void bezier_increase_degree(unsigned int N, double coeff2[N + 2],
                            const double coeff[N + 1]) {
  coeff2[0] = coeff[0];
  for (unsigned int i = 1; i <= N; i++)
    coeff2[i] = lerp(i / (1. + N), coeff[i], coeff[i - 1]);
  coeff2[N + 1] = coeff[N];
}


x86 assembly (clang, -O0):
<bezier_increase_degree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
ja     11a8 <bezier_increase_degree+0x98>
mov    -0x1c(%rbp),%eax
cvtsi2sd %rax,%xmm0
mov    -0x4(%rbp),%eax
cvtsi2sd %rax,%xmm2
movsd  0xea2(%rip),%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
movsd  (%rax,%rcx,8),%xmm2
mov    $0x3,%al
call   1030 <lerp@plt>
cvtsi2sd %eax,%xmm0
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113a <bezier_increase_degree+0x2a>
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
movsd  %xmm0,(%rax,%rcx,8)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bezier_increase_degree>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r13
mov    %rsi,%r14
movsd  (%rdx),%xmm0
movsd  %xmm0,(%rsi)
mov    %edi,%r15d
test   %edi,%edi
je     118c <bezier_increase_degree+0x7c>
mov    %edi,%r12d
xorps  %xmm0,%xmm0
cvtsi2sd %r15,%xmm0
addsd  0xebd(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    $0x1,%ebp
nopl   (%rax)
mov    %ebp,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
divsd  (%rsp),%xmm0
movsd  0x0(%r13,%rbx,8),%xmm1
lea    -0x1(%rbp),%eax
movsd  0x0(%r13,%rax,8),%xmm2
mov    $0x3,%al
call   1030 <lerp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%ebp
cmp    %r12d,%ebp
jbe    1150 <bezier_increase_degree+0x40>
movsd  0x0(%r13,%r15,8),%xmm0
movsd  %xmm0,0x8(%r14,%r15,8)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @bezier_increase_degree(i32 %0, double* nocapture writeonly %1, double* nocapture %2) {
%4 = load double, double* %2
store double %4, double* %1
%5 = icmp eq i32 %0, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = uitofp i32 %0 to double
%8 = fadd double %7, 1.000000e+00
br label %16
9: ; preds = %16, %3
%10 = add nuw i32 %0, 1
%11 = zext i32 %0 to i64
%12 = getelementptr inbounds double, double* %2, i64 %11
%13 = load double, double* %12
%14 = zext i32 %10 to i64
%15 = getelementptr inbounds double, double* %1, i64 %14
store double %13, double* %15
ret void
16: ; preds = %6, %16
%17 = phi i32 [ 1, %6 ], [ %30, %16 ]
%18 = uitofp i32 %17 to double
%19 = fdiv double %18, %8
%20 = zext i32 %17 to i64
%21 = getelementptr inbounds double, double* %2, i64 %20
%22 = load double, double* %21
%23 = add i32 %17, -1
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds double, double* %2, i64 %24
%26 = load double, double* %25
%27 = tail call i32 (double, double, double, ...) bitcast (i32 (...)* @lerp to i32 (double, double, double, ...)*)(double %19, double %22, double %26)
%28 = sitofp i32 %27 to double
%29 = getelementptr inbounds double, double* %1, i64 %20
store double %28, double* %29
%30 = add i32 %17, 1
%31 = icmp ugt i32 %30, %0
br i1 %31, label %9, label %16
}