#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*/ printf(char *, ...);
void dump_4x4(int m[4][4], const char *title) {
  printf("=============================\n");
  printf("%s\n", title);
  printf("-----------------------------\n");
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      printf("%5d ", m[i][j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<dump_4x4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    11be <dump_4x4+0xae>
movl   $0x0,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jge    11a2 <dump_4x4+0x92>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1166 <dump_4x4+0x56>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1155 <dump_4x4+0x45>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_4x4>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xec4(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0xece(%rip),%rdi
call   1040 <puts@plt>
mov    (%rbx),%esi
lea    0xe9d(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x10(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x1c(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x20(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x24(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2c(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x30(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x34(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x38(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x3c(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"=============================\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [31 x i8] c"-----------------------------\0A\00"
@.str.3 = [5 x i8] c"%5d \00"
@.str.4 = [2 x i8] c"\0A\00"
define void @dump_4x4([4 x i32]* %0, i8* %1) {
%3 = alloca [4 x i32]*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store [4 x i32]* %0, [4 x i32]** %3
store i8* %1, i8** %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %5
br label %11
11: ; preds = %33, %2
%12 = load i32, i32* %5
%13 = icmp slt i32 %12, 4
br i1 %13, label %14, label %36
14: ; preds = %11
store i32 0, i32* %6
br label %15
15: ; preds = %28, %14
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 4
br i1 %17, label %18, label %31
18: ; preds = %15
%19 = load [4 x i32]*, [4 x i32]** %3
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %19, i64 %21
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [4 x i32], [4 x i32]* %22, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %18
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %15
31: ; preds = %15
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %33
33: ; preds = %31
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
store i32 %35, i32* %5
br label %11
36: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str.3 = [5 x i8] c"%5d \00"
@str = [30 x i8] c"=============================\00"
@str.5 = [30 x i8] c"-----------------------------\00"
define void @dump_4x4([4 x i32]* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) %1)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.5, i64 0, i64 0))
%6 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 0, i64 0
%7 = load i32, i32* %6
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 0, i64 1
%10 = load i32, i32* %9
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 0, i64 2
%13 = load i32, i32* %12
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 0, i64 3
%16 = load i32, i32* %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = tail call i32 @putchar(i32 10)
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 1, i64 0
%20 = load i32, i32* %19
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 1, i64 1
%23 = load i32, i32* %22
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %23)
%25 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 1, i64 2
%26 = load i32, i32* %25
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 1, i64 3
%29 = load i32, i32* %28
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %29)
%31 = tail call i32 @putchar(i32 10)
%32 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 2, i64 0
%33 = load i32, i32* %32
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %33)
%35 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 2, i64 1
%36 = load i32, i32* %35
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %36)
%38 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 2, i64 2
%39 = load i32, i32* %38
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %39)
%41 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 2, i64 3
%42 = load i32, i32* %41
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %42)
%44 = tail call i32 @putchar(i32 10)
%45 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 3, i64 0
%46 = load i32, i32* %45
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %46)
%48 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 3, i64 1
%49 = load i32, i32* %48
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %49)
%51 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 3, i64 2
%52 = load i32, i32* %51
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %52)
%54 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 3, i64 3
%55 = load i32, i32* %54
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %55)
%57 = tail call i32 @putchar(i32 10)
ret void
}