#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 operation(int number) {
  int entered;
  printf("Enter a number: ");
  scanf("%d", &entered);
  while (entered != number) {
    if (entered < number) {
      printf("The number is bigger than yours\n");
      printf("Enter new number: ");
      scanf("%d", &entered);
    } else if (entered > number) {
      printf("The number is smaller than yours\n");
      printf("Enter new number: ");
      scanf("%d", &entered);
    }
  }
  printf("The number is correct.\n");
  printf("Number is %d\n", number);
}


x86 assembly (clang, -O0):
<operation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     11d4 <operation+0xb4>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1192 <operation+0x72>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8d(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
jmp    11cf <operation+0xaf>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11ca <operation+0xaa>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe50(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
jmp    11cf <operation+0xaf>
jmp    1149 <operation+0x29>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<operation>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebf(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %ebx,%eax
jne    118f <operation+0x5f>
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb0(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xed7(%rip),%r13
lea    0xe77(%rip),%r14
lea    0xe6d(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xe9c(%rip),%rbp
jmp    11e2 <operation+0xb2>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
call   1030 <puts@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %ebx,%eax
je     1164 <operation+0x34>
mov    %r13,%rdi
cmp    %ebx,%eax
jl     11c0 <operation+0x90>
mov    %rbp,%rdi
jg     11c0 <operation+0x90>
jmp    11da <operation+0xaa>

LLVM IR (-O0):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"The number is bigger than yours\0A\00"
@.str.3 = [19 x i8] c"Enter new number: \00"
@.str.4 = [34 x i8] c"The number is smaller than yours\0A\00"
@.str.5 = [24 x i8] c"The number is correct.\0A\00"
@.str.6 = [14 x i8] c"Number is %d\0A\00"
define i32 @operation(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = call i32 (i8*, ...) @printf(i8* 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* %4)
br label %7
7: ; preds = %28, %1
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %29
11: ; preds = %7
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
br label %28
19: ; preds = %11
%20 = load i32, i32* %4
%21 = load i32, i32* %3
%22 = icmp sgt i32 %20, %21
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
br label %27
27: ; preds = %23, %19
br label %28
28: ; preds = %27, %15
br label %7
29: ; preds = %7
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%31 = load i32, i32* %3
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %2
ret i32 %33
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [19 x i8] c"Enter new number: \00"
@.str.6 = [14 x i8] c"Number is %d\0A\00"
@str = [23 x i8] c"The number is correct.\00"
@str.7 = [33 x i8] c"The number is smaller than yours\00"
@str.8 = [32 x i8] c"The number is bigger than yours\00"
define i32 @operation(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, %0
br i1 %7, label %21, label %8
8: ; preds = %1, %18
%9 = phi i32 [ %19, %18 ], [ %6, %1 ]
%10 = icmp slt i32 %9, %0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = icmp sgt i32 %9, %0
br i1 %12, label %13, label %18
13: ; preds = %11, %8
%14 = phi i8* [ getelementptr inbounds ([32 x i8], [32 x i8]* @str.8, i64 0, i64 0), %8 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @str.7, i64 0, i64 0), %11 ]
%15 = call i32 @puts(i8* dereferenceable(1) %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %18
18: ; preds = %13, %11
%19 = load i32, i32* %2
%20 = icmp eq i32 %19, %0
br i1 %20, label %21, label %8
21: ; preds = %18, %1
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %0)
ret i32 undef
}