void nextgeneration(double modg[4][4], double *Cf, double *Cn) {
  int i, j;
  double meanW = 0, Wmarg[4], nu[4] = {1, -1, -1, 1};
  for (i = 0; i < 4; i++) {
    Wmarg[i] = 0;
    for (j = 0; j < 4; j++) {
      Wmarg[i] += modg[i][j] * Cf[j];
    }
    meanW += Wmarg[i] * Cf[i];
  }
  for (i = 0; i < 4; i++) {
    Cn[i] = (Cf[i] * Wmarg[i] +
             nu[i] * 0.5 * modg[0][3] * (Cf[1] * Cf[2] - Cf[0] * Cf[3])) /
            meanW;
  }
}


x86 assembly (clang, -O0):
<nextgeneration>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0xef1(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xeee(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xeeb(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xee8(%rip),%rax
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    11f5 <nextgeneration+0xf5>
movslq -0x1c(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp,%rax,8)
movl   $0x0,-0x20(%rbp)
cmpl   $0x4,-0x20(%rbp)
jge    11be <nextgeneration+0xbe>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movslq -0x1c(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp,%rax,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1169 <nextgeneration+0x69>
movslq -0x1c(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114b <nextgeneration+0x4b>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    12a6 <nextgeneration+0x1a6>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x1c(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm2
movslq -0x1c(%rbp),%rax
movsd  0xdd7(%rip),%xmm1
mulsd  -0x70(%rbp,%rax,8),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x18(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm3
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm5
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm4
mov    -0x10(%rbp),%rax
mulsd  0x18(%rax),%xmm4
movq   %xmm4,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm4
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11fc <nextgeneration+0xfc>
pop    %rbp
ret

x86 assembly (clang, -O2):
<nextgeneration>:
movsd  (%rsi),%xmm10
movsd  0x8(%rsi),%xmm0
movsd  (%rdi),%xmm1
mulsd  %xmm10,%xmm1
xorpd  %xmm8,%xmm8
addsd  %xmm8,%xmm1
movsd  0x8(%rdi),%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  0x10(%rsi),%xmm1
movsd  0x10(%rdi),%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm2,%xmm3
movsd  0x18(%rdi),%xmm9
movsd  0x18(%rsi),%xmm7
movapd %xmm9,%xmm12
mulsd  %xmm7,%xmm12
addsd  %xmm3,%xmm12
mulsd  %xmm10,%xmm12
movsd  0x20(%rdi),%xmm2
mulsd  %xmm10,%xmm2
addsd  %xmm8,%xmm2
movsd  0x28(%rdi),%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm2,%xmm3
movsd  0x30(%rdi),%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm3,%xmm2
movsd  0x38(%rdi),%xmm3
mulsd  %xmm7,%xmm3
addsd  %xmm2,%xmm3
movapd %xmm3,%xmm11
mulsd  %xmm0,%xmm11
movsd  0x40(%rdi),%xmm5
mulsd  %xmm10,%xmm5
addsd  %xmm8,%xmm5
movsd  0x48(%rdi),%xmm6
mulsd  %xmm0,%xmm6
addsd  %xmm5,%xmm6
movsd  0x50(%rdi),%xmm5
mulsd  %xmm1,%xmm5
addsd  %xmm6,%xmm5
movsd  0x58(%rdi),%xmm6
mulsd  %xmm7,%xmm6
addsd  %xmm5,%xmm6
movsd  0x60(%rdi),%xmm5
mulsd  %xmm10,%xmm5
addsd  %xmm8,%xmm5
movsd  0x68(%rdi),%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm5,%xmm2
movapd %xmm6,%xmm4
mulsd  %xmm1,%xmm4
mulsd  %xmm1,%xmm0
mulsd  0x70(%rdi),%xmm1
addsd  %xmm2,%xmm1
movsd  0x78(%rdi),%xmm5
mulsd  %xmm7,%xmm5
addsd  %xmm1,%xmm5
movapd %xmm5,%xmm1
mulsd  %xmm7,%xmm1
mulsd  %xmm10,%xmm7
subsd  %xmm7,%xmm0
movsd  0xdd7(%rip),%xmm10
mulsd  %xmm10,%xmm9
mulsd  %xmm9,%xmm0
addsd  %xmm12,%xmm0
addsd  %xmm8,%xmm12
addsd  %xmm12,%xmm11
addsd  %xmm11,%xmm4
addsd  %xmm4,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rdx)
movsd  0xdad(%rip),%xmm0
movsd  0x18(%rdi),%xmm2
mulsd  %xmm0,%xmm2
movsd  0x8(%rsi),%xmm8
movsd  0x18(%rsi),%xmm7
mulsd  (%rsi),%xmm7
movsd  0x10(%rsi),%xmm4
mulsd  %xmm8,%xmm4
subsd  %xmm7,%xmm4
mulsd  %xmm2,%xmm4
mulsd  %xmm8,%xmm3
addsd  %xmm4,%xmm3
divsd  %xmm1,%xmm3
movsd  %xmm3,0x8(%rdx)
mulsd  0x18(%rdi),%xmm0
movsd  0x10(%rsi),%xmm2
movsd  0x18(%rsi),%xmm3
mulsd  (%rsi),%xmm3
movsd  0x8(%rsi),%xmm4
mulsd  %xmm2,%xmm4
subsd  %xmm3,%xmm4
mulsd  %xmm0,%xmm4
mulsd  %xmm2,%xmm6
addsd  %xmm4,%xmm6
divsd  %xmm1,%xmm6
movsd  %xmm6,0x10(%rdx)
movsd  0x8(%rsi),%xmm0
movsd  0x18(%rsi),%xmm2
mulsd  0x18(%rdi),%xmm10
movsd  (%rsi),%xmm3
mulsd  %xmm2,%xmm3
mulsd  0x10(%rsi),%xmm0
subsd  %xmm3,%xmm0
mulsd  %xmm10,%xmm0
mulsd  %xmm2,%xmm5
addsd  %xmm0,%xmm5
divsd  %xmm1,%xmm5
movsd  %xmm5,0x18(%rdx)
ret

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

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