#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*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void numFingers(int answer) {
  int fingers;
  printf("\n How many fingers am I holding up?\n");
  scanf("%d", &fingers);
  getchar();
  if (fingers == answer) {
    printf("\t Correct!\n");
  } else if (fingers > 10 || fingers < 0) {
    printf("\t That is not possible with two hands!\n");
  } else {
    printf("\t Wrong.  Try again.\n");
  }
}


x86 assembly (clang, -O0):
<numFingers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    117b <numFingers+0x4b>
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
jmp    11b1 <numFingers+0x81>
cmpl   $0xa,-0x8(%rbp)
jg     118f <numFingers+0x5f>
cmpl   $0x0,-0x8(%rbp)
jge    11a0 <numFingers+0x70>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
jmp    11ac <numFingers+0x7c>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
jmp    11b1 <numFingers+0x81>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<numFingers>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb6(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0xc(%rsp),%eax
cmp    $0xb,%eax
lea    0xed3(%rip),%rcx
lea    0xeb7(%rip),%rdx
cmovae %rcx,%rdx
cmp    %ebx,%eax
lea    0xee6(%rip),%rdi
cmovne %rdx,%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"\0A How many fingers am I holding up?\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"\09 Correct!\0A\00"
@.str.3 = [40 x i8] c"\09 That is not possible with two hands!\0A\00"
@.str.4 = [22 x i8] c"\09 Wrong. Try again.\0A\00"
define void @numFingers(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%6 = call i32 (...) @getchar()
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %23
12: ; preds = %1
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 10
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15, %12
%19 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
br label %22
20: ; preds = %15
%21 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %22
22: ; preds = %20, %18
br label %23
23: ; preds = %22, %10
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [36 x i8] c"\0A How many fingers am I holding up?\00"
@str.5 = [21 x i8] c"\09 Wrong. Try again.\00"
@str.6 = [39 x i8] c"\09 That is not possible with two hands!\00"
@str.7 = [11 x i8] c"\09 Correct!\00"
define void @numFingers(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = call i32 (...) @getchar()
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, %0
%9 = icmp ugt i32 %7, 10
%10 = select i1 %9, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @str.6, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str.5, i64 0, i64 0)
%11 = select i1 %8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @str.7, i64 0, i64 0), i8* %10
%12 = call i32 @puts(i8* dereferenceable(1) %11)
ret void
}