void MAT3_inv3_swap(double inv[3][3], int row0, int row1, int row2) {
  register int i, tempi;
  double temp;
  if (row0 != 0) {
    if (row1 == 0) {
      for (i = 0; i < 3; i++)
        (temp = (inv[row0][i]), (inv[row0][i]) = (inv[row1][i]),
         (inv[row1][i]) = (temp));
      (tempi = (row0), (row0) = (row1), (row1) = (tempi));
    } else {
      for (i = 0; i < 3; i++)
        (temp = (inv[row0][i]), (inv[row0][i]) = (inv[row2][i]),
         (inv[row2][i]) = (temp));
      (tempi = (row0), (row0) = (row2), (row2) = (tempi));
    }
  }
  if (row1 != 1) {
    for (i = 0; i < 3; i++)
      (temp = (inv[row1][i]), (inv[row1][i]) = (inv[row2][i]),
       (inv[row2][i]) = (temp));
    (tempi = (row1), (row1) = (row2), (row2) = (tempi));
  }
}


x86 assembly (clang, -O0):
<MAT3_inv3_swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1265 <MAT3_inv3_swap+0x165>
cmpl   $0x0,-0x10(%rbp)
jne    11c5 <MAT3_inv3_swap+0xc5>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    11ae <MAT3_inv3_swap+0xae>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112c <MAT3_inv3_swap+0x2c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1260 <MAT3_inv3_swap+0x160>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    124e <MAT3_inv3_swap+0x14e>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11cc <MAT3_inv3_swap+0xcc>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1265 <MAT3_inv3_swap+0x165>
cmpl   $0x1,-0x10(%rbp)
je     130a <MAT3_inv3_swap+0x20a>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    12f8 <MAT3_inv3_swap+0x1f8>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1276 <MAT3_inv3_swap+0x176>
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<MAT3_inv3_swap>:
test   %esi,%esi
je     116f <MAT3_inv3_swap+0x6f>
movslq %esi,%rax
test   %edx,%edx
je     1145 <MAT3_inv3_swap+0x45>
movslq %ecx,%rcx
lea    (%rax,%rax,2),%rax
lea    (%rcx,%rcx,2),%rcx
movups (%rdi,%rax,8),%xmm0
movups (%rdi,%rcx,8),%xmm1
movups %xmm1,(%rdi,%rax,8)
movups %xmm0,(%rdi,%rcx,8)
movsd  0x10(%rdi,%rax,8),%xmm0
movsd  0x10(%rdi,%rcx,8),%xmm1
movsd  %xmm1,0x10(%rdi,%rax,8)
movsd  %xmm0,0x10(%rdi,%rcx,8)
cmp    $0x1,%edx
jne    1176 <MAT3_inv3_swap+0x76>
jmp    11ac <MAT3_inv3_swap+0xac>
lea    (%rax,%rax,2),%rax
movups (%rdi,%rax,8),%xmm0
movups (%rdi),%xmm1
movups %xmm1,(%rdi,%rax,8)
movups %xmm0,(%rdi)
movsd  0x10(%rdi,%rax,8),%xmm0
movsd  0x10(%rdi),%xmm1
movsd  %xmm1,0x10(%rdi,%rax,8)
movsd  %xmm0,0x10(%rdi)
mov    %esi,%edx
mov    %ecx,%esi
cmp    $0x1,%edx
je     11ac <MAT3_inv3_swap+0xac>
movslq %edx,%rax
movslq %esi,%rcx
lea    (%rax,%rax,2),%rax
lea    (%rcx,%rcx,2),%rcx
movups (%rdi,%rax,8),%xmm0
movups (%rdi,%rcx,8),%xmm1
movups %xmm1,(%rdi,%rax,8)
movups %xmm0,(%rdi,%rcx,8)
movsd  0x10(%rdi,%rax,8),%xmm0
movsd  0x10(%rdi,%rcx,8),%xmm1
movsd  %xmm1,0x10(%rdi,%rax,8)
movsd  %xmm0,0x10(%rdi,%rcx,8)
ret

LLVM IR (-O0):
define void @MAT3_inv3_swap([3 x double]* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [3 x double]*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
store [3 x double]* %0, [3 x double]** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%12 = load i32, i32* %6
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %104
14: ; preds = %4
%15 = load i32, i32* %7
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %60
17: ; preds = %14
store i32 0, i32* %9
br label %18
18: ; preds = %53, %17
%19 = load i32, i32* %9
%20 = icmp slt i32 %19, 3
br i1 %20, label %21, label %56
21: ; preds = %18
%22 = load [3 x double]*, [3 x double]** %5
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 %24
%26 = load i32, i32* %9
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 %27
%29 = load double, double* %28
store double %29, double* %11
%30 = load [3 x double]*, [3 x double]** %5
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 %32
%34 = load i32, i32* %9
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [3 x double], [3 x double]* %33, i64 0, i64 %35
%37 = load double, double* %36
%38 = load [3 x double]*, [3 x double]** %5
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [3 x double], [3 x double]* %38, i64 %40
%42 = load i32, i32* %9
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [3 x double], [3 x double]* %41, i64 0, i64 %43
store double %37, double* %44
%45 = load double, double* %11
%46 = load [3 x double]*, [3 x double]** %5
%47 = load i32, i32* %7
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [3 x double], [3 x double]* %46, i64 %48
%50 = load i32, i32* %9
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [3 x double], [3 x double]* %49, i64 0, i64 %51
store double %45, double* %52
br label %53
53: ; preds = %21
%54 = load i32, i32* %9
%55 = add nsw i32 %54, 1
store i32 %55, i32* %9
br label %18
56: ; preds = %18
%57 = load i32, i32* %6
store i32 %57, i32* %10
%58 = load i32, i32* %7
store i32 %58, i32* %6
%59 = load i32, i32* %10
store i32 %59, i32* %7
br label %103
60: ; preds = %14
store i32 0, i32* %9
br label %61
61: ; preds = %96, %60
%62 = load i32, i32* %9
%63 = icmp slt i32 %62, 3
br i1 %63, label %64, label %99
64: ; preds = %61
%65 = load [3 x double]*, [3 x double]** %5
%66 = load i32, i32* %6
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [3 x double], [3 x double]* %65, i64 %67
%69 = load i32, i32* %9
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [3 x double], [3 x double]* %68, i64 0, i64 %70
%72 = load double, double* %71
store double %72, double* %11
%73 = load [3 x double]*, [3 x double]** %5
%74 = load i32, i32* %8
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [3 x double], [3 x double]* %73, i64 %75
%77 = load i32, i32* %9
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [3 x double], [3 x double]* %76, i64 0, i64 %78
%80 = load double, double* %79
%81 = load [3 x double]*, [3 x double]** %5
%82 = load i32, i32* %6
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [3 x double], [3 x double]* %81, i64 %83
%85 = load i32, i32* %9
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [3 x double], [3 x double]* %84, i64 0, i64 %86
store double %80, double* %87
%88 = load double, double* %11
%89 = load [3 x double]*, [3 x double]** %5
%90 = load i32, i32* %8
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [3 x double], [3 x double]* %89, i64 %91
%93 = load i32, i32* %9
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [3 x double], [3 x double]* %92, i64 0, i64 %94
store double %88, double* %95
br label %96
96: ; preds = %64
%97 = load i32, i32* %9
%98 = add nsw i32 %97, 1
store i32 %98, i32* %9
br label %61
99: ; preds = %61
%100 = load i32, i32* %6
store i32 %100, i32* %10
%101 = load i32, i32* %8
store i32 %101, i32* %6
%102 = load i32, i32* %10
store i32 %102, i32* %8
br label %103
103: ; preds = %99, %56
br label %104
104: ; preds = %103, %4
%105 = load i32, i32* %7
%106 = icmp ne i32 %105, 1
br i1 %106, label %107, label %150
107: ; preds = %104
store i32 0, i32* %9
br label %108
108: ; preds = %143, %107
%109 = load i32, i32* %9
%110 = icmp slt i32 %109, 3
br i1 %110, label %111, label %146
111: ; preds = %108
%112 = load [3 x double]*, [3 x double]** %5
%113 = load i32, i32* %7
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds [3 x double], [3 x double]* %112, i64 %114
%116 = load i32, i32* %9
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds [3 x double], [3 x double]* %115, i64 0, i64 %117
%119 = load double, double* %118
store double %119, double* %11
%120 = load [3 x double]*, [3 x double]** %5
%121 = load i32, i32* %8
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds [3 x double], [3 x double]* %120, i64 %122
%124 = load i32, i32* %9
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds [3 x double], [3 x double]* %123, i64 0, i64 %125
%127 = load double, double* %126
%128 = load [3 x double]*, [3 x double]** %5
%129 = load i32, i32* %7
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds [3 x double], [3 x double]* %128, i64 %130
%132 = load i32, i32* %9
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds [3 x double], [3 x double]* %131, i64 0, i64 %133
store double %127, double* %134
%135 = load double, double* %11
%136 = load [3 x double]*, [3 x double]** %5
%137 = load i32, i32* %8
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds [3 x double], [3 x double]* %136, i64 %138
%140 = load i32, i32* %9
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds [3 x double], [3 x double]* %139, i64 0, i64 %141
store double %135, double* %142
br label %143
143: ; preds = %111
%144 = load i32, i32* %9
%145 = add nsw i32 %144, 1
store i32 %145, i32* %9
br label %108
146: ; preds = %108
%147 = load i32, i32* %7
store i32 %147, i32* %10
%148 = load i32, i32* %8
store i32 %148, i32* %7
%149 = load i32, i32* %10
store i32 %149, i32* %8
br label %150
150: ; preds = %146, %104
ret void
}

LLVM IR (-O2):
define void @MAT3_inv3_swap([3 x double]* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %1, 0
br i1 %5, label %35, label %6
6: ; preds = %4
%7 = icmp eq i32 %2, 0
%8 = sext i32 %1 to i64
br i1 %7, label %23, label %9
9: ; preds = %6
%10 = sext i32 %3 to i64
%11 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %8, i64 0
%12 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %10, i64 0
%13 = bitcast double* %11 to <2 x double>*
%14 = load <2 x double>, <2 x double>* %13
%15 = bitcast double* %12 to <2 x double>*
%16 = load <2 x double>, <2 x double>* %15
%17 = bitcast double* %11 to <2 x double>*
store <2 x double> %16, <2 x double>* %17
%18 = bitcast double* %12 to <2 x double>*
store <2 x double> %14, <2 x double>* %18
%19 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %8, i64 2
%20 = load double, double* %19
%21 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %10, i64 2
%22 = load double, double* %21
store double %22, double* %19
store double %20, double* %21
br label %35
23: ; preds = %6
%24 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %8, i64 0
%25 = bitcast double* %24 to <2 x double>*
%26 = load <2 x double>, <2 x double>* %25
%27 = bitcast [3 x double]* %0 to <2 x double>*
%28 = load <2 x double>, <2 x double>* %27
%29 = bitcast double* %24 to <2 x double>*
store <2 x double> %28, <2 x double>* %29
%30 = bitcast [3 x double]* %0 to <2 x double>*
store <2 x double> %26, <2 x double>* %30
%31 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %8, i64 2
%32 = load double, double* %31
%33 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 2
%34 = load double, double* %33
store double %34, double* %31
store double %32, double* %33
br label %35
35: ; preds = %9, %23, %4
%36 = phi i32 [ %2, %4 ], [ %1, %23 ], [ %2, %9 ]
%37 = phi i32 [ %3, %4 ], [ %3, %23 ], [ %1, %9 ]
%38 = icmp eq i32 %36, 1
br i1 %38, label %54, label %39
39: ; preds = %35
%40 = sext i32 %36 to i64
%41 = sext i32 %37 to i64
%42 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %40, i64 0
%43 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %41, i64 0
%44 = bitcast double* %42 to <2 x double>*
%45 = load <2 x double>, <2 x double>* %44
%46 = bitcast double* %43 to <2 x double>*
%47 = load <2 x double>, <2 x double>* %46
%48 = bitcast double* %42 to <2 x double>*
store <2 x double> %47, <2 x double>* %48
%49 = bitcast double* %43 to <2 x double>*
store <2 x double> %45, <2 x double>* %49
%50 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %40, i64 2
%51 = load double, double* %50
%52 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %41, i64 2
%53 = load double, double* %52
store double %53, double* %50
store double %51, double* %52
br label %54
54: ; preds = %39, %35
ret void
}