#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 *malloc(int);
int /*<<< orphan*/ mostra(int *, int);
double pcd(int *, int, int, float, int /*<<< orphan*/);
int /*<<< orphan*/ polinomio(int *, int, int);
int /*<<< orphan*/ printf(char *, int, int, float, double);
int scanf(char *, int *, ...);
int main() {
  int *v = NULL, tam = 0, a = 0, b = 0;
  int lido = 0;
  float x = 0;
  v = malloc(sizeof(int) * 100);
  scanf("%d %d %f\n", &a, &b, &x);
  while (scanf("%d ", &lido) == 1) {
    v[tam] = lido;
    tam++;
  }
  if (1) {
    mostra(v, tam);
    polinomio(v, a, b);
    printf("Dados> a: %d, b: %d, x: %0.2f, tam: %d\n", a, b, x, tam);
  }
  printf("p_%d,%d(%0.2f) = %0.2f \n", a, b, x, pcd(v, a, b, x, 0));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
mov    $0x190,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
lea    0xe50(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x24(%rbp),%rcx
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xe40(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
cmp    $0x1,%eax
jne    11fa <main+0x9a>
mov    -0x20(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c3 <main+0x63>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <mostra@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1030 <polinomio@plt>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
movss  -0x24(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
lea    0xde2(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
movss  -0x24(%rbp),%xmm0
xor    %ecx,%ecx
call   1080 <pcd@plt>
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
movaps %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
lea    0xdc4(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x18(%rsp)
movl   $0x0,0x14(%rsp)
mov    $0x190,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
lea    0xe60(%rip),%rdi
xor    %ebx,%ebx
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x14(%rsp),%rcx
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xe4b(%rip),%rdi
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
cmp    $0x1,%eax
jne    11fe <main+0x9e>
lea    0xe33(%rip),%r15
lea    0x18(%rsp),%r12
xor    %ebx,%ebx
xchg   %ax,%ax
mov    0x18(%rsp),%eax
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
cmp    $0x1,%eax
je     11e0 <main+0x80>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <mostra@plt>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
mov    %r14,%rdi
call   1030 <polinomio@plt>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
movss  0x14(%rsp),%xmm0
cvtsi2sd %ebx,%xmm1
lea    0xddd(%rip),%rdi
call   1050 <printf@plt>
mov    0x10(%rsp),%ebx
mov    0xc(%rsp),%ebp
movss  0x14(%rsp),%xmm0
movss  %xmm0,0x1c(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1080 <pcd@plt>
movaps %xmm0,%xmm1
lea    0xdd4(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
movss  0x1c(%rsp),%xmm0
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%d %d %f\0A\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [40 x i8] c"Dados> a: %d, b: %d, x: %0.2f, tam: %d\0A\00"
@.str.3 = [25 x i8] c"p_%d,%d(%0.2f) = %0.2f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
store i32 0, i32* %1
store i32* null, i32** %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store float 0.000000e+00, float* %7
%8 = call i32* @malloc(i32 400)
store i32* %8, i32** %2
%9 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5, float* %7)
br label %10
10: ; preds = %13, %0
%11 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = load i32, i32* %6
%15 = load i32*, i32** %2
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
store i32 %14, i32* %18
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %10
21: ; preds = %10
%22 = load i32*, i32** %2
%23 = load i32, i32* %3
%24 = call i32 @mostra(i32* %22, i32 %23)
%25 = load i32*, i32** %2
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = call i32 @polinomio(i32* %25, i32 %26, i32 %27)
%29 = load i32, i32* %4
%30 = load i32, i32* %5
%31 = load float, float* %7
%32 = load i32, i32* %3
%33 = sitofp i32 %32 to double
%34 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %29, i32 %30, float %31, double %33)
%35 = load i32, i32* %4
%36 = load i32, i32* %5
%37 = load float, float* %7
%38 = load i32*, i32** %2
%39 = load i32, i32* %4
%40 = load i32, i32* %5
%41 = load float, float* %7
%42 = call double @pcd(i32* %38, i32 %39, i32 %40, float %41, i32 0)
%43 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %35, i32 %36, float %37, double %42)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"%d %d %f\0A\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [40 x i8] c"Dados> a: %d, b: %d, x: %0.2f, tam: %d\0A\00"
@.str.3 = [25 x i8] c"p_%d,%d(%0.2f) = %0.2f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%6 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast float* %4 to i8*
store float 0.000000e+00, float* %4
%9 = tail call i32* @malloc(i32 400)
%10 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, float* %4)
%11 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %22
13: ; preds = %0, %13
%14 = phi i64 [ %17, %13 ], [ 0, %0 ]
%15 = load i32, i32* %3
%16 = getelementptr inbounds i32, i32* %9, i64 %14
store i32 %15, i32* %16
%17 = add nuw i64 %14, 1
%18 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%19 = icmp eq i32 %18, 1
br i1 %19, label %13, label %20
20: ; preds = %13
%21 = trunc i64 %17 to i32
br label %22
22: ; preds = %20, %0
%23 = phi i32 [ 0, %0 ], [ %21, %20 ]
%24 = call i32 @mostra(i32* %9, i32 %23)
%25 = load i32, i32* %1
%26 = load i32, i32* %2
%27 = call i32 @polinomio(i32* %9, i32 %25, i32 %26)
%28 = load i32, i32* %1
%29 = load i32, i32* %2
%30 = load float, float* %4
%31 = sitofp i32 %23 to double
%32 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %28, i32 %29, float %30, double %31)
%33 = load i32, i32* %1
%34 = load i32, i32* %2
%35 = load float, float* %4
%36 = call double @pcd(i32* %9, i32 %33, i32 %34, float %35, i32 0)
%37 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %33, i32 %34, float %35, double %36)
ret i32 0
}