#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 task3_guess_control(int number, int guessed) {
  int guess_state = 0;
  if (guessed > number) {
    guess_state = 1;
    printf("Your number guessed was too High!\n");
  } else if (guessed < number) {
    guess_state = -1;
    printf("Your number guessed was too Low!\n");
  }
  return guess_state;
}


x86 assembly (clang, -O0):
<task3_guess_control>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jle    1149 <task3_guess_control+0x39>
movl   $0x1,-0xc(%rbp)
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
jmp    116d <task3_guess_control+0x5d>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1168 <task3_guess_control+0x58>
movl   $0xffffffff,-0xc(%rbp)
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
jmp    116d <task3_guess_control+0x5d>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<task3_guess_control>:
push   %rbx
cmp    %edi,%esi
jle    1123 <task3_guess_control+0x13>
mov    $0x1,%ebx
lea    0xf00(%rip),%rdi
jmp    1135 <task3_guess_control+0x25>
xor    %ebx,%ebx
cmp    %edi,%esi
jge    113a <task3_guess_control+0x2a>
mov    $0xffffffff,%ebx
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Your number guessed was too High!\0A\00"
@.str.1 = [34 x i8] c"Your number guessed was too Low!\0A\00"
define i32 @task3_guess_control(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = icmp sgt i32 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
store i32 1, i32* %5
%10 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %18
11: ; preds = %2
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %11
store i32 -1, i32* %5
%16 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %11
br label %18
18: ; preds = %17, %9
%19 = load i32, i32* %5
ret i32 %19
}

LLVM IR (-O2):
@str = [33 x i8] c"Your number guessed was too Low!\00"
@str.2 = [34 x i8] c"Your number guessed was too High!\00"
define i32 @task3_guess_control(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, %0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = icmp slt i32 %1, %0
br i1 %5, label %6, label %10
6: ; preds = %4, %2
%7 = phi i8* [ getelementptr inbounds ([34 x i8], [34 x i8]* @str.2, i64 0, i64 0), %2 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0), %4 ]
%8 = phi i32 [ 1, %2 ], [ -1, %4 ]
%9 = tail call i32 @puts(i8* dereferenceable(1) %7)
br label %10
10: ; preds = %6, %4
%11 = phi i32 [ 0, %4 ], [ %8, %6 ]
ret i32 %11
}