#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 INT_MAX;
long INT_MIN;
long double scalbnl(long double, int);
long double scalblnl(long double x, long n) {
  if (n < INT_MIN)
    return scalbnl(x, INT_MIN);
  else if (n > INT_MAX)
    return scalbnl(x, INT_MAX);
  else
    return scalbnl(x, (int)n);
}


x86 assembly (clang, -O0):
<scalblnl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
fldt   0x10(%rbp)
fstpt  -0x20(%rbp)
mov    %rdi,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    0x2eb3(%rip),%rcx
cmp    (%rcx),%rax
jge    1154 <scalblnl+0x44>
fldt   -0x20(%rbp)
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <scalbnl@plt>
fstpt  -0x10(%rbp)
jmp    1199 <scalblnl+0x89>
mov    -0x28(%rbp),%rax
mov    0x2e89(%rip),%rcx
cmp    (%rcx),%rax
jle    1186 <scalblnl+0x76>
fldt   -0x20(%rbp)
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <scalbnl@plt>
fstpt  -0x10(%rbp)
jmp    1199 <scalblnl+0x89>
fldt   -0x20(%rbp)
mov    -0x28(%rbp),%edi
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <scalbnl@plt>
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scalblnl>:
mov    0x2ec9(%rip),%rax
mov    0x2eca(%rip),%rcx
mov    (%rcx),%rcx
cmp    %rdi,%rcx
cmovge %edi,%ecx
mov    (%rax),%rax
cmp    %rdi,%rax
cmovle %ecx,%eax
mov    %eax,%edi
jmp    1030 <scalbnl@plt>

LLVM IR (-O0):
@INT_MIN = global i64 0
@INT_MAX = global i64 0
define x86_fp80 @scalblnl(x86_fp80 %0, i64 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
%5 = alloca i64
store x86_fp80 %0, x86_fp80* %4
store i64 %1, i64* %5
%6 = load i64, i64* %5
%7 = load i64, i64* @INT_MIN
%8 = icmp slt i64 %6, %7
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load x86_fp80, x86_fp80* %4
%11 = load i64, i64* @INT_MIN
%12 = trunc i64 %11 to i32
%13 = call x86_fp80 @scalbnl(x86_fp80 %10, i32 %12)
store x86_fp80 %13, x86_fp80* %3
br label %28
14: ; preds = %2
%15 = load i64, i64* %5
%16 = load i64, i64* @INT_MAX
%17 = icmp sgt i64 %15, %16
br i1 %17, label %18, label %23
18: ; preds = %14
%19 = load x86_fp80, x86_fp80* %4
%20 = load i64, i64* @INT_MAX
%21 = trunc i64 %20 to i32
%22 = call x86_fp80 @scalbnl(x86_fp80 %19, i32 %21)
store x86_fp80 %22, x86_fp80* %3
br label %28
23: ; preds = %14
%24 = load x86_fp80, x86_fp80* %4
%25 = load i64, i64* %5
%26 = trunc i64 %25 to i32
%27 = call x86_fp80 @scalbnl(x86_fp80 %24, i32 %26)
store x86_fp80 %27, x86_fp80* %3
br label %28
28: ; preds = %23, %18, %9
%29 = load x86_fp80, x86_fp80* %3
ret x86_fp80 %29
}

LLVM IR (-O2):
@INT_MIN = global i64 0
@INT_MAX = global i64 0
define x86_fp80 @scalblnl(x86_fp80 %0, i64 %1) {
%3 = load i64, i64* @INT_MIN
%4 = icmp sgt i64 %3, %1
%5 = load i64, i64* @INT_MAX
%6 = icmp slt i64 %5, %1
%7 = select i1 %6, i64 %5, i64 %1
%8 = select i1 %4, i64 %3, i64 %7
%9 = trunc i64 %8 to i32
%10 = tail call x86_fp80 @scalbnl(x86_fp80 %0, i32 %9)
ret x86_fp80 %10
}