int main() {
  int i, j;
  printf("Matrix of integers (array of arrays of ints)\n");
  int intmatrix[3][5];
  for (i = 0; i < 3; i++)
    for (j = 0; j < 5; j++)
      intmatrix[i][j] = (i * 5) + j + 1;
  printmatrix(intmatrix, sizeof(**intmatrix), "%d", 3, 5, 5, 1);
  printf("\n");
  printf("Dynamically allocated matrix of integers (array of ints)\n");
  int *dynintmatrix = calloc(3 * 5, sizeof(int));
  for (i = 0; i < 3 * 5; i++)
    dynintmatrix[i] = i + 1;
  printmatrix(dynintmatrix, sizeof(*dynintmatrix), "%d", 3, 5, 5, 1);
  free(dynintmatrix);
  printf("\n");
  printf("Array of integers (array of ints)\n");
  int intarray[3 * 5];
  for (i = 0; i < 3 * 5; i++)
    intarray[i] = i + 1;
  printmatrix(intarray, sizeof(*intarray), "%d", 3, 5, 5, 1);
  printf("\n");
  printf("String (array of chars)\n");
  char string[3 * 5] = "abcdefghijklmno";
  printmatrix(string, sizeof(*string), "%c", 3, 5, 5, 1);
  printf("\n");
  printf("Array of strings (array of pointers to arrays of chars)\n");
  char *stringarray[3 * 5] = {"aa", "bb", "cc", "dd", "ee", "ff", "gg", "hh",
                              "ii", "jj", "kk", "ll", "mm", "nn", "oo"};
  printmatrix(stringarray, sizeof(*stringarray), "%s", 3, 5, 5, 1);
  printf("\n");
  printf(
      "Matrix of strings (array of arrays of pointers to arrays of chars)\n");
  char *stringmatrix[3][5] = {
      {"aa", "bb", "cc", "dd", "ee"},
      {"ff", "gg", "hh", "ii", "jj"},
      {"kk", "ll", "mm", "nn", "oo"},
  };
  printmatrix(stringmatrix, sizeof(**stringmatrix), "%s", 3, 5, 5, 1);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11d3 <main+0x83>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    11c0 <main+0x70>
imul   $0x5,-0x8(%rbp),%edx
add    -0xc(%rbp),%edx
add    $0x1,%edx
movslq -0x8(%rbp),%rcx
lea    -0x50(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1188 <main+0x38>
jmp    11c5 <main+0x75>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1177 <main+0x27>
lea    -0x50(%rbp),%rdi
mov    $0x4,%esi
lea    0xe4b(%rip),%rdx
mov    $0x3,%ecx
mov    $0x5,%r9d
mov    %r9d,%r8d
movl   $0x1,(%rsp)
mov    $0x0,%al
call   1040 <printmatrix@plt>
lea    0xf4f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xf,%edi
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xf,-0x8(%rbp)
jge    125e <main+0x10e>
mov    -0x8(%rbp),%edx
add    $0x1,%edx
mov    -0x58(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1235 <main+0xe5>
mov    -0x58(%rbp),%rdi
mov    $0x4,%esi
lea    0xdc0(%rip),%rdx
mov    $0x3,%ecx
mov    $0x5,%r9d
mov    %r9d,%r8d
movl   $0x1,(%rsp)
mov    $0x0,%al
call   1040 <printmatrix@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xf,-0x8(%rbp)
jge    12df <main+0x18f>
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0xa0(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    12b6 <main+0x166>
lea    -0xa0(%rbp),%rdi
mov    $0x4,%esi
lea    0xd3c(%rip),%rdx
mov    $0x3,%ecx
mov    $0x5,%r9d
mov    %r9d,%r8d
movl   $0x1,(%rsp)
mov    $0x0,%al
call   1040 <printmatrix@plt>
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd6b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0xe26(%rip),%rax
mov    %rax,-0xaf(%rbp)
mov    0xe21(%rip),%eax
mov    %eax,-0xa7(%rbp)
mov    0xe18(%rip),%ax
mov    %ax,-0xa3(%rbp)
mov    0xe0d(%rip),%al
mov    %al,-0xa1(%rbp)
lea    -0xaf(%rbp),%rdi
mov    $0x1,%esi
lea    0xd36(%rip),%rdx
mov    $0x3,%ecx
mov    $0x5,%r9d
mov    %r9d,%r8d
movl   $0x1,(%rsp)
mov    $0x0,%al
call   1040 <printmatrix@plt>
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd08(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x130(%rbp),%rdi
lea    0x2969(%rip),%rsi
mov    $0x78,%edx
call   1070 <memcpy@plt>
lea    -0x130(%rbp),%rdi
mov    $0x8,%esi
lea    0xd3c(%rip),%rdx
mov    $0x3,%ecx
mov    $0x5,%r9d
mov    %r9d,%r8d
movl   $0x1,(%rsp)
mov    $0x0,%al
call   1040 <printmatrix@plt>
lea    0xd5e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd0e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1b0(%rbp),%rdi
lea    0x2986(%rip),%rsi
mov    $0x78,%edx
call   1070 <memcpy@plt>
lea    -0x1b0(%rbp),%rdi
mov    $0x8,%esi
lea    0xcd9(%rip),%rdx
mov    $0x3,%ecx
mov    $0x5,%r9d
mov    %r9d,%r8d
movl   $0x1,(%rsp)
mov    $0x0,%al
call   1040 <printmatrix@plt>
lea    0xcfb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1a0,%rsp
lea    0xf03(%rip),%rdi
call   1050 <puts@plt>
movaps 0xe91(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xe95(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xe99(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movabs $0xe0000000d,%r15
mov    %r15,0x90(%rsp)
movl   $0xf,0x98(%rsp)
movl   $0x1,(%rsp)
lea    0xe76(%rip),%r14
lea    0x60(%rsp),%rdi
mov    $0x4,%esi
mov    %r14,%rdx
mov    $0x3,%ecx
mov    $0x5,%r8d
mov    $0x5,%r9d
xor    %eax,%eax
call   1060 <printmatrix@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xea3(%rip),%rdi
call   1050 <puts@plt>
mov    $0xf,%edi
mov    $0x4,%esi
call   1070 <calloc@plt>
mov    %rax,%rbx
movaps 0xdf2(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xdf8(%rip),%xmm0
movups %xmm0,0x10(%rax)
movaps 0xdfd(%rip),%xmm0
movups %xmm0,0x20(%rax)
mov    %r15,0x30(%rax)
movl   $0xf,0x38(%rax)
movl   $0x1,(%rsp)
mov    $0x4,%esi
mov    %rax,%rdi
mov    %r14,%rdx
mov    $0x3,%ecx
mov    $0x5,%r8d
mov    $0x5,%r9d
xor    %eax,%eax
call   1060 <printmatrix@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xe57(%rip),%rdi
call   1050 <puts@plt>
movaps 0xd7f(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xd83(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xd87(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
mov    %r15,0x50(%rsp)
movl   $0xf,0x58(%rsp)
movl   $0x1,(%rsp)
lea    0x20(%rsp),%rdi
mov    $0x4,%esi
mov    %r14,%rdx
mov    $0x3,%ecx
mov    $0x5,%r8d
mov    $0x5,%r9d
xor    %eax,%eax
call   1060 <printmatrix@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xe06(%rip),%rdi
call   1050 <puts@plt>
movabs $0x6f6e6d6c6b6a6968,%rax
6d 6e 6f
mov    %rax,0x17(%rsp)
movabs $0x6867666564636261,%rax
66 67 68
mov    %rax,0x10(%rsp)
movl   $0x1,(%rsp)
lea    0xd1a(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0x1,%esi
mov    $0x3,%ecx
mov    $0x5,%r8d
mov    $0x5,%r9d
xor    %eax,%eax
call   1060 <printmatrix@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xdba(%rip),%rdi
call   1050 <puts@plt>
mov    0x2a38(%rip),%rax
mov    %rax,0x190(%rsp)
movaps 0x2a19(%rip),%xmm0
movaps %xmm0,0x180(%rsp)
movaps 0x29fa(%rip),%xmm0
movaps %xmm0,0x170(%rsp)
movaps 0x29db(%rip),%xmm0
movaps %xmm0,0x160(%rsp)
movaps 0x29bc(%rip),%xmm0
movaps %xmm0,0x150(%rsp)
movaps 0x299d(%rip),%xmm0
movaps %xmm0,0x140(%rsp)
movaps 0x297e(%rip),%xmm0
movaps %xmm0,0x130(%rsp)
movaps 0x295f(%rip),%xmm0
movaps %xmm0,0x120(%rsp)
movl   $0x1,(%rsp)
lea    0xc8c(%rip),%rbx
lea    0x120(%rsp),%rdi
mov    $0x8,%esi
mov    %rbx,%rdx
mov    $0x3,%ecx
mov    $0x5,%r8d
mov    $0x5,%r9d
xor    %eax,%eax
call   1060 <printmatrix@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xd2e(%rip),%rdi
call   1050 <puts@plt>
mov    0x29f4(%rip),%rax
mov    %rax,0x110(%rsp)
movaps 0x29d5(%rip),%xmm0
movaps %xmm0,0x100(%rsp)
movaps 0x29b6(%rip),%xmm0
movaps %xmm0,0xf0(%rsp)
movaps 0x2997(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
movaps 0x2978(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
movaps 0x2959(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0x293a(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0x291b(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movl   $0x1,(%rsp)
lea    0xa0(%rsp),%rdi
mov    $0x8,%esi
mov    %rbx,%rdx
mov    $0x3,%ecx
mov    $0x5,%r8d
mov    $0x5,%r9d
xor    %eax,%eax
call   1060 <printmatrix@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [46 x i8] c"Matrix of integers (array of arrays of ints)\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [58 x i8] c"Dynamically allocated matrix of integers (array of ints)\0A\00"
@.str.4 = [35 x i8] c"Array of integers (array of ints)\0A\00"
@.str.5 = [25 x i8] c"String (array of chars)\0A\00"
@__const.main.string = [15 x i8] c"abcdefghijklmno"
@.str.6 = [3 x i8] c"%c\00"
@.str.7 = [57 x i8] c"Array of strings (array of pointers to arrays of chars)\0A\00"
@.str.8 = [3 x i8] c"aa\00"
@.str.9 = [3 x i8] c"bb\00"
@.str.10 = [3 x i8] c"cc\00"
@.str.11 = [3 x i8] c"dd\00"
@.str.12 = [3 x i8] c"ee\00"
@.str.13 = [3 x i8] c"ff\00"
@.str.14 = [3 x i8] c"gg\00"
@.str.15 = [3 x i8] c"hh\00"
@.str.16 = [3 x i8] c"ii\00"
@.str.17 = [3 x i8] c"jj\00"
@.str.18 = [3 x i8] c"kk\00"
@.str.19 = [3 x i8] c"ll\00"
@.str.20 = [3 x i8] c"mm\00"
@.str.21 = [3 x i8] c"nn\00"
@.str.22 = [3 x i8] c"oo\00"
@__const.main.stringarray = [15 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i32 0, i32 0)]
@.str.23 = [3 x i8] c"%s\00"
@.str.24 = [68 x i8] c"Matrix of strings (array of arrays of pointers to arrays of chars)\0A\00"
@__const.main.stringmatrix = [3 x [5 x i8*]] [[5 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i32 0, i32 0)], [5 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i32 0, i32 0)], [5 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i32 0, i32 0)]]
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [3 x [5 x i32]]
%5 = alloca i32*
%6 = alloca [15 x i32]
%7 = alloca [15 x i8]
%8 = alloca [15 x i8*]
%9 = alloca [3 x [5 x i8*]]
store i32 0, i32* %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %11
11: ; preds = %34, %0
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 3
br i1 %13, label %14, label %37
14: ; preds = %11
store i32 0, i32* %3
br label %15
15: ; preds = %30, %14
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 5
br i1 %17, label %18, label %33
18: ; preds = %15
%19 = load i32, i32* %2
%20 = mul nsw i32 %19, 5
%21 = load i32, i32* %3
%22 = add nsw i32 %20, %21
%23 = add nsw i32 %22, 1
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [3 x [5 x i32]], [3 x [5 x i32]]* %4, i64 0, i64 %25
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [5 x i32], [5 x i32]* %26, i64 0, i64 %28
store i32 %23, i32* %29
br label %30
30: ; preds = %18
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %15
33: ; preds = %15
br label %34
34: ; preds = %33
%35 = load i32, i32* %2
%36 = add nsw i32 %35, 1
store i32 %36, i32* %2
br label %11
37: ; preds = %11
%38 = getelementptr inbounds [3 x [5 x i32]], [3 x [5 x i32]]* %4, i64 0, i64 0
%39 = call i32 ([5 x i32]*, i64, i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @printmatrix to i32 ([5 x i32]*, i64, i8*, i32, i32, i32, i32, ...)*)([5 x i32]* %38, i64 4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 5, i32 5, i32 1)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0))
%42 = call i8* @calloc(i64 15, i64 4)
%43 = bitcast i8* %42 to i32*
store i32* %43, i32** %5
store i32 0, i32* %2
br label %44
44: ; preds = %54, %37
%45 = load i32, i32* %2
%46 = icmp slt i32 %45, 15
br i1 %46, label %47, label %57
47: ; preds = %44
%48 = load i32, i32* %2
%49 = add nsw i32 %48, 1
%50 = load i32*, i32** %5
%51 = load i32, i32* %2
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i32, i32* %50, i64 %52
store i32 %49, i32* %53
br label %54
54: ; preds = %47
%55 = load i32, i32* %2
%56 = add nsw i32 %55, 1
store i32 %56, i32* %2
br label %44
57: ; preds = %44
%58 = load i32*, i32** %5
%59 = call i32 (i32*, i64, i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @printmatrix to i32 (i32*, i64, i8*, i32, i32, i32, i32, ...)*)(i32* %58, i64 4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 5, i32 5, i32 1)
%60 = load i32*, i32** %5
%61 = bitcast i32* %60 to i8*
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %2
br label %64
64: ; preds = %73, %57
%65 = load i32, i32* %2
%66 = icmp slt i32 %65, 15
br i1 %66, label %67, label %76
67: ; preds = %64
%68 = load i32, i32* %2
%69 = add nsw i32 %68, 1
%70 = load i32, i32* %2
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [15 x i32], [15 x i32]* %6, i64 0, i64 %71
store i32 %69, i32* %72
br label %73
73: ; preds = %67
%74 = load i32, i32* %2
%75 = add nsw i32 %74, 1
store i32 %75, i32* %2
br label %64
76: ; preds = %64
%77 = getelementptr inbounds [15 x i32], [15 x i32]* %6, i64 0, i64 0
%78 = call i32 (i32*, i64, i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @printmatrix to i32 (i32*, i64, i8*, i32, i32, i32, i32, ...)*)(i32* %77, i64 4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 5, i32 5, i32 1)
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%81 = bitcast [15 x i8]* %7 to i8*
%82 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%83 = call i32 (i8*, i64, i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @printmatrix to i32 (i8*, i64, i8*, i32, i32, i32, i32, ...)*)(i8* %82, i64 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 3, i32 5, i32 5, i32 1)
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.7, i64 0, i64 0))
%86 = bitcast [15 x i8*]* %8 to i8*
%87 = getelementptr inbounds [15 x i8*], [15 x i8*]* %8, i64 0, i64 0
%88 = call i32 (i8**, i64, i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @printmatrix to i32 (i8**, i64, i8*, i32, i32, i32, i32, ...)*)(i8** %87, i64 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.23, i64 0, i64 0), i32 3, i32 5, i32 5, i32 1)
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.24, i64 0, i64 0))
%91 = bitcast [3 x [5 x i8*]]* %9 to i8*
%92 = getelementptr inbounds [3 x [5 x i8*]], [3 x [5 x i8*]]* %9, i64 0, i64 0
%93 = call i32 ([5 x i8*]*, i64, i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @printmatrix to i32 ([5 x i8*]*, i64, i8*, i32, i32, i32, i32, ...)*)([5 x i8*]* %92, i64 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.23, i64 0, i64 0), i32 3, i32 5, i32 5, i32 1)
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@__const.main.string = [15 x i8] c"abcdefghijklmno"
@.str.6 = [3 x i8] c"%c\00"
@.str.8 = [3 x i8] c"aa\00"
@.str.9 = [3 x i8] c"bb\00"
@.str.10 = [3 x i8] c"cc\00"
@.str.11 = [3 x i8] c"dd\00"
@.str.12 = [3 x i8] c"ee\00"
@.str.13 = [3 x i8] c"ff\00"
@.str.14 = [3 x i8] c"gg\00"
@.str.15 = [3 x i8] c"hh\00"
@.str.16 = [3 x i8] c"ii\00"
@.str.17 = [3 x i8] c"jj\00"
@.str.18 = [3 x i8] c"kk\00"
@.str.19 = [3 x i8] c"ll\00"
@.str.20 = [3 x i8] c"mm\00"
@.str.21 = [3 x i8] c"nn\00"
@.str.22 = [3 x i8] c"oo\00"
@__const.main.stringarray = [15 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i32 0, i32 0)]
@.str.23 = [3 x i8] c"%s\00"
@__const.main.stringmatrix = [3 x [5 x i8*]] [[5 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i32 0, i32 0)], [5 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i32 0, i32 0)], [5 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i32 0, i32 0)]]
@str = [45 x i8] c"Matrix of integers (array of arrays of ints)\00"
@str.25 = [57 x i8] c"Dynamically allocated matrix of integers (array of ints)\00"
@str.26 = [34 x i8] c"Array of integers (array of ints)\00"
@str.27 = [24 x i8] c"String (array of chars)\00"
@str.28 = [56 x i8] c"Array of strings (array of pointers to arrays of chars)\00"
@str.29 = [67 x i8] c"Matrix of strings (array of arrays of pointers to arrays of chars)\00"
define i32 @main() {
%1 = alloca [3 x [5 x i32]]
%2 = alloca [15 x i32]
%3 = alloca [15 x i8]
%4 = alloca [15 x i8*]
%5 = alloca [3 x [5 x i8*]]
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%7 = bitcast [3 x [5 x i32]]* %1 to i8*
%8 = bitcast [3 x [5 x i32]]* %1 to <4 x i32>*
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32>* %8
%9 = getelementptr inbounds [3 x [5 x i32]], [3 x [5 x i32]]* %1, i64 0, i64 0, i64 4
%10 = bitcast i32* %9 to <4 x i32>*
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, <4 x i32>* %10
%11 = getelementptr inbounds [3 x [5 x i32]], [3 x [5 x i32]]* %1, i64 0, i64 1, i64 3
%12 = bitcast i32* %11 to <4 x i32>*
store <4 x i32> <i32 9, i32 10, i32 11, i32 12>, <4 x i32>* %12
%13 = getelementptr inbounds [3 x [5 x i32]], [3 x [5 x i32]]* %1, i64 0, i64 2, i64 2
store i32 13, i32* %13
%14 = getelementptr inbounds [3 x [5 x i32]], [3 x [5 x i32]]* %1, i64 0, i64 2, i64 3
store i32 14, i32* %14
%15 = getelementptr inbounds [3 x [5 x i32]], [3 x [5 x i32]]* %1, i64 0, i64 2, i64 4
store i32 15, i32* %15
%16 = getelementptr inbounds [3 x [5 x i32]], [3 x [5 x i32]]* %1, i64 0, i64 0
%17 = call i32 ([5 x i32]*, i64, i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @printmatrix to i32 ([5 x i32]*, i64, i8*, i32, i32, i32, i32, ...)*)([5 x i32]* %16, i64 4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 5, i32 5, i32 1)
%18 = call i32 @putchar(i32 10)
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.25, i64 0, i64 0))
%20 = call dereferenceable_or_null(60) i8* @calloc(i64 15, i64 4)
%21 = bitcast i8* %20 to i32*
%22 = bitcast i8* %20 to <4 x i32>*
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32>* %22
%23 = getelementptr inbounds i32, i32* %21, i64 4
%24 = bitcast i32* %23 to <4 x i32>*
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, <4 x i32>* %24
%25 = getelementptr inbounds i32, i32* %21, i64 8
%26 = bitcast i32* %25 to <4 x i32>*
store <4 x i32> <i32 9, i32 10, i32 11, i32 12>, <4 x i32>* %26
%27 = getelementptr inbounds i32, i32* %21, i64 12
store i32 13, i32* %27
%28 = getelementptr inbounds i32, i32* %21, i64 13
store i32 14, i32* %28
%29 = getelementptr inbounds i32, i32* %21, i64 14
store i32 15, i32* %29
%30 = call i32 (i32*, i64, i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @printmatrix to i32 (i32*, i64, i8*, i32, i32, i32, i32, ...)*)(i32* %21, i64 4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 5, i32 5, i32 1)
%31 = call i32 @putchar(i32 10)
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.26, i64 0, i64 0))
%33 = bitcast [15 x i32]* %2 to i8*
%34 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 0
%35 = bitcast [15 x i32]* %2 to <4 x i32>*
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32>* %35
%36 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 4
%37 = bitcast i32* %36 to <4 x i32>*
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, <4 x i32>* %37
%38 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 8
%39 = bitcast i32* %38 to <4 x i32>*
store <4 x i32> <i32 9, i32 10, i32 11, i32 12>, <4 x i32>* %39
%40 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 12
store i32 13, i32* %40
%41 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 13
store i32 14, i32* %41
%42 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 14
store i32 15, i32* %42
%43 = call i32 (i32*, i64, i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @printmatrix to i32 (i32*, i64, i8*, i32, i32, i32, i32, ...)*)(i32* %34, i64 4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 5, i32 5, i32 1)
%44 = call i32 @putchar(i32 10)
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.27, i64 0, i64 0))
%46 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%47 = call i32 (i8*, i64, i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @printmatrix to i32 (i8*, i64, i8*, i32, i32, i32, i32, ...)*)(i8* %46, i64 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 3, i32 5, i32 5, i32 1)
%48 = call i32 @putchar(i32 10)
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.28, i64 0, i64 0))
%50 = bitcast [15 x i8*]* %4 to i8*
%51 = getelementptr inbounds [15 x i8*], [15 x i8*]* %4, i64 0, i64 0
%52 = call i32 (i8**, i64, i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @printmatrix to i32 (i8**, i64, i8*, i32, i32, i32, i32, ...)*)(i8** %51, i64 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.23, i64 0, i64 0), i32 3, i32 5, i32 5, i32 1)
%53 = call i32 @putchar(i32 10)
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str.29, i64 0, i64 0))
%55 = bitcast [3 x [5 x i8*]]* %5 to i8*
%56 = getelementptr inbounds [3 x [5 x i8*]], [3 x [5 x i8*]]* %5, i64 0, i64 0
%57 = call i32 ([5 x i8*]*, i64, i8*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @printmatrix to i32 ([5 x i8*]*, i64, i8*, i32, i32, i32, i32, ...)*)([5 x i8*]* %56, i64 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.23, i64 0, i64 0), i32 3, i32 5, i32 5, i32 1)
%58 = call i32 @putchar(i32 10)
ret i32 0
}