#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*/ header();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ sprintf(char *, char *, int, int);
int /*<<< orphan*/ txt_ctrd(char *, char);
int ask_mystery(int min, int max) {
  int mystery = min - 1;
  char str[50];
  sprintf(str, "Player 2 - Type a number between %d and %d : ", min, max);
  do {
    header();
    txt_ctrd(str, ' ');
    scanf("%d", &mystery);
  } while (mystery < min || max < mystery);
  return mystery;
}


x86 assembly (clang, -O0):
<ask_mystery>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xe98(%rip),%rsi
call   1060 <sprintf@plt>
mov    $0x0,%al
call   1030 <header@plt>
lea    -0x40(%rbp),%rdi
mov    $0x20,%esi
call   1040 <txt_ctrd@plt>
lea    0xea5(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%ecx
mov    $0x1,%al
cmp    -0x4(%rbp),%ecx
mov    %al,-0x41(%rbp)
jl     11af <ask_mystery+0x6f>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
setl   %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    116d <ask_mystery+0x2d>
mov    -0xc(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ask_mystery>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x50,%rsp
mov    %esi,%r14d
mov    %edi,%ebx
lea    -0x1(%rbx),%eax
mov    %eax,0xc(%rsp)
lea    0xea1(%rip),%rsi
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    %ebx,%edx
mov    %r14d,%ecx
call   1060 <sprintf@plt>
lea    0xeb6(%rip),%r12
lea    0xc(%rsp),%rbp
nopl   (%rax)
xor    %eax,%eax
call   1030 <header@plt>
mov    %r15,%rdi
mov    $0x20,%esi
call   1040 <txt_ctrd@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    %ebx,%eax
jl     1180 <ask_mystery+0x40>
cmp    %r14d,%eax
jg     1180 <ask_mystery+0x40>
add    $0x50,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [46 x i8] c"Player 2 - Type a number between %d and %d : \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @ask_mystery(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [50 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = sub nsw i32 %7, 1
store i32 %8, i32* %5
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11)
br label %13
13: ; preds = %26, %2
%14 = call i32 (...) @header()
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%16 = call i32 @txt_ctrd(i8* %15, i8 signext 32)
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
br label %18
18: ; preds = %13
%19 = load i32, i32* %5
%20 = load i32, i32* %3
%21 = icmp slt i32 %19, %20
br i1 %21, label %26, label %22
22: ; preds = %18
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = icmp slt i32 %23, %24
br label %26
26: ; preds = %22, %18
%27 = phi i1 [ true, %18 ], [ %25, %22 ]
br i1 %27, label %13, label %28
28: ; preds = %26
%29 = load i32, i32* %5
ret i32 %29
}

LLVM IR (-O2):
@.str = [46 x i8] c"Player 2 - Type a number between %d and %d : \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @ask_mystery(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca [50 x i8]
%5 = bitcast i32* %3 to i8*
%6 = add nsw i32 %0, -1
store i32 %6, i32* %3
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%8 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
br label %9
9: ; preds = %9, %2
%10 = call i32 (...) @header()
%11 = call i32 @txt_ctrd(i8* %7, i8 signext 32)
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, %0
%15 = icmp sgt i32 %13, %1
%16 = or i1 %14, %15
br i1 %16, label %9, label %17
17: ; preds = %9
ret i32 %13
}