#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 *, double, int);
void printEquation(double *eqCoef, size_t degree) {
  for (int i = degree; i >= 0; i--)
    if (i > 0)
      printf("%.4gx^%d + ", eqCoef[i], i);
    else
      printf("%.4g = 0\n", eqCoef[i], i);
}


x86 assembly (clang, -O0):
<printEquation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     118b <printEquation+0x7b>
cmpl   $0x0,-0x14(%rbp)
jle    115c <printEquation+0x4c>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x14(%rbp),%esi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
jmp    1178 <printEquation+0x68>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x14(%rbp),%esi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
jmp    117d <printEquation+0x6d>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <printEquation+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printEquation>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
test   $0x80000000,%ebx
jne    116e <printEquation+0x5e>
mov    %rdi,%r14
mov    $0xffffffff,%eax
and    %rax,%rbx
je     1156 <printEquation+0x46>
lea    0xecc(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%r14,%rbx,8),%xmm0
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0xffffffffffffffff,%rbx
jne    1140 <printEquation+0x30>
movsd  (%r14),%xmm0
lea    0xeaa(%rip),%rdi
xor    %esi,%esi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <printf@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%.4gx^%d + \00"
@.str.1 = [10 x i8] c"%.4g = 0\0A\00"
define void @printEquation(double* %0, i64 %1) {
%3 = alloca double*
%4 = alloca i64
%5 = alloca i32
store double* %0, double** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = trunc i64 %6 to i32
store i32 %7, i32* %5
br label %8
8: ; preds = %31, %2
%9 = load i32, i32* %5
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %34
11: ; preds = %8
%12 = load i32, i32* %5
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %22
14: ; preds = %11
%15 = load double*, double** %3
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds double, double* %15, i64 %17
%19 = load double, double* %18
%20 = load i32, i32* %5
%21 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %19, i32 %20)
br label %30
22: ; preds = %11
%23 = load double*, double** %3
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
%27 = load double, double* %26
%28 = load i32, i32* %5
%29 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %27, i32 %28)
br label %30
30: ; preds = %22, %14
br label %31
31: ; preds = %30
%32 = load i32, i32* %5
%33 = add nsw i32 %32, -1
store i32 %33, i32* %5
br label %8
34: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"%.4gx^%d + \00"
@.str.1 = [10 x i8] c"%.4g = 0\0A\00"
define void @printEquation(double* nocapture %0, i64 %1) {
%3 = and i64 %1, 2147483648
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = and i64 %1, 4294967295
%7 = icmp eq i64 %6, 0
br i1 %7, label %9, label %12
8: ; preds = %9, %2
ret void
9: ; preds = %12, %5
%10 = load double, double* %0
%11 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %10, i32 0)
br label %8
12: ; preds = %5, %12
%13 = phi i64 [ %18, %12 ], [ %6, %5 ]
%14 = getelementptr inbounds double, double* %0, i64 %13
%15 = load double, double* %14
%16 = trunc i64 %13 to i32
%17 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %15, i32 %16)
%18 = add nsw i64 %13, -1
%19 = icmp eq i64 %18, 0
br i1 %19, label %9, label %12
}