#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*/ initialize_rng();
int /*<<< orphan*/ printf(char *, ...);
int rand_num();
int /*<<< orphan*/ read_guesses(int);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char command;
  int secret_num;
  printf("Guess the secret number between 1 and %d\n", 100);
  initialize_rng();
  do {
    secret_num = rand_num();
    printf("A New number has been chosen.\n");
    read_guesses(secret_num);
    printf("Play again? (Y/N): ");
    scanf(" %c", &command);
  } while (command == 'y' || command == 'Y');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x64,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1070 <initialize_rng@plt>
mov    $0x0,%al
call   1050 <rand_num@plt>
mov    %eax,-0xc(%rbp)
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
call   1060 <read_guesses@plt>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%ecx
mov    $0x1,%al
cmp    $0x79,%ecx
mov    %al,-0xd(%rbp)
je     11d6 <main+0x86>
movsbl -0x5(%rbp),%eax
cmp    $0x59,%eax
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1179 <main+0x29>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe8d(%rip),%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <initialize_rng@plt>
lea    0xeb5(%rip),%r14
lea    0xe96(%rip),%r15
lea    0xea3(%rip),%r12
lea    0xf(%rsp),%rbx
xor    %eax,%eax
call   1060 <rand_num@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
call   1070 <read_guesses@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movzbl 0xf(%rsp),%eax
and    $0xdf,%al
cmp    $0x59,%al
je     11a0 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Guess the secret number between 1 and %d\0A\00"
@.str.1 = [31 x i8] c"A New number has been chosen.\0A\00"
@.str.2 = [20 x i8] c"Play again? (Y/N): \00"
@.str.3 = [4 x i8] c" %c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 100)
%5 = call i32 (...) @initialize_rng()
br label %6
6: ; preds = %21, %0
%7 = call i32 (...) @rand_num()
store i32 %7, i32* %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* %3
%10 = call i32 @read_guesses(i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %2)
br label %13
13: ; preds = %6
%14 = load i8, i8* %2
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 121
br i1 %16, label %21, label %17
17: ; preds = %13
%18 = load i8, i8* %2
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 89
br label %21
21: ; preds = %17, %13
%22 = phi i1 [ true, %13 ], [ %20, %17 ]
br i1 %22, label %6, label %23
23: ; preds = %21
ret i32 0
}

LLVM IR (-O2):
@.str = [42 x i8] c"Guess the secret number between 1 and %d\0A\00"
@.str.2 = [20 x i8] c"Play again? (Y/N): \00"
@.str.3 = [4 x i8] c" %c\00"
@str = [30 x i8] c"A New number has been chosen.\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 100)
%3 = tail call i32 (...) @initialize_rng()
br label %4
4: ; preds = %4, %0
%5 = call i32 (...) @rand_num()
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%7 = call i32 @read_guesses(i32 %5)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %1)
%10 = load i8, i8* %1
%11 = and i8 %10, -33
%12 = icmp eq i8 %11, 89
br i1 %12, label %4, label %13
13: ; preds = %4
ret i32 0
}