#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 Fct(int);
scalar_t__ pow(double, double);
double sqrt(int);
double murzin_P(int n, int m, double p) {
  double Pm;
  double sigma;
  double m_o;
  double t1, t2;
  sigma = sqrt(n * p * (1 - p));
  m_o = n * p;
  if (m <= (m_o + sigma)) {
    Pm = 1.0;
  } else {
    t1 = Fct(n) / (Fct(m) * Fct(n - m));
    t2 = (double)pow((double)p, (double)m) *
         (double)pow((double)(1 - p), (double)(n - m));
    Pm = t1 * t2;
  }
  if (Pm < 1e-100) {
    Pm = 0.0;
  }
  return Pm;
}


x86 assembly (clang, -O0):
<murzin_P>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xeab(%rip),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     11a6 <murzin_P+0x76>
movsd  0xe64(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    123c <murzin_P+0x10c>
mov    -0x4(%rbp),%edi
call   1030 <Fct@plt>
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <Fct@plt>
movsd  %xmm0,-0x50(%rbp)
mov    -0x4(%rbp),%edi
sub    -0x8(%rbp),%edi
call   1030 <Fct@plt>
movsd  -0x50(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
call   1040 <pow@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xdfa(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm1
call   1040 <pow@plt>
movsd  -0x40(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xdc4(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1257 <murzin_P+0x127>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<murzin_P>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
mov    %esi,%ebp
mov    %edi,%ebx
cvtsi2sd %edi,%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,(%rsp)
movsd  0xeb1(%rip),%xmm1
movsd  %xmm0,0x8(%rsp)
subsd  %xmm0,%xmm1
movapd %xmm2,%xmm0
movsd  %xmm1,0x20(%rsp)
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <sqrt@plt>
movsd  0xe88(%rip),%xmm2
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
addsd  (%rsp),%xmm0
ucomisd %xmm1,%xmm0
jae    120e <murzin_P+0xde>
mov    %ebx,%edi
movsd  %xmm1,0x18(%rsp)
call   1030 <Fct@plt>
movsd  %xmm0,(%rsp)
mov    %ebp,%edi
call   1030 <Fct@plt>
movsd  %xmm0,0x10(%rsp)
sub    %ebp,%ebx
mov    %ebx,%edi
call   1030 <Fct@plt>
mulsd  0x10(%rsp),%xmm0
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,0x8(%rsp)
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
movsd  0x20(%rsp),%xmm0
call   1040 <pow@plt>
xorps  %xmm2,%xmm2
cvtsi2sd %rax,%xmm2
mulsd  0x8(%rsp),%xmm2
mulsd  (%rsp),%xmm2
movapd %xmm2,%xmm0
cmpltsd 0xded(%rip),%xmm0
andnpd %xmm2,%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define double @murzin_P(i32 %0, i32 %1, double %2) {
%4 = sitofp i32 %0 to double
%5 = fmul double %4, %2
%6 = fsub double 1.000000e+00, %2
%7 = fmul double %5, %6
%8 = fptosi double %7 to i32
%9 = tail call double @sqrt(i32 %8)
%10 = sitofp i32 %1 to double
%11 = fadd double %5, %9
%12 = fcmp ult double %11, %10
br i1 %12, label %13, label %27
13: ; preds = %3
%14 = tail call double @Fct(i32 %0)
%15 = tail call double @Fct(i32 %1)
%16 = sub nsw i32 %0, %1
%17 = tail call double @Fct(i32 %16)
%18 = fmul double %15, %17
%19 = fdiv double %14, %18
%20 = tail call i64 @pow(double %2, double %10)
%21 = sitofp i64 %20 to double
%22 = sitofp i32 %16 to double
%23 = tail call i64 @pow(double %6, double %22)
%24 = sitofp i64 %23 to double
%25 = fmul double %21, %24
%26 = fmul double %19, %25
br label %27
27: ; preds = %3, %13
%28 = phi double [ %26, %13 ], [ 1.000000e+00, %3 ]
%29 = fcmp olt double %28, 1.000000e-100
%30 = select i1 %29, double 0.000000e+00, double %28
ret double %30
}