#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 printFrame(int frame[][4]) {
  int i, j;
  printf("================\r\n");
  for (i = 0; i < 4; i++) {
    for (j = 0; j < 4; j++) {
      if (0 != frame[i][j]) {
        printf("%4d", frame[i][j]);
      } else {
        printf("  - ");
      }
    }
    printf("\r\n");
  }
  printf("================\r\n");
}


x86 assembly (clang, -O0):
<printFrame>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    11d0 <printFrame+0xc0>
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    11b4 <printFrame+0xa4>
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rcx
movslq -0x10(%rbp),%rdx
xor    %eax,%eax
cmp    (%rcx,%rdx,4),%eax
je     1193 <printFrame+0x83>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a1 <printFrame+0x91>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a6 <printFrame+0x96>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1142 <printFrame+0x32>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1131 <printFrame+0x21>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printFrame>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r13
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
lea    0xec5(%rip),%r14
lea    0xed3(%rip),%r15
lea    0xeb3(%rip),%r12
xor    %ebx,%ebx
jmp    1180 <printFrame+0x60>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
add    $0x10,%rbx
cmp    $0x40,%rbx
je     1206 <printFrame+0xe6>
mov    0x0(%r13,%rbx,1),%esi
test   %esi,%esi
je     11a0 <printFrame+0x80>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11aa <printFrame+0x8a>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%r13,%rbx,1),%esi
test   %esi,%esi
je     11c0 <printFrame+0xa0>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11ca <printFrame+0xaa>
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%r13,%rbx,1),%esi
test   %esi,%esi
je     11e0 <printFrame+0xc0>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11ea <printFrame+0xca>
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%r13,%rbx,1),%esi
test   %esi,%esi
je     1160 <printFrame+0x40>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    116a <printFrame+0x4a>
lea    0xdfc(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%4d\00"
@.str.2 = [5 x i8] c" - \00"
@str.4 = [18 x i8] c"================\0D\00"
@str.5 = [2 x i8] c"\0D\00"
define void @printFrame([4 x i32]* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.4, i64 0, i64 0))
br label %3
3: ; preds = %1, %36
%4 = phi i64 [ 0, %1 ], [ %38, %36 ]
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %4, i64 0
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
br label %12
10: ; preds = %3
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %8, %10
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %4, i64 1
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %12
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
br label %20
18: ; preds = %12
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18, %16
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %4, i64 2
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %20
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %22)
br label %28
26: ; preds = %20
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %26, %24
%29 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %4, i64 3
%30 = load i32, i32* %29
%31 = icmp eq i32 %30, 0
br i1 %31, label %34, label %32
32: ; preds = %28
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
br label %36
34: ; preds = %28
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %36
36: ; preds = %34, %32
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0))
%38 = add nuw nsw i64 %4, 1
%39 = icmp eq i64 %38, 4
br i1 %39, label %40, label %3
40: ; preds = %36
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.4, i64 0, i64 0))
ret void
}