#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*/ getch();
double poly(double, int, double *);
int /*<<< orphan*/ printf(char *, double);
main() {
  double coeffs[] = {1.0, 4.0, 6.0, 4.0, 1.0};
  double x = 1.0, result;
  int degree = 4;
  result = poly(1.0, 4, coeffs);
  printf("The polynomial:x^4+4x^3+6x^2+4x+1 at 1.0 is %lf\n", result);
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movsd  0xea0(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe9b(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe96(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe81(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe6c(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe5f(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x4,-0x44(%rbp)
lea    -0x30(%rbp),%rsi
movsd  0xe47(%rip),%xmm0
mov    $0x4,%edi
call   1050 <poly@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
lea    0xe44(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <getch@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xec5(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xeca(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x20(%rsp)
movsd  0xebe(%rip),%xmm0
mov    %rsp,%rsi
mov    $0x4,%edi
call   1040 <poly@plt>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <getch@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [49 x i8] c"The polynomial:x^4+4x^3+6x^2+4x+1 at 1.0 is %lf\0A\00"
define i32 @main() {
%1 = alloca [5 x double]
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = bitcast [5 x double]* %1 to i8*
%6 = bitcast i8* %5 to [5 x double]*
%7 = getelementptr inbounds [5 x double], [5 x double]* %6, i32 0, i32 0
store double 1.000000e+00, double* %7
%8 = getelementptr inbounds [5 x double], [5 x double]* %6, i32 0, i32 1
store double 4.000000e+00, double* %8
%9 = getelementptr inbounds [5 x double], [5 x double]* %6, i32 0, i32 2
store double 6.000000e+00, double* %9
%10 = getelementptr inbounds [5 x double], [5 x double]* %6, i32 0, i32 3
store double 4.000000e+00, double* %10
%11 = getelementptr inbounds [5 x double], [5 x double]* %6, i32 0, i32 4
store double 1.000000e+00, double* %11
store double 1.000000e+00, double* %2
store i32 4, i32* %4
%12 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%13 = call double @poly(double 1.000000e+00, i32 4, double* %12)
store double %13, double* %3
%14 = load double, double* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), double %14)
%16 = call i32 (...) @getch()
ret i32 0
}

LLVM IR (-O2):
@.str = [49 x i8] c"The polynomial:x^4+4x^3+6x^2+4x+1 at 1.0 is %lf\0A\00"
define i32 @main() {
%1 = alloca [5 x double]
%2 = bitcast [5 x double]* %1 to i8*
%3 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%4 = bitcast [5 x double]* %1 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 4.000000e+00>, <2 x double>* %4
%5 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 2
%6 = bitcast double* %5 to <2 x double>*
store <2 x double> <double 6.000000e+00, double 4.000000e+00>, <2 x double>* %6
%7 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 4
store double 1.000000e+00, double* %7
%8 = call double @poly(double 1.000000e+00, i32 4, double* %3)
%9 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), double %8)
%10 = call i32 (...) @getch()
ret i32 0
}