#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 */
double HUGE_VAL;
long INT_MAX;
long INT_MIN;
double scalbn(double, int);
double scalbln(double __a, long __b) {
  if (__b > INT_MAX)
    return __a > 0 ? HUGE_VAL : -HUGE_VAL;
  if (__b < INT_MIN)
    return __a > 0 ? 0.0 : -0.0;
  return scalbn(__a, (int)__b);
}


x86 assembly (clang, -O0):
<scalbln>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x2eb4(%rip),%rcx
cmp    (%rcx),%rax
jle    1192 <scalbln+0x82>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    115c <scalbln+0x4c>
mov    0x2e9a(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1183 <scalbln+0x73>
mov    0x2e85(%rip),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11ec <scalbln+0xdc>
mov    -0x18(%rbp),%rax
mov    0x2e3b(%rip),%rcx
cmp    (%rcx),%rax
jge    11d7 <scalbln+0xc7>
movsd  -0x10(%rbp),%xmm1
xorps  %xmm3,%xmm3
movsd  0xe4a(%rip),%xmm2
movaps %xmm3,%xmm0
cmpltsd %xmm1,%xmm0
movaps %xmm0,%xmm1
andpd  %xmm3,%xmm1
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11ec <scalbln+0xdc>
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    %eax,%edi
call   1030 <scalbn@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scalbln>:
movapd %xmm0,%xmm1
mov    0x2ec5(%rip),%rax
cmp    %rdi,(%rax)
jge    114d <scalbln+0x3d>
mov    0x2ec1(%rip),%rax
movsd  (%rax),%xmm2
movapd 0xedd(%rip),%xmm3
xorpd  %xmm2,%xmm3
xorpd  %xmm0,%xmm0
cmpltsd %xmm1,%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm3,%xmm0
orpd   %xmm2,%xmm0
ret
mov    0x2e84(%rip),%rax
cmp    %rdi,(%rax)
jle    116f <scalbln+0x5f>
xorpd  %xmm0,%xmm0
cmpltsd %xmm1,%xmm0
movsd  0xe96(%rip),%xmm1
andnpd %xmm1,%xmm0
ret
movapd %xmm1,%xmm0
jmp    1030 <scalbn@plt>

LLVM IR (-O0):
@INT_MAX = global i64 0
@HUGE_VAL = global double 0.000000e+00
@INT_MIN = global i64 0
define double @scalbln(double %0, i64 %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i64
store double %0, double* %4
store i64 %1, i64* %5
%6 = load i64, i64* %5
%7 = load i64, i64* @INT_MAX
%8 = icmp sgt i64 %6, %7
br i1 %8, label %9, label %19
9: ; preds = %2
%10 = load double, double* %4
%11 = fcmp ogt double %10, 0.000000e+00
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = load double, double* @HUGE_VAL
br label %17
14: ; preds = %9
%15 = load double, double* @HUGE_VAL
%16 = fneg double %15
br label %17
17: ; preds = %14, %12
%18 = phi double [ %13, %12 ], [ %16, %14 ]
store double %18, double* %3
br label %33
19: ; preds = %2
%20 = load i64, i64* %5
%21 = load i64, i64* @INT_MIN
%22 = icmp slt i64 %20, %21
br i1 %22, label %23, label %28
23: ; preds = %19
%24 = load double, double* %4
%25 = fcmp ogt double %24, 0.000000e+00
%26 = zext i1 %25 to i64
%27 = select i1 %25, double 0.000000e+00, double -0.000000e+00
store double %27, double* %3
br label %33
28: ; preds = %19
%29 = load double, double* %4
%30 = load i64, i64* %5
%31 = trunc i64 %30 to i32
%32 = call double @scalbn(double %29, i32 %31)
store double %32, double* %3
br label %33
33: ; preds = %28, %23, %17
%34 = load double, double* %3
ret double %34
}

LLVM IR (-O2):
@INT_MAX = global i64 0
@HUGE_VAL = global double 0.000000e+00
@INT_MIN = global i64 0
define double @scalbln(double %0, i64 %1) {
%3 = load i64, i64* @INT_MAX
%4 = icmp slt i64 %3, %1
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = fcmp ogt double %0, 0.000000e+00
%7 = load double, double* @HUGE_VAL
%8 = fneg double %7
%9 = select i1 %6, double %7, double %8
br label %19
10: ; preds = %2
%11 = load i64, i64* @INT_MIN
%12 = icmp sgt i64 %11, %1
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = fcmp ogt double %0, 0.000000e+00
%15 = select i1 %14, double 0.000000e+00, double -0.000000e+00
br label %19
16: ; preds = %10
%17 = trunc i64 %1 to i32
%18 = tail call double @scalbn(double %0, i32 %17)
br label %19
19: ; preds = %16, %13, %5
%20 = phi double [ %9, %5 ], [ %15, %13 ], [ %18, %16 ]
ret double %20
}