#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 */
scalar_t__ INT_MAX;
scalar_t__ get_k(double);
double pow(double, int);
double get_rm_bound(double u, int k) {
  if (k <= 0)
    k = (double)get_k(20.0);
  double r;
  r = (2 * k + 2 * (1 - u)) / (k + 2 * (1 - u));
  r = pow(r, 1 / ((double)INT_MAX));
  r = r - 1;
  r = u * ((double)INT_MAX) * r;
  return r;
}


x86 assembly (clang, -O0):
<get_rm_bound>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     1153 <get_rm_bound+0x33>
movsd  0xebe(%rip),%xmm0
call   1030 <get_k@plt>
cvtsi2sd %rax,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0xea3(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm2
movsd  0xe89(%rip),%xmm1
subsd  -0x8(%rbp),%xmm1
addsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    0x2e47(%rip),%rax
cvtsi2sdq (%rax),%xmm2
movsd  0xe5a(%rip),%xmm1
divsd  %xmm2,%xmm1
cvttsd2si %xmm1,%edi
call   1040 <pow@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe3b(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    0x2e06(%rip),%rax
cvtsi2sdq (%rax),%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_rm_bound>:
push   %rbx
sub    $0x10,%rsp
movapd %xmm0,%xmm4
test   %edi,%edi
movsd  %xmm0,0x8(%rsp)
jg     1149 <get_rm_bound+0x29>
movsd  0xec5(%rip),%xmm0
call   1030 <get_k@plt>
movsd  0x8(%rsp),%xmm4
mov    %rax,%rdi
movsd  0xeb7(%rip),%xmm1
movapd %xmm1,%xmm0
movd   %edi,%xmm2
add    %edi,%edi
movd   %edi,%xmm3
punpckldq %xmm2,%xmm3
cvtdq2pd %xmm3,%xmm2
subsd  %xmm4,%xmm0
addsd  %xmm0,%xmm0
unpcklpd %xmm0,%xmm0
addpd  %xmm2,%xmm0
movapd %xmm0,%xmm2
unpckhpd %xmm0,%xmm2
mov    0x2e62(%rip),%rbx
xorps  %xmm3,%xmm3
cvtsi2sdq (%rbx),%xmm3
divsd  %xmm2,%xmm0
divsd  %xmm3,%xmm1
cvttsd2si %xmm1,%edi
call   1040 <pow@plt>
addsd  0xe69(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%rbx),%xmm1
mulsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@INT_MAX = global i64 0
define double @get_rm_bound(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
store double %0, double* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp sle i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = call i64 @get_k(double 2.000000e+01)
%10 = sitofp i64 %9 to double
%11 = fptosi double %10 to i32
store i32 %11, i32* %4
br label %12
12: ; preds = %8, %2
%13 = load i32, i32* %4
%14 = mul nsw i32 2, %13
%15 = sitofp i32 %14 to double
%16 = load double, double* %3
%17 = fsub double 1.000000e+00, %16
%18 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %17, double %15)
%19 = load i32, i32* %4
%20 = sitofp i32 %19 to double
%21 = load double, double* %3
%22 = fsub double 1.000000e+00, %21
%23 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %22, double %20)
%24 = fdiv double %18, %23
store double %24, double* %5
%25 = load double, double* %5
%26 = load i64, i64* @INT_MAX
%27 = sitofp i64 %26 to double
%28 = fdiv double 1.000000e+00, %27
%29 = fptosi double %28 to i32
%30 = call double @pow(double %25, i32 %29)
store double %30, double* %5
%31 = load double, double* %5
%32 = fsub double %31, 1.000000e+00
store double %32, double* %5
%33 = load double, double* %3
%34 = load i64, i64* @INT_MAX
%35 = sitofp i64 %34 to double
%36 = fmul double %33, %35
%37 = load double, double* %5
%38 = fmul double %36, %37
store double %38, double* %5
%39 = load double, double* %5
ret double %39
}

LLVM IR (-O2):
@INT_MAX = global i64 0
define double @get_rm_bound(double %0, i32 %1) {
%3 = icmp slt i32 %1, 1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i64 @get_k(double 2.000000e+01)
%6 = trunc i64 %5 to i32
br label %7
7: ; preds = %4, %2
%8 = phi i32 [ %6, %4 ], [ %1, %2 ]
%9 = shl nsw i32 %8, 1
%10 = fsub double 1.000000e+00, %0
%11 = insertelement <2 x i32> poison, i32 %9, i64 0
%12 = insertelement <2 x i32> %11, i32 %8, i64 1
%13 = sitofp <2 x i32> %12 to <2 x double>
%14 = insertelement <2 x double> poison, double %10, i64 0
%15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
%16 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %15, <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> %13)
%17 = extractelement <2 x double> %16, i64 0
%18 = extractelement <2 x double> %16, i64 1
%19 = fdiv double %17, %18
%20 = load i64, i64* @INT_MAX
%21 = sitofp i64 %20 to double
%22 = fdiv double 1.000000e+00, %21
%23 = fptosi double %22 to i32
%24 = tail call double @pow(double %19, i32 %23)
%25 = fadd double %24, -1.000000e+00
%26 = load i64, i64* @INT_MAX
%27 = sitofp i64 %26 to double
%28 = fmul double %27, %0
%29 = fmul double %25, %28
ret double %29
}