#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_number_generator();
int new_secret_number();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read_guesses(int);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char command;
  int secret_number;
  printf("Guess the secret number between 1 and %d.\n\n", 100);
  initialize_number_generator();
  do {
    secret_number = new_secret_number();
    printf("A new number has been chosen.\n");
    read_guesses(secret_number);
    printf("Play again? (Y/N) ");
    scanf(" %c", &command);
    printf("\n");
  } 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   1050 <printf@plt>
mov    $0x0,%al
call   1040 <initialize_number_generator@plt>
mov    $0x0,%al
call   1030 <new_secret_number@plt>
mov    %eax,-0xc(%rbp)
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
call   1070 <read_guesses@plt>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsbl -0x5(%rbp),%ecx
mov    $0x1,%al
cmp    $0x79,%ecx
mov    %al,-0xd(%rbp)
je     11e4 <main+0x94>
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    0xe7d(%rip),%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1060 <initialize_number_generator@plt>
lea    0xea6(%rip),%r14
lea    0xe88(%rip),%r15
lea    0xe94(%rip),%r12
lea    0xf(%rsp),%rbx
xor    %eax,%eax
call   1050 <new_secret_number@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %ebp,%edi
call   1090 <read_guesses@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1080 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movzbl 0xf(%rsp),%eax
and    $0xdf,%al
cmp    $0x59,%al
je     11b0 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [44 x i8] c"Guess the secret number between 1 and %d.\0A\0A\00"
@.str.1 = [31 x i8] c"A new number has been chosen.\0A\00"
@.str.2 = [19 x i8] c"Play again? (Y/N) \00"
@.str.3 = [4 x i8] c" %c\00"
@.str.4 = [2 x i8] c"\0A\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 ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 100)
%5 = call i32 (...) @initialize_number_generator()
br label %6
6: ; preds = %22, %0
%7 = call i32 (...) @new_secret_number()
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 ([19 x i8], [19 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)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %14
14: ; preds = %6
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 121
br i1 %17, label %22, label %18
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 89
br label %22
22: ; preds = %18, %14
%23 = phi i1 [ true, %14 ], [ %21, %18 ]
br i1 %23, label %6, label %24
24: ; preds = %22
ret i32 0
}

LLVM IR (-O2):
@.str = [44 x i8] c"Guess the secret number between 1 and %d.\0A\0A\00"
@.str.2 = [19 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 ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 100)
%3 = tail call i32 (...) @initialize_number_generator()
br label %4
4: ; preds = %4, %0
%5 = call i32 (...) @new_secret_number()
%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 ([19 x i8], [19 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 = call i32 @putchar(i32 10)
%11 = load i8, i8* %1
%12 = and i8 %11, -33
%13 = icmp eq i8 %12, 89
br i1 %13, label %4, label %14
14: ; preds = %4
ret i32 0
}