#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*/ fflush(int /*<<< orphan*/);
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int rand();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ srand(unsigned int);
int /*<<< orphan*/ stdin;
scalar_t__ time(int /*<<< orphan*/ *);
int main() {
  int min = 0, max = 100;
  int me_guess = 0;
  int comp_guess = 0;
  char res;
  srand((unsigned)time(NULL));
  printf("First, I'll choose a no between %d and %d: ", 0, 100);
  scanf("%d", &me_guess);
  fflush(stdin);
  do {
    if (min == max) {
      printf("\n\n\t\tThat would mean your chosen number is %d !!!\n", min);
      printf("\t\t****************************************\n");
      printf("\t\t\t****Damn, I'm good %c****\n", 1);
      printf("\t\t****************************************\n");
      goto tambalau;
    }
    printf("\n\nNow you guess, what number did i choose between %d and %d\n",
           min, max);
    comp_guess = rand() % (max - min);
    comp_guess += min;
    printf(
        "\n\t\tI say, in my absolute knowledge, the number you chose is.. %d\n",
        comp_guess);
    if (me_guess == comp_guess) {
      printf("\t\t****************************************\n");
      printf("\t\t\t****Damn, I'm good %c****\n", 1);
      printf("\t\t****************************************\n");
      break;
    }
    printf("\t\tAm I close?\n\t\tEnter \"H\" if your chosen number is higher, "
           "or L if ... %c ",
           16);
    res = getchar();
    while (getchar() != '\n')
      continue;
    switch (res) {
    case 'H':
    case 'h': {
      min = comp_guess + 1;
      break;
    }
    case 'L':
    case 'l': {
      max = comp_guess - 1;
      break;
    }
    default:
      puts("Naughty !");
      break;
    }
  } while (1);
tambalau:
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x64,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    0xed2(%rip),%rdi
xor    %esi,%esi
mov    $0x64,%edx
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee9(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1090 <scanf@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    123f <main+0xbf>
mov    -0x8(%rbp),%esi
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf01(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1360 <main+0x1e0>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xef3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   10a0 <rand@plt>
mov    -0xc(%rbp),%ecx
sub    -0x8(%rbp),%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xf03(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    12c0 <main+0x140>
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe80(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    135b <main+0x1db>
lea    0xef7(%rip),%rdi
mov    $0x10,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %al,-0x15(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     12f5 <main+0x175>
jmp    12dd <main+0x15d>
movsbl -0x15(%rbp),%eax
add    $0xffffffb8,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x24,%eax
ja     133b <main+0x1bb>
mov    -0x20(%rbp),%rax
lea    0xcea(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1347 <main+0x1c7>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1347 <main+0x1c7>
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
jmp    134c <main+0x1cc>
mov    $0x1,%al
test   $0x1,%al
jne    11ee <main+0x6e>
jmp    135b <main+0x1db>
jmp    1360 <main+0x1e0>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    0xe80(%rip),%rdi
mov    $0x64,%ebx
xor    %esi,%esi
mov    $0x64,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe92(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1090 <scanf@plt>
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
lea    0xf03(%rip),%r15
lea    0xe18(%rip),%r14
xor    %r13d,%r13d
jmp    11fe <main+0x7e>
nopl   (%rax)
add    $0xffffffff,%ebp
mov    %ebp,%ebx
cmp    %r13d,%ebx
je     129f <main+0x11f>
lea    0xea2(%rip),%rdi
mov    %r13d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   10a0 <rand@plt>
mov    %ebx,%ecx
sub    %r13d,%ecx
cltd
idiv   %ecx
mov    %edx,%ebp
add    %r13d,%ebp
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %ebp,0x4(%rsp)
je     12af <main+0x12f>
lea    0xee8(%rip),%rdi
mov    $0x10,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%r12d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%al
jne    1260 <main+0xe0>
movsbl %r12b,%eax
add    $0xffffffb8,%eax
rol    $0x1e,%eax
cmp    $0x9,%eax
ja     128e <main+0x10e>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
add    $0x1,%ebp
mov    %ebp,%r13d
jmp    11f5 <main+0x75>
lea    0xedc(%rip),%rdi
call   1030 <puts@plt>
jmp    11f5 <main+0x75>
lea    0xdb1(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec5(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xdc4(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [44 x i8] c"First, I'll choose a no between %d and %d: \00"
@.str.1 = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.2 = [50 x i8] c"\0A\0A\09\09That would mean your chosen number is %d !!!\0A\00"
@.str.3 = [44 x i8] c"\09\09****************************************\0A\00"
@.str.4 = [30 x i8] c"\09\09\09****Damn, I'm good %c****\0A\00"
@.str.5 = [61 x i8] c"\0A\0ANow you guess, what number did i choose between %d and %d\0A\00"
@.str.6 = [66 x i8] c"\0A\09\09I say, in my absolute knowledge, the number you chose is.. %d\0A\00"
@.str.7 = [75 x i8] c"\09\09Am I close?\0A\09\09Enter \22H\22 if your chosen number is higher, or L if ... %c \00"
@.str.8 = [10 x i8] c"Naughty !\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %2
store i32 100, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%7 = call i64 @time(i32* null)
%8 = trunc i64 %7 to i32
%9 = call i32 @srand(i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 0, i32 100)
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%12 = load i32, i32* @stdin
%13 = call i32 @fflush(i32 %12)
br label %14
14: ; preds = %65, %0
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %24
18: ; preds = %14
%19 = load i32, i32* %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 1)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
br label %67
24: ; preds = %14
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), i32 %25, i32 %26)
%28 = call i32 (...) @rand()
%29 = load i32, i32* %3
%30 = load i32, i32* %2
%31 = sub nsw i32 %29, %30
%32 = srem i32 %28, %31
store i32 %32, i32* %5
%33 = load i32, i32* %2
%34 = load i32, i32* %5
%35 = add nsw i32 %34, %33
store i32 %35, i32* %5
%36 = load i32, i32* %5
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.6, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %4
%39 = load i32, i32* %5
%40 = icmp eq i32 %38, %39
br i1 %40, label %41, label %45
41: ; preds = %24
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 1)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
br label %66
45: ; preds = %24
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.7, i64 0, i64 0), i32 16)
%47 = call signext i8 (...) @getchar()
store i8 %47, i8* %6
br label %48
48: ; preds = %52, %45
%49 = call signext i8 (...) @getchar()
%50 = sext i8 %49 to i32
%51 = icmp ne i32 %50, 10
br i1 %51, label %52, label %53
52: ; preds = %48
br label %48
53: ; preds = %48
%54 = load i8, i8* %6
%55 = sext i8 %54 to i32
switch i32 %55, label %62 [
i32 72, label %56
i32 104, label %56
i32 76, label %59
i32 108, label %59
]
56: ; preds = %53, %53
%57 = load i32, i32* %5
%58 = add nsw i32 %57, 1
store i32 %58, i32* %2
br label %64
59: ; preds = %53, %53
%60 = load i32, i32* %5
%61 = sub nsw i32 %60, 1
store i32 %61, i32* %3
br label %64
62: ; preds = %53
%63 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
br label %64
64: ; preds = %62, %59, %56
br label %65
65: ; preds = %64
br i1 true, label %14, label %66
66: ; preds = %65, %41
br label %67
67: ; preds = %66, %18
ret i32 0
}

LLVM IR (-O2):
@.str = [44 x i8] c"First, I'll choose a no between %d and %d: \00"
@.str.1 = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.2 = [50 x i8] c"\0A\0A\09\09That would mean your chosen number is %d !!!\0A\00"
@.str.4 = [30 x i8] c"\09\09\09****Damn, I'm good %c****\0A\00"
@.str.5 = [61 x i8] c"\0A\0ANow you guess, what number did i choose between %d and %d\0A\00"
@.str.6 = [66 x i8] c"\0A\09\09I say, in my absolute knowledge, the number you chose is.. %d\0A\00"
@.str.7 = [75 x i8] c"\09\09Am I close?\0A\09\09Enter \22H\22 if your chosen number is higher, or L if ... %c \00"
@.str.8 = [10 x i8] c"Naughty !\00"
@str.11 = [43 x i8] c"\09\09****************************************\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i64 @time(i32* null)
%4 = trunc i64 %3 to i32
%5 = tail call i32 @srand(i32 %4)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 0, i32 100)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = load i32, i32* @stdin
%9 = call i32 @fflush(i32 %8)
br label %12
10: ; preds = %39
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %40)
br label %43
12: ; preds = %0, %39
%13 = phi i32 [ 0, %0 ], [ %41, %39 ]
%14 = phi i32 [ 100, %0 ], [ %40, %39 ]
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), i32 %13, i32 %14)
%16 = call i32 (...) @rand()
%17 = sub nsw i32 %14, %13
%18 = srem i32 %16, %17
%19 = add nsw i32 %18, %13
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.6, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %1
%22 = icmp eq i32 %21, %19
br i1 %22, label %43, label %23
23: ; preds = %12
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @.str.7, i64 0, i64 0), i32 16)
%25 = call signext i8 (...) @getchar()
br label %26
26: ; preds = %26, %23
%27 = call signext i8 (...) @getchar()
%28 = icmp eq i8 %27, 10
br i1 %28, label %29, label %26
29: ; preds = %26
%30 = sext i8 %25 to i32
%31 = add nsw i32 %30, -72
%32 = call i32 @llvm.fshl.i32(i32 %31, i32 %31, i32 30)
switch i32 %32, label %37 [
i32 0, label %33
i32 8, label %33
i32 1, label %35
i32 9, label %35
]
33: ; preds = %29, %29
%34 = add nsw i32 %19, 1
br label %39
35: ; preds = %29, %29
%36 = add nsw i32 %19, -1
br label %39
37: ; preds = %29
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
br label %39
39: ; preds = %33, %35, %37
%40 = phi i32 [ %14, %37 ], [ %36, %35 ], [ %14, %33 ]
%41 = phi i32 [ %13, %37 ], [ %13, %35 ], [ %34, %33 ]
%42 = icmp eq i32 %40, %41
br i1 %42, label %10, label %12
43: ; preds = %12, %10
%44 = phi i8* [ getelementptr inbounds ([43 x i8], [43 x i8]* @str.11, i64 0, i64 0), %10 ], [ getelementptr inbounds ([43 x i8], [43 x i8]* @str.11, i64 0, i64 0), %12 ]
%45 = phi i8* [ getelementptr inbounds ([43 x i8], [43 x i8]* @str.11, i64 0, i64 0), %10 ], [ getelementptr inbounds ([43 x i8], [43 x i8]* @str.11, i64 0, i64 0), %12 ]
%46 = call i32 @puts(i8* dereferenceable(1) %44)
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 1)
%48 = call i32 @puts(i8* dereferenceable(1) %45)
ret i32 0
}