void printPoly(double coef[], int length) {
  int exponent;
  exponent = length;
  puts("");
  int i;
  for (i = 0; i < length; ++i) {
    if (coef[i] > 0) {
      printf(" + ");
    } else if (coef[i] < 0) {
      printf(" - ");
    } else
      printf(" ");
    if (i < length - 1)
      printf(" %0.2lfx^%d ", fabs(coef[i]), --exponent);
    else
      printf(" %0.2lf ", fabs(coef[i]));
  }
  puts("");
}


x86 assembly (clang, -O0):
<printPoly>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    123d <printPoly+0x11d>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1183 <printPoly+0x63>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11bf <printPoly+0x9f>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
xorps  %xmm0,%xmm0
ucomisd (%rax,%rcx,8),%xmm0
jbe    11ac <printPoly+0x8c>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11ba <printPoly+0x9a>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11bf <printPoly+0x9f>
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1204 <printPoly+0xe4>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xe1c(%rip),%xmm1
pand   %xmm1,%xmm0
mov    -0x10(%rbp),%esi
add    $0xffffffff,%esi
mov    %esi,-0x10(%rbp)
lea    0xe20(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    122a <printPoly+0x10a>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xde8(%rip),%xmm1
pand   %xmm1,%xmm0
lea    0xe02(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    122f <printPoly+0x10f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114a <printPoly+0x2a>
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPoly>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1040 <puts@plt>
test   %r14d,%r14d
jle    11f3 <printPoly+0xc3>
lea    -0x1(%r14),%ebp
mov    %r14d,%r15d
xorpd  %xmm1,%xmm1
lea    0xebb(%rip),%r13
xor    %r12d,%r12d
jmp    1187 <printPoly+0x57>
nop
mov    %r13,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xorpd  %xmm1,%xmm1
add    $0x1,%r12
cmp    %r12,%r15
je     11f3 <printPoly+0xc3>
movsd  (%rbx,%r12,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    11a0 <printPoly+0x70>
lea    0xe76(%rip),%rdi
jmp    11ad <printPoly+0x7d>
nopl   0x0(%rax)
ucomisd %xmm0,%xmm1
jbe    11c0 <printPoly+0x90>
lea    0xe67(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11ca <printPoly+0x9a>
cs nopw 0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
movsd  (%rbx,%r12,8),%xmm0
andps  0xe29(%rip),%xmm0
cmp    %rbp,%r12
jae    1170 <printPoly+0x40>
add    $0xffffffff,%r14d
lea    0xe31(%rip),%rdi
mov    %r14d,%esi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    117a <printPoly+0x4a>
lea    0xe19(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c" + \00"
@.str.2 = [4 x i8] c" - \00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [13 x i8] c" %0.2lfx^%d \00"
@.str.5 = [9 x i8] c" %0.2lf \00"
define void @printPoly(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
store i32 %7, i32* %5
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %9
9: ; preds = %58, %2
%10 = load i32, i32* %6
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %61
13: ; preds = %9
%14 = load double*, double** %3
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds double, double* %14, i64 %16
%18 = load double, double* %17
%19 = fcmp ogt double %18, 0.000000e+00
br i1 %19, label %20, label %22
20: ; preds = %13
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %34
22: ; preds = %13
%23 = load double*, double** %3
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
%27 = load double, double* %26
%28 = fcmp olt double %27, 0.000000e+00
br i1 %28, label %29, label %31
29: ; preds = %22
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %33
31: ; preds = %22
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %33
33: ; preds = %31, %29
br label %34
34: ; preds = %33, %20
%35 = load i32, i32* %6
%36 = load i32, i32* %4
%37 = sub nsw i32 %36, 1
%38 = icmp slt i32 %35, %37
br i1 %38, label %39, label %49
39: ; preds = %34
%40 = load double*, double** %3
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %40, i64 %42
%44 = load double, double* %43
%45 = call double @llvm.fabs.f64(double %44)
%46 = load i32, i32* %5
%47 = add nsw i32 %46, -1
store i32 %47, i32* %5
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double %45, i32 %47)
br label %57
49: ; preds = %34
%50 = load double*, double** %3
%51 = load i32, i32* %6
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double, double* %50, i64 %52
%54 = load double, double* %53
%55 = call double @llvm.fabs.f64(double %54)
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), double %55)
br label %57
57: ; preds = %49, %39
br label %58
58: ; preds = %57
%59 = load i32, i32* %6
%60 = add nsw i32 %59, 1
store i32 %60, i32* %6
br label %9
61: ; preds = %9
%62 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c" + \00"
@.str.2 = [4 x i8] c" - \00"
@.str.4 = [13 x i8] c" %0.2lfx^%d \00"
@.str.5 = [9 x i8] c" %0.2lf \00"
define void @printPoly(double* nocapture %0, i32 %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %36
5: ; preds = %2
%6 = add nsw i32 %1, -1
%7 = zext i32 %6 to i64
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %5, %32
%10 = phi i64 [ 0, %5 ], [ %34, %32 ]
%11 = phi i32 [ %1, %5 ], [ %33, %32 ]
%12 = getelementptr inbounds double, double* %0, i64 %10
%13 = load double, double* %12
%14 = fcmp ogt double %13, 0.000000e+00
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %23
17: ; preds = %9
%18 = fcmp olt double %13, 0.000000e+00
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %23
21: ; preds = %17
%22 = tail call i32 @putchar(i32 32)
br label %23
23: ; preds = %19, %21, %15
%24 = icmp ult i64 %10, %7
%25 = load double, double* %12
%26 = tail call double @llvm.fabs.f64(double %25)
br i1 %24, label %27, label %30
27: ; preds = %23
%28 = add nsw i32 %11, -1
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double %26, i32 %28)
br label %32
30: ; preds = %23
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), double %26)
br label %32
32: ; preds = %27, %30
%33 = phi i32 [ %28, %27 ], [ %11, %30 ]
%34 = add nuw nsw i64 %10, 1
%35 = icmp eq i64 %34, %8
br i1 %35, label %36, label %9
36: ; preds = %32, %2
%37 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret void
}