#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_int_array(int *array, int size, char *format, bool all) {
  int i = 0;
  for (i = 0; i < size; i++) {
    if (!all && array[i] <= 0) {
      continue;
    }
    printf(format, array[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_int_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1185 <print_int_array+0x75>
cmpl   $0x0,-0x1c(%rbp)
jne    1161 <print_int_array+0x51>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jg     1161 <print_int_array+0x51>
jmp    1177 <print_int_array+0x67>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1134 <print_int_array+0x24>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_int_array>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %esi,%esi
jle    1162 <print_int_array+0x42>
mov    %ecx,%r15d
mov    %rdx,%r14
mov    %rdi,%r12
mov    %esi,%ebp
xor    %ebx,%ebx
jmp    1153 <print_int_array+0x33>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1162 <print_int_array+0x42>
mov    (%r12,%rbx,4),%esi
test   %r15d,%r15d
jne    1140 <print_int_array+0x20>
test   %esi,%esi
jle    114a <print_int_array+0x2a>
jmp    1140 <print_int_array+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @print_int_array(i32* nocapture %0, i32 %1, i8* nocapture %2, i32 %3) {
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %20
6: ; preds = %4
%7 = icmp eq i32 %3, 0
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %6, %17
%10 = phi i64 [ 0, %6 ], [ %18, %17 ]
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = icmp slt i32 %12, 1
%14 = select i1 %7, i1 %13, i1 false
br i1 %14, label %17, label %15
15: ; preds = %9
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %2, i32 %12)
br label %17
17: ; preds = %9, %15
%18 = add nuw nsw i64 %10, 1
%19 = icmp eq i64 %18, %8
br i1 %19, label %20, label %9
20: ; preds = %17, %4
%21 = tail call i32 @putchar(i32 10)
ret void
}