#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 printArray(double *arr, int arrSize) {
  int i;
  for (i = 0; i <= (arrSize - 1); i++) {
    printf("%s", (i == 0) ? "{" : "");
    printf("%2.2f%s", arr[i], (i == arrSize - 1) ? "}" : ", ");
  }
}


x86 assembly (clang, -O0):
<printArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11a3 <printArray+0x93>
mov    -0x10(%rbp),%ecx
lea    0xecd(%rip),%rsi
lea    0xeb8(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rsi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
lea    0xe92(%rip),%rsi
lea    0xe89(%rip),%rax
cmp    %edx,%ecx
cmove  %rax,%rsi
lea    0xe74(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printArray+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArray>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    118d <printArray+0x7d>
mov    %rdi,%r12
lea    -0x1(%rsi),%r13d
mov    %esi,%ebx
lea    0xedd(%rip),%r14
lea    0xecc(%rip),%r15
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
test   %rbp,%rbp
lea    0xec4(%rip),%rsi
lea    0xeaf(%rip),%rax
cmove  %rax,%rsi
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movsd  (%r12,%rbp,8),%xmm0
cmp    %rbp,%r13
mov    %r14,%rsi
lea    0xe94(%rip),%rax
cmove  %rax,%rsi
mov    %r15,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1140 <printArray+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c"{\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [8 x i8] c"%2.2f%s\00"
@.str.4 = [2 x i8] c"}\00"
@.str.5 = [3 x i8] c", \00"
define void @printArray(double* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %20
4: ; preds = %2
%5 = add nsw i32 %1, -1
%6 = zext i32 %5 to i64
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %18, %8 ]
%10 = icmp eq i64 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds double, double* %0, i64 %9
%14 = load double, double* %13
%15 = icmp eq i64 %9, %6
%16 = select i1 %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double %14, i8* %16)
%18 = add nuw nsw i64 %9, 1
%19 = icmp eq i64 %18, %7
br i1 %19, label %20, label %8
20: ; preds = %8, %2
ret void
}