#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 */
long long INT_MAX;
long long INT_MIN;
long long LONG_MAX;
long long LONG_MIN;
int valid_int(long long int check) {
  if ((check == LONG_MIN) || (check == LONG_MAX))
    return 0;
  else if ((check <= INT_MAX) && (check >= INT_MIN))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<valid_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2ecd(%rip),%rcx
cmp    (%rcx),%rax
je     1130 <valid_int+0x30>
mov    -0x10(%rbp),%rax
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%rax
jne    113c <valid_int+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    117c <valid_int+0x7c>
mov    -0x10(%rbp),%rax
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%rax
jg     1170 <valid_int+0x70>
mov    -0x10(%rbp),%rax
mov    0x2e7d(%rip),%rcx
cmp    (%rcx),%rax
jl     1170 <valid_int+0x70>
movl   $0x1,-0x4(%rbp)
jmp    117c <valid_int+0x7c>
jmp    1175 <valid_int+0x75>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_int>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
cmp    %rdi,(%rcx)
je     1139 <valid_int+0x39>
mov    0x2eb3(%rip),%rcx
cmp    %rdi,(%rcx)
je     1139 <valid_int+0x39>
mov    0x2ec7(%rip),%rax
cmp    %rdi,(%rax)
setge  %al
mov    0x2eaa(%rip),%rcx
cmp    %rdi,(%rcx)
setle  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
@LONG_MIN = global i64 0
@LONG_MAX = global i64 0
@INT_MAX = global i64 0
@INT_MIN = global i64 0
define i32 @valid_int(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = load i64, i64* @LONG_MIN
%6 = icmp eq i64 %4, %5
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = load i64, i64* %3
%9 = load i64, i64* @LONG_MAX
%10 = icmp eq i64 %8, %9
br i1 %10, label %11, label %12
11: ; preds = %7, %1
store i32 0, i32* %2
br label %23
12: ; preds = %7
%13 = load i64, i64* %3
%14 = load i64, i64* @INT_MAX
%15 = icmp sle i64 %13, %14
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i64, i64* %3
%18 = load i64, i64* @INT_MIN
%19 = icmp sge i64 %17, %18
br i1 %19, label %20, label %21
20: ; preds = %16
store i32 1, i32* %2
br label %23
21: ; preds = %16, %12
br label %22
22: ; preds = %21
store i32 0, i32* %2
br label %23
23: ; preds = %22, %20, %11
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
@LONG_MIN = global i64 0
@LONG_MAX = global i64 0
@INT_MAX = global i64 0
@INT_MIN = global i64 0
define i32 @valid_int(i64 %0) {
%2 = load i64, i64* @LONG_MIN
%3 = icmp eq i64 %2, %0
%4 = load i64, i64* @LONG_MAX
%5 = icmp eq i64 %4, %0
%6 = select i1 %3, i1 true, i1 %5
br i1 %6, label %14, label %7
7: ; preds = %1
%8 = load i64, i64* @INT_MAX
%9 = icmp sge i64 %8, %0
%10 = load i64, i64* @INT_MIN
%11 = icmp sle i64 %10, %0
%12 = select i1 %9, i1 %11, i1 false
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %7, %1
%15 = phi i32 [ 0, %1 ], [ %13, %7 ]
ret i32 %15
}