#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 *);
main() {
  int age;
  int year;
  char math;
  int birth;
  int implvl = 0;
  int implvl2 = 0;
  printf("How old are you?\n");
  scanf("%i", &age);
  while (age > 100 || age < 0) {
    if (implvl == 10) {
      printf("If you're just going to lie to me then I don't want to talk to "
             "you. Goodbye.\n");
      return 0;
    }
    printf("I don't believe you. Let's try again.\n");
    switch (implvl2) {
    default:
      implvl2 = implvl + 1;
    }
    switch (implvl) {
    default:
      implvl = implvl2;
    }
    scanf("%i", &age);
  }
  printf("Great! Now, what year did you turn %i?\n", age);
  scanf("%i", &year);
  switch (birth) {
  default:
    birth = year - age;
  }
  printf("%i? That means you were born in the year %i!\n", year, birth);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x64,-0x8(%rbp)
mov    %al,-0x1d(%rbp)
jg     1174 <main+0x54>
cmpl   $0x0,-0x8(%rbp)
setl   %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1184 <main+0x64>
jmp    11da <main+0xba>
cmpl   $0xa,-0x18(%rbp)
jne    11a8 <main+0x88>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    121f <main+0xff>
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    0xe46(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    115b <main+0x3b>
mov    -0x8(%rbp),%esi
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe20(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf21(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%esi
cmp    $0x65,%esi
jb     12dc <main+0x1ac>
lea    0xf0b(%rip),%rdi
call   1030 <puts@plt>
lea    0xe95(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%esi
cmp    $0x64,%esi
jbe    12dc <main+0x1ac>
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6e(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%esi
cmp    $0x65,%esi
jb     12dc <main+0x1ac>
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
lea    0xe47(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%esi
cmp    $0x65,%esi
jb     12dc <main+0x1ac>
lea    0xe96(%rip),%rdi
call   1030 <puts@plt>
lea    0xe20(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%esi
cmp    $0x65,%esi
jb     12dc <main+0x1ac>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
lea    0xdf9(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%esi
cmp    $0x65,%esi
jb     12dc <main+0x1ac>
lea    0xe48(%rip),%rdi
call   1030 <puts@plt>
lea    0xdd2(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%esi
cmp    $0x65,%esi
jb     12dc <main+0x1ac>
lea    0xe21(%rip),%rdi
call   1030 <puts@plt>
lea    0xdab(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%esi
cmp    $0x65,%esi
jb     12dc <main+0x1ac>
lea    0xdfe(%rip),%rdi
call   1030 <puts@plt>
lea    0xd88(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%esi
cmp    $0x65,%esi
jb     12dc <main+0x1ac>
lea    0xddb(%rip),%rdi
call   1030 <puts@plt>
lea    0xd65(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%esi
cmp    $0x65,%esi
jb     12dc <main+0x1ac>
lea    0xdb8(%rip),%rdi
call   1030 <puts@plt>
lea    0xd42(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%esi
cmp    $0x64,%esi
jbe    12dc <main+0x1ac>
lea    0xdbb(%rip),%rdi
call   1030 <puts@plt>
jmp    1312 <main+0x1e2>
lea    0xd20(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd0f(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
mov    %esi,%edx
sub    (%rsp),%edx
lea    0xd20(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"How old are you?\0A\00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [78 x i8] c"If you're just going to lie to me then I don't want to talk to you. Goodbye.\0A\00"
@.str.3 = [39 x i8] c"I don't believe you. Let's try again.\0A\00"
@.str.4 = [40 x i8] c"Great! Now, what year did you turn %i?\0A\00"
@.str.5 = [46 x i8] c"%i? That means you were born in the year %i!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
store i32 0, i32* %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %10
10: ; preds = %33, %0
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 100
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 0
br label %16
16: ; preds = %13, %10
%17 = phi i1 [ true, %10 ], [ %15, %13 ]
br i1 %17, label %18, label %35
18: ; preds = %16
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 10
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %48
23: ; preds = %18
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%25 = load i32, i32* %7
switch i32 %25, label %26 [
]
26: ; preds = %23
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %29
29: ; preds = %26
%30 = load i32, i32* %6
switch i32 %30, label %31 [
]
31: ; preds = %29
%32 = load i32, i32* %7
store i32 %32, i32* %6
br label %33
33: ; preds = %31
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %10
35: ; preds = %16
%36 = load i32, i32* %2
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i32 %36)
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%39 = load i32, i32* %5
switch i32 %39, label %40 [
]
40: ; preds = %35
%41 = load i32, i32* %3
%42 = load i32, i32* %2
%43 = sub nsw i32 %41, %42
store i32 %43, i32* %5
br label %44
44: ; preds = %40
%45 = load i32, i32* %3
%46 = load i32, i32* %5
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0), i32 %45, i32 %46)
store i32 0, i32* %1
br label %48
48: ; preds = %44, %21
%49 = load i32, i32* %1
ret i32 %49
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%i\00"
@.str.4 = [40 x i8] c"Great! Now, what year did you turn %i?\0A\00"
@.str.5 = [46 x i8] c"%i? That means you were born in the year %i!\0A\00"
@str = [17 x i8] c"How old are you?\00"
@str.6 = [38 x i8] c"I don't believe you. Let's try again.\00"
@str.7 = [77 x i8] c"If you're just going to lie to me then I don't want to talk to you. Goodbye.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 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* %1)
%7 = load i32, i32* %1
%8 = icmp ugt i32 %7, 100
br i1 %8, label %9, label %61
9: ; preds = %0
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.6, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
%13 = icmp ugt i32 %12, 100
br i1 %13, label %16, label %61
14: ; preds = %56
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.7, i64 0, i64 0))
br label %69
16: ; preds = %9
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.6, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%19 = load i32, i32* %1
%20 = icmp ugt i32 %19, 100
br i1 %20, label %21, label %61
21: ; preds = %16
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.6, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%24 = load i32, i32* %1
%25 = icmp ugt i32 %24, 100
br i1 %25, label %26, label %61
26: ; preds = %21
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.6, i64 0, i64 0))
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%29 = load i32, i32* %1
%30 = icmp ugt i32 %29, 100
br i1 %30, label %31, label %61
31: ; preds = %26
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.6, i64 0, i64 0))
%33 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%34 = load i32, i32* %1
%35 = icmp ugt i32 %34, 100
br i1 %35, label %36, label %61
36: ; preds = %31
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.6, i64 0, i64 0))
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%39 = load i32, i32* %1
%40 = icmp ugt i32 %39, 100
br i1 %40, label %41, label %61
41: ; preds = %36
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.6, i64 0, i64 0))
%43 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%44 = load i32, i32* %1
%45 = icmp ugt i32 %44, 100
br i1 %45, label %46, label %61
46: ; preds = %41
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.6, i64 0, i64 0))
%48 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%49 = load i32, i32* %1
%50 = icmp ugt i32 %49, 100
br i1 %50, label %51, label %61
51: ; preds = %46
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.6, i64 0, i64 0))
%53 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%54 = load i32, i32* %1
%55 = icmp ugt i32 %54, 100
br i1 %55, label %56, label %61
56: ; preds = %51
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.6, i64 0, i64 0))
%58 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%59 = load i32, i32* %1
%60 = icmp ugt i32 %59, 100
br i1 %60, label %14, label %61
61: ; preds = %9, %16, %21, %26, %31, %36, %41, %46, %51, %56, %0
%62 = phi i32 [ %7, %0 ], [ %12, %9 ], [ %19, %16 ], [ %24, %21 ], [ %29, %26 ], [ %34, %31 ], [ %39, %36 ], [ %44, %41 ], [ %49, %46 ], [ %54, %51 ], [ %59, %56 ]
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i32 %62)
%64 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%65 = load i32, i32* %2
%66 = load i32, i32* %1
%67 = sub nsw i32 %65, %66
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0), i32 %65, i32 %67)
br label %69
69: ; preds = %61, %14
ret i32 0
}