#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 */
float L(int, float, float *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int i, ordem = 0;
  printf("Quantidade de dados>>");
  scanf("%d", &ordem);
  float x[ordem], y[ordem];
  for (i = 0; i < ordem; i++) {
    printf("x%d>> ", i);
    scanf("%f", &x[i]);
    printf("y%d>> ", i);
    scanf("%f", &y[i]);
  }
  float ptx, pty;
  while (1) {
    printf("\nEscolha um x da p(x)>> ");
    scanf("%f", &ptx);
    for (i = 0; i < ordem; i++) {
      pty += y[i] * L(i, ptx, x);
    }
    printf("\np(%f) = %f\n", ptx, pty);
    ptx = 0;
    pty = 0;
    printf("\n>>>Digite ctrl + c para finalizar o programa<<<\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x41(%rbp)
call   1040 <printf@plt>
mov    -0x41(%rbp),%al
lea    0xeb5(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    122e <main+0xfe>
mov    -0x8(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x40(%rbp),%rsi
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%rsi
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b8 <main+0x88>
jmp    1233 <main+0x103>
jmp    1238 <main+0x108>
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdd3(%rip),%rdi
lea    -0x2c(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12b6 <main+0x186>
mov    -0x40(%rbp),%rsi
mov    -0x38(%rbp),%rax
movslq -0x8(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%edi
movss  -0x2c(%rbp),%xmm0
call   1030 <L@plt>
movaps %xmm0,%xmm2
movss  -0x48(%rbp),%xmm0
movss  -0x30(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    125f <main+0x12f>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x30(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xd74(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
lea    0xd63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1233 <main+0x103>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,-0x2c(%rbp)
lea    0xea1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea9(%rip),%rdi
lea    -0x2c(%rbp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    -0x2c(%rbp),%eax
mov    %rsp,%rbx
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rbx
mov    %rbx,%rsp
mov    %rsp,%r14
sub    %rcx,%r14
mov    %r14,%rsp
test   %eax,%eax
jle    1209 <main+0xc9>
mov    %rbx,%r13
mov    %r14,%r15
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
lea    0xe62(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe58(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe4a(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe36(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
add    $0x1,%r12
movslq -0x2c(%rbp),%rax
add    $0x4,%r15
add    $0x4,%r13
cmp    %rax,%r12
jl     11b0 <main+0x70>
lea    0xe33(%rip),%r13
lea    0xe39(%rip),%r12
jmp    1249 <main+0x109>
nopl   0x0(%rax)
xorps  %xmm1,%xmm1
movss  -0x30(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
mov    %r13,%rdi
mov    $0x2,%al
call   1050 <printf@plt>
movl   $0x0,-0x30(%rbp)
mov    %r12,%rdi
call   1030 <puts@plt>
lea    0xdda(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdc2(%rip),%rdi
lea    -0x30(%rbp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    1220 <main+0xe0>
xorps  %xmm1,%xmm1
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nop
movss  %xmm1,-0x38(%rbp)
movss  (%r14,%r15,4),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x30(%rbp),%xmm0
mov    %r15d,%edi
mov    %rbx,%rsi
call   1040 <L@plt>
movss  -0x38(%rbp),%xmm1
mulss  -0x34(%rbp),%xmm0
addss  %xmm0,%xmm1
add    $0x1,%r15
movslq -0x2c(%rbp),%rax
cmp    %rax,%r15
jl     1280 <main+0x140>
jmp    1223 <main+0xe3>

LLVM IR (-O0):
@.str = [22 x i8] c"Quantidade de dados>>\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [7 x i8] c"x%d>> \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [7 x i8] c"y%d>> \00"
@.str.5 = [25 x i8] c"\0AEscolha um x da p(x)>> \00"
@.str.6 = [13 x i8] c"\0Ap(%f) = %f\0A\00"
@.str.7 = [50 x i8] c"\0A>>>Digite ctrl + c para finalizar o programa<<<\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca float
%8 = alloca float
store i32 0, i32* %1
store i32 0, i32* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%11 = load i32, i32* %3
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %4
%14 = alloca float, i64 %12
store i64 %12, i64* %5
%15 = load i32, i32* %3
%16 = zext i32 %15 to i64
%17 = alloca float, i64 %16
store i64 %16, i64* %6
store i32 0, i32* %2
br label %18
18: ; preds = %35, %0
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %38
22: ; preds = %18
%23 = load i32, i32* %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds float, float* %14, i64 %26
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %27)
%29 = load i32, i32* %2
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds float, float* %17, i64 %32
%34 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %33)
br label %35
35: ; preds = %22
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
br label %18
38: ; preds = %18
br label %39
39: ; preds = %60, %38
br label %40
40: ; preds = %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%42 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %7)
store i32 0, i32* %2
br label %43
43: ; preds = %57, %40
%44 = load i32, i32* %2
%45 = load i32, i32* %3
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %60
47: ; preds = %43
%48 = load i32, i32* %2
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds float, float* %17, i64 %49
%51 = load float, float* %50
%52 = load i32, i32* %2
%53 = load float, float* %7
%54 = call float @L(i32 %52, float %53, float* %14)
%55 = load float, float* %8
%56 = call float @llvm.fmuladd.f32(float %51, float %54, float %55)
store float %56, float* %8
br label %57
57: ; preds = %47
%58 = load i32, i32* %2
%59 = add nsw i32 %58, 1
store i32 %59, i32* %2
br label %43
60: ; preds = %43
%61 = load float, float* %7
%62 = fpext float %61 to double
%63 = load float, float* %8
%64 = fpext float %63 to double
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), double %62, double %64)
store float 0.000000e+00, float* %7
store float 0.000000e+00, float* %8
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0))
br label %39
}

LLVM IR (-O2):
@.str = [22 x i8] c"Quantidade de dados>>\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [7 x i8] c"x%d>> \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [7 x i8] c"y%d>> \00"
@.str.5 = [25 x i8] c"\0AEscolha um x da p(x)>> \00"
@.str.6 = [13 x i8] c"\0Ap(%f) = %f\0A\00"
@str = [49 x i8] c"\0A>>>Digite ctrl + c para finalizar o programa<<<\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = zext i32 %6 to i64
%8 = alloca float, i64 %7
%9 = alloca float, i64 %7
%10 = icmp sgt i32 %6, 0
br i1 %10, label %11, label %24
11: ; preds = %0, %11
%12 = phi i64 [ %20, %11 ], [ 0, %0 ]
%13 = trunc i64 %12 to i32
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds float, float* %8, i64 %12
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %15)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%18 = getelementptr inbounds float, float* %9, i64 %12
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %18)
%20 = add nuw nsw i64 %12, 1
%21 = load i32, i32* %1
%22 = sext i32 %21 to i64
%23 = icmp slt i64 %20, %22
br i1 %23, label %11, label %24
24: ; preds = %11, %0
%25 = bitcast float* %2 to i8*
br label %26
26: ; preds = %44, %24
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%29 = load i32, i32* %1
%30 = icmp sgt i32 %29, 0
br i1 %30, label %31, label %44
31: ; preds = %26, %31
%32 = phi i64 [ %40, %31 ], [ 0, %26 ]
%33 = phi float [ %39, %31 ], [ 0.000000e+00, %26 ]
%34 = getelementptr inbounds float, float* %9, i64 %32
%35 = load float, float* %34
%36 = load float, float* %2
%37 = trunc i64 %32 to i32
%38 = call float @L(i32 %37, float %36, float* %8)
%39 = call float @llvm.fmuladd.f32(float %35, float %38, float %33)
%40 = add nuw nsw i64 %32, 1
%41 = load i32, i32* %1
%42 = sext i32 %41 to i64
%43 = icmp slt i64 %40, %42
br i1 %43, label %31, label %44
44: ; preds = %31, %26
%45 = phi float [ 0.000000e+00, %26 ], [ %39, %31 ]
%46 = load float, float* %2
%47 = fpext float %46 to double
%48 = fpext float %45 to double
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), double %47, double %48)
store float 0.000000e+00, float* %2
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
br label %26
}