#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 getNode(struct Node *, int);
int /*<<< orphan*/ insertNode(struct Node **, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  struct Node *head = NULL;
  insertNode(&head, 5);
  insertNode(&head, 4);
  insertNode(&head, 3);
  insertNode(&head, 1);
  int val = getNode(head, 3);
  printf("The 3rd node is %d\n", val);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   1030 <insertNode@plt>
lea    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1030 <insertNode@plt>
lea    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1030 <insertNode@plt>
lea    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1030 <insertNode@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1050 <getNode@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe66(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <insertNode@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <insertNode@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <insertNode@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <insertNode@plt>
mov    0x8(%rsp),%rdi
mov    $0x3,%esi
call   1050 <getNode@plt>
lea    0xe73(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.Node = type { i32 }
@.str = [20 x i8] c"The 3rd node is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.Node*
%3 = alloca i32
store i32 0, i32* %1
store %struct.Node* null, %struct.Node** %2
%4 = call i32 @insertNode(%struct.Node** %2, i32 5)
%5 = call i32 @insertNode(%struct.Node** %2, i32 4)
%6 = call i32 @insertNode(%struct.Node** %2, i32 3)
%7 = call i32 @insertNode(%struct.Node** %2, i32 1)
%8 = load %struct.Node*, %struct.Node** %2
%9 = call i32 @getNode(%struct.Node* %8, i32 3)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
%struct.Node = type { i32 }
@.str = [20 x i8] c"The 3rd node is %d\0A\00"
define i32 @main() {
%1 = alloca %struct.Node*
%2 = bitcast %struct.Node** %1 to i8*
store %struct.Node* null, %struct.Node** %1
%3 = call i32 @insertNode(%struct.Node** %1, i32 5)
%4 = call i32 @insertNode(%struct.Node** %1, i32 4)
%5 = call i32 @insertNode(%struct.Node** %1, i32 3)
%6 = call i32 @insertNode(%struct.Node** %1, i32 1)
%7 = load %struct.Node*, %struct.Node** %1
%8 = call i32 @getNode(%struct.Node* %7, i32 3)
%9 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}