typedef struct List_ {
  int head;
  struct List_ *tail;
} List;

void reverse(List *l) {
  List *prev, *curr, *next;
  for (prev = NULL, curr = l, next = NULL; curr != NULL; curr = next) {
    next = curr->tail;
    curr->tail = prev;
    prev = curr;
  }
}