#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*/ logprintf(char *, long);
long num_input(char const *);
long size_screen(const char *msg, long min, long max) {
  long size;
  do {
    size = num_input(msg);
    if (size < min)
      logprintf("1size too small, lower limit is %ld", min);
    if (size > max)
      logprintf("1size too big, upper limit is %ld", max);
  } while ((size < min) || (size > max));
  return size;
}


x86 assembly (clang, -O0):
<size_screen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <num_input@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    115f <size_screen+0x3f>
mov    -0x10(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1040 <logprintf@plt>
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jle    117d <size_screen+0x5d>
mov    -0x18(%rbp),%rsi
lea    0xeac(%rip),%rdi
call   1040 <logprintf@plt>
jmp    1182 <size_screen+0x62>
mov    -0x20(%rbp),%rcx
mov    $0x1,%al
cmp    -0x10(%rbp),%rcx
mov    %al,-0x21(%rbp)
jl     11a3 <size_screen+0x83>
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
setg   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1134 <size_screen+0x14>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<size_screen>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0xec5(%rip),%r12
lea    0xee2(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
call   1030 <num_input@plt>
mov    %rax,%rbp
cmp    %rbx,%rax
jl     1180 <size_screen+0x60>
cmp    %r14,%rbp
jg     1190 <size_screen+0x70>
cmp    %rbx,%rbp
jl     1150 <size_screen+0x30>
cmp    %r14,%rbp
jg     1150 <size_screen+0x30>
jmp    11a2 <size_screen+0x82>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <logprintf@plt>
cmp    %r14,%rbp
jle    1165 <size_screen+0x45>
mov    %r13,%rdi
mov    %r14,%rsi
call   1040 <logprintf@plt>
cmp    %rbx,%rbp
jge    116a <size_screen+0x4a>
jmp    1150 <size_screen+0x30>
mov    %rbp,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"1size too small, lower limit is %ld\00"
@.str.1 = [34 x i8] c"1size too big, upper limit is %ld\00"
define i64 @size_screen(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
br label %8
8: ; preds = %33, %3
%9 = load i8*, i8** %4
%10 = call i64 @num_input(i8* %9)
store i64 %10, i64* %7
%11 = load i64, i64* %7
%12 = load i64, i64* %5
%13 = icmp slt i64 %11, %12
br i1 %13, label %14, label %17
14: ; preds = %8
%15 = load i64, i64* %5
%16 = call i32 @logprintf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i64 %15)
br label %17
17: ; preds = %14, %8
%18 = load i64, i64* %7
%19 = load i64, i64* %6
%20 = icmp sgt i64 %18, %19
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i64, i64* %6
%23 = call i32 @logprintf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i64 %22)
br label %24
24: ; preds = %21, %17
br label %25
25: ; preds = %24
%26 = load i64, i64* %7
%27 = load i64, i64* %5
%28 = icmp slt i64 %26, %27
br i1 %28, label %33, label %29
29: ; preds = %25
%30 = load i64, i64* %7
%31 = load i64, i64* %6
%32 = icmp sgt i64 %30, %31
br label %33
33: ; preds = %29, %25
%34 = phi i1 [ true, %25 ], [ %32, %29 ]
br i1 %34, label %8, label %35
35: ; preds = %33
%36 = load i64, i64* %7
ret i64 %36
}

LLVM IR (-O2):
@.str = [36 x i8] c"1size too small, lower limit is %ld\00"
@.str.1 = [34 x i8] c"1size too big, upper limit is %ld\00"
define i64 @size_screen(i8* %0, i64 %1, i64 %2) {
br label %4
4: ; preds = %13, %3
%5 = tail call i64 @num_input(i8* %0)
%6 = icmp slt i64 %5, %1
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @logprintf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i64 %1)
br label %9
9: ; preds = %7, %4
%10 = icmp sgt i64 %5, %2
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = tail call i32 @logprintf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i64 %2)
br label %13
13: ; preds = %9, %11
%14 = or i1 %6, %10
br i1 %14, label %4, label %15
15: ; preds = %13
ret i64 %5
}