#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*/ flushin();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ sprintf(char *, char *, int, ...);
int /*<<< orphan*/ txt_ctrd(char *, char);
int ask_try(int lives, int min, int max) {
  char rmlives[50];
  char try_str[50];
  int try;
  sprintf(rmlives, "Remaining lives : %d", lives);
  sprintf(try_str, "Try a value [%d - %d] : ", min, max);
  do {
    txt_ctrd(rmlives, '\n');
    txt_ctrd(try_str, ' ');
    scanf("%d", &try);
    flushin();
  } while (try < min || max < try);
  return try;
}


x86 assembly (clang, -O0):
<ask_try>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe9e(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
lea    -0x80(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe9b(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
call   1030 <txt_ctrd@plt>
lea    -0x80(%rbp),%rdi
mov    $0x20,%esi
call   1030 <txt_ctrd@plt>
lea    0xe6e(%rip),%rdi
lea    -0x84(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <flushin@plt>
mov    -0x84(%rbp),%ecx
mov    $0x1,%al
cmp    -0x8(%rbp),%ecx
mov    %al,-0x85(%rbp)
jl     11e0 <ask_try+0xa0>
mov    -0xc(%rbp),%eax
cmp    -0x84(%rbp),%eax
setl   %al
mov    %al,-0x85(%rbp)
mov    -0x85(%rbp),%al
test   $0x1,%al
jne    1181 <ask_try+0x41>
mov    -0x84(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ask_try>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%edx
lea    0xea1(%rip),%rsi
lea    0x50(%rsp),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <sprintf@plt>
lea    0xea0(%rip),%rsi
lea    0x10(%rsp),%r12
mov    %r12,%rdi
mov    %ebp,%edx
mov    %r14d,%ecx
xor    %eax,%eax
call   1060 <sprintf@plt>
lea    0xe82(%rip),%r13
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
mov    $0xa,%esi
call   1030 <txt_ctrd@plt>
mov    %r12,%rdi
mov    $0x20,%esi
call   1030 <txt_ctrd@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
call   1040 <flushin@plt>
mov    0xc(%rsp),%eax
cmp    %ebp,%eax
jl     11a0 <ask_try+0x60>
cmp    %r14d,%eax
jg     11a0 <ask_try+0x60>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Remaining lives : %d\00"
@.str.1 = [25 x i8] c"Try a value [%d - %d] : \00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @ask_try(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [50 x i8]
%8 = alloca [50 x i8]
%9 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%11 = load i32, i32* %4
%12 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %10, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds [50 x i8], [50 x i8]* %8, i64 0, i64 0
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %13, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %15)
br label %17
17: ; preds = %32, %3
%18 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%19 = call i32 @txt_ctrd(i8* %18, i8 signext 10)
%20 = getelementptr inbounds [50 x i8], [50 x i8]* %8, i64 0, i64 0
%21 = call i32 @txt_ctrd(i8* %20, i8 signext 32)
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %9)
%23 = call i32 (...) @flushin()
br label %24
24: ; preds = %17
%25 = load i32, i32* %9
%26 = load i32, i32* %5
%27 = icmp slt i32 %25, %26
br i1 %27, label %32, label %28
28: ; preds = %24
%29 = load i32, i32* %6
%30 = load i32, i32* %9
%31 = icmp slt i32 %29, %30
br label %32
32: ; preds = %28, %24
%33 = phi i1 [ true, %24 ], [ %31, %28 ]
br i1 %33, label %17, label %34
34: ; preds = %32
%35 = load i32, i32* %9
ret i32 %35
}

LLVM IR (-O2):
@.str = [21 x i8] c"Remaining lives : %d\00"
@.str.1 = [25 x i8] c"Try a value [%d - %d] : \00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @ask_try(i32 %0, i32 %1, i32 %2) {
%4 = alloca [50 x i8]
%5 = alloca [50 x i8]
%6 = alloca i32
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%9 = bitcast i32* %6 to i8*
%10 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %0)
%11 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %1, i32 %2)
br label %12
12: ; preds = %12, %3
%13 = call i32 @txt_ctrd(i8* %7, i8 signext 10)
%14 = call i32 @txt_ctrd(i8* %8, i8 signext 32)
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%16 = call i32 (...) @flushin()
%17 = load i32, i32* %6
%18 = icmp slt i32 %17, %1
%19 = icmp sgt i32 %17, %2
%20 = or i1 %18, %19
br i1 %20, label %12, label %21
21: ; preds = %12
ret i32 %17
}