#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 get_delta_transfer_function_with_base(double b[], double b_out[],
                                           int b_size, double a[],
                                           double a_out[], int a_size,
                                           double delta) {
  int i, j;
  int N = a_size - 1;
  int M = b_size - 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 + a[j] * nchoosek(N - j, i - j);
    }
    a_out[i] = internal_pow(delta, N - i) * sum_delta_operator;
  }
  for (i = 0; i <= M; i++) {
    sum_delta_operator = 0;
    for (j = 0; j <= i; j++) {
      sum_delta_operator = sum_delta_operator + b[j] * nchoosek(M - j, i - j);
    }
    b_out[i] = internal_pow(delta, M - i) * sum_delta_operator;
  }
}


x86 assembly (clang, -O0):
<get_delta_transfer_function_with_base>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
movsd  %xmm0,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x48(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x44(%rbp),%eax
jg     1209 <get_delta_transfer_function_with_base+0xe9>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jg     11d9 <get_delta_transfer_function_with_base+0xb9>
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x44(%rbp),%edi
sub    -0x40(%rbp),%edi
mov    -0x3c(%rbp),%esi
sub    -0x40(%rbp),%esi
call   1040 <nchoosek@plt>
movsd  -0x60(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1178 <get_delta_transfer_function_with_base+0x58>
movsd  -0x38(%rbp),%xmm0
mov    -0x44(%rbp),%edi
sub    -0x3c(%rbp),%edi
call   1030 <internal_pow@plt>
mulsd  -0x50(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    115d <get_delta_transfer_function_with_base+0x3d>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x48(%rbp),%eax
jg     12bc <get_delta_transfer_function_with_base+0x19c>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jg     128c <get_delta_transfer_function_with_base+0x16c>
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x48(%rbp),%edi
sub    -0x40(%rbp),%edi
mov    -0x3c(%rbp),%esi
sub    -0x40(%rbp),%esi
call   1040 <nchoosek@plt>
movsd  -0x70(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    122b <get_delta_transfer_function_with_base+0x10b>
movsd  -0x38(%rbp),%xmm0
mov    -0x48(%rbp),%edi
sub    -0x3c(%rbp),%edi
call   1030 <internal_pow@plt>
mulsd  -0x50(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1210 <get_delta_transfer_function_with_base+0xf0>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_delta_transfer_function_with_base>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movsd  %xmm0,0x18(%rsp)
mov    %r8,0x30(%rsp)
mov    %rcx,0x28(%rsp)
mov    %edx,%r12d
mov    %rsi,0x40(%rsp)
mov    %rdi,0x38(%rsp)
test   %r9d,%r9d
jle    11fc <get_delta_transfer_function_with_base+0xdc>
mov    %r9d,%r14d
mov    %r9d,%eax
mov    %rax,0x20(%rsp)
add    $0xffffffff,%r14d
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    0x28(%rsp),%rbx
mov    %r14d,%ebp
mov    %r13,%r15
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %ebp,%edi
mov    %r15d,%esi
call   1040 <nchoosek@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
add    $0xffffffff,%ebp
add    $0x8,%rbx
add    $0xffffffffffffffff,%r15
jb     1190 <get_delta_transfer_function_with_base+0x70>
mov    %r14d,%edi
sub    %r13d,%edi
movsd  0x18(%rsp),%xmm0
call   1030 <internal_pow@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
mov    0x30(%rsp),%rax
movsd  %xmm1,(%rax,%r13,8)
add    $0x1,%r13
cmp    0x20(%rsp),%r13
jne    1170 <get_delta_transfer_function_with_base+0x50>
test   %r12d,%r12d
jle    129b <get_delta_transfer_function_with_base+0x17b>
mov    %r12d,%r14d
add    $0xffffffff,%r12d
xor    %r15d,%r15d
nop
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    0x38(%rsp),%r13
mov    %r12d,%ebp
mov    %r15,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0x0(%r13),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <nchoosek@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
add    $0xffffffff,%ebp
add    $0x8,%r13
add    $0xffffffffffffffff,%rbx
jb     1230 <get_delta_transfer_function_with_base+0x110>
mov    %r12d,%edi
sub    %r15d,%edi
movsd  0x18(%rsp),%xmm0
call   1030 <internal_pow@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
mov    0x40(%rsp),%rax
movsd  %xmm1,(%rax,%r15,8)
add    $0x1,%r15
cmp    %r14,%r15
jne    1210 <get_delta_transfer_function_with_base+0xf0>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @get_delta_transfer_function_with_base(double* %0, double* %1, i32 %2, double* %3, double* %4, i32 %5, double %6) {
%8 = alloca double*
%9 = alloca double*
%10 = alloca i32
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
%14 = alloca double
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca double
store double* %0, double** %8
store double* %1, double** %9
store i32 %2, i32* %10
store double* %3, double** %11
store double* %4, double** %12
store i32 %5, i32* %13
store double %6, double* %14
%20 = load i32, i32* %13
%21 = sub nsw i32 %20, 1
store i32 %21, i32* %17
%22 = load i32, i32* %10
%23 = sub nsw i32 %22, 1
store i32 %23, i32* %18
store i32 0, i32* %15
br label %24
24: ; preds = %63, %7
%25 = load i32, i32* %15
%26 = load i32, i32* %17
%27 = icmp sle i32 %25, %26
br i1 %27, label %28, label %66
28: ; preds = %24
store double 0.000000e+00, double* %19
store i32 0, i32* %16
br label %29
29: ; preds = %48, %28
%30 = load i32, i32* %16
%31 = load i32, i32* %15
%32 = icmp sle i32 %30, %31
br i1 %32, label %33, label %51
33: ; preds = %29
%34 = load double, double* %19
%35 = load double*, double** %11
%36 = load i32, i32* %16
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %35, i64 %37
%39 = load double, double* %38
%40 = load i32, i32* %17
%41 = load i32, i32* %16
%42 = sub nsw i32 %40, %41
%43 = load i32, i32* %15
%44 = load i32, i32* %16
%45 = sub nsw i32 %43, %44
%46 = call double @nchoosek(i32 %42, i32 %45)
%47 = call double @llvm.fmuladd.f64(double %39, double %46, double %34)
store double %47, double* %19
br label %48
48: ; preds = %33
%49 = load i32, i32* %16
%50 = add nsw i32 %49, 1
store i32 %50, i32* %16
br label %29
51: ; preds = %29
%52 = load double, double* %14
%53 = load i32, i32* %17
%54 = load i32, i32* %15
%55 = sub nsw i32 %53, %54
%56 = call double @internal_pow(double %52, i32 %55)
%57 = load double, double* %19
%58 = fmul double %56, %57
%59 = load double*, double** %12
%60 = load i32, i32* %15
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds double, double* %59, i64 %61
store double %58, double* %62
br label %63
63: ; preds = %51
%64 = load i32, i32* %15
%65 = add nsw i32 %64, 1
store i32 %65, i32* %15
br label %24
66: ; preds = %24
store i32 0, i32* %15
br label %67
67: ; preds = %106, %66
%68 = load i32, i32* %15
%69 = load i32, i32* %18
%70 = icmp sle i32 %68, %69
br i1 %70, label %71, label %109
71: ; preds = %67
store double 0.000000e+00, double* %19
store i32 0, i32* %16
br label %72
72: ; preds = %91, %71
%73 = load i32, i32* %16
%74 = load i32, i32* %15
%75 = icmp sle i32 %73, %74
br i1 %75, label %76, label %94
76: ; preds = %72
%77 = load double, double* %19
%78 = load double*, double** %8
%79 = load i32, i32* %16
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds double, double* %78, i64 %80
%82 = load double, double* %81
%83 = load i32, i32* %18
%84 = load i32, i32* %16
%85 = sub nsw i32 %83, %84
%86 = load i32, i32* %15
%87 = load i32, i32* %16
%88 = sub nsw i32 %86, %87
%89 = call double @nchoosek(i32 %85, i32 %88)
%90 = call double @llvm.fmuladd.f64(double %82, double %89, double %77)
store double %90, double* %19
br label %91
91: ; preds = %76
%92 = load i32, i32* %16
%93 = add nsw i32 %92, 1
store i32 %93, i32* %16
br label %72
94: ; preds = %72
%95 = load double, double* %14
%96 = load i32, i32* %18
%97 = load i32, i32* %15
%98 = sub nsw i32 %96, %97
%99 = call double @internal_pow(double %95, i32 %98)
%100 = load double, double* %19
%101 = fmul double %99, %100
%102 = load double*, double** %9
%103 = load i32, i32* %15
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds double, double* %102, i64 %104
store double %101, double* %105
br label %106
106: ; preds = %94
%107 = load i32, i32* %15
%108 = add nsw i32 %107, 1
store i32 %108, i32* %15
br label %67
109: ; preds = %67
ret void
}

LLVM IR (-O2):
define void @get_delta_transfer_function_with_base(double* nocapture %0, double* nocapture writeonly %1, i32 %2, double* nocapture %3, double* nocapture writeonly %4, i32 %5, double %6) {
%8 = add nsw i32 %5, -1
%9 = add nsw i32 %2, -1
%10 = icmp sgt i32 %5, 0
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = zext i32 %5 to i64
br label %13
13: ; preds = %11, %33
%14 = phi i64 [ 0, %11 ], [ %39, %33 ]
%15 = phi i64 [ 1, %11 ], [ %40, %33 ]
br label %20
16: ; preds = %33, %7
%17 = icmp sgt i32 %2, 0
br i1 %17, label %18, label %67
18: ; preds = %16
%19 = zext i32 %2 to i64
br label %42
20: ; preds = %13, %20
%21 = phi i64 [ 0, %13 ], [ %31, %20 ]
%22 = phi double [ 0.000000e+00, %13 ], [ %30, %20 ]
%23 = getelementptr inbounds double, double* %3, i64 %21
%24 = load double, double* %23
%25 = trunc i64 %21 to i32
%26 = sub nsw i32 %8, %25
%27 = sub nsw i64 %14, %21
%28 = trunc i64 %27 to i32
%29 = tail call double @nchoosek(i32 %26, i32 %28)
%30 = tail call double @llvm.fmuladd.f64(double %24, double %29, double %22)
%31 = add nuw nsw i64 %21, 1
%32 = icmp eq i64 %31, %15
br i1 %32, label %33, label %20
33: ; preds = %20
%34 = trunc i64 %14 to i32
%35 = sub nsw i32 %8, %34
%36 = tail call double @internal_pow(double %6, i32 %35)
%37 = fmul double %30, %36
%38 = getelementptr inbounds double, double* %4, i64 %14
store double %37, double* %38
%39 = add nuw nsw i64 %14, 1
%40 = add nuw nsw i64 %15, 1
%41 = icmp eq i64 %39, %12
br i1 %41, label %16, label %13
42: ; preds = %18, %58
%43 = phi i64 [ 0, %18 ], [ %64, %58 ]
%44 = phi i64 [ 1, %18 ], [ %65, %58 ]
br label %45
45: ; preds = %42, %45
%46 = phi i64 [ 0, %42 ], [ %56, %45 ]
%47 = phi double [ 0.000000e+00, %42 ], [ %55, %45 ]
%48 = getelementptr inbounds double, double* %0, i64 %46
%49 = load double, double* %48
%50 = trunc i64 %46 to i32
%51 = sub nsw i32 %9, %50
%52 = sub nsw i64 %43, %46
%53 = trunc i64 %52 to i32
%54 = tail call double @nchoosek(i32 %51, i32 %53)
%55 = tail call double @llvm.fmuladd.f64(double %49, double %54, double %47)
%56 = add nuw nsw i64 %46, 1
%57 = icmp eq i64 %56, %44
br i1 %57, label %58, label %45
58: ; preds = %45
%59 = trunc i64 %43 to i32
%60 = sub nsw i32 %9, %59
%61 = tail call double @internal_pow(double %6, i32 %60)
%62 = fmul double %55, %61
%63 = getelementptr inbounds double, double* %1, i64 %43
store double %62, double* %63
%64 = add nuw nsw i64 %43, 1
%65 = add nuw nsw i64 %44, 1
%66 = icmp eq i64 %64, %19
br i1 %66, label %67, label %42
67: ; preds = %58, %16
ret void
}