#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 intCompSimp(double *, double, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ system(char *);
int main() {
  int i;
  double a = 0;
  double b = 1;
  double *X;
  double h;
  double longitud;
  double area;
  X = (double *)malloc((100 + 1) * sizeof(double));
  h = (b - a) / 100;
  for (i = 0; i < 100 + 1; i++)
    X[i] = a + h * i;
  longitud = intCompSimp(X, h, 1);
  printf("longitud--> %lf\n", longitud);
  area = 2 * 3.14192654 * intCompSimp(X, h, 2);
  printf("area--> %lf\n", area);
  system("PAUSE");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xea9(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x328,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  0xe7c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x65,-0x8(%rbp)
jge    11d0 <main+0x90>
movsd  -0x10(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x8(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1194 <main+0x54>
mov    -0x20(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
mov    $0x1,%esi
call   1030 <intCompSimp@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
lea    0xe20(%rip),%rdi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
mov    $0x2,%esi
call   1030 <intCompSimp@plt>
cvtsi2sd %eax,%xmm1
movsd  0xdf4(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
lea    0xdf8(%rip),%rdi
call   1050 <printf@plt>
lea    0xdf9(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x328,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
movdqa 0xeaa(%rip),%xmm0
mov    $0x2,%eax
movapd 0xead(%rip),%xmm1
xorpd  %xmm2,%xmm2
movdqa 0xeb1(%rip),%xmm3
movdqa 0xeb9(%rip),%xmm4
nopw   0x0(%rax,%rax,1)
cvtdq2pd %xmm0,%xmm5
mulpd  %xmm1,%xmm5
addpd  %xmm2,%xmm5
movupd %xmm5,-0x10(%rbx,%rax,8)
movdqa %xmm0,%xmm5
paddd  %xmm3,%xmm5
cvtdq2pd %xmm5,%xmm5
mulpd  %xmm1,%xmm5
addpd  %xmm2,%xmm5
movupd %xmm5,(%rbx,%rax,8)
paddd  %xmm4,%xmm0
add    $0x4,%rax
cmp    $0x66,%rax
jne    1180 <main+0x40>
movabs $0x3ff0000000000000,%rax
mov    %rax,0x320(%rbx)
movsd  0xe6e(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <intCompSimp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
lea    0xe63(%rip),%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
movsd  0xe43(%rip),%xmm0
mov    $0x2,%esi
call   1030 <intCompSimp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe32(%rip),%xmm0
lea    0xe44(%rip),%rdi
call   1050 <printf@plt>
lea    0xe45(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"longitud--> %lf\0A\00"
@.str.1 = [13 x i8] c"area--> %lf\0A\00"
@.str.2 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double*
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %3
store double 1.000000e+00, double* %4
%9 = call i64 @malloc(i32 808)
%10 = inttoptr i64 %9 to double*
store double* %10, double** %5
%11 = load double, double* %4
%12 = load double, double* %3
%13 = fsub double %11, %12
%14 = fdiv double %13, 1.000000e+02
store double %14, double* %6
store i32 0, i32* %2
br label %15
15: ; preds = %28, %0
%16 = load i32, i32* %2
%17 = icmp slt i32 %16, 101
br i1 %17, label %18, label %31
18: ; preds = %15
%19 = load double, double* %3
%20 = load double, double* %6
%21 = load i32, i32* %2
%22 = sitofp i32 %21 to double
%23 = call double @llvm.fmuladd.f64(double %20, double %22, double %19)
%24 = load double*, double** %5
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
store double %23, double* %27
br label %28
28: ; preds = %18
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %15
31: ; preds = %15
%32 = load double*, double** %5
%33 = load double, double* %6
%34 = call i32 @intCompSimp(double* %32, double %33, i32 1)
%35 = sitofp i32 %34 to double
store double %35, double* %7
%36 = load double, double* %7
%37 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double %36)
%38 = load double*, double** %5
%39 = load double, double* %6
%40 = call i32 @intCompSimp(double* %38, double %39, i32 2)
%41 = sitofp i32 %40 to double
%42 = fmul double 0x401922AA61BDE020, %41
store double %42, double* %8
%43 = load double, double* %8
%44 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %43)
%45 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"longitud--> %lf\0A\00"
@.str.1 = [13 x i8] c"area--> %lf\0A\00"
@.str.2 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 808)
%2 = inttoptr i64 %1 to double*
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ 0, %0 ], [ %16, %3 ]
%5 = phi <2 x i32> [ <i32 0, i32 1>, %0 ], [ %17, %3 ]
%6 = sitofp <2 x i32> %5 to <2 x double>
%7 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %6, <2 x double> <double 1.000000e-02, double 1.000000e-02>, <2 x double> zeroinitializer)
%8 = getelementptr inbounds double, double* %2, i64 %4
%9 = bitcast double* %8 to <2 x double>*
store <2 x double> %7, <2 x double>* %9
%10 = or i64 %4, 2
%11 = add <2 x i32> %5, <i32 2, i32 2>
%12 = sitofp <2 x i32> %11 to <2 x double>
%13 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %12, <2 x double> <double 1.000000e-02, double 1.000000e-02>, <2 x double> zeroinitializer)
%14 = getelementptr inbounds double, double* %2, i64 %10
%15 = bitcast double* %14 to <2 x double>*
store <2 x double> %13, <2 x double>* %15
%16 = add nuw nsw i64 %4, 4
%17 = add <2 x i32> %5, <i32 4, i32 4>
%18 = icmp eq i64 %16, 100
br i1 %18, label %19, label %3
19: ; preds = %3
%20 = getelementptr inbounds double, double* %2, i64 100
store double 1.000000e+00, double* %20
%21 = tail call i32 @intCompSimp(double* %2, double 1.000000e-02, i32 1)
%22 = sitofp i32 %21 to double
%23 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double %22)
%24 = tail call i32 @intCompSimp(double* %2, double 1.000000e-02, i32 2)
%25 = sitofp i32 %24 to double
%26 = fmul double %25, 0x401922AA61BDE020
%27 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %26)
%28 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}