#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 LinkedListNode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ middle(struct LinkedListNode *);
int /*<<< orphan*/ printList(struct LinkedListNode *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ push(struct LinkedListNode **, int);
int main(void) {
  struct LinkedListNode *head = NULL;
  middle(head);
  push(&head, 4);
  middle(head);
  push(&head, 11);
  middle(head);
  push(&head, 7);
  push(&head, 8);
  push(&head, 5);
  push(&head, 14);
  push(&head, 3);
  push(&head, 2);
  push(&head, 1);
  printf("\nGiven linked list \n");
  printList(head);
  middle(head);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <middle@plt>
lea    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1040 <push@plt>
mov    -0x10(%rbp),%rdi
call   1050 <middle@plt>
lea    -0x10(%rbp),%rdi
mov    $0xb,%esi
call   1040 <push@plt>
mov    -0x10(%rbp),%rdi
call   1050 <middle@plt>
lea    -0x10(%rbp),%rdi
mov    $0x7,%esi
call   1040 <push@plt>
lea    -0x10(%rbp),%rdi
mov    $0x8,%esi
call   1040 <push@plt>
lea    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   1040 <push@plt>
lea    -0x10(%rbp),%rdi
mov    $0xe,%esi
call   1040 <push@plt>
lea    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1040 <push@plt>
lea    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1040 <push@plt>
lea    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1040 <push@plt>
lea    0xe09(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1060 <printList@plt>
mov    -0x10(%rbp),%rdi
call   1050 <middle@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
xor    %edi,%edi
call   1050 <middle@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <push@plt>
mov    0x8(%rsp),%rdi
call   1050 <middle@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
call   1040 <push@plt>
mov    0x8(%rsp),%rdi
call   1050 <middle@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1040 <push@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1040 <push@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <push@plt>
mov    %rbx,%rdi
mov    $0xe,%esi
call   1040 <push@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <push@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <push@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <push@plt>
lea    0xe16(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%rdi
call   1060 <printList@plt>
mov    0x8(%rsp),%rdi
call   1050 <middle@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.LinkedListNode = type { i32 }
@str = [20 x i8] c"\0AGiven linked list \00"
define i32 @main() {
%1 = alloca %struct.LinkedListNode*
%2 = bitcast %struct.LinkedListNode** %1 to i8*
store %struct.LinkedListNode* null, %struct.LinkedListNode** %1
%3 = tail call i32 @middle(%struct.LinkedListNode* null)
%4 = call i32 @push(%struct.LinkedListNode** %1, i32 4)
%5 = load %struct.LinkedListNode*, %struct.LinkedListNode** %1
%6 = call i32 @middle(%struct.LinkedListNode* %5)
%7 = call i32 @push(%struct.LinkedListNode** %1, i32 11)
%8 = load %struct.LinkedListNode*, %struct.LinkedListNode** %1
%9 = call i32 @middle(%struct.LinkedListNode* %8)
%10 = call i32 @push(%struct.LinkedListNode** %1, i32 7)
%11 = call i32 @push(%struct.LinkedListNode** %1, i32 8)
%12 = call i32 @push(%struct.LinkedListNode** %1, i32 5)
%13 = call i32 @push(%struct.LinkedListNode** %1, i32 14)
%14 = call i32 @push(%struct.LinkedListNode** %1, i32 3)
%15 = call i32 @push(%struct.LinkedListNode** %1, i32 2)
%16 = call i32 @push(%struct.LinkedListNode** %1, i32 1)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%18 = load %struct.LinkedListNode*, %struct.LinkedListNode** %1
%19 = call i32 @printList(%struct.LinkedListNode* %18)
%20 = load %struct.LinkedListNode*, %struct.LinkedListNode** %1
%21 = call i32 @middle(%struct.LinkedListNode* %20)
ret i32 0
}