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


x86 assembly (clang, -O0):
<nodes_equiespaiats>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a1 <nodes_equiespaiats+0x91>
movsd  -0x10(%rbp),%xmm1
cvtsi2sdl -0x24(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1163 <nodes_equiespaiats+0x53>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nodes_equiespaiats>:
push   %rbx
sub    $0x20,%rsp
movapd %xmm1,0x10(%rsp)
movapd %xmm0,(%rsp)
mov    %edi,%ebx
lea    0x0(,%rbx,8),%edi
call   1030 <malloc@plt>
movapd (%rsp),%xmm5
movapd 0x10(%rsp),%xmm4
test   %ebx,%ebx
jle    129d <nodes_equiespaiats+0x18d>
lea    -0x1(%rbx),%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
subsd  %xmm5,%xmm4
divsd  %xmm0,%xmm4
mov    %ebx,%ecx
cmp    $0x4,%ebx
jae    1161 <nodes_equiespaiats+0x51>
xor    %edx,%edx
jmp    1280 <nodes_equiespaiats+0x170>
mov    %ecx,%edx
and    $0xfffffffc,%edx
movapd %xmm4,%xmm0
unpcklpd %xmm4,%xmm0
movapd %xmm5,%xmm1
unpcklpd %xmm5,%xmm1
lea    -0x4(%rdx),%rsi
mov    %rsi,%rbx
shr    $0x2,%rbx
add    $0x1,%rbx
test   %rsi,%rsi
je     12a3 <nodes_equiespaiats+0x193>
mov    %rbx,%rdi
and    $0xfffffffffffffffe,%rdi
movdqa 0xe63(%rip),%xmm2
xor    %esi,%esi
movdqa 0xe68(%rip),%xmm8
movdqa 0xe6f(%rip),%xmm9
movdqa 0xe76(%rip),%xmm10
movdqa 0xe7e(%rip),%xmm6
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movdqa %xmm2,%xmm7
cvtdq2pd %xmm2,%xmm3
paddd  %xmm8,%xmm7
cvtdq2pd %xmm7,%xmm7
mulpd  %xmm0,%xmm3
addpd  %xmm1,%xmm3
mulpd  %xmm0,%xmm7
addpd  %xmm1,%xmm7
movupd %xmm3,(%rax,%rsi,8)
movupd %xmm7,0x10(%rax,%rsi,8)
movdqa %xmm2,%xmm3
paddd  %xmm9,%xmm3
movdqa %xmm2,%xmm7
cvtdq2pd %xmm3,%xmm3
paddd  %xmm10,%xmm7
cvtdq2pd %xmm7,%xmm7
mulpd  %xmm0,%xmm3
addpd  %xmm1,%xmm3
mulpd  %xmm0,%xmm7
addpd  %xmm1,%xmm7
movupd %xmm3,0x20(%rax,%rsi,8)
movupd %xmm7,0x30(%rax,%rsi,8)
add    $0x8,%rsi
paddd  %xmm6,%xmm2
add    $0xfffffffffffffffe,%rdi
jne    11d0 <nodes_equiespaiats+0xc0>
test   $0x1,%bl
je     1270 <nodes_equiespaiats+0x160>
cvtdq2pd %xmm2,%xmm3
paddd  0xdbf(%rip),%xmm2
cvtdq2pd %xmm2,%xmm2
mulpd  %xmm0,%xmm3
addpd  %xmm1,%xmm3
mulpd  %xmm0,%xmm2
addpd  %xmm1,%xmm2
movupd %xmm3,(%rax,%rsi,8)
movupd %xmm2,0x10(%rax,%rsi,8)
cmp    %rcx,%rdx
je     129d <nodes_equiespaiats+0x18d>
cs nopw 0x0(%rax,%rax,1)
nop
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
mulsd  %xmm4,%xmm0
addsd  %xmm5,%xmm0
movsd  %xmm0,(%rax,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1280 <nodes_equiespaiats+0x170>
add    $0x20,%rsp
pop    %rbx
ret
movdqa 0xd55(%rip),%xmm2
xor    %esi,%esi
test   $0x1,%bl
jne    1245 <nodes_equiespaiats+0x135>
jmp    1270 <nodes_equiespaiats+0x160>

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

LLVM IR (-O2):
define noalias double* @nodes_equiespaiats(i32 %0, double %1, double %2) {
%4 = shl i32 %0, 3
%5 = tail call double* @malloc(i32 %4)
%6 = fsub double %2, %1
%7 = add nsw i32 %0, -1
%8 = sitofp i32 %7 to double
%9 = fdiv double %6, %8
%10 = icmp sgt i32 %0, 0
br i1 %10, label %11, label %85
11: ; preds = %3
%12 = zext i32 %0 to i64
%13 = icmp ult i32 %0, 4
br i1 %13, label %75, label %14
14: ; preds = %11
%15 = and i64 %12, 4294967292
%16 = insertelement <2 x double> poison, double %9, i64 0
%17 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> zeroinitializer
%18 = insertelement <2 x double> poison, double %1, i64 0
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
%20 = insertelement <2 x double> poison, double %9, i64 0
%21 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> zeroinitializer
%22 = insertelement <2 x double> poison, double %1, i64 0
%23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
%24 = add nsw i64 %15, -4
%25 = lshr exact i64 %24, 2
%26 = add nuw nsw i64 %25, 1
%27 = and i64 %26, 1
%28 = icmp eq i64 %24, 0
br i1 %28, label %59, label %29
29: ; preds = %14
%30 = and i64 %26, 9223372036854775806
br label %31
31: ; preds = %31, %29
%32 = phi i64 [ 0, %29 ], [ %55, %31 ]
%33 = phi <2 x i32> [ <i32 0, i32 1>, %29 ], [ %56, %31 ]
%34 = phi i64 [ 0, %29 ], [ %57, %31 ]
%35 = add <2 x i32> %33, <i32 2, i32 2>
%36 = sitofp <2 x i32> %33 to <2 x double>
%37 = sitofp <2 x i32> %35 to <2 x double>
%38 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %36, <2 x double> %17, <2 x double> %19)
%39 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %37, <2 x double> %21, <2 x double> %23)
%40 = getelementptr inbounds double, double* %5, i64 %32
%41 = bitcast double* %40 to <2 x double>*
store <2 x double> %38, <2 x double>* %41
%42 = getelementptr inbounds double, double* %40, i64 2
%43 = bitcast double* %42 to <2 x double>*
store <2 x double> %39, <2 x double>* %43
%44 = or i64 %32, 4
%45 = add <2 x i32> %33, <i32 4, i32 4>
%46 = add <2 x i32> %33, <i32 6, i32 6>
%47 = sitofp <2 x i32> %45 to <2 x double>
%48 = sitofp <2 x i32> %46 to <2 x double>
%49 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %47, <2 x double> %17, <2 x double> %19)
%50 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %48, <2 x double> %21, <2 x double> %23)
%51 = getelementptr inbounds double, double* %5, i64 %44
%52 = bitcast double* %51 to <2 x double>*
store <2 x double> %49, <2 x double>* %52
%53 = getelementptr inbounds double, double* %51, i64 2
%54 = bitcast double* %53 to <2 x double>*
store <2 x double> %50, <2 x double>* %54
%55 = add nuw i64 %32, 8
%56 = add <2 x i32> %33, <i32 8, i32 8>
%57 = add i64 %34, 2
%58 = icmp eq i64 %57, %30
br i1 %58, label %59, label %31
59: ; preds = %31, %14
%60 = phi i64 [ 0, %14 ], [ %55, %31 ]
%61 = phi <2 x i32> [ <i32 0, i32 1>, %14 ], [ %56, %31 ]
%62 = icmp eq i64 %27, 0
br i1 %62, label %73, label %63
63: ; preds = %59
%64 = add <2 x i32> %61, <i32 2, i32 2>
%65 = sitofp <2 x i32> %61 to <2 x double>
%66 = sitofp <2 x i32> %64 to <2 x double>
%67 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %65, <2 x double> %17, <2 x double> %19)
%68 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %66, <2 x double> %21, <2 x double> %23)
%69 = getelementptr inbounds double, double* %5, i64 %60
%70 = bitcast double* %69 to <2 x double>*
store <2 x double> %67, <2 x double>* %70
%71 = getelementptr inbounds double, double* %69, i64 2
%72 = bitcast double* %71 to <2 x double>*
store <2 x double> %68, <2 x double>* %72
br label %73
73: ; preds = %59, %63
%74 = icmp eq i64 %15, %12
br i1 %74, label %85, label %75
75: ; preds = %11, %73
%76 = phi i64 [ 0, %11 ], [ %15, %73 ]
br label %77
77: ; preds = %75, %77
%78 = phi i64 [ %83, %77 ], [ %76, %75 ]
%79 = trunc i64 %78 to i32
%80 = sitofp i32 %79 to double
%81 = tail call double @llvm.fmuladd.f64(double %80, double %9, double %1)
%82 = getelementptr inbounds double, double* %5, i64 %78
store double %81, double* %82
%83 = add nuw nsw i64 %78, 1
%84 = icmp eq i64 %83, %12
br i1 %84, label %85, label %77
85: ; preds = %77, %73, %3
ret double* %5
}