#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
long double exp(long);
int /*<<< orphan*/ printf(char *);
void gausscr(FILE *fout, long double var, long double *gauss) {
  long i;
  long double Summ = 0.0;
  for (i = 0; i != 1500L + 1; i++) {
    gauss[i] = exp(-(i * i) / (2 * var));
    Summ += gauss[i];
  }
  for (i = 0; i != 1500L + 1; i++)
    gauss[i] /= Summ;
  for (i = 1; i != 1500L + 1; i++)
    gauss[i] = gauss[i] + gauss[i - 1];
  if (gauss[1500L] < 0.99999999)
    printf("gausscr - Kozel1!");
  gauss[1500L] = 1.0;
}


x86 assembly (clang, -O0):
<gausscr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
fldt   0x10(%rbp)
mov    %rdi,-0x8(%rbp)
fstpt  -0x20(%rbp)
mov    %rsi,-0x28(%rbp)
fldz
fstpt  -0x40(%rbp)
movq   $0x0,-0x30(%rbp)
cmpq   $0x5dd,-0x30(%rbp)
je     11c3 <gausscr+0xa3>
mov    -0x30(%rbp),%rax
imul   %rax,%rax
neg    %rax
mov    %rax,-0x50(%rbp)
fildll -0x50(%rbp)
fldt   -0x20(%rbp)
fadd   %st,%st(0)
fdivrp %st,%st(1)
fnstcw -0x52(%rbp)
movzwl -0x52(%rbp),%eax
or     $0xc00,%eax
mov    %ax,-0x54(%rbp)
fldcw  -0x54(%rbp)
fistpll -0x48(%rbp)
fldcw  -0x52(%rbp)
mov    -0x48(%rbp),%rdi
call   1040 <exp@plt>
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
shl    $0x4,%rcx
fstpt  (%rax,%rcx,1)
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
fldt   -0x40(%rbp)
faddp  %st,%st(1)
fstpt  -0x40(%rbp)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1143 <gausscr+0x23>
movq   $0x0,-0x30(%rbp)
cmpq   $0x5dd,-0x30(%rbp)
je     1201 <gausscr+0xe1>
fldt   -0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
fdivp  %st,%st(1)
fstpt  (%rax,%rcx,1)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    11cb <gausscr+0xab>
movq   $0x1,-0x30(%rbp)
cmpq   $0x5dd,-0x30(%rbp)
je     1240 <gausscr+0x120>
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
fldt   -0x10(%rax,%rcx,1)
faddp  %st,%st(1)
fstpt  (%rax,%rcx,1)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1209 <gausscr+0xe9>
mov    -0x28(%rbp),%rax
fldt   0x5dc0(%rax)
fldl   0xdb0(%rip)
fucomip %st(1),%st
fstp   %st(0)
jbe    126b <gausscr+0x14b>
jmp    125f <gausscr+0x13f>
lea    0xda2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
fld1
fstpt  0x5dc0(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gausscr>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%r14
fldt   0x50(%rsp)
fadd   %st,%st(0)
fstpt  0x18(%rsp)
fldz
xor    %ebx,%ebx
mov    %rsi,%r15
nopl   (%rax)
fstpt  0x24(%rsp)
mov    %rbx,%rax
imul   %rbx,%rax
neg    %rax
mov    %rax,0x8(%rsp)
fildll 0x8(%rsp)
fldt   0x18(%rsp)
fdivrp %st,%st(1)
fnstcw 0x4(%rsp)
movzwl 0x4(%rsp),%eax
or     $0xc00,%eax
mov    %ax,0x6(%rsp)
fldcw  0x6(%rsp)
fistpll 0x10(%rsp)
fldcw  0x4(%rsp)
mov    0x10(%rsp),%rdi
call   1040 <exp@plt>
fldt   0x24(%rsp)
fld    %st(1)
fstpt  (%r15)
faddp  %st,%st(1)
add    $0x1,%rbx
add    $0x10,%r15
cmp    $0x5dd,%rbx
jne    1140 <gausscr+0x20>
mov    $0x10,%eax
nopw   0x0(%rax,%rax,1)
fldt   -0x10(%r14,%rax,1)
fdiv   %st(1),%st
fstpt  -0x10(%r14,%rax,1)
cmp    $0x5dd0,%rax
je     11d4 <gausscr+0xb4>
fldt   (%r14,%rax,1)
fdiv   %st(1),%st
fstpt  (%r14,%rax,1)
add    $0x20,%rax
jmp    11b0 <gausscr+0x90>
fstp   %st(0)
fldt   (%r14)
mov    $0x40,%eax
xchg   %ax,%ax
fldt   -0x30(%r14,%rax,1)
faddp  %st,%st(1)
fld    %st(0)
fstpt  -0x30(%r14,%rax,1)
fldt   -0x20(%r14,%rax,1)
faddp  %st,%st(1)
fld    %st(0)
fstpt  -0x20(%r14,%rax,1)
fldt   -0x10(%r14,%rax,1)
faddp  %st,%st(1)
fld    %st(0)
fstpt  -0x10(%r14,%rax,1)
fldt   (%r14,%rax,1)
faddp  %st,%st(1)
fld    %st(0)
fstpt  (%r14,%rax,1)
add    $0x40,%rax
cmp    $0x5e00,%rax
jne    11e0 <gausscr+0xc0>
fstp   %st(0)
fldt   0x5dc0(%r14)
fldl   0xdcf(%rip)
fucomip %st(1),%st
fstp   %st(0)
jbe    1243 <gausscr+0x123>
lea    0xdca(%rip),%rdi
call   1030 <printf@plt>
fld1
fstpt  0x5dc0(%r14)
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [18 x i8] c"gausscr - Kozel1!\00"
define void @gausscr(i32* %0, x86_fp80 %1, x86_fp80* %2) {
%4 = alloca i32*
%5 = alloca x86_fp80
%6 = alloca x86_fp80*
%7 = alloca i64
%8 = alloca x86_fp80
store i32* %0, i32** %4
store x86_fp80 %1, x86_fp80* %5
store x86_fp80* %2, x86_fp80** %6
store x86_fp80 0xK00000000000000000000, x86_fp80* %8
store i64 0, i64* %7
br label %9
9: ; preds = %32, %3
%10 = load i64, i64* %7
%11 = icmp ne i64 %10, 1501
br i1 %11, label %12, label %35
12: ; preds = %9
%13 = load i64, i64* %7
%14 = load i64, i64* %7
%15 = mul nsw i64 %13, %14
%16 = sub nsw i64 0, %15
%17 = sitofp i64 %16 to x86_fp80
%18 = load x86_fp80, x86_fp80* %5
%19 = fmul x86_fp80 0xK40008000000000000000, %18
%20 = fdiv x86_fp80 %17, %19
%21 = fptosi x86_fp80 %20 to i64
%22 = call x86_fp80 @exp(i64 %21)
%23 = load x86_fp80*, x86_fp80** %6
%24 = load i64, i64* %7
%25 = getelementptr inbounds x86_fp80, x86_fp80* %23, i64 %24
store x86_fp80 %22, x86_fp80* %25
%26 = load x86_fp80*, x86_fp80** %6
%27 = load i64, i64* %7
%28 = getelementptr inbounds x86_fp80, x86_fp80* %26, i64 %27
%29 = load x86_fp80, x86_fp80* %28
%30 = load x86_fp80, x86_fp80* %8
%31 = fadd x86_fp80 %30, %29
store x86_fp80 %31, x86_fp80* %8
br label %32
32: ; preds = %12
%33 = load i64, i64* %7
%34 = add nsw i64 %33, 1
store i64 %34, i64* %7
br label %9
35: ; preds = %9
store i64 0, i64* %7
br label %36
36: ; preds = %46, %35
%37 = load i64, i64* %7
%38 = icmp ne i64 %37, 1501
br i1 %38, label %39, label %49
39: ; preds = %36
%40 = load x86_fp80, x86_fp80* %8
%41 = load x86_fp80*, x86_fp80** %6
%42 = load i64, i64* %7
%43 = getelementptr inbounds x86_fp80, x86_fp80* %41, i64 %42
%44 = load x86_fp80, x86_fp80* %43
%45 = fdiv x86_fp80 %44, %40
store x86_fp80 %45, x86_fp80* %43
br label %46
46: ; preds = %39
%47 = load i64, i64* %7
%48 = add nsw i64 %47, 1
store i64 %48, i64* %7
br label %36
49: ; preds = %36
store i64 1, i64* %7
br label %50
50: ; preds = %67, %49
%51 = load i64, i64* %7
%52 = icmp ne i64 %51, 1501
br i1 %52, label %53, label %70
53: ; preds = %50
%54 = load x86_fp80*, x86_fp80** %6
%55 = load i64, i64* %7
%56 = getelementptr inbounds x86_fp80, x86_fp80* %54, i64 %55
%57 = load x86_fp80, x86_fp80* %56
%58 = load x86_fp80*, x86_fp80** %6
%59 = load i64, i64* %7
%60 = sub nsw i64 %59, 1
%61 = getelementptr inbounds x86_fp80, x86_fp80* %58, i64 %60
%62 = load x86_fp80, x86_fp80* %61
%63 = fadd x86_fp80 %57, %62
%64 = load x86_fp80*, x86_fp80** %6
%65 = load i64, i64* %7
%66 = getelementptr inbounds x86_fp80, x86_fp80* %64, i64 %65
store x86_fp80 %63, x86_fp80* %66
br label %67
67: ; preds = %53
%68 = load i64, i64* %7
%69 = add nsw i64 %68, 1
store i64 %69, i64* %7
br label %50
70: ; preds = %50
%71 = load x86_fp80*, x86_fp80** %6
%72 = getelementptr inbounds x86_fp80, x86_fp80* %71, i64 1500
%73 = load x86_fp80, x86_fp80* %72
%74 = fcmp olt x86_fp80 %73, 0xK3FFEFFFFFFD50CE23800
br i1 %74, label %75, label %77
75: ; preds = %70
%76 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %77
77: ; preds = %75, %70
%78 = load x86_fp80*, x86_fp80** %6
%79 = getelementptr inbounds x86_fp80, x86_fp80* %78, i64 1500
store x86_fp80 0xK3FFF8000000000000000, x86_fp80* %79
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"gausscr - Kozel1!\00"
define void @gausscr(i32* nocapture readnone %0, x86_fp80 %1, x86_fp80* nocapture %2) {
%4 = fmul x86_fp80 %1, 0xK40008000000000000000
br label %5
5: ; preds = %3, %5
%6 = phi x86_fp80 [ 0xK00000000000000000000, %3 ], [ %15, %5 ]
%7 = phi i64 [ 0, %3 ], [ %16, %5 ]
%8 = mul i64 %7, %7
%9 = sub i64 0, %8
%10 = sitofp i64 %9 to x86_fp80
%11 = fdiv x86_fp80 %10, %4
%12 = fptosi x86_fp80 %11 to i64
%13 = tail call x86_fp80 @exp(i64 %12)
%14 = getelementptr inbounds x86_fp80, x86_fp80* %2, i64 %7
store x86_fp80 %13, x86_fp80* %14
%15 = fadd x86_fp80 %6, %13
%16 = add nuw nsw i64 %7, 1
%17 = icmp eq i64 %16, 1501
br i1 %17, label %18, label %5
18: ; preds = %5, %25
%19 = phi i64 [ %29, %25 ], [ 0, %5 ]
%20 = getelementptr inbounds x86_fp80, x86_fp80* %2, i64 %19
%21 = load x86_fp80, x86_fp80* %20
%22 = fdiv x86_fp80 %21, %15
store x86_fp80 %22, x86_fp80* %20
%23 = or i64 %19, 1
%24 = icmp eq i64 %23, 1501
br i1 %24, label %30, label %25
25: ; preds = %18
%26 = getelementptr inbounds x86_fp80, x86_fp80* %2, i64 %23
%27 = load x86_fp80, x86_fp80* %26
%28 = fdiv x86_fp80 %27, %15
store x86_fp80 %28, x86_fp80* %26
%29 = add nuw nsw i64 %19, 2
br label %18
30: ; preds = %18
%31 = load x86_fp80, x86_fp80* %2
br label %32
32: ; preds = %32, %30
%33 = phi x86_fp80 [ %31, %30 ], [ %49, %32 ]
%34 = phi i64 [ 1, %30 ], [ %50, %32 ]
%35 = getelementptr inbounds x86_fp80, x86_fp80* %2, i64 %34
%36 = load x86_fp80, x86_fp80* %35
%37 = fadd x86_fp80 %36, %33
store x86_fp80 %37, x86_fp80* %35
%38 = add nuw nsw i64 %34, 1
%39 = getelementptr inbounds x86_fp80, x86_fp80* %2, i64 %38
%40 = load x86_fp80, x86_fp80* %39
%41 = fadd x86_fp80 %40, %37
store x86_fp80 %41, x86_fp80* %39
%42 = add nuw nsw i64 %34, 2
%43 = getelementptr inbounds x86_fp80, x86_fp80* %2, i64 %42
%44 = load x86_fp80, x86_fp80* %43
%45 = fadd x86_fp80 %44, %41
store x86_fp80 %45, x86_fp80* %43
%46 = add nuw nsw i64 %34, 3
%47 = getelementptr inbounds x86_fp80, x86_fp80* %2, i64 %46
%48 = load x86_fp80, x86_fp80* %47
%49 = fadd x86_fp80 %48, %45
store x86_fp80 %49, x86_fp80* %47
%50 = add nuw nsw i64 %34, 4
%51 = icmp eq i64 %50, 1501
br i1 %51, label %52, label %32
52: ; preds = %32
%53 = getelementptr inbounds x86_fp80, x86_fp80* %2, i64 1500
%54 = load x86_fp80, x86_fp80* %53
%55 = fcmp olt x86_fp80 %54, 0xK3FFEFFFFFFD50CE23800
br i1 %55, label %56, label %58
56: ; preds = %52
%57 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %58
58: ; preds = %56, %52
store x86_fp80 0xK3FFF8000000000000000, x86_fp80* %53
ret void
}