#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 exp(double);
double pow(double, int);
void poiscalc(double ratio, double ppois[10], double refppois[10]) {
  double refppoi[] = {0.3678794, 0.7357589, 0.9196986, 0.9810118, 0.9963402,
                      0.9994058, 0.9999168, 0.9999898, 0.9999989, 0.9999999};
  int i;
  for (i = 0; i < 10; i++) {
    refppois[i] = refppoi[i];
  }
  double fac[] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880};
  ppois[0] = exp(ratio * -1);
  for (i = 1; i < 10; i++) {
    ppois[i] = ppois[i - 1] + pow(ratio, i) * exp(ratio * -1) / fac[i];
  }
  return;
}


x86 assembly (clang, -O0):
<poiscalc>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x50,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0xa,-0x74(%rbp)
jge    1193 <poiscalc+0x63>
movslq -0x74(%rbp),%rax
movsd  -0x70(%rbp,%rax,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1164 <poiscalc+0x34>
lea    -0xd0(%rbp),%rdi
lea    0xebf(%rip),%rsi
mov    $0x50,%edx
call   1030 <memcpy@plt>
movsd  0xe4d(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1040 <exp@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x74(%rbp)
cmpl   $0xa,-0x74(%rbp)
jge    125a <poiscalc+0x12a>
mov    -0x10(%rbp),%rax
mov    -0x74(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
mov    -0x74(%rbp),%edi
call   1050 <pow@plt>
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  0xdf3(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1040 <exp@plt>
movsd  -0xe0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xd8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
movslq -0x74(%rbp),%rax
divsd  -0xd0(%rbp,%rax,8),%xmm1
ff ff
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    11cc <poiscalc+0x9c>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<poiscalc>:
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rbx
movaps %xmm0,0x10(%rsp)
movaps 0xf5c(%rip),%xmm1
movups %xmm1,0x40(%rsi)
movaps 0xf41(%rip),%xmm1
movups %xmm1,0x30(%rsi)
movaps 0xf26(%rip),%xmm1
movups %xmm1,0x20(%rsi)
movaps 0xf0b(%rip),%xmm1
movups %xmm1,0x10(%rsi)
movaps 0xef0(%rip),%xmm1
movups %xmm1,(%rsi)
movaps 0xe96(%rip),%xmm1
xorps  %xmm0,%xmm1
movaps %xmm1,0x20(%rsp)
movaps %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,(%rsp)
movsd  %xmm0,(%rbx)
movaps 0x10(%rsp),%xmm0
mov    $0x1,%edi
call   1040 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
call   1030 <exp@plt>
mulsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  %xmm0,0x8(%rbx)
movaps 0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
call   1030 <exp@plt>
mulsd  0x8(%rsp),%xmm0
mulsd  0xe2a(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  %xmm0,0x10(%rbx)
movaps 0x10(%rsp),%xmm0
mov    $0x3,%edi
call   1040 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
call   1030 <exp@plt>
mulsd  0x8(%rsp),%xmm0
divsd  0xdf5(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  %xmm0,0x18(%rbx)
movaps 0x10(%rsp),%xmm0
mov    $0x4,%edi
call   1040 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
call   1030 <exp@plt>
mulsd  0x8(%rsp),%xmm0
divsd  0xdc0(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  %xmm0,0x20(%rbx)
movaps 0x10(%rsp),%xmm0
mov    $0x5,%edi
call   1040 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
call   1030 <exp@plt>
mulsd  0x8(%rsp),%xmm0
divsd  0xd8b(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  %xmm0,0x28(%rbx)
movaps 0x10(%rsp),%xmm0
mov    $0x6,%edi
call   1040 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
call   1030 <exp@plt>
mulsd  0x8(%rsp),%xmm0
divsd  0xd56(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  %xmm0,0x30(%rbx)
movaps 0x10(%rsp),%xmm0
mov    $0x7,%edi
call   1040 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
call   1030 <exp@plt>
mulsd  0x8(%rsp),%xmm0
divsd  0xd21(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  %xmm0,0x38(%rbx)
movaps 0x10(%rsp),%xmm0
mov    $0x8,%edi
call   1040 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
call   1030 <exp@plt>
mulsd  0x8(%rsp),%xmm0
divsd  0xcec(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  %xmm0,0x40(%rbx)
movaps 0x10(%rsp),%xmm0
mov    $0x9,%edi
call   1040 <pow@plt>
movsd  %xmm0,0x10(%rsp)
movapd 0x20(%rsp),%xmm0
call   1030 <exp@plt>
mulsd  0x10(%rsp),%xmm0
divsd  0xcb7(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,0x48(%rbx)
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.poiscalc.refppoi = [10 x double] [double 0x3FD78B5609F7D087, double 0x3FE78B563FA7B5BC, double 0x3FED6E2BC225A9DE, double 0x3FEF6472DBBFAED7, double 0x3FEFE204D7D6154B, double 0x3FEFFB21DF4DD8D1, double 0x3FEFFF5184571236, double 0x3FEFFFEA9BEAACB2, double 0x3FEFFFFDB17126B4, double 0x3FEFFFFFCA501ACB]
@__const.poiscalc.fac = [10 x double] [double 1.000000e+00, double 1.000000e+00, double 2.000000e+00, double 6.000000e+00, double 2.400000e+01, double 1.200000e+02, double 7.200000e+02, double 5.040000e+03, double 4.032000e+04, double 3.628800e+05]
define void @poiscalc(double %0, double* %1, double* %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca double*
%7 = alloca [10 x double]
%8 = alloca i32
%9 = alloca [10 x double]
store double %0, double* %4
store double* %1, double** %5
store double* %2, double** %6
%10 = bitcast [10 x double]* %7 to i8*
store i32 0, i32* %8
br label %11
11: ; preds = %23, %3
%12 = load i32, i32* %8
%13 = icmp slt i32 %12, 10
br i1 %13, label %14, label %26
14: ; preds = %11
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [10 x double], [10 x double]* %7, i64 0, i64 %16
%18 = load double, double* %17
%19 = load double*, double** %6
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %19, i64 %21
store double %18, double* %22
br label %23
23: ; preds = %14
%24 = load i32, i32* %8
%25 = add nsw i32 %24, 1
store i32 %25, i32* %8
br label %11
26: ; preds = %11
%27 = bitcast [10 x double]* %9 to i8*
%28 = load double, double* %4
%29 = fmul double %28, -1.000000e+00
%30 = call double @exp(double %29)
%31 = load double*, double** %5
%32 = getelementptr inbounds double, double* %31, i64 0
store double %30, double* %32
store i32 1, i32* %8
br label %33
33: ; preds = %60, %26
%34 = load i32, i32* %8
%35 = icmp slt i32 %34, 10
br i1 %35, label %36, label %63
36: ; preds = %33
%37 = load double*, double** %5
%38 = load i32, i32* %8
%39 = sub nsw i32 %38, 1
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %37, i64 %40
%42 = load double, double* %41
%43 = load double, double* %4
%44 = load i32, i32* %8
%45 = call double @pow(double %43, i32 %44)
%46 = load double, double* %4
%47 = fmul double %46, -1.000000e+00
%48 = call double @exp(double %47)
%49 = fmul double %45, %48
%50 = load i32, i32* %8
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [10 x double], [10 x double]* %9, i64 0, i64 %51
%53 = load double, double* %52
%54 = fdiv double %49, %53
%55 = fadd double %42, %54
%56 = load double*, double** %5
%57 = load i32, i32* %8
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
store double %55, double* %59
br label %60
60: ; preds = %36
%61 = load i32, i32* %8
%62 = add nsw i32 %61, 1
store i32 %62, i32* %8
br label %33
63: ; preds = %33
ret void
}

LLVM IR (-O2):
@__const.poiscalc.refppoi = [10 x double] [double 0x3FD78B5609F7D087, double 0x3FE78B563FA7B5BC, double 0x3FED6E2BC225A9DE, double 0x3FEF6472DBBFAED7, double 0x3FEFE204D7D6154B, double 0x3FEFFB21DF4DD8D1, double 0x3FEFFF5184571236, double 0x3FEFFFEA9BEAACB2, double 0x3FEFFFFDB17126B4, double 0x3FEFFFFFCA501ACB]
define void @poiscalc(double %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = bitcast double* %2 to i8*
%5 = fneg double %0
%6 = tail call double @exp(double %5)
store double %6, double* %1
%7 = tail call double @pow(double %0, i32 1)
%8 = tail call double @exp(double %5)
%9 = fmul double %7, %8
%10 = fadd double %6, %9
%11 = getelementptr inbounds double, double* %1, i64 1
store double %10, double* %11
%12 = tail call double @pow(double %0, i32 2)
%13 = tail call double @exp(double %5)
%14 = fmul double %12, %13
%15 = fmul double %14, 5.000000e-01
%16 = fadd double %10, %15
%17 = getelementptr inbounds double, double* %1, i64 2
store double %16, double* %17
%18 = tail call double @pow(double %0, i32 3)
%19 = tail call double @exp(double %5)
%20 = fmul double %18, %19
%21 = fdiv double %20, 6.000000e+00
%22 = fadd double %16, %21
%23 = getelementptr inbounds double, double* %1, i64 3
store double %22, double* %23
%24 = tail call double @pow(double %0, i32 4)
%25 = tail call double @exp(double %5)
%26 = fmul double %24, %25
%27 = fdiv double %26, 2.400000e+01
%28 = fadd double %22, %27
%29 = getelementptr inbounds double, double* %1, i64 4
store double %28, double* %29
%30 = tail call double @pow(double %0, i32 5)
%31 = tail call double @exp(double %5)
%32 = fmul double %30, %31
%33 = fdiv double %32, 1.200000e+02
%34 = fadd double %28, %33
%35 = getelementptr inbounds double, double* %1, i64 5
store double %34, double* %35
%36 = tail call double @pow(double %0, i32 6)
%37 = tail call double @exp(double %5)
%38 = fmul double %36, %37
%39 = fdiv double %38, 7.200000e+02
%40 = fadd double %34, %39
%41 = getelementptr inbounds double, double* %1, i64 6
store double %40, double* %41
%42 = tail call double @pow(double %0, i32 7)
%43 = tail call double @exp(double %5)
%44 = fmul double %42, %43
%45 = fdiv double %44, 5.040000e+03
%46 = fadd double %40, %45
%47 = getelementptr inbounds double, double* %1, i64 7
store double %46, double* %47
%48 = tail call double @pow(double %0, i32 8)
%49 = tail call double @exp(double %5)
%50 = fmul double %48, %49
%51 = fdiv double %50, 4.032000e+04
%52 = fadd double %46, %51
%53 = getelementptr inbounds double, double* %1, i64 8
store double %52, double* %53
%54 = tail call double @pow(double %0, i32 9)
%55 = tail call double @exp(double %5)
%56 = fmul double %54, %55
%57 = fdiv double %56, 3.628800e+05
%58 = fadd double %52, %57
%59 = getelementptr inbounds double, double* %1, i64 9
store double %58, double* %59
ret void
}