#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void px_sfuncao(long double *degrees, unsigned long size, FILE *outfile) {
  unsigned long i;
  fprintf(outfile, "Função Simplificada P(x)~ ");
  if (degrees[size - 1] != 0)
    fprintf(outfile, "%Lf*x^%lu", degrees[size - 1], size - 1);
  for (i = size - 2; i > 0; i--) {
    if (degrees[i] != 0) {
      fprintf(outfile, "%s%Lf", ((degrees[i] < 0) ? " - " : " + "),
              ((degrees[i] < 0) ? -degrees[i] : degrees[i]));
      if (i != 1)
        fprintf(outfile, "*x^%lu", i);
      else
        fprintf(outfile, "*x");
    }
  }
  if (degrees[i] != 0)
    fprintf(outfile, "%s%Lf\n", ((degrees[i] < 0) ? " - " : " + "),
            ((degrees[i] < 0) ? -degrees[i] : degrees[i]));
  else
    fprintf(outfile, "\n");
}


x86 assembly (clang, -O0):
<px_sfuncao>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xed1(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
shl    $0x4,%rax
fldt   -0x10(%rax,%rcx,1)
fldz
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    115f <px_sfuncao+0x4f>
jp     115f <px_sfuncao+0x4f>
jmp    118e <px_sfuncao+0x7e>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
shl    $0x4,%rax
fldt   -0x10(%rax,%rcx,1)
mov    -0x10(%rbp),%rdx
sub    $0x1,%rdx
mov    %rsp,%rax
fstpt  (%rax)
lea    0xe96(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rax
sub    $0x2,%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jbe    12ad <px_sfuncao+0x19d>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
fldz
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    11cd <px_sfuncao+0xbd>
jp     11cd <px_sfuncao+0xbd>
jmp    1297 <px_sfuncao+0x187>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
fldz
fucomip %st(1),%st
fstp   %st(0)
lea    0xe3c(%rip),%rcx
lea    0xe39(%rip),%rax
cmova  %rcx,%rax
mov    %rax,-0x28(%rbp)
jbe    122a <px_sfuncao+0x11a>
jmp    120b <px_sfuncao+0xfb>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
shl    $0x4,%rcx
mov    %rax,%rdx
add    %rcx,%rdx
fldt   (%rax,%rcx,1)
fchs
fstpt  -0x3c(%rbp)
jmp    123c <px_sfuncao+0x12c>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
fstpt  -0x3c(%rbp)
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rdi
fldt   -0x3c(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xdd4(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
cmpq   $0x1,-0x20(%rbp)
je     1280 <px_sfuncao+0x170>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xdac(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1292 <px_sfuncao+0x182>
mov    -0x18(%rbp),%rdi
lea    0xdaa(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1297 <px_sfuncao+0x187>
jmp    129c <px_sfuncao+0x18c>
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    119a <px_sfuncao+0x8a>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
fldz
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    12d5 <px_sfuncao+0x1c5>
jp     12d5 <px_sfuncao+0x1c5>
jmp    1367 <px_sfuncao+0x257>
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
fldz
fucomip %st(1),%st
fstp   %st(0)
lea    0xd34(%rip),%rcx
lea    0xd31(%rip),%rax
cmova  %rcx,%rax
mov    %rax,-0x48(%rbp)
jbe    1332 <px_sfuncao+0x222>
jmp    1313 <px_sfuncao+0x203>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
shl    $0x4,%rcx
mov    %rax,%rdx
add    %rcx,%rdx
fldt   (%rax,%rcx,1)
fchs
fstpt  -0x5c(%rbp)
jmp    1344 <px_sfuncao+0x234>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
shl    $0x4,%rcx
fldt   (%rax,%rcx,1)
fstpt  -0x5c(%rbp)
mov    -0x48(%rbp),%rdx
mov    -0x50(%rbp),%rdi
fldt   -0x5c(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xcdd(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    1379 <px_sfuncao+0x269>
mov    -0x18(%rbp),%rdi
lea    0xccb(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<px_sfuncao>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xeb2(%rip),%rdi
mov    $0x1c,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    -0x1(%r14),%rdx
mov    %rdx,%rax
shl    $0x4,%rax
mov    %rbx,0x20(%rsp)
fldt   (%rbx,%rax,1)
fldz
fxch   %st(1)
fucomi %st(1),%st
fld    %st(1)
fstpt  0x14(%rsp)
jne    1183 <px_sfuncao+0x53>
jnp    119f <px_sfuncao+0x6f>
fstp   %st(1)
fstpt  (%rsp)
lea    0xe8e(%rip),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <fprintf@plt>
fldt   0x14(%rsp)
fldz
fstp   %st(0)
mov    %r14,%rbx
add    $0xfffffffffffffffe,%rbx
je     1250 <px_sfuncao+0x120>
add    $0xfffffffffffffffd,%r14
shl    $0x4,%rbx
add    0x20(%rsp),%rbx
lea    0xe65(%rip),%r12
lea    0xe57(%rip),%r13
jmp    11dc <px_sfuncao+0xac>
nopl   0x0(%rax,%rax,1)
fstp   %st(0)
add    $0xfffffffffffffff0,%rbx
add    $0xffffffffffffffff,%r14
jae    1250 <px_sfuncao+0x120>
fldt   (%rbx)
fucomi %st(1),%st
jne    11e4 <px_sfuncao+0xb4>
jnp    11d0 <px_sfuncao+0xa0>
lea    0x1(%r14),%rbp
fxch   %st(1)
fucomip %st(1),%st
lea    0xe3a(%rip),%rdx
ja     11fc <px_sfuncao+0xcc>
lea    0xe35(%rip),%rdx
fld    %st(0)
fchs
fxch   %st(1)
fcmovnbe %st(1),%st
fstp   %st(1)
fstpt  (%rsp)
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %r14,%r14
je     1233 <px_sfuncao+0x103>
mov    %r15,%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
fldt   0x14(%rsp)
fldz
jmp    11d0 <px_sfuncao+0xa0>
lea    0xdfb(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
fldt   0x14(%rsp)
mov    0x20(%rsp),%rax
fldt   (%rax)
fucomi %st(1),%st
jne    125d <px_sfuncao+0x12d>
jnp    12a0 <px_sfuncao+0x170>
fxch   %st(1)
fucomip %st(1),%st
lea    0xdc5(%rip),%rax
lea    0xdc2(%rip),%rdx
cmova  %rax,%rdx
fld    %st(0)
fchs
fxch   %st(1)
fcmovnbe %st(1),%st
fstp   %st(1)
fstpt  (%rsp)
lea    0xdb1(%rip),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
fstp   %st(0)
fstp   %st(0)
mov    $0xa,%edi
mov    %r15,%rsi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"Fun\C3\A7\C3\A3o Simplificada P(x)~ \00"
@.str.1 = [10 x i8] c"%Lf*x^%lu\00"
@.str.2 = [6 x i8] c"%s%Lf\00"
@.str.3 = [4 x i8] c" - \00"
@.str.4 = [4 x i8] c" + \00"
@.str.5 = [7 x i8] c"*x^%lu\00"
@.str.6 = [3 x i8] c"*x\00"
@.str.7 = [7 x i8] c"%s%Lf\0A\00"
@.str.8 = [2 x i8] c"\0A\00"
define void @px_sfuncao(x86_fp80* %0, i64 %1, i32* %2) {
%4 = alloca x86_fp80*
%5 = alloca i64
%6 = alloca i32*
%7 = alloca i64
store x86_fp80* %0, x86_fp80** %4
store i64 %1, i64* %5
store i32* %2, i32** %6
%8 = load i32*, i32** %6
%9 = call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%10 = load x86_fp80*, x86_fp80** %4
%11 = load i64, i64* %5
%12 = sub i64 %11, 1
%13 = getelementptr inbounds x86_fp80, x86_fp80* %10, i64 %12
%14 = load x86_fp80, x86_fp80* %13
%15 = fcmp une x86_fp80 %14, 0xK00000000000000000000
br i1 %15, label %16, label %26
16: ; preds = %3
%17 = load i32*, i32** %6
%18 = load x86_fp80*, x86_fp80** %4
%19 = load i64, i64* %5
%20 = sub i64 %19, 1
%21 = getelementptr inbounds x86_fp80, x86_fp80* %18, i64 %20
%22 = load x86_fp80, x86_fp80* %21
%23 = load i64, i64* %5
%24 = sub i64 %23, 1
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), x86_fp80 %22, i64 %24)
br label %26
26: ; preds = %16, %3
%27 = load i64, i64* %5
%28 = sub i64 %27, 2
store i64 %28, i64* %7
br label %29
29: ; preds = %77, %26
%30 = load i64, i64* %7
%31 = icmp ugt i64 %30, 0
br i1 %31, label %32, label %80
32: ; preds = %29
%33 = load x86_fp80*, x86_fp80** %4
%34 = load i64, i64* %7
%35 = getelementptr inbounds x86_fp80, x86_fp80* %33, i64 %34
%36 = load x86_fp80, x86_fp80* %35
%37 = fcmp une x86_fp80 %36, 0xK00000000000000000000
br i1 %37, label %38, label %76
38: ; preds = %32
%39 = load i32*, i32** %6
%40 = load x86_fp80*, x86_fp80** %4
%41 = load i64, i64* %7
%42 = getelementptr inbounds x86_fp80, x86_fp80* %40, i64 %41
%43 = load x86_fp80, x86_fp80* %42
%44 = fcmp olt x86_fp80 %43, 0xK00000000000000000000
%45 = zext i1 %44 to i64
%46 = select i1 %44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%47 = load x86_fp80*, x86_fp80** %4
%48 = load i64, i64* %7
%49 = getelementptr inbounds x86_fp80, x86_fp80* %47, i64 %48
%50 = load x86_fp80, x86_fp80* %49
%51 = fcmp olt x86_fp80 %50, 0xK00000000000000000000
br i1 %51, label %52, label %58
52: ; preds = %38
%53 = load x86_fp80*, x86_fp80** %4
%54 = load i64, i64* %7
%55 = getelementptr inbounds x86_fp80, x86_fp80* %53, i64 %54
%56 = load x86_fp80, x86_fp80* %55
%57 = fneg x86_fp80 %56
br label %63
58: ; preds = %38
%59 = load x86_fp80*, x86_fp80** %4
%60 = load i64, i64* %7
%61 = getelementptr inbounds x86_fp80, x86_fp80* %59, i64 %60
%62 = load x86_fp80, x86_fp80* %61
br label %63
63: ; preds = %58, %52
%64 = phi x86_fp80 [ %57, %52 ], [ %62, %58 ]
%65 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %46, x86_fp80 %64)
%66 = load i64, i64* %7
%67 = icmp ne i64 %66, 1
br i1 %67, label %68, label %72
68: ; preds = %63
%69 = load i32*, i32** %6
%70 = load i64, i64* %7
%71 = call i32 (i32*, i8*, ...) @fprintf(i32* %69, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i64 %70)
br label %75
72: ; preds = %63
%73 = load i32*, i32** %6
%74 = call i32 (i32*, i8*, ...) @fprintf(i32* %73, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %75
75: ; preds = %72, %68
br label %76
76: ; preds = %75, %32
br label %77
77: ; preds = %76
%78 = load i64, i64* %7
%79 = add i64 %78, -1
store i64 %79, i64* %7
br label %29
80: ; preds = %29
%81 = load x86_fp80*, x86_fp80** %4
%82 = load i64, i64* %7
%83 = getelementptr inbounds x86_fp80, x86_fp80* %81, i64 %82
%84 = load x86_fp80, x86_fp80* %83
%85 = fcmp une x86_fp80 %84, 0xK00000000000000000000
br i1 %85, label %86, label %114
86: ; preds = %80
%87 = load i32*, i32** %6
%88 = load x86_fp80*, x86_fp80** %4
%89 = load i64, i64* %7
%90 = getelementptr inbounds x86_fp80, x86_fp80* %88, i64 %89
%91 = load x86_fp80, x86_fp80* %90
%92 = fcmp olt x86_fp80 %91, 0xK00000000000000000000
%93 = zext i1 %92 to i64
%94 = select i1 %92, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%95 = load x86_fp80*, x86_fp80** %4
%96 = load i64, i64* %7
%97 = getelementptr inbounds x86_fp80, x86_fp80* %95, i64 %96
%98 = load x86_fp80, x86_fp80* %97
%99 = fcmp olt x86_fp80 %98, 0xK00000000000000000000
br i1 %99, label %100, label %106
100: ; preds = %86
%101 = load x86_fp80*, x86_fp80** %4
%102 = load i64, i64* %7
%103 = getelementptr inbounds x86_fp80, x86_fp80* %101, i64 %102
%104 = load x86_fp80, x86_fp80* %103
%105 = fneg x86_fp80 %104
br label %111
106: ; preds = %86
%107 = load x86_fp80*, x86_fp80** %4
%108 = load i64, i64* %7
%109 = getelementptr inbounds x86_fp80, x86_fp80* %107, i64 %108
%110 = load x86_fp80, x86_fp80* %109
br label %111
111: ; preds = %106, %100
%112 = phi x86_fp80 [ %105, %100 ], [ %110, %106 ]
%113 = call i32 (i32*, i8*, ...) @fprintf(i32* %87, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* %94, x86_fp80 %112)
br label %117
114: ; preds = %80
%115 = load i32*, i32** %6
%116 = call i32 (i32*, i8*, ...) @fprintf(i32* %115, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %117
117: ; preds = %114, %111
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"Fun\C3\A7\C3\A3o Simplificada P(x)~ \00"
@.str.1 = [10 x i8] c"%Lf*x^%lu\00"
@.str.2 = [6 x i8] c"%s%Lf\00"
@.str.3 = [4 x i8] c" - \00"
@.str.4 = [4 x i8] c" + \00"
@.str.5 = [7 x i8] c"*x^%lu\00"
@.str.6 = [3 x i8] c"*x\00"
@.str.7 = [7 x i8] c"%s%Lf\0A\00"
define void @px_sfuncao(x86_fp80* nocapture %0, i64 %1, i32* nocapture %2) {
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i64 28, i64 1, i32* %2)
%5 = add i64 %1, -1
%6 = getelementptr inbounds x86_fp80, x86_fp80* %0, i64 %5
%7 = load x86_fp80, x86_fp80* %6
%8 = fcmp une x86_fp80 %7, 0xK00000000000000000000
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), x86_fp80 %7, i64 %5)
br label %11
11: ; preds = %9, %3
%12 = add i64 %1, -2
%13 = icmp eq i64 %12, 0
br i1 %13, label %33, label %14
14: ; preds = %11, %30
%15 = phi i64 [ %31, %30 ], [ %12, %11 ]
%16 = getelementptr inbounds x86_fp80, x86_fp80* %0, i64 %15
%17 = load x86_fp80, x86_fp80* %16
%18 = fcmp une x86_fp80 %17, 0xK00000000000000000000
br i1 %18, label %19, label %30
19: ; preds = %14
%20 = fcmp olt x86_fp80 %17, 0xK00000000000000000000
%21 = select i1 %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%22 = fneg x86_fp80 %17
%23 = select i1 %20, x86_fp80 %22, x86_fp80 %17
%24 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %21, x86_fp80 %23)
%25 = icmp eq i64 %15, 1
br i1 %25, label %28, label %26
26: ; preds = %19
%27 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i64 %15)
br label %30
28: ; preds = %19
%29 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i64 2, i64 1, i32* %2)
br label %33
30: ; preds = %14, %26
%31 = add i64 %15, -1
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %14
33: ; preds = %30, %28, %11
%34 = load x86_fp80, x86_fp80* %0
%35 = fcmp une x86_fp80 %34, 0xK00000000000000000000
br i1 %35, label %36, label %42
36: ; preds = %33
%37 = fcmp olt x86_fp80 %34, 0xK00000000000000000000
%38 = select i1 %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%39 = fneg x86_fp80 %34
%40 = select i1 %37, x86_fp80 %39, x86_fp80 %34
%41 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* %38, x86_fp80 %40)
br label %44
42: ; preds = %33
%43 = tail call i32 @fputc(i32 10, i32* %2)
br label %44
44: ; preds = %42, %36
ret void
}