#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 human_choice(int pile) {
  int choice;
  int trigger = 0;
  while (trigger == 0) {
    printf("Enter a number between 1-3, that is less than the pile:\n");
    scanf("%d", &choice);
    if ((choice == 1 || choice == 2 || choice == 3) && choice <= pile) {
      trigger = 1;
      return choice;
    }
  }
  return choice;
}


x86 assembly (clang, -O0):
<human_choice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1199 <human_choice+0x79>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0xc(%rbp)
je     1176 <human_choice+0x56>
cmpl   $0x2,-0xc(%rbp)
je     1176 <human_choice+0x56>
cmpl   $0x3,-0xc(%rbp)
jne    1194 <human_choice+0x74>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1194 <human_choice+0x74>
movl   $0x1,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    119f <human_choice+0x7f>
jmp    1132 <human_choice+0x12>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<human_choice>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xed2(%rip),%r14
lea    0xec8(%rip),%r15
lea    0x4(%rsp),%r12
nopl   (%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x4(%rax),%ecx
cmp    %ebx,%eax
jg     1140 <human_choice+0x20>
cmp    $0xfffffffd,%ecx
jb     1140 <human_choice+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [57 x i8] c"Enter a number between 1-3, that is less than the pile:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @human_choice(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %5
br label %6
6: ; preds = %26, %1
%7 = load i32, i32* %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %27
9: ; preds = %6
%10 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 1
br i1 %13, label %20, label %14
14: ; preds = %9
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 2
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, 3
br i1 %19, label %20, label %26
20: ; preds = %17, %14, %9
%21 = load i32, i32* %4
%22 = load i32, i32* %3
%23 = icmp sle i32 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %20
store i32 1, i32* %5
%25 = load i32, i32* %4
store i32 %25, i32* %2
br label %29
26: ; preds = %20, %17
br label %6
27: ; preds = %6
%28 = load i32, i32* %4
store i32 %28, i32* %2
br label %29
29: ; preds = %27, %24
%30 = load i32, i32* %2
ret i32 %30
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [56 x i8] c"Enter a number between 1-3, that is less than the pile:\00"
define i32 @human_choice(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
br label %4
4: ; preds = %4, %1
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 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* %2)
%7 = load i32, i32* %2
%8 = add i32 %7, -4
%9 = icmp ult i32 %8, -3
%10 = icmp sgt i32 %7, %0
%11 = or i1 %10, %9
br i1 %11, label %4, label %12
12: ; preds = %4
ret i32 %7
}