#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ puts(char *);
int input_handling(FILE *fin, int low_limit, int upper_limit, char *error_msg) {
  int temp = 0;
  fscanf(fin, "%d", &temp);
  if ((temp < low_limit) || (upper_limit < temp)) {
    puts(error_msg);
    exit(0);
  }
  return temp;
}


x86 assembly (clang, -O0):
<input_handling>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea8(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1040 <fscanf@plt>
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1179 <input_handling+0x49>
mov    -0x10(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1189 <input_handling+0x59>
mov    -0x18(%rbp),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_handling>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %edx,%ebp
mov    %esi,%ebx
movl   $0x0,0xc(%rsp)
lea    0xeb2(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1040 <fscanf@plt>
mov    0xc(%rsp),%eax
cmp    %ebx,%eax
jl     116d <input_handling+0x3d>
cmp    %ebp,%eax
jg     116d <input_handling+0x3d>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @input_handling(i32* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
store i32 0, i32* %9
%10 = load i32*, i32** %5
%11 = call i32 @fscanf(i32* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%12 = load i32, i32* %9
%13 = load i32, i32* %6
%14 = icmp slt i32 %12, %13
br i1 %14, label %19, label %15
15: ; preds = %4
%16 = load i32, i32* %7
%17 = load i32, i32* %9
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %23
19: ; preds = %15, %4
%20 = load i8*, i8** %8
%21 = call i32 @puts(i8* %20)
%22 = call i32 @exit(i32 0)
unreachable
23: ; preds = %15
%24 = load i32, i32* %9
ret i32 %24
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @input_handling(i32* nocapture %0, i32 %1, i32 %2, i8* nocapture %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%7 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, %1
%10 = icmp sgt i32 %8, %2
%11 = or i1 %9, %10
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = call i32 @puts(i8* dereferenceable(1) %3)
%14 = call i32 @exit(i32 0)
unreachable
15: ; preds = %4
ret i32 %8
}