#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 + 1; 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
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11df <printarr+0xcf>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     11ad <printarr+0x9d>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe97(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1189 <printarr+0x79>
jp     1189 <printarr+0x79>
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    0xe67(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11cc <printarr+0xbc>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe44(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11d1 <printarr+0xc1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <printarr+0x16>
lea    0xe29(%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
js     118d <printarr+0x6d>
mov    %esi,%r14d
mov    %rdi,%r15
add    $0x1,%r14d
xor    %ebx,%ebx
lea    0xec5(%rip),%r12
lea    0xebd(%rip),%r13
jmp    1167 <printarr+0x47>
nopl   0x0(%rax)
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 = %49, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = add nsw i32 %9, 1
%11 = icmp slt i32 %8, %10
br i1 %11, label %12, label %52
12: ; preds = %7
%13 = load float*, float** %3
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds float, float* %13, i64 %15
%17 = load float, float* %16
%18 = fcmp oge float %17, 0.000000e+00
br i1 %18, label %19, label %40
19: ; preds = %12
%20 = load float*, float** %3
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds float, float* %20, i64 %22
%24 = load float, float* %23
%25 = fpext float %24 to double
%26 = fcmp oeq double %25, -0.000000e+00
br i1 %26, label %27, label %32
27: ; preds = %19
%28 = load float*, float** %3
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds float, float* %28, i64 %30
store float 0.000000e+00, float* %31
br label %32
32: ; preds = %27, %19
%33 = load float*, float** %3
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds float, float* %33, i64 %35
%37 = load float, float* %36
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %38)
br label %48
40: ; preds = %12
%41 = load float*, float** %3
%42 = load i32, i32* %6
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds float, float* %41, i64 %43
%45 = load float, float* %44
%46 = fpext float %45 to double
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %46)
br label %48
48: ; preds = %40, %32
br label %49
49: ; preds = %48
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
br label %7
52: ; preds = %7
%53 = 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 slt i32 %1, 0
br i1 %3, label %22, label %4
4: ; preds = %2
%5 = add nuw i32 %1, 1
%6 = zext i32 %5 to i64
br label %7
7: ; preds = %4, %15
%8 = phi i64 [ 0, %4 ], [ %20, %15 ]
%9 = getelementptr inbounds float, float* %0, i64 %8
%10 = load float, float* %9
%11 = fcmp ult float %10, 0.000000e+00
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = fcmp oeq float %10, 0.000000e+00
br i1 %13, label %14, label %15
14: ; preds = %12
store float 0.000000e+00, float* %9
br label %15
15: ; preds = %7, %12, %14
%16 = phi float [ 0.000000e+00, %14 ], [ %10, %12 ], [ %10, %7 ]
%17 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %14 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %12 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %7 ]
%18 = fpext float %16 to double
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %17, double %18)
%20 = add nuw nsw i64 %8, 1
%21 = icmp eq i64 %20, %6
br i1 %21, label %22, label %7
22: ; preds = %15, %2
%23 = tail call i32 @putchar(i32 10)
ret void
}