  wapp_debug_assert(list != NULL, "`list` should not be NULL");

  {NodeType} *output = NULL;

  if (index == 0) {{
    output = wapp_{Tlower}_list_pop_front(list);
    goto RETURN_{Tupper}_LIST_REMOVE;
  }} else if (index == list->node_count) {{
    output = wapp_{Tlower}_list_pop_back(list);
    goto RETURN_{Tupper}_LIST_REMOVE;
  }}

  output = wapp_{Tlower}_list_get(list, index);
  if (!output) {{
    goto RETURN_{Tupper}_LIST_REMOVE;
  }}

  output->prev->next = output->next;
  output->next->prev = output->prev;

  --(list->node_count);

  output->prev = output->next = NULL;

RETURN_{Tupper}_LIST_REMOVE:
  return output;
