#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 */
int /*<<< orphan*/ PmlTableGen(int, int, double *, double *);
int TableSize(int, int);
int /*<<< orphan*/ Transpose_CosPmlTableGen(int, int, double *, double *);
scalar_t__ malloc(int);
double **Transpose_SemiNaive_Naive_Pml_Table(double **seminaive_naive_pml_table,
                                             int bw, int m, double *resultspace,
                                             double *workspace) {
  int i, lastspace;
  double **trans_seminaive_naive_pml_table;
  trans_seminaive_naive_pml_table =
      (double **)malloc(sizeof(double *) * (bw + 1));
  trans_seminaive_naive_pml_table[0] = resultspace;
  for (i = 1; i < m; i++) {
    trans_seminaive_naive_pml_table[i] =
        trans_seminaive_naive_pml_table[i - 1] + TableSize(i - 1, bw);
  }
  if (m == 0) {
    lastspace = 0;
    for (i = m + 1; i < bw; i++) {
      trans_seminaive_naive_pml_table[i] =
          trans_seminaive_naive_pml_table[i - 1] + (2 * bw * (bw - (i - 1)));
    }
  } else {
    lastspace = TableSize(m - 1, bw);
    trans_seminaive_naive_pml_table[m] =
        trans_seminaive_naive_pml_table[m - 1] + lastspace;
    for (i = m + 1; i < bw; i++) {
      trans_seminaive_naive_pml_table[i] =
          trans_seminaive_naive_pml_table[i - 1] + (2 * bw * (bw - (i - 1)));
    }
  }
  for (i = 0; i < m; i++) {
    Transpose_CosPmlTableGen(bw, i, seminaive_naive_pml_table[i],
                             trans_seminaive_naive_pml_table[i]);
    if (i != (bw - 1)) {
      trans_seminaive_naive_pml_table[i + 1] =
          trans_seminaive_naive_pml_table[i] + TableSize(i, bw);
    }
  }
  for (i = m; i < bw; i++) {
    PmlTableGen(bw, i, trans_seminaive_naive_pml_table[i], workspace);
  }
  return trans_seminaive_naive_pml_table;
}


x86 assembly (clang, -O0):
<Transpose_SemiNaive_Naive_Pml_Table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11d9 <Transpose_SemiNaive_Naive_Pml_Table+0x99>
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
mov    -0x24(%rbp),%edi
sub    $0x1,%edi
mov    -0xc(%rbp),%esi
call   1040 <TableSize@plt>
mov    -0x38(%rbp),%rdx
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1183 <Transpose_SemiNaive_Naive_Pml_Table+0x43>
cmpl   $0x0,-0x10(%rbp)
jne    124c <Transpose_SemiNaive_Naive_Pml_Table+0x10c>
movl   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1247 <Transpose_SemiNaive_Naive_Pml_Table+0x107>
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    -0xc(%rbp),%ecx
mov    -0x24(%rbp),%esi
sub    $0x1,%esi
sub    %esi,%ecx
imul   %ecx,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11f3 <Transpose_SemiNaive_Naive_Pml_Table+0xb3>
jmp    12e7 <Transpose_SemiNaive_Naive_Pml_Table+0x1a7>
mov    -0x10(%rbp),%edi
sub    $0x1,%edi
mov    -0xc(%rbp),%esi
call   1040 <TableSize@plt>
mov    %eax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
movslq -0x28(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x30(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12e2 <Transpose_SemiNaive_Naive_Pml_Table+0x1a2>
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    -0xc(%rbp),%ecx
mov    -0x24(%rbp),%esi
sub    $0x1,%esi
sub    %esi,%ecx
imul   %ecx,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    128e <Transpose_SemiNaive_Naive_Pml_Table+0x14e>
jmp    12e7 <Transpose_SemiNaive_Naive_Pml_Table+0x1a7>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    137a <Transpose_SemiNaive_Naive_Pml_Table+0x23a>
mov    -0xc(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
call   1030 <Transpose_CosPmlTableGen@plt>
mov    -0x24(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     1367 <Transpose_SemiNaive_Naive_Pml_Table+0x227>
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x40(%rbp)
mov    -0x24(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <TableSize@plt>
mov    -0x40(%rbp),%rdx
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    136c <Transpose_SemiNaive_Naive_Pml_Table+0x22c>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12ee <Transpose_SemiNaive_Naive_Pml_Table+0x1ae>
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    13b5 <Transpose_SemiNaive_Naive_Pml_Table+0x275>
mov    -0xc(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x20(%rbp),%rcx
call   1050 <PmlTableGen@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1380 <Transpose_SemiNaive_Naive_Pml_Table+0x240>
mov    -0x30(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Transpose_SemiNaive_Naive_Pml_Table>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,0x18(%rsp)
mov    %rcx,%rbp
mov    %edx,%ebx
mov    %esi,%r13d
mov    %rdi,0x20(%rsp)
lea    0x8(,%r13,8),%edi
call   1060 <malloc@plt>
mov    %rax,%r12
mov    %rbp,(%rax)
mov    %rbx,(%rsp)
cmp    $0x2,%ebx
jl     11b0 <Transpose_SemiNaive_Naive_Pml_Table+0x70>
mov    (%rsp),%ebx
add    $0xffffffffffffffff,%rbx
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
mov    %r14d,%edi
mov    %r13d,%esi
call   1040 <TableSize@plt>
cltq
lea    0x0(%rbp,%rax,8),%rbp
mov    %rbp,0x8(%r12,%r14,8)
add    $0x1,%r14
cmp    %r14,%rbx
jne    1190 <Transpose_SemiNaive_Naive_Pml_Table+0x50>
mov    (%rsp),%rbp
movslq %ebp,%rbx
test   %ebp,%ebp
mov    %r13,0x8(%rsp)
mov    %rbx,0x10(%rsp)
je     1262 <Transpose_SemiNaive_Naive_Pml_Table+0x122>
lea    -0x1(%rbp),%edi
mov    %r13d,%esi
call   1040 <TableSize@plt>
cltq
shl    $0x3,%rax
add    -0x8(%r12,%rbx,8),%rax
mov    %rax,(%r12,%rbx,8)
lea    0x1(%rbp),%eax
cmp    %r13d,%eax
jge    1511 <Transpose_SemiNaive_Naive_Pml_Table+0x3d1>
lea    0x0(%r13,%r13,1),%r9d
cltq
lea    -0x2(%r13),%ecx
mov    %ecx,%r8d
mov    (%rsp),%rsi
sub    %esi,%r8d
cmp    $0x3,%r8d
jb     1339 <Transpose_SemiNaive_Naive_Pml_Table+0x1f9>
cmp    %esi,%ecx
jl     1339 <Transpose_SemiNaive_Naive_Pml_Table+0x1f9>
lea    (%r12,%rax,8),%rdx
mov    %r13d,%ecx
sub    %esi,%ecx
add    $0xfffffffe,%ecx
mov    0x10(%rsp),%rdi
lea    (%rdi,%rcx,1),%rsi
lea    (%r12,%rsi,8),%rsi
add    $0x8,%rsi
cmp    %rsi,%rdx
jae    1343 <Transpose_SemiNaive_Naive_Pml_Table+0x203>
add    %rax,%rcx
lea    (%r12,%rcx,8),%rcx
add    $0x8,%rcx
lea    (%r12,%rdi,8),%rdx
cmp    %rcx,%rdx
jae    1343 <Transpose_SemiNaive_Naive_Pml_Table+0x203>
mov    %rax,%rbp
mov    (%rsp),%rax
mov    %eax,%edx
jmp    145f <Transpose_SemiNaive_Naive_Pml_Table+0x31f>
cmp    $0x2,%r13d
jl     157b <Transpose_SemiNaive_Naive_Pml_Table+0x43b>
mov    0x8(%rsp),%rcx
lea    (%rcx,%rcx,1),%eax
mov    %ecx,%r14d
movslq %eax,%r8
mov    (%r12),%rsi
lea    -0x1(%r14),%rdi
lea    -0x2(%r14),%rbp
mov    %edi,%r9d
and    $0x3,%r9d
mov    $0x1,%ecx
cmp    $0x3,%rbp
jb     12fd <Transpose_SemiNaive_Naive_Pml_Table+0x1bd>
mov    %rdi,%r10
and    $0xfffffffffffffffc,%r10
lea    -0x3(%r14),%rdx
imul   %r8,%rdx
lea    0x0(,%r8,4),%r11
imul   %r8,%rdi
mov    %r8,%rax
imul   %r14,%rax
imul   %r8,%rbp
xor    %ecx,%ecx
lea    (%rsi,%rax,8),%rsi
mov    %rsi,0x8(%r12,%rcx,8)
lea    (%rsi,%rdi,8),%rsi
mov    %rsi,0x10(%r12,%rcx,8)
lea    (%rsi,%rbp,8),%rsi
mov    %rsi,0x18(%r12,%rcx,8)
lea    (%rsi,%rdx,8),%rsi
mov    %rsi,0x20(%r12,%rcx,8)
add    $0x4,%rcx
sub    %r11,%rdx
sub    %r11,%rdi
sub    %r11,%rax
sub    %r11,%rbp
cmp    %rcx,%r10
jne    12c0 <Transpose_SemiNaive_Naive_Pml_Table+0x180>
add    $0x1,%rcx
test   %r9,%r9
je     1511 <Transpose_SemiNaive_Naive_Pml_Table+0x3d1>
lea    (%r12,%rcx,8),%rax
sub    %rcx,%r14
add    $0x1,%r14
imul   %r8,%r14
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
lea    (%rsi,%r14,8),%rsi
mov    %rsi,(%rax,%rcx,8)
add    $0x1,%rcx
sub    %r8,%r14
cmp    %rcx,%r9
jne    1320 <Transpose_SemiNaive_Naive_Pml_Table+0x1e0>
jmp    1511 <Transpose_SemiNaive_Naive_Pml_Table+0x3d1>
mov    %rax,%rbp
mov    %esi,%edx
jmp    145f <Transpose_SemiNaive_Naive_Pml_Table+0x31f>
add    $0x1,%r8
mov    %r8,%rdi
and    $0xfffffffffffffffc,%rdi
lea    (%rdi,%rax,1),%rbp
mov    (%rsp),%rcx
lea    (%rdi,%rcx,1),%edx
movd   %ecx,%xmm0
pshufd $0x50,%xmm0,%xmm0
paddd  0xc96(%rip),%xmm0
movd   %r13d,%xmm1
pshufd $0x50,%xmm1,%xmm10
movd   %r9d,%xmm2
pshufd $0x50,%xmm2,%xmm5
mov    %ecx,%esi
lea    (%r12,%rax,8),%rcx
add    $0x10,%rcx
xor    %eax,%eax
movdqa 0xc7c(%rip),%xmm8
pshufd $0xf5,%xmm5,%xmm4
movdqa 0xc7e(%rip),%xmm9
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    (%rsi,%rax,1),%ebx
movslq %ebx,%rbx
movdqu (%r12,%rbx,8),%xmm7
movdqu 0x10(%r12,%rbx,8),%xmm6
movdqa %xmm10,%xmm1
psubd  %xmm0,%xmm1
movdqa %xmm5,%xmm2
pmuludq %xmm1,%xmm2
pshufd $0xf5,%xmm1,%xmm3
psubd  %xmm8,%xmm1
pshufd $0xe8,%xmm2,%xmm2
pmuludq %xmm4,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm3,%xmm2
movdqa %xmm5,%xmm3
pmuludq %xmm1,%xmm3
pshufd $0xe8,%xmm3,%xmm3
pshufd $0xf5,%xmm1,%xmm1
pmuludq %xmm4,%xmm1
pshufd $0xe8,%xmm1,%xmm1
punpckldq %xmm1,%xmm3
pxor   %xmm1,%xmm1
pcmpgtd %xmm2,%xmm1
punpckldq %xmm1,%xmm2
pxor   %xmm1,%xmm1
pcmpgtd %xmm3,%xmm1
punpckldq %xmm1,%xmm3
psllq  $0x3,%xmm2
paddq  %xmm7,%xmm2
psllq  $0x3,%xmm3
paddq  %xmm6,%xmm3
movdqu %xmm2,-0x10(%rcx,%rax,8)
movdqu %xmm3,(%rcx,%rax,8)
add    $0x4,%rax
paddd  %xmm9,%xmm0
cmp    %rax,%rdi
jne    13b0 <Transpose_SemiNaive_Naive_Pml_Table+0x270>
cmp    %rdi,%r8
je     1511 <Transpose_SemiNaive_Naive_Pml_Table+0x3d1>
mov    %r13d,%ecx
sub    %ebp,%ecx
mov    %ebp,%eax
not    %eax
test   $0x1,%cl
je     148e <Transpose_SemiNaive_Naive_Pml_Table+0x34e>
movslq %edx,%rcx
mov    %r13d,%edx
sub    %ecx,%edx
imul   %r9d,%edx
movslq %edx,%rdx
shl    $0x3,%rdx
add    (%r12,%rcx,8),%rdx
mov    %rdx,(%r12,%rbp,8)
mov    %ebp,%edx
add    $0x1,%rbp
add    %r13d,%eax
je     1511 <Transpose_SemiNaive_Naive_Pml_Table+0x3d1>
movabs $0x1fffffffc,%r8
mov    %r13d,%r10d
mov    %rbp,%rcx
shl    $0x20,%rcx
mov    %r13d,%edi
sub    %ebp,%edi
imul   %r13d,%edi
add    %edi,%edi
lea    0x0(,%r13,4),%eax
xchg   %ax,%ax
movslq %edx,%rdx
mov    %r13d,%ebx
sub    %edx,%ebx
imul   %r9d,%ebx
movslq %ebx,%rbx
shl    $0x3,%rbx
add    (%r12,%rdx,8),%rbx
mov    %rbx,(%r12,%rbp,8)
lea    (%r8,%rcx,1),%rbx
add    $0x4,%rbx
sar    $0x1d,%rcx
movslq %edi,%rdi
lea    0x0(,%rdi,8),%rdx
add    (%r12,%rcx,1),%rdx
mov    %rdx,0x8(%r12,%rbp,8)
mov    %ebp,%edx
lea    0x2(%rbp),%rsi
add    $0x1,%edx
sub    %eax,%edi
mov    %rbx,%rcx
mov    %rsi,%rbp
cmp    %esi,%r10d
jne    14c0 <Transpose_SemiNaive_Naive_Pml_Table+0x380>
cmpl   $0x0,(%rsp)
jle    157b <Transpose_SemiNaive_Naive_Pml_Table+0x43b>
mov    0x8(%rsp),%rax
lea    -0x1(%rax),%r13d
mov    (%rsp),%r15d
xor    %ebp,%ebp
jmp    153c <Transpose_SemiNaive_Naive_Pml_Table+0x3fc>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
mov    %r14,%r12
cmp    %r15,%rbp
je     157b <Transpose_SemiNaive_Naive_Pml_Table+0x43b>
mov    0x20(%rsp),%rax
mov    (%rax,%rbp,8),%rdx
mov    (%r12,%rbp,8),%rcx
mov    %r12,%r14
mov    0x8(%rsp),%r12
mov    %r12d,%edi
mov    %ebp,%esi
call   1030 <Transpose_CosPmlTableGen@plt>
cmp    %r13,%rbp
je     1530 <Transpose_SemiNaive_Naive_Pml_Table+0x3f0>
mov    (%r14,%rbp,8),%rbx
mov    %ebp,%edi
mov    %r12d,%esi
call   1040 <TableSize@plt>
cltq
lea    (%rbx,%rax,8),%rax
mov    %rax,0x8(%r14,%rbp,8)
jmp    1530 <Transpose_SemiNaive_Naive_Pml_Table+0x3f0>
mov    0x8(%rsp),%r15
mov    (%rsp),%rbp
cmp    %r15d,%ebp
mov    0x18(%rsp),%r14
jge    15bc <Transpose_SemiNaive_Naive_Pml_Table+0x47c>
mov    0x10(%rsp),%rax
lea    (%r12,%rax,8),%rbx
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%rdx
mov    %r15d,%edi
mov    %ebp,%esi
mov    %r14,%rcx
call   1050 <PmlTableGen@plt>
add    $0x1,%ebp
add    $0x8,%rbx
cmp    %ebp,%r15d
jne    15a0 <Transpose_SemiNaive_Naive_Pml_Table+0x460>
mov    %r12,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double** @Transpose_SemiNaive_Naive_Pml_Table(double** %0, i32 %1, i32 %2, double* %3, double* %4) {
%6 = alloca double**
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca i32
%13 = alloca double**
store double** %0, double*** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store double* %3, double** %9
store double* %4, double** %10
%14 = load i32, i32* %7
%15 = add nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = mul i64 8, %16
%18 = trunc i64 %17 to i32
%19 = call i64 @malloc(i32 %18)
%20 = inttoptr i64 %19 to double**
store double** %20, double*** %13
%21 = load double*, double** %9
%22 = load double**, double*** %13
%23 = getelementptr inbounds double*, double** %22, i64 0
store double* %21, double** %23
store i32 1, i32* %11
br label %24
24: ; preds = %45, %5
%25 = load i32, i32* %11
%26 = load i32, i32* %8
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %48
28: ; preds = %24
%29 = load double**, double*** %13
%30 = load i32, i32* %11
%31 = sub nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double*, double** %29, i64 %32
%34 = load double*, double** %33
%35 = load i32, i32* %11
%36 = sub nsw i32 %35, 1
%37 = load i32, i32* %7
%38 = call i32 @TableSize(i32 %36, i32 %37)
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %34, i64 %39
%41 = load double**, double*** %13
%42 = load i32, i32* %11
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double*, double** %41, i64 %43
store double* %40, double** %44
br label %45
45: ; preds = %28
%46 = load i32, i32* %11
%47 = add nsw i32 %46, 1
store i32 %47, i32* %11
br label %24
48: ; preds = %24
%49 = load i32, i32* %8
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %82
51: ; preds = %48
store i32 0, i32* %12
%52 = load i32, i32* %8
%53 = add nsw i32 %52, 1
store i32 %53, i32* %11
br label %54
54: ; preds = %78, %51
%55 = load i32, i32* %11
%56 = load i32, i32* %7
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %81
58: ; preds = %54
%59 = load double**, double*** %13
%60 = load i32, i32* %11
%61 = sub nsw i32 %60, 1
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double*, double** %59, i64 %62
%64 = load double*, double** %63
%65 = load i32, i32* %7
%66 = mul nsw i32 2, %65
%67 = load i32, i32* %7
%68 = load i32, i32* %11
%69 = sub nsw i32 %68, 1
%70 = sub nsw i32 %67, %69
%71 = mul nsw i32 %66, %70
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %64, i64 %72
%74 = load double**, double*** %13
%75 = load i32, i32* %11
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds double*, double** %74, i64 %76
store double* %73, double** %77
br label %78
78: ; preds = %58
%79 = load i32, i32* %11
%80 = add nsw i32 %79, 1
store i32 %80, i32* %11
br label %54
81: ; preds = %54
br label %130
82: ; preds = %48
%83 = load i32, i32* %8
%84 = sub nsw i32 %83, 1
%85 = load i32, i32* %7
%86 = call i32 @TableSize(i32 %84, i32 %85)
store i32 %86, i32* %12
%87 = load double**, double*** %13
%88 = load i32, i32* %8
%89 = sub nsw i32 %88, 1
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds double*, double** %87, i64 %90
%92 = load double*, double** %91
%93 = load i32, i32* %12
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds double, double* %92, i64 %94
%96 = load double**, double*** %13
%97 = load i32, i32* %8
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds double*, double** %96, i64 %98
store double* %95, double** %99
%100 = load i32, i32* %8
%101 = add nsw i32 %100, 1
store i32 %101, i32* %11
br label %102
102: ; preds = %126, %82
%103 = load i32, i32* %11
%104 = load i32, i32* %7
%105 = icmp slt i32 %103, %104
br i1 %105, label %106, label %129
106: ; preds = %102
%107 = load double**, double*** %13
%108 = load i32, i32* %11
%109 = sub nsw i32 %108, 1
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds double*, double** %107, i64 %110
%112 = load double*, double** %111
%113 = load i32, i32* %7
%114 = mul nsw i32 2, %113
%115 = load i32, i32* %7
%116 = load i32, i32* %11
%117 = sub nsw i32 %116, 1
%118 = sub nsw i32 %115, %117
%119 = mul nsw i32 %114, %118
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds double, double* %112, i64 %120
%122 = load double**, double*** %13
%123 = load i32, i32* %11
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds double*, double** %122, i64 %124
store double* %121, double** %125
br label %126
126: ; preds = %106
%127 = load i32, i32* %11
%128 = add nsw i32 %127, 1
store i32 %128, i32* %11
br label %102
129: ; preds = %102
br label %130
130: ; preds = %129, %81
store i32 0, i32* %11
br label %131
131: ; preds = %170, %130
%132 = load i32, i32* %11
%133 = load i32, i32* %8
%134 = icmp slt i32 %132, %133
br i1 %134, label %135, label %173
135: ; preds = %131
%136 = load i32, i32* %7
%137 = load i32, i32* %11
%138 = load double**, double*** %6
%139 = load i32, i32* %11
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds double*, double** %138, i64 %140
%142 = load double*, double** %141
%143 = load double**, double*** %13
%144 = load i32, i32* %11
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds double*, double** %143, i64 %145
%147 = load double*, double** %146
%148 = call i32 @Transpose_CosPmlTableGen(i32 %136, i32 %137, double* %142, double* %147)
%149 = load i32, i32* %11
%150 = load i32, i32* %7
%151 = sub nsw i32 %150, 1
%152 = icmp ne i32 %149, %151
br i1 %152, label %153, label %169
153: ; preds = %135
%154 = load double**, double*** %13
%155 = load i32, i32* %11
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds double*, double** %154, i64 %156
%158 = load double*, double** %157
%159 = load i32, i32* %11
%160 = load i32, i32* %7
%161 = call i32 @TableSize(i32 %159, i32 %160)
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds double, double* %158, i64 %162
%164 = load double**, double*** %13
%165 = load i32, i32* %11
%166 = add nsw i32 %165, 1
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds double*, double** %164, i64 %167
store double* %163, double** %168
br label %169
169: ; preds = %153, %135
br label %170
170: ; preds = %169
%171 = load i32, i32* %11
%172 = add nsw i32 %171, 1
store i32 %172, i32* %11
br label %131
173: ; preds = %131
%174 = load i32, i32* %8
store i32 %174, i32* %11
br label %175
175: ; preds = %189, %173
%176 = load i32, i32* %11
%177 = load i32, i32* %7
%178 = icmp slt i32 %176, %177
br i1 %178, label %179, label %192
179: ; preds = %175
%180 = load i32, i32* %7
%181 = load i32, i32* %11
%182 = load double**, double*** %13
%183 = load i32, i32* %11
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds double*, double** %182, i64 %184
%186 = load double*, double** %185
%187 = load double*, double** %10
%188 = call i32 @PmlTableGen(i32 %180, i32 %181, double* %186, double* %187)
br label %189
189: ; preds = %179
%190 = load i32, i32* %11
%191 = add nsw i32 %190, 1
store i32 %191, i32* %11
br label %175
192: ; preds = %175
%193 = load double**, double*** %13
ret double** %193
}

LLVM IR (-O2):
define double** @Transpose_SemiNaive_Naive_Pml_Table(double** nocapture %0, i32 %1, i32 %2, double* %3, double* %4) {
%6 = shl i32 %1, 3
%7 = add i32 %6, 8
%8 = tail call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to double**
store double* %3, double** %9
%10 = icmp sgt i32 %2, 1
br i1 %10, label %11, label %24
11: ; preds = %5
%12 = zext i32 %2 to i64
br label %13
13: ; preds = %11, %13
%14 = phi double* [ %3, %11 ], [ %20, %13 ]
%15 = phi i64 [ 1, %11 ], [ %22, %13 ]
%16 = trunc i64 %15 to i32
%17 = add i32 %16, -1
%18 = tail call i32 @TableSize(i32 %17, i32 %1)
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %14, i64 %19
%21 = getelementptr inbounds double*, double** %9, i64 %15
store double* %20, double** %21
%22 = add nuw nsw i64 %15, 1
%23 = icmp eq i64 %22, %12
br i1 %23, label %24, label %13
24: ; preds = %13, %5
%25 = icmp eq i32 %2, 0
br i1 %25, label %26, label %67
26: ; preds = %24
%27 = icmp sgt i32 %1, 1
br i1 %27, label %28, label %225
28: ; preds = %26
%29 = shl nuw nsw i32 %1, 1
%30 = zext i32 %1 to i64
%31 = sext i32 %29 to i64
%32 = zext i32 %1 to i64
%33 = load double*, double** %9
%34 = add nsw i64 %32, -1
%35 = add nsw i64 %32, -2
%36 = and i64 %34, 3
%37 = icmp ult i64 %35, 3
br i1 %37, label %203, label %38
38: ; preds = %28
%39 = and i64 %34, -4
br label %40
40: ; preds = %40, %38
%41 = phi double* [ %33, %38 ], [ %62, %40 ]
%42 = phi i64 [ 1, %38 ], [ %64, %40 ]
%43 = phi i64 [ 0, %38 ], [ %65, %40 ]
%44 = add nsw i64 %42, -1
%45 = sub nsw i64 %30, %44
%46 = mul nsw i64 %45, %31
%47 = getelementptr inbounds double, double* %41, i64 %46
%48 = getelementptr inbounds double*, double** %9, i64 %42
store double* %47, double** %48
%49 = add nuw nsw i64 %42, 1
%50 = sub nsw i64 %30, %42
%51 = mul nsw i64 %50, %31
%52 = getelementptr inbounds double, double* %47, i64 %51
%53 = getelementptr inbounds double*, double** %9, i64 %49
store double* %52, double** %53
%54 = add nuw nsw i64 %42, 2
%55 = sub nsw i64 %30, %49
%56 = mul nsw i64 %55, %31
%57 = getelementptr inbounds double, double* %52, i64 %56
%58 = getelementptr inbounds double*, double** %9, i64 %54
store double* %57, double** %58
%59 = add nuw nsw i64 %42, 3
%60 = sub nsw i64 %30, %54
%61 = mul nsw i64 %60, %31
%62 = getelementptr inbounds double, double* %57, i64 %61
%63 = getelementptr inbounds double*, double** %9, i64 %59
store double* %62, double** %63
%64 = add nuw nsw i64 %42, 4
%65 = add nuw i64 %43, 4
%66 = icmp eq i64 %65, %39
br i1 %66, label %203, label %40
67: ; preds = %24
%68 = add nsw i32 %2, -1
%69 = tail call i32 @TableSize(i32 %68, i32 %1)
%70 = sext i32 %68 to i64
%71 = getelementptr inbounds double*, double** %9, i64 %70
%72 = load double*, double** %71
%73 = sext i32 %69 to i64
%74 = getelementptr inbounds double, double* %72, i64 %73
%75 = sext i32 %2 to i64
%76 = getelementptr inbounds double*, double** %9, i64 %75
store double* %74, double** %76
%77 = add i32 %2, 1
%78 = icmp slt i32 %77, %1
br i1 %78, label %79, label %219
79: ; preds = %67
%80 = shl nsw i32 %1, 1
%81 = sext i32 %77 to i64
%82 = add i32 %1, -2
%83 = sub i32 %82, %2
%84 = zext i32 %83 to i64
%85 = add nuw nsw i64 %84, 1
%86 = icmp ult i32 %83, 3
%87 = add i32 %1, -2
%88 = icmp slt i32 %87, %2
%89 = or i1 %86, %88
br i1 %89, label %153, label %90
90: ; preds = %79
%91 = getelementptr double*, double** %9, i64 %81
%92 = add i32 %1, -2
%93 = sub i32 %92, %2
%94 = zext i32 %93 to i64
%95 = add nsw i64 %81, %94
%96 = add nsw i64 %95, 1
%97 = getelementptr double*, double** %9, i64 %96
%98 = sext i32 %2 to i64
%99 = getelementptr double*, double** %9, i64 %98
%100 = add nsw i64 %98, %94
%101 = add nsw i64 %100, 1
%102 = getelementptr double*, double** %9, i64 %101
%103 = icmp ult double** %91, %102
%104 = icmp ult double** %99, %97
%105 = and i1 %103, %104
br i1 %105, label %153, label %106
106: ; preds = %90
%107 = and i64 %85, 8589934588
%108 = add nsw i64 %107, %81
%109 = trunc i64 %107 to i32
%110 = add i32 %109, %2
%111 = insertelement <2 x i32> poison, i32 %2, i64 0
%112 = shufflevector <2 x i32> %111, <2 x i32> poison, <2 x i32> zeroinitializer
%113 = add <2 x i32> %112, <i32 0, i32 1>
%114 = insertelement <2 x i32> poison, i32 %1, i64 0
%115 = shufflevector <2 x i32> %114, <2 x i32> poison, <2 x i32> zeroinitializer
%116 = insertelement <2 x i32> poison, i32 %1, i64 0
%117 = shufflevector <2 x i32> %116, <2 x i32> poison, <2 x i32> zeroinitializer
%118 = insertelement <2 x i32> poison, i32 %80, i64 0
%119 = shufflevector <2 x i32> %118, <2 x i32> poison, <2 x i32> zeroinitializer
%120 = insertelement <2 x i32> poison, i32 %80, i64 0
%121 = shufflevector <2 x i32> %120, <2 x i32> poison, <2 x i32> zeroinitializer
br label %122
122: ; preds = %122, %106
%123 = phi i64 [ 0, %106 ], [ %148, %122 ]
%124 = phi <2 x i32> [ %113, %106 ], [ %149, %122 ]
%125 = add i64 %123, %81
%126 = add <2 x i32> %124, <i32 2, i32 2>
%127 = trunc i64 %123 to i32
%128 = add i32 %127, %2
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds double*, double** %9, i64 %129
%131 = bitcast double** %130 to <2 x double*>*
%132 = load <2 x double*>, <2 x double*>* %131
%133 = getelementptr inbounds double*, double** %130, i64 2
%134 = bitcast double** %133 to <2 x double*>*
%135 = load <2 x double*>, <2 x double*>* %134
%136 = sub nsw <2 x i32> %115, %124
%137 = sub nsw <2 x i32> %117, %126
%138 = mul nsw <2 x i32> %119, %136
%139 = mul nsw <2 x i32> %121, %137
%140 = sext <2 x i32> %138 to <2 x i64>
%141 = sext <2 x i32> %139 to <2 x i64>
%142 = getelementptr inbounds double, <2 x double*> %132, <2 x i64> %140
%143 = getelementptr inbounds double, <2 x double*> %135, <2 x i64> %141
%144 = getelementptr inbounds double*, double** %9, i64 %125
%145 = bitcast double** %144 to <2 x double*>*
store <2 x double*> %142, <2 x double*>* %145
%146 = getelementptr inbounds double*, double** %144, i64 2
%147 = bitcast double** %146 to <2 x double*>*
store <2 x double*> %143, <2 x double*>* %147
%148 = add nuw i64 %123, 4
%149 = add <2 x i32> %124, <i32 4, i32 4>
%150 = icmp eq i64 %148, %107
br i1 %150, label %151, label %122
151: ; preds = %122
%152 = icmp eq i64 %85, %107
br i1 %152, label %219, label %153
153: ; preds = %90, %79, %151
%154 = phi i64 [ %81, %90 ], [ %81, %79 ], [ %108, %151 ]
%155 = phi i32 [ %2, %90 ], [ %2, %79 ], [ %110, %151 ]
%156 = trunc i64 %154 to i32
%157 = sub i32 %1, %156
%158 = xor i32 %156, -1
%159 = and i32 %157, 1
%160 = icmp eq i32 %159, 0
br i1 %160, label %172, label %161
161: ; preds = %153
%162 = sext i32 %155 to i64
%163 = getelementptr inbounds double*, double** %9, i64 %162
%164 = load double*, double** %163
%165 = sub nsw i32 %1, %155
%166 = mul nsw i32 %80, %165
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds double, double* %164, i64 %167
%169 = getelementptr inbounds double*, double** %9, i64 %154
store double* %168, double** %169
%170 = add nsw i64 %154, 1
%171 = trunc i64 %154 to i32
br label %172
172: ; preds = %161, %153
%173 = phi i64 [ %154, %153 ], [ %170, %161 ]
%174 = phi i32 [ %155, %153 ], [ %171, %161 ]
%175 = sub i32 0, %1
%176 = icmp eq i32 %158, %175
br i1 %176, label %219, label %177
177: ; preds = %172, %177
%178 = phi i64 [ %199, %177 ], [ %173, %172 ]
%179 = phi i32 [ %200, %177 ], [ %174, %172 ]
%180 = sext i32 %179 to i64
%181 = getelementptr inbounds double*, double** %9, i64 %180
%182 = load double*, double** %181
%183 = sub nsw i32 %1, %179
%184 = mul nsw i32 %80, %183
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds double, double* %182, i64 %185
%187 = getelementptr inbounds double*, double** %9, i64 %178
store double* %186, double** %187
%188 = add nsw i64 %178, 1
%189 = trunc i64 %178 to i32
%190 = shl i64 %178, 32
%191 = ashr exact i64 %190, 32
%192 = getelementptr inbounds double*, double** %9, i64 %191
%193 = load double*, double** %192
%194 = sub nsw i32 %1, %189
%195 = mul nsw i32 %80, %194
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds double, double* %193, i64 %196
%198 = getelementptr inbounds double*, double** %9, i64 %188
store double* %197, double** %198
%199 = add nsw i64 %178, 2
%200 = trunc i64 %188 to i32
%201 = trunc i64 %199 to i32
%202 = icmp eq i32 %201, %1
br i1 %202, label %219, label %177
203: ; preds = %40, %28
%204 = phi double* [ %33, %28 ], [ %62, %40 ]
%205 = phi i64 [ 1, %28 ], [ %64, %40 ]
%206 = icmp eq i64 %36, 0
br i1 %206, label %219, label %207
207: ; preds = %203, %207
%208 = phi double* [ %214, %207 ], [ %204, %203 ]
%209 = phi i64 [ %216, %207 ], [ %205, %203 ]
%210 = phi i64 [ %217, %207 ], [ 0, %203 ]
%211 = add nsw i64 %209, -1
%212 = sub nsw i64 %30, %211
%213 = mul nsw i64 %212, %31
%214 = getelementptr inbounds double, double* %208, i64 %213
%215 = getelementptr inbounds double*, double** %9, i64 %209
store double* %214, double** %215
%216 = add nuw nsw i64 %209, 1
%217 = add i64 %210, 1
%218 = icmp eq i64 %217, %36
br i1 %218, label %219, label %207
219: ; preds = %172, %177, %203, %207, %151, %67
%220 = icmp sgt i32 %2, 0
br i1 %220, label %221, label %225
221: ; preds = %219
%222 = add nsw i32 %1, -1
%223 = zext i32 %222 to i64
%224 = zext i32 %2 to i64
br label %229
225: ; preds = %247, %26, %219
%226 = icmp slt i32 %2, %1
br i1 %226, label %227, label %259
227: ; preds = %225
%228 = sext i32 %2 to i64
br label %250
229: ; preds = %221, %247
%230 = phi i64 [ 0, %221 ], [ %248, %247 ]
%231 = getelementptr inbounds double*, double** %0, i64 %230
%232 = load double*, double** %231
%233 = getelementptr inbounds double*, double** %9, i64 %230
%234 = load double*, double** %233
%235 = trunc i64 %230 to i32
%236 = tail call i32 @Transpose_CosPmlTableGen(i32 %1, i32 %235, double* %232, double* %234)
%237 = icmp eq i64 %230, %223
br i1 %237, label %238, label %240
238: ; preds = %229
%239 = add nuw nsw i64 %230, 1
br label %247
240: ; preds = %229
%241 = load double*, double** %233
%242 = tail call i32 @TableSize(i32 %235, i32 %1)
%243 = sext i32 %242 to i64
%244 = getelementptr inbounds double, double* %241, i64 %243
%245 = add nuw nsw i64 %230, 1
%246 = getelementptr inbounds double*, double** %9, i64 %245
store double* %244, double** %246
br label %247
247: ; preds = %238, %240
%248 = phi i64 [ %239, %238 ], [ %245, %240 ]
%249 = icmp eq i64 %248, %224
br i1 %249, label %225, label %229
250: ; preds = %227, %250
%251 = phi i64 [ %228, %227 ], [ %256, %250 ]
%252 = getelementptr inbounds double*, double** %9, i64 %251
%253 = load double*, double** %252
%254 = trunc i64 %251 to i32
%255 = tail call i32 @PmlTableGen(i32 %1, i32 %254, double* %253, double* %4)
%256 = add nsw i64 %251, 1
%257 = trunc i64 %256 to i32
%258 = icmp eq i32 %257, %1
br i1 %258, label %259, label %250
259: ; preds = %250, %225
ret double** %9
}