#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 *, unsigned int *);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stdout;
int main() {
  setbuf(stdout, NULL);
  printf("Solve the following equations:\n");
  printf("X > 1337\n");
  printf("X * 7 + 4 = 1337\n");
  unsigned int leet = 1337;
  unsigned int x = 0;
  unsigned int seven = 7;
  printf("Enter the solution X: ");
  scanf("%d", &x);
  printf("You entered: %d\n", x);
  if (x <= leet) {
    printf("%d is not bigger than %d\n", x, leet);
    printf("WRONG!!!\n");
    printf("Go to school and learn some math!\n");
    return 1;
  }
  printf("%d is bigger than %d\n", x, leet);
  x *= 7;
  x += 4;
  if (x == 1337) {
    printf("%d is equal to %d\n", x, leet);
    printf("Well done!\n");
    printf("IW{Y4Y_0verfl0w}");
    return 0;
  }
  printf("%d is not equal to %d\n", x, leet);
  printf("WRONG!!!\n");
  printf("Go to school and learn some math!\n");
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <setbuf@plt>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x539,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x7,-0x10(%rbp)
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeae(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%esi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
ja     1207 <main+0xd7>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12ab <main+0x17b>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
imul   $0x7,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x539,-0xc(%rbp)
jne    1274 <main+0x144>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12ab <main+0x17b>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1040 <setbuf@plt>
lea    0xf3a(%rip),%rdi
call   1030 <puts@plt>
lea    0xf4d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf4a(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,0xc(%rsp)
lea    0xe78(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe81(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0xe6f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
cmp    $0x539,%esi
ja     11c7 <main+0x87>
lea    0xe66(%rip),%rdi
jmp    1233 <main+0xf3>
lea    0xe77(%rip),%rdi
xor    %ebx,%ebx
mov    $0x539,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%eax
lea    0x0(,%rax,8),%esi
sub    %eax,%esi
add    $0x4,%esi
mov    %esi,0xc(%rsp)
cmp    $0x539,%esi
jne    122c <main+0xec>
lea    0xe5c(%rip),%rdi
mov    $0x539,%esi
mov    $0x539,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
lea    0xe4b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    125c <main+0x11c>
lea    0xe4c(%rip),%rdi
mov    $0x539,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [32 x i8] c"Solve the following equations:\0A\00"
@.str.1 = [10 x i8] c"X > 1337\0A\00"
@.str.2 = [18 x i8] c"X * 7 + 4 = 1337\0A\00"
@.str.3 = [23 x i8] c"Enter the solution X: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [17 x i8] c"You entered: %d\0A\00"
@.str.6 = [26 x i8] c"%d is not bigger than %d\0A\00"
@.str.7 = [10 x i8] c"WRONG!!!\0A\00"
@.str.8 = [35 x i8] c"Go to school and learn some math!\0A\00"
@.str.9 = [22 x i8] c"%d is bigger than %d\0A\00"
@.str.10 = [19 x i8] c"%d is equal to %d\0A\00"
@.str.11 = [12 x i8] c"Well done!\0A\00"
@.str.12 = [17 x i8] c"IW{Y4Y_0verfl0w}\00"
@.str.13 = [23 x i8] c"%d is not equal to %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* @stdout
%6 = call i32 @setbuf(i32 %5, i32* null)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
store i32 1337, i32* %2
store i32 0, i32* %3
store i32 7, i32* %4
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = icmp ule i32 %14, %15
br i1 %16, label %17, label %23
17: ; preds = %0
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 %18, i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %1
br label %45
23: ; preds = %0
%24 = load i32, i32* %3
%25 = load i32, i32* %2
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i32 %24, i32 %25)
%27 = load i32, i32* %3
%28 = mul i32 %27, 7
store i32 %28, i32* %3
%29 = load i32, i32* %3
%30 = add i32 %29, 4
store i32 %30, i32* %3
%31 = load i32, i32* %3
%32 = icmp eq i32 %31, 1337
br i1 %32, label %33, label %39
33: ; preds = %23
%34 = load i32, i32* %3
%35 = load i32, i32* %2
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %34, i32 %35)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0))
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0))
store i32 0, i32* %1
br label %45
39: ; preds = %23
%40 = load i32, i32* %3
%41 = load i32, i32* %2
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0), i32 %40, i32 %41)
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %1
br label %45
45: ; preds = %39, %33, %17
%46 = load i32, i32* %1
ret i32 %46
}

LLVM IR (-O2):
@stdout = global i32 0
@.str.3 = [23 x i8] c"Enter the solution X: \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [17 x i8] c"You entered: %d\0A\00"
@.str.6 = [26 x i8] c"%d is not bigger than %d\0A\00"
@.str.9 = [22 x i8] c"%d is bigger than %d\0A\00"
@.str.10 = [19 x i8] c"%d is equal to %d\0A\00"
@.str.12 = [17 x i8] c"IW{Y4Y_0verfl0w}\00"
@.str.13 = [23 x i8] c"%d is not equal to %d\0A\00"
@str = [31 x i8] c"Solve the following equations:\00"
@str.14 = [9 x i8] c"X > 1337\00"
@str.15 = [17 x i8] c"X * 7 + 4 = 1337\00"
@str.18 = [11 x i8] c"Well done!\00"
@str.19 = [9 x i8] c"WRONG!!!\00"
@str.20 = [34 x i8] c"Go to school and learn some math!\00"
define i32 @main() {
%1 = alloca i32
%2 = load i32, i32* @stdout
%3 = tail call i32 @setbuf(i32 %2, i32* null)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.14, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.15, i64 0, i64 0))
%7 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %1
%13 = icmp ult i32 %12, 1338
br i1 %13, label %14, label %18
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 %12, i32 1337)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.19, i64 0, i64 0))
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.20, i64 0, i64 0))
br label %32
18: ; preds = %0
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i32 %12, i32 1337)
%20 = load i32, i32* %1
%21 = mul i32 %20, 7
%22 = add i32 %21, 4
store i32 %22, i32* %1
%23 = icmp eq i32 %22, 1337
br i1 %23, label %24, label %28
24: ; preds = %18
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 1337, i32 1337)
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.18, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0))
br label %32
28: ; preds = %18
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0), i32 %22, i32 1337)
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.19, i64 0, i64 0))
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.20, i64 0, i64 0))
br label %32
32: ; preds = %28, %24, %14
%33 = phi i32 [ 1, %14 ], [ 0, %24 ], [ 1, %28 ]
ret i32 %33
}