#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 fabs(double);
int fact(int);
double fact2(int);
double pow(double, int);
double sqrt(double);
double Fm(int m, double x) {
  double precedent, current;
  int k;
  if ((x - 0.00000001) < 3.0e-7) {
    k = 1;
    current = 1 / (2 * m + 1);
    do {
      precedent = current;
      current += pow(-x, k) / (fact(k) * (2 * m + 2 * k + 1));
      k++;
    } while (fabs(precedent - current) > 3.0e-7);
    return current;
  } else {
    return fact2(2 * m - 1) / pow(2.0, m + 1) *
           sqrt(3.14159265358979323846 / pow(x, 2 * m + 1));
  }
}


x86 assembly (clang, -O0):
<Fm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  0xeab(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe97(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1239 <Fm+0xf9>
movl   $0x1,-0x2c(%rbp)
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x2c(%rbp),%edi
call   1050 <pow@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x2c(%rbp),%edi
call   1040 <fact@plt>
movsd  -0x38(%rbp),%xmm0
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
mov    -0x2c(%rbp),%edx
shl    $0x1,%edx
add    %edx,%ecx
add    $0x1,%ecx
imul   %ecx,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movaps 0xe0c(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xde0(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     1194 <Fm+0x54>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12a8 <Fm+0x168>
mov    -0xc(%rbp),%edi
shl    $0x1,%edi
sub    $0x1,%edi
call   1030 <fact2@plt>
movsd  %xmm0,-0x48(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
movsd  0xdbe(%rip),%xmm0
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0xc(%rbp),%edi
shl    $0x1,%edi
add    $0x1,%edi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xd82(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fm>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %edi,%r14d
movsd  0xead(%rip),%xmm1
movapd %xmm0,0x10(%rsp)
addsd  %xmm0,%xmm1
lea    (%r14,%r14,1),%ebx
movsd  0xe9f(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1217 <Fm+0xd7>
mov    %ebx,%eax
or     $0x1,%eax
add    $0x2,%ebx
xor    %ecx,%ecx
cmp    $0x3,%ebx
cmovb  %eax,%ecx
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
movapd 0x10(%rsp),%xmm0
xorpd  0xe88(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
lea    (%r14,%r14,1),%ebp
add    $0x3,%ebp
mov    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
movapd %xmm1,0x20(%rsp)
movaps 0x10(%rsp),%xmm0
mov    %ebx,%edi
call   1050 <pow@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1040 <fact@plt>
movsd  0xe31(%rip),%xmm1
imul   %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x8(%rsp),%xmm2
divsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
movapd 0x20(%rsp),%xmm2
addsd  %xmm2,%xmm0
add    $0x1,%ebx
subsd  %xmm0,%xmm2
andpd  0xe28(%rip),%xmm2
add    $0x2,%ebp
ucomisd %xmm1,%xmm2
movapd %xmm0,%xmm1
ja     11b0 <Fm+0x70>
jmp    128c <Fm+0x14c>
lea    -0x1(%rbx),%edi
call   1030 <fact2@plt>
movsd  %xmm0,0x8(%rsp)
add    $0x1,%r14d
movsd  0xddf(%rip),%xmm0
mov    %r14d,%edi
call   1050 <pow@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
or     $0x1,%ebx
movapd 0x10(%rsp),%xmm0
mov    %ebx,%edi
call   1050 <pow@plt>
movapd %xmm0,%xmm1
movsd  0xdb3(%rip),%xmm0
divsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1279 <Fm+0x139>
sqrtsd %xmm0,%xmm0
jmp    127e <Fm+0x13e>
call   1060 <sqrt@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double @Fm(i32 %0, double %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32
store i32 %0, i32* %4
store double %1, double* %5
%9 = load double, double* %5
%10 = fsub double %9, 1.000000e-08
%11 = fcmp olt double %10, 3.000000e-07
br i1 %11, label %12, label %47
12: ; preds = %2
store i32 1, i32* %8
%13 = load i32, i32* %4
%14 = mul nsw i32 2, %13
%15 = add nsw i32 %14, 1
%16 = sdiv i32 1, %15
%17 = sitofp i32 %16 to double
store double %17, double* %7
br label %18
18: ; preds = %39, %12
%19 = load double, double* %7
store double %19, double* %6
%20 = load double, double* %5
%21 = fneg double %20
%22 = load i32, i32* %8
%23 = call double @pow(double %21, i32 %22)
%24 = load i32, i32* %8
%25 = call i32 @fact(i32 %24)
%26 = load i32, i32* %4
%27 = mul nsw i32 2, %26
%28 = load i32, i32* %8
%29 = mul nsw i32 2, %28
%30 = add nsw i32 %27, %29
%31 = add nsw i32 %30, 1
%32 = mul nsw i32 %25, %31
%33 = sitofp i32 %32 to double
%34 = fdiv double %23, %33
%35 = load double, double* %7
%36 = fadd double %35, %34
store double %36, double* %7
%37 = load i32, i32* %8
%38 = add nsw i32 %37, 1
store i32 %38, i32* %8
br label %39
39: ; preds = %18
%40 = load double, double* %6
%41 = load double, double* %7
%42 = fsub double %40, %41
%43 = call double @llvm.fabs.f64(double %42)
%44 = fcmp ogt double %43, 3.000000e-07
br i1 %44, label %18, label %45
45: ; preds = %39
%46 = load double, double* %7
store double %46, double* %3
br label %64
47: ; preds = %2
%48 = load i32, i32* %4
%49 = mul nsw i32 2, %48
%50 = sub nsw i32 %49, 1
%51 = call double @fact2(i32 %50)
%52 = load i32, i32* %4
%53 = add nsw i32 %52, 1
%54 = call double @pow(double 2.000000e+00, i32 %53)
%55 = fdiv double %51, %54
%56 = load double, double* %5
%57 = load i32, i32* %4
%58 = mul nsw i32 2, %57
%59 = add nsw i32 %58, 1
%60 = call double @pow(double %56, i32 %59)
%61 = fdiv double 0x400921FB54442D18, %60
%62 = call double @sqrt(double %61)
%63 = fmul double %55, %62
store double %63, double* %3
br label %64
64: ; preds = %47, %45
%65 = load double, double* %3
ret double %65
}

LLVM IR (-O2):
define double @Fm(i32 %0, double %1) {
%3 = fadd double %1, -1.000000e-08
%4 = fcmp olt double %3, 3.000000e-07
%5 = shl nsw i32 %0, 1
br i1 %4, label %6, label %29
6: ; preds = %2
%7 = or i32 %5, 1
%8 = add i32 %5, 2
%9 = icmp ult i32 %8, 3
%10 = select i1 %9, i32 %7, i32 0
%11 = sitofp i32 %10 to double
%12 = fneg double %1
br label %13
13: ; preds = %13, %6
%14 = phi double [ %11, %6 ], [ %24, %13 ]
%15 = phi i32 [ 1, %6 ], [ %25, %13 ]
%16 = tail call double @pow(double %12, i32 %15)
%17 = tail call i32 @fact(i32 %15)
%18 = add nsw i32 %15, %0
%19 = shl nsw i32 %18, 1
%20 = or i32 %19, 1
%21 = mul nsw i32 %20, %17
%22 = sitofp i32 %21 to double
%23 = fdiv double %16, %22
%24 = fadd double %14, %23
%25 = add nuw nsw i32 %15, 1
%26 = fsub double %14, %24
%27 = tail call double @llvm.fabs.f64(double %26)
%28 = fcmp ogt double %27, 3.000000e-07
br i1 %28, label %13, label %40
29: ; preds = %2
%30 = add nsw i32 %5, -1
%31 = tail call double @fact2(i32 %30)
%32 = add nsw i32 %0, 1
%33 = tail call double @pow(double 2.000000e+00, i32 %32)
%34 = fdiv double %31, %33
%35 = or i32 %5, 1
%36 = tail call double @pow(double %1, i32 %35)
%37 = fdiv double 0x400921FB54442D18, %36
%38 = tail call double @sqrt(double %37)
%39 = fmul double %34, %38
br label %40
40: ; preds = %13, %29
%41 = phi double [ %39, %29 ], [ %24, %13 ]
ret double %41
}