#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 rand();
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  int guess, numrange, random;
  char goAgain;
  int counter = 0;
  srand(time(NULL));
  printf("Welcome to the Guessing game \n");
  printf("Please enter the range greater than 99: ");
  scanf("%d", &numrange);
  random = rand() % numrange + 1;
  if (numrange >= 99) {
    do {
      do {
        printf("Please enter a guess between 1 and the number");
        printf(" you entered:\n");
        scanf("%d", &guess);
        if (guess > random) {
          counter++;
          printf("\nToo high\n");
        } else if (guess < random) {
          counter++;
          printf("\nToo Low\n");
        } else {
          counter++;
          printf("\nYou got it\n");
          printf("\nIt only took you %d tries!\n", counter);
        }
      } while (random != guess);
      printf("\nWould you like to try again?");
      scanf("%s", &goAgain);
    } while (goAgain == 'y' || goAgain == 'Y');
  } else if (numrange < 99) {
    printf("Error your value was not that of over the value of 99");
    printf("\nPlease enter your value again: ");
    scanf("%d", &numrange);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    $0x0,%al
call   1070 <rand@plt>
cltd
idivl  -0xc(%rbp)
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
cmpl   $0x63,-0xc(%rbp)
jl     12d4 <main+0x184>
jmp    11c4 <main+0x74>
jmp    11c9 <main+0x79>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe5c(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    121f <main+0xcf>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1274 <main+0x124>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1247 <main+0xf7>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126f <main+0x11f>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1274 <main+0x124>
jmp    1279 <main+0x129>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11c9 <main+0x79>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe4b(%rip),%rdi
lea    -0x11(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
movsbl -0x11(%rbp),%ecx
mov    $0x1,%al
cmp    $0x79,%ecx
mov    %al,-0x19(%rbp)
je     12c4 <main+0x174>
movsbl -0x11(%rbp),%eax
cmp    $0x59,%eax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11c4 <main+0x74>
jmp    1311 <main+0x1c1>
cmpl   $0x63,-0xc(%rbp)
jge    130c <main+0x1bc>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd47(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
jmp    1311 <main+0x1c1>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    0xf6c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe71(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8c(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
xor    %eax,%eax
call   1080 <rand@plt>
mov    0x10(%rsp),%ecx
cltd
idiv   %ecx
cmp    $0x63,%ecx
jl     129c <main+0x13c>
mov    %edx,%r12d
lea    0x1(%r12),%r14d
lea    0xf3e(%rip),%r15
lea    0xe53(%rip),%r13
lea    0x14(%rsp),%rbx
xor    %ebp,%ebp
jmp    1210 <main+0xb0>
nop
lea    0xe90(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea0(%rip),%rdi
lea    0xf(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
movzbl 0xf(%rsp),%eax
and    $0xdf,%al
cmp    $0x59,%al
jne    12cb <main+0x16b>
lea    0xe15(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x14(%rsp),%eax
add    $0x1,%ebp
cmp    %r14d,%eax
jle    1250 <main+0xf0>
lea    0xeea(%rip),%rdi
jmp    1287 <main+0x127>
nopl   0x0(%rax,%rax,1)
cmp    %r12d,%eax
jle    1280 <main+0x120>
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
lea    0xdf2(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    0x14(%rsp),%r14d
jne    1210 <main+0xb0>
jmp    11e0 <main+0x80>
nopl   (%rax)
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
cmp    0x14(%rsp),%r14d
jne    1210 <main+0xb0>
jmp    11e0 <main+0x80>
lea    0xdf5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe1d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd6a(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Welcome to the Guessing game \0A\00"
@.str.1 = [41 x i8] c"Please enter the range greater than 99: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [46 x i8] c"Please enter a guess between 1 and the number\00"
@.str.4 = [15 x i8] c" you entered:\0A\00"
@.str.5 = [11 x i8] c"\0AToo high\0A\00"
@.str.6 = [10 x i8] c"\0AToo Low\0A\00"
@.str.7 = [13 x i8] c"\0AYou got it\0A\00"
@.str.8 = [29 x i8] c"\0AIt only took you %d tries!\0A\00"
@.str.9 = [30 x i8] c"\0AWould you like to try again?\00"
@.str.10 = [3 x i8] c"%s\00"
@.str.11 = [54 x i8] c"Error your value was not that of over the value of 99\00"
@.str.12 = [33 x i8] c"\0APlease enter your value again: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
%7 = call i32 @time(i32* null)
%8 = call i32 @srand(i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%12 = call i32 (...) @rand()
%13 = load i32, i32* %3
%14 = srem i32 %12, %13
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
%16 = load i32, i32* %3
%17 = icmp sge i32 %16, 99
br i1 %17, label %18, label %65
18: ; preds = %0
br label %19
19: ; preds = %62, %18
br label %20
20: ; preds = %47, %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%24 = load i32, i32* %2
%25 = load i32, i32* %4
%26 = icmp sgt i32 %24, %25
br i1 %26, label %27, label %31
27: ; preds = %20
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %46
31: ; preds = %20
%32 = load i32, i32* %2
%33 = load i32, i32* %4
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %39
35: ; preds = %31
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
br label %45
39: ; preds = %31
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%43 = load i32, i32* %6
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %39, %35
br label %46
46: ; preds = %45, %27
br label %47
47: ; preds = %46
%48 = load i32, i32* %4
%49 = load i32, i32* %2
%50 = icmp ne i32 %48, %49
br i1 %50, label %20, label %51
51: ; preds = %47
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
%53 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %5)
br label %54
54: ; preds = %51
%55 = load i8, i8* %5
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 121
br i1 %57, label %62, label %58
58: ; preds = %54
%59 = load i8, i8* %5
%60 = sext i8 %59 to i32
%61 = icmp eq i32 %60, 89
br label %62
62: ; preds = %58, %54
%63 = phi i1 [ true, %54 ], [ %61, %58 ]
br i1 %63, label %19, label %64
64: ; preds = %62
br label %73
65: ; preds = %0
%66 = load i32, i32* %3
%67 = icmp slt i32 %66, 99
br i1 %67, label %68, label %72
68: ; preds = %65
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.11, i64 0, i64 0))
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.12, i64 0, i64 0))
%71 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
br label %72
72: ; preds = %68, %65
br label %73
73: ; preds = %72, %64
%74 = load i32, i32* %1
ret i32 %74
}

LLVM IR (-O2):
@.str.1 = [41 x i8] c"Please enter the range greater than 99: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [46 x i8] c"Please enter a guess between 1 and the number\00"
@.str.8 = [29 x i8] c"\0AIt only took you %d tries!\0A\00"
@.str.9 = [30 x i8] c"\0AWould you like to try again?\00"
@.str.10 = [3 x i8] c"%s\00"
@.str.11 = [54 x i8] c"Error your value was not that of over the value of 99\00"
@.str.12 = [33 x i8] c"\0APlease enter your value again: \00"
@str = [30 x i8] c"Welcome to the Guessing game \00"
@str.13 = [14 x i8] c" you entered:\00"
@str.14 = [12 x i8] c"\0AYou got it\00"
@str.15 = [9 x i8] c"\0AToo Low\00"
@str.16 = [10 x i8] c"\0AToo high\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = tail call i32 @time(i32* null)
%7 = tail call i32 @srand(i32 %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%11 = call i32 (...) @rand()
%12 = load i32, i32* %2
%13 = srem i32 %11, %12
%14 = add nsw i32 %13, 1
%15 = icmp sgt i32 %12, 98
br i1 %15, label %16, label %45
16: ; preds = %0, %38
%17 = phi i32 [ %35, %38 ], [ 0, %0 ]
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.13, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%21 = load i32, i32* %1
%22 = icmp sgt i32 %21, %14
br i1 %22, label %23, label %26
23: ; preds = %16
%24 = add nsw i32 %17, 1
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.16, i64 0, i64 0))
br label %34
26: ; preds = %16
%27 = icmp sgt i32 %21, %13
%28 = add nsw i32 %17, 1
br i1 %27, label %31, label %29
29: ; preds = %26
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.15, i64 0, i64 0))
br label %34
31: ; preds = %26
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.14, i64 0, i64 0))
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i32 %28)
br label %34
34: ; preds = %23, %31, %29
%35 = phi i32 [ %24, %23 ], [ %28, %29 ], [ %28, %31 ]
%36 = load i32, i32* %1
%37 = icmp eq i32 %14, %36
br i1 %37, label %39, label %38
38: ; preds = %34, %39
br label %16
39: ; preds = %34
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
%41 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %3)
%42 = load i8, i8* %3
%43 = and i8 %42, -33
%44 = icmp eq i8 %43, 89
br i1 %44, label %38, label %49
45: ; preds = %0
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.11, i64 0, i64 0))
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.12, i64 0, i64 0))
%48 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %49
49: ; preds = %39, %45
ret i32 0
}