#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 *calloc(long, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ gausscr(int /*<<< orphan*/ *, long double, long double *);
int /*<<< orphan*/ poissoncr(int /*<<< orphan*/ *, long, long double *);
long LocusHistoryInit(FILE *fout, long double (*poissonTrans)[300L + 1],
                      long double (*gaussTrans)[1500L + 1]) {
  long LinCount, i, j;
  long double var, *poisson, *gauss;
  if ((poisson = calloc(300L + 1, sizeof(long double))) == NULL) {
    fprintf(fout, " No memory-3! ");
    return -1;
  };
  if ((gauss = calloc(1500L + 1, sizeof(long double))) == NULL) {
    fprintf(fout, " No memory-4! ");
    return -1;
  };
  for (i = 1; i != 100L + 1; i++) {
    poissoncr(fout, i, poisson);
    for (j = 0; j != 300L + 1; j++)
      poissonTrans[i][j] = poisson[j];
  }
  for (i = 100L + 1; i != 100000L - 100L; i++) {
    var = (float)i * (100000L - i) / 100000L;
    gausscr(fout, var, gauss);
    for (j = 0; j != 1500L + 1; j++)
      gaussTrans[i][j] = gauss[j];
  }
  return 0;
}


x86 assembly (clang, -O0):
<LocusHistoryInit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    $0x12d,%edi
mov    $0x10,%esi
call   1030 <calloc@plt>
mov    %rax,-0x58(%rbp)
cmp    $0x0,%rax
jne    1191 <LocusHistoryInit+0x51>
mov    -0x10(%rbp),%rdi
lea    0xe85(%rip),%rsi
call   1040 <fprintf@plt>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1315 <LocusHistoryInit+0x1d5>
mov    $0x5dd,%edi
mov    $0x10,%esi
call   1030 <calloc@plt>
mov    %rax,-0x60(%rbp)
cmp    $0x0,%rax
jne    11cb <LocusHistoryInit+0x8b>
mov    -0x10(%rbp),%rdi
lea    0xe5a(%rip),%rsi
call   1040 <fprintf@plt>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1315 <LocusHistoryInit+0x1d5>
movq   $0x1,-0x30(%rbp)
cmpq   $0x65,-0x30(%rbp)
je     1250 <LocusHistoryInit+0x110>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x58(%rbp),%rdx
call   1060 <poissoncr@plt>
movq   $0x0,-0x38(%rbp)
cmpq   $0x12d,-0x38(%rbp)
je     123a <LocusHistoryInit+0xfa>
mov    -0x58(%rbp),%rcx
mov    -0x38(%rbp),%rax
shl    $0x4,%rax
fldt   (%rcx,%rax,1)
mov    -0x18(%rbp),%rcx
mov    -0x30(%rbp),%rdx
imul   $0x12d0,%rdx,%rdx
add    %rdx,%rcx
fstpt  (%rax,%rcx,1)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    11f7 <LocusHistoryInit+0xb7>
jmp    123f <LocusHistoryInit+0xff>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    11d3 <LocusHistoryInit+0x93>
movq   $0x65,-0x30(%rbp)
cmpq   $0x1863c,-0x30(%rbp)
je     130d <LocusHistoryInit+0x1cd>
mov    -0x30(%rbp),%rcx
cvtsi2ss %rcx,%xmm0
mov    $0x186a0,%eax
sub    %rcx,%rax
cvtsi2ss %rax,%xmm1
mulss  %xmm1,%xmm0
movss  0xd78(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x64(%rbp)
flds   -0x64(%rbp)
fstpt  -0x50(%rbp)
mov    -0x10(%rbp),%rdi
fldt   -0x50(%rbp)
mov    -0x60(%rbp),%rsi
mov    %rsp,%rax
fstpt  (%rax)
call   1050 <gausscr@plt>
movq   $0x0,-0x38(%rbp)
cmpq   $0x5dd,-0x38(%rbp)
je     12f7 <LocusHistoryInit+0x1b7>
mov    -0x60(%rbp),%rcx
mov    -0x38(%rbp),%rax
shl    $0x4,%rax
fldt   (%rcx,%rax,1)
mov    -0x20(%rbp),%rcx
mov    -0x30(%rbp),%rdx
imul   $0x5dd0,%rdx,%rdx
add    %rdx,%rcx
fstpt  (%rax,%rcx,1)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    12b4 <LocusHistoryInit+0x174>
jmp    12fc <LocusHistoryInit+0x1bc>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1258 <LocusHistoryInit+0x118>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LocusHistoryInit>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r15
mov    %rsi,%r13
mov    %rdi,%r14
mov    $0x12d,%edi
mov    $0x10,%esi
call   1030 <calloc@plt>
test   %rax,%rax
je     12b4 <LocusHistoryInit+0x174>
mov    %rax,%rbx
mov    $0x5dd,%edi
mov    $0x10,%esi
call   1030 <calloc@plt>
test   %rax,%rax
je     12bd <LocusHistoryInit+0x17d>
mov    %rax,%r12
add    $0x12d0,%r13
mov    $0x1,%ebp
jmp    11b1 <LocusHistoryInit+0x71>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
add    $0x12d0,%r13
cmp    $0x65,%rbp
je     1201 <LocusHistoryInit+0xc1>
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
call   1050 <poissoncr@plt>
mov    $0x30,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
fldt   -0x30(%rbx,%rax,1)
fstpt  -0x30(%r13,%rax,1)
cmp    $0x12f0,%rax
je     11a0 <LocusHistoryInit+0x60>
fldt   -0x20(%rbx,%rax,1)
fstpt  -0x20(%r13,%rax,1)
fldt   -0x10(%rbx,%rax,1)
fstpt  -0x10(%r13,%rax,1)
fldt   (%rbx,%rax,1)
fstpt  0x0(%r13,%rax,1)
add    $0x40,%rax
jmp    11d0 <LocusHistoryInit+0x90>
add    $0x250340,%r15
mov    $0x65,%ebp
xor    %ebx,%ebx
jmp    1238 <LocusHistoryInit+0xf8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
add    $0x5dd0,%r15
cmp    $0x1863c,%rbp
je     12dd <LocusHistoryInit+0x19d>
xorps  %xmm0,%xmm0
cvtsi2ss %rbp,%xmm0
mov    $0x186a0,%eax
sub    %rbp,%rax
xorps  %xmm1,%xmm1
cvtsi2ss %rax,%xmm1
mulss  %xmm0,%xmm1
divss  0xda4(%rip),%xmm1
movss  %xmm1,0x14(%rsp)
flds   0x14(%rsp)
fstpt  (%rsp)
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <gausscr@plt>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
fldt   (%r12,%rax,1)
fstpt  -0x30(%r15,%rax,1)
cmp    $0x5dc0,%rax
je     1220 <LocusHistoryInit+0xe0>
fldt   0x10(%r12,%rax,1)
fstpt  -0x20(%r15,%rax,1)
fldt   0x20(%r12,%rax,1)
fstpt  -0x10(%r15,%rax,1)
fldt   0x30(%r12,%rax,1)
fstpt  (%r15,%rax,1)
add    $0x40,%rax
jmp    1280 <LocusHistoryInit+0x140>
lea    0xd49(%rip),%rdi
jmp    12c4 <LocusHistoryInit+0x184>
lea    0xd4f(%rip),%rdi
mov    $0xe,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1060 <fwrite@plt>
mov    $0xffffffffffffffff,%rbx
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c" No memory-3! \00"
@.str.1 = [15 x i8] c" No memory-4! \00"
define i64 @LocusHistoryInit(i32* %0, [301 x x86_fp80]* %1, [1501 x x86_fp80]* %2) {
%4 = alloca i64
%5 = alloca i32*
%6 = alloca [301 x x86_fp80]*
%7 = alloca [1501 x x86_fp80]*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca x86_fp80
%12 = alloca x86_fp80*
%13 = alloca x86_fp80*
store i32* %0, i32** %5
store [301 x x86_fp80]* %1, [301 x x86_fp80]** %6
store [1501 x x86_fp80]* %2, [1501 x x86_fp80]** %7
%14 = call x86_fp80* @calloc(i64 301, i32 16)
store x86_fp80* %14, x86_fp80** %12
%15 = icmp eq x86_fp80* %14, null
br i1 %15, label %16, label %19
16: ; preds = %3
%17 = load i32*, i32** %5
%18 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i64 -1, i64* %4
br label %92
19: ; preds = %3
%20 = call x86_fp80* @calloc(i64 1501, i32 16)
store x86_fp80* %20, x86_fp80** %13
%21 = icmp eq x86_fp80* %20, null
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32*, i32** %5
%24 = call i32 @fprintf(i32* %23, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
store i64 -1, i64* %4
br label %92
25: ; preds = %19
store i64 1, i64* %9
br label %26
26: ; preds = %51, %25
%27 = load i64, i64* %9
%28 = icmp ne i64 %27, 101
br i1 %28, label %29, label %54
29: ; preds = %26
%30 = load i32*, i32** %5
%31 = load i64, i64* %9
%32 = load x86_fp80*, x86_fp80** %12
%33 = call i32 @poissoncr(i32* %30, i64 %31, x86_fp80* %32)
store i64 0, i64* %10
br label %34
34: ; preds = %47, %29
%35 = load i64, i64* %10
%36 = icmp ne i64 %35, 301
br i1 %36, label %37, label %50
37: ; preds = %34
%38 = load x86_fp80*, x86_fp80** %12
%39 = load i64, i64* %10
%40 = getelementptr inbounds x86_fp80, x86_fp80* %38, i64 %39
%41 = load x86_fp80, x86_fp80* %40
%42 = load [301 x x86_fp80]*, [301 x x86_fp80]** %6
%43 = load i64, i64* %9
%44 = getelementptr inbounds [301 x x86_fp80], [301 x x86_fp80]* %42, i64 %43
%45 = load i64, i64* %10
%46 = getelementptr inbounds [301 x x86_fp80], [301 x x86_fp80]* %44, i64 0, i64 %45
store x86_fp80 %41, x86_fp80* %46
br label %47
47: ; preds = %37
%48 = load i64, i64* %10
%49 = add nsw i64 %48, 1
store i64 %49, i64* %10
br label %34
50: ; preds = %34
br label %51
51: ; preds = %50
%52 = load i64, i64* %9
%53 = add nsw i64 %52, 1
store i64 %53, i64* %9
br label %26
54: ; preds = %26
store i64 101, i64* %9
br label %55
55: ; preds = %88, %54
%56 = load i64, i64* %9
%57 = icmp ne i64 %56, 99900
br i1 %57, label %58, label %91
58: ; preds = %55
%59 = load i64, i64* %9
%60 = sitofp i64 %59 to float
%61 = load i64, i64* %9
%62 = sub nsw i64 100000, %61
%63 = sitofp i64 %62 to float
%64 = fmul float %60, %63
%65 = fdiv float %64, 1.000000e+05
%66 = fpext float %65 to x86_fp80
store x86_fp80 %66, x86_fp80* %11
%67 = load i32*, i32** %5
%68 = load x86_fp80, x86_fp80* %11
%69 = load x86_fp80*, x86_fp80** %13
%70 = call i32 @gausscr(i32* %67, x86_fp80 %68, x86_fp80* %69)
store i64 0, i64* %10
br label %71
71: ; preds = %84, %58
%72 = load i64, i64* %10
%73 = icmp ne i64 %72, 1501
br i1 %73, label %74, label %87
74: ; preds = %71
%75 = load x86_fp80*, x86_fp80** %13
%76 = load i64, i64* %10
%77 = getelementptr inbounds x86_fp80, x86_fp80* %75, i64 %76
%78 = load x86_fp80, x86_fp80* %77
%79 = load [1501 x x86_fp80]*, [1501 x x86_fp80]** %7
%80 = load i64, i64* %9
%81 = getelementptr inbounds [1501 x x86_fp80], [1501 x x86_fp80]* %79, i64 %80
%82 = load i64, i64* %10
%83 = getelementptr inbounds [1501 x x86_fp80], [1501 x x86_fp80]* %81, i64 0, i64 %82
store x86_fp80 %78, x86_fp80* %83
br label %84
84: ; preds = %74
%85 = load i64, i64* %10
%86 = add nsw i64 %85, 1
store i64 %86, i64* %10
br label %71
87: ; preds = %71
br label %88
88: ; preds = %87
%89 = load i64, i64* %9
%90 = add nsw i64 %89, 1
store i64 %90, i64* %9
br label %55
91: ; preds = %55
store i64 0, i64* %4
br label %92
92: ; preds = %91, %22, %16
%93 = load i64, i64* %4
ret i64 %93
}

LLVM IR (-O2):
@.str = [15 x i8] c" No memory-3! \00"
@.str.1 = [15 x i8] c" No memory-4! \00"
define i64 @LocusHistoryInit(i32* %0, [301 x x86_fp80]* nocapture writeonly %1, [1501 x x86_fp80]* nocapture writeonly %2) {
%4 = tail call x86_fp80* @calloc(i64 301, i32 16)
%5 = icmp eq x86_fp80* %4, null
br i1 %5, label %67, label %6
6: ; preds = %3
%7 = tail call x86_fp80* @calloc(i64 1501, i32 16)
%8 = icmp eq x86_fp80* %7, null
br i1 %8, label %67, label %9
9: ; preds = %6, %32
%10 = phi i64 [ %33, %32 ], [ 1, %6 ]
%11 = tail call i32 @poissoncr(i32* %0, i64 %10, x86_fp80* %4)
br label %12
12: ; preds = %19, %9
%13 = phi i64 [ 0, %9 ], [ %31, %19 ]
%14 = getelementptr inbounds x86_fp80, x86_fp80* %4, i64 %13
%15 = load x86_fp80, x86_fp80* %14
%16 = getelementptr inbounds [301 x x86_fp80], [301 x x86_fp80]* %1, i64 %10, i64 %13
store x86_fp80 %15, x86_fp80* %16
%17 = or i64 %13, 1
%18 = icmp eq i64 %17, 301
br i1 %18, label %32, label %19
19: ; preds = %12
%20 = getelementptr inbounds x86_fp80, x86_fp80* %4, i64 %17
%21 = load x86_fp80, x86_fp80* %20
%22 = getelementptr inbounds [301 x x86_fp80], [301 x x86_fp80]* %1, i64 %10, i64 %17
store x86_fp80 %21, x86_fp80* %22
%23 = or i64 %13, 2
%24 = getelementptr inbounds x86_fp80, x86_fp80* %4, i64 %23
%25 = load x86_fp80, x86_fp80* %24
%26 = getelementptr inbounds [301 x x86_fp80], [301 x x86_fp80]* %1, i64 %10, i64 %23
store x86_fp80 %25, x86_fp80* %26
%27 = or i64 %13, 3
%28 = getelementptr inbounds x86_fp80, x86_fp80* %4, i64 %27
%29 = load x86_fp80, x86_fp80* %28
%30 = getelementptr inbounds [301 x x86_fp80], [301 x x86_fp80]* %1, i64 %10, i64 %27
store x86_fp80 %29, x86_fp80* %30
%31 = add nuw nsw i64 %13, 4
br label %12
32: ; preds = %12
%33 = add nuw nsw i64 %10, 1
%34 = icmp eq i64 %33, 101
br i1 %34, label %35, label %9
35: ; preds = %32, %64
%36 = phi i64 [ %65, %64 ], [ 101, %32 ]
%37 = sitofp i64 %36 to float
%38 = sub nuw nsw i64 100000, %36
%39 = sitofp i64 %38 to float
%40 = fmul float %37, %39
%41 = fdiv float %40, 1.000000e+05
%42 = fpext float %41 to x86_fp80
%43 = tail call i32 @gausscr(i32* %0, x86_fp80 %42, x86_fp80* %7)
br label %44
44: ; preds = %51, %35
%45 = phi i64 [ 0, %35 ], [ %63, %51 ]
%46 = getelementptr inbounds x86_fp80, x86_fp80* %7, i64 %45
%47 = load x86_fp80, x86_fp80* %46
%48 = getelementptr inbounds [1501 x x86_fp80], [1501 x x86_fp80]* %2, i64 %36, i64 %45
store x86_fp80 %47, x86_fp80* %48
%49 = or i64 %45, 1
%50 = icmp eq i64 %49, 1501
br i1 %50, label %64, label %51
51: ; preds = %44
%52 = getelementptr inbounds x86_fp80, x86_fp80* %7, i64 %49
%53 = load x86_fp80, x86_fp80* %52
%54 = getelementptr inbounds [1501 x x86_fp80], [1501 x x86_fp80]* %2, i64 %36, i64 %49
store x86_fp80 %53, x86_fp80* %54
%55 = or i64 %45, 2
%56 = getelementptr inbounds x86_fp80, x86_fp80* %7, i64 %55
%57 = load x86_fp80, x86_fp80* %56
%58 = getelementptr inbounds [1501 x x86_fp80], [1501 x x86_fp80]* %2, i64 %36, i64 %55
store x86_fp80 %57, x86_fp80* %58
%59 = or i64 %45, 3
%60 = getelementptr inbounds x86_fp80, x86_fp80* %7, i64 %59
%61 = load x86_fp80, x86_fp80* %60
%62 = getelementptr inbounds [1501 x x86_fp80], [1501 x x86_fp80]* %2, i64 %36, i64 %59
store x86_fp80 %61, x86_fp80* %62
%63 = add nuw nsw i64 %45, 4
br label %44
64: ; preds = %44
%65 = add nuw nsw i64 %36, 1
%66 = icmp eq i64 %65, 99900
br i1 %66, label %70, label %35
67: ; preds = %6, %3
%68 = phi i8* [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %3 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), %6 ]
%69 = tail call i64 @fwrite(i8* %68, i64 14, i64 1, i32* %0)
br label %70
70: ; preds = %64, %67
%71 = phi i64 [ -1, %67 ], [ 0, %64 ]
ret i64 %71
}