#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 */
scalar_t__ malloc(int);
int ephcom_cheby(int maxcoeffs, double x, double span, double *y, int ncoords,
                 int ncoeffs, double *pv) {
  int i, j;
  static double twox;
  static double *pc, *vc;
  static double lastx = 2.0;
  static int init = 1;
  if (init) {
    pc = (double *)malloc(maxcoeffs * sizeof(double));
    vc = (double *)malloc(maxcoeffs * sizeof(double));
    init = 0;
  }
  if (lastx != x) {
    lastx = x;
    twox = x + x;
    pc[0] = 1.0;
    pc[1] = x;
    for (i = 2; i < maxcoeffs; i++) {
      pc[i] = twox * pc[i - 1] - pc[i - 2];
      if (pc[i] * pc[i] == 0.0) {
        pc[i] = 0.0;
      }
    }
    vc[0] = 0.0;
    vc[1] = 1.0;
    vc[2] = twox + twox;
    for (i = 3; i < maxcoeffs; i++) {
      vc[i] = twox * vc[i - 1] + pc[i - 1] + pc[i - 1] - vc[i - 2];
    }
  }
  for (i = 0; i < ncoords; i++) {
    pv[i] = 0.0;
    for (j = ncoeffs - 1; j >= 0; j--) {
      pv[i] += pc[j] * y[i * ncoeffs + j];
    }
  }
  for (i = 0; i < ncoords; i++) {
    pv[ncoords + i] = 0.0;
    for (j = ncoeffs - 1; j >= 0; j--) {
      pv[ncoords + i] += vc[j] * y[i * ncoeffs + j];
    }
    pv[ncoords + i] *= 2.0 / span;
  }
  return (0);
}


x86 assembly (clang, -O0):
<ephcom_cheby>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %edx,-0x24(%rbp)
mov    %ecx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
cmpl   $0x0,0x2ef6(%rip)
je     1176 <ephcom_cheby+0x66>
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,0x2ef2(%rip)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,0x2ee4(%rip)
movl   $0x0,0x2eba(%rip)
movsd  0x2eaa(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    1194 <ephcom_cheby+0x84>
jp     1194 <ephcom_cheby+0x84>
jmp    137c <ephcom_cheby+0x26c>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,0x2e87(%rip)
movsd  -0x10(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,0x2e8d(%rip)
mov    0x2e8e(%rip),%rax
movsd  0xe3e(%rip),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm0
mov    0x2e76(%rip),%rax
movsd  %xmm0,0x8(%rax)
movl   $0x2,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    12a4 <ephcom_cheby+0x194>
movsd  0x2e4e(%rip),%xmm0
mov    0x2e4f(%rip),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    0x2e3a(%rip),%rax
mov    -0x34(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x2e06(%rip),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x2df6(%rip),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x2de6(%rip),%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1291 <ephcom_cheby+0x181>
jp     1291 <ephcom_cheby+0x181>
mov    0x2dc3(%rip),%rax
movslq -0x34(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    1296 <ephcom_cheby+0x186>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11de <ephcom_cheby+0xce>
mov    0x2da5(%rip),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    0x2d97(%rip),%rax
movsd  0xd3f(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
movsd  0x2d72(%rip),%xmm0
addsd  0x2d6a(%rip),%xmm0
mov    0x2d73(%rip),%rax
movsd  %xmm0,0x10(%rax)
movl   $0x3,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1377 <ephcom_cheby+0x267>
movsd  0x2d43(%rip),%xmm0
mov    0x2d4c(%rip),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    0x2d2f(%rip),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x2d12(%rip),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    0x2d05(%rip),%rax
mov    -0x34(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    0x2cf0(%rip),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12e9 <ephcom_cheby+0x1d9>
jmp    137c <ephcom_cheby+0x26c>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1413 <ephcom_cheby+0x303>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jl     1400 <ephcom_cheby+0x2f0>
mov    0x2c8f(%rip),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x28(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x38(%rbp)
jmp    13a8 <ephcom_cheby+0x298>
jmp    1405 <ephcom_cheby+0x2f5>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1383 <ephcom_cheby+0x273>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    14d3 <ephcom_cheby+0x3c3>
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jl     14a1 <ephcom_cheby+0x391>
mov    0x2bfb(%rip),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x28(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x38(%rbp)
jmp    1444 <ephcom_cheby+0x334>
movsd  0xb5f(%rip),%xmm0
divsd  -0x18(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    141a <ephcom_cheby+0x30a>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ephcom_cheby>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,%rbx
mov    %ecx,%r15d
mov    %rsi,%r14
mov    %edi,%r12d
cmpb   $0x0,0x2f17(%rip)
jne    117b <ephcom_cheby+0x6b>
lea    0x0(,%r12,8),%r13d
mov    %r13d,%edi
movsd  %xmm1,0x8(%rsp)
mov    %edx,%ebp
movaps %xmm0,0x10(%rsp)
call   1030 <malloc@plt>
mov    %rax,0x2ee1(%rip)
mov    %r13d,%edi
call   1030 <malloc@plt>
movapd 0x10(%rsp),%xmm0
mov    %ebp,%edx
movsd  0x8(%rsp),%xmm1
mov    %rax,0x2ecc(%rip)
movb   $0x1,0x2ecd(%rip)
movsd  0x2ea5(%rip),%xmm2
ucomisd %xmm0,%xmm2
jne    118f <ephcom_cheby+0x7f>
jnp    13c3 <ephcom_cheby+0x2b3>
movsd  %xmm0,0x2e91(%rip)
movapd %xmm0,%xmm5
addsd  %xmm0,%xmm5
mov    0x2e92(%rip),%rax
movabs $0x3ff0000000000000,%rcx
mov    %rcx,(%rax)
movsd  %xmm0,0x8(%rax)
cmp    $0x2,%r12d
jle    1214 <ephcom_cheby+0x104>
mov    %r12d,%r8d
mulsd  %xmm5,%xmm0
addsd  0xe3b(%rip),%xmm0
movapd %xmm0,%xmm2
mulsd  %xmm0,%xmm2
xorpd  %xmm4,%xmm4
cmpeqsd %xmm2,%xmm4
andnpd %xmm0,%xmm4
movlpd %xmm4,0x10(%rax)
cmp    $0x3,%r12d
je     12d0 <ephcom_cheby+0x1c0>
lea    -0x3(%r8),%rsi
cmp    $0x4,%r12d
jne    1239 <ephcom_cheby+0x129>
mov    $0x1,%edi
mov    $0x3,%ecx
test   $0x1,%sil
jne    12ad <ephcom_cheby+0x19d>
jmp    12d0 <ephcom_cheby+0x1c0>
xorpd  %xmm2,%xmm2
movhpd 0xde0(%rip),%xmm2
mov    0x2e19(%rip),%rax
movupd %xmm2,(%rax)
addsd  %xmm5,%xmm5
movsd  %xmm5,0x10(%rax)
jmp    13c3 <ephcom_cheby+0x2b3>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
neg    %rdi
mov    $0x3,%ecx
xorpd  %xmm2,%xmm2
nopl   0x0(%rax)
mulsd  %xmm5,%xmm4
subsd  -0x10(%rax,%rcx,8),%xmm4
movapd %xmm4,%xmm3
mulsd  %xmm4,%xmm3
cmpeqsd %xmm2,%xmm3
andnpd %xmm4,%xmm3
movlpd %xmm3,(%rax,%rcx,8)
mulsd  %xmm5,%xmm3
subsd  -0x8(%rax,%rcx,8),%xmm3
movapd %xmm3,%xmm4
mulsd  %xmm3,%xmm4
cmpeqsd %xmm2,%xmm4
andnpd %xmm3,%xmm4
movlpd %xmm4,0x8(%rax,%rcx,8)
lea    (%rdi,%rcx,1),%rbp
add    $0x2,%rbp
add    $0x2,%rcx
cmp    $0x3,%rbp
jne    1250 <ephcom_cheby+0x140>
lea    -0x2(%rcx),%rdi
test   $0x1,%sil
je     12d0 <ephcom_cheby+0x1c0>
mulsd  %xmm5,%xmm4
subsd  (%rax,%rdi,8),%xmm4
movapd %xmm4,%xmm2
mulsd  %xmm4,%xmm2
xorpd  %xmm3,%xmm3
cmpeqsd %xmm2,%xmm3
andnpd %xmm4,%xmm3
movlpd %xmm3,(%rax,%rcx,8)
mov    0x2d69(%rip),%rcx
xorpd  %xmm2,%xmm2
movhpd 0xd1d(%rip),%xmm2
movupd %xmm2,(%rcx)
movapd %xmm5,%xmm3
addsd  %xmm5,%xmm3
movsd  %xmm3,0x10(%rcx)
cmp    $0x4,%r12d
jl     13c3 <ephcom_cheby+0x2b3>
movsd  0x10(%rax),%xmm2
mulsd  %xmm5,%xmm3
addsd  %xmm2,%xmm3
addsd  %xmm2,%xmm3
addsd  0xcf1(%rip),%xmm3
movsd  %xmm3,0x18(%rcx)
je     13c3 <ephcom_cheby+0x2b3>
cmp    $0x5,%r12d
jne    1334 <ephcom_cheby+0x224>
mov    $0x2,%esi
mov    $0x4,%edi
jmp    13a1 <ephcom_cheby+0x291>
lea    -0x4(%r8),%rdi
and    $0xfffffffffffffffe,%rdi
neg    %rdi
mov    $0x2,%esi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  0x8(%rax,%rsi,8),%xmm2
mulsd  %xmm5,%xmm3
addsd  %xmm2,%xmm3
addsd  %xmm2,%xmm3
subsd  (%rcx,%rsi,8),%xmm3
movsd  %xmm3,0x10(%rcx,%rsi,8)
movsd  0x10(%rax,%rsi,8),%xmm2
mulsd  %xmm5,%xmm3
addsd  %xmm2,%xmm3
addsd  %xmm2,%xmm3
subsd  0x8(%rcx,%rsi,8),%xmm3
movsd  %xmm3,0x18(%rcx,%rsi,8)
lea    (%rdi,%rsi,1),%rbp
add    $0x2,%rbp
add    $0x2,%rsi
cmp    $0x2,%rbp
jne    1350 <ephcom_cheby+0x240>
lea    0x2(%rsi),%rdi
test   $0x1,%r8b
je     13c3 <ephcom_cheby+0x2b3>
movsd  -0x8(%rax,%rdi,8),%xmm2
mulsd  %xmm3,%xmm5
addsd  %xmm2,%xmm5
addsd  %xmm2,%xmm5
subsd  (%rcx,%rsi,8),%xmm5
movsd  %xmm5,(%rcx,%rdi,8)
test   %edx,%edx
jle    1559 <ephcom_cheby+0x449>
mov    0x2c66(%rip),%rsi
movslq %r15d,%rax
mov    %edx,%r12d
lea    -0x1(%rax),%r11
lea    -0x8(%r14),%rdi
lea    0x0(,%rax,8),%r8
xor    %ebp,%ebp
xorpd  %xmm0,%xmm0
jmp    13fc <ephcom_cheby+0x2ec>
add    $0x1,%rbp
add    %r8,%rdi
cmp    %r12,%rbp
je     1479 <ephcom_cheby+0x369>
movq   $0x0,(%rbx,%rbp,8)
test   %r15d,%r15d
jle    13f0 <ephcom_cheby+0x2e0>
xorpd  %xmm3,%xmm3
mov    %rax,%rcx
test   $0x1,%al
je     1436 <ephcom_cheby+0x326>
mov    %rbp,%rcx
imul   %rax,%rcx
movsd  -0x8(%rsi,%rax,8),%xmm3
add    %r11,%rcx
mulsd  (%r14,%rcx,8),%xmm3
addsd  %xmm0,%xmm3
movsd  %xmm3,(%rbx,%rbp,8)
mov    %r11,%rcx
test   %r11,%r11
je     13f0 <ephcom_cheby+0x2e0>
add    $0x2,%rcx
nop
movsd  -0x18(%rsi,%rcx,8),%xmm2
mulsd  -0x10(%rdi,%rcx,8),%xmm2
addsd  %xmm3,%xmm2
movsd  %xmm2,(%rbx,%rbp,8)
movsd  -0x20(%rsi,%rcx,8),%xmm3
mulsd  -0x18(%rdi,%rcx,8),%xmm3
addsd  %xmm2,%xmm3
movsd  %xmm3,(%rbx,%rbp,8)
add    $0xfffffffffffffffe,%rcx
cmp    $0x2,%rcx
jg     1440 <ephcom_cheby+0x330>
jmp    13f0 <ephcom_cheby+0x2e0>
test   %edx,%edx
jle    1559 <ephcom_cheby+0x449>
mov    0x2bb8(%rip),%rsi
movsd  0xb80(%rip),%xmm0
divsd  %xmm1,%xmm0
movslq %r15d,%r10
lea    -0x1(%r10),%r8
lea    -0x8(%r14),%rbp
lea    0x0(,%r10,8),%r9
xor    %edi,%edi
xorpd  %xmm1,%xmm1
jmp    14c9 <ephcom_cheby+0x3b9>
nop
mulsd  %xmm0,%xmm2
movsd  %xmm2,(%rbx,%rdx,8)
add    $0x1,%rdi
add    %r9,%rbp
cmp    %r12,%rdi
je     1559 <ephcom_cheby+0x449>
lea    (%rdi,%r12,1),%rdx
movq   $0x0,(%rbx,%rdx,8)
xorpd  %xmm2,%xmm2
test   %r15d,%r15d
jle    14b0 <ephcom_cheby+0x3a0>
xorpd  %xmm2,%xmm2
mov    %r10,%rcx
test   $0x1,%al
je     150c <ephcom_cheby+0x3fc>
mov    %rdi,%rcx
imul   %r10,%rcx
movsd  -0x8(%rsi,%r10,8),%xmm2
add    %r8,%rcx
mulsd  (%r14,%rcx,8),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rbx,%rdx,8)
mov    %r8,%rcx
test   %r11,%r11
je     14b0 <ephcom_cheby+0x3a0>
add    $0x2,%rcx
cs nopw 0x0(%rax,%rax,1)
nop
movsd  -0x18(%rsi,%rcx,8),%xmm3
mulsd  -0x10(%rbp,%rcx,8),%xmm3
addsd  %xmm2,%xmm3
movsd  %xmm3,(%rbx,%rdx,8)
movsd  -0x20(%rsi,%rcx,8),%xmm2
mulsd  -0x18(%rbp,%rcx,8),%xmm2
addsd  %xmm3,%xmm2
movsd  %xmm2,(%rbx,%rdx,8)
add    $0xfffffffffffffffe,%rcx
cmp    $0x2,%rcx
jg     1520 <ephcom_cheby+0x410>
jmp    14b0 <ephcom_cheby+0x3a0>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@ephcom_cheby.twox = internal global double 0.000000e+00
@ephcom_cheby.pc = internal global double* null
@ephcom_cheby.vc = internal global double* null
@ephcom_cheby.lastx = internal global double 2.000000e+00
@ephcom_cheby.init = internal global i32 1
define i32 @ephcom_cheby(i32 %0, double %1, double %2, double* %3, i32 %4, i32 %5, double* %6) {
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double*
%12 = alloca i32
%13 = alloca i32
%14 = alloca double*
%15 = alloca i32
%16 = alloca i32
store i32 %0, i32* %8
store double %1, double* %9
store double %2, double* %10
store double* %3, double** %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store double* %6, double** %14
%17 = load i32, i32* @ephcom_cheby.init
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %32
19: ; preds = %7
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = mul i64 %21, 8
%23 = trunc i64 %22 to i32
%24 = call i64 @malloc(i32 %23)
%25 = inttoptr i64 %24 to double*
store double* %25, double** @ephcom_cheby.pc
%26 = load i32, i32* %8
%27 = sext i32 %26 to i64
%28 = mul i64 %27, 8
%29 = trunc i64 %28 to i32
%30 = call i64 @malloc(i32 %29)
%31 = inttoptr i64 %30 to double*
store double* %31, double** @ephcom_cheby.vc
store i32 0, i32* @ephcom_cheby.init
br label %32
32: ; preds = %19, %7
%33 = load double, double* @ephcom_cheby.lastx
%34 = load double, double* %9
%35 = fcmp une double %33, %34
br i1 %35, label %36, label %142
36: ; preds = %32
%37 = load double, double* %9
store double %37, double* @ephcom_cheby.lastx
%38 = load double, double* %9
%39 = load double, double* %9
%40 = fadd double %38, %39
store double %40, double* @ephcom_cheby.twox
%41 = load double*, double** @ephcom_cheby.pc
%42 = getelementptr inbounds double, double* %41, i64 0
store double 1.000000e+00, double* %42
%43 = load double, double* %9
%44 = load double*, double** @ephcom_cheby.pc
%45 = getelementptr inbounds double, double* %44, i64 1
store double %43, double* %45
store i32 2, i32* %15
br label %46
46: ; preds = %88, %36
%47 = load i32, i32* %15
%48 = load i32, i32* %8
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %91
50: ; preds = %46
%51 = load double, double* @ephcom_cheby.twox
%52 = load double*, double** @ephcom_cheby.pc
%53 = load i32, i32* %15
%54 = sub nsw i32 %53, 1
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %52, i64 %55
%57 = load double, double* %56
%58 = load double*, double** @ephcom_cheby.pc
%59 = load i32, i32* %15
%60 = sub nsw i32 %59, 2
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds double, double* %58, i64 %61
%63 = load double, double* %62
%64 = fneg double %63
%65 = call double @llvm.fmuladd.f64(double %51, double %57, double %64)
%66 = load double*, double** @ephcom_cheby.pc
%67 = load i32, i32* %15
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %66, i64 %68
store double %65, double* %69
%70 = load double*, double** @ephcom_cheby.pc
%71 = load i32, i32* %15
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %70, i64 %72
%74 = load double, double* %73
%75 = load double*, double** @ephcom_cheby.pc
%76 = load i32, i32* %15
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds double, double* %75, i64 %77
%79 = load double, double* %78
%80 = fmul double %74, %79
%81 = fcmp oeq double %80, 0.000000e+00
br i1 %81, label %82, label %87
82: ; preds = %50
%83 = load double*, double** @ephcom_cheby.pc
%84 = load i32, i32* %15
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds double, double* %83, i64 %85
store double 0.000000e+00, double* %86
br label %87
87: ; preds = %82, %50
br label %88
88: ; preds = %87
%89 = load i32, i32* %15
%90 = add nsw i32 %89, 1
store i32 %90, i32* %15
br label %46
91: ; preds = %46
%92 = load double*, double** @ephcom_cheby.vc
%93 = getelementptr inbounds double, double* %92, i64 0
store double 0.000000e+00, double* %93
%94 = load double*, double** @ephcom_cheby.vc
%95 = getelementptr inbounds double, double* %94, i64 1
store double 1.000000e+00, double* %95
%96 = load double, double* @ephcom_cheby.twox
%97 = load double, double* @ephcom_cheby.twox
%98 = fadd double %96, %97
%99 = load double*, double** @ephcom_cheby.vc
%100 = getelementptr inbounds double, double* %99, i64 2
store double %98, double* %100
store i32 3, i32* %15
br label %101
101: ; preds = %138, %91
%102 = load i32, i32* %15
%103 = load i32, i32* %8
%104 = icmp slt i32 %102, %103
br i1 %104, label %105, label %141
105: ; preds = %101
%106 = load double, double* @ephcom_cheby.twox
%107 = load double*, double** @ephcom_cheby.vc
%108 = load i32, i32* %15
%109 = sub nsw i32 %108, 1
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds double, double* %107, i64 %110
%112 = load double, double* %111
%113 = load double*, double** @ephcom_cheby.pc
%114 = load i32, i32* %15
%115 = sub nsw i32 %114, 1
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds double, double* %113, i64 %116
%118 = load double, double* %117
%119 = call double @llvm.fmuladd.f64(double %106, double %112, double %118)
%120 = load double*, double** @ephcom_cheby.pc
%121 = load i32, i32* %15
%122 = sub nsw i32 %121, 1
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds double, double* %120, i64 %123
%125 = load double, double* %124
%126 = fadd double %119, %125
%127 = load double*, double** @ephcom_cheby.vc
%128 = load i32, i32* %15
%129 = sub nsw i32 %128, 2
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds double, double* %127, i64 %130
%132 = load double, double* %131
%133 = fsub double %126, %132
%134 = load double*, double** @ephcom_cheby.vc
%135 = load i32, i32* %15
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds double, double* %134, i64 %136
store double %133, double* %137
br label %138
138: ; preds = %105
%139 = load i32, i32* %15
%140 = add nsw i32 %139, 1
store i32 %140, i32* %15
br label %101
141: ; preds = %101
br label %142
142: ; preds = %141, %32
store i32 0, i32* %15
br label %143
143: ; preds = %182, %142
%144 = load i32, i32* %15
%145 = load i32, i32* %12
%146 = icmp slt i32 %144, %145
br i1 %146, label %147, label %185
147: ; preds = %143
%148 = load double*, double** %14
%149 = load i32, i32* %15
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds double, double* %148, i64 %150
store double 0.000000e+00, double* %151
%152 = load i32, i32* %13
%153 = sub nsw i32 %152, 1
store i32 %153, i32* %16
br label %154
154: ; preds = %178, %147
%155 = load i32, i32* %16
%156 = icmp sge i32 %155, 0
br i1 %156, label %157, label %181
157: ; preds = %154
%158 = load double*, double** @ephcom_cheby.pc
%159 = load i32, i32* %16
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds double, double* %158, i64 %160
%162 = load double, double* %161
%163 = load double*, double** %11
%164 = load i32, i32* %15
%165 = load i32, i32* %13
%166 = mul nsw i32 %164, %165
%167 = load i32, i32* %16
%168 = add nsw i32 %166, %167
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds double, double* %163, i64 %169
%171 = load double, double* %170
%172 = load double*, double** %14
%173 = load i32, i32* %15
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds double, double* %172, i64 %174
%176 = load double, double* %175
%177 = call double @llvm.fmuladd.f64(double %162, double %171, double %176)
store double %177, double* %175
br label %178
178: ; preds = %157
%179 = load i32, i32* %16
%180 = add nsw i32 %179, -1
store i32 %180, i32* %16
br label %154
181: ; preds = %154
br label %182
182: ; preds = %181
%183 = load i32, i32* %15
%184 = add nsw i32 %183, 1
store i32 %184, i32* %15
br label %143
185: ; preds = %143
store i32 0, i32* %15
br label %186
186: ; preds = %239, %185
%187 = load i32, i32* %15
%188 = load i32, i32* %12
%189 = icmp slt i32 %187, %188
br i1 %189, label %190, label %242
190: ; preds = %186
%191 = load double*, double** %14
%192 = load i32, i32* %12
%193 = load i32, i32* %15
%194 = add nsw i32 %192, %193
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds double, double* %191, i64 %195
store double 0.000000e+00, double* %196
%197 = load i32, i32* %13
%198 = sub nsw i32 %197, 1
store i32 %198, i32* %16
br label %199
199: ; preds = %225, %190
%200 = load i32, i32* %16
%201 = icmp sge i32 %200, 0
br i1 %201, label %202, label %228
202: ; preds = %199
%203 = load double*, double** @ephcom_cheby.vc
%204 = load i32, i32* %16
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds double, double* %203, i64 %205
%207 = load double, double* %206
%208 = load double*, double** %11
%209 = load i32, i32* %15
%210 = load i32, i32* %13
%211 = mul nsw i32 %209, %210
%212 = load i32, i32* %16
%213 = add nsw i32 %211, %212
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds double, double* %208, i64 %214
%216 = load double, double* %215
%217 = load double*, double** %14
%218 = load i32, i32* %12
%219 = load i32, i32* %15
%220 = add nsw i32 %218, %219
%221 = sext i32 %220 to i64
%222 = getelementptr inbounds double, double* %217, i64 %221
%223 = load double, double* %222
%224 = call double @llvm.fmuladd.f64(double %207, double %216, double %223)
store double %224, double* %222
br label %225
225: ; preds = %202
%226 = load i32, i32* %16
%227 = add nsw i32 %226, -1
store i32 %227, i32* %16
br label %199
228: ; preds = %199
%229 = load double, double* %10
%230 = fdiv double 2.000000e+00, %229
%231 = load double*, double** %14
%232 = load i32, i32* %12
%233 = load i32, i32* %15
%234 = add nsw i32 %232, %233
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds double, double* %231, i64 %235
%237 = load double, double* %236
%238 = fmul double %237, %230
store double %238, double* %236
br label %239
239: ; preds = %228
%240 = load i32, i32* %15
%241 = add nsw i32 %240, 1
store i32 %241, i32* %15
br label %186
242: ; preds = %186
ret i32 0
}

LLVM IR (-O2):
@ephcom_cheby.pc = internal unnamed_addr global double* null
@ephcom_cheby.vc = internal unnamed_addr global double* null
@ephcom_cheby.lastx = internal unnamed_addr global double 2.000000e+00
@ephcom_cheby.init = internal unnamed_addr global i1 false
define i32 @ephcom_cheby(i32 %0, double %1, double %2, double* nocapture %3, i32 %4, i32 %5, double* nocapture %6) {
%8 = load i1, i1* @ephcom_cheby.init
br i1 %8, label %15, label %9
9: ; preds = %7
%10 = shl i32 %0, 3
%11 = tail call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to double*
store double* %12, double** @ephcom_cheby.pc
%13 = tail call i64 @malloc(i32 %10)
%14 = inttoptr i64 %13 to double*
store double* %14, double** @ephcom_cheby.vc
store i1 true, i1* @ephcom_cheby.init
br label %15
15: ; preds = %9, %7
%16 = load double, double* @ephcom_cheby.lastx
%17 = fcmp une double %16, %1
br i1 %17, label %18, label %144
18: ; preds = %15
store double %1, double* @ephcom_cheby.lastx
%19 = fadd double %1, %1
%20 = load double*, double** @ephcom_cheby.pc
store double 1.000000e+00, double* %20
%21 = getelementptr inbounds double, double* %20, i64 1
store double %1, double* %21
%22 = icmp sgt i32 %0, 2
br i1 %22, label %28, label %23
23: ; preds = %18
%24 = load double*, double** @ephcom_cheby.vc
%25 = bitcast double* %24 to <2 x double>*
store <2 x double> <double 0.000000e+00, double 1.000000e+00>, <2 x double>* %25
%26 = fadd double %19, %19
%27 = getelementptr inbounds double, double* %24, i64 2
store double %26, double* %27
br label %144
28: ; preds = %18
%29 = zext i32 %0 to i64
%30 = tail call double @llvm.fmuladd.f64(double %19, double %1, double -1.000000e+00)
%31 = getelementptr inbounds double, double* %20, i64 2
%32 = fmul double %30, %30
%33 = fcmp oeq double %32, 0.000000e+00
%34 = select i1 %33, double 0.000000e+00, double %30
store double %34, double* %31
%35 = icmp eq i32 %0, 3
br i1 %35, label %83, label %36
36: ; preds = %28
%37 = add nsw i64 %29, -3
%38 = and i64 %37, 1
%39 = icmp eq i32 %0, 4
br i1 %39, label %69, label %40
40: ; preds = %36
%41 = and i64 %37, -2
br label %42
42: ; preds = %42, %40
%43 = phi i64 [ 3, %40 ], [ %66, %42 ]
%44 = phi double [ %34, %40 ], [ %65, %42 ]
%45 = phi i64 [ 2, %40 ], [ %56, %42 ]
%46 = phi i64 [ 0, %40 ], [ %67, %42 ]
%47 = add nsw i64 %45, -1
%48 = getelementptr inbounds double, double* %20, i64 %47
%49 = load double, double* %48
%50 = fneg double %49
%51 = tail call double @llvm.fmuladd.f64(double %19, double %44, double %50)
%52 = getelementptr inbounds double, double* %20, i64 %43
%53 = fmul double %51, %51
%54 = fcmp oeq double %53, 0.000000e+00
%55 = select i1 %54, double 0.000000e+00, double %51
store double %55, double* %52
%56 = add nuw nsw i64 %43, 1
%57 = add nsw i64 %43, -1
%58 = getelementptr inbounds double, double* %20, i64 %57
%59 = load double, double* %58
%60 = fneg double %59
%61 = tail call double @llvm.fmuladd.f64(double %19, double %55, double %60)
%62 = getelementptr inbounds double, double* %20, i64 %56
%63 = fmul double %61, %61
%64 = fcmp oeq double %63, 0.000000e+00
%65 = select i1 %64, double 0.000000e+00, double %61
store double %65, double* %62
%66 = add nuw nsw i64 %43, 2
%67 = add i64 %46, 2
%68 = icmp eq i64 %67, %41
br i1 %68, label %69, label %42
69: ; preds = %42, %36
%70 = phi i64 [ 3, %36 ], [ %66, %42 ]
%71 = phi double [ %34, %36 ], [ %65, %42 ]
%72 = phi i64 [ 1, %36 ], [ %43, %42 ]
%73 = icmp eq i64 %38, 0
br i1 %73, label %83, label %74
74: ; preds = %69
%75 = getelementptr inbounds double, double* %20, i64 %72
%76 = load double, double* %75
%77 = fneg double %76
%78 = tail call double @llvm.fmuladd.f64(double %19, double %71, double %77)
%79 = getelementptr inbounds double, double* %20, i64 %70
%80 = fmul double %78, %78
%81 = fcmp oeq double %80, 0.000000e+00
%82 = select i1 %81, double 0.000000e+00, double %78
store double %82, double* %79
br label %83
83: ; preds = %74, %69, %28
%84 = load double*, double** @ephcom_cheby.vc
%85 = bitcast double* %84 to <2 x double>*
store <2 x double> <double 0.000000e+00, double 1.000000e+00>, <2 x double>* %85
%86 = fadd double %19, %19
%87 = getelementptr inbounds double, double* %84, i64 2
store double %86, double* %87
%88 = icmp sgt i32 %0, 3
br i1 %88, label %89, label %144
89: ; preds = %83
%90 = getelementptr inbounds double, double* %20, i64 2
%91 = load double, double* %90
%92 = tail call double @llvm.fmuladd.f64(double %19, double %86, double %91)
%93 = fadd double %91, %92
%94 = fadd double %93, -1.000000e+00
%95 = getelementptr inbounds double, double* %84, i64 3
store double %94, double* %95
%96 = icmp eq i32 %0, 4
br i1 %96, label %144, label %97
97: ; preds = %89
%98 = and i64 %29, 1
%99 = icmp eq i32 %0, 5
br i1 %99, label %129, label %100
100: ; preds = %97
%101 = add nsw i64 %29, -4
%102 = and i64 %101, -2
br label %103
103: ; preds = %103, %100
%104 = phi i64 [ 4, %100 ], [ %126, %103 ]
%105 = phi double [ %94, %100 ], [ %124, %103 ]
%106 = phi i64 [ 2, %100 ], [ %104, %103 ]
%107 = phi i64 [ 0, %100 ], [ %127, %103 ]
%108 = getelementptr inbounds double, double* %84, i64 %106
%109 = load double, double* %108
%110 = add nsw i64 %104, -1
%111 = getelementptr inbounds double, double* %20, i64 %110
%112 = load double, double* %111
%113 = tail call double @llvm.fmuladd.f64(double %19, double %105, double %112)
%114 = fadd double %112, %113
%115 = fsub double %114, %109
%116 = getelementptr inbounds double, double* %84, i64 %104
store double %115, double* %116
%117 = or i64 %104, 1
%118 = getelementptr inbounds double, double* %84, i64 %110
%119 = load double, double* %118
%120 = getelementptr inbounds double, double* %20, i64 %104
%121 = load double, double* %120
%122 = tail call double @llvm.fmuladd.f64(double %19, double %115, double %121)
%123 = fadd double %121, %122
%124 = fsub double %123, %119
%125 = getelementptr inbounds double, double* %84, i64 %117
store double %124, double* %125
%126 = add nuw nsw i64 %104, 2
%127 = add i64 %107, 2
%128 = icmp eq i64 %127, %102
br i1 %128, label %129, label %103
129: ; preds = %103, %97
%130 = phi i64 [ 4, %97 ], [ %126, %103 ]
%131 = phi double [ %94, %97 ], [ %124, %103 ]
%132 = phi i64 [ 2, %97 ], [ %104, %103 ]
%133 = icmp eq i64 %98, 0
br i1 %133, label %144, label %134
134: ; preds = %129
%135 = getelementptr inbounds double, double* %84, i64 %132
%136 = load double, double* %135
%137 = add nsw i64 %130, -1
%138 = getelementptr inbounds double, double* %20, i64 %137
%139 = load double, double* %138
%140 = tail call double @llvm.fmuladd.f64(double %19, double %131, double %139)
%141 = fadd double %139, %140
%142 = fsub double %141, %136
%143 = getelementptr inbounds double, double* %84, i64 %130
store double %142, double* %143
br label %144
144: ; preds = %134, %129, %89, %23, %83, %15
%145 = icmp sgt i32 %4, 0
br i1 %145, label %146, label %244
146: ; preds = %144
%147 = icmp sgt i32 %5, 0
%148 = load double*, double** @ephcom_cheby.pc
%149 = sext i32 %5 to i64
%150 = zext i32 %4 to i64
%151 = add nsw i64 %149, -1
%152 = and i64 %149, 1
%153 = icmp eq i64 %152, 0
%154 = add nsw i64 %149, -1
%155 = getelementptr inbounds double, double* %148, i64 %154
%156 = icmp eq i64 %151, 0
br label %170
157: ; preds = %202
br i1 %145, label %158, label %244
158: ; preds = %157
%159 = icmp sgt i32 %5, 0
%160 = load double*, double** @ephcom_cheby.vc
%161 = fdiv double 2.000000e+00, %2
%162 = sext i32 %5 to i64
%163 = zext i32 %4 to i64
%164 = zext i32 %4 to i64
%165 = and i64 %149, 1
%166 = icmp eq i64 %165, 0
%167 = add nsw i64 %162, -1
%168 = getelementptr inbounds double, double* %160, i64 %167
%169 = icmp eq i64 %151, 0
br label %205
170: ; preds = %146, %202
%171 = phi i64 [ 0, %146 ], [ %203, %202 ]
%172 = getelementptr inbounds double, double* %6, i64 %171
store double 0.000000e+00, double* %172
br i1 %147, label %173, label %202
173: ; preds = %170
%174 = mul nsw i64 %171, %149
br i1 %153, label %181, label %175
175: ; preds = %173
%176 = load double, double* %155
%177 = add nsw i64 %154, %174
%178 = getelementptr inbounds double, double* %3, i64 %177
%179 = load double, double* %178
%180 = tail call double @llvm.fmuladd.f64(double %176, double %179, double 0.000000e+00)
store double %180, double* %172
br label %181
181: ; preds = %175, %173
%182 = phi i64 [ %149, %173 ], [ %154, %175 ]
%183 = phi double [ 0.000000e+00, %173 ], [ %180, %175 ]
br i1 %156, label %202, label %184
184: ; preds = %181, %184
%185 = phi i64 [ %194, %184 ], [ %182, %181 ]
%186 = phi double [ %200, %184 ], [ %183, %181 ]
%187 = add nsw i64 %185, -1
%188 = getelementptr inbounds double, double* %148, i64 %187
%189 = load double, double* %188
%190 = add nsw i64 %187, %174
%191 = getelementptr inbounds double, double* %3, i64 %190
%192 = load double, double* %191
%193 = tail call double @llvm.fmuladd.f64(double %189, double %192, double %186)
store double %193, double* %172
%194 = add nsw i64 %185, -2
%195 = getelementptr inbounds double, double* %148, i64 %194
%196 = load double, double* %195
%197 = add nsw i64 %194, %174
%198 = getelementptr inbounds double, double* %3, i64 %197
%199 = load double, double* %198
%200 = tail call double @llvm.fmuladd.f64(double %196, double %199, double %193)
store double %200, double* %172
%201 = icmp sgt i64 %185, 2
br i1 %201, label %184, label %202
202: ; preds = %181, %184, %170
%203 = add nuw nsw i64 %171, 1
%204 = icmp eq i64 %203, %150
br i1 %204, label %157, label %170
205: ; preds = %158, %239
%206 = phi i64 [ 0, %158 ], [ %242, %239 ]
%207 = add nuw nsw i64 %206, %163
%208 = getelementptr inbounds double, double* %6, i64 %207
store double 0.000000e+00, double* %208
br i1 %159, label %209, label %239
209: ; preds = %205
%210 = mul nsw i64 %206, %162
br i1 %166, label %217, label %211
211: ; preds = %209
%212 = load double, double* %168
%213 = add nsw i64 %167, %210
%214 = getelementptr inbounds double, double* %3, i64 %213
%215 = load double, double* %214
%216 = tail call double @llvm.fmuladd.f64(double %212, double %215, double 0.000000e+00)
store double %216, double* %208
br label %217
217: ; preds = %211, %209
%218 = phi i64 [ %162, %209 ], [ %167, %211 ]
%219 = phi double [ 0.000000e+00, %209 ], [ %216, %211 ]
%220 = phi double [ undef, %209 ], [ %216, %211 ]
br i1 %169, label %239, label %221
221: ; preds = %217, %221
%222 = phi i64 [ %231, %221 ], [ %218, %217 ]
%223 = phi double [ %237, %221 ], [ %219, %217 ]
%224 = add nsw i64 %222, -1
%225 = getelementptr inbounds double, double* %160, i64 %224
%226 = load double, double* %225
%227 = add nsw i64 %224, %210
%228 = getelementptr inbounds double, double* %3, i64 %227
%229 = load double, double* %228
%230 = tail call double @llvm.fmuladd.f64(double %226, double %229, double %223)
store double %230, double* %208
%231 = add nsw i64 %222, -2
%232 = getelementptr inbounds double, double* %160, i64 %231
%233 = load double, double* %232
%234 = add nsw i64 %231, %210
%235 = getelementptr inbounds double, double* %3, i64 %234
%236 = load double, double* %235
%237 = tail call double @llvm.fmuladd.f64(double %233, double %236, double %230)
store double %237, double* %208
%238 = icmp sgt i64 %222, 2
br i1 %238, label %221, label %239
239: ; preds = %217, %221, %205
%240 = phi double [ 0.000000e+00, %205 ], [ %220, %217 ], [ %237, %221 ]
%241 = fmul double %161, %240
store double %241, double* %208
%242 = add nuw nsw i64 %206, 1
%243 = icmp eq i64 %242, %164
br i1 %243, label %244, label %205
244: ; preds = %239, %144, %157
ret i32 0
}