int main(void) {
  int **x, **y;
  int nlx, ncx, nly, ncy;
  int i, j;
  ncy = nlx = 3;
  nly = ncx = 4;
  x = (int **)malloc(nlx * sizeof(int *));
  x[0] = (int *)malloc(nlx * ncx * sizeof(int));
  for (i = 1; i < nlx; i++) {
    x[i] = x[i - 1] + ncx;
  }
  for (i = 0; i < nlx; i++) {
    for (j = 0; j < ncx; j++) {
      x[i][j] = rand() % 11;
    }
  }
  for (i = 0; i < nlx; i++) {
    for (j = 0; j < ncx; j++) {
      printf("%2d ", x[i][j]);
    }
    printf("\n");
  }
  y = (int **)malloc(nly * sizeof(int *));
  y[0] = (int *)malloc(nly * ncy * sizeof(int));
  for (i = 1; i < nly; i++) {
    y[i] = y[i - 1] + ncy;
  }
  for (i = 0; i < nly; i++) {
    for (j = 0; j < ncy; j++) {
      y[i][j] = x[j][i];
    }
  }
  for (i = 0; i < nly; i++) {
    for (j = 0; j < ncy; j++) {
      printf("%2d ", y[i][j]);
    }
    printf("\n");
  }
  free(*x);
  free(y[0]);
  free(x);
  free(y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x1c(%rbp)
movl   $0x3,-0x28(%rbp)
movl   $0x4,-0x20(%rbp)
movl   $0x4,-0x24(%rbp)
movslq -0x1c(%rbp),%rdi
shl    $0x3,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x20(%rbp),%eax
movslq %eax,%rdi
shl    $0x2,%rdi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11e2 <main+0xa2>
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
movslq -0x20(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11a0 <main+0x60>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    124b <main+0x10b>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1238 <main+0xf8>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0xb,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11fc <main+0xbc>
jmp    123d <main+0xfd>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11e9 <main+0xa9>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12bc <main+0x17c>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    12a0 <main+0x160>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1265 <main+0x125>
lea    0xd5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1252 <main+0x112>
movslq -0x24(%rbp),%rdi
shl    $0x3,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x24(%rbp),%eax
imul   -0x28(%rbp),%eax
movslq %eax,%rdi
shl    $0x2,%rdi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1333 <main+0x1f3>
mov    -0x18(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
movslq -0x28(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12f1 <main+0x1b1>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    13a0 <main+0x260>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    138d <main+0x24d>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    134d <main+0x20d>
jmp    1392 <main+0x252>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    133a <main+0x1fa>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1411 <main+0x2d1>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    13f5 <main+0x2b5>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xc20(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    13ba <main+0x27a>
lea    0xc09(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    13a7 <main+0x267>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x18,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
mov    $0x30,%edi
call   1060 <malloc@plt>
mov    %rax,(%rsp)
mov    %rax,(%r15)
movq   %rax,%xmm0
pshufd $0x44,%xmm0,%xmm0
paddq  0xe75(%rip),%xmm0
movdqu %xmm0,0x8(%r15)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    %ecx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
sub    %ecx,%eax
mov    (%r15),%rbx
mov    %eax,(%rbx)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    %ecx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
sub    %ecx,%eax
mov    %eax,0x4(%rbx)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    %ecx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
sub    %ecx,%eax
mov    (%r15),%rbx
mov    %eax,0x8(%rbx)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    %ecx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
sub    %ecx,%eax
mov    %eax,0xc(%rbx)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    %ecx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
sub    %ecx,%eax
mov    0x8(%r15),%rbx
mov    %eax,(%rbx)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    %ecx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
sub    %ecx,%eax
mov    %eax,0x4(%rbx)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    %ecx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
sub    %ecx,%eax
mov    0x8(%r15),%r13
mov    %eax,0x8(%r13)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    %ecx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
sub    %ecx,%eax
mov    %eax,0xc(%r13)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    %ecx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
sub    %ecx,%eax
mov    0x10(%r15),%rbx
mov    %eax,(%rbx)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    %ecx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
sub    %ecx,%eax
mov    %eax,0x4(%rbx)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    %ecx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
sub    %ecx,%eax
mov    0x10(%r15),%rbp
mov    %eax,0x8(%rbp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    %ecx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
sub    %ecx,%eax
mov    %eax,0xc(%rbp)
mov    (%r15),%r14
mov    (%r14),%esi
lea    0xc65(%rip),%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%r14),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%r14),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%r14),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0x0(%r13),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%r13),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%r13),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%r13),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0x0(%rbp),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rbp),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rbp),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rbp),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    $0x30,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    (%r14),%esi
mov    %esi,(%rax)
mov    0x0(%r13),%eax
mov    %eax,0x4(%rbx)
mov    0x0(%rbp),%eax
mov    %eax,0x8(%rbx)
mov    0x4(%r14),%eax
mov    %eax,0xc(%rbx)
mov    0x4(%r13),%eax
mov    %eax,0x10(%rbx)
mov    0x4(%rbp),%eax
mov    %eax,0x14(%rbx)
mov    0x8(%r14),%eax
mov    %eax,0x18(%rbx)
mov    0x8(%r13),%eax
mov    %eax,0x1c(%rbx)
mov    0x8(%rbp),%eax
mov    %eax,0x20(%rbx)
mov    0xc(%r14),%eax
mov    %eax,0x24(%rbx)
mov    0xc(%r13),%eax
mov    %eax,0x28(%rbx)
mov    0xc(%rbp),%eax
mov    %eax,0x2c(%rbx)
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0xc(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0x18(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x1c(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0x24(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2c(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%2d \00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(24) i8* @malloc(i64 24)
%2 = bitcast i8* %1 to i32**
%3 = tail call dereferenceable_or_null(48) i8* @malloc(i64 48)
%4 = bitcast i8* %1 to i8**
store i8* %3, i8** %4
%5 = bitcast i8* %3 to i32*
%6 = getelementptr inbounds i32*, i32** %2, i64 1
%7 = insertelement <2 x i32*> poison, i32* %5, i64 0
%8 = shufflevector <2 x i32*> %7, <2 x i32*> poison, <2 x i32> zeroinitializer
%9 = getelementptr i32, <2 x i32*> %8, <2 x i64> <i64 4, i64 8>
%10 = getelementptr inbounds i32*, i32** %2, i64 2
%11 = bitcast i32** %6 to <2 x i32*>*
store <2 x i32*> %9, <2 x i32*>* %11
%12 = tail call i32 (...) @rand()
%13 = srem i32 %12, 11
%14 = load i32*, i32** %2
store i32 %13, i32* %14
%15 = tail call i32 (...) @rand()
%16 = srem i32 %15, 11
%17 = getelementptr inbounds i32, i32* %14, i64 1
store i32 %16, i32* %17
%18 = tail call i32 (...) @rand()
%19 = srem i32 %18, 11
%20 = load i32*, i32** %2
%21 = getelementptr inbounds i32, i32* %20, i64 2
store i32 %19, i32* %21
%22 = tail call i32 (...) @rand()
%23 = srem i32 %22, 11
%24 = getelementptr inbounds i32, i32* %20, i64 3
store i32 %23, i32* %24
%25 = tail call i32 (...) @rand()
%26 = srem i32 %25, 11
%27 = load i32*, i32** %6
store i32 %26, i32* %27
%28 = tail call i32 (...) @rand()
%29 = srem i32 %28, 11
%30 = getelementptr inbounds i32, i32* %27, i64 1
store i32 %29, i32* %30
%31 = tail call i32 (...) @rand()
%32 = srem i32 %31, 11
%33 = load i32*, i32** %6
%34 = getelementptr inbounds i32, i32* %33, i64 2
store i32 %32, i32* %34
%35 = tail call i32 (...) @rand()
%36 = srem i32 %35, 11
%37 = getelementptr inbounds i32, i32* %33, i64 3
store i32 %36, i32* %37
%38 = tail call i32 (...) @rand()
%39 = srem i32 %38, 11
%40 = load i32*, i32** %10
store i32 %39, i32* %40
%41 = tail call i32 (...) @rand()
%42 = srem i32 %41, 11
%43 = getelementptr inbounds i32, i32* %40, i64 1
store i32 %42, i32* %43
%44 = tail call i32 (...) @rand()
%45 = srem i32 %44, 11
%46 = load i32*, i32** %10
%47 = getelementptr inbounds i32, i32* %46, i64 2
store i32 %45, i32* %47
%48 = tail call i32 (...) @rand()
%49 = srem i32 %48, 11
%50 = getelementptr inbounds i32, i32* %46, i64 3
store i32 %49, i32* %50
%51 = load i32*, i32** %2
%52 = load i32, i32* %51
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %52)
%54 = getelementptr inbounds i32, i32* %51, i64 1
%55 = load i32, i32* %54
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %55)
%57 = getelementptr inbounds i32, i32* %51, i64 2
%58 = load i32, i32* %57
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %58)
%60 = getelementptr inbounds i32, i32* %51, i64 3
%61 = load i32, i32* %60
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %61)
%63 = tail call i32 @putchar(i32 10)
%64 = load i32, i32* %33
%65 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %64)
%66 = getelementptr inbounds i32, i32* %33, i64 1
%67 = load i32, i32* %66
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %67)
%69 = getelementptr inbounds i32, i32* %33, i64 2
%70 = load i32, i32* %69
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %70)
%72 = load i32, i32* %37
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %72)
%74 = tail call i32 @putchar(i32 10)
%75 = load i32, i32* %46
%76 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %75)
%77 = getelementptr inbounds i32, i32* %46, i64 1
%78 = load i32, i32* %77
%79 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %78)
%80 = getelementptr inbounds i32, i32* %46, i64 2
%81 = load i32, i32* %80
%82 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %81)
%83 = load i32, i32* %50
%84 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %83)
%85 = tail call i32 @putchar(i32 10)
%86 = tail call dereferenceable_or_null(48) i8* @malloc(i64 48)
%87 = bitcast i8* %86 to i32*
%88 = getelementptr inbounds i32, i32* %87, i64 3
%89 = getelementptr inbounds i32, i32* %87, i64 6
%90 = getelementptr inbounds i32, i32* %87, i64 9
%91 = load i32, i32* %51
store i32 %91, i32* %87
%92 = load i32, i32* %33
%93 = getelementptr inbounds i32, i32* %87, i64 1
store i32 %92, i32* %93
%94 = load i32, i32* %46
%95 = getelementptr inbounds i32, i32* %87, i64 2
store i32 %94, i32* %95
%96 = load i32, i32* %54
store i32 %96, i32* %88
%97 = load i32, i32* %66
%98 = getelementptr inbounds i32, i32* %87, i64 4
store i32 %97, i32* %98
%99 = load i32, i32* %77
%100 = getelementptr inbounds i32, i32* %87, i64 5
store i32 %99, i32* %100
%101 = load i32, i32* %57
store i32 %101, i32* %89
%102 = load i32, i32* %69
%103 = getelementptr inbounds i32, i32* %87, i64 7
store i32 %102, i32* %103
%104 = load i32, i32* %80
%105 = getelementptr inbounds i32, i32* %87, i64 8
store i32 %104, i32* %105
%106 = load i32, i32* %60
store i32 %106, i32* %90
%107 = load i32, i32* %37
%108 = getelementptr inbounds i32, i32* %87, i64 10
store i32 %107, i32* %108
%109 = load i32, i32* %50
%110 = getelementptr inbounds i32, i32* %87, i64 11
store i32 %109, i32* %110
%111 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %91)
%112 = load i32, i32* %93
%113 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %112)
%114 = load i32, i32* %95
%115 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %114)
%116 = tail call i32 @putchar(i32 10)
%117 = load i32, i32* %88
%118 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %117)
%119 = load i32, i32* %98
%120 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %119)
%121 = load i32, i32* %100
%122 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %121)
%123 = tail call i32 @putchar(i32 10)
%124 = load i32, i32* %89
%125 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %124)
%126 = load i32, i32* %103
%127 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %126)
%128 = load i32, i32* %105
%129 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %128)
%130 = tail call i32 @putchar(i32 10)
%131 = load i32, i32* %90
%132 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %131)
%133 = load i32, i32* %108
%134 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %133)
%135 = load i32, i32* %110
%136 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %135)
%137 = tail call i32 @putchar(i32 10)
tail call void @free(i8* %3)
tail call void @free(i8* %86)
tail call void @free(i8* %1)
ret i32 0
}