#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 internal_pow(double, int);
double nchoosek(int, int);
void generate_delta_coefficients(double vetor[], double out[], int n,
                                 double delta) {
  int i, j;
  int N = n - 1;
  double sum_delta_operator;
  for (i = 0; i <= N; i++) {
    sum_delta_operator = 0;
    for (j = 0; j <= i; j++) {
      sum_delta_operator =
          sum_delta_operator + vetor[j] * nchoosek(N - j, i - j);
    }
    out[i] = internal_pow(delta, N - i) * sum_delta_operator;
  }
}


x86 assembly (clang, -O0):
<generate_delta_coefficients>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jg     11f4 <generate_delta_coefficients+0xd4>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     11c4 <generate_delta_coefficients+0xa4>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x2c(%rbp),%edi
sub    -0x28(%rbp),%edi
mov    -0x24(%rbp),%esi
sub    -0x28(%rbp),%esi
call   1040 <nchoosek@plt>
movsd  -0x48(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1163 <generate_delta_coefficients+0x43>
movsd  -0x20(%rbp),%xmm0
mov    -0x2c(%rbp),%edi
sub    -0x24(%rbp),%edi
call   1030 <internal_pow@plt>
mulsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1148 <generate_delta_coefficients+0x28>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_delta_coefficients>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movsd  %xmm0,0x18(%rsp)
mov    %rsi,0x10(%rsp)
mov    %rdi,0x8(%rsp)
test   %edx,%edx
jle    11e7 <generate_delta_coefficients+0xc7>
mov    %edx,%r12d
mov    %edx,%r13d
add    $0xffffffff,%r12d
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xorpd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
mov    0x8(%rsp),%r15
mov    %r12d,%ebp
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%r15),%xmm0
movsd  %xmm0,0x20(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <nchoosek@plt>
mulsd  0x20(%rsp),%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
add    $0xffffffff,%ebp
add    $0x8,%r15
add    $0xffffffffffffffff,%rbx
jb     1180 <generate_delta_coefficients+0x60>
mov    %r12d,%edi
sub    %r14d,%edi
movsd  0x18(%rsp),%xmm0
call   1030 <internal_pow@plt>
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
mov    0x10(%rsp),%rax
movsd  %xmm1,(%rax,%r14,8)
add    $0x1,%r14
cmp    %r13,%r14
jne    1160 <generate_delta_coefficients+0x40>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @generate_delta_coefficients(double* %0, double* %1, i32 %2, double %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
store double* %0, double** %5
store double* %1, double** %6
store i32 %2, i32* %7
store double %3, double* %8
%13 = load i32, i32* %7
%14 = sub nsw i32 %13, 1
store i32 %14, i32* %11
store i32 0, i32* %9
br label %15
15: ; preds = %54, %4
%16 = load i32, i32* %9
%17 = load i32, i32* %11
%18 = icmp sle i32 %16, %17
br i1 %18, label %19, label %57
19: ; preds = %15
store double 0.000000e+00, double* %12
store i32 0, i32* %10
br label %20
20: ; preds = %39, %19
%21 = load i32, i32* %10
%22 = load i32, i32* %9
%23 = icmp sle i32 %21, %22
br i1 %23, label %24, label %42
24: ; preds = %20
%25 = load double, double* %12
%26 = load double*, double** %5
%27 = load i32, i32* %10
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %26, i64 %28
%30 = load double, double* %29
%31 = load i32, i32* %11
%32 = load i32, i32* %10
%33 = sub nsw i32 %31, %32
%34 = load i32, i32* %9
%35 = load i32, i32* %10
%36 = sub nsw i32 %34, %35
%37 = call double @nchoosek(i32 %33, i32 %36)
%38 = call double @llvm.fmuladd.f64(double %30, double %37, double %25)
store double %38, double* %12
br label %39
39: ; preds = %24
%40 = load i32, i32* %10
%41 = add nsw i32 %40, 1
store i32 %41, i32* %10
br label %20
42: ; preds = %20
%43 = load double, double* %8
%44 = load i32, i32* %11
%45 = load i32, i32* %9
%46 = sub nsw i32 %44, %45
%47 = call double @internal_pow(double %43, i32 %46)
%48 = load double, double* %12
%49 = fmul double %47, %48
%50 = load double*, double** %6
%51 = load i32, i32* %9
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double, double* %50, i64 %52
store double %49, double* %53
br label %54
54: ; preds = %42
%55 = load i32, i32* %9
%56 = add nsw i32 %55, 1
store i32 %56, i32* %9
br label %15
57: ; preds = %15
ret void
}

LLVM IR (-O2):
define void @generate_delta_coefficients(double* nocapture %0, double* nocapture writeonly %1, i32 %2, double %3) {
%5 = add nsw i32 %2, -1
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %34
7: ; preds = %4
%8 = zext i32 %2 to i64
br label %9
9: ; preds = %7, %25
%10 = phi i64 [ 0, %7 ], [ %31, %25 ]
%11 = phi i64 [ 1, %7 ], [ %32, %25 ]
br label %12
12: ; preds = %9, %12
%13 = phi i64 [ 0, %9 ], [ %23, %12 ]
%14 = phi double [ 0.000000e+00, %9 ], [ %22, %12 ]
%15 = getelementptr inbounds double, double* %0, i64 %13
%16 = load double, double* %15
%17 = trunc i64 %13 to i32
%18 = sub nsw i32 %5, %17
%19 = sub nsw i64 %10, %13
%20 = trunc i64 %19 to i32
%21 = tail call double @nchoosek(i32 %18, i32 %20)
%22 = tail call double @llvm.fmuladd.f64(double %16, double %21, double %14)
%23 = add nuw nsw i64 %13, 1
%24 = icmp eq i64 %23, %11
br i1 %24, label %25, label %12
25: ; preds = %12
%26 = trunc i64 %10 to i32
%27 = sub nsw i32 %5, %26
%28 = tail call double @internal_pow(double %3, i32 %27)
%29 = fmul double %22, %28
%30 = getelementptr inbounds double, double* %1, i64 %10
store double %29, double* %30
%31 = add nuw nsw i64 %10, 1
%32 = add nuw nsw i64 %11, 1
%33 = icmp eq i64 %31, %8
br i1 %33, label %34, label %9
34: ; preds = %25, %4
ret void
}