#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*/ FDLIBM_finite(double);
scalar_t__ FDLIBM_isnan(double);
double FDLIBM_rint(double);
double FDLIBM_scalbn(double, int);
double FDLIBM___ieee754_scalb(double x, double fn) {
  if (FDLIBM_isnan(x) || FDLIBM_isnan(fn))
    return x * fn;
  if (!FDLIBM_finite(fn)) {
    if (fn > 0.0)
      return x * fn;
    else
      return x / (-fn);
  }
  if (FDLIBM_rint(fn) != fn)
    return (fn - fn) / (fn - fn);
  if (fn > 65000.0)
    return FDLIBM_scalbn(x, 65000);
  if (-fn > 65000.0)
    return FDLIBM_scalbn(x, -65000);
  return FDLIBM_scalbn(x, (int)fn);
}


x86 assembly (clang, -O0):
<FDLIBM___ieee754_scalb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1060 <FDLIBM_isnan@plt>
cmp    $0x0,%rax
jne    117a <FDLIBM___ieee754_scalb+0x3a>
movsd  -0x18(%rbp),%xmm0
call   1060 <FDLIBM_isnan@plt>
cmp    $0x0,%rax
je     118e <FDLIBM___ieee754_scalb+0x4e>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12c3 <FDLIBM___ieee754_scalb+0x183>
movsd  -0x18(%rbp),%xmm0
call   1030 <FDLIBM_finite@plt>
cmp    $0x0,%eax
jne    11f6 <FDLIBM___ieee754_scalb+0xb6>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11c7 <FDLIBM___ieee754_scalb+0x87>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12c3 <FDLIBM___ieee754_scalb+0x183>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12c3 <FDLIBM___ieee754_scalb+0x183>
movsd  -0x18(%rbp),%xmm0
call   1040 <FDLIBM_rint@plt>
ucomisd -0x18(%rbp),%xmm0
jne    1216 <FDLIBM___ieee754_scalb+0xd6>
jp     1216 <FDLIBM___ieee754_scalb+0xd6>
jmp    1238 <FDLIBM___ieee754_scalb+0xf8>
movsd  -0x18(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12c3 <FDLIBM___ieee754_scalb+0x183>
movsd  -0x18(%rbp),%xmm0
movsd  0xdbb(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1268 <FDLIBM___ieee754_scalb+0x128>
movsd  -0x10(%rbp),%xmm0
mov    $0xfde8,%edi
call   1050 <FDLIBM_scalbn@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    12c3 <FDLIBM___ieee754_scalb+0x183>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xd74(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12af <FDLIBM___ieee754_scalb+0x16f>
movsd  -0x10(%rbp),%xmm0
mov    $0xffff0218,%edi
call   1050 <FDLIBM_scalbn@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    12c3 <FDLIBM___ieee754_scalb+0x183>
movsd  -0x10(%rbp),%xmm0
cvttsd2si -0x18(%rbp),%edi
call   1050 <FDLIBM_scalbn@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FDLIBM___ieee754_scalb>:
sub    $0x18,%rsp
movapd %xmm1,(%rsp)
movsd  %xmm0,0x10(%rsp)
call   1060 <FDLIBM_isnan@plt>
test   %rax,%rax
jne    1168 <FDLIBM___ieee754_scalb+0x28>
movapd (%rsp),%xmm0
call   1060 <FDLIBM_isnan@plt>
test   %rax,%rax
je     1178 <FDLIBM___ieee754_scalb+0x38>
movsd  0x10(%rsp),%xmm0
mulsd  (%rsp),%xmm0
add    $0x18,%rsp
ret
movapd (%rsp),%xmm0
call   1030 <FDLIBM_finite@plt>
test   %eax,%eax
je     11ab <FDLIBM___ieee754_scalb+0x6b>
movapd (%rsp),%xmm0
call   1040 <FDLIBM_rint@plt>
ucomisd (%rsp),%xmm0
jne    1199 <FDLIBM___ieee754_scalb+0x59>
jnp    11d6 <FDLIBM___ieee754_scalb+0x96>
movapd (%rsp),%xmm0
subsd  %xmm0,%xmm0
divsd  %xmm0,%xmm0
add    $0x18,%rsp
ret
xorpd  %xmm0,%xmm0
movapd (%rsp),%xmm1
ucomisd %xmm0,%xmm1
ja     1168 <FDLIBM___ieee754_scalb+0x28>
movapd (%rsp),%xmm1
xorpd  0xe49(%rip),%xmm1
movsd  0x10(%rsp),%xmm0
divsd  %xmm1,%xmm0
add    $0x18,%rsp
ret
movapd (%rsp),%xmm0
ucomisd 0xe1d(%rip),%xmm0
jbe    11f9 <FDLIBM___ieee754_scalb+0xb9>
movsd  0x10(%rsp),%xmm0
mov    $0xfde8,%edi
add    $0x18,%rsp
jmp    1050 <FDLIBM_scalbn@plt>
movsd  0xe07(%rip),%xmm0
ucomisd (%rsp),%xmm0
movsd  0x10(%rsp),%xmm0
jbe    121c <FDLIBM___ieee754_scalb+0xdc>
mov    $0xffff0218,%edi
add    $0x18,%rsp
jmp    1050 <FDLIBM_scalbn@plt>
cvttsd2si (%rsp),%edi
add    $0x18,%rsp
jmp    1050 <FDLIBM_scalbn@plt>

LLVM IR (-O0):
define double @FDLIBM___ieee754_scalb(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = call i64 @FDLIBM_isnan(double %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = load double, double* %5
%11 = call i64 @FDLIBM_isnan(double %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %9, %2
%14 = load double, double* %4
%15 = load double, double* %5
%16 = fmul double %14, %15
store double %16, double* %3
br label %64
17: ; preds = %9
%18 = load double, double* %5
%19 = call i32 @FDLIBM_finite(double %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %33, label %21
21: ; preds = %17
%22 = load double, double* %5
%23 = fcmp ogt double %22, 0.000000e+00
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = load double, double* %4
%26 = load double, double* %5
%27 = fmul double %25, %26
store double %27, double* %3
br label %64
28: ; preds = %21
%29 = load double, double* %4
%30 = load double, double* %5
%31 = fneg double %30
%32 = fdiv double %29, %31
store double %32, double* %3
br label %64
33: ; preds = %17
%34 = load double, double* %5
%35 = call double @FDLIBM_rint(double %34)
%36 = load double, double* %5
%37 = fcmp une double %35, %36
br i1 %37, label %38, label %46
38: ; preds = %33
%39 = load double, double* %5
%40 = load double, double* %5
%41 = fsub double %39, %40
%42 = load double, double* %5
%43 = load double, double* %5
%44 = fsub double %42, %43
%45 = fdiv double %41, %44
store double %45, double* %3
br label %64
46: ; preds = %33
%47 = load double, double* %5
%48 = fcmp ogt double %47, 6.500000e+04
br i1 %48, label %49, label %52
49: ; preds = %46
%50 = load double, double* %4
%51 = call double @FDLIBM_scalbn(double %50, i32 65000)
store double %51, double* %3
br label %64
52: ; preds = %46
%53 = load double, double* %5
%54 = fneg double %53
%55 = fcmp ogt double %54, 6.500000e+04
br i1 %55, label %56, label %59
56: ; preds = %52
%57 = load double, double* %4
%58 = call double @FDLIBM_scalbn(double %57, i32 -65000)
store double %58, double* %3
br label %64
59: ; preds = %52
%60 = load double, double* %4
%61 = load double, double* %5
%62 = fptosi double %61 to i32
%63 = call double @FDLIBM_scalbn(double %60, i32 %62)
store double %63, double* %3
br label %64
64: ; preds = %59, %56, %49, %38, %28, %24, %13
%65 = load double, double* %3
ret double %65
}

LLVM IR (-O2):
define double @FDLIBM___ieee754_scalb(double %0, double %1) {
%3 = tail call i64 @FDLIBM_isnan(double %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i64 @FDLIBM_isnan(double %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5, %2
%9 = fmul double %0, %1
br label %37
10: ; preds = %5
%11 = tail call i32 @FDLIBM_finite(double %1)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = fcmp ogt double %1, 0.000000e+00
br i1 %14, label %15, label %17
15: ; preds = %13
%16 = fmul double %0, %1
br label %37
17: ; preds = %13
%18 = fneg double %1
%19 = fdiv double %0, %18
br label %37
20: ; preds = %10
%21 = tail call double @FDLIBM_rint(double %1)
%22 = fcmp une double %21, %1
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = fsub double %1, %1
%25 = fdiv double %24, %24
br label %37
26: ; preds = %20
%27 = fcmp ogt double %1, 6.500000e+04
br i1 %27, label %28, label %30
28: ; preds = %26
%29 = tail call double @FDLIBM_scalbn(double %0, i32 65000)
br label %37
30: ; preds = %26
%31 = fcmp olt double %1, -6.500000e+04
br i1 %31, label %32, label %34
32: ; preds = %30
%33 = tail call double @FDLIBM_scalbn(double %0, i32 -65000)
br label %37
34: ; preds = %30
%35 = fptosi double %1 to i32
%36 = tail call double @FDLIBM_scalbn(double %0, i32 %35)
br label %37
37: ; preds = %34, %32, %28, %23, %17, %15, %8
%38 = phi double [ %9, %8 ], [ %25, %23 ], [ %29, %28 ], [ %33, %32 ], [ %36, %34 ], [ %16, %15 ], [ %19, %17 ]
ret double %38
}