#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 *makeList();
struct node *partition(struct node *, int);
int /*<<< orphan*/ printList(struct node *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  struct node *list = makeList();
  printList(list);
  int x;
  printf("Please enter X value: ");
  scanf("%d", &x);
  list = partition(list, x);
  printList(list);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <makeList@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <printList@plt>
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
lea    0xe91(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <partition@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <printList@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1050 <makeList@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <printList@plt>
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9d(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <partition@plt>
mov    %rax,%rdi
call   1070 <printList@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [23 x i8] c"Please enter X value: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.node*
%3 = alloca i32
store i32 0, i32* %1
%4 = call %struct.node* (...) @makeList()
store %struct.node* %4, %struct.node** %2
%5 = load %struct.node*, %struct.node** %2
%6 = call i32 @printList(%struct.node* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = load %struct.node*, %struct.node** %2
%10 = load i32, i32* %3
%11 = call %struct.node* @partition(%struct.node* %9, i32 %10)
store %struct.node* %11, %struct.node** %2
%12 = load %struct.node*, %struct.node** %2
%13 = call i32 @printList(%struct.node* %12)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [23 x i8] c"Please enter X value: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call %struct.node* (...) @makeList()
%3 = tail call i32 @printList(%struct.node* %2)
%4 = bitcast i32* %1 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = call %struct.node* @partition(%struct.node* %2, i32 %7)
%9 = call i32 @printList(%struct.node* %8)
ret i32 0
}