#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_double_array(double *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_double_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    118b <print_double_array+0x7b>
cmpl   $0x0,-0x1c(%rbp)
jne    1165 <print_double_array+0x55>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
xorps  %xmm0,%xmm0
ucomisd (%rax,%rcx,8),%xmm0
jb     1165 <print_double_array+0x55>
jmp    117d <print_double_array+0x6d>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1134 <print_double_array+0x24>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_double_array>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %esi,%esi
jle    116a <print_double_array+0x4a>
mov    %ecx,%r15d
mov    %rdx,%r14
mov    %rdi,%r12
mov    %esi,%ebp
xor    %ebx,%ebx
jmp    1153 <print_double_array+0x33>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
je     116a <print_double_array+0x4a>
movsd  (%r12,%rbx,8),%xmm0
test   %r15d,%r15d
jne    1140 <print_double_array+0x20>
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jae    114a <print_double_array+0x2a>
jmp    1140 <print_double_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_double_array(double* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca double*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store double* %0, double** %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 double*, double** %5
%19 = load i32, i32* %9
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double, double* %18, i64 %20
%22 = load double, double* %21
%23 = fcmp ole double %22, 0.000000e+00
br i1 %23, label %24, label %25
24: ; preds = %17
br label %33
25: ; preds = %17, %14
%26 = load i8*, i8** %7
%27 = load double*, double** %5
%28 = load i32, i32* %9
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %27, i64 %29
%31 = load double, double* %30
%32 = call i32 (i8*, ...) @printf(i8* %26, double %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_double_array(double* 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 ne 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 double, double* %0, i64 %10
%12 = load double, double* %11
%13 = fcmp ugt double %12, 0.000000e+00
%14 = select i1 %7, i1 true, i1 %13
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %2, double %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
}