#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int result;
  unsigned int passes = 0;
  unsigned int failures = 0;
  unsigned int student = 1;
  while (student <= 10) {
    printf("%s", "Enter result ( 1=pass,2=fail ): ");
    scanf("%d", &result);
    while (1 > result || result > 2) {
      printf("%s", "Enter result ( 1=pass,2=fail ): ");
      scanf("%d", &result);
    }
    if (result == 1) {
      passes = passes + 1;
    } else {
      failures = failures + 1;
    }
    student = student + 1;
  }
  printf("Passed %u\n", passes);
  printf("Failed %u\n", failures);
  if (passes > 8) {
    puts("Bonus to instructor!");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
ja     1209 <main+0xd9>
lea    0xe9b(%rip),%rdi
lea    0xe97(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x1,%al
mov    $0x1,%ecx
cmp    -0x8(%rbp),%ecx
mov    %al,-0x15(%rbp)
jg     11a0 <main+0x70>
cmpl   $0x2,-0x8(%rbp)
setg   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    11b0 <main+0x80>
jmp    11da <main+0xaa>
lea    0xe49(%rip),%rdi
lea    0xe45(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe58(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
jmp    1183 <main+0x53>
cmpl   $0x1,-0x8(%rbp)
jne    11f2 <main+0xc2>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11fb <main+0xcb>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1154 <main+0x24>
mov    -0xc(%rbp),%esi
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x8,-0xc(%rbp)
jbe    1241 <main+0x111>
lea    0xe01(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%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,%r14d
lea    0xeb8(%rip),%r12
lea    0xeb4(%rip),%r13
lea    0xece(%rip),%rbx
mov    %rsp,%rbp
xor    %r15d,%r15d
xor    %eax,%eax
jmp    1180 <main+0x50>
xor    %ecx,%ecx
xor    %edx,%edx
cmp    $0x1,%eax
setne  %cl
sete   %dl
mov    0x4(%rsp),%eax
add    %edx,%eax
add    %ecx,%r15d
add    $0x1,%r14d
cmp    $0xb,%r14d
je     11d5 <main+0xa5>
mov    %eax,0x4(%rsp)
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%eax
lea    -0x3(%rax),%ecx
cmp    $0xfffffffd,%ecx
ja     1160 <main+0x30>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%eax
lea    -0x3(%rax),%ecx
cmp    $0xfffffffe,%ecx
jb     11b0 <main+0x80>
jmp    1160 <main+0x30>
lea    0xe4b(%rip),%rdi
mov    %eax,%ebx
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe44(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x9,%ebx
jb     1209 <main+0xd9>
lea    0xe39(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [33 x i8] c"Enter result ( 1=pass,2=fail ): \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [11 x i8] c"Passed %u\0A\00"
@.str.4 = [11 x i8] c"Failed %u\0A\00"
@.str.5 = [21 x i8] c"Bonus to instructor!\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 0, i32* %3
store i32 0, i32* %4
store i32 1, i32* %5
br label %6
6: ; preds = %32, %0
%7 = load i32, i32* %5
%8 = icmp ule i32 %7, 10
br i1 %8, label %9, label %35
9: ; preds = %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %12
12: ; preds = %20, %9
%13 = load i32, i32* %2
%14 = icmp sgt i32 1, %13
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 2
br label %18
18: ; preds = %15, %12
%19 = phi i1 [ true, %12 ], [ %17, %15 ]
br i1 %19, label %20, label %23
20: ; preds = %18
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %12
23: ; preds = %18
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i32, i32* %3
%28 = add i32 %27, 1
store i32 %28, i32* %3
br label %32
29: ; preds = %23
%30 = load i32, i32* %4
%31 = add i32 %30, 1
store i32 %31, i32* %4
br label %32
32: ; preds = %29, %26
%33 = load i32, i32* %5
%34 = add i32 %33, 1
store i32 %34, i32* %5
br label %6
35: ; preds = %6
%36 = load i32, i32* %3
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %4
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %3
%41 = icmp ugt i32 %40, 8
br i1 %41, label %42, label %44
42: ; preds = %35
%43 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
br label %44
44: ; preds = %42, %35
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [33 x i8] c"Enter result ( 1=pass,2=fail ): \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [11 x i8] c"Passed %u\0A\00"
@.str.4 = [11 x i8] c"Failed %u\0A\00"
@.str.5 = [21 x i8] c"Bonus to instructor!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %0, %18
%4 = phi i32 [ 1, %0 ], [ %26, %18 ]
%5 = phi i32 [ 0, %0 ], [ %25, %18 ]
%6 = phi i32 [ 0, %0 ], [ %22, %18 ]
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = add i32 %9, -3
%11 = icmp ult i32 %10, -2
br i1 %11, label %12, label %18
12: ; preds = %3, %12
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%15 = load i32, i32* %1
%16 = add i32 %15, -3
%17 = icmp ult i32 %16, -2
br i1 %17, label %12, label %18
18: ; preds = %12, %3
%19 = phi i32 [ %9, %3 ], [ %15, %12 ]
%20 = icmp eq i32 %19, 1
%21 = zext i1 %20 to i32
%22 = add i32 %6, %21
%23 = xor i1 %20, true
%24 = zext i1 %23 to i32
%25 = add i32 %5, %24
%26 = add nuw nsw i32 %4, 1
%27 = icmp eq i32 %26, 11
br i1 %27, label %28, label %3
28: ; preds = %18
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %25)
%31 = icmp ugt i32 %22, 8
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
br label %34
34: ; preds = %32, %28
ret i32 0
}