#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct Node {
  int dummy;
};

/* Variables and functions */
struct Node *insertNode(struct Node *, int);
int /*<<< orphan*/ printLinkedList(struct Node *);
struct Node *reverseLinkedList(struct Node *);
int main(void) {
  struct Node *head;
  struct Node *one;
  struct Node *two;
  struct Node *three;
  head = NULL;
  head = insertNode(head, 1);
  head = insertNode(head, 2);
  head = insertNode(head, 3);
  head = insertNode(head, 4);
  printLinkedList(head);
  head = reverseLinkedList(head);
  printLinkedList(head);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <insertNode@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
call   1030 <insertNode@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
call   1030 <insertNode@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1030 <insertNode@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <printLinkedList@plt>
mov    -0x8(%rbp),%rdi
call   1040 <reverseLinkedList@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <printLinkedList@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <insertNode@plt>
mov    %rax,%rdi
mov    $0x2,%esi
call   1030 <insertNode@plt>
mov    %rax,%rdi
mov    $0x3,%esi
call   1030 <insertNode@plt>
mov    %rax,%rdi
mov    $0x4,%esi
call   1030 <insertNode@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <printLinkedList@plt>
mov    %rbx,%rdi
call   1040 <reverseLinkedList@plt>
mov    %rax,%rdi
call   1050 <printLinkedList@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.Node = type { i32 }
define i32 @main() {
%1 = alloca %struct.Node*
%2 = alloca %struct.Node*
%3 = alloca %struct.Node*
%4 = alloca %struct.Node*
store %struct.Node* null, %struct.Node** %1
%5 = load %struct.Node*, %struct.Node** %1
%6 = call %struct.Node* @insertNode(%struct.Node* %5, i32 1)
store %struct.Node* %6, %struct.Node** %1
%7 = load %struct.Node*, %struct.Node** %1
%8 = call %struct.Node* @insertNode(%struct.Node* %7, i32 2)
store %struct.Node* %8, %struct.Node** %1
%9 = load %struct.Node*, %struct.Node** %1
%10 = call %struct.Node* @insertNode(%struct.Node* %9, i32 3)
store %struct.Node* %10, %struct.Node** %1
%11 = load %struct.Node*, %struct.Node** %1
%12 = call %struct.Node* @insertNode(%struct.Node* %11, i32 4)
store %struct.Node* %12, %struct.Node** %1
%13 = load %struct.Node*, %struct.Node** %1
%14 = call i32 @printLinkedList(%struct.Node* %13)
%15 = load %struct.Node*, %struct.Node** %1
%16 = call %struct.Node* @reverseLinkedList(%struct.Node* %15)
store %struct.Node* %16, %struct.Node** %1
%17 = load %struct.Node*, %struct.Node** %1
%18 = call i32 @printLinkedList(%struct.Node* %17)
ret i32 0
}

LLVM IR (-O2):
%struct.Node = type { i32 }
define i32 @main() {
%1 = tail call %struct.Node* @insertNode(%struct.Node* null, i32 1)
%2 = tail call %struct.Node* @insertNode(%struct.Node* %1, i32 2)
%3 = tail call %struct.Node* @insertNode(%struct.Node* %2, i32 3)
%4 = tail call %struct.Node* @insertNode(%struct.Node* %3, i32 4)
%5 = tail call i32 @printLinkedList(%struct.Node* %4)
%6 = tail call %struct.Node* @reverseLinkedList(%struct.Node* %4)
%7 = tail call i32 @printLinkedList(%struct.Node* %6)
ret i32 0
}