#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 print_array(int str[], size_t size) {
  int i, zeroCtr = 0;
  for (i = 0; i < size; i++) {
    if (str[i] > 0) {
      printf("%d", str[i]);
      if (i < size - 1) {
        printf("\n");
      }
    } else {
      zeroCtr++;
    }
  }
  if (i == zeroCtr) {
    printf("[Board is empty]");
  }
}


x86 assembly (clang, -O0):
<print_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11ab <print_array+0x9b>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jle    118f <print_array+0x7f>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x14(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jae    118a <print_array+0x7a>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1198 <print_array+0x88>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    119d <print_array+0x8d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112e <print_array+0x1e>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    11c5 <print_array+0xb5>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_array>:
test   %rsi,%rsi
je     1194 <print_array+0x74>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    -0x1(%rsi),%r12
lea    0xebf(%rip),%r15
xor    %ebp,%ebp
xor    %r13d,%r13d
jmp    115d <print_array+0x3d>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r13d
add    $0x1,%rbp
cmp    %rbp,%rbx
je     1180 <print_array+0x60>
mov    (%r14,%rbp,4),%esi
test   %esi,%esi
jle    1150 <print_array+0x30>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %rbp,%r12
jbe    1154 <print_array+0x34>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1154 <print_array+0x34>
cmp    %ebx,%r13d
lea    0x8(%rsp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jne    11a2 <print_array+0x82>
lea    0xe68(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.2 = [17 x i8] c"[Board is empty]\00"
define void @print_array(i32* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %26, label %4
4: ; preds = %2
%5 = add i64 %1, -1
br label %6
6: ; preds = %4, %19
%7 = phi i64 [ 0, %4 ], [ %21, %19 ]
%8 = phi i32 [ 0, %4 ], [ %20, %19 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %7
%10 = load i32, i32* %9
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %6
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %10)
%14 = icmp ugt i64 %5, %7
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = tail call i32 @putchar(i32 10)
br label %19
17: ; preds = %6
%18 = add nsw i32 %8, 1
br label %19
19: ; preds = %17, %15, %12
%20 = phi i32 [ %8, %15 ], [ %8, %12 ], [ %18, %17 ]
%21 = add nuw i64 %7, 1
%22 = icmp eq i64 %21, %1
br i1 %22, label %23, label %6
23: ; preds = %19
%24 = trunc i64 %1 to i32
%25 = icmp eq i32 %20, %24
br i1 %25, label %26, label %28
26: ; preds = %2, %23
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %26, %23
ret void
}