#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*/ SIGPIPE;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ listChoices();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ processChoice(int);
scalar_t__ scanf(char *, int *);
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  signal(SIGPIPE, SIG_IGN);
  int choice;
  listChoices();
  while (scanf("%d", &choice)) {
    processChoice(choice);
    printf("Make a choice: ");
  }
  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)
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
mov    0x2e72(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    $0x0,%al
call   1070 <listChoices@plt>
lea    0xe75(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
cmp    $0x0,%rax
je     11b7 <main+0x67>
mov    -0x14(%rbp),%edi
call   1050 <processChoice@plt>
lea    0xe56(%rip),%rdi
call   1030 <printf@plt>
jmp    1184 <main+0x34>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
mov    0x2e7f(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
xor    %eax,%eax
call   1070 <listChoices@plt>
lea    0xe82(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
test   %rax,%rax
je     11c1 <main+0x71>
lea    0xe6f(%rip),%r14
lea    0xe65(%rip),%r15
lea    0xc(%rsp),%rbx
mov    0xc(%rsp),%edi
call   1050 <processChoice@plt>
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
test   %rax,%rax
jne    11a0 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@SIGPIPE = global i32 0
@SIG_IGN = global i32 0
@.str = [3 x i8] c"%d\00"
@.str.1 = [16 x i8] c"Make a choice: \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* @SIGPIPE
%8 = load i32, i32* @SIG_IGN
%9 = call i32 @signal(i32 %7, i32 %8)
%10 = call i32 (...) @listChoices()
br label %11
11: ; preds = %14, %2
%12 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i32, i32* %6
%16 = call i32 @processChoice(i32 %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %11
18: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@SIGPIPE = global i32 0
@SIG_IGN = global i32 0
@.str = [3 x i8] c"%d\00"
@.str.1 = [16 x i8] c"Make a choice: \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = load i32, i32* @SIGPIPE
%5 = load i32, i32* @SIG_IGN
%6 = tail call i32 @signal(i32 %4, i32 %5)
%7 = bitcast i32* %3 to i8*
%8 = tail call i32 (...) @listChoices()
%9 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = icmp eq i64 %9, 0
br i1 %10, label %17, label %11
11: ; preds = %2, %11
%12 = load i32, i32* %3
%13 = call i32 @processChoice(i32 %12)
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%15 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %11
17: ; preds = %11, %2
ret i32 0
}