#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 /*<<< orphan*/ CSPL_Array_scale(double *, double const, double const,
                                    long const);
void CSPL_Array_linspace(double *inval, const double min, const double max,
                         const long n) {
  unsigned long i;
  for (i = 0; i < n; i++)
    inval[i] = (double)i;
  CSPL_Array_scale(inval, min, max, n);
}


x86 assembly (clang, -O0):
<CSPL_Array_linspace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1185 <CSPL_Array_linspace+0x75>
movaps 0xeb9(%rip),%xmm1
movq   -0x28(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xeb8(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1132 <CSPL_Array_linspace+0x22>
mov    -0x8(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    -0x20(%rbp),%rsi
call   1030 <CSPL_Array_scale@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CSPL_Array_linspace>:
test   %rsi,%rsi
je     1317 <CSPL_Array_linspace+0x207>
cmp    $0x4,%rsi
jae    1126 <CSPL_Array_linspace+0x16>
xor    %eax,%eax
jmp    12e0 <CSPL_Array_linspace+0x1d0>
mov    %rsi,%rax
and    $0xfffffffffffffffc,%rax
lea    -0x4(%rax),%rcx
mov    %rcx,%r8
shr    $0x2,%r8
add    $0x1,%r8
test   %rcx,%rcx
je     131c <CSPL_Array_linspace+0x20c>
mov    %r8,%rdx
and    $0xfffffffffffffffe,%rdx
movdqa 0xeac(%rip),%xmm5
xor    %ecx,%ecx
movdqa 0xeb1(%rip),%xmm8
movdqa 0xeb8(%rip),%xmm12
movdqa 0xebf(%rip),%xmm13
movdqa 0xec7(%rip),%xmm6
movapd 0xecf(%rip),%xmm7
movdqa 0xed6(%rip),%xmm9
movdqa 0xedd(%rip),%xmm10
movdqa 0xee4(%rip),%xmm11
nopl   0x0(%rax)
movdqa %xmm5,%xmm2
paddq  %xmm8,%xmm2
movdqa %xmm5,%xmm3
pand   %xmm12,%xmm3
por    %xmm13,%xmm3
movdqa %xmm5,%xmm4
psrlq  $0x20,%xmm4
por    %xmm6,%xmm4
subpd  %xmm7,%xmm4
addpd  %xmm3,%xmm4
movdqa %xmm2,%xmm3
pand   %xmm12,%xmm3
por    %xmm13,%xmm3
psrlq  $0x20,%xmm2
por    %xmm6,%xmm2
subpd  %xmm7,%xmm2
addpd  %xmm3,%xmm2
movupd %xmm4,(%rdi,%rcx,8)
movupd %xmm2,0x10(%rdi,%rcx,8)
movdqa %xmm5,%xmm2
paddq  %xmm9,%xmm2
movdqa %xmm5,%xmm3
paddq  %xmm10,%xmm3
movdqa %xmm2,%xmm4
pand   %xmm12,%xmm4
por    %xmm13,%xmm4
psrlq  $0x20,%xmm2
por    %xmm6,%xmm2
subpd  %xmm7,%xmm2
addpd  %xmm4,%xmm2
movdqa %xmm3,%xmm4
pand   %xmm12,%xmm4
por    %xmm13,%xmm4
psrlq  $0x20,%xmm3
por    %xmm6,%xmm3
subpd  %xmm7,%xmm3
addpd  %xmm4,%xmm3
movupd %xmm2,0x20(%rdi,%rcx,8)
movupd %xmm3,0x30(%rdi,%rcx,8)
add    $0x8,%rcx
paddq  %xmm11,%xmm5
add    $0xfffffffffffffffe,%rdx
jne    11a0 <CSPL_Array_linspace+0x90>
test   $0x1,%r8b
je     12db <CSPL_Array_linspace+0x1cb>
movdqa 0xd9d(%rip),%xmm2
paddq  %xmm5,%xmm2
movdqa 0xda1(%rip),%xmm3
movdqa %xmm5,%xmm4
pand   %xmm3,%xmm4
movdqa 0xda0(%rip),%xmm8
por    %xmm8,%xmm4
psrlq  $0x20,%xmm5
movdqa 0xd9e(%rip),%xmm7
por    %xmm7,%xmm5
movapd 0xda2(%rip),%xmm6
subpd  %xmm6,%xmm5
addpd  %xmm4,%xmm5
pand   %xmm2,%xmm3
por    %xmm8,%xmm3
psrlq  $0x20,%xmm2
por    %xmm7,%xmm2
subpd  %xmm6,%xmm2
addpd  %xmm3,%xmm2
movupd %xmm5,(%rdi,%rcx,8)
movupd %xmm2,0x10(%rdi,%rcx,8)
cmp    %rsi,%rax
je     1317 <CSPL_Array_linspace+0x207>
movdqa 0xda8(%rip),%xmm2
movapd 0xdb0(%rip),%xmm3
movq   %rax,%xmm4
punpckldq %xmm2,%xmm4
subpd  %xmm3,%xmm4
movapd %xmm4,%xmm5
unpckhpd %xmm4,%xmm5
addsd  %xmm4,%xmm5
movsd  %xmm5,(%rdi,%rax,8)
add    $0x1,%rax
cmp    %rax,%rsi
jne    12f0 <CSPL_Array_linspace+0x1e0>
jmp    1030 <CSPL_Array_scale@plt>
movdqa 0xcdc(%rip),%xmm5
xor    %ecx,%ecx
test   $0x1,%r8b
jne    126b <CSPL_Array_linspace+0x15b>
jmp    12db <CSPL_Array_linspace+0x1cb>

LLVM IR (-O0):
define void @CSPL_Array_linspace(double* %0, double %1, double %2, i64 %3) {
%5 = alloca double*
%6 = alloca double
%7 = alloca double
%8 = alloca i64
%9 = alloca i64
store double* %0, double** %5
store double %1, double* %6
store double %2, double* %7
store i64 %3, i64* %8
store i64 0, i64* %9
br label %10
10: ; preds = %20, %4
%11 = load i64, i64* %9
%12 = load i64, i64* %8
%13 = icmp ult i64 %11, %12
br i1 %13, label %14, label %23
14: ; preds = %10
%15 = load i64, i64* %9
%16 = uitofp i64 %15 to double
%17 = load double*, double** %5
%18 = load i64, i64* %9
%19 = getelementptr inbounds double, double* %17, i64 %18
store double %16, double* %19
br label %20
20: ; preds = %14
%21 = load i64, i64* %9
%22 = add i64 %21, 1
store i64 %22, i64* %9
br label %10
23: ; preds = %10
%24 = load double*, double** %5
%25 = load double, double* %6
%26 = load double, double* %7
%27 = load i64, i64* %8
%28 = call i32 @CSPL_Array_scale(double* %24, double %25, double %26, i64 %27)
ret void
}

LLVM IR (-O2):
define void @CSPL_Array_linspace(double* %0, double %1, double %2, i64 %3) {
%5 = icmp eq i64 %3, 0
br i1 %5, label %63, label %6
6: ; preds = %4
%7 = icmp ult i64 %3, 4
br i1 %7, label %55, label %8
8: ; preds = %6
%9 = and i64 %3, -4
%10 = add i64 %9, -4
%11 = lshr exact i64 %10, 2
%12 = add nuw nsw i64 %11, 1
%13 = and i64 %12, 1
%14 = icmp eq i64 %10, 0
br i1 %14, label %41, label %15
15: ; preds = %8
%16 = and i64 %12, 9223372036854775806
br label %17
17: ; preds = %17, %15
%18 = phi i64 [ 0, %15 ], [ %37, %17 ]
%19 = phi <2 x i64> [ <i64 0, i64 1>, %15 ], [ %38, %17 ]
%20 = phi i64 [ 0, %15 ], [ %39, %17 ]
%21 = add <2 x i64> %19, <i64 2, i64 2>
%22 = uitofp <2 x i64> %19 to <2 x double>
%23 = uitofp <2 x i64> %21 to <2 x double>
%24 = getelementptr inbounds double, double* %0, i64 %18
%25 = bitcast double* %24 to <2 x double>*
store <2 x double> %22, <2 x double>* %25
%26 = getelementptr inbounds double, double* %24, i64 2
%27 = bitcast double* %26 to <2 x double>*
store <2 x double> %23, <2 x double>* %27
%28 = or i64 %18, 4
%29 = add <2 x i64> %19, <i64 4, i64 4>
%30 = add <2 x i64> %19, <i64 6, i64 6>
%31 = uitofp <2 x i64> %29 to <2 x double>
%32 = uitofp <2 x i64> %30 to <2 x double>
%33 = getelementptr inbounds double, double* %0, i64 %28
%34 = bitcast double* %33 to <2 x double>*
store <2 x double> %31, <2 x double>* %34
%35 = getelementptr inbounds double, double* %33, i64 2
%36 = bitcast double* %35 to <2 x double>*
store <2 x double> %32, <2 x double>* %36
%37 = add nuw i64 %18, 8
%38 = add <2 x i64> %19, <i64 8, i64 8>
%39 = add i64 %20, 2
%40 = icmp eq i64 %39, %16
br i1 %40, label %41, label %17
41: ; preds = %17, %8
%42 = phi i64 [ 0, %8 ], [ %37, %17 ]
%43 = phi <2 x i64> [ <i64 0, i64 1>, %8 ], [ %38, %17 ]
%44 = icmp eq i64 %13, 0
br i1 %44, label %53, label %45
45: ; preds = %41
%46 = add <2 x i64> %43, <i64 2, i64 2>
%47 = uitofp <2 x i64> %43 to <2 x double>
%48 = uitofp <2 x i64> %46 to <2 x double>
%49 = getelementptr inbounds double, double* %0, i64 %42
%50 = bitcast double* %49 to <2 x double>*
store <2 x double> %47, <2 x double>* %50
%51 = getelementptr inbounds double, double* %49, i64 2
%52 = bitcast double* %51 to <2 x double>*
store <2 x double> %48, <2 x double>* %52
br label %53
53: ; preds = %41, %45
%54 = icmp eq i64 %9, %3
br i1 %54, label %63, label %55
55: ; preds = %6, %53
%56 = phi i64 [ 0, %6 ], [ %9, %53 ]
br label %57
57: ; preds = %55, %57
%58 = phi i64 [ %61, %57 ], [ %56, %55 ]
%59 = uitofp i64 %58 to double
%60 = getelementptr inbounds double, double* %0, i64 %58
store double %59, double* %60
%61 = add nuw i64 %58, 1
%62 = icmp eq i64 %61, %3
br i1 %62, label %63, label %57
63: ; preds = %57, %53, %4
%64 = tail call i32 @CSPL_Array_scale(double* %0, double %1, double %2, i64 %3)
ret void
}