#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 */
float exp(float);
double fabs(float);
float probks(float alam) {
  int j;
  float a2, fac = 2.0, sum = 0.0, term, termbf = 0.0;
  a2 = -2.0 * alam * alam;
  for (j = 1; j <= 100; j++) {
    term = fac * exp(a2 * j * j);
    sum += term;
    if (fabs(term) <= 0.001 * termbf || fabs(term) <= 1.0e-8 * sum)
      return sum;
    fac = -fac;
    termbf = fabs(term);
  }
  return 1.0;
}


x86 assembly (clang, -O0):
<probks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x8(%rbp)
movss  0xee3(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xea5(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jg     126b <probks+0x14b>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x10(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm2
movsd  0xe1e(%rip),%xmm0
mulsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jae    1224 <probks+0x104>
movss  -0x1c(%rbp),%xmm0
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm2
movsd  0xdfa(%rip),%xmm0
mulsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jb     1233 <probks+0x113>
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1278 <probks+0x158>
movss  -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117c <probks+0x5c>
movss  0xda9(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<probks>:
push   %rbx
sub    $0x20,%rsp
cvtss2sd %xmm0,%xmm0
movsd  0xecf(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0x8(%rsp)
mov    $0x1,%ebx
movss  0xec5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
xorps  %xmm1,%xmm1
xorps  %xmm0,%xmm0
movss  %xmm0,(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movss  %xmm1,0xc(%rsp)
xorps  %xmm1,%xmm1
cvtsi2ss %ebx,%xmm1
movss  0x8(%rsp),%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
call   1040 <exp@plt>
mulss  0x10(%rsp),%xmm0
movss  (%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,(%rsp)
movss  %xmm0,0x4(%rsp)
call   1030 <fabs@plt>
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0xe47(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1225 <probks+0x105>
movss  0x4(%rsp),%xmm0
call   1030 <fabs@plt>
movss  (%rsp),%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
mulsd  0xe2a(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    122c <probks+0x10c>
movaps 0x10(%rsp),%xmm0
xorps  0xe28(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movss  0x4(%rsp),%xmm0
call   1030 <fabs@plt>
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
add    $0x1,%ebx
cmp    $0x65,%ebx
jne    1170 <probks+0x50>
movss  0xdf9(%rip),%xmm0
jmp    122f <probks+0x10f>
movss  (%rsp),%xmm0
jmp    122f <probks+0x10f>
movaps %xmm2,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

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

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