#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*/ getch(int /*<<< orphan*/);
int /*<<< orphan*/ instruct();
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ thanks();
int main() {
  printf("\t\aWelcome!!\n");
  int i, Guess_num, result;
  char ch1 = 'H';
  char ch2 = 'h';
  char ch;
  rand();
  printf("To know how to play this game press 'H'\n");
  scanf("%c", &ch);
  if (ch == ch1 || ch2) {
    instruct();
  }
  for (i = 1; i <= 5; i = i + 1) {
    printf("\nEnter your Guess number>\n");
    scanf("%d", &Guess_num);
    result = rand() - Guess_num;
    if (result > 0) {
      printf("Your Guess number is worng!!It %d higher than your number.\n",
             result + 2);
    } else if (Guess_num == rand()) {
      printf("\aYour Guess is correct.you win^^\n");
      thanks();
      getch(0);
    } else {
      printf("Your Guess number is worng!!It %d lower than your number.\n",
             result * (-1));
    }
  }
  printf("\n\n\aGame is over.You are a looser!!!\tTry again.\n");
  thanks();
  getch(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movb   $0x48,-0x11(%rbp)
movb   $0x68,-0x12(%rbp)
mov    $0x0,%al
call   1070 <rand@plt>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe95(%rip),%rdi
lea    -0x13(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movsbl -0x13(%rbp),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
je     11c9 <main+0x69>
movsbl -0x12(%rbp),%eax
cmp    $0x0,%eax
je     11d0 <main+0x70>
mov    $0x0,%al
call   1030 <instruct@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jg     1296 <main+0x136>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe5e(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    $0x0,%al
call   1070 <rand@plt>
sub    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1231 <main+0xd1>
mov    -0x10(%rbp),%esi
add    $0x2,%esi
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1283 <main+0x123>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1070 <rand@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jne    126c <main+0x10c>
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1080 <thanks@plt>
xor    %edi,%edi
call   1060 <getch@plt>
jmp    127e <main+0x11e>
imul   $0xffffffff,-0x10(%rbp),%esi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1283 <main+0x123>
jmp    1288 <main+0x128>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d7 <main+0x77>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1080 <thanks@plt>
xor    %edi,%edi
call   1060 <getch@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xf03(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1080 <rand@plt>
lea    0xefc(%rip),%rdi
call   1030 <puts@plt>
lea    0xe67(%rip),%rdi
lea    0x7(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
xor    %eax,%eax
call   1040 <instruct@plt>
lea    0xf2d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe44(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,%ebx
mov    (%rsp),%ebp
sub    %ebp,%ebx
jle    11e5 <main+0x75>
add    $0x2,%ebx
lea    0xe23(%rip),%rdi
jmp    1215 <main+0xa5>
xor    %eax,%eax
call   1080 <rand@plt>
cmp    %eax,%ebp
jne    120c <main+0x9c>
lea    0xf03(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1090 <thanks@plt>
xor    %edi,%edi
call   1070 <getch@plt>
jmp    121e <main+0xae>
neg    %ebx
lea    0xe2d(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
lea    0xdd2(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,%ebx
mov    (%rsp),%ebp
sub    %ebp,%ebx
jle    1257 <main+0xe7>
add    $0x2,%ebx
lea    0xdb1(%rip),%rdi
jmp    1287 <main+0x117>
xor    %eax,%eax
call   1080 <rand@plt>
cmp    %eax,%ebp
jne    127e <main+0x10e>
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1090 <thanks@plt>
xor    %edi,%edi
call   1070 <getch@plt>
jmp    1290 <main+0x120>
neg    %ebx
lea    0xdbb(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe49(%rip),%rdi
call   1030 <puts@plt>
lea    0xd60(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,%ebx
mov    (%rsp),%ebp
sub    %ebp,%ebx
jle    12c9 <main+0x159>
add    $0x2,%ebx
lea    0xd3f(%rip),%rdi
jmp    12f9 <main+0x189>
xor    %eax,%eax
call   1080 <rand@plt>
cmp    %eax,%ebp
jne    12f0 <main+0x180>
lea    0xe1f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1090 <thanks@plt>
xor    %edi,%edi
call   1070 <getch@plt>
jmp    1302 <main+0x192>
neg    %ebx
lea    0xd49(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdd7(%rip),%rdi
call   1030 <puts@plt>
lea    0xcee(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,%ebx
mov    (%rsp),%ebp
sub    %ebp,%ebx
jle    133b <main+0x1cb>
add    $0x2,%ebx
lea    0xccd(%rip),%rdi
jmp    136b <main+0x1fb>
xor    %eax,%eax
call   1080 <rand@plt>
cmp    %eax,%ebp
jne    1362 <main+0x1f2>
lea    0xdad(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1090 <thanks@plt>
xor    %edi,%edi
call   1070 <getch@plt>
jmp    1374 <main+0x204>
neg    %ebx
lea    0xcd7(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd65(%rip),%rdi
call   1030 <puts@plt>
lea    0xc7c(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,%ebx
mov    (%rsp),%ebp
sub    %ebp,%ebx
jle    13ad <main+0x23d>
add    $0x2,%ebx
lea    0xc5b(%rip),%rdi
jmp    13dd <main+0x26d>
xor    %eax,%eax
call   1080 <rand@plt>
cmp    %eax,%ebp
jne    13d4 <main+0x264>
lea    0xd3b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1090 <thanks@plt>
xor    %edi,%edi
call   1070 <getch@plt>
jmp    13e6 <main+0x276>
neg    %ebx
lea    0xc65(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xcc4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1090 <thanks@plt>
xor    %edi,%edi
call   1070 <getch@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"\09\07Welcome!!\0A\00"
@.str.1 = [41 x i8] c"To know how to play this game press 'H'\0A\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [27 x i8] c"\0AEnter your Guess number>\0A\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [60 x i8] c"Your Guess number is worng!!It %d higher than your number.\0A\00"
@.str.6 = [34 x i8] c"\07Your Guess is correct.you win^^\0A\00"
@.str.7 = [59 x i8] c"Your Guess number is worng!!It %d lower than your number.\0A\00"
@.str.8 = [48 x i8] c"\0A\0A\07Game is over.You are a looser!!!\09Try again.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i8 72, i8* %5
store i8 104, i8* %6
%9 = call i32 (...) @rand()
%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), i8* %7)
%12 = load i8, i8* %7
%13 = sext i8 %12 to i32
%14 = load i8, i8* %5
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %13, %15
br i1 %16, label %21, label %17
17: ; preds = %0
%18 = load i8, i8* %6
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %17, %0
%22 = call i32 (...) @instruct()
br label %23
23: ; preds = %21, %17
store i32 1, i32* %2
br label %24
24: ; preds = %53, %23
%25 = load i32, i32* %2
%26 = icmp sle i32 %25, 5
br i1 %26, label %27, label %56
27: ; preds = %24
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%30 = call i32 (...) @rand()
%31 = load i32, i32* %3
%32 = sub nsw i32 %30, %31
store i32 %32, i32* %4
%33 = load i32, i32* %4
%34 = icmp sgt i32 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %27
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 2
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.5, i64 0, i64 0), i32 %37)
br label %52
39: ; preds = %27
%40 = load i32, i32* %3
%41 = call i32 (...) @rand()
%42 = icmp eq i32 %40, %41
br i1 %42, label %43, label %47
43: ; preds = %39
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
%45 = call i32 (...) @thanks()
%46 = call i32 @getch(i32 0)
br label %51
47: ; preds = %39
%48 = load i32, i32* %4
%49 = mul nsw i32 %48, -1
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.7, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %47, %43
br label %52
52: ; preds = %51, %35
br label %53
53: ; preds = %52
%54 = load i32, i32* %2
%55 = add nsw i32 %54, 1
store i32 %55, i32* %2
br label %24
56: ; preds = %24
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0))
%58 = call i32 (...) @thanks()
%59 = call i32 @getch(i32 0)
%60 = load i32, i32* %1
ret i32 %60
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%c\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [60 x i8] c"Your Guess number is worng!!It %d higher than your number.\0A\00"
@.str.7 = [59 x i8] c"Your Guess number is worng!!It %d lower than your number.\0A\00"
@str = [12 x i8] c"\09\07Welcome!!\00"
@str.9 = [40 x i8] c"To know how to play this game press 'H'\00"
@str.10 = [47 x i8] c"\0A\0A\07Game is over.You are a looser!!!\09Try again.\00"
@str.11 = [26 x i8] c"\0AEnter your Guess number>\00"
@str.12 = [33 x i8] c"\07Your Guess is correct.you win^^\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%4 = bitcast i32* %1 to i8*
%5 = tail call i32 (...) @rand()
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.9, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%8 = call i32 (...) @instruct()
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.11, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%11 = call i32 (...) @rand()
%12 = load i32, i32* %1
%13 = sub nsw i32 %11, %12
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %0
%16 = add nuw nsw i32 %13, 2
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.5, i64 0, i64 0), i32 %16)
br label %28
18: ; preds = %0
%19 = call i32 (...) @rand()
%20 = icmp eq i32 %12, %19
br i1 %20, label %21, label %25
21: ; preds = %18
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.12, i64 0, i64 0))
%23 = call i32 (...) @thanks()
%24 = call i32 @getch(i32 0)
br label %28
25: ; preds = %18
%26 = sub nsw i32 0, %13
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.7, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %15, %25, %21
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.11, i64 0, i64 0))
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%31 = call i32 (...) @rand()
%32 = load i32, i32* %1
%33 = sub nsw i32 %31, %32
%34 = icmp sgt i32 %33, 0
br i1 %34, label %45, label %35
35: ; preds = %28
%36 = call i32 (...) @rand()
%37 = icmp eq i32 %32, %36
br i1 %37, label %41, label %38
38: ; preds = %35
%39 = sub nsw i32 0, %33
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.7, i64 0, i64 0), i32 %39)
br label %48
41: ; preds = %35
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.12, i64 0, i64 0))
%43 = call i32 (...) @thanks()
%44 = call i32 @getch(i32 0)
br label %48
45: ; preds = %28
%46 = add nuw nsw i32 %33, 2
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.5, i64 0, i64 0), i32 %46)
br label %48
48: ; preds = %45, %41, %38
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.11, i64 0, i64 0))
%50 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%51 = call i32 (...) @rand()
%52 = load i32, i32* %1
%53 = sub nsw i32 %51, %52
%54 = icmp sgt i32 %53, 0
br i1 %54, label %65, label %55
55: ; preds = %48
%56 = call i32 (...) @rand()
%57 = icmp eq i32 %52, %56
br i1 %57, label %61, label %58
58: ; preds = %55
%59 = sub nsw i32 0, %53
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.7, i64 0, i64 0), i32 %59)
br label %68
61: ; preds = %55
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.12, i64 0, i64 0))
%63 = call i32 (...) @thanks()
%64 = call i32 @getch(i32 0)
br label %68
65: ; preds = %48
%66 = add nuw nsw i32 %53, 2
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.5, i64 0, i64 0), i32 %66)
br label %68
68: ; preds = %65, %61, %58
%69 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.11, i64 0, i64 0))
%70 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%71 = call i32 (...) @rand()
%72 = load i32, i32* %1
%73 = sub nsw i32 %71, %72
%74 = icmp sgt i32 %73, 0
br i1 %74, label %85, label %75
75: ; preds = %68
%76 = call i32 (...) @rand()
%77 = icmp eq i32 %72, %76
br i1 %77, label %81, label %78
78: ; preds = %75
%79 = sub nsw i32 0, %73
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.7, i64 0, i64 0), i32 %79)
br label %88
81: ; preds = %75
%82 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.12, i64 0, i64 0))
%83 = call i32 (...) @thanks()
%84 = call i32 @getch(i32 0)
br label %88
85: ; preds = %68
%86 = add nuw nsw i32 %73, 2
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.5, i64 0, i64 0), i32 %86)
br label %88
88: ; preds = %85, %81, %78
%89 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.11, i64 0, i64 0))
%90 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%91 = call i32 (...) @rand()
%92 = load i32, i32* %1
%93 = sub nsw i32 %91, %92
%94 = icmp sgt i32 %93, 0
br i1 %94, label %105, label %95
95: ; preds = %88
%96 = call i32 (...) @rand()
%97 = icmp eq i32 %92, %96
br i1 %97, label %101, label %98
98: ; preds = %95
%99 = sub nsw i32 0, %93
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.7, i64 0, i64 0), i32 %99)
br label %108
101: ; preds = %95
%102 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.12, i64 0, i64 0))
%103 = call i32 (...) @thanks()
%104 = call i32 @getch(i32 0)
br label %108
105: ; preds = %88
%106 = add nuw nsw i32 %93, 2
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.5, i64 0, i64 0), i32 %106)
br label %108
108: ; preds = %105, %101, %98
%109 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.10, i64 0, i64 0))
%110 = call i32 (...) @thanks()
%111 = call i32 @getch(i32 0)
ret i32 0
}