#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 printarr(float *T, int n) {
  int i, j;
  for (j = 0; j < n; j++) {
    if (T[j] >= 0) {
      if (T[j] == -0.0)
        T[j] = 0.0;
      printf(" %.2f ", T[j]);
    } else
      printf("%.2f ", T[j]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printarr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11da <printarr+0xca>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     11a8 <printarr+0x98>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe9c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1184 <printarr+0x74>
jp     1184 <printarr+0x74>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe6c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11c7 <printarr+0xb7>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe49(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11cc <printarr+0xbc>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <printarr+0x16>
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printarr>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %esi,%esi
jle    118d <printarr+0x6d>
mov    %rdi,%r15
mov    %esi,%r14d
xor    %ebx,%ebx
lea    0xec9(%rip),%r12
lea    0xec1(%rip),%r13
jmp    1167 <printarr+0x47>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12,%rdi
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
je     118d <printarr+0x6d>
movss  (%r15,%rbx,4),%xmm0
ucomiss 0xe8c(%rip),%xmm0
jb     1150 <printarr+0x30>
mov    %r13,%rdi
jne    1153 <printarr+0x33>
jp     1153 <printarr+0x33>
movl   $0x0,(%r15,%rbx,4)
xorps  %xmm0,%xmm0
mov    %r13,%rdi
jmp    1153 <printarr+0x33>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [7 x i8] c" %.2f \00"
@.str.1 = [6 x i8] c"%.2f \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @printarr(float* %0, i32 %1) {
%3 = alloca float*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store float* %0, float** %3
store i32 %1, i32* %4
store i32 0, i32* %6
br label %7
7: ; preds = %48, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %51
11: ; preds = %7
%12 = load float*, float** %3
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds float, float* %12, i64 %14
%16 = load float, float* %15
%17 = fcmp oge float %16, 0.000000e+00
br i1 %17, label %18, label %39
18: ; preds = %11
%19 = load float*, float** %3
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds float, float* %19, i64 %21
%23 = load float, float* %22
%24 = fpext float %23 to double
%25 = fcmp oeq double %24, -0.000000e+00
br i1 %25, label %26, label %31
26: ; preds = %18
%27 = load float*, float** %3
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds float, float* %27, i64 %29
store float 0.000000e+00, float* %30
br label %31
31: ; preds = %26, %18
%32 = load float*, float** %3
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds float, float* %32, i64 %34
%36 = load float, float* %35
%37 = fpext float %36 to double
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %37)
br label %47
39: ; preds = %11
%40 = load float*, float** %3
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds float, float* %40, i64 %42
%44 = load float, float* %43
%45 = fpext float %44 to double
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %45)
br label %47
47: ; preds = %39, %31
br label %48
48: ; preds = %47
%49 = load i32, i32* %6
%50 = add nsw i32 %49, 1
store i32 %50, i32* %6
br label %7
51: ; preds = %7
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

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