#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 exp(int);
double fabs(double);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int pow(double, int);
int /*<<< orphan*/ printf(char *, double, double);
int /*<<< orphan*/ system(char *);
double yp(double, double);
int ypp(double, double);
int main() {
  double a = 0;
  double b = 1;
  double *X;
  double *Y;
  double *Yp;
  double error;
  double sol = (-1 + 5 * exp(1 / 2.));
  double h;
  int n;
  int i;
  h = 0.1;
  n = (b - a) / h + 1;
  X = (double *)malloc((n + 1) * sizeof(double));
  Y = (double *)malloc((n + 1) * sizeof(double));
  X[0] = a;
  Y[0] = 4;
  for (i = 1; i < n + 1; i++) {
    X[i] = X[i - 1] + h;
    Y[i] = Y[i - 1] + yp(X[i - 1], Y[i - 1]) * h +
           ypp(X[i - 1], Y[i - 1]) * pow(h, 2) / 2;
  }
  error = fabs(sol - Y[n]);
  printf("Para x=1 y con h=%lf:\n error:%lf\n", h, error);
  free(X);
  free(Y);
  h = 0.01;
  n = (b - a) / h + 1;
  X = (double *)malloc((n + 1) * sizeof(double));
  Y = (double *)malloc((n + 1) * sizeof(double));
  X[0] = a;
  Y[0] = 4;
  for (i = 1; i < n + 1; i++) {
    X[i] = X[i - 1] + h;
    Y[i] = Y[i - 1] + yp(X[i - 1], Y[i - 1]) * h +
           ypp(X[i - 1], Y[i - 1]) * pow(h, 2) / 2;
  }
  error = fabs(sol - Y[n]);
  printf("Para x=1 y con h=%lf:\n error:%lf\n", h, error);
  free(X);
  free(Y);
  h = 0.001;
  n = (b - a) / h + 1;
  X = (double *)malloc((n + 1) * sizeof(double));
  Y = (double *)malloc((n + 1) * sizeof(double));
  X[0] = a;
  Y[0] = 4;
  for (i = 1; i < n + 1; i++) {
    X[i] = X[i - 1] + h;
    Y[i] = Y[i - 1] + yp(X[i - 1], Y[i - 1]) * h +
           ypp(X[i - 1], Y[i - 1]) * pow(h, 2) / 2;
  }
  error = fabs(sol - Y[n]);
  printf("Para x=1 y con h=%lf:\n error:%lf\n", h, error);
  free(X);
  free(Y);
  system("PAUSE");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe66(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
xor    %edi,%edi
call   1080 <exp@plt>
imul   $0x5,%eax,%eax
add    $0xffffffff,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe49(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  0xe25(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  0xdcb(%rip),%xmm0
movsd  %xmm0,(%rax)
movl   $0x1,-0x50(%rbp)
mov    -0x50(%rbp),%eax
mov    -0x4c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    133f <main+0x1bf>
mov    -0x20(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x48(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
call   10a0 <yp@plt>
movsd  -0x68(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
call   1060 <ypp@plt>
mov    %eax,-0x54(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    $0x2,%edi
call   1090 <pow@plt>
movsd  -0x60(%rbp),%xmm0
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1240 <main+0xc0>
movsd  -0x40(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movaps 0xcd8(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
lea    0xcce(%rip),%rdi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movsd  0xc87(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  0xc5b(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  0xc01(%rip),%xmm0
movsd  %xmm0,(%rax)
movl   $0x1,-0x50(%rbp)
mov    -0x50(%rbp),%eax
mov    -0x4c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1509 <main+0x389>
mov    -0x20(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x48(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
call   10a0 <yp@plt>
movsd  -0x80(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
call   1060 <ypp@plt>
mov    %eax,-0x6c(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    $0x2,%edi
call   1090 <pow@plt>
movsd  -0x78(%rbp),%xmm0
mov    %eax,%ecx
mov    -0x6c(%rbp),%eax
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    140a <main+0x28a>
movsd  -0x40(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movaps 0xb0e(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
lea    0xb04(%rip),%rdi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movsd  0xac5(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  0xa91(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  0xa37(%rip),%xmm0
movsd  %xmm0,(%rax)
movl   $0x1,-0x50(%rbp)
mov    -0x50(%rbp),%eax
mov    -0x4c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    16e5 <main+0x565>
mov    -0x20(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x48(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x20(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
call   10a0 <yp@plt>
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x20(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
call   1060 <ypp@plt>
mov    %eax,-0x84(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    $0x2,%edi
call   1090 <pow@plt>
movsd  -0x90(%rbp),%xmm0
ff
mov    %eax,%ecx
mov    -0x84(%rbp),%eax
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    15d4 <main+0x454>
movsd  -0x40(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movaps 0x932(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
lea    0x928(%rip),%rdi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
lea    0x92c(%rip),%rdi
call   1040 <system@plt>
mov    -0x4(%rbp),%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    $0x28,%rsp
xor    %ebx,%ebx
xor    %edi,%edi
call   1080 <exp@plt>
lea    (%rax,%rax,4),%r13d
add    $0xffffffff,%r13d
mov    $0x60,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
mov    $0x60,%edi
call   1070 <malloc@plt>
mov    %rax,%r12
movq   $0x0,(%r14)
movabs $0x4010000000000000,%r15
mov    %r15,(%rax)
nopl   (%rax)
movsd  (%r14,%rbx,8),%xmm0
movapd %xmm0,%xmm1
movsd  0xe1e(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  %xmm1,0x8(%r14,%rbx,8)
movsd  (%r12,%rbx,8),%xmm1
movsd  %xmm1,0x8(%rsp)
call   10a0 <yp@plt>
mulsd  0xdfa(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%r14,%rbx,8),%xmm0
movsd  (%r12,%rbx,8),%xmm1
call   1060 <ypp@plt>
mov    %eax,%ebp
movsd  0xdd3(%rip),%xmm0
mov    $0x2,%edi
call   1090 <pow@plt>
imul   %ebp,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%r12,%rbx,8)
add    $0x1,%rbx
cmp    $0xb,%rbx
jne    11d0 <main+0x50>
xorps  %xmm1,%xmm1
cvtsi2sd %r13d,%xmm1
movapd %xmm1,0x10(%rsp)
subsd  0x58(%r12),%xmm1
andpd  0xd9e(%rip),%xmm1
lea    0xda7(%rip),%rdi
movsd  0xd6f(%rip),%xmm0
call   1050 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    $0x330,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
mov    $0x330,%edi
call   1070 <malloc@plt>
mov    %rax,%r12
movq   $0x0,(%r14)
mov    %r15,(%rax)
xor    %ebx,%ebx
nopl   0x0(%rax)
movsd  (%r14,%rbx,8),%xmm0
movapd %xmm0,%xmm1
movsd  0xd26(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  %xmm1,0x8(%r14,%rbx,8)
movsd  (%r12,%rbx,8),%xmm1
movsd  %xmm1,0x8(%rsp)
call   10a0 <yp@plt>
mulsd  0xd02(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%r14,%rbx,8),%xmm0
movsd  (%r12,%rbx,8),%xmm1
call   1060 <ypp@plt>
mov    %eax,%ebp
movsd  0xcdb(%rip),%xmm0
mov    $0x2,%edi
call   1090 <pow@plt>
imul   %ebp,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%r12,%rbx,8)
add    $0x1,%rbx
cmp    $0x65,%rbx
jne    12d0 <main+0x150>
movapd 0x10(%rsp),%xmm1
subsd  0x328(%r12),%xmm1
andpd  0xca3(%rip),%xmm1
lea    0xcac(%rip),%rdi
movsd  0xc7c(%rip),%xmm0
call   1050 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    $0x1f50,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
mov    $0x1f50,%edi
call   1070 <malloc@plt>
mov    %rax,%r12
movq   $0x0,(%r14)
mov    %r15,(%rax)
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsd  (%r14,%rbx,8),%xmm0
movapd %xmm0,%xmm1
movsd  0xc2e(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  %xmm1,0x8(%r14,%rbx,8)
movsd  (%r12,%rbx,8),%xmm1
movsd  %xmm1,0x8(%rsp)
call   10a0 <yp@plt>
mulsd  0xc0a(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%r14,%rbx,8),%xmm0
movsd  (%r12,%rbx,8),%xmm1
call   1060 <ypp@plt>
mov    %eax,%ebp
movsd  0xbe3(%rip),%xmm0
mov    $0x2,%edi
call   1090 <pow@plt>
imul   %ebp,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%r12,%rbx,8)
add    $0x1,%rbx
cmp    $0x3e9,%rbx
jne    13d0 <main+0x250>
movapd 0x10(%rsp),%xmm1
subsd  0x1f48(%r12),%xmm1
andpd  0xba0(%rip),%xmm1
lea    0xba9(%rip),%rdi
movsd  0xb81(%rip),%xmm0
call   1050 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
lea    0xba7(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Para x=1 y con h=%lf:\0A error:%lf\0A\00"
@.str.1 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
store double 0.000000e+00, double* %2
store double 1.000000e+00, double* %3
%12 = call i32 @exp(i32 0)
%13 = mul nsw i32 5, %12
%14 = add nsw i32 -1, %13
%15 = sitofp i32 %14 to double
store double %15, double* %8
store double 1.000000e-01, double* %9
%16 = load double, double* %3
%17 = load double, double* %2
%18 = fsub double %16, %17
%19 = load double, double* %9
%20 = fdiv double %18, %19
%21 = fadd double %20, 1.000000e+00
%22 = fptosi double %21 to i32
store i32 %22, i32* %10
%23 = load i32, i32* %10
%24 = add nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = mul i64 %25, 8
%27 = trunc i64 %26 to i32
%28 = call i64 @malloc(i32 %27)
%29 = inttoptr i64 %28 to double*
store double* %29, double** %4
%30 = load i32, i32* %10
%31 = add nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = mul i64 %32, 8
%34 = trunc i64 %33 to i32
%35 = call i64 @malloc(i32 %34)
%36 = inttoptr i64 %35 to double*
store double* %36, double** %5
%37 = load double, double* %2
%38 = load double*, double** %4
%39 = getelementptr inbounds double, double* %38, i64 0
store double %37, double* %39
%40 = load double*, double** %5
%41 = getelementptr inbounds double, double* %40, i64 0
store double 4.000000e+00, double* %41
store i32 1, i32* %11
br label %42
42: ; preds = %104, %0
%43 = load i32, i32* %11
%44 = load i32, i32* %10
%45 = add nsw i32 %44, 1
%46 = icmp slt i32 %43, %45
br i1 %46, label %47, label %107
47: ; preds = %42
%48 = load double*, double** %4
%49 = load i32, i32* %11
%50 = sub nsw i32 %49, 1
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %48, i64 %51
%53 = load double, double* %52
%54 = load double, double* %9
%55 = fadd double %53, %54
%56 = load double*, double** %4
%57 = load i32, i32* %11
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
store double %55, double* %59
%60 = load double*, double** %5
%61 = load i32, i32* %11
%62 = sub nsw i32 %61, 1
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %60, i64 %63
%65 = load double, double* %64
%66 = load double*, double** %4
%67 = load i32, i32* %11
%68 = sub nsw i32 %67, 1
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds double, double* %66, i64 %69
%71 = load double, double* %70
%72 = load double*, double** %5
%73 = load i32, i32* %11
%74 = sub nsw i32 %73, 1
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds double, double* %72, i64 %75
%77 = load double, double* %76
%78 = call double @yp(double %71, double %77)
%79 = load double, double* %9
%80 = call double @llvm.fmuladd.f64(double %78, double %79, double %65)
%81 = load double*, double** %4
%82 = load i32, i32* %11
%83 = sub nsw i32 %82, 1
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds double, double* %81, i64 %84
%86 = load double, double* %85
%87 = load double*, double** %5
%88 = load i32, i32* %11
%89 = sub nsw i32 %88, 1
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds double, double* %87, i64 %90
%92 = load double, double* %91
%93 = call i32 @ypp(double %86, double %92)
%94 = load double, double* %9
%95 = call i32 @pow(double %94, i32 2)
%96 = mul nsw i32 %93, %95
%97 = sdiv i32 %96, 2
%98 = sitofp i32 %97 to double
%99 = fadd double %80, %98
%100 = load double*, double** %5
%101 = load i32, i32* %11
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds double, double* %100, i64 %102
store double %99, double* %103
br label %104
104: ; preds = %47
%105 = load i32, i32* %11
%106 = add nsw i32 %105, 1
store i32 %106, i32* %11
br label %42
107: ; preds = %42
%108 = load double, double* %8
%109 = load double*, double** %5
%110 = load i32, i32* %10
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds double, double* %109, i64 %111
%113 = load double, double* %112
%114 = fsub double %108, %113
%115 = call double @llvm.fabs.f64(double %114)
store double %115, double* %7
%116 = load double, double* %9
%117 = load double, double* %7
%118 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), double %116, double %117)
%119 = load double*, double** %4
%120 = call i32 @free(double* %119)
%121 = load double*, double** %5
%122 = call i32 @free(double* %121)
store double 1.000000e-02, double* %9
%123 = load double, double* %3
%124 = load double, double* %2
%125 = fsub double %123, %124
%126 = load double, double* %9
%127 = fdiv double %125, %126
%128 = fadd double %127, 1.000000e+00
%129 = fptosi double %128 to i32
store i32 %129, i32* %10
%130 = load i32, i32* %10
%131 = add nsw i32 %130, 1
%132 = sext i32 %131 to i64
%133 = mul i64 %132, 8
%134 = trunc i64 %133 to i32
%135 = call i64 @malloc(i32 %134)
%136 = inttoptr i64 %135 to double*
store double* %136, double** %4
%137 = load i32, i32* %10
%138 = add nsw i32 %137, 1
%139 = sext i32 %138 to i64
%140 = mul i64 %139, 8
%141 = trunc i64 %140 to i32
%142 = call i64 @malloc(i32 %141)
%143 = inttoptr i64 %142 to double*
store double* %143, double** %5
%144 = load double, double* %2
%145 = load double*, double** %4
%146 = getelementptr inbounds double, double* %145, i64 0
store double %144, double* %146
%147 = load double*, double** %5
%148 = getelementptr inbounds double, double* %147, i64 0
store double 4.000000e+00, double* %148
store i32 1, i32* %11
br label %149
149: ; preds = %211, %107
%150 = load i32, i32* %11
%151 = load i32, i32* %10
%152 = add nsw i32 %151, 1
%153 = icmp slt i32 %150, %152
br i1 %153, label %154, label %214
154: ; preds = %149
%155 = load double*, double** %4
%156 = load i32, i32* %11
%157 = sub nsw i32 %156, 1
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds double, double* %155, i64 %158
%160 = load double, double* %159
%161 = load double, double* %9
%162 = fadd double %160, %161
%163 = load double*, double** %4
%164 = load i32, i32* %11
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds double, double* %163, i64 %165
store double %162, double* %166
%167 = load double*, double** %5
%168 = load i32, i32* %11
%169 = sub nsw i32 %168, 1
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds double, double* %167, i64 %170
%172 = load double, double* %171
%173 = load double*, double** %4
%174 = load i32, i32* %11
%175 = sub nsw i32 %174, 1
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds double, double* %173, i64 %176
%178 = load double, double* %177
%179 = load double*, double** %5
%180 = load i32, i32* %11
%181 = sub nsw i32 %180, 1
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds double, double* %179, i64 %182
%184 = load double, double* %183
%185 = call double @yp(double %178, double %184)
%186 = load double, double* %9
%187 = call double @llvm.fmuladd.f64(double %185, double %186, double %172)
%188 = load double*, double** %4
%189 = load i32, i32* %11
%190 = sub nsw i32 %189, 1
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds double, double* %188, i64 %191
%193 = load double, double* %192
%194 = load double*, double** %5
%195 = load i32, i32* %11
%196 = sub nsw i32 %195, 1
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds double, double* %194, i64 %197
%199 = load double, double* %198
%200 = call i32 @ypp(double %193, double %199)
%201 = load double, double* %9
%202 = call i32 @pow(double %201, i32 2)
%203 = mul nsw i32 %200, %202
%204 = sdiv i32 %203, 2
%205 = sitofp i32 %204 to double
%206 = fadd double %187, %205
%207 = load double*, double** %5
%208 = load i32, i32* %11
%209 = sext i32 %208 to i64
%210 = getelementptr inbounds double, double* %207, i64 %209
store double %206, double* %210
br label %211
211: ; preds = %154
%212 = load i32, i32* %11
%213 = add nsw i32 %212, 1
store i32 %213, i32* %11
br label %149
214: ; preds = %149
%215 = load double, double* %8
%216 = load double*, double** %5
%217 = load i32, i32* %10
%218 = sext i32 %217 to i64
%219 = getelementptr inbounds double, double* %216, i64 %218
%220 = load double, double* %219
%221 = fsub double %215, %220
%222 = call double @llvm.fabs.f64(double %221)
store double %222, double* %7
%223 = load double, double* %9
%224 = load double, double* %7
%225 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), double %223, double %224)
%226 = load double*, double** %4
%227 = call i32 @free(double* %226)
%228 = load double*, double** %5
%229 = call i32 @free(double* %228)
store double 1.000000e-03, double* %9
%230 = load double, double* %3
%231 = load double, double* %2
%232 = fsub double %230, %231
%233 = load double, double* %9
%234 = fdiv double %232, %233
%235 = fadd double %234, 1.000000e+00
%236 = fptosi double %235 to i32
store i32 %236, i32* %10
%237 = load i32, i32* %10
%238 = add nsw i32 %237, 1
%239 = sext i32 %238 to i64
%240 = mul i64 %239, 8
%241 = trunc i64 %240 to i32
%242 = call i64 @malloc(i32 %241)
%243 = inttoptr i64 %242 to double*
store double* %243, double** %4
%244 = load i32, i32* %10
%245 = add nsw i32 %244, 1
%246 = sext i32 %245 to i64
%247 = mul i64 %246, 8
%248 = trunc i64 %247 to i32
%249 = call i64 @malloc(i32 %248)
%250 = inttoptr i64 %249 to double*
store double* %250, double** %5
%251 = load double, double* %2
%252 = load double*, double** %4
%253 = getelementptr inbounds double, double* %252, i64 0
store double %251, double* %253
%254 = load double*, double** %5
%255 = getelementptr inbounds double, double* %254, i64 0
store double 4.000000e+00, double* %255
store i32 1, i32* %11
br label %256
256: ; preds = %318, %214
%257 = load i32, i32* %11
%258 = load i32, i32* %10
%259 = add nsw i32 %258, 1
%260 = icmp slt i32 %257, %259
br i1 %260, label %261, label %321
261: ; preds = %256
%262 = load double*, double** %4
%263 = load i32, i32* %11
%264 = sub nsw i32 %263, 1
%265 = sext i32 %264 to i64
%266 = getelementptr inbounds double, double* %262, i64 %265
%267 = load double, double* %266
%268 = load double, double* %9
%269 = fadd double %267, %268
%270 = load double*, double** %4
%271 = load i32, i32* %11
%272 = sext i32 %271 to i64
%273 = getelementptr inbounds double, double* %270, i64 %272
store double %269, double* %273
%274 = load double*, double** %5
%275 = load i32, i32* %11
%276 = sub nsw i32 %275, 1
%277 = sext i32 %276 to i64
%278 = getelementptr inbounds double, double* %274, i64 %277
%279 = load double, double* %278
%280 = load double*, double** %4
%281 = load i32, i32* %11
%282 = sub nsw i32 %281, 1
%283 = sext i32 %282 to i64
%284 = getelementptr inbounds double, double* %280, i64 %283
%285 = load double, double* %284
%286 = load double*, double** %5
%287 = load i32, i32* %11
%288 = sub nsw i32 %287, 1
%289 = sext i32 %288 to i64
%290 = getelementptr inbounds double, double* %286, i64 %289
%291 = load double, double* %290
%292 = call double @yp(double %285, double %291)
%293 = load double, double* %9
%294 = call double @llvm.fmuladd.f64(double %292, double %293, double %279)
%295 = load double*, double** %4
%296 = load i32, i32* %11
%297 = sub nsw i32 %296, 1
%298 = sext i32 %297 to i64
%299 = getelementptr inbounds double, double* %295, i64 %298
%300 = load double, double* %299
%301 = load double*, double** %5
%302 = load i32, i32* %11
%303 = sub nsw i32 %302, 1
%304 = sext i32 %303 to i64
%305 = getelementptr inbounds double, double* %301, i64 %304
%306 = load double, double* %305
%307 = call i32 @ypp(double %300, double %306)
%308 = load double, double* %9
%309 = call i32 @pow(double %308, i32 2)
%310 = mul nsw i32 %307, %309
%311 = sdiv i32 %310, 2
%312 = sitofp i32 %311 to double
%313 = fadd double %294, %312
%314 = load double*, double** %5
%315 = load i32, i32* %11
%316 = sext i32 %315 to i64
%317 = getelementptr inbounds double, double* %314, i64 %316
store double %313, double* %317
br label %318
318: ; preds = %261
%319 = load i32, i32* %11
%320 = add nsw i32 %319, 1
store i32 %320, i32* %11
br label %256
321: ; preds = %256
%322 = load double, double* %8
%323 = load double*, double** %5
%324 = load i32, i32* %10
%325 = sext i32 %324 to i64
%326 = getelementptr inbounds double, double* %323, i64 %325
%327 = load double, double* %326
%328 = fsub double %322, %327
%329 = call double @llvm.fabs.f64(double %328)
store double %329, double* %7
%330 = load double, double* %9
%331 = load double, double* %7
%332 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), double %330, double %331)
%333 = load double*, double** %4
%334 = call i32 @free(double* %333)
%335 = load double*, double** %5
%336 = call i32 @free(double* %335)
%337 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%338 = load i32, i32* %1
ret i32 %338
}

LLVM IR (-O2):
@.str = [34 x i8] c"Para x=1 y con h=%lf:\0A error:%lf\0A\00"
@.str.1 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = tail call i32 @exp(i32 0)
%2 = mul nsw i32 %1, 5
%3 = add nsw i32 %2, -1
%4 = tail call i64 @malloc(i32 96)
%5 = inttoptr i64 %4 to double*
%6 = tail call i64 @malloc(i32 96)
%7 = inttoptr i64 %6 to double*
store double 0.000000e+00, double* %5
store double 4.000000e+00, double* %7
br label %8
8: ; preds = %0, %8
%9 = phi i64 [ 1, %0 ], [ %28, %8 ]
%10 = add nsw i64 %9, -1
%11 = getelementptr inbounds double, double* %5, i64 %10
%12 = load double, double* %11
%13 = fadd double %12, 1.000000e-01
%14 = getelementptr inbounds double, double* %5, i64 %9
store double %13, double* %14
%15 = getelementptr inbounds double, double* %7, i64 %10
%16 = load double, double* %15
%17 = tail call double @yp(double %12, double %16)
%18 = tail call double @llvm.fmuladd.f64(double %17, double 1.000000e-01, double %16)
%19 = load double, double* %11
%20 = load double, double* %15
%21 = tail call i32 @ypp(double %19, double %20)
%22 = tail call i32 @pow(double 1.000000e-01, i32 2)
%23 = mul nsw i32 %22, %21
%24 = sdiv i32 %23, 2
%25 = sitofp i32 %24 to double
%26 = fadd double %18, %25
%27 = getelementptr inbounds double, double* %7, i64 %9
store double %26, double* %27
%28 = add nuw nsw i64 %9, 1
%29 = icmp eq i64 %28, 12
br i1 %29, label %30, label %8
30: ; preds = %8
%31 = sitofp i32 %3 to double
%32 = getelementptr inbounds double, double* %7, i64 11
%33 = load double, double* %32
%34 = fsub double %31, %33
%35 = tail call double @llvm.fabs.f64(double %34)
%36 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), double 1.000000e-01, double %35)
%37 = tail call i32 @free(double* %5)
%38 = tail call i32 @free(double* %7)
%39 = tail call i64 @malloc(i32 816)
%40 = inttoptr i64 %39 to double*
%41 = tail call i64 @malloc(i32 816)
%42 = inttoptr i64 %41 to double*
store double 0.000000e+00, double* %40
store double 4.000000e+00, double* %42
br label %43
43: ; preds = %30, %43
%44 = phi i64 [ 1, %30 ], [ %63, %43 ]
%45 = add nsw i64 %44, -1
%46 = getelementptr inbounds double, double* %40, i64 %45
%47 = load double, double* %46
%48 = fadd double %47, 1.000000e-02
%49 = getelementptr inbounds double, double* %40, i64 %44
store double %48, double* %49
%50 = getelementptr inbounds double, double* %42, i64 %45
%51 = load double, double* %50
%52 = tail call double @yp(double %47, double %51)
%53 = tail call double @llvm.fmuladd.f64(double %52, double 1.000000e-02, double %51)
%54 = load double, double* %46
%55 = load double, double* %50
%56 = tail call i32 @ypp(double %54, double %55)
%57 = tail call i32 @pow(double 1.000000e-02, i32 2)
%58 = mul nsw i32 %57, %56
%59 = sdiv i32 %58, 2
%60 = sitofp i32 %59 to double
%61 = fadd double %53, %60
%62 = getelementptr inbounds double, double* %42, i64 %44
store double %61, double* %62
%63 = add nuw nsw i64 %44, 1
%64 = icmp eq i64 %63, 102
br i1 %64, label %65, label %43
65: ; preds = %43
%66 = getelementptr inbounds double, double* %42, i64 101
%67 = load double, double* %66
%68 = fsub double %31, %67
%69 = tail call double @llvm.fabs.f64(double %68)
%70 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), double 1.000000e-02, double %69)
%71 = tail call i32 @free(double* %40)
%72 = tail call i32 @free(double* %42)
%73 = tail call i64 @malloc(i32 8016)
%74 = inttoptr i64 %73 to double*
%75 = tail call i64 @malloc(i32 8016)
%76 = inttoptr i64 %75 to double*
store double 0.000000e+00, double* %74
store double 4.000000e+00, double* %76
br label %77
77: ; preds = %65, %77
%78 = phi i64 [ 1, %65 ], [ %97, %77 ]
%79 = add nsw i64 %78, -1
%80 = getelementptr inbounds double, double* %74, i64 %79
%81 = load double, double* %80
%82 = fadd double %81, 1.000000e-03
%83 = getelementptr inbounds double, double* %74, i64 %78
store double %82, double* %83
%84 = getelementptr inbounds double, double* %76, i64 %79
%85 = load double, double* %84
%86 = tail call double @yp(double %81, double %85)
%87 = tail call double @llvm.fmuladd.f64(double %86, double 1.000000e-03, double %85)
%88 = load double, double* %80
%89 = load double, double* %84
%90 = tail call i32 @ypp(double %88, double %89)
%91 = tail call i32 @pow(double 1.000000e-03, i32 2)
%92 = mul nsw i32 %91, %90
%93 = sdiv i32 %92, 2
%94 = sitofp i32 %93 to double
%95 = fadd double %87, %94
%96 = getelementptr inbounds double, double* %76, i64 %78
store double %95, double* %96
%97 = add nuw nsw i64 %78, 1
%98 = icmp eq i64 %97, 1002
br i1 %98, label %99, label %77
99: ; preds = %77
%100 = getelementptr inbounds double, double* %76, i64 1001
%101 = load double, double* %100
%102 = fsub double %31, %101
%103 = tail call double @llvm.fabs.f64(double %102)
%104 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), double 1.000000e-03, double %103)
%105 = tail call i32 @free(double* %74)
%106 = tail call i32 @free(double* %76)
%107 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}