#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 main(void) {
  int c = 1, n, pass = 0, fail = 0;
  while (c <= 10) {
    printf("\nplease enter 1 or 2: ");
    scanf("%d", &n);
    if (1 == n) {
      pass = pass + 1;
      printf("\n\t% d - passes = %d\n", c, pass);
      c++;
    } else if (2 == n) {
      fail = fail + 1;
      printf("\n\t %d - fails = %d\n", c, fail);
      c++;
    } else {
      printf("\n %d - please enter a valid input!!!", c);
    }
  }
  printf("\n\npass = %d\tfail=%d", pass, fail);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x8(%rbp)
jg     11f9 <main+0xd9>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf13(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%eax
cmp    -0xc(%rbp),%eax
jne    11a5 <main+0x85>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11f4 <main+0xd4>
mov    $0x2,%eax
cmp    -0xc(%rbp),%eax
jne    11de <main+0xbe>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ef <main+0xcf>
mov    -0x8(%rbp),%esi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f4 <main+0xd4>
jmp    1144 <main+0x24>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x1,%ebx
lea    0xec9(%rip),%r14
lea    0xf38(%rip),%r12
lea    0x4(%rsp),%r13
xor    %r15d,%r15d
xor    %ebp,%ebp
jmp    1165 <main+0x45>
nopw   0x0(%rax,%rax,1)
lea    0xee9(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0xb,%ebx
jge    11bf <main+0x9f>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
je     11a0 <main+0x80>
cmp    $0x1,%eax
jne    1150 <main+0x30>
add    $0x1,%ebp
lea    0xe85(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
jmp    11b0 <main+0x90>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15d
lea    0xe81(%rip),%rdi
mov    %ebx,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0xb,%ebx
jl     1165 <main+0x45>
lea    0xe9f(%rip),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\0Aplease enter 1 or 2: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [21 x i8] c"\0A\09% d - passes = %d\0A\00"
@.str.3 = [20 x i8] c"\0A\09 %d - fails = %d\0A\00"
@.str.4 = [37 x i8] c"\0A %d - please enter a valid input!!!\00"
@.str.5 = [20 x i8] c"\0A\0Apass = %d\09fail=%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %37, %0
%7 = load i32, i32* %2
%8 = icmp sle i32 %7, 10
br i1 %8, label %9, label %38
9: ; preds = %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 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* %3)
%12 = load i32, i32* %3
%13 = icmp eq i32 1, %12
br i1 %13, label %14, label %22
14: ; preds = %9
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
%17 = load i32, i32* %2
%18 = load i32, i32* %4
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %17, i32 %18)
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %37
22: ; preds = %9
%23 = load i32, i32* %3
%24 = icmp eq i32 2, %23
br i1 %24, label %25, label %33
25: ; preds = %22
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
%28 = load i32, i32* %2
%29 = load i32, i32* %5
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %28, i32 %29)
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
br label %36
33: ; preds = %22
%34 = load i32, i32* %2
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %33, %25
br label %37
37: ; preds = %36, %14
br label %6
38: ; preds = %6
%39 = load i32, i32* %4
%40 = load i32, i32* %5
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %39, i32 %40)
%42 = load i32, i32* %1
ret i32 %42
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0Aplease enter 1 or 2: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [21 x i8] c"\0A\09% d - passes = %d\0A\00"
@.str.3 = [20 x i8] c"\0A\09 %d - fails = %d\0A\00"
@.str.4 = [37 x i8] c"\0A %d - please enter a valid input!!!\00"
@.str.5 = [20 x i8] c"\0A\0Apass = %d\09fail=%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %0, %20
%4 = phi i32 [ 0, %0 ], [ %23, %20 ]
%5 = phi i32 [ 0, %0 ], [ %22, %20 ]
%6 = phi i32 [ 1, %0 ], [ %21, %20 ]
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) 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* %1)
%9 = load i32, i32* %1
switch i32 %9, label %18 [
i32 1, label %10
i32 2, label %14
]
10: ; preds = %3
%11 = add nsw i32 %5, 1
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %11)
%13 = add nsw i32 %6, 1
br label %20
14: ; preds = %3
%15 = add nsw i32 %4, 1
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %6, i32 %15)
%17 = add nsw i32 %6, 1
br label %20
18: ; preds = %3
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i32 %6)
br label %20
20: ; preds = %14, %18, %10
%21 = phi i32 [ %13, %10 ], [ %17, %14 ], [ %6, %18 ]
%22 = phi i32 [ %11, %10 ], [ %5, %14 ], [ %5, %18 ]
%23 = phi i32 [ %4, %10 ], [ %15, %14 ], [ %4, %18 ]
%24 = icmp slt i32 %21, 11
br i1 %24, label %3, label %25
25: ; preds = %20
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %22, i32 %23)
ret i32 0
}