#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 ceil(float);
float pow(float, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *, float *, float *);
int ej12() {
  float a, b, c, x1, x2, delta;
  int tam, i;
  printf("Ingrese en orden los coeficientes a, b y c\n");
  scanf("%f%f%f", &a, &b, &c);
  printf("Ingrese en orden valor inicial, valor final e incremento\n");
  scanf("%f%f%f", &x1, &x2, &delta);
  tam = ceil((x2 - x1) / delta);
  tam = tam + 1;
  float P[tam];
  float V[tam];
  for (i = 1; i <= tam; i++) {
    if (i == 1) {
      V[(i - 1)] = x1;
    } else if (i == tam) {
      V[(i - 1)] = x2;
    } else {
      V[(i - 1)] = x1 + (i - 1) * delta;
    }
    P[(i - 1)] = a * pow(V[(i - 1)], 2) + b * V[(i - 1)] + c;
    printf("Para x= %f ==>  P(x)= %f\n", V[(i - 1)], P[(i - 1)]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<ej12>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x51(%rbp)
call   1040 <printf@plt>
lea    0xecc(%rip),%rdi
mov    %rdi,-0x50(%rbp)
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1050 <scanf@plt>
mov    -0x51(%rbp),%al
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
mov    -0x50(%rbp),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1050 <scanf@plt>
movss  -0x14(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  -0x18(%rbp),%xmm1
divss  %xmm1,%xmm0
call   1030 <ceil@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     1340 <ej12+0x200>
cmpl   $0x1,-0x20(%rbp)
jne    1241 <ej12+0x101>
mov    -0x40(%rbp),%rax
movss  -0x10(%rbp),%xmm0
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    129c <ej12+0x15c>
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    1269 <ej12+0x129>
mov    -0x40(%rbp),%rax
movss  -0x14(%rbp),%xmm0
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    1297 <ej12+0x157>
mov    -0x40(%rbp),%rax
movss  -0x10(%rbp),%xmm1
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
cvtsi2ss %ecx,%xmm0
movss  -0x18(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    129c <ej12+0x15c>
mov    -0x40(%rbp),%rax
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x58(%rbp)
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
mov    -0x40(%rbp),%rcx
mov    -0x48(%rbp),%rax
movaps %xmm0,%xmm2
movss  -0x58(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mov    -0x20(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
mulss  (%rcx,%rdx,4),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
addss  -0xc(%rbp),%xmm0
mov    -0x20(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
movss  %xmm0,(%rax,%rdx,4)
mov    -0x20(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
movss  (%rcx,%rdx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xd42(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    120f <ej12+0xcf>
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ej12>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8c(%rip),%rbx
lea    -0x48(%rbp),%rsi
lea    -0x44(%rbp),%rdx
lea    -0x40(%rbp),%rcx
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
lea    -0x34(%rbp),%rsi
lea    -0x3c(%rbp),%rdx
lea    -0x38(%rbp),%rcx
mov    %rbx,%rdi
call   1060 <scanf@plt>
movss  -0x3c(%rbp),%xmm0
subss  -0x34(%rbp),%xmm0
divss  -0x38(%rbp),%xmm0
call   1040 <ceil@plt>
mov    %eax,%r12d
mov    %rsp,-0x58(%rbp)
lea    0x1(%r12),%eax
mov    %rsp,%rbx
mov    %rax,-0x50(%rbp)
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
test   %r12d,%r12d
js     131e <ej12+0x1ce>
movss  -0x34(%rbp),%xmm1
movss  %xmm1,-0x2c(%rbp)
movss  %xmm1,(%rbx)
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movaps %xmm1,%xmm0
mov    $0x2,%edi
call   1070 <pow@plt>
movss  -0x2c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
mulss  -0x44(%rbp),%xmm1
mulss  -0x30(%rbp),%xmm0
addss  %xmm1,%xmm0
addss  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
lea    0xdce(%rip),%rdi
movaps %xmm2,%xmm0
mov    $0x2,%al
call   1050 <printf@plt>
test   %r12d,%r12d
je     131e <ej12+0x1ce>
add    $0x2,%r12d
mov    $0x2,%r13d
mov    $0x2,%r14d
sub    -0x50(%rbp),%r14
sub    %r12,%r13
mov    $0x1,%r15d
lea    0xd97(%rip),%r12
jmp    12fc <ej12+0x1ac>
cs nopw 0x0(%rax,%rax,1)
nop
xorps  %xmm0,%xmm0
cvtsi2ss %r15d,%xmm0
mulss  -0x38(%rbp),%xmm0
addss  -0x34(%rbp),%xmm0
movss  %xmm0,(%rbx,%r15,4)
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  (%rbx,%r15,4),%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    $0x2,%edi
call   1070 <pow@plt>
movss  -0x2c(%rbp),%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm1,%xmm2
mulss  -0x44(%rbp),%xmm1
mulss  -0x30(%rbp),%xmm0
addss  %xmm1,%xmm0
addss  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
mov    %r12,%rdi
movaps %xmm2,%xmm0
mov    $0x2,%al
call   1050 <printf@plt>
lea    (%r15,%r13,1),%rax
add    $0x1,%rax
add    $0x1,%r15
cmp    $0x1,%rax
je     131e <ej12+0x1ce>
lea    (%r14,%r15,1),%rax
cmp    $0x1,%rax
jne    1280 <ej12+0x130>
movss  -0x3c(%rbp),%xmm0
mov    -0x50(%rbp),%rax
movss  %xmm0,-0x4(%rbx,%rax,4)
jmp    1298 <ej12+0x148>
mov    -0x58(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [44 x i8] c"Ingrese en orden los coeficientes a, b y c\0A\00"
@.str.1 = [7 x i8] c"%f%f%f\00"
@.str.2 = [58 x i8] c"Ingrese en orden valor inicial, valor final e incremento\0A\00"
@.str.3 = [26 x i8] c"Para x= %f ==> P(x)= %f\0A\00"
define i32 @ej12() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i64
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), float* %1, float* %2, float* %3)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), float* %4, float* %5, float* %6)
%16 = load float, float* %5
%17 = load float, float* %4
%18 = fsub float %16, %17
%19 = load float, float* %6
%20 = fdiv float %18, %19
%21 = call i32 @ceil(float %20)
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = add nsw i32 %22, 1
store i32 %23, i32* %7
%24 = load i32, i32* %7
%25 = zext i32 %24 to i64
%26 = call i8* @llvm.stacksave()
store i8* %26, i8** %9
%27 = alloca float, i64 %25
store i64 %25, i64* %10
%28 = load i32, i32* %7
%29 = zext i32 %28 to i64
%30 = alloca float, i64 %29
store i64 %29, i64* %11
store i32 1, i32* %8
br label %31
31: ; preds = %101, %0
%32 = load i32, i32* %8
%33 = load i32, i32* %7
%34 = icmp sle i32 %32, %33
br i1 %34, label %35, label %104
35: ; preds = %31
%36 = load i32, i32* %8
%37 = icmp eq i32 %36, 1
br i1 %37, label %38, label %44
38: ; preds = %35
%39 = load float, float* %4
%40 = load i32, i32* %8
%41 = sub nsw i32 %40, 1
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds float, float* %30, i64 %42
store float %39, float* %43
br label %66
44: ; preds = %35
%45 = load i32, i32* %8
%46 = load i32, i32* %7
%47 = icmp eq i32 %45, %46
br i1 %47, label %48, label %54
48: ; preds = %44
%49 = load float, float* %5
%50 = load i32, i32* %8
%51 = sub nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds float, float* %30, i64 %52
store float %49, float* %53
br label %65
54: ; preds = %44
%55 = load float, float* %4
%56 = load i32, i32* %8
%57 = sub nsw i32 %56, 1
%58 = sitofp i32 %57 to float
%59 = load float, float* %6
%60 = call float @llvm.fmuladd.f32(float %58, float %59, float %55)
%61 = load i32, i32* %8
%62 = sub nsw i32 %61, 1
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds float, float* %30, i64 %63
store float %60, float* %64
br label %65
65: ; preds = %54, %48
br label %66
66: ; preds = %65, %38
%67 = load float, float* %1
%68 = load i32, i32* %8
%69 = sub nsw i32 %68, 1
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds float, float* %30, i64 %70
%72 = load float, float* %71
%73 = call float @pow(float %72, i32 2)
%74 = load float, float* %2
%75 = load i32, i32* %8
%76 = sub nsw i32 %75, 1
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds float, float* %30, i64 %77
%79 = load float, float* %78
%80 = fmul float %74, %79
%81 = call float @llvm.fmuladd.f32(float %67, float %73, float %80)
%82 = load float, float* %3
%83 = fadd float %81, %82
%84 = load i32, i32* %8
%85 = sub nsw i32 %84, 1
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds float, float* %27, i64 %86
store float %83, float* %87
%88 = load i32, i32* %8
%89 = sub nsw i32 %88, 1
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds float, float* %30, i64 %90
%92 = load float, float* %91
%93 = fpext float %92 to double
%94 = load i32, i32* %8
%95 = sub nsw i32 %94, 1
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds float, float* %27, i64 %96
%98 = load float, float* %97
%99 = fpext float %98 to double
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), double %93, double %99)
br label %101
101: ; preds = %66
%102 = load i32, i32* %8
%103 = add nsw i32 %102, 1
store i32 %103, i32* %8
br label %31
104: ; preds = %31
%105 = load i8*, i8** %9
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"%f%f%f\00"
@.str.3 = [26 x i8] c"Para x= %f ==> P(x)= %f\0A\00"
@str = [43 x i8] c"Ingrese en orden los coeficientes a, b y c\00"
@str.4 = [57 x i8] c"Ingrese en orden valor inicial, valor final e incremento\00"
define i32 @ej12() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = bitcast float* %1 to i8*
%8 = bitcast float* %2 to i8*
%9 = bitcast float* %3 to i8*
%10 = bitcast float* %4 to i8*
%11 = bitcast float* %5 to i8*
%12 = bitcast float* %6 to i8*
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), float* %1, float* %2, float* %3)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.4, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), float* %4, float* %5, float* %6)
%17 = load float, float* %5
%18 = load float, float* %4
%19 = fsub float %17, %18
%20 = load float, float* %6
%21 = fdiv float %19, %20
%22 = call i32 @ceil(float %21)
%23 = add nsw i32 %22, 1
%24 = zext i32 %23 to i64
%25 = call i8* @llvm.stacksave()
%26 = alloca float, i64 %24
%27 = icmp slt i32 %22, 0
br i1 %27, label %75, label %28
28: ; preds = %0
%29 = add nuw i32 %22, 2
%30 = zext i32 %29 to i64
%31 = load float, float* %4
store float %31, float* %26
%32 = load float, float* %1
%33 = call float @pow(float %31, i32 2)
%34 = load float, float* %2
%35 = fmul float %31, %34
%36 = call float @llvm.fmuladd.f32(float %32, float %33, float %35)
%37 = load float, float* %3
%38 = fadd float %37, %36
%39 = fpext float %31 to double
%40 = fpext float %38 to double
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), double %39, double %40)
%42 = icmp eq i32 %22, 0
br i1 %42, label %75, label %43
43: ; preds = %28
%44 = add nsw i64 %24, -1
%45 = getelementptr inbounds float, float* %26, i64 %44
br label %46
46: ; preds = %59, %43
%47 = phi i64 [ 2, %43 ], [ %73, %59 ]
%48 = icmp eq i64 %47, %24
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = load float, float* %5
store float %50, float* %45
br label %59
51: ; preds = %46
%52 = load float, float* %4
%53 = add nsw i64 %47, -1
%54 = trunc i64 %53 to i32
%55 = sitofp i32 %54 to float
%56 = load float, float* %6
%57 = call float @llvm.fmuladd.f32(float %55, float %56, float %52)
%58 = getelementptr inbounds float, float* %26, i64 %53
store float %57, float* %58
br label %59
59: ; preds = %49, %51
%60 = load float, float* %1
%61 = add nsw i64 %47, -1
%62 = getelementptr inbounds float, float* %26, i64 %61
%63 = load float, float* %62
%64 = call float @pow(float %63, i32 2)
%65 = load float, float* %2
%66 = fmul float %63, %65
%67 = call float @llvm.fmuladd.f32(float %60, float %64, float %66)
%68 = load float, float* %3
%69 = fadd float %68, %67
%70 = fpext float %63 to double
%71 = fpext float %69 to double
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), double %70, double %71)
%73 = add nuw nsw i64 %47, 1
%74 = icmp eq i64 %73, %30
br i1 %74, label %75, label %46
75: ; preds = %59, %28, %0
ret i32 0
}