#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 */
int /*<<< orphan*/ MergeSort(struct node **);
int /*<<< orphan*/ Push(struct node **, int);
int /*<<< orphan*/ free_linked_list(struct node *);
int /*<<< orphan*/ print_linked_list(char *, struct node **);
int main(int argc, char const *argv[]) {
  struct node *head = NULL;
  Push(&head, 10);
  Push(&head, 9);
  Push(&head, 8);
  Push(&head, 7);
  Push(&head, 6);
  Push(&head, 5);
  Push(&head, 4);
  Push(&head, 3);
  Push(&head, 2);
  Push(&head, 1);
  print_linked_list("main", &head);
  MergeSort(&head);
  print_linked_list("main", &head);
  free_linked_list(head);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
mov    $0xa,%esi
call   1050 <Push@plt>
lea    -0x18(%rbp),%rdi
mov    $0x9,%esi
call   1050 <Push@plt>
lea    -0x18(%rbp),%rdi
mov    $0x8,%esi
call   1050 <Push@plt>
lea    -0x18(%rbp),%rdi
mov    $0x7,%esi
call   1050 <Push@plt>
lea    -0x18(%rbp),%rdi
mov    $0x6,%esi
call   1050 <Push@plt>
lea    -0x18(%rbp),%rdi
mov    $0x5,%esi
call   1050 <Push@plt>
lea    -0x18(%rbp),%rdi
mov    $0x4,%esi
call   1050 <Push@plt>
lea    -0x18(%rbp),%rdi
mov    $0x3,%esi
call   1050 <Push@plt>
lea    -0x18(%rbp),%rdi
mov    $0x2,%esi
call   1050 <Push@plt>
lea    -0x18(%rbp),%rdi
mov    $0x1,%esi
call   1050 <Push@plt>
lea    0xe0f(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <print_linked_list@plt>
lea    -0x18(%rbp),%rdi
call   1060 <MergeSort@plt>
lea    0xdf6(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <print_linked_list@plt>
mov    -0x18(%rbp),%rdi
call   1040 <free_linked_list@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movq   $0x0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <Push@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1050 <Push@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1050 <Push@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1050 <Push@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1050 <Push@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <Push@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1050 <Push@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1050 <Push@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <Push@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1050 <Push@plt>
lea    0xe28(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <print_linked_list@plt>
mov    %rbx,%rdi
call   1060 <MergeSort@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <print_linked_list@plt>
mov    (%rsp),%rdi
call   1040 <free_linked_list@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [5 x i8] c"main\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.node*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.node* null, %struct.node** %6
%7 = call i32 @Push(%struct.node** %6, i32 10)
%8 = call i32 @Push(%struct.node** %6, i32 9)
%9 = call i32 @Push(%struct.node** %6, i32 8)
%10 = call i32 @Push(%struct.node** %6, i32 7)
%11 = call i32 @Push(%struct.node** %6, i32 6)
%12 = call i32 @Push(%struct.node** %6, i32 5)
%13 = call i32 @Push(%struct.node** %6, i32 4)
%14 = call i32 @Push(%struct.node** %6, i32 3)
%15 = call i32 @Push(%struct.node** %6, i32 2)
%16 = call i32 @Push(%struct.node** %6, i32 1)
%17 = call i32 @print_linked_list(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %struct.node** %6)
%18 = call i32 @MergeSort(%struct.node** %6)
%19 = call i32 @print_linked_list(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %struct.node** %6)
%20 = load %struct.node*, %struct.node** %6
%21 = call i32 @free_linked_list(%struct.node* %20)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [5 x i8] c"main\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.node*
%4 = bitcast %struct.node** %3 to i8*
store %struct.node* null, %struct.node** %3
%5 = call i32 @Push(%struct.node** %3, i32 10)
%6 = call i32 @Push(%struct.node** %3, i32 9)
%7 = call i32 @Push(%struct.node** %3, i32 8)
%8 = call i32 @Push(%struct.node** %3, i32 7)
%9 = call i32 @Push(%struct.node** %3, i32 6)
%10 = call i32 @Push(%struct.node** %3, i32 5)
%11 = call i32 @Push(%struct.node** %3, i32 4)
%12 = call i32 @Push(%struct.node** %3, i32 3)
%13 = call i32 @Push(%struct.node** %3, i32 2)
%14 = call i32 @Push(%struct.node** %3, i32 1)
%15 = call i32 @print_linked_list(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %struct.node** %3)
%16 = call i32 @MergeSort(%struct.node** %3)
%17 = call i32 @print_linked_list(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %struct.node** %3)
%18 = load %struct.node*, %struct.node** %3
%19 = call i32 @free_linked_list(%struct.node* %18)
ret i32 0
}