#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 */
double f(double *, int);
int /*<<< orphan*/ polyadd(double *, double *, double *);
int /*<<< orphan*/ polyprint(double *);
int /*<<< orphan*/ printf(char *, double);
int main(void) {
  double p[] = {1, 2, 0, -3, 99999999};
  double q[] = {2, -1, 99999999};
  double r[100];
  polyadd(r, p, q);
  polyprint(r);
  printf("p(2) = %.1f\n", f(p, 2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x370,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1060 <memset@plt>
movsd  0xe9e(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe89(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe74(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe5f(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    0xe73(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe70(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe6d(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    -0x370(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x50(%rbp),%rdx
call   1070 <polyadd@plt>
lea    -0x370(%rbp),%rdi
call   1040 <polyprint@plt>
lea    -0x30(%rbp),%rdi
mov    $0x2,%esi
call   1030 <f@plt>
lea    0xe3c(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x370,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x378,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeab(%rip),%xmm0
movups %xmm0,0x38(%rsp)
mov    0xebf(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xea3(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x50(%rsp),%rbx
lea    0x20(%rsp),%r14
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <polyadd@plt>
mov    %rbx,%rdi
call   1040 <polyprint@plt>
mov    %r14,%rdi
mov    $0x2,%esi
call   1030 <f@plt>
lea    0xe83(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x378,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.q = [3 x double] [double 2.000000e+00, double -1.000000e+00, double 0x4197D783FC000000]
@.str = [13 x i8] c"p(2) = %.1f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x double]
%3 = alloca [3 x double]
%4 = alloca [100 x double]
store i32 0, i32* %1
%5 = bitcast [5 x double]* %2 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 2.000000e+00, double* %8
%9 = getelementptr inbounds [5 x double], [5 x double]* %6, i32 0, i32 3
store double -3.000000e+00, double* %9
%10 = getelementptr inbounds [5 x double], [5 x double]* %6, i32 0, i32 4
store double 0x4197D783FC000000, double* %10
%11 = bitcast [3 x double]* %3 to i8*
%12 = getelementptr inbounds [100 x double], [100 x double]* %4, i64 0, i64 0
%13 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 0
%14 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%15 = call i32 @polyadd(double* %12, double* %13, double* %14)
%16 = getelementptr inbounds [100 x double], [100 x double]* %4, i64 0, i64 0
%17 = call i32 @polyprint(double* %16)
%18 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 0
%19 = call double @f(double* %18, i32 2)
%20 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double %19)
ret i32 0
}

LLVM IR (-O2):
@__const.main.q = [3 x double] [double 2.000000e+00, double -1.000000e+00, double 0x4197D783FC000000]
@.str = [13 x i8] c"p(2) = %.1f\0A\00"
define i32 @main() {
%1 = alloca [5 x double]
%2 = alloca [3 x double]
%3 = alloca [100 x double]
%4 = bitcast [5 x double]* %1 to i8*
%5 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 2
%6 = bitcast double* %5 to i8*
%7 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%8 = bitcast [5 x double]* %1 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 2.000000e+00>, <2 x double>* %8
%9 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 3
%10 = bitcast double* %9 to <2 x double>*
store <2 x double> <double -3.000000e+00, double 0x4197D783FC000000>, <2 x double>* %10
%11 = bitcast [3 x double]* %2 to i8*
%12 = bitcast [100 x double]* %3 to i8*
%13 = getelementptr inbounds [100 x double], [100 x double]* %3, i64 0, i64 0
%14 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%15 = call i32 @polyadd(double* %13, double* %7, double* %14)
%16 = call i32 @polyprint(double* %13)
%17 = call double @f(double* %7, i32 2)
%18 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double %17)
ret i32 0
}