#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ entropy_int(int *, int *, int *, float *, float *, float *,
                               float *, float *, float *, float *, float *,
                               float *, float *, float *, float *, float *,
                               float *);
int /*<<< orphan*/ free(int *);
int *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void main() {
  uint32_t min_rows = 5000;
  uint32_t max_rows = 10000;
  uint32_t row_iterator = 5000;
  uint32_t min_cols = 5000;
  uint32_t max_cols = 10000;
  uint32_t col_iterator = 5000;
  float entropy_table = 0.0;
  float entropy_rows = 0.0;
  float entropy_cols = 0.0;
  float entropy_rowsGivencols = 0.0;
  float entropy_colsGivenRows = 0.0;
  float dependency_rowsOncols = 0.0;
  float dependency_colsOnRows = 0.0;
  float dependency_symmetrical = 0.0;
  float time_sum_all = 0.0;
  float time_sum_rows = 0.0;
  float time_sum_cols = 0.0;
  float time_entropy_table = 0.0;
  float time_entropy_rows = 0.0;
  float time_entropy_cols = 0.0;
  for (uint32_t rows = min_rows; rows <= max_rows; rows += row_iterator) {
    for (uint32_t cols = min_cols; cols <= max_cols; cols += col_iterator) {
      uint32_t *table = malloc(rows * cols * sizeof(uint32_t));
      srand(time(NULL));
      for (uint32_t row = 0; row < rows; row++) {
        for (uint32_t col = 0; col < cols; col++) {
          table[row * cols + col] = rand() % 32767;
        }
      }
      entropy_int(table, &rows, &cols, &entropy_table, &entropy_rows,
                  &entropy_cols, &entropy_rowsGivencols, &entropy_colsGivenRows,
                  &dependency_rowsOncols, &dependency_colsOnRows,
                  &dependency_symmetrical, &time_sum_all, &time_sum_rows,
                  &time_sum_cols, &time_entropy_table, &time_entropy_rows,
                  &time_entropy_cols);
      free(table);
      printf("Rows: %d, cols: %d\n", rows, cols);
      printf("\n");
      printf("Entropy of Table          : %1.4f\n", entropy_table);
      printf("Entropy of x-distribution : %1.4f\n", entropy_rows);
      printf("Entropy of y-distribution : %1.4f\n", entropy_cols);
      printf("Entropy of x given y      : %1.4f\n", entropy_rowsGivencols);
      printf("Entropy of y given x      : %1.4f\n", entropy_colsGivenRows);
      printf("Dependency or x on y      : %1.4f\n", dependency_rowsOncols);
      printf("Dependency of y on x      : %1.4f\n", dependency_colsOnRows);
      printf("Symmetrical Dependency    : %1.4f\n", dependency_symmetrical);
      printf("Time Sum All              : %1.4f seconds\n", time_sum_all);
      printf("Time Sum Rows             : %1.4f seconds\n", time_sum_rows);
      printf("Time Sum cols             : %1.4f seconds\n", time_sum_cols);
      printf("Time Entropy Rows         : %1.4f seconds\n", time_entropy_rows);
      printf("Time Entropy cols         : %1.4f seconds\n", time_entropy_cols);
      printf("Time Table Entropy        : %1.4f seconds\n", time_entropy_table);
      printf("\n");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
movl   $0x1388,-0x2c(%rbp)
movl   $0x2710,-0x30(%rbp)
movl   $0x1388,-0x34(%rbp)
movl   $0x1388,-0x38(%rbp)
movl   $0x2710,-0x3c(%rbp)
movl   $0x1388,-0x40(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x44(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x54(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x5c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x64(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x6c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x70(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x74(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x78(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jg     1551 <main+0x3e1>
mov    -0x38(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    -0x80(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jg     153e <main+0x3ce>
mov    -0x7c(%rbp),%eax
imul   -0x80(%rbp),%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x88(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x7c(%rbp),%eax
jge    12f8 <main+0x188>
movl   $0x0,-0x90(%rbp)
mov    -0x90(%rbp),%eax
cmp    -0x80(%rbp),%eax
jge    12df <main+0x16f>
mov    $0x0,%al
call   1090 <rand@plt>
mov    $0x7fff,%ecx
cltd
idiv   %ecx
mov    -0x88(%rbp),%rax
mov    -0x8c(%rbp),%ecx
imul   -0x80(%rbp),%ecx
add    -0x90(%rbp),%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    1290 <main+0x120>
jmp    12e4 <main+0x174>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    1277 <main+0x107>
mov    -0x88(%rbp),%rdi
lea    -0x7c(%rbp),%rsi
lea    -0x80(%rbp),%rdx
lea    -0x44(%rbp),%rcx
lea    -0x48(%rbp),%r8
lea    -0x4c(%rbp),%r9
lea    -0x50(%rbp),%rax
mov    %rax,-0xb0(%rbp)
lea    -0x54(%rbp),%rax
mov    %rax,-0xa8(%rbp)
lea    -0x58(%rbp),%rax
mov    %rax,-0xa0(%rbp)
lea    -0x5c(%rbp),%r13
lea    -0x60(%rbp),%r12
lea    -0x64(%rbp),%r15
lea    -0x68(%rbp),%r14
lea    -0x6c(%rbp),%rbx
lea    -0x70(%rbp),%r11
lea    -0x74(%rbp),%r10
lea    -0x78(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0xb0(%rbp),%rax
mov    %rax,(%rsp)
mov    -0xa8(%rbp),%rax
mov    %rax,0x8(%rsp)
mov    -0xa0(%rbp),%rax
mov    %rax,0x10(%rsp)
mov    -0x98(%rbp),%rax
mov    %r13,0x18(%rsp)
mov    %r12,0x20(%rsp)
mov    %r15,0x28(%rsp)
mov    %r14,0x30(%rsp)
mov    %rbx,0x38(%rsp)
mov    %r11,0x40(%rsp)
mov    %r10,0x48(%rsp)
mov    %rax,0x50(%rsp)
call   1040 <entropy_int@plt>
mov    -0x88(%rbp),%rdi
call   1030 <free@plt>
mov    -0x7c(%rbp),%esi
mov    -0x80(%rbp),%edx
lea    0xc35(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc39(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movss  -0x44(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc24(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  -0x48(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc30(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  -0x4c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc3c(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  -0x50(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc48(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  -0x54(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc54(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  -0x58(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc60(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  -0x5c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc6c(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  -0x60(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc78(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  -0x64(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc84(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  -0x68(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc98(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  -0x6c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcac(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  -0x74(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcc0(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  -0x78(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcd4(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movss  -0x70(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xce8(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xae9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%eax
add    -0x80(%rbp),%eax
mov    %eax,-0x80(%rbp)
jmp    1236 <main+0xc6>
jmp    1543 <main+0x3d3>
mov    -0x34(%rbp),%eax
add    -0x7c(%rbp),%eax
mov    %eax,-0x7c(%rbp)
jmp    1224 <main+0xb4>
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movl   $0x0,0x44(%rsp)
movl   $0x0,0x40(%rsp)
movl   $0x0,0x3c(%rsp)
movl   $0x0,0x38(%rsp)
movl   $0x0,0x34(%rsp)
movl   $0x0,0x30(%rsp)
movl   $0x0,0x2c(%rsp)
movl   $0x0,0x28(%rsp)
movl   $0x0,0x24(%rsp)
movl   $0x0,0x20(%rsp)
movl   $0x0,0x1c(%rsp)
movl   $0x0,0x18(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x1388,0x8(%rsp)
mov    $0x1388,%edi
lea    0xf9b(%rip),%rbp
lea    0xfbf(%rip),%r14
lea    0xfe3(%rip),%r15
jmp    1249 <main+0xc9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x8(%rsp),%eax
lea    0x1388(%rax),%edi
mov    %edi,0x8(%rsp)
cmp    $0x1389,%eax
jge    14fa <main+0x37a>
movl   $0x1388,0xc(%rsp)
mov    $0x1388,%eax
cs nopw 0x0(%rax,%rax,1)
imul   %eax,%edi
shl    $0x2,%edi
call   1090 <malloc@plt>
mov    %rax,%r12
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
mov    0x8(%rsp),%ecx
test   %ecx,%ecx
jle    12f0 <main+0x170>
xor    %r13d,%r13d
mov    0xc(%rsp),%eax
jmp    1299 <main+0x119>
nopl   (%rax)
add    $0x1,%r13d
cmp    %ecx,%r13d
jge    12f0 <main+0x170>
test   %eax,%eax
jle    1290 <main+0x110>
xor    %ebx,%ebx
nop
xor    %eax,%eax
call   10a0 <rand@plt>
cltq
imul   $0xffffffff80010003,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0xe,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0xf,%edx
sub    %edx,%ecx
add    %eax,%ecx
mov    0xc(%rsp),%eax
mov    %r13d,%edx
imul   %eax,%edx
movslq %edx,%rdx
add    %rbx,%rdx
mov    %ecx,(%r12,%rdx,4)
add    $0x1,%rbx
cmp    %eax,%ebx
jl     12a0 <main+0x120>
mov    0x8(%rsp),%ecx
jmp    1290 <main+0x110>
nopl   0x0(%rax,%rax,1)
sub    $0x8,%rsp
mov    %r12,%rdi
lea    0x10(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x4c(%rsp),%rcx
lea    0x48(%rsp),%r8
lea    0x44(%rsp),%r9
lea    0x18(%rsp),%rax
push   %rax
lea    0x24(%rsp),%rax
push   %rax
lea    0x30(%rsp),%rax
push   %rax
lea    0x3c(%rsp),%rax
push   %rax
lea    0x48(%rsp),%rax
push   %rax
lea    0x54(%rsp),%rax
push   %rax
lea    0x60(%rsp),%rax
push   %rax
lea    0x6c(%rsp),%rax
push   %rax
lea    0x78(%rsp),%rax
push   %rax
lea    0x84(%rsp),%rax
push   %rax
lea    0x90(%rsp),%rax
push   %rax
call   1050 <entropy_int@plt>
add    $0x60,%rsp
mov    %r12,%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
lea    0xc88(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
movss  0x44(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc7a(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x40(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc85(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x3c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc90(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x38(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc9b(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x34(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xca6(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x30(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcb1(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x2c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcbc(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x28(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcc7(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x24(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcd2(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x20(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xce5(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x1c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcf8(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x18(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0xc(%rsp),%ecx
lea    0x1388(%rcx),%eax
mov    %eax,0xc(%rsp)
cmp    $0x1388,%ecx
jg     1230 <main+0xb0>
mov    0x8(%rsp),%edi
jmp    1260 <main+0xe0>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Rows: %d, cols: %d\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [35 x i8] c"Entropy of Table : %1.4f\0A\00"
@.str.3 = [35 x i8] c"Entropy of x-distribution : %1.4f\0A\00"
@.str.4 = [35 x i8] c"Entropy of y-distribution : %1.4f\0A\00"
@.str.5 = [35 x i8] c"Entropy of x given y : %1.4f\0A\00"
@.str.6 = [35 x i8] c"Entropy of y given x : %1.4f\0A\00"
@.str.7 = [35 x i8] c"Dependency or x on y : %1.4f\0A\00"
@.str.8 = [35 x i8] c"Dependency of y on x : %1.4f\0A\00"
@.str.9 = [35 x i8] c"Symmetrical Dependency : %1.4f\0A\00"
@.str.10 = [43 x i8] c"Time Sum All : %1.4f seconds\0A\00"
@.str.11 = [43 x i8] c"Time Sum Rows : %1.4f seconds\0A\00"
@.str.12 = [43 x i8] c"Time Sum cols : %1.4f seconds\0A\00"
@.str.13 = [43 x i8] c"Time Entropy Rows : %1.4f seconds\0A\00"
@.str.14 = [43 x i8] c"Time Entropy cols : %1.4f seconds\0A\00"
@.str.15 = [43 x i8] c"Time Table Entropy : %1.4f seconds\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
%20 = alloca float
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32*
%24 = alloca i32
%25 = alloca i32
store i32 5000, i32* %1
store i32 10000, i32* %2
store i32 5000, i32* %3
store i32 5000, i32* %4
store i32 10000, i32* %5
store i32 5000, i32* %6
store float 0.000000e+00, float* %7
store float 0.000000e+00, float* %8
store float 0.000000e+00, float* %9
store float 0.000000e+00, float* %10
store float 0.000000e+00, float* %11
store float 0.000000e+00, float* %12
store float 0.000000e+00, float* %13
store float 0.000000e+00, float* %14
store float 0.000000e+00, float* %15
store float 0.000000e+00, float* %16
store float 0.000000e+00, float* %17
store float 0.000000e+00, float* %18
store float 0.000000e+00, float* %19
store float 0.000000e+00, float* %20
%26 = load i32, i32* %1
store i32 %26, i32* %21
br label %27
27: ; preds = %131, %0
%28 = load i32, i32* %21
%29 = load i32, i32* %2
%30 = icmp sle i32 %28, %29
br i1 %30, label %31, label %135
31: ; preds = %27
%32 = load i32, i32* %4
store i32 %32, i32* %22
br label %33
33: ; preds = %126, %31
%34 = load i32, i32* %22
%35 = load i32, i32* %5
%36 = icmp sle i32 %34, %35
br i1 %36, label %37, label %130
37: ; preds = %33
%38 = load i32, i32* %21
%39 = load i32, i32* %22
%40 = mul nsw i32 %38, %39
%41 = sext i32 %40 to i64
%42 = mul i64 %41, 4
%43 = trunc i64 %42 to i32
%44 = call i32* @malloc(i32 %43)
store i32* %44, i32** %23
%45 = call i32 @time(i32* null)
%46 = call i32 @srand(i32 %45)
store i32 0, i32* %24
br label %47
47: ; preds = %71, %37
%48 = load i32, i32* %24
%49 = load i32, i32* %21
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %74
51: ; preds = %47
store i32 0, i32* %25
br label %52
52: ; preds = %67, %51
%53 = load i32, i32* %25
%54 = load i32, i32* %22
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %70
56: ; preds = %52
%57 = call i32 (...) @rand()
%58 = srem i32 %57, 32767
%59 = load i32*, i32** %23
%60 = load i32, i32* %24
%61 = load i32, i32* %22
%62 = mul nsw i32 %60, %61
%63 = load i32, i32* %25
%64 = add nsw i32 %62, %63
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i32, i32* %59, i64 %65
store i32 %58, i32* %66
br label %67
67: ; preds = %56
%68 = load i32, i32* %25
%69 = add nsw i32 %68, 1
store i32 %69, i32* %25
br label %52
70: ; preds = %52
br label %71
71: ; preds = %70
%72 = load i32, i32* %24
%73 = add nsw i32 %72, 1
store i32 %73, i32* %24
br label %47
74: ; preds = %47
%75 = load i32*, i32** %23
%76 = call i32 @entropy_int(i32* %75, i32* %21, i32* %22, float* %7, float* %8, float* %9, float* %10, float* %11, float* %12, float* %13, float* %14, float* %15, float* %16, float* %17, float* %18, float* %19, float* %20)
%77 = load i32*, i32** %23
%78 = call i32 @free(i32* %77)
%79 = load i32, i32* %21
%80 = load i32, i32* %22
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %79, i32 %80)
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%83 = load float, float* %7
%84 = fpext float %83 to double
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), double %84)
%86 = load float, float* %8
%87 = fpext float %86 to double
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), double %87)
%89 = load float, float* %9
%90 = fpext float %89 to double
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), double %90)
%92 = load float, float* %10
%93 = fpext float %92 to double
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), double %93)
%95 = load float, float* %11
%96 = fpext float %95 to double
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), double %96)
%98 = load float, float* %12
%99 = fpext float %98 to double
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), double %99)
%101 = load float, float* %13
%102 = fpext float %101 to double
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0), double %102)
%104 = load float, float* %14
%105 = fpext float %104 to double
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0), double %105)
%107 = load float, float* %15
%108 = fpext float %107 to double
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.10, i64 0, i64 0), double %108)
%110 = load float, float* %16
%111 = fpext float %110 to double
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.11, i64 0, i64 0), double %111)
%113 = load float, float* %17
%114 = fpext float %113 to double
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.12, i64 0, i64 0), double %114)
%116 = load float, float* %19
%117 = fpext float %116 to double
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.13, i64 0, i64 0), double %117)
%119 = load float, float* %20
%120 = fpext float %119 to double
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.14, i64 0, i64 0), double %120)
%122 = load float, float* %18
%123 = fpext float %122 to double
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.15, i64 0, i64 0), double %123)
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %126
126: ; preds = %74
%127 = load i32, i32* %6
%128 = load i32, i32* %22
%129 = add nsw i32 %128, %127
store i32 %129, i32* %22
br label %33
130: ; preds = %33
br label %131
131: ; preds = %130
%132 = load i32, i32* %3
%133 = load i32, i32* %21
%134 = add nsw i32 %133, %132
store i32 %134, i32* %21
br label %27
135: ; preds = %27
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"Rows: %d, cols: %d\0A\00"
@.str.2 = [35 x i8] c"Entropy of Table : %1.4f\0A\00"
@.str.3 = [35 x i8] c"Entropy of x-distribution : %1.4f\0A\00"
@.str.4 = [35 x i8] c"Entropy of y-distribution : %1.4f\0A\00"
@.str.5 = [35 x i8] c"Entropy of x given y : %1.4f\0A\00"
@.str.6 = [35 x i8] c"Entropy of y given x : %1.4f\0A\00"
@.str.7 = [35 x i8] c"Dependency or x on y : %1.4f\0A\00"
@.str.8 = [35 x i8] c"Dependency of y on x : %1.4f\0A\00"
@.str.9 = [35 x i8] c"Symmetrical Dependency : %1.4f\0A\00"
@.str.10 = [43 x i8] c"Time Sum All : %1.4f seconds\0A\00"
@.str.11 = [43 x i8] c"Time Sum Rows : %1.4f seconds\0A\00"
@.str.12 = [43 x i8] c"Time Sum cols : %1.4f seconds\0A\00"
@.str.13 = [43 x i8] c"Time Entropy Rows : %1.4f seconds\0A\00"
@.str.14 = [43 x i8] c"Time Entropy cols : %1.4f seconds\0A\00"
@.str.15 = [43 x i8] c"Time Table Entropy : %1.4f seconds\0A\00"
define void @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca i32
%16 = alloca i32
%17 = bitcast float* %1 to i8*
store float 0.000000e+00, float* %1
%18 = bitcast float* %2 to i8*
store float 0.000000e+00, float* %2
%19 = bitcast float* %3 to i8*
store float 0.000000e+00, float* %3
%20 = bitcast float* %4 to i8*
store float 0.000000e+00, float* %4
%21 = bitcast float* %5 to i8*
store float 0.000000e+00, float* %5
%22 = bitcast float* %6 to i8*
store float 0.000000e+00, float* %6
%23 = bitcast float* %7 to i8*
store float 0.000000e+00, float* %7
%24 = bitcast float* %8 to i8*
store float 0.000000e+00, float* %8
%25 = bitcast float* %9 to i8*
store float 0.000000e+00, float* %9
%26 = bitcast float* %10 to i8*
store float 0.000000e+00, float* %10
%27 = bitcast float* %11 to i8*
store float 0.000000e+00, float* %11
%28 = bitcast float* %12 to i8*
store float 0.000000e+00, float* %12
%29 = bitcast float* %13 to i8*
store float 0.000000e+00, float* %13
%30 = bitcast float* %14 to i8*
store float 0.000000e+00, float* %14
%31 = bitcast i32* %15 to i8*
%32 = bitcast i32* %16 to i8*
store i32 5000, i32* %15
br label %34
33: ; preds = %36
ret void
34: ; preds = %0, %36
%35 = phi i32 [ 5000, %0 ], [ %38, %36 ]
store i32 5000, i32* %16
br label %40
36: ; preds = %57
%37 = load i32, i32* %15
%38 = add nsw i32 %37, 5000
store i32 %38, i32* %15
%39 = icmp slt i32 %37, 5001
br i1 %39, label %34, label %33
40: ; preds = %110, %34
%41 = phi i32 [ %35, %34 ], [ %111, %110 ]
%42 = phi i32 [ 5000, %34 ], [ %108, %110 ]
%43 = shl i32 %42, 2
%44 = mul i32 %43, %41
%45 = call i32* @malloc(i32 %44)
%46 = call i32 @time(i32* null)
%47 = call i32 @srand(i32 %46)
%48 = load i32, i32* %15
%49 = icmp sgt i32 %48, 0
br i1 %49, label %50, label %57
50: ; preds = %40
%51 = load i32, i32* %16
br label %52
52: ; preds = %50, %114
%53 = phi i32 [ %115, %114 ], [ %48, %50 ]
%54 = phi i32 [ %116, %114 ], [ %51, %50 ]
%55 = phi i32 [ %117, %114 ], [ 0, %50 ]
%56 = icmp sgt i32 %54, 0
br i1 %56, label %119, label %114
57: ; preds = %114, %40
%58 = call i32 @entropy_int(i32* %45, i32* %15, i32* %16, float* %1, float* %2, float* %3, float* %4, float* %5, float* %6, float* %7, float* %8, float* %9, float* %10, float* %11, float* %12, float* %13, float* %14)
%59 = call i32 @free(i32* %45)
%60 = load i32, i32* %15
%61 = load i32, i32* %16
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %60, i32 %61)
%63 = call i32 @putchar(i32 10)
%64 = load float, float* %1
%65 = fpext float %64 to double
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), double %65)
%67 = load float, float* %2
%68 = fpext float %67 to double
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), double %68)
%70 = load float, float* %3
%71 = fpext float %70 to double
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), double %71)
%73 = load float, float* %4
%74 = fpext float %73 to double
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), double %74)
%76 = load float, float* %5
%77 = fpext float %76 to double
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), double %77)
%79 = load float, float* %6
%80 = fpext float %79 to double
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), double %80)
%82 = load float, float* %7
%83 = fpext float %82 to double
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0), double %83)
%85 = load float, float* %8
%86 = fpext float %85 to double
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0), double %86)
%88 = load float, float* %9
%89 = fpext float %88 to double
%90 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.10, i64 0, i64 0), double %89)
%91 = load float, float* %10
%92 = fpext float %91 to double
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.11, i64 0, i64 0), double %92)
%94 = load float, float* %11
%95 = fpext float %94 to double
%96 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.12, i64 0, i64 0), double %95)
%97 = load float, float* %13
%98 = fpext float %97 to double
%99 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.13, i64 0, i64 0), double %98)
%100 = load float, float* %14
%101 = fpext float %100 to double
%102 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.14, i64 0, i64 0), double %101)
%103 = load float, float* %12
%104 = fpext float %103 to double
%105 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.15, i64 0, i64 0), double %104)
%106 = call i32 @putchar(i32 10)
%107 = load i32, i32* %16
%108 = add nsw i32 %107, 5000
store i32 %108, i32* %16
%109 = icmp slt i32 %107, 5001
br i1 %109, label %110, label %36
110: ; preds = %57
%111 = load i32, i32* %15
br label %40
112: ; preds = %119
%113 = load i32, i32* %15
br label %114
114: ; preds = %112, %52
%115 = phi i32 [ %113, %112 ], [ %53, %52 ]
%116 = phi i32 [ %123, %112 ], [ %54, %52 ]
%117 = add nuw nsw i32 %55, 1
%118 = icmp slt i32 %117, %115
br i1 %118, label %52, label %57
119: ; preds = %52, %119
%120 = phi i32 [ %128, %119 ], [ 0, %52 ]
%121 = call i32 (...) @rand()
%122 = srem i32 %121, 32767
%123 = load i32, i32* %16
%124 = mul nsw i32 %123, %55
%125 = add nsw i32 %124, %120
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i32, i32* %45, i64 %126
store i32 %122, i32* %127
%128 = add nuw nsw i32 %120, 1
%129 = icmp slt i32 %128, %123
br i1 %129, label %119, label %112
}