#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*/ free(int *);
int *malloc(int const);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  int i, j;
  const int nclines = 6;
  const int ncols = 3;
  int nrows = nclines / ncols;
  int *arr1 = malloc(nclines * sizeof(int));
  int *arr2 = malloc(nclines * sizeof(int));
  int k = 0;
  for (j = 0; j < nclines; ++j) {
    arr1[j] = j;
  }
  printf("Consecutive progression:\n");
  for (i = 0; i < nclines; ++i)
    printf("%i ", arr1[i]);
  printf("\n");
  printf("%ix%i row-wise grid layout:\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);
  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");
  free(arr1);
  free(arr2);
  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)
movl   $0x6,-0x1c(%rbp)
movl   $0x3,-0x20(%rbp)
movl   $0x2,-0x24(%rbp)
mov    $0x18,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    $0x18,%edi
call   1050 <malloc@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x6,-0x18(%rbp)
jge    11ab <main+0x7b>
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    1185 <main+0x55>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x6,-0x14(%rbp)
jge    11f1 <main+0xc1>
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c0 <main+0x90>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xe11(%rip),%rdi
mov    $0x3,%edx
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1284 <main+0x154>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    1268 <main+0x138>
mov    -0x30(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   $0x3,-0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    122f <main+0xff>
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    121c <main+0xec>
mov    -0x24(%rbp),%esi
lea    0xda9(%rip),%rdi
mov    $0x3,%edx
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    130a <main+0x1da>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    12ee <main+0x1be>
mov    -0x30(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   -0x24(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12b4 <main+0x184>
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12a1 <main+0x171>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1374 <main+0x244>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    1361 <main+0x231>
mov    -0x30(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   -0x24(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x38(%rbp),%rax
imul   $0x3,-0x14(%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    1324 <main+0x1f4>
jmp    1366 <main+0x236>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1311 <main+0x1e1>
lea    0xcdc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    13e8 <main+0x2b8>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    13d5 <main+0x2a5>
mov    -0x38(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   $0x3,-0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xcf1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    139c <main+0x26c>
jmp    13da <main+0x2aa>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1389 <main+0x259>
lea    0xcbc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    147d <main+0x34d>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    146a <main+0x33a>
mov    -0x30(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   $0x3,-0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x38(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   $0x3,-0x14(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
lea    0xc58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    141e <main+0x2ee>
jmp    146f <main+0x33f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    140b <main+0x2db>
lea    0xc27(%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>
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    $0x28,%rsp
mov    $0x18,%edi
call   1070 <malloc@plt>
mov    %rax,%r12
mov    $0x18,%edi
call   1070 <malloc@plt>
mov    %rax,%r15
movaps 0xe81(%rip),%xmm0
movups %xmm0,(%r12)
movabs $0x500000004,%rax
mov    %rax,0x10(%r12)
lea    0xebb(%rip),%rdi
call   1050 <puts@plt>
lea    0xeab(%rip),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x4(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x14(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xe02(%rip),%rdi
mov    $0x2,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x4(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0xc(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x14(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xd9a(%rip),%rdi
mov    $0x2,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%r12),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%r12),%esi
mov    %esi,0x10(%rsp)
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0x4(%r12),%ebx
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %ebx,0x18(%rsp)
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%r12),%esi
mov    %esi,0xc(%rsp)
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x14(%r12),%r14d
mov    %rbp,%rdi
mov    %r14d,%esi
mov    %r14d,0x14(%rsp)
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    (%r12),%r13d
mov    %r15,%rax
mov    %r15,0x20(%rsp)
mov    %r13d,(%r15)
mov    0x8(%r12),%r15d
mov    %r15d,0x4(%rax)
mov    %r15d,0x1c(%rsp)
mov    0x10(%rsp),%ebp
mov    %ebp,0x8(%rax)
mov    %ebx,0xc(%rax)
mov    0xc(%rsp),%ebx
mov    %ebx,0x10(%rax)
mov    %r14d,0x14(%rax)
lea    0xd0e(%rip),%rdi
call   1050 <puts@plt>
lea    0xce5(%rip),%r14
mov    %r14,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    0x18(%rsp),%ebp
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    0x14(%rsp),%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xcc7(%rip),%rdi
call   1050 <puts@plt>
lea    0xc74(%rip),%r15
mov    %r15,%rdi
mov    %r13d,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebp,%r14d
mov    0x1c(%rsp),%ebx
mov    %ebx,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    0x10(%rsp),%ebp
mov    %ebp,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    0xc(%rsp),%ebx
mov    %ebx,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    0x14(%rsp),%edx
mov    %edx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%i \00"
@.str.3 = [29 x i8] c"%ix%i row-wise grid layout:\0A\00"
@.str.4 = [32 x i8] c"%ix%i column-wise grid layout:\0A\00"
@.str.7 = [8 x i8] c"%i->%i \00"
@str = [25 x i8] c"Consecutive progression:\00"
@str.8 = [38 x i8] c"After conversion, print straight out:\00"
@str.9 = [46 x i8] c"So what's happened? This mapping has occured:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @malloc(i32 24)
%4 = tail call i32* @malloc(i32 24)
%5 = getelementptr inbounds i32, i32* %3, i64 1
%6 = getelementptr inbounds i32, i32* %3, i64 2
%7 = getelementptr inbounds i32, i32* %3, i64 3
%8 = bitcast i32* %3 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %8
%9 = getelementptr inbounds i32, i32* %3, i64 4
store i32 4, i32* %9
%10 = getelementptr inbounds i32, i32* %3, i64 5
store i32 5, i32* %10
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
%13 = load i32, i32* %5
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %6
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %7
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %9
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %10
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = tail call i32 @putchar(i32 10)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 2, i32 3)
%25 = load i32, i32* %3
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %5
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %6
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = tail call i32 @putchar(i32 10)
%32 = load i32, i32* %7
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %9
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %10
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = tail call i32 @putchar(i32 10)
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i32 2, i32 3)
%40 = load i32, i32* %3
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %6
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %9
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %44)
%46 = tail call i32 @putchar(i32 10)
%47 = load i32, i32* %5
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %47)
%49 = load i32, i32* %7
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %49)
%51 = load i32, i32* %10
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %51)
%53 = tail call i32 @putchar(i32 10)
%54 = load i32, i32* %3
store i32 %54, i32* %4
%55 = load i32, i32* %6
%56 = getelementptr inbounds i32, i32* %4, i64 1
store i32 %55, i32* %56
%57 = getelementptr inbounds i32, i32* %4, i64 2
store i32 %44, i32* %57
%58 = getelementptr inbounds i32, i32* %4, i64 3
store i32 %47, i32* %58
%59 = getelementptr inbounds i32, i32* %4, i64 4
store i32 %49, i32* %59
%60 = getelementptr inbounds i32, i32* %4, i64 5
store i32 %51, i32* %60
%61 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.8, i64 0, i64 0))
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %54)
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %55)
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %44)
%65 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %47)
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %49)
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %51)
%68 = tail call i32 @putchar(i32 10)
%69 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.9, i64 0, i64 0))
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %54, i32 %54)
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %47, i32 %55)
%72 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %55, i32 %44)
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %49, i32 %47)
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %44, i32 %49)
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %51, i32 %51)
%76 = tail call i32 @putchar(i32 10)
%77 = tail call i32 @free(i32* %3)
%78 = tail call i32 @free(i32* %4)
ret i32 0
}