#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 atoi(char *);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ showPrefixAndPostfixOps();
int main(int argc, char **argv) {
  int age;
  int bonus;
  char agestring[10];
  bool playagain = true;
  int a = 10;
  int b = 2;
  while (playagain == true) {
    printf("Please input your age, input 'Q' to quit:\n");
    gets(agestring);
    age = atoi(agestring);
    if (agestring[0] == 'q' || agestring[0] == 'Q') {
      playagain = false;
    } else if (age <= 0) {
      printf(
          "You entered an invalid age, so your bonus cannot be calculated.\n");
    } else {
      if (age > 45)
        bonus = 1000;
      else
        bonus = 500;
      printf("Your age is %d, so your bonus is %d.\n", age, bonus);
      if (age < 50) {
        printf("You are one of our youngest employees!\n");
      }
      if (bonus >= 1000) {
        printf("You've earned a high bonus!\n");
      }
    }
  }
  showPrefixAndPostfixOps();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x28(%rbp)
movl   $0xa,-0x2c(%rbp)
movl   $0x2,-0x30(%rbp)
cmpl   $0x1,-0x28(%rbp)
jne    124e <main+0x10e>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x22(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x22(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
movsbl -0x22(%rbp),%eax
cmp    $0x71,%eax
je     11b2 <main+0x72>
movsbl -0x22(%rbp),%eax
cmp    $0x51,%eax
jne    11be <main+0x7e>
movl   $0x0,-0x28(%rbp)
jmp    1249 <main+0x109>
cmpl   $0x0,-0x14(%rbp)
jg     11db <main+0x9b>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1244 <main+0x104>
cmpl   $0x2d,-0x14(%rbp)
jle    11f1 <main+0xb1>
movl   $0x3e8,-0x18(%rbp)
jmp    11f8 <main+0xb8>
movl   $0x1f4,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x32,-0x14(%rbp)
jge    1224 <main+0xe4>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x3e8,-0x18(%rbp)
jl     123f <main+0xff>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1244 <main+0x104>
jmp    1249 <main+0x109>
jmp    116b <main+0x2b>
mov    $0x0,%al
call   1030 <showPrefixAndPostfixOps@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    0xe(%rsp),%rdi
call   1060 <gets@plt>
mov    0xe(%rsp),%al
and    $0xdf,%al
cmp    $0x51,%al
jne    1196 <main+0x46>
xor    %eax,%eax
call   1040 <showPrefixAndPostfixOps@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
lea    0xee7(%rip),%r13
lea    0xe73(%rip),%r14
lea    0xe46(%rip),%r15
lea    0xe8f(%rip),%r12
jmp    11fa <main+0xaa>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1060 <gets@plt>
mov    %rbx,%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
movzbl 0xe(%rsp),%eax
and    $0xdf,%al
cmp    $0x51,%al
je     117e <main+0x2e>
mov    %r13,%rdi
test   %ebp,%ebp
jle    11d0 <main+0x80>
cmp    $0x2e,%ebp
mov    $0x1f4,%edx
mov    $0x3e8,%eax
cmovae %eax,%edx
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x31,%ebp
ja     122e <main+0xde>
lea    0xe43(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
cmp    $0x2e,%ebp
jae    11d0 <main+0x80>
jmp    11d5 <main+0x85>

LLVM IR (-O0):
@.str = [43 x i8] c"Please input your age, input 'Q' to quit:\0A\00"
@.str.1 = [65 x i8] c"You entered an invalid age, so your bonus cannot be calculated.\0A\00"
@.str.2 = [38 x i8] c"Your age is %d, so your bonus is %d.\0A\00"
@.str.3 = [40 x i8] c"You are one of our youngest employees!\0A\00"
@.str.4 = [29 x i8] c"You've earned a high bonus!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [10 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %9
store i32 10, i32* %10
store i32 2, i32* %11
br label %12
12: ; preds = %56, %2
%13 = load i32, i32* %9
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %57
15: ; preds = %12
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%18 = call i32 @gets(i8* %17)
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %6
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 113
br i1 %24, label %30, label %25
25: ; preds = %15
%26 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 81
br i1 %29, label %30, label %31
30: ; preds = %25, %15
store i32 0, i32* %9
br label %56
31: ; preds = %25
%32 = load i32, i32* %6
%33 = icmp sle i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
br label %55
36: ; preds = %31
%37 = load i32, i32* %6
%38 = icmp sgt i32 %37, 45
br i1 %38, label %39, label %40
39: ; preds = %36
store i32 1000, i32* %7
br label %41
40: ; preds = %36
store i32 500, i32* %7
br label %41
41: ; preds = %40, %39
%42 = load i32, i32* %6
%43 = load i32, i32* %7
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %42, i32 %43)
%45 = load i32, i32* %6
%46 = icmp slt i32 %45, 50
br i1 %46, label %47, label %49
47: ; preds = %41
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
br label %49
49: ; preds = %47, %41
%50 = load i32, i32* %7
%51 = icmp sge i32 %50, 1000
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
br label %54
54: ; preds = %52, %49
br label %55
55: ; preds = %54, %34
br label %56
56: ; preds = %55, %30
br label %12
57: ; preds = %12
%58 = call i32 (...) @showPrefixAndPostfixOps()
%59 = load i32, i32* %3
ret i32 %59
}

LLVM IR (-O2):
@.str.2 = [38 x i8] c"Your age is %d, so your bonus is %d.\0A\00"
@str = [42 x i8] c"Please input your age, input 'Q' to quit:\00"
@str.5 = [28 x i8] c"You've earned a high bonus!\00"
@str.6 = [39 x i8] c"You are one of our youngest employees!\00"
@str.7 = [64 x i8] c"You entered an invalid age, so your bonus cannot be calculated.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%6 = call i32 @gets(i8* %4)
%7 = load i8, i8* %4
%8 = and i8 %7, -33
%9 = icmp eq i8 %8, 81
br i1 %9, label %33, label %10
10: ; preds = %2
%11 = call i32 @atoi(i8* %4)
br label %12
12: ; preds = %10, %26
%13 = phi i32 [ %11, %10 ], [ %29, %26 ]
%14 = icmp slt i32 %13, 1
br i1 %14, label %23, label %15
15: ; preds = %12
%16 = icmp ugt i32 %13, 45
%17 = select i1 %16, i32 1000, i32 500
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %13, i32 %17)
%19 = icmp ult i32 %13, 50
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.6, i64 0, i64 0))
br label %22
22: ; preds = %20, %15
br i1 %16, label %23, label %26
23: ; preds = %22, %12
%24 = phi i8* [ getelementptr inbounds ([64 x i8], [64 x i8]* @str.7, i64 0, i64 0), %12 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @str.5, i64 0, i64 0), %22 ]
%25 = call i32 @puts(i8* dereferenceable(1) %24)
br label %26
26: ; preds = %23, %22
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%28 = call i32 @gets(i8* %4)
%29 = call i32 @atoi(i8* %4)
%30 = load i8, i8* %4
%31 = and i8 %30, -33
%32 = icmp eq i8 %31, 81
br i1 %32, label %33, label %12
33: ; preds = %26, %2
%34 = call i32 (...) @showPrefixAndPostfixOps()
ret i32 0
}