#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 HTS_mlsafir(double, double const *, int const, double const,
                   double const, double *);
double HTS_mlsadf2(double x, const double *b, const int m, const double a,
                   const double aa, const int pd, double *d,
                   const double *ppade) {
  double v, out = 0.0, *pt;
  int i;
  pt = &d[pd * (m + 2)];
  for (i = pd; i >= 1; i--) {
    pt[i] = HTS_mlsafir(pt[i - 1], b, m, a, aa, &d[(i - 1) * (m + 2)]);
    v = pt[i] * ppade[i];
    x += (1 & i) ? v : -v;
    out += v;
  }
  pt[0] = x;
  out += x;
  return (out);
}


x86 assembly (clang, -O0):
<HTS_mlsadf2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
mov    %edx,-0x2c(%rbp)
mov    %rcx,-0x38(%rbp)
mov    %r8,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    -0x14(%rbp),%edx
add    $0x2,%edx
imul   %edx,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
cmpl   $0x1,-0x5c(%rbp)
jl     124a <HTS_mlsadf2+0x13a>
mov    -0x58(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
mov    -0x38(%rbp),%rdx
mov    -0x5c(%rbp),%eax
sub    $0x1,%eax
mov    -0x14(%rbp),%ecx
add    $0x2,%ecx
imul   %ecx,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
call   1030 <HTS_mlsafir@plt>
mov    -0x58(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x58(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x5c(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11fd <HTS_mlsadf2+0xed>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    121e <HTS_mlsadf2+0x10e>
movsd  -0x48(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x48(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x5c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x5c(%rbp)
jmp    1165 <HTS_mlsadf2+0x55>
movsd  -0x8(%rbp),%xmm0
mov    -0x58(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HTS_mlsadf2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,(%rsp)
mov    %esi,%r12d
movapd %xmm0,%xmm1
lea    0x2(%r12),%eax
mov    %eax,%esi
imul   %edx,%esi
movslq %esi,%rsi
lea    (%rcx,%rsi,8),%r13
test   %edx,%edx
jle    11ee <HTS_mlsadf2+0xde>
mov    %rdi,%r15
mov    %edx,%r14d
movslq %eax,%rbp
lea    -0x1(%r14),%rax
imul   %rbp,%rax
lea    (%rcx,%rax,8),%rbx
shl    $0x3,%rbp
neg    %rbp
xorpd  %xmm0,%xmm0
jmp    119c <HTS_mlsadf2+0x8c>
movsd  0x20(%rsp),%xmm2
addsd  %xmm1,%xmm2
movapd %xmm2,%xmm1
lea    -0x1(%r14),%rax
movsd  0x18(%rsp),%xmm2
addsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
add    %rbp,%rbx
cmp    $0x1,%r14
mov    %rax,%r14
jbe    11f2 <HTS_mlsadf2+0xe2>
movsd  %xmm0,0x18(%rsp)
movsd  %xmm1,0x20(%rsp)
movsd  -0x8(%r13,%r14,8),%xmm0
mov    %r15,%rdi
mov    %r12d,%esi
movsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
mov    %rbx,%rdx
call   1030 <HTS_mlsafir@plt>
movsd  %xmm0,0x0(%r13,%r14,8)
mov    0x10(%rsp),%rax
mulsd  (%rax,%r14,8),%xmm0
movapd %xmm0,%xmm1
test   $0x1,%r14b
jne    1170 <HTS_mlsadf2+0x60>
xorpd  0xe14(%rip),%xmm1
jmp    1170 <HTS_mlsadf2+0x60>
xorpd  %xmm0,%xmm0
movsd  %xmm1,0x0(%r13)
addsd  %xmm1,%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @HTS_mlsadf2(double %0, double* %1, i32 %2, double %3, double %4, i32 %5, double* %6, double* %7) {
%9 = alloca double
%10 = alloca double*
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca i32
%15 = alloca double*
%16 = alloca double*
%17 = alloca double
%18 = alloca double
%19 = alloca double*
%20 = alloca i32
store double %0, double* %9
store double* %1, double** %10
store i32 %2, i32* %11
store double %3, double* %12
store double %4, double* %13
store i32 %5, i32* %14
store double* %6, double** %15
store double* %7, double** %16
store double 0.000000e+00, double* %18
%21 = load double*, double** %15
%22 = load i32, i32* %14
%23 = load i32, i32* %11
%24 = add nsw i32 %23, 2
%25 = mul nsw i32 %22, %24
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %21, i64 %26
store double* %27, double** %19
%28 = load i32, i32* %14
store i32 %28, i32* %20
br label %29
29: ; preds = %82, %8
%30 = load i32, i32* %20
%31 = icmp sge i32 %30, 1
br i1 %31, label %32, label %85
32: ; preds = %29
%33 = load double*, double** %19
%34 = load i32, i32* %20
%35 = sub 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 double*, double** %10
%40 = load i32, i32* %11
%41 = load double, double* %12
%42 = load double, double* %13
%43 = load double*, double** %15
%44 = load i32, i32* %20
%45 = sub nsw i32 %44, 1
%46 = load i32, i32* %11
%47 = add nsw i32 %46, 2
%48 = mul nsw i32 %45, %47
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %43, i64 %49
%51 = call double @HTS_mlsafir(double %38, double* %39, i32 %40, double %41, double %42, double* %50)
%52 = load double*, double** %19
%53 = load i32, i32* %20
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %52, i64 %54
store double %51, double* %55
%56 = load double*, double** %19
%57 = load i32, i32* %20
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
%60 = load double, double* %59
%61 = load double*, double** %16
%62 = load i32, i32* %20
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %61, i64 %63
%65 = load double, double* %64
%66 = fmul double %60, %65
store double %66, double* %17
%67 = load i32, i32* %20
%68 = and i32 1, %67
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %72
70: ; preds = %32
%71 = load double, double* %17
br label %75
72: ; preds = %32
%73 = load double, double* %17
%74 = fneg double %73
br label %75
75: ; preds = %72, %70
%76 = phi double [ %71, %70 ], [ %74, %72 ]
%77 = load double, double* %9
%78 = fadd double %77, %76
store double %78, double* %9
%79 = load double, double* %17
%80 = load double, double* %18
%81 = fadd double %80, %79
store double %81, double* %18
br label %82
82: ; preds = %75
%83 = load i32, i32* %20
%84 = add nsw i32 %83, -1
store i32 %84, i32* %20
br label %29
85: ; preds = %29
%86 = load double, double* %9
%87 = load double*, double** %19
%88 = getelementptr inbounds double, double* %87, i64 0
store double %86, double* %88
%89 = load double, double* %9
%90 = load double, double* %18
%91 = fadd double %90, %89
store double %91, double* %18
%92 = load double, double* %18
ret double %92
}

LLVM IR (-O2):
define double @HTS_mlsadf2(double %0, double* %1, i32 %2, double %3, double %4, i32 %5, double* %6, double* nocapture %7) {
%9 = add nsw i32 %2, 2
%10 = mul nsw i32 %9, %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds double, double* %6, i64 %11
%13 = icmp sgt i32 %5, 0
br i1 %13, label %14, label %38
14: ; preds = %8
%15 = zext i32 %5 to i64
%16 = sext i32 %9 to i64
br label %17
17: ; preds = %14, %17
%18 = phi i64 [ %15, %14 ], [ %21, %17 ]
%19 = phi double [ %0, %14 ], [ %35, %17 ]
%20 = phi double [ 0.000000e+00, %14 ], [ %36, %17 ]
%21 = add nsw i64 %18, -1
%22 = getelementptr inbounds double, double* %12, i64 %21
%23 = load double, double* %22
%24 = mul nsw i64 %21, %16
%25 = getelementptr inbounds double, double* %6, i64 %24
%26 = tail call double @HTS_mlsafir(double %23, double* %1, i32 %2, double %3, double %4, double* %25)
%27 = getelementptr inbounds double, double* %12, i64 %18
store double %26, double* %27
%28 = getelementptr inbounds double, double* %7, i64 %18
%29 = load double, double* %28
%30 = fmul double %26, %29
%31 = and i64 %18, 1
%32 = icmp eq i64 %31, 0
%33 = fneg double %30
%34 = select i1 %32, double %33, double %30
%35 = fadd double %19, %34
%36 = fadd double %20, %30
%37 = icmp ugt i64 %18, 1
br i1 %37, label %17, label %38
38: ; preds = %17, %8
%39 = phi double [ 0.000000e+00, %8 ], [ %36, %17 ]
%40 = phi double [ %0, %8 ], [ %35, %17 ]
store double %40, double* %12
%41 = fadd double %39, %40
ret double %41
}