#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*/ clear_screen();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ put_bar(int);
void put_location(int num[4][4]) {
  int i;
  int j;
  clear_screen();
  put_bar(6 * 4 + 1);
  for (i = 0; i < 4; i++) {
    printf("|");
    for (j = 0; j < 4; j++) {
      if (num[i][j])
        printf("%3d  |", num[i][j]);
      else
        printf("     |");
    }
    printf("\n");
    put_bar(6 * 4 + 1);
  }
}


x86 assembly (clang, -O0):
<put_location>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <clear_screen@plt>
mov    $0x19,%edi
call   1050 <put_bar@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    120a <put_location+0xda>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    11e4 <put_location+0xb4>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     11c3 <put_location+0x93>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d1 <put_location+0xa1>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d6 <put_location+0xa6>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1173 <put_location+0x43>
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x19,%edi
call   1050 <put_bar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1154 <put_location+0x24>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_location>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r12
xor    %eax,%eax
call   1050 <clear_screen@plt>
mov    $0x19,%edi
call   1060 <put_bar@plt>
lea    0xea4(%rip),%r14
lea    0xe96(%rip),%r15
xor    %ebx,%ebx
jmp    119c <put_location+0x5c>
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x19,%edi
call   1060 <put_bar@plt>
add    $0x10,%rbx
cmp    $0x40,%rbx
je     1226 <put_location+0xe6>
mov    $0x7c,%edi
call   1030 <putchar@plt>
mov    (%r12,%rbx,1),%esi
test   %esi,%esi
je     11c0 <put_location+0x80>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11ca <put_location+0x8a>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%r12,%rbx,1),%esi
test   %esi,%esi
je     11e0 <put_location+0xa0>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11ea <put_location+0xaa>
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%r12,%rbx,1),%esi
test   %esi,%esi
je     1200 <put_location+0xc0>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    120a <put_location+0xca>
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%r12,%rbx,1),%esi
test   %esi,%esi
je     1170 <put_location+0x30>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    117a <put_location+0x3a>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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