#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double get_angle(double **, int, int);
double const mat_Dabs(double);
double sqrt(int);
int is_identity_metric(double metric_rotated[3][3], double metric_orig[3][3],
                       const double symprec, const double angle_symprec) {
  int i, j, k;
  int elem_sets[3][2] = {{0, 1}, {0, 2}, {1, 2}};
  double cos1, cos2, x, length_ave2, sin_dtheta2;
  double length_orig[3], length_rot[3];
  for (i = 0; i < 3; i++) {
    length_orig[i] = sqrt(metric_orig[i][i]);
    length_rot[i] = sqrt(metric_rotated[i][i]);
    if (mat_Dabs(length_orig[i] - length_rot[i]) > symprec) {
      goto fail;
    }
  }
  for (i = 0; i < 3; i++) {
    j = elem_sets[i][0];
    k = elem_sets[i][1];
    if (angle_symprec > 0) {
      if (mat_Dabs(get_angle(metric_orig, j, k) -
                   get_angle(metric_rotated, j, k)) > angle_symprec) {
        goto fail;
      }
    } else {
      cos1 = metric_orig[j][k] / length_orig[j] / length_orig[k];
      cos2 = metric_rotated[j][k] / length_rot[j] / length_rot[k];
      x = cos1 * cos2 + sqrt(1 - cos1 * cos1) * sqrt(1 - cos2 * cos2);
      sin_dtheta2 = 1 - x * x;
      length_ave2 = ((length_orig[j] + length_rot[j]) *
                     (length_orig[k] + length_rot[k])) /
                    4;
      if (sin_dtheta2 > 1e-12) {
        if (sin_dtheta2 * length_ave2 > symprec * symprec) {
          goto fail;
        }
      }
    }
  }
  return 1;
fail:
  return 0;
}


x86 assembly (clang, -O0):
<is_identity_metric>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
mov    0xecc(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xec9(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xec6(%rip),%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    1215 <is_identity_metric+0xe5>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
cvttsd2si (%rax,%rcx,8),%edi
call   1050 <sqrt@plt>
movslq -0x2c(%rbp),%rax
movsd  %xmm0,-0x90(%rbp,%rax,8)
ff ff
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
cvttsd2si (%rax,%rcx,8),%edi
call   1050 <sqrt@plt>
movslq -0x2c(%rbp),%rax
movsd  %xmm0,-0xb0(%rbp,%rax,8)
ff ff
movslq -0x2c(%rbp),%rax
movsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
movslq -0x2c(%rbp),%rax
subsd  -0xb0(%rbp,%rax,8),%xmm0
ff ff
call   1040 <mat_Dabs@plt>
ucomisd -0x20(%rbp),%xmm0
jbe    1202 <is_identity_metric+0xd2>
jmp    14af <is_identity_metric+0x37f>
jmp    1207 <is_identity_metric+0xd7>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1175 <is_identity_metric+0x45>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    14a3 <is_identity_metric+0x373>
movslq -0x2c(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%eax
mov    %eax,-0x30(%rbp)
movslq -0x2c(%rbp),%rax
mov    -0x4c(%rbp,%rax,8),%eax
mov    %eax,-0x34(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    129d <is_identity_metric+0x16d>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%esi
mov    -0x34(%rbp),%edx
call   1030 <get_angle@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%esi
mov    -0x34(%rbp),%edx
call   1030 <get_angle@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
call   1040 <mat_Dabs@plt>
ucomisd -0x28(%rbp),%xmm0
jbe    1298 <is_identity_metric+0x168>
jmp    14af <is_identity_metric+0x37f>
jmp    1490 <is_identity_metric+0x360>
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x30(%rbp),%rax
divsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
movslq -0x34(%rbp),%rax
divsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x30(%rbp),%rax
divsd  -0xb0(%rbp,%rax,8),%xmm0
ff ff
movslq -0x34(%rbp),%rax
divsd  -0xb0(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xcbe(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <sqrt@plt>
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xc7c(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <sqrt@plt>
movsd  -0xd0(%rbp),%xmm1
ff
movsd  -0xc8(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xc0(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xc16(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movslq -0x30(%rbp),%rax
movsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
movslq -0x30(%rbp),%rax
addsd  -0xb0(%rbp,%rax,8),%xmm0
ff ff
movslq -0x34(%rbp),%rax
movsd  -0x90(%rbp,%rax,8),%xmm1
ff ff
movslq -0x34(%rbp),%rax
addsd  -0xb0(%rbp,%rax,8),%xmm1
ff ff
mulsd  %xmm1,%xmm0
movsd  0xbc5(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  0xba7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    148b <is_identity_metric+0x35b>
movsd  -0x78(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1486 <is_identity_metric+0x356>
jmp    14af <is_identity_metric+0x37f>
jmp    148b <is_identity_metric+0x35b>
jmp    1490 <is_identity_metric+0x360>
jmp    1495 <is_identity_metric+0x365>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    121c <is_identity_metric+0xec>
movl   $0x1,-0x4(%rbp)
jmp    14b6 <is_identity_metric+0x386>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_identity_metric>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    %rsi,%r14
mov    %rdi,%r15
cvttsd2si (%rsi),%edi
call   1050 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
movsd  %xmm0,0x70(%rsp)
cvttsd2si (%r15),%edi
call   1050 <sqrt@plt>
movsd  %xmm0,0x50(%rsp)
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1040 <mat_Dabs@plt>
movsd  0x10(%rsp),%xmm1
xor    %ebp,%ebp
ucomisd %xmm1,%xmm0
ja     13d9 <is_identity_metric+0x2a9>
cvttsd2si 0x20(%r14),%edi
call   1050 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
movsd  %xmm0,0x78(%rsp)
cvttsd2si 0x20(%r15),%edi
call   1050 <sqrt@plt>
movsd  %xmm0,0x58(%rsp)
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1040 <mat_Dabs@plt>
ucomisd 0x10(%rsp),%xmm0
ja     13d9 <is_identity_metric+0x2a9>
cvttsd2si 0x40(%r14),%edi
call   1050 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
movsd  %xmm0,0x80(%rsp)
cvttsd2si 0x40(%r15),%edi
call   1050 <sqrt@plt>
movsd  %xmm0,0x60(%rsp)
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1040 <mat_Dabs@plt>
movsd  0x10(%rsp),%xmm1
ucomisd %xmm1,%xmm0
ja     13d9 <is_identity_metric+0x2a9>
mulsd  %xmm1,%xmm1
movsd  %xmm1,0x10(%rsp)
xor    %ebx,%ebx
lea    0xddb(%rip),%r13
movsd  0x18(%rsp),%xmm1
jmp    12a1 <is_identity_metric+0x171>
nopl   (%rax)
mov    %r14,%rdi
mov    %r12d,%esi
mov    %ebp,%edx
call   1030 <get_angle@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r15,%rdi
mov    %r12d,%esi
mov    %ebp,%edx
call   1030 <get_angle@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1040 <mat_Dabs@plt>
movsd  0x18(%rsp),%xmm1
ucomisd %xmm1,%xmm0
ja     13d0 <is_identity_metric+0x2a0>
add    $0x1,%rbx
cmp    $0x3,%rbx
je     13d4 <is_identity_metric+0x2a4>
ucomisd 0xd6f(%rip),%xmm1
movslq 0x0(%r13,%rbx,8),%r12
movslq 0x4(%r13,%rbx,8),%rbp
ja     1250 <is_identity_metric+0x120>
lea    0x0(,%r12,8),%rax
lea    (%rax,%rax,2),%rax
lea    (%r14,%rax,1),%rcx
movsd  (%rcx,%rbp,8),%xmm1
movsd  0x70(%rsp,%r12,8),%xmm0
movsd  %xmm0,0x30(%rsp)
divsd  %xmm0,%xmm1
movsd  0x70(%rsp,%rbp,8),%xmm0
movsd  %xmm0,0x38(%rsp)
divsd  %xmm0,%xmm1
movsd  %xmm1,0x48(%rsp)
add    %r15,%rax
movsd  (%rax,%rbp,8),%xmm2
movsd  0x50(%rsp,%r12,8),%xmm0
movsd  %xmm0,0x28(%rsp)
divsd  %xmm0,%xmm2
movsd  0x50(%rsp,%rbp,8),%xmm0
movsd  %xmm0,0x20(%rsp)
divsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsp)
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xcd0(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1050 <sqrt@plt>
movsd  %xmm0,0x40(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm0
movsd  0xcab(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1050 <sqrt@plt>
movsd  0x18(%rsp),%xmm1
mulsd  0x40(%rsp),%xmm0
movsd  0x8(%rsp),%xmm2
mulsd  0x48(%rsp),%xmm2
addsd  %xmm0,%xmm2
mulsd  %xmm2,%xmm2
movsd  0xc76(%rip),%xmm0
subsd  %xmm2,%xmm0
ucomisd 0xc72(%rip),%xmm0
jbe    1293 <is_identity_metric+0x163>
movsd  0x30(%rsp),%xmm3
addsd  0x28(%rsp),%xmm3
movsd  0x38(%rsp),%xmm2
addsd  0x20(%rsp),%xmm2
mulsd  %xmm3,%xmm2
mulsd  0xc50(%rip),%xmm2
mulsd  %xmm0,%xmm2
ucomisd 0x10(%rsp),%xmm2
jbe    1293 <is_identity_metric+0x163>
xor    %ebp,%ebp
jmp    13d9 <is_identity_metric+0x2a9>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.is_identity_metric.elem_sets = [3 x [2 x i32]] [[2 x i32] [i32 0, i32 1], [2 x i32] [i32 0, i32 2], [2 x i32] [i32 1, i32 2]]
define i32 @is_identity_metric([3 x double]* %0, [3 x double]* %1, double %2, double %3) {
%5 = alloca i32
%6 = alloca [3 x double]*
%7 = alloca [3 x double]*
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [3 x [2 x i32]]
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca [3 x double]
%20 = alloca [3 x double]
store [3 x double]* %0, [3 x double]** %6
store [3 x double]* %1, [3 x double]** %7
store double %2, double* %8
store double %3, double* %9
%21 = bitcast [3 x [2 x i32]]* %13 to i8*
store i32 0, i32* %10
br label %22
22: ; preds = %66, %4
%23 = load i32, i32* %10
%24 = icmp slt i32 %23, 3
br i1 %24, label %25, label %69
25: ; preds = %22
%26 = load [3 x double]*, [3 x double]** %7
%27 = load i32, i32* %10
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [3 x double], [3 x double]* %26, i64 %28
%30 = load i32, i32* %10
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [3 x double], [3 x double]* %29, i64 0, i64 %31
%33 = load double, double* %32
%34 = fptosi double %33 to i32
%35 = call double @sqrt(i32 %34)
%36 = load i32, i32* %10
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [3 x double], [3 x double]* %19, i64 0, i64 %37
store double %35, double* %38
%39 = load [3 x double]*, [3 x double]** %6
%40 = load i32, i32* %10
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [3 x double], [3 x double]* %39, i64 %41
%43 = load i32, i32* %10
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [3 x double], [3 x double]* %42, i64 0, i64 %44
%46 = load double, double* %45
%47 = fptosi double %46 to i32
%48 = call double @sqrt(i32 %47)
%49 = load i32, i32* %10
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 %50
store double %48, double* %51
%52 = load i32, i32* %10
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [3 x double], [3 x double]* %19, i64 0, i64 %53
%55 = load double, double* %54
%56 = load i32, i32* %10
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 %57
%59 = load double, double* %58
%60 = fsub double %55, %59
%61 = call double @mat_Dabs(double %60)
%62 = load double, double* %8
%63 = fcmp ogt double %61, %62
br i1 %63, label %64, label %65
64: ; preds = %25
br label %198
65: ; preds = %25
br label %66
66: ; preds = %65
%67 = load i32, i32* %10
%68 = add nsw i32 %67, 1
store i32 %68, i32* %10
br label %22
69: ; preds = %22
store i32 0, i32* %10
br label %70
70: ; preds = %194, %69
%71 = load i32, i32* %10
%72 = icmp slt i32 %71, 3
br i1 %72, label %73, label %197
73: ; preds = %70
%74 = load i32, i32* %10
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %13, i64 0, i64 %75
%77 = getelementptr inbounds [2 x i32], [2 x i32]* %76, i64 0, i64 0
%78 = load i32, i32* %77
store i32 %78, i32* %11
%79 = load i32, i32* %10
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %13, i64 0, i64 %80
%82 = getelementptr inbounds [2 x i32], [2 x i32]* %81, i64 0, i64 1
%83 = load i32, i32* %82
store i32 %83, i32* %12
%84 = load double, double* %9
%85 = fcmp ogt double %84, 0.000000e+00
br i1 %85, label %86, label %103
86: ; preds = %73
%87 = load [3 x double]*, [3 x double]** %7
%88 = bitcast [3 x double]* %87 to double**
%89 = load i32, i32* %11
%90 = load i32, i32* %12
%91 = call double @get_angle(double** %88, i32 %89, i32 %90)
%92 = load [3 x double]*, [3 x double]** %6
%93 = bitcast [3 x double]* %92 to double**
%94 = load i32, i32* %11
%95 = load i32, i32* %12
%96 = call double @get_angle(double** %93, i32 %94, i32 %95)
%97 = fsub double %91, %96
%98 = call double @mat_Dabs(double %97)
%99 = load double, double* %9
%100 = fcmp ogt double %98, %99
br i1 %100, label %101, label %102
101: ; preds = %86
br label %198
102: ; preds = %86
br label %193
103: ; preds = %73
%104 = load [3 x double]*, [3 x double]** %7
%105 = load i32, i32* %11
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds [3 x double], [3 x double]* %104, i64 %106
%108 = load i32, i32* %12
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [3 x double], [3 x double]* %107, i64 0, i64 %109
%111 = load double, double* %110
%112 = load i32, i32* %11
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [3 x double], [3 x double]* %19, i64 0, i64 %113
%115 = load double, double* %114
%116 = fdiv double %111, %115
%117 = load i32, i32* %12
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds [3 x double], [3 x double]* %19, i64 0, i64 %118
%120 = load double, double* %119
%121 = fdiv double %116, %120
store double %121, double* %14
%122 = load [3 x double]*, [3 x double]** %6
%123 = load i32, i32* %11
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds [3 x double], [3 x double]* %122, i64 %124
%126 = load i32, i32* %12
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds [3 x double], [3 x double]* %125, i64 0, i64 %127
%129 = load double, double* %128
%130 = load i32, i32* %11
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 %131
%133 = load double, double* %132
%134 = fdiv double %129, %133
%135 = load i32, i32* %12
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 %136
%138 = load double, double* %137
%139 = fdiv double %134, %138
store double %139, double* %15
%140 = load double, double* %14
%141 = load double, double* %15
%142 = load double, double* %14
%143 = load double, double* %14
%144 = fneg double %142
%145 = call double @llvm.fmuladd.f64(double %144, double %143, double 1.000000e+00)
%146 = fptosi double %145 to i32
%147 = call double @sqrt(i32 %146)
%148 = load double, double* %15
%149 = load double, double* %15
%150 = fneg double %148
%151 = call double @llvm.fmuladd.f64(double %150, double %149, double 1.000000e+00)
%152 = fptosi double %151 to i32
%153 = call double @sqrt(i32 %152)
%154 = fmul double %147, %153
%155 = call double @llvm.fmuladd.f64(double %140, double %141, double %154)
store double %155, double* %16
%156 = load double, double* %16
%157 = load double, double* %16
%158 = fneg double %156
%159 = call double @llvm.fmuladd.f64(double %158, double %157, double 1.000000e+00)
store double %159, double* %18
%160 = load i32, i32* %11
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds [3 x double], [3 x double]* %19, i64 0, i64 %161
%163 = load double, double* %162
%164 = load i32, i32* %11
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 %165
%167 = load double, double* %166
%168 = fadd double %163, %167
%169 = load i32, i32* %12
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds [3 x double], [3 x double]* %19, i64 0, i64 %170
%172 = load double, double* %171
%173 = load i32, i32* %12
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 %174
%176 = load double, double* %175
%177 = fadd double %172, %176
%178 = fmul double %168, %177
%179 = fdiv double %178, 4.000000e+00
store double %179, double* %17
%180 = load double, double* %18
%181 = fcmp ogt double %180, 0x3D719799812DEA11
br i1 %181, label %182, label %192
182: ; preds = %103
%183 = load double, double* %18
%184 = load double, double* %17
%185 = fmul double %183, %184
%186 = load double, double* %8
%187 = load double, double* %8
%188 = fmul double %186, %187
%189 = fcmp ogt double %185, %188
br i1 %189, label %190, label %191
190: ; preds = %182
br label %198
191: ; preds = %182
br label %192
192: ; preds = %191, %103
br label %193
193: ; preds = %192, %102
br label %194
194: ; preds = %193
%195 = load i32, i32* %10
%196 = add nsw i32 %195, 1
store i32 %196, i32* %10
br label %70
197: ; preds = %70
store i32 1, i32* %5
br label %199
198: ; preds = %190, %101, %64
store i32 0, i32* %5
br label %199
199: ; preds = %198, %197
%200 = load i32, i32* %5
ret i32 %200
}

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