#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 fabs(double);
double probks(double alam) {
  int i;
  double EPS1 = 0.001, EPS2 = 1.E-8, FAC = 2.0, A2 = -2.0 * (alam * alam),
         PROBKS = 0.0, TERMBF = 0.0, TERM = 0.0;
  for (i = 1; i <= 100; i++) {
    TERM = FAC * exp(A2 * i * i);
    PROBKS = PROBKS + TERM;
    if ((fabs(TERM) < EPS1 * TERMBF) || (fabs(TERM) < EPS2 * PROBKS))
      return PROBKS;
    FAC = -FAC;
    TERMBF = fabs(TERM);
  }
  PROBKS = 1.0;
  return PROBKS;
}


x86 assembly (clang, -O0):
<probks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  0xef3(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xede(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  0xeaa(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jg     1269 <probks+0x159>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x50(%rbp),%xmm1
movaps 0xe56(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     1216 <probks+0x106>
movsd  -0x50(%rbp),%xmm1
movaps 0xe32(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1225 <probks+0x115>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1280 <probks+0x170>
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x50(%rbp),%xmm0
movaps 0xdde(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117e <probks+0x6e>
movsd  0xdaf(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<probks>:
push   %rbx
sub    $0x30,%rsp
mulsd  %xmm0,%xmm0
mulsd  0xedf(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0x1,%ebx
movsd  0xed4(%rip),%xmm3
xorpd  %xmm0,%xmm0
xorpd  %xmm2,%xmm2
nopl   0x0(%rax)
movsd  %xmm0,0x10(%rsp)
movapd %xmm3,0x20(%rsp)
movsd  %xmm2,0x18(%rsp)
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movapd 0x20(%rsp),%xmm3
movsd  0x18(%rsp),%xmm2
mulsd  %xmm3,%xmm0
addsd  %xmm0,%xmm2
andpd  0xea8(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  0xe7a(%rip),%xmm1
ucomisd %xmm0,%xmm1
movapd %xmm2,%xmm1
mulsd  0xe72(%rip),%xmm1
ja     11c6 <probks+0xb6>
ucomisd %xmm0,%xmm1
ja     11c6 <probks+0xb6>
xorpd  0xe8a(%rip),%xmm3
add    $0x1,%ebx
cmp    $0x65,%ebx
jne    1140 <probks+0x30>
movsd  0xe5a(%rip),%xmm2
movapd %xmm2,%xmm0
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @probks(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store double %0, double* %3
store double 1.000000e-03, double* %5
store double 1.000000e-08, double* %6
store double 2.000000e+00, double* %7
%12 = load double, double* %3
%13 = load double, double* %3
%14 = fmul double %12, %13
%15 = fmul double -2.000000e+00, %14
store double %15, double* %8
store double 0.000000e+00, double* %9
store double 0.000000e+00, double* %10
store double 0.000000e+00, double* %11
store i32 1, i32* %4
br label %16
16: ; preds = %53, %1
%17 = load i32, i32* %4
%18 = icmp sle i32 %17, 100
br i1 %18, label %19, label %56
19: ; preds = %16
%20 = load double, double* %7
%21 = load double, double* %8
%22 = load i32, i32* %4
%23 = sitofp i32 %22 to double
%24 = fmul double %21, %23
%25 = load i32, i32* %4
%26 = sitofp i32 %25 to double
%27 = fmul double %24, %26
%28 = call double @exp(double %27)
%29 = fmul double %20, %28
store double %29, double* %11
%30 = load double, double* %9
%31 = load double, double* %11
%32 = fadd double %30, %31
store double %32, double* %9
%33 = load double, double* %11
%34 = call double @llvm.fabs.f64(double %33)
%35 = load double, double* %5
%36 = load double, double* %10
%37 = fmul double %35, %36
%38 = fcmp olt double %34, %37
br i1 %38, label %46, label %39
39: ; preds = %19
%40 = load double, double* %11
%41 = call double @llvm.fabs.f64(double %40)
%42 = load double, double* %6
%43 = load double, double* %9
%44 = fmul double %42, %43
%45 = fcmp olt double %41, %44
br i1 %45, label %46, label %48
46: ; preds = %39, %19
%47 = load double, double* %9
store double %47, double* %2
br label %58
48: ; preds = %39
%49 = load double, double* %7
%50 = fneg double %49
store double %50, double* %7
%51 = load double, double* %11
%52 = call double @llvm.fabs.f64(double %51)
store double %52, double* %10
br label %53
53: ; preds = %48
%54 = load i32, i32* %4
%55 = add nsw i32 %54, 1
store i32 %55, i32* %4
br label %16
56: ; preds = %16
store double 1.000000e+00, double* %9
%57 = load double, double* %9
store double %57, double* %2
br label %58
58: ; preds = %56, %46
%59 = load double, double* %2
ret double %59
}

LLVM IR (-O2):
define double @probks(double %0) {
%2 = fmul double %0, %0
%3 = fmul double %2, -2.000000e+00
br label %4
4: ; preds = %1, %21
%5 = phi double [ 0.000000e+00, %1 ], [ %15, %21 ]
%6 = phi double [ 0.000000e+00, %1 ], [ %14, %21 ]
%7 = phi double [ 2.000000e+00, %1 ], [ %22, %21 ]
%8 = phi i32 [ 1, %1 ], [ %23, %21 ]
%9 = sitofp i32 %8 to double
%10 = fmul double %3, %9
%11 = fmul double %10, %9
%12 = tail call double @exp(double %11)
%13 = fmul double %7, %12
%14 = fadd double %6, %13
%15 = tail call double @llvm.fabs.f64(double %13)
%16 = fmul double %5, 1.000000e-03
%17 = fcmp olt double %15, %16
%18 = fmul double %14, 1.000000e-08
%19 = fcmp olt double %15, %18
%20 = select i1 %17, i1 true, i1 %19
br i1 %20, label %25, label %21
21: ; preds = %4
%22 = fneg double %7
%23 = add nuw nsw i32 %8, 1
%24 = icmp eq i32 %23, 101
br i1 %24, label %25, label %4
25: ; preds = %21, %4
%26 = phi double [ %14, %4 ], [ 1.000000e+00, %21 ]
ret double %26
}