#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*/ add(double *, int, double *, int, double *);
double definiteIntegral(double *, int, double, double);
int /*<<< orphan*/ differentiate(double *, int, double *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ multiply(double *, int, double *, int, double *);
int /*<<< orphan*/ printPolynomial(double *, int);
int /*<<< orphan*/ printf(char *, ...);
double valueAtPoint(double *, int, double);
int main() {
  double A[] = {1, 2, 3, 4};
  double B[] = {1, 0, 1};
  double C[3 + 2 + 1];
  printf("Polynomial addition:\n");
  add(A, 3, B, 2, C);
  printPolynomial(A, 3);
  printf("\nplus\n");
  printPolynomial(B, 2);
  printf("\nis\n");
  printPolynomial(C, 3);
  printf("\n\n");
  printf("Polynomial multiplication:\n");
  multiply(A, 3, B, 2, C);
  printPolynomial(A, 3);
  printf("\ntimes\n");
  printPolynomial(B, 2);
  printf("\nis\n");
  printPolynomial(C, 5);
  printf("\n\n");
  printf("Polynomial differentiation:\n");
  differentiate(A, 3, C);
  printf("the derivative of\n");
  printPolynomial(A, 3);
  printf("\nis\n");
  printPolynomial(C, 2);
  printf("\n\n");
  printf("Polynomial definite integration:\n");
  printf("the definite integral on [0.1, 0.5] of\n");
  printPolynomial(A, 3);
  printf("\nequals\n");
  printf("%f\n\n", definiteIntegral(A, 3, 0.1, 0.5));
  printf("Evaluating a polynomial at a point:\n");
  printPolynomial(A, 3);
  printf("\nat x = 2 equals\n");
  printf("%f\n\n", valueAtPoint(A, 3, 2));
  printf("Application: Finding roots using Newton's method:\n");
  printf("n = 10 iterations of Newton's method on the polynomial\n");
  printPolynomial(A, 3);
  printf("\nstarting at x = 0 give\n");
  differentiate(A, 3, C);
  double x = 0;
  int i;
  for (i = 0; i <= 10; i++) {
    printf("x_%d = %f\n", i, x);
    x = x - valueAtPoint(A, 3, x) / valueAtPoint(C, 2, x);
  }
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe87(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe84(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe81(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe7e(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe7b(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe78(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe75(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rdx
lea    -0x80(%rbp),%r8
mov    $0x3,%esi
mov    $0x2,%ecx
call   1030 <add@plt>
lea    -0x30(%rbp),%rdi
mov    $0x3,%esi
call   10a0 <printPolynomial@plt>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x2,%esi
call   10a0 <printPolynomial@plt>
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    $0x3,%esi
call   10a0 <printPolynomial@plt>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rdx
lea    -0x80(%rbp),%r8
mov    $0x3,%esi
mov    $0x2,%ecx
call   1040 <multiply@plt>
lea    -0x30(%rbp),%rdi
mov    $0x3,%esi
call   10a0 <printPolynomial@plt>
lea    0xdfc(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x2,%esi
call   10a0 <printPolynomial@plt>
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    $0x5,%esi
call   10a0 <printPolynomial@plt>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    -0x80(%rbp),%rdx
mov    $0x3,%esi
call   1090 <differentiate@plt>
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x3,%esi
call   10a0 <printPolynomial@plt>
lea    0xd59(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    $0x2,%esi
call   10a0 <printPolynomial@plt>
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd88(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x3,%esi
call   10a0 <printPolynomial@plt>
lea    0xda8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x3,%esi
movsd  0xc80(%rip),%xmm0
movsd  0xc80(%rip),%xmm1
call   1070 <definiteIntegral@plt>
lea    0xd85(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xd7c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x3,%esi
call   10a0 <printPolynomial@plt>
lea    0xd85(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x3,%esi
movsd  0xc22(%rip),%xmm0
call   1050 <valueAtPoint@plt>
lea    0xd37(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xd65(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x3,%esi
call   10a0 <printPolynomial@plt>
lea    0xda6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    -0x80(%rbp),%rdx
mov    $0x3,%esi
call   1090 <differentiate@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movl   $0x0,-0x8c(%rbp)
cmpl   $0xa,-0x8c(%rbp)
jg     14f4 <main+0x374>
mov    -0x8c(%rbp),%esi
movsd  -0x88(%rbp),%xmm0
ff
lea    0xd6f(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
lea    -0x30(%rbp),%rdi
movsd  -0x88(%rbp),%xmm0
ff
mov    $0x3,%esi
call   1050 <valueAtPoint@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
lea    -0x80(%rbp),%rdi
movsd  -0x88(%rbp),%xmm0
ff
mov    $0x2,%esi
call   1050 <valueAtPoint@plt>
movsd  -0xa0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x98(%rbp),%xmm0
ff
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    1450 <main+0x2d0>
mov    $0x0,%al
call   1080 <getchar@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
movaps 0xe88(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe6c(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    0xe90(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xe74(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xe90(%rip),%rdi
call   1050 <puts@plt>
lea    0x30(%rsp),%r15
lea    0x10(%rsp),%r13
lea    0x50(%rsp),%r14
mov    %r15,%rdi
mov    $0x3,%esi
mov    %r13,%rdx
mov    $0x2,%ecx
mov    %r14,%r8
call   1030 <add@plt>
mov    %r15,%rdi
mov    $0x3,%esi
call   10b0 <printPolynomial@plt>
lea    0xe65(%rip),%rdi
call   1050 <puts@plt>
mov    %r13,%rdi
mov    $0x2,%esi
call   10b0 <printPolynomial@plt>
lea    0xea2(%rip),%rbx
mov    %rbx,%rdi
call   1050 <puts@plt>
mov    %r14,%rdi
mov    $0x3,%esi
call   10b0 <printPolynomial@plt>
lea    0xe0e(%rip),%r12
mov    %r12,%rdi
call   1050 <puts@plt>
lea    0xe27(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
mov    $0x3,%esi
mov    %r13,%rdx
mov    $0x2,%ecx
mov    %r14,%r8
call   1040 <multiply@plt>
mov    %r15,%rdi
mov    $0x3,%esi
call   10b0 <printPolynomial@plt>
lea    0xe11(%rip),%rdi
call   1050 <puts@plt>
mov    %r13,%rdi
mov    $0x2,%esi
call   10b0 <printPolynomial@plt>
mov    %rbx,%rdi
call   1050 <puts@plt>
mov    %r14,%rdi
mov    $0x5,%esi
call   10b0 <printPolynomial@plt>
mov    %r12,%rdi
call   1050 <puts@plt>
lea    0xde2(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
mov    $0x3,%esi
mov    %r14,%rdx
call   10a0 <differentiate@plt>
lea    0xde2(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
mov    $0x3,%esi
call   10b0 <printPolynomial@plt>
mov    %rbx,%rdi
call   1050 <puts@plt>
mov    %r14,%rdi
mov    $0x2,%esi
call   10b0 <printPolynomial@plt>
mov    %r12,%rdi
call   1050 <puts@plt>
lea    0xdc2(%rip),%rdi
call   1050 <puts@plt>
lea    0xdd7(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
mov    $0x3,%esi
call   10b0 <printPolynomial@plt>
lea    0xde5(%rip),%rdi
call   1050 <puts@plt>
movsd  0xcb9(%rip),%xmm0
movsd  0xcb9(%rip),%xmm1
mov    %r15,%rdi
mov    $0x3,%esi
call   1080 <definiteIntegral@plt>
lea    0xcf5(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1070 <printf@plt>
lea    0xdb3(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
mov    $0x3,%esi
call   10b0 <printPolynomial@plt>
lea    0xdbe(%rip),%rdi
call   1050 <puts@plt>
movsd  0xc76(%rip),%xmm0
mov    %r15,%rdi
mov    $0x3,%esi
call   1060 <valueAtPoint@plt>
mov    %rbx,%rdi
mov    $0x1,%al
call   1070 <printf@plt>
lea    0xda4(%rip),%rdi
call   1050 <puts@plt>
lea    0xdca(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
mov    $0x3,%esi
call   10b0 <printPolynomial@plt>
lea    0xde8(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
mov    $0x3,%esi
mov    %r14,%rdx
call   10a0 <differentiate@plt>
xorpd  %xmm0,%xmm0
xor    %ebp,%ebp
lea    0xc5e(%rip),%rbx
nop
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
mov    %ebp,%esi
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1070 <printf@plt>
mov    %r15,%rdi
mov    $0x3,%esi
movsd  (%rsp),%xmm0
call   1060 <valueAtPoint@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
mov    $0x2,%esi
movsd  (%rsp),%xmm0
call   1060 <valueAtPoint@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  (%rsp),%xmm0
subsd  %xmm1,%xmm0
add    $0x1,%ebp
cmp    $0xb,%ebp
jne    1400 <main+0x270>
xor    %eax,%eax
call   1090 <getchar@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.A = [4 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00]
@__const.main.B = [3 x double] [double 1.000000e+00, double 0.000000e+00, double 1.000000e+00]
@.str = [22 x i8] c"Polynomial addition:\0A\00"
@.str.1 = [7 x i8] c"\0Aplus\0A\00"
@.str.2 = [5 x i8] c"\0Ais\0A\00"
@.str.3 = [3 x i8] c"\0A\0A\00"
@.str.4 = [28 x i8] c"Polynomial multiplication:\0A\00"
@.str.5 = [8 x i8] c"\0Atimes\0A\00"
@.str.6 = [29 x i8] c"Polynomial differentiation:\0A\00"
@.str.7 = [19 x i8] c"the derivative of\0A\00"
@.str.8 = [34 x i8] c"Polynomial definite integration:\0A\00"
@.str.9 = [40 x i8] c"the definite integral on [0.1, 0.5] of\0A\00"
@.str.10 = [9 x i8] c"\0Aequals\0A\00"
@.str.11 = [5 x i8] c"%f\0A\0A\00"
@.str.12 = [37 x i8] c"Evaluating a polynomial at a point:\0A\00"
@.str.13 = [18 x i8] c"\0Aat x = 2 equals\0A\00"
@.str.14 = [51 x i8] c"Application: Finding roots using Newton's method:\0A\00"
@.str.15 = [56 x i8] c"n = 10 iterations of Newton's method on the polynomial\0A\00"
@.str.16 = [25 x i8] c"\0Astarting at x = 0 give\0A\00"
@.str.17 = [11 x i8] c"x_%d = %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x double]
%3 = alloca [3 x double]
%4 = alloca [6 x double]
%5 = alloca double
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [4 x double]* %2 to i8*
%8 = bitcast [3 x double]* %3 to i8*
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 0
%11 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%12 = getelementptr inbounds [6 x double], [6 x double]* %4, i64 0, i64 0
%13 = call i32 @add(double* %10, i32 3, double* %11, i32 2, double* %12)
%14 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 0
%15 = call i32 @printPolynomial(double* %14, i32 3)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%17 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%18 = call i32 @printPolynomial(double* %17, i32 2)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%20 = getelementptr inbounds [6 x double], [6 x double]* %4, i64 0, i64 0
%21 = call i32 @printPolynomial(double* %20, i32 3)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%24 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 0
%25 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%26 = getelementptr inbounds [6 x double], [6 x double]* %4, i64 0, i64 0
%27 = call i32 @multiply(double* %24, i32 3, double* %25, i32 2, double* %26)
%28 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 0
%29 = call i32 @printPolynomial(double* %28, i32 3)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%31 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%32 = call i32 @printPolynomial(double* %31, i32 2)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%34 = getelementptr inbounds [6 x double], [6 x double]* %4, i64 0, i64 0
%35 = call i32 @printPolynomial(double* %34, i32 5)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
%38 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 0
%39 = getelementptr inbounds [6 x double], [6 x double]* %4, i64 0, i64 0
%40 = call i32 @differentiate(double* %38, i32 3, double* %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%42 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 0
%43 = call i32 @printPolynomial(double* %42, i32 3)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%45 = getelementptr inbounds [6 x double], [6 x double]* %4, i64 0, i64 0
%46 = call i32 @printPolynomial(double* %45, i32 2)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0))
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0))
%50 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 0
%51 = call i32 @printPolynomial(double* %50, i32 3)
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0))
%53 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 0
%54 = call double @definiteIntegral(double* %53, i32 3, double 1.000000e-01, double 5.000000e-01)
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), double %54)
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.12, i64 0, i64 0))
%57 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 0
%58 = call i32 @printPolynomial(double* %57, i32 3)
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0))
%60 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 0
%61 = call double @valueAtPoint(double* %60, i32 3, double 2.000000e+00)
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), double %61)
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.14, i64 0, i64 0))
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.15, i64 0, i64 0))
%65 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 0
%66 = call i32 @printPolynomial(double* %65, i32 3)
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.16, i64 0, i64 0))
%68 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 0
%69 = getelementptr inbounds [6 x double], [6 x double]* %4, i64 0, i64 0
%70 = call i32 @differentiate(double* %68, i32 3, double* %69)
store double 0.000000e+00, double* %5
store i32 0, i32* %6
br label %71
71: ; preds = %87, %0
%72 = load i32, i32* %6
%73 = icmp sle i32 %72, 10
br i1 %73, label %74, label %90
74: ; preds = %71
%75 = load i32, i32* %6
%76 = load double, double* %5
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0), i32 %75, double %76)
%78 = load double, double* %5
%79 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 0
%80 = load double, double* %5
%81 = call double @valueAtPoint(double* %79, i32 3, double %80)
%82 = getelementptr inbounds [6 x double], [6 x double]* %4, i64 0, i64 0
%83 = load double, double* %5
%84 = call double @valueAtPoint(double* %82, i32 2, double %83)
%85 = fdiv double %81, %84
%86 = fsub double %78, %85
store double %86, double* %5
br label %87
87: ; preds = %74
%88 = load i32, i32* %6
%89 = add nsw i32 %88, 1
store i32 %89, i32* %6
br label %71
90: ; preds = %71
%91 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.A = [4 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00]
@__const.main.B = [3 x double] [double 1.000000e+00, double 0.000000e+00, double 1.000000e+00]
@.str.11 = [5 x i8] c"%f\0A\0A\00"
@.str.17 = [11 x i8] c"x_%d = %f\0A\00"
@str = [21 x i8] c"Polynomial addition:\00"
@str.18 = [6 x i8] c"\0Aplus\00"
@str.21 = [27 x i8] c"Polynomial multiplication:\00"
@str.22 = [7 x i8] c"\0Atimes\00"
@str.25 = [28 x i8] c"Polynomial differentiation:\00"
@str.26 = [18 x i8] c"the derivative of\00"
@str.27 = [4 x i8] c"\0Ais\00"
@str.28 = [2 x i8] c"\0A\00"
@str.29 = [33 x i8] c"Polynomial definite integration:\00"
@str.30 = [39 x i8] c"the definite integral on [0.1, 0.5] of\00"
@str.31 = [8 x i8] c"\0Aequals\00"
@str.32 = [36 x i8] c"Evaluating a polynomial at a point:\00"
@str.33 = [17 x i8] c"\0Aat x = 2 equals\00"
@str.34 = [50 x i8] c"Application: Finding roots using Newton's method:\00"
@str.35 = [55 x i8] c"n = 10 iterations of Newton's method on the polynomial\00"
@str.36 = [24 x i8] c"\0Astarting at x = 0 give\00"
define i32 @main() {
%1 = alloca [4 x double]
%2 = alloca [3 x double]
%3 = alloca [6 x double]
%4 = bitcast [4 x double]* %1 to i8*
%5 = bitcast [3 x double]* %2 to i8*
%6 = bitcast [6 x double]* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%8 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 0
%9 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%10 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 0
%11 = call i32 @add(double* %8, i32 3, double* %9, i32 2, double* %10)
%12 = call i32 @printPolynomial(double* %8, i32 3)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.18, i64 0, i64 0))
%14 = call i32 @printPolynomial(double* %9, i32 2)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.27, i64 0, i64 0))
%16 = call i32 @printPolynomial(double* %10, i32 3)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.28, i64 0, i64 0))
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.21, i64 0, i64 0))
%19 = call i32 @multiply(double* %8, i32 3, double* %9, i32 2, double* %10)
%20 = call i32 @printPolynomial(double* %8, i32 3)
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.22, i64 0, i64 0))
%22 = call i32 @printPolynomial(double* %9, i32 2)
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.27, i64 0, i64 0))
%24 = call i32 @printPolynomial(double* %10, i32 5)
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.28, i64 0, i64 0))
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.25, i64 0, i64 0))
%27 = call i32 @differentiate(double* %8, i32 3, double* %10)
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.26, i64 0, i64 0))
%29 = call i32 @printPolynomial(double* %8, i32 3)
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.27, i64 0, i64 0))
%31 = call i32 @printPolynomial(double* %10, i32 2)
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.28, i64 0, i64 0))
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.29, i64 0, i64 0))
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.30, i64 0, i64 0))
%35 = call i32 @printPolynomial(double* %8, i32 3)
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.31, i64 0, i64 0))
%37 = call double @definiteIntegral(double* %8, i32 3, double 1.000000e-01, double 5.000000e-01)
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), double %37)
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.32, i64 0, i64 0))
%40 = call i32 @printPolynomial(double* %8, i32 3)
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.33, i64 0, i64 0))
%42 = call double @valueAtPoint(double* %8, i32 3, double 2.000000e+00)
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), double %42)
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.34, i64 0, i64 0))
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.35, i64 0, i64 0))
%46 = call i32 @printPolynomial(double* %8, i32 3)
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.36, i64 0, i64 0))
%48 = call i32 @differentiate(double* %8, i32 3, double* %10)
br label %49
49: ; preds = %0, %49
%50 = phi i32 [ 0, %0 ], [ %57, %49 ]
%51 = phi double [ 0.000000e+00, %0 ], [ %56, %49 ]
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0), i32 %50, double %51)
%53 = call double @valueAtPoint(double* %8, i32 3, double %51)
%54 = call double @valueAtPoint(double* %10, i32 2, double %51)
%55 = fdiv double %53, %54
%56 = fsub double %51, %55
%57 = add nuw nsw i32 %50, 1
%58 = icmp eq i32 %57, 11
br i1 %58, label %59, label %49
59: ; preds = %49
%60 = call i32 (...) @getchar()
ret i32 0
}