#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*/ EXIT_FAILURE;
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ free(int *);
int *malloc(int const);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  if (argc != 3) {
    printf("Needs 2 args: 1) nrows & 2) ncols grid layout (math-style nrows=M, "
           "ncols=N for MxN).\n");
    exit(EXIT_FAILURE);
  }
  int i, j;
  const int nrows = atoi(argv[1]);
  const int ncols = atoi(argv[2]);
  const int nclines = nrows * ncols;
  int *arr1 = malloc(nclines * sizeof(int));
  int *arr2 = malloc(nclines * sizeof(int));
  int *arr3 = malloc(nclines * sizeof(int));
  for (j = 0; j < nclines; ++j) {
    arr1[j] = j;
  }
  printf("So here's a little story: we layout a series of samples which we "
         "label with consecutive numbers:\n");
  for (i = 0; i < nclines; ++i)
    printf("%i ", arr1[i]);
  printf("\n");
  printf("They are put into a %ix%i grid in \"row-wise\", meaning each row is "
         "completed, before moving to next:\n",
         nrows, ncols);
  for (i = 0; i < nrows; ++i) {
    for (j = 0; j < ncols; ++j)
      printf("%i ", arr1[j + i * ncols]);
    printf("\n");
  }
  printf("%ix%i column-wise grid layout:\n", nrows, ncols);
  printf("However the samples are mistakenly analysed in columnwise fashion. "
         "Note the gird retains %ix%i dimensions:\n",
         nrows, ncols);
  for (i = 0; i < nrows; ++i) {
    for (j = 0; j < ncols; ++j)
      printf("%i ", arr1[j * nrows + i]);
    printf("\n");
  }
  for (i = 0; i < nrows; ++i)
    for (j = 0; j < ncols; ++j)
      arr2[i * ncols + j] = arr1[j * nrows + i];
  printf("After conversion, print straight out:\n");
  for (i = 0; i < nrows; ++i)
    for (j = 0; j < ncols; ++j)
      printf("%i ", arr2[j + i * ncols]);
  printf("\n");
  printf("So what's happened? This mapping has occured:\n");
  for (i = 0; i < nrows; ++i)
    for (j = 0; j < ncols; ++j)
      printf("%i->%i ", arr1[j + i * ncols], arr2[j + i * ncols]);
  printf("\n");
  printf("SO we need to reverse this\n");
  for (i = 0; i < nrows; ++i)
    for (j = 0; j < ncols; ++j)
      printf("%i->%i ", arr2[j + i * ncols], arr1[j + i * ncols]);
  printf("\n");
  for (i = 0; i < nrows; ++i)
    for (j = 0; j < ncols; ++j)
      arr3[arr2[i * ncols + j]] = arr1[i * ncols + j];
  printf("New arr3:\n");
  for (i = 0; i < nrows; ++i)
    for (j = 0; j < ncols; ++j)
      printf("%i ", arr3[j + i * ncols]);
  printf("\n");
  free(arr1);
  free(arr2);
  free(arr3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     118c <main+0x3c>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x38(%rbp)
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    121e <main+0xce>
mov    -0x18(%rbp),%edx
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11f6 <main+0xa6>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1266 <main+0x116>
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xfb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1233 <main+0xe3>
lea    0xde7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12fc <main+0x1ac>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    12e0 <main+0x190>
mov    -0x30(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%edx
imul   -0x20(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xf38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12a2 <main+0x152>
lea    0xd6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    128f <main+0x13f>
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1396 <main+0x246>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    137a <main+0x22a>
mov    -0x30(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    133e <main+0x1ee>
lea    0xcd3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    132b <main+0x1db>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1405 <main+0x2b5>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    13f2 <main+0x2a2>
mov    -0x30(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x38(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x20(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    13b0 <main+0x260>
jmp    13f7 <main+0x2a7>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    139d <main+0x24d>
lea    0xd9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    147e <main+0x32e>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    146b <main+0x31b>
mov    -0x38(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%edx
imul   -0x20(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdad(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    142d <main+0x2dd>
jmp    1470 <main+0x320>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    141a <main+0x2ca>
lea    0xbcf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd3d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    151b <main+0x3cb>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1508 <main+0x3b8>
mov    -0x30(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%edx
imul   -0x20(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x38(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%edx
imul   -0x20(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
lea    0xd0c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    14b4 <main+0x364>
jmp    150d <main+0x3bd>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    14a1 <main+0x351>
lea    0xb32(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xcd7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    15b8 <main+0x468>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    15a5 <main+0x455>
mov    -0x38(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%edx
imul   -0x20(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x30(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%edx
imul   -0x20(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
lea    0xc6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1551 <main+0x401>
jmp    15aa <main+0x45a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    153e <main+0x3ee>
lea    0xa95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    163d <main+0x4ed>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    162a <main+0x4da>
mov    -0x30(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x20(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    -0x14(%rbp),%esi
imul   -0x20(%rbp),%esi
add    -0x18(%rbp),%esi
movslq %esi,%rsi
movslq (%rcx,%rsi,4),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    15e0 <main+0x490>
jmp    162f <main+0x4df>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    15cd <main+0x47d>
lea    0xbdf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    16b6 <main+0x566>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    16a3 <main+0x553>
mov    -0x40(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%edx
imul   -0x20(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xb75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1665 <main+0x515>
jmp    16a8 <main+0x558>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1652 <main+0x502>
lea    0x997(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
cmp    $0x3,%edi
jne    1978 <main+0x808>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1080 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1080 <atoi@plt>
mov    %eax,%r15d
mov    %eax,%r12d
mov    %ebp,0xc(%rsp)
imul   %ebp,%r12d
lea    0x0(,%r12,4),%ebx
mov    %ebx,%edi
call   1070 <malloc@plt>
mov    %rax,%r13
mov    %ebx,%edi
call   1070 <malloc@plt>
mov    %rax,0x28(%rsp)
mov    %ebx,%edi
call   1070 <malloc@plt>
mov    %rax,0x30(%rsp)
test   %r12d,%r12d
jle    11eb <main+0x7b>
mov    %r12d,%r14d
cmp    $0x8,%r12d
jae    11fc <main+0x8c>
xor    %eax,%eax
jmp    1360 <main+0x1f0>
lea    0xf97(%rip),%rdi
call   1050 <puts@plt>
jmp    13a8 <main+0x238>
mov    %r14d,%eax
and    $0xfffffff8,%eax
lea    -0x8(%rax),%rsi
mov    %rsi,%rdx
shr    $0x3,%rdx
add    $0x1,%rdx
mov    %edx,%ecx
and    $0x3,%ecx
cmp    $0x18,%rsi
jae    122b <main+0xbb>
movdqa 0xddc(%rip),%xmm0
xor    %esi,%esi
jmp    1305 <main+0x195>
and    $0xfffffffffffffffc,%rdx
movdqa 0xdc9(%rip),%xmm0
xor    %esi,%esi
movdqa 0xdce(%rip),%xmm8
movdqa 0xdd5(%rip),%xmm9
movdqa 0xddc(%rip),%xmm10
movdqa 0xde4(%rip),%xmm4
movdqa 0xdec(%rip),%xmm5
movdqa 0xdf4(%rip),%xmm6
movdqa 0xdfc(%rip),%xmm7
movdqa 0xe04(%rip),%xmm1
nopl   0x0(%rax)
movdqa %xmm0,%xmm2
paddd  %xmm8,%xmm2
movdqu %xmm0,0x0(%r13,%rsi,4)
movdqu %xmm2,0x10(%r13,%rsi,4)
movdqa %xmm0,%xmm2
paddd  %xmm9,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm10,%xmm3
movdqu %xmm2,0x20(%r13,%rsi,4)
movdqu %xmm3,0x30(%r13,%rsi,4)
movdqa %xmm0,%xmm2
paddd  %xmm4,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm5,%xmm3
movdqu %xmm2,0x40(%r13,%rsi,4)
movdqu %xmm3,0x50(%r13,%rsi,4)
movdqa %xmm0,%xmm2
paddd  %xmm6,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm7,%xmm3
movdqu %xmm2,0x60(%r13,%rsi,4)
movdqu %xmm3,0x70(%r13,%rsi,4)
add    $0x20,%rsi
paddd  %xmm1,%xmm0
add    $0xfffffffffffffffc,%rdx
jne    1280 <main+0x110>
test   %rcx,%rcx
je     1350 <main+0x1e0>
lea    0x10(,%rsi,4),%rdx
add    %r13,%rdx
shl    $0x5,%rcx
xor    %esi,%esi
movdqa 0xced(%rip),%xmm1
movdqa 0xcf5(%rip),%xmm2
nopl   0x0(%rax,%rax,1)
movdqa %xmm0,%xmm3
paddd  %xmm1,%xmm3
movdqu %xmm0,-0x10(%rdx,%rsi,1)
movdqu %xmm3,(%rdx,%rsi,1)
paddd  %xmm2,%xmm0
add    $0x20,%rsi
cmp    %rsi,%rcx
jne    1330 <main+0x1c0>
cmp    %r14,%rax
je     136e <main+0x1fe>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %eax,0x0(%r13,%rax,4)
add    $0x1,%rax
cmp    %rax,%r14
jne    1360 <main+0x1f0>
lea    0xe14(%rip),%rdi
call   1050 <puts@plt>
test   %r12d,%r12d
jle    13a8 <main+0x238>
lea    0xdff(%rip),%rbp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13,%rbx,4),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1390 <main+0x220>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xcd7(%rip),%rdi
mov    0xc(%rsp),%ebx
mov    %ebx,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1060 <printf@plt>
movslq %r15d,%rax
mov    %ebx,%ecx
mov    %rcx,0x10(%rsp)
mov    %r15d,%r12d
test   %ebx,%ebx
mov    %r13,0x38(%rsp)
mov    %r15d,0x8(%rsp)
mov    %rax,0x20(%rsp)
jle    15bd <main+0x44d>
lea    0x0(,%rax,4),%rax
mov    %rax,0x18(%rsp)
lea    0xd84(%rip),%r15
mov    %r13,%rbx
xor    %r14d,%r14d
jmp    142a <main+0x2ba>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1040 <putchar@plt>
add    $0x1,%r14
add    0x18(%rsp),%rbx
cmp    0x10(%rsp),%r14
je     1458 <main+0x2e8>
cmpl   $0x0,0x8(%rsp)
jle    1410 <main+0x2a0>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rbx,%rbp,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1440 <main+0x2d0>
jmp    1410 <main+0x2a0>
lea    0xc96(%rip),%rdi
mov    0xc(%rsp),%ebp
mov    %ebp,%esi
mov    0x8(%rsp),%ebx
mov    %ebx,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xc9c(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1060 <printf@plt>
test   %ebp,%ebp
jle    15e3 <main+0x473>
mov    0x10(%rsp),%rax
lea    0x0(,%rax,4),%r14
lea    0xce5(%rip),%rbp
xor    %ebx,%ebx
jmp    14ce <main+0x35e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1040 <putchar@plt>
add    $0x1,%rbx
mov    0x40(%rsp),%r13
add    $0x4,%r13
cmp    0x10(%rsp),%rbx
je     14f9 <main+0x389>
mov    %r12,%r15
mov    %r13,0x40(%rsp)
cmpl   $0x0,0x8(%rsp)
jle    14b0 <main+0x340>
nopl   (%rax)
mov    0x0(%r13),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    %r14,%r13
add    $0xffffffffffffffff,%r15
jne    14e0 <main+0x370>
jmp    14b0 <main+0x340>
cmpl   $0x0,0xc(%rsp)
mov    0x38(%rsp),%r13
jle    15e3 <main+0x473>
mov    %r12d,%r15d
and    $0xfffffffe,%r15d
mov    0x10(%rsp),%rax
lea    0x0(,%rax,8),%rcx
mov    0x28(%rsp),%r14
lea    0x4(%r14),%rdx
xor    %r9d,%r9d
mov    %r13,%r8
mov    0x8(%rsp),%r10d
mov    0x20(%rsp),%r11
jmp    1556 <main+0x3e6>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r9
add    $0x4,%r8
add    0x18(%rsp),%rdx
cmp    %rax,%r9
je     16a8 <main+0x538>
test   %r10d,%r10d
jle    1540 <main+0x3d0>
cmp    $0x1,%r10d
jne    1570 <main+0x400>
xor    %esi,%esi
jmp    1598 <main+0x428>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r8,%rdi
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rdi),%ebx
mov    %ebx,-0x4(%rdx,%rsi,4)
mov    (%rdi,%rax,4),%ebx
mov    %ebx,(%rdx,%rsi,4)
add    $0x2,%rsi
add    %rcx,%rdi
cmp    %rsi,%r15
jne    1580 <main+0x410>
test   $0x1,%r12b
je     1540 <main+0x3d0>
mov    %r9,%rdi
imul   %r11,%rdi
mov    %rsi,%rbp
imul   %rax,%rbp
add    %r9,%rbp
mov    0x0(%r13,%rbp,4),%ebp
add    %rsi,%rdi
mov    %ebp,(%r14,%rdi,4)
jmp    1540 <main+0x3d0>
lea    0xb31(%rip),%rdi
mov    %ebx,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xb3e(%rip),%rdi
mov    %ebx,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xc00(%rip),%rdi
call   1050 <puts@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xc10(%rip),%rdi
call   1050 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    168d <main+0x51d>
mov    0x20(%rsp),%rax
lea    0x0(,%rax,4),%rax
mov    %rax,0x18(%rsp)
lea    0xb58(%rip),%r15
mov    %r13,%rbx
mov    0x28(%rsp),%r13
xor    %r14d,%r14d
jmp    165a <main+0x4ea>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r14
mov    0x18(%rsp),%rax
add    %rax,%rbx
add    %rax,%r13
cmp    0x10(%rsp),%r14
je     171e <main+0x5ae>
cmpl   $0x0,0x8(%rsp)
jle    1640 <main+0x4d0>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rbx,%rbp,4),%esi
mov    0x0(%r13,%rbp,4),%edx
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1670 <main+0x500>
jmp    1640 <main+0x4d0>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xba0(%rip),%rdi
call   1050 <puts@plt>
jmp    179d <main+0x62d>
lea    0xb3b(%rip),%rdi
call   1050 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    1708 <main+0x598>
lea    0xac3(%rip),%r15
mov    %r14,%rbx
xor    %r14d,%r14d
jmp    16e4 <main+0x574>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r14
add    0x18(%rsp),%rbx
cmp    0x10(%rsp),%r14
je     15ef <main+0x47f>
cmpl   $0x0,0x8(%rsp)
jle    16d0 <main+0x560>
xor    %ebp,%ebp
nopl   (%rax)
mov    (%rbx,%rbp,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    16f0 <main+0x580>
jmp    16d0 <main+0x560>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xaf7(%rip),%rdi
call   1050 <puts@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xb0f(%rip),%rdi
call   1050 <puts@plt>
cmpl   $0x0,0xc(%rsp)
mov    0x38(%rsp),%r13
jle    179d <main+0x62d>
shlq   $0x2,0x20(%rsp)
lea    0xa34(%rip),%r14
mov    %r13,%r15
mov    0x28(%rsp),%rbp
xor    %r13d,%r13d
jmp    1776 <main+0x606>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r13
mov    0x20(%rsp),%rax
add    %rax,%rbp
add    %rax,%r15
cmp    0x10(%rsp),%r13
je     17ac <main+0x63c>
cmpl   $0x0,0x8(%rsp)
jle    1760 <main+0x5f0>
xor    %ebx,%ebx
nop
mov    0x0(%rbp,%rbx,4),%esi
mov    (%r15,%rbx,4),%edx
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1780 <main+0x610>
jmp    1760 <main+0x5f0>
mov    $0xa,%edi
call   1040 <putchar@plt>
jmp    18ce <main+0x75e>
mov    $0xa,%edi
call   1040 <putchar@plt>
cmpl   $0x0,0xc(%rsp)
mov    0x38(%rsp),%r13
jle    18ce <main+0x75e>
lea    -0x1(%r12),%rax
mov    %rax,0x18(%rsp)
mov    %r12d,%r15d
and    $0x3,%r15d
mov    %r12d,%r14d
and    $0xfffffffc,%r14d
mov    0x28(%rsp),%r10
mov    %r10,%rsi
add    $0xc,%rsi
mov    %r13,%rdi
add    $0xc,%rdi
xor    %r11d,%r11d
mov    %r13,%r9
mov    0x30(%rsp),%rcx
mov    0x30(%rsp),%r8
jmp    1830 <main+0x6c0>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r11
mov    0x20(%rsp),%rax
add    %rax,%rsi
add    %rax,%rdi
add    %rax,%r10
add    %rax,%r9
cmp    0x10(%rsp),%r11
je     1911 <main+0x7a1>
cmpl   $0x0,0x8(%rsp)
jle    1810 <main+0x6a0>
cmpq   $0x3,0x18(%rsp)
jae    1850 <main+0x6e0>
xor    %ebx,%ebx
jmp    1897 <main+0x727>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    -0xc(%rdi,%rbx,4),%eax
movslq -0xc(%rsi,%rbx,4),%rbp
mov    %eax,(%rcx,%rbp,4)
mov    -0x8(%rdi,%rbx,4),%eax
movslq -0x8(%rsi,%rbx,4),%rbp
mov    %eax,(%rcx,%rbp,4)
mov    -0x4(%rdi,%rbx,4),%eax
movslq -0x4(%rsi,%rbx,4),%rbp
mov    %eax,(%rcx,%rbp,4)
mov    (%rdi,%rbx,4),%eax
movslq (%rsi,%rbx,4),%rbp
mov    %eax,(%rcx,%rbp,4)
add    $0x4,%rbx
cmp    %rbx,%r14
jne    1860 <main+0x6f0>
test   %r15,%r15
je     1810 <main+0x6a0>
lea    (%r10,%rbx,4),%rax
lea    (%r9,%rbx,4),%rbx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,4),%edx
movslq (%rax,%rbp,4),%rcx
mov    %edx,(%r8,%rcx,4)
mov    0x30(%rsp),%rcx
add    $0x1,%rbp
cmp    %rbp,%r15
jne    18b0 <main+0x740>
jmp    1810 <main+0x6a0>
lea    0x984(%rip),%rdi
call   1050 <puts@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
mov    0x30(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x941(%rip),%rdi
call   1050 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    18da <main+0x76a>
lea    0x85a(%rip),%r15
mov    0x30(%rsp),%rbx
xor    %r14d,%r14d
jmp    1950 <main+0x7e0>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r14
add    0x20(%rsp),%rbx
cmp    0x10(%rsp),%r14
je     18da <main+0x76a>
cmpl   $0x0,0x8(%rsp)
jle    1940 <main+0x7d0>
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    (%rbx,%rbp,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1960 <main+0x7f0>
jmp    1940 <main+0x7d0>
lea    0x8e4(%rip),%rdi
call   1050 <puts@plt>
mov    0x2655(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [86 x i8] c"Needs 2 args: 1) nrows & 2) ncols grid layout (math-style nrows=M, ncols=N for MxN).\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [98 x i8] c"So here's a little story: we layout a series of samples which we label with consecutive numbers:\0A\00"
@.str.2 = [4 x i8] c"%i \00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [101 x i8] c"They are put into a %ix%i grid in \22row-wise\22, meaning each row is completed, before moving to next:\0A\00"
@.str.5 = [32 x i8] c"%ix%i column-wise grid layout:\0A\00"
@.str.6 = [108 x i8] c"However the samples are mistakenly analysed in columnwise fashion. Note the gird retains %ix%i dimensions:\0A\00"
@.str.7 = [39 x i8] c"After conversion, print straight out:\0A\00"
@.str.8 = [47 x i8] c"So what's happened? This mapping has occured:\0A\00"
@.str.9 = [8 x i8] c"%i->%i \00"
@.str.10 = [28 x i8] c"SO we need to reverse this\0A\00"
@.str.11 = [11 x i8] c"New arr3:\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 3
br i1 %15, label %16, label %20
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0))
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
store i32 %24, i32* %8
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i32 @atoi(i8* %27)
store i32 %28, i32* %9
%29 = load i32, i32* %8
%30 = load i32, i32* %9
%31 = mul nsw i32 %29, %30
store i32 %31, i32* %10
%32 = load i32, i32* %10
%33 = sext i32 %32 to i64
%34 = mul i64 %33, 4
%35 = trunc i64 %34 to i32
%36 = call i32* @malloc(i32 %35)
store i32* %36, i32** %11
%37 = load i32, i32* %10
%38 = sext i32 %37 to i64
%39 = mul i64 %38, 4
%40 = trunc i64 %39 to i32
%41 = call i32* @malloc(i32 %40)
store i32* %41, i32** %12
%42 = load i32, i32* %10
%43 = sext i32 %42 to i64
%44 = mul i64 %43, 4
%45 = trunc i64 %44 to i32
%46 = call i32* @malloc(i32 %45)
store i32* %46, i32** %13
store i32 0, i32* %7
br label %47
47: ; preds = %57, %20
%48 = load i32, i32* %7
%49 = load i32, i32* %10
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %60
51: ; preds = %47
%52 = load i32, i32* %7
%53 = load i32*, i32** %11
%54 = load i32, i32* %7
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i32, i32* %53, i64 %55
store i32 %52, i32* %56
br label %57
57: ; preds = %51
%58 = load i32, i32* %7
%59 = add nsw i32 %58, 1
store i32 %59, i32* %7
br label %47
60: ; preds = %47
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %6
br label %62
62: ; preds = %73, %60
%63 = load i32, i32* %6
%64 = load i32, i32* %10
%65 = icmp slt i32 %63, %64
br i1 %65, label %66, label %76
66: ; preds = %62
%67 = load i32*, i32** %11
%68 = load i32, i32* %6
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i32, i32* %67, i64 %69
%71 = load i32, i32* %70
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %71)
br label %73
73: ; preds = %66
%74 = load i32, i32* %6
%75 = add nsw i32 %74, 1
store i32 %75, i32* %6
br label %62
76: ; preds = %62
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%78 = load i32, i32* %8
%79 = load i32, i32* %9
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.4, i64 0, i64 0), i32 %78, i32 %79)
store i32 0, i32* %6
br label %81
81: ; preds = %106, %76
%82 = load i32, i32* %6
%83 = load i32, i32* %8
%84 = icmp slt i32 %82, %83
br i1 %84, label %85, label %109
85: ; preds = %81
store i32 0, i32* %7
br label %86
86: ; preds = %101, %85
%87 = load i32, i32* %7
%88 = load i32, i32* %9
%89 = icmp slt i32 %87, %88
br i1 %89, label %90, label %104
90: ; preds = %86
%91 = load i32*, i32** %11
%92 = load i32, i32* %7
%93 = load i32, i32* %6
%94 = load i32, i32* %9
%95 = mul nsw i32 %93, %94
%96 = add nsw i32 %92, %95
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i32, i32* %91, i64 %97
%99 = load i32, i32* %98
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %99)
br label %101
101: ; preds = %90
%102 = load i32, i32* %7
%103 = add nsw i32 %102, 1
store i32 %103, i32* %7
br label %86
104: ; preds = %86
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %106
106: ; preds = %104
%107 = load i32, i32* %6
%108 = add nsw i32 %107, 1
store i32 %108, i32* %6
br label %81
109: ; preds = %81
%110 = load i32, i32* %8
%111 = load i32, i32* %9
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 %110, i32 %111)
%113 = load i32, i32* %8
%114 = load i32, i32* %9
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([108 x i8], [108 x i8]* @.str.6, i64 0, i64 0), i32 %113, i32 %114)
store i32 0, i32* %6
br label %116
116: ; preds = %141, %109
%117 = load i32, i32* %6
%118 = load i32, i32* %8
%119 = icmp slt i32 %117, %118
br i1 %119, label %120, label %144
120: ; preds = %116
store i32 0, i32* %7
br label %121
121: ; preds = %136, %120
%122 = load i32, i32* %7
%123 = load i32, i32* %9
%124 = icmp slt i32 %122, %123
br i1 %124, label %125, label %139
125: ; preds = %121
%126 = load i32*, i32** %11
%127 = load i32, i32* %7
%128 = load i32, i32* %8
%129 = mul nsw i32 %127, %128
%130 = load i32, i32* %6
%131 = add nsw i32 %129, %130
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds i32, i32* %126, i64 %132
%134 = load i32, i32* %133
%135 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %134)
br label %136
136: ; preds = %125
%137 = load i32, i32* %7
%138 = add nsw i32 %137, 1
store i32 %138, i32* %7
br label %121
139: ; preds = %121
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %141
141: ; preds = %139
%142 = load i32, i32* %6
%143 = add nsw i32 %142, 1
store i32 %143, i32* %6
br label %116
144: ; preds = %116
store i32 0, i32* %6
br label %145
145: ; preds = %176, %144
%146 = load i32, i32* %6
%147 = load i32, i32* %8
%148 = icmp slt i32 %146, %147
br i1 %148, label %149, label %179
149: ; preds = %145
store i32 0, i32* %7
br label %150
150: ; preds = %172, %149
%151 = load i32, i32* %7
%152 = load i32, i32* %9
%153 = icmp slt i32 %151, %152
br i1 %153, label %154, label %175
154: ; preds = %150
%155 = load i32*, i32** %11
%156 = load i32, i32* %7
%157 = load i32, i32* %8
%158 = mul nsw i32 %156, %157
%159 = load i32, i32* %6
%160 = add nsw i32 %158, %159
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds i32, i32* %155, i64 %161
%163 = load i32, i32* %162
%164 = load i32*, i32** %12
%165 = load i32, i32* %6
%166 = load i32, i32* %9
%167 = mul nsw i32 %165, %166
%168 = load i32, i32* %7
%169 = add nsw i32 %167, %168
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds i32, i32* %164, i64 %170
store i32 %163, i32* %171
br label %172
172: ; preds = %154
%173 = load i32, i32* %7
%174 = add nsw i32 %173, 1
store i32 %174, i32* %7
br label %150
175: ; preds = %150
br label %176
176: ; preds = %175
%177 = load i32, i32* %6
%178 = add nsw i32 %177, 1
store i32 %178, i32* %6
br label %145
179: ; preds = %145
%180 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %6
br label %181
181: ; preds = %205, %179
%182 = load i32, i32* %6
%183 = load i32, i32* %8
%184 = icmp slt i32 %182, %183
br i1 %184, label %185, label %208
185: ; preds = %181
store i32 0, i32* %7
br label %186
186: ; preds = %201, %185
%187 = load i32, i32* %7
%188 = load i32, i32* %9
%189 = icmp slt i32 %187, %188
br i1 %189, label %190, label %204
190: ; preds = %186
%191 = load i32*, i32** %12
%192 = load i32, i32* %7
%193 = load i32, i32* %6
%194 = load i32, i32* %9
%195 = mul nsw i32 %193, %194
%196 = add nsw i32 %192, %195
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds i32, i32* %191, i64 %197
%199 = load i32, i32* %198
%200 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %199)
br label %201
201: ; preds = %190
%202 = load i32, i32* %7
%203 = add nsw i32 %202, 1
store i32 %203, i32* %7
br label %186
204: ; preds = %186
br label %205
205: ; preds = %204
%206 = load i32, i32* %6
%207 = add nsw i32 %206, 1
store i32 %207, i32* %6
br label %181
208: ; preds = %181
%209 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%210 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %6
br label %211
211: ; preds = %244, %208
%212 = load i32, i32* %6
%213 = load i32, i32* %8
%214 = icmp slt i32 %212, %213
br i1 %214, label %215, label %247
215: ; preds = %211
store i32 0, i32* %7
br label %216
216: ; preds = %240, %215
%217 = load i32, i32* %7
%218 = load i32, i32* %9
%219 = icmp slt i32 %217, %218
br i1 %219, label %220, label %243
220: ; preds = %216
%221 = load i32*, i32** %11
%222 = load i32, i32* %7
%223 = load i32, i32* %6
%224 = load i32, i32* %9
%225 = mul nsw i32 %223, %224
%226 = add nsw i32 %222, %225
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds i32, i32* %221, i64 %227
%229 = load i32, i32* %228
%230 = load i32*, i32** %12
%231 = load i32, i32* %7
%232 = load i32, i32* %6
%233 = load i32, i32* %9
%234 = mul nsw i32 %232, %233
%235 = add nsw i32 %231, %234
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds i32, i32* %230, i64 %236
%238 = load i32, i32* %237
%239 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i32 %229, i32 %238)
br label %240
240: ; preds = %220
%241 = load i32, i32* %7
%242 = add nsw i32 %241, 1
store i32 %242, i32* %7
br label %216
243: ; preds = %216
br label %244
244: ; preds = %243
%245 = load i32, i32* %6
%246 = add nsw i32 %245, 1
store i32 %246, i32* %6
br label %211
247: ; preds = %211
%248 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%249 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %6
br label %250
250: ; preds = %283, %247
%251 = load i32, i32* %6
%252 = load i32, i32* %8
%253 = icmp slt i32 %251, %252
br i1 %253, label %254, label %286
254: ; preds = %250
store i32 0, i32* %7
br label %255
255: ; preds = %279, %254
%256 = load i32, i32* %7
%257 = load i32, i32* %9
%258 = icmp slt i32 %256, %257
br i1 %258, label %259, label %282
259: ; preds = %255
%260 = load i32*, i32** %12
%261 = load i32, i32* %7
%262 = load i32, i32* %6
%263 = load i32, i32* %9
%264 = mul nsw i32 %262, %263
%265 = add nsw i32 %261, %264
%266 = sext i32 %265 to i64
%267 = getelementptr inbounds i32, i32* %260, i64 %266
%268 = load i32, i32* %267
%269 = load i32*, i32** %11
%270 = load i32, i32* %7
%271 = load i32, i32* %6
%272 = load i32, i32* %9
%273 = mul nsw i32 %271, %272
%274 = add nsw i32 %270, %273
%275 = sext i32 %274 to i64
%276 = getelementptr inbounds i32, i32* %269, i64 %275
%277 = load i32, i32* %276
%278 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i32 %268, i32 %277)
br label %279
279: ; preds = %259
%280 = load i32, i32* %7
%281 = add nsw i32 %280, 1
store i32 %281, i32* %7
br label %255
282: ; preds = %255
br label %283
283: ; preds = %282
%284 = load i32, i32* %6
%285 = add nsw i32 %284, 1
store i32 %285, i32* %6
br label %250
286: ; preds = %250
%287 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %6
br label %288
288: ; preds = %323, %286
%289 = load i32, i32* %6
%290 = load i32, i32* %8
%291 = icmp slt i32 %289, %290
br i1 %291, label %292, label %326
292: ; preds = %288
store i32 0, i32* %7
br label %293
293: ; preds = %319, %292
%294 = load i32, i32* %7
%295 = load i32, i32* %9
%296 = icmp slt i32 %294, %295
br i1 %296, label %297, label %322
297: ; preds = %293
%298 = load i32*, i32** %11
%299 = load i32, i32* %6
%300 = load i32, i32* %9
%301 = mul nsw i32 %299, %300
%302 = load i32, i32* %7
%303 = add nsw i32 %301, %302
%304 = sext i32 %303 to i64
%305 = getelementptr inbounds i32, i32* %298, i64 %304
%306 = load i32, i32* %305
%307 = load i32*, i32** %13
%308 = load i32*, i32** %12
%309 = load i32, i32* %6
%310 = load i32, i32* %9
%311 = mul nsw i32 %309, %310
%312 = load i32, i32* %7
%313 = add nsw i32 %311, %312
%314 = sext i32 %313 to i64
%315 = getelementptr inbounds i32, i32* %308, i64 %314
%316 = load i32, i32* %315
%317 = sext i32 %316 to i64
%318 = getelementptr inbounds i32, i32* %307, i64 %317
store i32 %306, i32* %318
br label %319
319: ; preds = %297
%320 = load i32, i32* %7
%321 = add nsw i32 %320, 1
store i32 %321, i32* %7
br label %293
322: ; preds = %293
br label %323
323: ; preds = %322
%324 = load i32, i32* %6
%325 = add nsw i32 %324, 1
store i32 %325, i32* %6
br label %288
326: ; preds = %288
%327 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %6
br label %328
328: ; preds = %352, %326
%329 = load i32, i32* %6
%330 = load i32, i32* %8
%331 = icmp slt i32 %329, %330
br i1 %331, label %332, label %355
332: ; preds = %328
store i32 0, i32* %7
br label %333
333: ; preds = %348, %332
%334 = load i32, i32* %7
%335 = load i32, i32* %9
%336 = icmp slt i32 %334, %335
br i1 %336, label %337, label %351
337: ; preds = %333
%338 = load i32*, i32** %13
%339 = load i32, i32* %7
%340 = load i32, i32* %6
%341 = load i32, i32* %9
%342 = mul nsw i32 %340, %341
%343 = add nsw i32 %339, %342
%344 = sext i32 %343 to i64
%345 = getelementptr inbounds i32, i32* %338, i64 %344
%346 = load i32, i32* %345
%347 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %346)
br label %348
348: ; preds = %337
%349 = load i32, i32* %7
%350 = add nsw i32 %349, 1
store i32 %350, i32* %7
br label %333
351: ; preds = %333
br label %352
352: ; preds = %351
%353 = load i32, i32* %6
%354 = add nsw i32 %353, 1
store i32 %354, i32* %6
br label %328
355: ; preds = %328
%356 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%357 = load i32*, i32** %11
%358 = call i32 @free(i32* %357)
%359 = load i32*, i32** %12
%360 = call i32 @free(i32* %359)
%361 = load i32*, i32** %13
%362 = call i32 @free(i32* %361)
ret i32 0
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str.2 = [4 x i8] c"%i \00"
@.str.4 = [101 x i8] c"They are put into a %ix%i grid in \22row-wise\22, meaning each row is completed, before moving to next:\0A\00"
@.str.5 = [32 x i8] c"%ix%i column-wise grid layout:\0A\00"
@.str.6 = [108 x i8] c"However the samples are mistakenly analysed in columnwise fashion. Note the gird retains %ix%i dimensions:\0A\00"
@.str.9 = [8 x i8] c"%i->%i \00"
@str = [97 x i8] c"So here's a little story: we layout a series of samples which we label with consecutive numbers:\00"
@str.12 = [38 x i8] c"After conversion, print straight out:\00"
@str.13 = [46 x i8] c"So what's happened? This mapping has occured:\00"
@str.14 = [27 x i8] c"SO we need to reverse this\00"
@str.15 = [10 x i8] c"New arr3:\00"
@str.16 = [85 x i8] c"Needs 2 args: 1) nrows & 2) ncols grid layout (math-style nrows=M, ncols=N for MxN).\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @str.16, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = mul nsw i32 %14, %11
%16 = shl i32 %15, 2
%17 = tail call i32* @malloc(i32 %16)
%18 = tail call i32* @malloc(i32 %16)
%19 = tail call i32* @malloc(i32 %16)
%20 = icmp sgt i32 %15, 0
br i1 %20, label %23, label %21
21: ; preds = %8
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([97 x i8], [97 x i8]* @str, i64 0, i64 0))
br label %107
23: ; preds = %8
%24 = zext i32 %15 to i64
%25 = icmp ult i32 %15, 8
br i1 %25, label %88, label %26
26: ; preds = %23
%27 = and i64 %24, 4294967288
%28 = add nsw i64 %27, -8
%29 = lshr exact i64 %28, 3
%30 = add nuw nsw i64 %29, 1
%31 = and i64 %30, 3
%32 = icmp ult i64 %28, 24
br i1 %32, label %69, label %33
33: ; preds = %26
%34 = and i64 %30, 4611686018427387900
br label %35
35: ; preds = %35, %33
%36 = phi i64 [ 0, %33 ], [ %65, %35 ]
%37 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %33 ], [ %66, %35 ]
%38 = phi i64 [ 0, %33 ], [ %67, %35 ]
%39 = add <4 x i32> %37, <i32 4, i32 4, i32 4, i32 4>
%40 = getelementptr inbounds i32, i32* %17, i64 %36
%41 = bitcast i32* %40 to <4 x i32>*
store <4 x i32> %37, <4 x i32>* %41
%42 = getelementptr inbounds i32, i32* %40, i64 4
%43 = bitcast i32* %42 to <4 x i32>*
store <4 x i32> %39, <4 x i32>* %43
%44 = or i64 %36, 8
%45 = add <4 x i32> %37, <i32 8, i32 8, i32 8, i32 8>
%46 = add <4 x i32> %37, <i32 12, i32 12, i32 12, i32 12>
%47 = getelementptr inbounds i32, i32* %17, i64 %44
%48 = bitcast i32* %47 to <4 x i32>*
store <4 x i32> %45, <4 x i32>* %48
%49 = getelementptr inbounds i32, i32* %47, i64 4
%50 = bitcast i32* %49 to <4 x i32>*
store <4 x i32> %46, <4 x i32>* %50
%51 = or i64 %36, 16
%52 = add <4 x i32> %37, <i32 16, i32 16, i32 16, i32 16>
%53 = add <4 x i32> %37, <i32 20, i32 20, i32 20, i32 20>
%54 = getelementptr inbounds i32, i32* %17, i64 %51
%55 = bitcast i32* %54 to <4 x i32>*
store <4 x i32> %52, <4 x i32>* %55
%56 = getelementptr inbounds i32, i32* %54, i64 4
%57 = bitcast i32* %56 to <4 x i32>*
store <4 x i32> %53, <4 x i32>* %57
%58 = or i64 %36, 24
%59 = add <4 x i32> %37, <i32 24, i32 24, i32 24, i32 24>
%60 = add <4 x i32> %37, <i32 28, i32 28, i32 28, i32 28>
%61 = getelementptr inbounds i32, i32* %17, i64 %58
%62 = bitcast i32* %61 to <4 x i32>*
store <4 x i32> %59, <4 x i32>* %62
%63 = getelementptr inbounds i32, i32* %61, i64 4
%64 = bitcast i32* %63 to <4 x i32>*
store <4 x i32> %60, <4 x i32>* %64
%65 = add nuw i64 %36, 32
%66 = add <4 x i32> %37, <i32 32, i32 32, i32 32, i32 32>
%67 = add i64 %38, 4
%68 = icmp eq i64 %67, %34
br i1 %68, label %69, label %35
69: ; preds = %35, %26
%70 = phi i64 [ 0, %26 ], [ %65, %35 ]
%71 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %26 ], [ %66, %35 ]
%72 = icmp eq i64 %31, 0
br i1 %72, label %86, label %73
73: ; preds = %69, %73
%74 = phi i64 [ %82, %73 ], [ %70, %69 ]
%75 = phi <4 x i32> [ %83, %73 ], [ %71, %69 ]
%76 = phi i64 [ %84, %73 ], [ 0, %69 ]
%77 = add <4 x i32> %75, <i32 4, i32 4, i32 4, i32 4>
%78 = getelementptr inbounds i32, i32* %17, i64 %74
%79 = bitcast i32* %78 to <4 x i32>*
store <4 x i32> %75, <4 x i32>* %79
%80 = getelementptr inbounds i32, i32* %78, i64 4
%81 = bitcast i32* %80 to <4 x i32>*
store <4 x i32> %77, <4 x i32>* %81
%82 = add nuw i64 %74, 8
%83 = add <4 x i32> %75, <i32 8, i32 8, i32 8, i32 8>
%84 = add i64 %76, 1
%85 = icmp eq i64 %84, %31
br i1 %85, label %86, label %73
86: ; preds = %73, %69
%87 = icmp eq i64 %27, %24
br i1 %87, label %96, label %88
88: ; preds = %23, %86
%89 = phi i64 [ 0, %23 ], [ %27, %86 ]
br label %90
90: ; preds = %88, %90
%91 = phi i64 [ %94, %90 ], [ %89, %88 ]
%92 = getelementptr inbounds i32, i32* %17, i64 %91
%93 = trunc i64 %91 to i32
store i32 %93, i32* %92
%94 = add nuw nsw i64 %91, 1
%95 = icmp eq i64 %94, %24
br i1 %95, label %96, label %90
96: ; preds = %90, %86
%97 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([97 x i8], [97 x i8]* @str, i64 0, i64 0))
br i1 %20, label %98, label %107
98: ; preds = %96
%99 = zext i32 %15 to i64
br label %100
100: ; preds = %98, %100
%101 = phi i64 [ 0, %98 ], [ %105, %100 ]
%102 = getelementptr inbounds i32, i32* %17, i64 %101
%103 = load i32, i32* %102
%104 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %103)
%105 = add nuw nsw i64 %101, 1
%106 = icmp eq i64 %105, %99
br i1 %106, label %107, label %100
107: ; preds = %100, %21, %96
%108 = tail call i32 @putchar(i32 10)
%109 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([101 x i8], [101 x i8]* @.str.4, i64 0, i64 0), i32 %11, i32 %14)
%110 = icmp sgt i32 %11, 0
br i1 %110, label %111, label %200
111: ; preds = %107
%112 = icmp sgt i32 %14, 0
%113 = sext i32 %14 to i64
%114 = zext i32 %11 to i64
%115 = zext i32 %14 to i64
br label %116
116: ; preds = %111, %128
%117 = phi i64 [ 0, %111 ], [ %130, %128 ]
br i1 %112, label %118, label %128
118: ; preds = %116
%119 = mul nsw i64 %117, %113
br label %120
120: ; preds = %118, %120
%121 = phi i64 [ 0, %118 ], [ %126, %120 ]
%122 = add nsw i64 %121, %119
%123 = getelementptr inbounds i32, i32* %17, i64 %122
%124 = load i32, i32* %123
%125 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %124)
%126 = add nuw nsw i64 %121, 1
%127 = icmp eq i64 %126, %115
br i1 %127, label %128, label %120
128: ; preds = %120, %116
%129 = tail call i32 @putchar(i32 10)
%130 = add nuw nsw i64 %117, 1
%131 = icmp eq i64 %130, %114
br i1 %131, label %132, label %116
132: ; preds = %128
%133 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 %11, i32 %14)
%134 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([108 x i8], [108 x i8]* @.str.6, i64 0, i64 0), i32 %11, i32 %14)
br i1 %110, label %135, label %203
135: ; preds = %132
%136 = icmp sgt i32 %14, 0
%137 = zext i32 %11 to i64
%138 = zext i32 %11 to i64
%139 = zext i32 %14 to i64
br label %140
140: ; preds = %135, %161
%141 = phi i64 [ 0, %135 ], [ %163, %161 ]
br i1 %136, label %152, label %161
142: ; preds = %161
br i1 %110, label %143, label %203
143: ; preds = %142
%144 = icmp sgt i32 %14, 0
%145 = zext i32 %11 to i64
%146 = sext i32 %14 to i64
%147 = zext i32 %11 to i64
%148 = and i64 %115, 1
%149 = icmp eq i32 %14, 1
%150 = and i64 %115, 4294967294
%151 = icmp eq i64 %148, 0
br label %165
152: ; preds = %140, %152
%153 = phi i64 [ %159, %152 ], [ 0, %140 ]
%154 = mul nsw i64 %153, %137
%155 = add nuw nsw i64 %154, %141
%156 = getelementptr inbounds i32, i32* %17, i64 %155
%157 = load i32, i32* %156
%158 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %157)
%159 = add nuw nsw i64 %153, 1
%160 = icmp eq i64 %159, %139
br i1 %160, label %161, label %152
161: ; preds = %152, %140
%162 = tail call i32 @putchar(i32 10)
%163 = add nuw nsw i64 %141, 1
%164 = icmp eq i64 %163, %138
br i1 %164, label %142, label %140
165: ; preds = %143, %197
%166 = phi i64 [ 0, %143 ], [ %198, %197 ]
br i1 %144, label %167, label %197
167: ; preds = %165
%168 = mul nsw i64 %166, %146
br i1 %149, label %188, label %169
169: ; preds = %167, %169
%170 = phi i64 [ %185, %169 ], [ 0, %167 ]
%171 = phi i64 [ %186, %169 ], [ 0, %167 ]
%172 = mul nsw i64 %170, %145
%173 = add nuw nsw i64 %172, %166
%174 = getelementptr inbounds i32, i32* %17, i64 %173
%175 = load i32, i32* %174
%176 = add nsw i64 %170, %168
%177 = getelementptr inbounds i32, i32* %18, i64 %176
store i32 %175, i32* %177
%178 = or i64 %170, 1
%179 = mul nsw i64 %178, %145
%180 = add nuw nsw i64 %179, %166
%181 = getelementptr inbounds i32, i32* %17, i64 %180
%182 = load i32, i32* %181
%183 = add nsw i64 %178, %168
%184 = getelementptr inbounds i32, i32* %18, i64 %183
store i32 %182, i32* %184
%185 = add nuw nsw i64 %170, 2
%186 = add i64 %171, 2
%187 = icmp eq i64 %186, %150
br i1 %187, label %188, label %169
188: ; preds = %169, %167
%189 = phi i64 [ 0, %167 ], [ %185, %169 ]
br i1 %151, label %197, label %190
190: ; preds = %188
%191 = mul nsw i64 %189, %145
%192 = add nuw nsw i64 %191, %166
%193 = getelementptr inbounds i32, i32* %17, i64 %192
%194 = load i32, i32* %193
%195 = add nsw i64 %189, %168
%196 = getelementptr inbounds i32, i32* %18, i64 %195
store i32 %194, i32* %196
br label %197
197: ; preds = %190, %188, %165
%198 = add nuw nsw i64 %166, 1
%199 = icmp eq i64 %198, %147
br i1 %199, label %205, label %165
200: ; preds = %107
%201 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 %11, i32 %14)
%202 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([108 x i8], [108 x i8]* @.str.6, i64 0, i64 0), i32 %11, i32 %14)
br label %203
203: ; preds = %200, %142, %132
%204 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.12, i64 0, i64 0))
br label %227
205: ; preds = %197
%206 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.12, i64 0, i64 0))
br i1 %110, label %207, label %252
207: ; preds = %205
%208 = icmp sgt i32 %14, 0
%209 = sext i32 %14 to i64
%210 = zext i32 %11 to i64
%211 = zext i32 %14 to i64
br label %212
212: ; preds = %207, %224
%213 = phi i64 [ 0, %207 ], [ %225, %224 ]
br i1 %208, label %214, label %224
214: ; preds = %212
%215 = mul nsw i64 %213, %209
br label %216
216: ; preds = %214, %216
%217 = phi i64 [ 0, %214 ], [ %222, %216 ]
%218 = add nsw i64 %217, %215
%219 = getelementptr inbounds i32, i32* %18, i64 %218
%220 = load i32, i32* %219
%221 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %220)
%222 = add nuw nsw i64 %217, 1
%223 = icmp eq i64 %222, %211
br i1 %223, label %224, label %216
224: ; preds = %216, %212
%225 = add nuw nsw i64 %213, 1
%226 = icmp eq i64 %225, %210
br i1 %226, label %227, label %212
227: ; preds = %224, %203
%228 = tail call i32 @putchar(i32 10)
%229 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.13, i64 0, i64 0))
br i1 %110, label %230, label %258
230: ; preds = %227
%231 = icmp sgt i32 %14, 0
%232 = sext i32 %14 to i64
%233 = zext i32 %11 to i64
%234 = zext i32 %14 to i64
br label %235
235: ; preds = %230, %249
%236 = phi i64 [ 0, %230 ], [ %250, %249 ]
br i1 %231, label %237, label %249
237: ; preds = %235
%238 = mul nsw i64 %236, %232
br label %239
239: ; preds = %237, %239
%240 = phi i64 [ 0, %237 ], [ %247, %239 ]
%241 = add nsw i64 %240, %238
%242 = getelementptr inbounds i32, i32* %17, i64 %241
%243 = load i32, i32* %242
%244 = getelementptr inbounds i32, i32* %18, i64 %241
%245 = load i32, i32* %244
%246 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i32 %243, i32 %245)
%247 = add nuw nsw i64 %240, 1
%248 = icmp eq i64 %247, %234
br i1 %248, label %249, label %239
249: ; preds = %239, %235
%250 = add nuw nsw i64 %236, 1
%251 = icmp eq i64 %250, %233
br i1 %251, label %255, label %235
252: ; preds = %205
%253 = tail call i32 @putchar(i32 10)
%254 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.13, i64 0, i64 0))
br label %255
255: ; preds = %249, %252
%256 = tail call i32 @putchar(i32 10)
%257 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.14, i64 0, i64 0))
br i1 %110, label %263, label %261
258: ; preds = %227
%259 = tail call i32 @putchar(i32 10)
%260 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.14, i64 0, i64 0))
br label %261
261: ; preds = %258, %255
%262 = tail call i32 @putchar(i32 10)
br label %355
263: ; preds = %255
%264 = icmp sgt i32 %14, 0
%265 = sext i32 %14 to i64
%266 = zext i32 %11 to i64
%267 = zext i32 %14 to i64
br label %268
268: ; preds = %263, %282
%269 = phi i64 [ 0, %263 ], [ %283, %282 ]
br i1 %264, label %270, label %282
270: ; preds = %268
%271 = mul nsw i64 %269, %265
br label %272
272: ; preds = %270, %272
%273 = phi i64 [ 0, %270 ], [ %280, %272 ]
%274 = add nsw i64 %273, %271
%275 = getelementptr inbounds i32, i32* %18, i64 %274
%276 = load i32, i32* %275
%277 = getelementptr inbounds i32, i32* %17, i64 %274
%278 = load i32, i32* %277
%279 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i32 %276, i32 %278)
%280 = add nuw nsw i64 %273, 1
%281 = icmp eq i64 %280, %267
br i1 %281, label %282, label %272
282: ; preds = %272, %268
%283 = add nuw nsw i64 %269, 1
%284 = icmp eq i64 %283, %266
br i1 %284, label %285, label %268
285: ; preds = %282
%286 = tail call i32 @putchar(i32 10)
br i1 %110, label %287, label %355
287: ; preds = %285
%288 = icmp sgt i32 %14, 0
%289 = sext i32 %14 to i64
%290 = zext i32 %11 to i64
%291 = add nsw i64 %267, -1
%292 = and i64 %267, 3
%293 = icmp ult i64 %291, 3
%294 = and i64 %267, 4294967292
%295 = icmp eq i64 %292, 0
br label %296
296: ; preds = %287, %352
%297 = phi i64 [ 0, %287 ], [ %353, %352 ]
br i1 %288, label %298, label %352
298: ; preds = %296
%299 = mul nsw i64 %297, %289
br i1 %293, label %337, label %300
300: ; preds = %298, %300
%301 = phi i64 [ %334, %300 ], [ 0, %298 ]
%302 = phi i64 [ %335, %300 ], [ 0, %298 ]
%303 = add nsw i64 %301, %299
%304 = getelementptr inbounds i32, i32* %17, i64 %303
%305 = load i32, i32* %304
%306 = getelementptr inbounds i32, i32* %18, i64 %303
%307 = load i32, i32* %306
%308 = sext i32 %307 to i64
%309 = getelementptr inbounds i32, i32* %19, i64 %308
store i32 %305, i32* %309
%310 = or i64 %301, 1
%311 = add nsw i64 %310, %299
%312 = getelementptr inbounds i32, i32* %17, i64 %311
%313 = load i32, i32* %312
%314 = getelementptr inbounds i32, i32* %18, i64 %311
%315 = load i32, i32* %314
%316 = sext i32 %315 to i64
%317 = getelementptr inbounds i32, i32* %19, i64 %316
store i32 %313, i32* %317
%318 = or i64 %301, 2
%319 = add nsw i64 %318, %299
%320 = getelementptr inbounds i32, i32* %17, i64 %319
%321 = load i32, i32* %320
%322 = getelementptr inbounds i32, i32* %18, i64 %319
%323 = load i32, i32* %322
%324 = sext i32 %323 to i64
%325 = getelementptr inbounds i32, i32* %19, i64 %324
store i32 %321, i32* %325
%326 = or i64 %301, 3
%327 = add nsw i64 %326, %299
%328 = getelementptr inbounds i32, i32* %17, i64 %327
%329 = load i32, i32* %328
%330 = getelementptr inbounds i32, i32* %18, i64 %327
%331 = load i32, i32* %330
%332 = sext i32 %331 to i64
%333 = getelementptr inbounds i32, i32* %19, i64 %332
store i32 %329, i32* %333
%334 = add nuw nsw i64 %301, 4
%335 = add i64 %302, 4
%336 = icmp eq i64 %335, %294
br i1 %336, label %337, label %300
337: ; preds = %300, %298
%338 = phi i64 [ 0, %298 ], [ %334, %300 ]
br i1 %295, label %352, label %339
339: ; preds = %337, %339
%340 = phi i64 [ %349, %339 ], [ %338, %337 ]
%341 = phi i64 [ %350, %339 ], [ 0, %337 ]
%342 = add nsw i64 %340, %299
%343 = getelementptr inbounds i32, i32* %17, i64 %342
%344 = load i32, i32* %343
%345 = getelementptr inbounds i32, i32* %18, i64 %342
%346 = load i32, i32* %345
%347 = sext i32 %346 to i64
%348 = getelementptr inbounds i32, i32* %19, i64 %347
store i32 %344, i32* %348
%349 = add nuw nsw i64 %340, 1
%350 = add i64 %341, 1
%351 = icmp eq i64 %350, %292
br i1 %351, label %352, label %339
352: ; preds = %337, %339, %296
%353 = add nuw nsw i64 %297, 1
%354 = icmp eq i64 %353, %290
br i1 %354, label %357, label %296
355: ; preds = %261, %285
%356 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.15, i64 0, i64 0))
br label %379
357: ; preds = %352
%358 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.15, i64 0, i64 0))
br i1 %110, label %359, label %379
359: ; preds = %357
%360 = icmp sgt i32 %14, 0
%361 = sext i32 %14 to i64
%362 = zext i32 %11 to i64
%363 = zext i32 %14 to i64
br label %364
364: ; preds = %359, %376
%365 = phi i64 [ 0, %359 ], [ %377, %376 ]
br i1 %360, label %366, label %376
366: ; preds = %364
%367 = mul nsw i64 %365, %361
br label %368
368: ; preds = %366, %368
%369 = phi i64 [ 0, %366 ], [ %374, %368 ]
%370 = add nsw i64 %369, %367
%371 = getelementptr inbounds i32, i32* %19, i64 %370
%372 = load i32, i32* %371
%373 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %372)
%374 = add nuw nsw i64 %369, 1
%375 = icmp eq i64 %374, %363
br i1 %375, label %376, label %368
376: ; preds = %368, %364
%377 = add nuw nsw i64 %365, 1
%378 = icmp eq i64 %377, %362
br i1 %378, label %379, label %364
379: ; preds = %376, %355, %357
%380 = tail call i32 @putchar(i32 10)
%381 = tail call i32 @free(i32* %17)
%382 = tail call i32 @free(i32* %18)
%383 = tail call i32 @free(i32* %19)
ret i32 0
}