#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() {
  int guess;
  int secret = 50;
  printf("Lets play a game, I'll think of a number and you'll guess the "
         "number\nI'll tell you if it's higher or lower\n\n");
  printf("Please enter an integer:\n");
  scanf("%i", &guess);
  if (guess < secret) {
    printf("%i is less than %i\n\n", guess, secret);
  }
  if (guess > secret) {
    printf("%i is greater than %i\n\n", guess, secret);
  }
  if (guess == secret) {
    printf("Congratulations!!! %i was the secret number!!! \n\n", secret);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x32,-0xc(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf2e(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1182 <main+0x62>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xf0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11a2 <main+0x82>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xf04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11bf <main+0x9f>
mov    -0xc(%rbp),%esi
lea    0xeff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf2a(%rip),%rdi
call   1030 <puts@plt>
lea    0xf8a(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
cmp    $0x31,%esi
jle    1184 <main+0x54>
cmp    $0x33,%esi
jge    11a0 <main+0x70>
cmp    $0x32,%esi
jne    1180 <main+0x50>
lea    0xebc(%rip),%rdi
mov    $0x32,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe78(%rip),%rdi
mov    $0x32,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
cmp    $0x33,%esi
jl     1168 <main+0x38>
lea    0xe71(%rip),%rdi
mov    $0x32,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
cmp    $0x32,%esi
je     116d <main+0x3d>
jmp    1180 <main+0x50>

LLVM IR (-O0):
@.str = [109 x i8] c"Lets play a game, I'll think of a number and you'll guess the number\0AI'll tell you if it's higher or lower\0A\0A\00"
@.str.1 = [26 x i8] c"Please enter an integer:\0A\00"
@.str.2 = [3 x i8] c"%i\00"
@.str.3 = [21 x i8] c"%i is less than %i\0A\0A\00"
@.str.4 = [24 x i8] c"%i is greater than %i\0A\0A\00"
@.str.5 = [50 x i8] c"Congratulations!!! %i was the secret number!!! \0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 50, i32* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([109 x i8], [109 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %0
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %11, i32 %12)
br label %14
14: ; preds = %10, %0
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = icmp sgt i32 %15, %16
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %19, i32 %20)
br label %22
22: ; preds = %18, %14
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = load i32, i32* %3
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %26, %22
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%i\00"
@.str.3 = [21 x i8] c"%i is less than %i\0A\0A\00"
@.str.4 = [24 x i8] c"%i is greater than %i\0A\0A\00"
@.str.5 = [50 x i8] c"Congratulations!!! %i was the secret number!!! \0A\0A\00"
@str = [108 x i8] c"Lets play a game, I'll think of a number and you'll guess the number\0AI'll tell you if it's higher or lower\0A\00"
@str.6 = [25 x i8] c"Please enter an integer:\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([108 x i8], [108 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.6, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 50
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %6, i32 50)
%10 = load i32, i32* %1
br label %11
11: ; preds = %8, %0
%12 = phi i32 [ %10, %8 ], [ %6, %0 ]
%13 = icmp sgt i32 %12, 50
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %12, i32 50)
%16 = load i32, i32* %1
br label %17
17: ; preds = %14, %11
%18 = phi i32 [ %16, %14 ], [ %12, %11 ]
%19 = icmp eq i32 %18, 50
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0), i32 50)
br label %22
22: ; preds = %20, %17
ret i32 0
}