#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 */
scalar_t__ calloc(int, int);
int countElementInArray(int *, int, int);
int findElementInArray(int *, int, int);
int /*<<< orphan*/ free(int *);
double calcKeyBytes(int *stream, int size) {
  int i = 0, k = 0, cnt = 0;
  int *setVal = (int *)calloc(size, sizeof(int));
  int *setCnt = (int *)calloc(size, sizeof(int));
  double alphabetFrequency[256] = {};
  alphabetFrequency[97] = 0.08167;
  alphabetFrequency[98] = 0.01492;
  alphabetFrequency[99] = 0.02782;
  alphabetFrequency[100] = 0.04253;
  alphabetFrequency[101] = 0.12702;
  alphabetFrequency[102] = 0.02228;
  alphabetFrequency[103] = 0.02015;
  alphabetFrequency[104] = 0.06094;
  alphabetFrequency[105] = 0.06966;
  alphabetFrequency[106] = 0.00153;
  alphabetFrequency[107] = 0.00772;
  alphabetFrequency[108] = 0.04025;
  alphabetFrequency[109] = 0.02406;
  alphabetFrequency[110] = 0.06749;
  alphabetFrequency[111] = 0.07507;
  alphabetFrequency[112] = 0.01929;
  alphabetFrequency[113] = 0.00095;
  alphabetFrequency[114] = 0.05987;
  alphabetFrequency[115] = 0.06327;
  alphabetFrequency[116] = 0.09056;
  alphabetFrequency[117] = 0.02758;
  alphabetFrequency[118] = 0.00978;
  alphabetFrequency[119] = 0.02360;
  alphabetFrequency[120] = 0.00150;
  alphabetFrequency[121] = 0.01974;
  alphabetFrequency[122] = 0.00074;
  double pr = 0.0;
  for (i = 0; i < size; i++) {
    if (stream[i] < 97 || stream[i] > 122) {
      continue;
    }
    cnt++;
    if (k > 0 && findElementInArray(setVal, k, stream[i]) < k) {
      continue;
    }
    setVal[k] = stream[i];
    setCnt[k] = countElementInArray(stream, size, stream[i]);
    k++;
  }
  if (k == 0) {
    return 0.0;
  }
  for (i = 0; i < k; i++) {
    pr += (double)setCnt[i] / cnt * alphabetFrequency[setVal[i]];
  }
  free(setVal);
  free(setCnt);
  return pr;
}


x86 assembly (clang, -O0):
<calcKeyBytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x840,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
mov    %rax,-0x30(%rbp)
lea    -0x830(%rbp),%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1050 <memset@plt>
movsd  0xf14(%rip),%xmm0
movsd  %xmm0,-0x528(%rbp)
ff
movsd  0xefc(%rip),%xmm0
movsd  %xmm0,-0x520(%rbp)
ff
movsd  0xee4(%rip),%xmm0
movsd  %xmm0,-0x518(%rbp)
ff
movsd  0xecc(%rip),%xmm0
movsd  %xmm0,-0x510(%rbp)
ff
movsd  0xeb4(%rip),%xmm0
movsd  %xmm0,-0x508(%rbp)
ff
movsd  0xe9c(%rip),%xmm0
movsd  %xmm0,-0x500(%rbp)
ff
movsd  0xe84(%rip),%xmm0
movsd  %xmm0,-0x4f8(%rbp)
ff
movsd  0xe6c(%rip),%xmm0
movsd  %xmm0,-0x4f0(%rbp)
ff
movsd  0xe54(%rip),%xmm0
movsd  %xmm0,-0x4e8(%rbp)
ff
movsd  0xe3c(%rip),%xmm0
movsd  %xmm0,-0x4e0(%rbp)
ff
movsd  0xe24(%rip),%xmm0
movsd  %xmm0,-0x4d8(%rbp)
ff
movsd  0xe0c(%rip),%xmm0
movsd  %xmm0,-0x4d0(%rbp)
ff
movsd  0xdf4(%rip),%xmm0
movsd  %xmm0,-0x4c8(%rbp)
ff
movsd  0xddc(%rip),%xmm0
movsd  %xmm0,-0x4c0(%rbp)
ff
movsd  0xdc4(%rip),%xmm0
movsd  %xmm0,-0x4b8(%rbp)
ff
movsd  0xdac(%rip),%xmm0
movsd  %xmm0,-0x4b0(%rbp)
ff
movsd  0xd94(%rip),%xmm0
movsd  %xmm0,-0x4a8(%rbp)
ff
movsd  0xd7c(%rip),%xmm0
movsd  %xmm0,-0x4a0(%rbp)
ff
movsd  0xd64(%rip),%xmm0
movsd  %xmm0,-0x498(%rbp)
ff
movsd  0xd4c(%rip),%xmm0
movsd  %xmm0,-0x490(%rbp)
ff
movsd  0xd34(%rip),%xmm0
movsd  %xmm0,-0x488(%rbp)
ff
movsd  0xd1c(%rip),%xmm0
movsd  %xmm0,-0x480(%rbp)
ff
movsd  0xd04(%rip),%xmm0
movsd  %xmm0,-0x478(%rbp)
ff
movsd  0xcec(%rip),%xmm0
movsd  %xmm0,-0x470(%rbp)
ff
movsd  0xcd4(%rip),%xmm0
movsd  %xmm0,-0x468(%rbp)
ff
movsd  0xcbc(%rip),%xmm0
movsd  %xmm0,-0x460(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x838(%rbp)
ff
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    141c <calcKeyBytes+0x2cc>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0x61,(%rax,%rcx,4)
jl     138e <calcKeyBytes+0x23e>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0x7a,(%rax,%rcx,4)
jle    1393 <calcKeyBytes+0x243>
jmp    140e <calcKeyBytes+0x2be>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    13cb <calcKeyBytes+0x27b>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
call   1040 <findElementInArray@plt>
cmp    -0x1c(%rbp),%eax
jge    13cb <calcKeyBytes+0x27b>
jmp    140e <calcKeyBytes+0x2be>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
call   1060 <countElementInArray@plt>
mov    %eax,%edx
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    135e <calcKeyBytes+0x20e>
cmpl   $0x0,-0x1c(%rbp)
jne    1433 <calcKeyBytes+0x2e3>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    14b6 <calcKeyBytes+0x366>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1497 <calcKeyBytes+0x347>
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm0
cvtsi2sdl -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
movslq (%rax,%rcx,4),%rax
movsd  -0x830(%rbp,%rax,8),%xmm2
ff ff
movsd  -0x838(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x838(%rbp)
ff
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    143a <calcKeyBytes+0x2ea>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x838(%rbp),%xmm0
ff
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x840,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcKeyBytes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x828,%rsp
mov    %esi,%ebx
mov    %rdi,%rbp
mov    %esi,%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
mov    %rax,%r14
mov    %ebx,%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
mov    %rax,%r12
lea    0x20(%rsp),%rdi
xor    %r13d,%r13d
mov    $0x800,%edx
xor    %esi,%esi
call   1050 <memset@plt>
movaps 0xe61(%rip),%xmm0
movups %xmm0,0x328(%rsp)
movaps 0xe62(%rip),%xmm0
movups %xmm0,0x338(%rsp)
movaps 0xe63(%rip),%xmm0
movups %xmm0,0x348(%rsp)
movaps 0xe64(%rip),%xmm0
movups %xmm0,0x358(%rsp)
movaps 0xe65(%rip),%xmm0
movups %xmm0,0x368(%rsp)
movaps 0xe66(%rip),%xmm0
movups %xmm0,0x378(%rsp)
movaps 0xe67(%rip),%xmm0
movups %xmm0,0x388(%rsp)
movaps 0xe68(%rip),%xmm0
movups %xmm0,0x398(%rsp)
movaps 0xe69(%rip),%xmm0
movups %xmm0,0x3a8(%rsp)
movaps 0xe6a(%rip),%xmm0
movups %xmm0,0x3b8(%rsp)
movaps 0xe6b(%rip),%xmm0
movups %xmm0,0x3c8(%rsp)
movaps 0xe6c(%rip),%xmm0
movups %xmm0,0x3d8(%rsp)
movapd 0xe6c(%rip),%xmm0
movupd %xmm0,0x3e8(%rsp)
xorpd  %xmm0,%xmm0
test   %ebx,%ebx
jle    13b9 <calcKeyBytes+0x269>
mov    %r14,0x8(%rsp)
mov    %ebx,0x14(%rsp)
mov    %ebx,%r14d
xor    %r15d,%r15d
xor    %ebx,%ebx
mov    %r12,0x18(%rsp)
jmp    12c9 <calcKeyBytes+0x179>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movslq %ebx,%r12
mov    0x8(%rsp),%rax
mov    %edx,(%rax,%r12,4)
mov    0x0(%rbp,%r15,4),%edx
mov    %rbp,%rdi
mov    0x14(%rsp),%esi
call   1060 <countElementInArray@plt>
mov    0x18(%rsp),%rcx
mov    %eax,(%rcx,%r12,4)
mov    %rcx,%r12
add    $0x1,%ebx
xorpd  %xmm0,%xmm0
add    $0x1,%r15
cmp    %r15,%r14
je     12f5 <calcKeyBytes+0x1a5>
mov    0x0(%rbp,%r15,4),%edx
lea    -0x7b(%rdx),%eax
cmp    $0xffffffe6,%eax
jb     12c0 <calcKeyBytes+0x170>
add    $0x1,%r13d
test   %ebx,%ebx
jle    1290 <calcKeyBytes+0x140>
mov    0x8(%rsp),%rdi
mov    %ebx,%esi
call   1040 <findElementInArray@plt>
cmp    %ebx,%eax
jl     12bc <calcKeyBytes+0x16c>
mov    0x0(%rbp,%r15,4),%edx
jmp    1290 <calcKeyBytes+0x140>
test   %ebx,%ebx
je     13b9 <calcKeyBytes+0x269>
jle    131b <calcKeyBytes+0x1cb>
xorps  %xmm0,%xmm0
cvtsi2sd %r13d,%xmm0
mov    %ebx,%eax
cmp    $0x1,%ebx
mov    0x8(%rsp),%rdi
jne    1326 <calcKeyBytes+0x1d6>
xorpd  %xmm2,%xmm2
xor    %ecx,%ecx
jmp    1381 <calcKeyBytes+0x231>
xorpd  %xmm2,%xmm2
mov    0x8(%rsp),%rdi
jmp    13a0 <calcKeyBytes+0x250>
mov    %eax,%edx
and    $0xfffffffe,%edx
xorpd  %xmm2,%xmm2
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xorps  %xmm1,%xmm1
cvtsi2sdl (%r12,%rcx,4),%xmm1
divsd  %xmm0,%xmm1
movslq (%rdi,%rcx,4),%rsi
mulsd  0x20(%rsp,%rsi,8),%xmm1
addsd  %xmm2,%xmm1
xorps  %xmm2,%xmm2
cvtsi2sdl 0x4(%r12,%rcx,4),%xmm2
divsd  %xmm0,%xmm2
movslq 0x4(%rdi,%rcx,4),%rsi
mulsd  0x20(%rsp,%rsi,8),%xmm2
addsd  %xmm1,%xmm2
add    $0x2,%rcx
cmp    %rcx,%rdx
jne    1340 <calcKeyBytes+0x1f0>
test   $0x1,%al
je     13a0 <calcKeyBytes+0x250>
xorps  %xmm1,%xmm1
cvtsi2sdl (%r12,%rcx,4),%xmm1
divsd  %xmm0,%xmm1
movslq (%rdi,%rcx,4),%rax
mulsd  0x20(%rsp,%rax,8),%xmm1
addsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
movsd  0x8(%rsp),%xmm0
add    $0x828,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @calcKeyBytes(i32* %0, i32 %1) {
%3 = alloca double
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca [256 x double]
%12 = alloca double
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%13 = load i32, i32* %5
%14 = call i64 @calloc(i32 %13, i32 4)
%15 = inttoptr i64 %14 to i32*
store i32* %15, i32** %9
%16 = load i32, i32* %5
%17 = call i64 @calloc(i32 %16, i32 4)
%18 = inttoptr i64 %17 to i32*
store i32* %18, i32** %10
%19 = bitcast [256 x double]* %11 to i8*
%20 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 97
store double 8.167000e-02, double* %20
%21 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 98
store double 1.492000e-02, double* %21
%22 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 99
store double 2.782000e-02, double* %22
%23 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 100
store double 4.253000e-02, double* %23
%24 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 101
store double 1.270200e-01, double* %24
%25 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 102
store double 2.228000e-02, double* %25
%26 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 103
store double 2.015000e-02, double* %26
%27 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 104
store double 6.094000e-02, double* %27
%28 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 105
store double 6.966000e-02, double* %28
%29 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 106
store double 1.530000e-03, double* %29
%30 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 107
store double 7.720000e-03, double* %30
%31 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 108
store double 4.025000e-02, double* %31
%32 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 109
store double 2.406000e-02, double* %32
%33 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 110
store double 6.749000e-02, double* %33
%34 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 111
store double 7.507000e-02, double* %34
%35 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 112
store double 1.929000e-02, double* %35
%36 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 113
store double 0x3F4F212D77318FC5, double* %36
%37 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 114
store double 5.987000e-02, double* %37
%38 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 115
store double 6.327000e-02, double* %38
%39 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 116
store double 9.056000e-02, double* %39
%40 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 117
store double 2.758000e-02, double* %40
%41 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 118
store double 9.780000e-03, double* %41
%42 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 119
store double 2.360000e-02, double* %42
%43 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 120
store double 1.500000e-03, double* %43
%44 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 121
store double 1.974000e-02, double* %44
%45 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 122
store double 7.400000e-04, double* %45
store double 0.000000e+00, double* %12
store i32 0, i32* %6
br label %46
46: ; preds = %106, %2
%47 = load i32, i32* %6
%48 = load i32, i32* %5
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %109
50: ; preds = %46
%51 = load i32*, i32** %4
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i32, i32* %51, i64 %53
%55 = load i32, i32* %54
%56 = icmp slt i32 %55, 97
br i1 %56, label %64, label %57
57: ; preds = %50
%58 = load i32*, i32** %4
%59 = load i32, i32* %6
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i32, i32* %58, i64 %60
%62 = load i32, i32* %61
%63 = icmp sgt i32 %62, 122
br i1 %63, label %64, label %65
64: ; preds = %57, %50
br label %106
65: ; preds = %57
%66 = load i32, i32* %8
%67 = add nsw i32 %66, 1
store i32 %67, i32* %8
%68 = load i32, i32* %7
%69 = icmp sgt i32 %68, 0
br i1 %69, label %70, label %82
70: ; preds = %65
%71 = load i32*, i32** %9
%72 = load i32, i32* %7
%73 = load i32*, i32** %4
%74 = load i32, i32* %6
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i32, i32* %73, i64 %75
%77 = load i32, i32* %76
%78 = call i32 @findElementInArray(i32* %71, i32 %72, i32 %77)
%79 = load i32, i32* %7
%80 = icmp slt i32 %78, %79
br i1 %80, label %81, label %82
81: ; preds = %70
br label %106
82: ; preds = %70, %65
%83 = load i32*, i32** %4
%84 = load i32, i32* %6
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i32, i32* %83, i64 %85
%87 = load i32, i32* %86
%88 = load i32*, i32** %9
%89 = load i32, i32* %7
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i32, i32* %88, i64 %90
store i32 %87, i32* %91
%92 = load i32*, i32** %4
%93 = load i32, i32* %5
%94 = load i32*, i32** %4
%95 = load i32, i32* %6
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds i32, i32* %94, i64 %96
%98 = load i32, i32* %97
%99 = call i32 @countElementInArray(i32* %92, i32 %93, i32 %98)
%100 = load i32*, i32** %10
%101 = load i32, i32* %7
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i32, i32* %100, i64 %102
store i32 %99, i32* %103
%104 = load i32, i32* %7
%105 = add nsw i32 %104, 1
store i32 %105, i32* %7
br label %106
106: ; preds = %82, %81, %64
%107 = load i32, i32* %6
%108 = add nsw i32 %107, 1
store i32 %108, i32* %6
br label %46
109: ; preds = %46
%110 = load i32, i32* %7
%111 = icmp eq i32 %110, 0
br i1 %111, label %112, label %113
112: ; preds = %109
store double 0.000000e+00, double* %3
br label %147
113: ; preds = %109
store i32 0, i32* %6
br label %114
114: ; preds = %138, %113
%115 = load i32, i32* %6
%116 = load i32, i32* %7
%117 = icmp slt i32 %115, %116
br i1 %117, label %118, label %141
118: ; preds = %114
%119 = load i32*, i32** %10
%120 = load i32, i32* %6
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds i32, i32* %119, i64 %121
%123 = load i32, i32* %122
%124 = sitofp i32 %123 to double
%125 = load i32, i32* %8
%126 = sitofp i32 %125 to double
%127 = fdiv double %124, %126
%128 = load i32*, i32** %9
%129 = load i32, i32* %6
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i32, i32* %128, i64 %130
%132 = load i32, i32* %131
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds [256 x double], [256 x double]* %11, i64 0, i64 %133
%135 = load double, double* %134
%136 = load double, double* %12
%137 = call double @llvm.fmuladd.f64(double %127, double %135, double %136)
store double %137, double* %12
br label %138
138: ; preds = %118
%139 = load i32, i32* %6
%140 = add nsw i32 %139, 1
store i32 %140, i32* %6
br label %114
141: ; preds = %114
%142 = load i32*, i32** %9
%143 = call i32 @free(i32* %142)
%144 = load i32*, i32** %10
%145 = call i32 @free(i32* %144)
%146 = load double, double* %12
store double %146, double* %3
br label %147
147: ; preds = %141, %112
%148 = load double, double* %3
ret double %148
}

LLVM IR (-O2):
define double @calcKeyBytes(i32* %0, i32 %1) {
%3 = alloca [256 x double]
%4 = tail call i64 @calloc(i32 %1, i32 4)
%5 = inttoptr i64 %4 to i32*
%6 = tail call i64 @calloc(i32 %1, i32 4)
%7 = inttoptr i64 %6 to i32*
%8 = bitcast [256 x double]* %3 to i8*
%9 = getelementptr inbounds [256 x double], [256 x double]* %3, i64 0, i64 97
%10 = bitcast double* %9 to <2 x double>*
store <2 x double> <double 8.167000e-02, double 1.492000e-02>, <2 x double>* %10
%11 = getelementptr inbounds [256 x double], [256 x double]* %3, i64 0, i64 99
%12 = bitcast double* %11 to <2 x double>*
store <2 x double> <double 2.782000e-02, double 4.253000e-02>, <2 x double>* %12
%13 = getelementptr inbounds [256 x double], [256 x double]* %3, i64 0, i64 101
%14 = bitcast double* %13 to <2 x double>*
store <2 x double> <double 1.270200e-01, double 2.228000e-02>, <2 x double>* %14
%15 = getelementptr inbounds [256 x double], [256 x double]* %3, i64 0, i64 103
%16 = bitcast double* %15 to <2 x double>*
store <2 x double> <double 2.015000e-02, double 6.094000e-02>, <2 x double>* %16
%17 = getelementptr inbounds [256 x double], [256 x double]* %3, i64 0, i64 105
%18 = bitcast double* %17 to <2 x double>*
store <2 x double> <double 6.966000e-02, double 1.530000e-03>, <2 x double>* %18
%19 = getelementptr inbounds [256 x double], [256 x double]* %3, i64 0, i64 107
%20 = bitcast double* %19 to <2 x double>*
store <2 x double> <double 7.720000e-03, double 4.025000e-02>, <2 x double>* %20
%21 = getelementptr inbounds [256 x double], [256 x double]* %3, i64 0, i64 109
%22 = bitcast double* %21 to <2 x double>*
store <2 x double> <double 2.406000e-02, double 6.749000e-02>, <2 x double>* %22
%23 = getelementptr inbounds [256 x double], [256 x double]* %3, i64 0, i64 111
%24 = bitcast double* %23 to <2 x double>*
store <2 x double> <double 7.507000e-02, double 1.929000e-02>, <2 x double>* %24
%25 = getelementptr inbounds [256 x double], [256 x double]* %3, i64 0, i64 113
%26 = bitcast double* %25 to <2 x double>*
store <2 x double> <double 0x3F4F212D77318FC5, double 5.987000e-02>, <2 x double>* %26
%27 = getelementptr inbounds [256 x double], [256 x double]* %3, i64 0, i64 115
%28 = bitcast double* %27 to <2 x double>*
store <2 x double> <double 6.327000e-02, double 9.056000e-02>, <2 x double>* %28
%29 = getelementptr inbounds [256 x double], [256 x double]* %3, i64 0, i64 117
%30 = bitcast double* %29 to <2 x double>*
store <2 x double> <double 2.758000e-02, double 9.780000e-03>, <2 x double>* %30
%31 = getelementptr inbounds [256 x double], [256 x double]* %3, i64 0, i64 119
%32 = bitcast double* %31 to <2 x double>*
store <2 x double> <double 2.360000e-02, double 1.500000e-03>, <2 x double>* %32
%33 = getelementptr inbounds [256 x double], [256 x double]* %3, i64 0, i64 121
%34 = bitcast double* %33 to <2 x double>*
store <2 x double> <double 1.974000e-02, double 7.400000e-04>, <2 x double>* %34
%35 = icmp sgt i32 %1, 0
br i1 %35, label %36, label %126
36: ; preds = %2
%37 = zext i32 %1 to i64
br label %38
38: ; preds = %36, %62
%39 = phi i64 [ 0, %36 ], [ %65, %62 ]
%40 = phi i32 [ 0, %36 ], [ %64, %62 ]
%41 = phi i32 [ 0, %36 ], [ %63, %62 ]
%42 = getelementptr inbounds i32, i32* %0, i64 %39
%43 = load i32, i32* %42
%44 = add i32 %43, -123
%45 = icmp ult i32 %44, -26
br i1 %45, label %62, label %46
46: ; preds = %38
%47 = add nsw i32 %40, 1
%48 = icmp sgt i32 %41, 0
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = tail call i32 @findElementInArray(i32* %5, i32 %41, i32 %43)
%51 = icmp slt i32 %50, %41
br i1 %51, label %62, label %52
52: ; preds = %49
%53 = load i32, i32* %42
br label %54
54: ; preds = %52, %46
%55 = phi i32 [ %53, %52 ], [ %43, %46 ]
%56 = sext i32 %41 to i64
%57 = getelementptr inbounds i32, i32* %5, i64 %56
store i32 %55, i32* %57
%58 = load i32, i32* %42
%59 = tail call i32 @countElementInArray(i32* %0, i32 %1, i32 %58)
%60 = getelementptr inbounds i32, i32* %7, i64 %56
store i32 %59, i32* %60
%61 = add nsw i32 %41, 1
br label %62
62: ; preds = %49, %38, %54
%63 = phi i32 [ %41, %38 ], [ %41, %49 ], [ %61, %54 ]
%64 = phi i32 [ %40, %38 ], [ %47, %49 ], [ %47, %54 ]
%65 = add nuw nsw i64 %39, 1
%66 = icmp eq i64 %65, %37
br i1 %66, label %67, label %38
67: ; preds = %62
%68 = icmp eq i32 %63, 0
br i1 %68, label %126, label %69
69: ; preds = %67
%70 = icmp sgt i32 %63, 0
br i1 %70, label %71, label %122
71: ; preds = %69
%72 = sitofp i32 %64 to double
%73 = zext i32 %63 to i64
%74 = and i64 %73, 1
%75 = icmp eq i32 %63, 1
br i1 %75, label %106, label %76
76: ; preds = %71
%77 = and i64 %73, 4294967294
br label %78
78: ; preds = %78, %76
%79 = phi i64 [ 0, %76 ], [ %103, %78 ]
%80 = phi double [ 0.000000e+00, %76 ], [ %102, %78 ]
%81 = phi i64 [ 0, %76 ], [ %104, %78 ]
%82 = getelementptr inbounds i32, i32* %7, i64 %79
%83 = load i32, i32* %82
%84 = sitofp i32 %83 to double
%85 = fdiv double %84, %72
%86 = getelementptr inbounds i32, i32* %5, i64 %79
%87 = load i32, i32* %86
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [256 x double], [256 x double]* %3, i64 0, i64 %88
%90 = load double, double* %89
%91 = tail call double @llvm.fmuladd.f64(double %85, double %90, double %80)
%92 = or i64 %79, 1
%93 = getelementptr inbounds i32, i32* %7, i64 %92
%94 = load i32, i32* %93
%95 = sitofp i32 %94 to double
%96 = fdiv double %95, %72
%97 = getelementptr inbounds i32, i32* %5, i64 %92
%98 = load i32, i32* %97
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [256 x double], [256 x double]* %3, i64 0, i64 %99
%101 = load double, double* %100
%102 = tail call double @llvm.fmuladd.f64(double %96, double %101, double %91)
%103 = add nuw nsw i64 %79, 2
%104 = add i64 %81, 2
%105 = icmp eq i64 %104, %77
br i1 %105, label %106, label %78
106: ; preds = %78, %71
%107 = phi double [ undef, %71 ], [ %102, %78 ]
%108 = phi i64 [ 0, %71 ], [ %103, %78 ]
%109 = phi double [ 0.000000e+00, %71 ], [ %102, %78 ]
%110 = icmp eq i64 %74, 0
br i1 %110, label %122, label %111
111: ; preds = %106
%112 = getelementptr inbounds i32, i32* %7, i64 %108
%113 = load i32, i32* %112
%114 = sitofp i32 %113 to double
%115 = fdiv double %114, %72
%116 = getelementptr inbounds i32, i32* %5, i64 %108
%117 = load i32, i32* %116
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds [256 x double], [256 x double]* %3, i64 0, i64 %118
%120 = load double, double* %119
%121 = tail call double @llvm.fmuladd.f64(double %115, double %120, double %109)
br label %122
122: ; preds = %111, %106, %69
%123 = phi double [ 0.000000e+00, %69 ], [ %107, %106 ], [ %121, %111 ]
%124 = tail call i32 @free(i32* %5)
%125 = tail call i32 @free(i32* %7)
br label %126
126: ; preds = %2, %67, %122
%127 = phi double [ %123, %122 ], [ 0.000000e+00, %67 ], [ 0.000000e+00, %2 ]
ret double %127
}