#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*/ exit(int /*<<< orphan*/);
char getchar();
int /*<<< orphan*/ isalpha(char);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ scanf(char *, int *, int *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char tolower(char);
int main(void) {
  int x, h, l, try, temp;
  char yesno;
  printf(
      "Trap\n----\n"
      "In this game you have to try to guess a number between 1 and %d by\n"
      "trapping it. Every guess you type a low and high number seperated by a\n"
      "comma (like \"15, 30\") and you'll be told if the number you are trying "
      "to\n"
      "find is between your number. When you think you have it type the same\n"
      "number for both the high and low guess. And remember, you only have %d\n"
      "guesses to find the number\n"
      "Good luck!\n\n",
      100, 8);
  srand(time(NULL));
  do {
    x = rand() % 100 + 1;
    printf("I have a number. You have %d guesses.\n", 8);
    for (try = 1; try <= 8 && !(l == h && h == x); try++) {
      printf("\nGuess %d (low , high) : ", try);
      scanf("%d %*c %d", &l, &h);
      if (l > h) {
        temp = h;
        h = l;
        l = temp;
      }
      if (l <= x && x <= h)
        printf("You've trapped my number.\n");
      else
        printf("My number is %s than your guesses.\n",
               (l > x) ? "lower" : "higher");
    }
    if (l == h && h == x)
      printf("I am undone! You caught my number.\n\n");
    else
      printf("Ha ha! That's %d guesses. My number was %d.\n\n", 8, x);
    printf("Do you want to do play again? (y/n) ");
    while (!isalpha(yesno = getchar()))
      ;
  } while (tolower(yesno) == 'y');
  printf("Until next time then!\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe5a(%rip),%rdi
mov    $0x64,%esi
mov    $0x8,%edx
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   10b0 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
lea    0xfaf(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0x8,-0x14(%rbp)
mov    %al,-0x1a(%rbp)
jg     122a <main+0x9a>
mov    -0x10(%rbp),%ecx
xor    %eax,%eax
cmp    -0xc(%rbp),%ecx
mov    %al,-0x1b(%rbp)
jne    1222 <main+0x92>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
mov    %al,-0x1b(%rbp)
mov    -0x1b(%rbp),%al
xor    $0xff,%al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
test   $0x1,%al
jne    123a <main+0xaa>
jmp    12e3 <main+0x153>
mov    -0x14(%rbp),%esi
lea    0xf75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf81(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1090 <scanf@plt>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    127d <main+0xed>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     12a8 <main+0x118>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     12a8 <main+0x118>
lea    0xf41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d0 <main+0x140>
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%edx
lea    0xf6d(%rip),%rsi
lea    0xf60(%rip),%rax
cmp    %edx,%ecx
cmovg  %rax,%rsi
lea    0xf2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d5 <main+0x145>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11f6 <main+0x66>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    130e <main+0x17e>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    130e <main+0x17e>
lea    0xf27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1324 <main+0x194>
mov    -0x8(%rbp),%edx
lea    0xf36(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x19(%rbp)
movsbl %al,%edi
call   1080 <isalpha@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1359 <main+0x1c9>
jmp    135e <main+0x1ce>
jmp    1332 <main+0x1a2>
jmp    1363 <main+0x1d3>
movsbl -0x19(%rbp),%edi
call   1070 <tolower@plt>
movsbl %al,%eax
cmp    $0x79,%eax
je     11c7 <main+0x37>
lea    0xf22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe4e(%rip),%rdi
mov    $0x64,%esi
mov    $0x8,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    0xffb(%rip),%r12
mov    %rsp,%r13
lea    0x4(%rsp),%rbx
xor    %eax,%eax
call   10c0 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
mov    %eax,%r15d
sub    %ecx,%r15d
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0x1,%ebp
lea    0xf7d(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%r14d
jmp    1260 <main+0xc0>
nopl   0x0(%rax)
cmp    %ebp,%eax
lea    0xfce(%rip),%rsi
lea    0xfc1(%rip),%rax
cmovg  %rax,%rsi
lea    0xf92(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r14d
cmp    $0x9,%r14d
je     12f0 <main+0x150>
mov    (%rsp),%eax
mov    0x4(%rsp),%ecx
cmp    %ecx,%eax
jne    126f <main+0xcf>
cmp    %ebp,%ecx
je     12e0 <main+0x140>
lea    0xf43(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   10a0 <scanf@plt>
mov    (%rsp),%edx
mov    0x4(%rsp),%eax
cmp    %eax,%edx
jle    12b0 <main+0x110>
mov    %edx,0x4(%rsp)
mov    %eax,(%rsp)
mov    %edx,%ecx
cmp    %ebp,%eax
jle    12bc <main+0x11c>
jmp    1230 <main+0x90>
nopl   0x0(%rax,%rax,1)
mov    %eax,%ecx
mov    %edx,%eax
cmp    %ebp,%eax
jg     1230 <main+0x90>
cmp    %ecx,%r15d
jge    1230 <main+0x90>
lea    0xfcf(%rip),%rdi
call   1030 <puts@plt>
jmp    1252 <main+0xb2>
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%ecx
cmp    %ecx,%eax
je     12fb <main+0x15b>
jmp    1310 <main+0x170>
nopl   0x0(%rax,%rax,1)
mov    (%rsp),%eax
mov    0x4(%rsp),%ecx
cmp    %ecx,%eax
jne    1310 <main+0x170>
cmp    %ebp,%ecx
jne    1310 <main+0x170>
lea    0xf71(%rip),%rdi
call   1030 <puts@plt>
jmp    1325 <main+0x185>
nopl   (%rax)
lea    0xef7(%rip),%rdi
mov    $0x8,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf10(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1060 <getchar@plt>
movsbl %al,%ebp
mov    %ebp,%edi
call   1090 <isalpha@plt>
test   %eax,%eax
je     1340 <main+0x1a0>
mov    %ebp,%edi
call   1080 <tolower@plt>
cmp    $0x79,%al
je     11e0 <main+0x40>
lea    0xef6(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [402 x i8] c"Trap\0A----\0AIn this game you have to try to guess a number between 1 and %d by\0Atrapping it. Every guess you type a low and high number seperated by a\0Acomma (like \2215, 30\22) and you'll be told if the number you are trying to\0Afind is between your number. When you think you have it type the same\0Anumber for both the high and low guess. And remember, you only have %d\0Aguesses to find the number\0AGood luck!\0A\0A\00"
@.str.1 = [39 x i8] c"I have a number. You have %d guesses.\0A\00"
@.str.2 = [26 x i8] c"\0AGuess %d (low , high) : \00"
@.str.3 = [10 x i8] c"%d %*c %d\00"
@.str.4 = [27 x i8] c"You've trapped my number.\0A\00"
@.str.5 = [36 x i8] c"My number is %s than your guesses.\0A\00"
@.str.6 = [6 x i8] c"lower\00"
@.str.7 = [7 x i8] c"higher\00"
@.str.8 = [37 x i8] c"I am undone! You caught my number.\0A\0A\00"
@.str.9 = [46 x i8] c"Ha ha! That's %d guesses. My number was %d.\0A\0A\00"
@.str.10 = [37 x i8] c"Do you want to do play again? (y/n) \00"
@.str.11 = [23 x i8] c"Until next time then!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([402 x i8], [402 x i8]* @.str, i64 0, i64 0), i32 100, i32 8)
%9 = call i32 @time(i32* null)
%10 = call i32 @srand(i32 %9)
br label %11
11: ; preds = %86, %0
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 100
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 8)
store i32 1, i32* %5
br label %16
16: ; preds = %61, %11
%17 = load i32, i32* %5
%18 = icmp sle i32 %17, 8
br i1 %18, label %19, label %30
19: ; preds = %16
%20 = load i32, i32* %4
%21 = load i32, i32* %3
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = load i32, i32* %3
%25 = load i32, i32* %2
%26 = icmp eq i32 %24, %25
br label %27
27: ; preds = %23, %19
%28 = phi i1 [ false, %19 ], [ %26, %23 ]
%29 = xor i1 %28, true
br label %30
30: ; preds = %27, %16
%31 = phi i1 [ false, %16 ], [ %29, %27 ]
br i1 %31, label %32, label %64
32: ; preds = %30
%33 = load i32, i32* %5
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %33)
%35 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32* %4, i32* %3)
%36 = load i32, i32* %4
%37 = load i32, i32* %3
%38 = icmp sgt i32 %36, %37
br i1 %38, label %39, label %43
39: ; preds = %32
%40 = load i32, i32* %3
store i32 %40, i32* %6
%41 = load i32, i32* %4
store i32 %41, i32* %3
%42 = load i32, i32* %6
store i32 %42, i32* %4
br label %43
43: ; preds = %39, %32
%44 = load i32, i32* %4
%45 = load i32, i32* %2
%46 = icmp sle i32 %44, %45
br i1 %46, label %47, label %53
47: ; preds = %43
%48 = load i32, i32* %2
%49 = load i32, i32* %3
%50 = icmp sle i32 %48, %49
br i1 %50, label %51, label %53
51: ; preds = %47
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %60
53: ; preds = %47, %43
%54 = load i32, i32* %4
%55 = load i32, i32* %2
%56 = icmp sgt i32 %54, %55
%57 = zext i1 %56 to i64
%58 = select i1 %56, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0)
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i8* %58)
br label %60
60: ; preds = %53, %51
br label %61
61: ; preds = %60
%62 = load i32, i32* %5
%63 = add nsw i32 %62, 1
store i32 %63, i32* %5
br label %16
64: ; preds = %30
%65 = load i32, i32* %4
%66 = load i32, i32* %3
%67 = icmp eq i32 %65, %66
br i1 %67, label %68, label %74
68: ; preds = %64
%69 = load i32, i32* %3
%70 = load i32, i32* %2
%71 = icmp eq i32 %69, %70
br i1 %71, label %72, label %74
72: ; preds = %68
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.8, i64 0, i64 0))
br label %77
74: ; preds = %68, %64
%75 = load i32, i32* %2
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.9, i64 0, i64 0), i32 8, i32 %75)
br label %77
77: ; preds = %74, %72
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.10, i64 0, i64 0))
br label %79
79: ; preds = %84, %77
%80 = call signext i8 (...) @getchar()
store i8 %80, i8* %7
%81 = call i32 @isalpha(i8 signext %80)
%82 = icmp ne i32 %81, 0
%83 = xor i1 %82, true
br i1 %83, label %84, label %85
84: ; preds = %79
br label %79
85: ; preds = %79
br label %86
86: ; preds = %85
%87 = load i8, i8* %7
%88 = call signext i8 @tolower(i8 signext %87)
%89 = sext i8 %88 to i32
%90 = icmp eq i32 %89, 121
br i1 %90, label %11, label %91
91: ; preds = %86
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0))
%93 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [402 x i8] c"Trap\0A----\0AIn this game you have to try to guess a number between 1 and %d by\0Atrapping it. Every guess you type a low and high number seperated by a\0Acomma (like \2215, 30\22) and you'll be told if the number you are trying to\0Afind is between your number. When you think you have it type the same\0Anumber for both the high and low guess. And remember, you only have %d\0Aguesses to find the number\0AGood luck!\0A\0A\00"
@.str.1 = [39 x i8] c"I have a number. You have %d guesses.\0A\00"
@.str.2 = [26 x i8] c"\0AGuess %d (low , high) : \00"
@.str.3 = [10 x i8] c"%d %*c %d\00"
@.str.5 = [36 x i8] c"My number is %s than your guesses.\0A\00"
@.str.6 = [6 x i8] c"lower\00"
@.str.7 = [7 x i8] c"higher\00"
@.str.9 = [46 x i8] c"Ha ha! That's %d guesses. My number was %d.\0A\0A\00"
@.str.10 = [37 x i8] c"Do you want to do play again? (y/n) \00"
@str = [22 x i8] c"Until next time then!\00"
@str.12 = [36 x i8] c"I am undone! You caught my number.\0A\00"
@str.13 = [26 x i8] c"You've trapped my number.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([402 x i8], [402 x i8]* @.str, i64 0, i64 0), i32 100, i32 8)
%6 = tail call i32 @time(i32* null)
%7 = tail call i32 @srand(i32 %6)
br label %8
8: ; preds = %61, %0
%9 = call i32 (...) @rand()
%10 = srem i32 %9, 100
%11 = add nsw i32 %10, 1
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 8)
br label %13
13: ; preds = %8, %39
%14 = phi i32 [ 1, %8 ], [ %40, %39 ]
%15 = load i32, i32* %2
%16 = load i32, i32* %1
%17 = icmp ne i32 %15, %16
%18 = icmp ne i32 %16, %11
%19 = select i1 %17, i1 true, i1 %18
br i1 %19, label %20, label %45
20: ; preds = %13
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%22 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32* %2, i32* %1)
%23 = load i32, i32* %2
%24 = load i32, i32* %1
%25 = icmp sgt i32 %23, %24
br i1 %25, label %26, label %27
26: ; preds = %20
store i32 %23, i32* %1
store i32 %24, i32* %2
br label %27
27: ; preds = %26, %20
%28 = phi i32 [ %23, %26 ], [ %24, %20 ]
%29 = phi i32 [ %24, %26 ], [ %23, %20 ]
%30 = icmp sle i32 %29, %11
%31 = icmp slt i32 %10, %28
%32 = select i1 %30, i1 %31, i1 false
br i1 %32, label %33, label %35
33: ; preds = %27
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.13, i64 0, i64 0))
br label %39
35: ; preds = %27
%36 = icmp sgt i32 %29, %11
%37 = select i1 %36, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0)
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i8* %37)
br label %39
39: ; preds = %33, %35
%40 = add nuw nsw i32 %14, 1
%41 = icmp eq i32 %40, 9
br i1 %41, label %42, label %13
42: ; preds = %39
%43 = load i32, i32* %2
%44 = load i32, i32* %1
br label %45
45: ; preds = %13, %42
%46 = phi i32 [ %44, %42 ], [ %11, %13 ]
%47 = phi i32 [ %43, %42 ], [ %15, %13 ]
%48 = icmp eq i32 %47, %46
%49 = icmp eq i32 %46, %11
%50 = select i1 %48, i1 %49, i1 false
br i1 %50, label %51, label %53
51: ; preds = %45
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.12, i64 0, i64 0))
br label %55
53: ; preds = %45
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.9, i64 0, i64 0), i32 8, i32 %11)
br label %55
55: ; preds = %53, %51
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.10, i64 0, i64 0))
br label %57
57: ; preds = %57, %55
%58 = call signext i8 (...) @getchar()
%59 = call i32 @isalpha(i8 signext %58)
%60 = icmp eq i32 %59, 0
br i1 %60, label %57, label %61
61: ; preds = %57
%62 = call signext i8 @tolower(i8 signext %58)
%63 = icmp eq i8 %62, 121
br i1 %63, label %8, label %64
64: ; preds = %61
%65 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%66 = call i32 @exit(i32 0)
unreachable
}