#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 */
double *malloc(int);
double *funcio_polinomica(int n, double *x) {
  int i = 0;
  double *f = malloc(sizeof(double) * n);
  for (i = 0; i < n; i++) {
    f[i] = 1 / (1 + 25 * x[i] * x[i]);
  }
  return f;
}


x86 assembly (clang, -O0):
<funcio_polinomica>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a5 <funcio_polinomica+0x95>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  0xeac(%rip),%xmm1
mulsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe86(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe7a(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1140 <funcio_polinomica+0x30>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<funcio_polinomica>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%r14d
lea    0x0(,%r14,8),%edi
call   1030 <malloc@plt>
test   %r14d,%r14d
jle    124b <funcio_polinomica+0x13b>
mov    %r14d,%ecx
cmp    $0x1,%r14d
jne    1140 <funcio_polinomica+0x30>
xor    %edx,%edx
jmp    1205 <funcio_polinomica+0xf5>
mov    %ecx,%edx
and    $0xfffffffe,%edx
lea    -0x2(%rdx),%rsi
mov    %rsi,%r8
shr    %r8
add    $0x1,%r8
test   %rsi,%rsi
je     1253 <funcio_polinomica+0x143>
mov    %r8,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %esi,%esi
movapd 0xe93(%rip),%xmm0
movapd 0xe9b(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nop
movupd (%rbx,%rsi,8),%xmm2
movapd %xmm2,%xmm3
mulpd  %xmm0,%xmm3
mulpd  %xmm2,%xmm3
addpd  %xmm1,%xmm3
movapd %xmm1,%xmm2
divpd  %xmm3,%xmm2
movupd %xmm2,(%rax,%rsi,8)
movupd 0x10(%rbx,%rsi,8),%xmm2
movapd %xmm2,%xmm3
mulpd  %xmm0,%xmm3
mulpd  %xmm2,%xmm3
addpd  %xmm1,%xmm3
movapd %xmm1,%xmm2
divpd  %xmm3,%xmm2
movupd %xmm2,0x10(%rax,%rsi,8)
add    $0x4,%rsi
add    $0xfffffffffffffffe,%rdi
jne    1180 <funcio_polinomica+0x70>
test   $0x1,%r8b
je     1200 <funcio_polinomica+0xf0>
movupd (%rbx,%rsi,8),%xmm0
movapd 0xe1d(%rip),%xmm1
mulpd  %xmm0,%xmm1
mulpd  %xmm0,%xmm1
movapd 0xe1d(%rip),%xmm0
addpd  %xmm0,%xmm1
divpd  %xmm1,%xmm0
movupd %xmm0,(%rax,%rsi,8)
cmp    %rcx,%rdx
je     124b <funcio_polinomica+0x13b>
movsd  0xe13(%rip),%xmm0
movsd  0xe13(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%rbx,%rdx,8),%xmm2
movapd %xmm2,%xmm3
mulsd  %xmm0,%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm1,%xmm3
movapd %xmm1,%xmm2
divsd  %xmm3,%xmm2
movsd  %xmm2,(%rax,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1220 <funcio_polinomica+0x110>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %esi,%esi
test   $0x1,%r8b
jne    11d6 <funcio_polinomica+0xc6>
jmp    1200 <funcio_polinomica+0xf0>

LLVM IR (-O0):
define double* @funcio_polinomica(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
%6 = alloca double*
store i32 %0, i32* %3
store double* %1, double** %4
store i32 0, i32* %5
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = mul i64 8, %8
%10 = trunc i64 %9 to i32
%11 = call double* @malloc(i32 %10)
store double* %11, double** %6
store i32 0, i32* %5
br label %12
12: ; preds = %34, %2
%13 = load i32, i32* %5
%14 = load i32, i32* %3
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %37
16: ; preds = %12
%17 = load double*, double** %4
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
%21 = load double, double* %20
%22 = fmul double 2.500000e+01, %21
%23 = load double*, double** %4
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
%27 = load double, double* %26
%28 = call double @llvm.fmuladd.f64(double %22, double %27, double 1.000000e+00)
%29 = fdiv double 1.000000e+00, %28
%30 = load double*, double** %6
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %30, i64 %32
store double %29, double* %33
br label %34
34: ; preds = %16
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %12
37: ; preds = %12
%38 = load double*, double** %6
ret double* %38
}

LLVM IR (-O2):
define noalias double* @funcio_polinomica(i32 %0, double* nocapture %1) {
%3 = shl i32 %0, 3
%4 = tail call double* @malloc(i32 %3)
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %67
6: ; preds = %2
%7 = zext i32 %0 to i64
%8 = icmp eq i32 %0, 1
br i1 %8, label %55, label %9
9: ; preds = %6
%10 = and i64 %7, 4294967294
%11 = add nsw i64 %10, -2
%12 = lshr exact i64 %11, 1
%13 = add nuw i64 %12, 1
%14 = and i64 %13, 1
%15 = icmp eq i64 %11, 0
br i1 %15, label %41, label %16
16: ; preds = %9
%17 = and i64 %13, -2
br label %18
18: ; preds = %18, %16
%19 = phi i64 [ 0, %16 ], [ %38, %18 ]
%20 = phi i64 [ 0, %16 ], [ %39, %18 ]
%21 = getelementptr inbounds double, double* %1, i64 %19
%22 = bitcast double* %21 to <2 x double>*
%23 = load <2 x double>, <2 x double>* %22
%24 = fmul <2 x double> %23, <double 2.500000e+01, double 2.500000e+01>
%25 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %24, <2 x double> %23, <2 x double> <double 1.000000e+00, double 1.000000e+00>)
%26 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %25
%27 = getelementptr inbounds double, double* %4, i64 %19
%28 = bitcast double* %27 to <2 x double>*
store <2 x double> %26, <2 x double>* %28
%29 = or i64 %19, 2
%30 = getelementptr inbounds double, double* %1, i64 %29
%31 = bitcast double* %30 to <2 x double>*
%32 = load <2 x double>, <2 x double>* %31
%33 = fmul <2 x double> %32, <double 2.500000e+01, double 2.500000e+01>
%34 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %33, <2 x double> %32, <2 x double> <double 1.000000e+00, double 1.000000e+00>)
%35 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %34
%36 = getelementptr inbounds double, double* %4, i64 %29
%37 = bitcast double* %36 to <2 x double>*
store <2 x double> %35, <2 x double>* %37
%38 = add nuw i64 %19, 4
%39 = add nuw i64 %20, 2
%40 = icmp eq i64 %39, %17
br i1 %40, label %41, label %18
41: ; preds = %18, %9
%42 = phi i64 [ 0, %9 ], [ %38, %18 ]
%43 = icmp eq i64 %14, 0
br i1 %43, label %53, label %44
44: ; preds = %41
%45 = getelementptr inbounds double, double* %1, i64 %42
%46 = bitcast double* %45 to <2 x double>*
%47 = load <2 x double>, <2 x double>* %46
%48 = fmul <2 x double> %47, <double 2.500000e+01, double 2.500000e+01>
%49 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %48, <2 x double> %47, <2 x double> <double 1.000000e+00, double 1.000000e+00>)
%50 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %49
%51 = getelementptr inbounds double, double* %4, i64 %42
%52 = bitcast double* %51 to <2 x double>*
store <2 x double> %50, <2 x double>* %52
br label %53
53: ; preds = %41, %44
%54 = icmp eq i64 %10, %7
br i1 %54, label %67, label %55
55: ; preds = %6, %53
%56 = phi i64 [ 0, %6 ], [ %10, %53 ]
br label %57
57: ; preds = %55, %57
%58 = phi i64 [ %65, %57 ], [ %56, %55 ]
%59 = getelementptr inbounds double, double* %1, i64 %58
%60 = load double, double* %59
%61 = fmul double %60, 2.500000e+01
%62 = tail call double @llvm.fmuladd.f64(double %61, double %60, double 1.000000e+00)
%63 = fdiv double 1.000000e+00, %62
%64 = getelementptr inbounds double, double* %4, i64 %58
store double %63, double* %64
%65 = add nuw nsw i64 %58, 1
%66 = icmp eq i64 %65, %7
br i1 %66, label %67, label %57
67: ; preds = %57, %53, %2
ret double* %4
}