void II_combine_LR(sb_sample, joint_sample,
                   sblimit) double sb_sample[2][3][12][32];
double joint_sample[3][12][32];
int sblimit;
{
  int sb, smp, sufr;
  for (sb = 0; sb < sblimit; ++sb)
    for (smp = 0; smp < 12; ++smp)
      for (sufr = 0; sufr < 3; ++sufr)
        joint_sample[sufr][smp][sb] =
            .5 * (sb_sample[0][sufr][smp][sb] + sb_sample[1][sufr][smp][sb]);
}


x86 assembly (clang, -O0):
<II_combine_LR>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11fc <II_combine_LR+0xfc>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xc,-0x1c(%rbp)
jge    11e9 <II_combine_LR+0xe9>
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    11d6 <II_combine_LR+0xd6>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
imul   $0xc00,%rcx,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
shl    $0x8,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
add    $0x2400,%rax
movslq -0x20(%rbp),%rcx
imul   $0xc00,%rcx,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
shl    $0x8,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm1
movsd  0xe62(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
imul   $0xc00,%rcx,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
shl    $0x8,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    113a <II_combine_LR+0x3a>
jmp    11db <II_combine_LR+0xdb>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1129 <II_combine_LR+0x29>
jmp    11ee <II_combine_LR+0xee>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1116 <II_combine_LR+0x16>
pop    %rbp
ret

x86 assembly (clang, -O2):
<II_combine_LR>:
test   %edx,%edx
jle    11af <II_combine_LR+0xaf>
mov    %edx,%eax
add    $0x3c00,%rdi
add    $0x1800,%rsi
xor    %ecx,%ecx
movsd  0xede(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xfffffffffffff400,%rdx
nopw   0x0(%rax,%rax,1)
movsd  -0x3000(%rdi,%rdx,1),%xmm1
ff ff
addsd  -0xc00(%rdi,%rdx,1),%xmm1
ff ff
mulsd  %xmm0,%xmm1
movsd  %xmm1,-0xc00(%rsi,%rdx,1)
ff ff
movsd  -0x2400(%rdi,%rdx,1),%xmm1
ff ff
addsd  (%rdi,%rdx,1),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi,%rdx,1)
movsd  -0x1800(%rdi,%rdx,1),%xmm1
ff ff
addsd  0xc00(%rdi,%rdx,1),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0xc00(%rsi,%rdx,1)
add    $0x100,%rdx
jne    1140 <II_combine_LR+0x40>
add    $0x1,%rcx
add    $0x8,%rdi
add    $0x8,%rsi
cmp    %rax,%rcx
jne    1130 <II_combine_LR+0x30>
ret

LLVM IR (-O0):
define void @II_combine_LR([3 x [12 x [32 x double]]]* %0, [12 x [32 x double]]* %1, i32 %2) {
%4 = alloca [3 x [12 x [32 x double]]]*
%5 = alloca [12 x [32 x double]]*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store [3 x [12 x [32 x double]]]* %0, [3 x [12 x [32 x double]]]** %4
store [12 x [32 x double]]* %1, [12 x [32 x double]]** %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %10
10: ; preds = %67, %3
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %70
14: ; preds = %10
store i32 0, i32* %8
br label %15
15: ; preds = %63, %14
%16 = load i32, i32* %8
%17 = icmp slt i32 %16, 12
br i1 %17, label %18, label %66
18: ; preds = %15
store i32 0, i32* %9
br label %19
19: ; preds = %59, %18
%20 = load i32, i32* %9
%21 = icmp slt i32 %20, 3
br i1 %21, label %22, label %62
22: ; preds = %19
%23 = load [3 x [12 x [32 x double]]]*, [3 x [12 x [32 x double]]]** %4
%24 = getelementptr inbounds [3 x [12 x [32 x double]]], [3 x [12 x [32 x double]]]* %23, i64 0
%25 = load i32, i32* %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [3 x [12 x [32 x double]]], [3 x [12 x [32 x double]]]* %24, i64 0, i64 %26
%28 = load i32, i32* %8
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [12 x [32 x double]], [12 x [32 x double]]* %27, i64 0, i64 %29
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [32 x double], [32 x double]* %30, i64 0, i64 %32
%34 = load double, double* %33
%35 = load [3 x [12 x [32 x double]]]*, [3 x [12 x [32 x double]]]** %4
%36 = getelementptr inbounds [3 x [12 x [32 x double]]], [3 x [12 x [32 x double]]]* %35, i64 1
%37 = load i32, i32* %9
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [3 x [12 x [32 x double]]], [3 x [12 x [32 x double]]]* %36, i64 0, i64 %38
%40 = load i32, i32* %8
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [12 x [32 x double]], [12 x [32 x double]]* %39, i64 0, i64 %41
%43 = load i32, i32* %7
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [32 x double], [32 x double]* %42, i64 0, i64 %44
%46 = load double, double* %45
%47 = fadd double %34, %46
%48 = fmul double 5.000000e-01, %47
%49 = load [12 x [32 x double]]*, [12 x [32 x double]]** %5
%50 = load i32, i32* %9
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [12 x [32 x double]], [12 x [32 x double]]* %49, i64 %51
%53 = load i32, i32* %8
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [12 x [32 x double]], [12 x [32 x double]]* %52, i64 0, i64 %54
%56 = load i32, i32* %7
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [32 x double], [32 x double]* %55, i64 0, i64 %57
store double %48, double* %58
br label %59
59: ; preds = %22
%60 = load i32, i32* %9
%61 = add nsw i32 %60, 1
store i32 %61, i32* %9
br label %19
62: ; preds = %19
br label %63
63: ; preds = %62
%64 = load i32, i32* %8
%65 = add nsw i32 %64, 1
store i32 %65, i32* %8
br label %15
66: ; preds = %15
br label %67
67: ; preds = %66
%68 = load i32, i32* %7
%69 = add nsw i32 %68, 1
store i32 %69, i32* %7
br label %10
70: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @II_combine_LR([3 x [12 x [32 x double]]]* nocapture %0, [12 x [32 x double]]* nocapture writeonly %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %37
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %34
%8 = phi i64 [ 0, %5 ], [ %35, %34 ]
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %32, %9 ]
%11 = getelementptr inbounds [3 x [12 x [32 x double]]], [3 x [12 x [32 x double]]]* %0, i64 0, i64 0, i64 %10, i64 %8
%12 = load double, double* %11
%13 = getelementptr inbounds [3 x [12 x [32 x double]]], [3 x [12 x [32 x double]]]* %0, i64 1, i64 0, i64 %10, i64 %8
%14 = load double, double* %13
%15 = fadd double %12, %14
%16 = fmul double %15, 5.000000e-01
%17 = getelementptr inbounds [12 x [32 x double]], [12 x [32 x double]]* %1, i64 0, i64 %10, i64 %8
store double %16, double* %17
%18 = getelementptr inbounds [3 x [12 x [32 x double]]], [3 x [12 x [32 x double]]]* %0, i64 0, i64 1, i64 %10, i64 %8
%19 = load double, double* %18
%20 = getelementptr inbounds [3 x [12 x [32 x double]]], [3 x [12 x [32 x double]]]* %0, i64 1, i64 1, i64 %10, i64 %8
%21 = load double, double* %20
%22 = fadd double %19, %21
%23 = fmul double %22, 5.000000e-01
%24 = getelementptr inbounds [12 x [32 x double]], [12 x [32 x double]]* %1, i64 1, i64 %10, i64 %8
store double %23, double* %24
%25 = getelementptr inbounds [3 x [12 x [32 x double]]], [3 x [12 x [32 x double]]]* %0, i64 0, i64 2, i64 %10, i64 %8
%26 = load double, double* %25
%27 = getelementptr inbounds [3 x [12 x [32 x double]]], [3 x [12 x [32 x double]]]* %0, i64 1, i64 2, i64 %10, i64 %8
%28 = load double, double* %27
%29 = fadd double %26, %28
%30 = fmul double %29, 5.000000e-01
%31 = getelementptr inbounds [12 x [32 x double]], [12 x [32 x double]]* %1, i64 2, i64 %10, i64 %8
store double %30, double* %31
%32 = add nuw nsw i64 %10, 1
%33 = icmp eq i64 %32, 12
br i1 %33, label %34, label %9
34: ; preds = %9
%35 = add nuw nsw i64 %8, 1
%36 = icmp eq i64 %35, %6
br i1 %36, label %37, label %7
37: ; preds = %34, %3
ret void
}