#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 cos_interpolate(double const, double const, int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(double *, int /*<<< orphan*/, int);
int /*<<< orphan*/ mu(int);
double *interpolateY(const double ys[], int dot_i, int smooth) {
  double *yi = (double *)malloc(sizeof(double) * (smooth - 1));
  memset(yi, 0, sizeof(double) * (smooth - 1));
  int i;
  for (i = 1; i < smooth; ++i)
    yi[i - 1] = cos_interpolate(ys[dot_i], ys[dot_i + 1], mu(i - 1));
  return yi;
}


x86 assembly (clang, -O0):
<interpolateY>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1030 <memset@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11fa <interpolateY+0xba>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x1c(%rbp),%edi
sub    $0x1,%edi
call   1060 <mu@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mov    %eax,%edi
call   1050 <cos_interpolate@plt>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1189 <interpolateY+0x49>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<interpolateY>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,%ebx
mov    %esi,%r15d
mov    %rdi,%r12
lea    -0x8(,%rbx,8),%ebp
mov    %ebp,%edi
call   1040 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1030 <memset@plt>
cmp    $0x2,%ebx
jl     11d1 <interpolateY+0x91>
movslq %r15d,%r13
lea    0x1(%r13),%eax
movslq %eax,%r15
mov    %ebx,%ebp
add    $0xffffffffffffffff,%rbp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsd  (%r12,%r13,8),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%r12,%r15,8),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1060 <mu@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mov    %eax,%edi
call   1050 <cos_interpolate@plt>
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1190 <interpolateY+0x50>
mov    %r14,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double* @interpolateY(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca double*
%8 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = sub nsw i32 %9, 1
%11 = sext i32 %10 to i64
%12 = mul i64 8, %11
%13 = trunc i64 %12 to i32
%14 = call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to double*
store double* %15, double** %7
%16 = load double*, double** %7
%17 = load i32, i32* %6
%18 = sub nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = mul i64 8, %19
%21 = trunc i64 %20 to i32
%22 = call i32 @memset(double* %16, i32 0, i32 %21)
store i32 1, i32* %8
br label %23
23: ; preds = %48, %3
%24 = load i32, i32* %8
%25 = load i32, i32* %6
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %51
27: ; preds = %23
%28 = load double*, double** %4
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %28, i64 %30
%32 = load double, double* %31
%33 = load double*, double** %4
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double, double* %33, i64 %36
%38 = load double, double* %37
%39 = load i32, i32* %8
%40 = sub nsw i32 %39, 1
%41 = call i32 @mu(i32 %40)
%42 = call double @cos_interpolate(double %32, double %38, i32 %41)
%43 = load double*, double** %7
%44 = load i32, i32* %8
%45 = sub nsw i32 %44, 1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %43, i64 %46
store double %42, double* %47
br label %48
48: ; preds = %27
%49 = load i32, i32* %8
%50 = add nsw i32 %49, 1
store i32 %50, i32* %8
br label %23
51: ; preds = %23
%52 = load double*, double** %7
ret double* %52
}

LLVM IR (-O2):
define double* @interpolateY(double* nocapture %0, i32 %1, i32 %2) {
%4 = shl i32 %2, 3
%5 = add i32 %4, -8
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to double*
%8 = tail call i32 @memset(double* %7, i32 0, i32 %5)
%9 = icmp sgt i32 %2, 1
br i1 %9, label %10, label %28
10: ; preds = %3
%11 = sext i32 %1 to i64
%12 = getelementptr inbounds double, double* %0, i64 %11
%13 = add nsw i32 %1, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %0, i64 %14
%16 = zext i32 %2 to i64
br label %17
17: ; preds = %10, %17
%18 = phi i64 [ 1, %10 ], [ %26, %17 ]
%19 = load double, double* %12
%20 = load double, double* %15
%21 = add nsw i64 %18, -1
%22 = trunc i64 %21 to i32
%23 = tail call i32 @mu(i32 %22)
%24 = tail call double @cos_interpolate(double %19, double %20, i32 %23)
%25 = getelementptr inbounds double, double* %7, i64 %21
store double %24, double* %25
%26 = add nuw nsw i64 %18, 1
%27 = icmp eq i64 %26, %16
br i1 %27, label %28, label %17
28: ; preds = %17, %3
ret double* %7
}