#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int get_user_input(void) {
  int input = 0;
  printf("\033[32m"
         "create list:              %d\n"
         "\033[m",
         1);
  printf("\033[32m"
         "insert item:              %d\n"
         "\033[m",
         2);
  printf("\033[32m"
         "delete item:              %d\n"
         "\033[m",
         3);
  printf("\033[32m"
         "find middle:              %d\n"
         "\033[m",
         4);
  printf("\033[32m"
         "print list:               %d\n"
         "\033[m",
         5);
  printf("\033[32m"
         "reverse list (iterative): %d \n"
         "\033[m",
         6);
  printf("\033[32m"
         "reverse list (recursive): %d \n"
         "\033[m",
         7);
  printf("\033[32m"
         "quit:                     %d\n"
         "\033[m",
         0);
  printf("\033[31m"
         "?? "
         "\033[m");
  scanf("%d", &input);
  return input;
}


x86 assembly (clang, -O0):
<get_user_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
mov    $0x3,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf03(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf16(%rip),%rdi
mov    $0x5,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf29(%rip),%rdi
mov    $0x6,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf3d(%rip),%rdi
mov    $0x7,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf51(%rip),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf65(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_user_input>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xed0(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf09(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf1c(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf2f(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf43(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf57(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf6d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf6b(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"\1B[32mcreate list: %d\0A\1B[m\00"
@.str.1 = [38 x i8] c"\1B[32minsert item: %d\0A\1B[m\00"
@.str.2 = [38 x i8] c"\1B[32mdelete item: %d\0A\1B[m\00"
@.str.3 = [38 x i8] c"\1B[32mfind middle: %d\0A\1B[m\00"
@.str.4 = [38 x i8] c"\1B[32mprint list: %d\0A\1B[m\00"
@.str.5 = [39 x i8] c"\1B[32mreverse list (iterative): %d \0A\1B[m\00"
@.str.6 = [39 x i8] c"\1B[32mreverse list (recursive): %d \0A\1B[m\00"
@.str.7 = [38 x i8] c"\1B[32mquit: %d\0A\1B[m\00"
@.str.8 = [12 x i8] c"\1B[31m?? \1B[m\00"
@.str.9 = [3 x i8] c"%d\00"
define i32 @get_user_input() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 1)
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 2)
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i32 6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i32 7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i32 0)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@.str = [38 x i8] c"\1B[32mcreate list: %d\0A\1B[m\00"
@.str.1 = [38 x i8] c"\1B[32minsert item: %d\0A\1B[m\00"
@.str.2 = [38 x i8] c"\1B[32mdelete item: %d\0A\1B[m\00"
@.str.3 = [38 x i8] c"\1B[32mfind middle: %d\0A\1B[m\00"
@.str.4 = [38 x i8] c"\1B[32mprint list: %d\0A\1B[m\00"
@.str.5 = [39 x i8] c"\1B[32mreverse list (iterative): %d \0A\1B[m\00"
@.str.6 = [39 x i8] c"\1B[32mreverse list (recursive): %d \0A\1B[m\00"
@.str.7 = [38 x i8] c"\1B[32mquit: %d\0A\1B[m\00"
@.str.8 = [12 x i8] c"\1B[31m?? \1B[m\00"
@.str.9 = [3 x i8] c"%d\00"
define i32 @get_user_input() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 2)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 3)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 4)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 5)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i32 6)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), i32 7)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i32 0)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
ret i32 %13
}