void convert_modg(double mod[3][3], double modg[4][4]) {
  int i, j;
  modg[0][0] = mod[0][0];
  modg[1][0] = mod[0][1];
  modg[1][1] = mod[0][2];
  modg[2][0] = mod[1][0];
  modg[2][1] = mod[1][1];
  modg[2][2] = mod[2][0];
  modg[3][0] = mod[1][1];
  modg[3][1] = mod[1][2];
  modg[3][2] = mod[2][1];
  modg[3][3] = mod[2][2];
  for (i = 0; i < 4; i++)
    for (j = 0; j < i; j++)
      modg[j][i] = modg[i][j];
}


x86 assembly (clang, -O0):
<convert_modg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x28(%rax)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x40(%rax)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x48(%rax)
mov    -0x8(%rbp),%rax
movsd  0x30(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x50(%rax)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x60(%rax)
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x68(%rax)
mov    -0x8(%rbp),%rax
movsd  0x38(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x70(%rax)
mov    -0x8(%rbp),%rax
movsd  0x40(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x78(%rax)
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1233 <convert_modg+0x133>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1220 <convert_modg+0x120>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11d6 <convert_modg+0xd6>
jmp    1225 <convert_modg+0x125>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c5 <convert_modg+0xc5>
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_modg>:
movsd  (%rdi),%xmm0
movsd  %xmm0,(%rsi)
movsd  0x8(%rdi),%xmm0
movsd  %xmm0,0x20(%rsi)
movsd  0x10(%rdi),%xmm1
movsd  %xmm1,0x28(%rsi)
movsd  0x18(%rdi),%xmm1
movsd  %xmm1,0x40(%rsi)
movsd  0x20(%rdi),%xmm2
movsd  %xmm2,0x48(%rsi)
movsd  0x30(%rdi),%xmm3
movsd  %xmm3,0x50(%rsi)
movsd  0x20(%rdi),%xmm3
movsd  %xmm3,0x60(%rsi)
movsd  0x28(%rdi),%xmm4
movsd  %xmm4,0x68(%rsi)
movsd  0x38(%rdi),%xmm5
movsd  %xmm5,0x70(%rsi)
movsd  0x40(%rdi),%xmm6
movsd  %xmm6,0x78(%rsi)
movsd  %xmm0,0x8(%rsi)
movsd  %xmm1,0x10(%rsi)
movsd  %xmm2,0x30(%rsi)
movsd  %xmm3,0x18(%rsi)
movsd  %xmm4,0x38(%rsi)
movsd  %xmm5,0x58(%rsi)
ret

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

LLVM IR (-O2):
define void @convert_modg([3 x double]* nocapture %0, [4 x double]* nocapture %1) {
%3 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 0
%4 = load double, double* %3
%5 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 0
store double %4, double* %5
%6 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 1
%7 = load double, double* %6
%8 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 0
store double %7, double* %8
%9 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 2
%10 = load double, double* %9
%11 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 1
store double %10, double* %11
%12 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 0
%13 = load double, double* %12
%14 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 0
store double %13, double* %14
%15 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 1
%16 = load double, double* %15
%17 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 1
store double %16, double* %17
%18 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 0
%19 = load double, double* %18
%20 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 2
store double %19, double* %20
%21 = load double, double* %15
%22 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 0
store double %21, double* %22
%23 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 2
%24 = load double, double* %23
%25 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 1
store double %24, double* %25
%26 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 1
%27 = load double, double* %26
%28 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 2
store double %27, double* %28
%29 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 2
%30 = load double, double* %29
%31 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 3
store double %30, double* %31
%32 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 1
store double %7, double* %32
%33 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 2
store double %13, double* %33
%34 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 2
store double %16, double* %34
%35 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 3
store double %21, double* %35
%36 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 3
store double %24, double* %36
%37 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 3
store double %27, double* %37
ret void
}