#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 */
int /*<<< orphan*/ arb_rotation(double *, double, double **);
int /*<<< orphan*/ bring_atoms(int, long, long, char **, long *, long *);
int /*<<< orphan*/ cross(double *, double *, double *);
double **dmatrix(int, int, int, int);
double dot(double *, double *);
int /*<<< orphan*/ free_dmatrix(double **, int, int, int, int);
int /*<<< orphan*/ ls_plane(double **, long, double *, double *, double *,
                            double *);
double magang(double *, double *);
int /*<<< orphan*/ plane_xyz(long, double **, double *, double *, double **);
void prj2plane(long num, long rnum, char **AtomName, double **xyz, double z0,
               double **nxyz) {
  double ang, temp;
  double zaxis[4] = {-9999.99, 0.0, 0.0, 1.0};
  double adist[10], hinge[4], ppos[4], z[4];
  double **bxyz, **rmtx;
  long i, j, nmatch;
  long batom[10];
  bring_atoms(1, num, rnum, AtomName, &nmatch, batom);
  bxyz = dmatrix(1, nmatch, 1, 3);
  for (i = 1; i <= nmatch; i++)
    for (j = 1; j <= 3; j++)
      bxyz[i][j] = xyz[batom[i]][j];
  ls_plane(bxyz, nmatch, z, ppos, &temp, adist);
  plane_xyz(num, xyz, ppos, z, nxyz);
  rmtx = dmatrix(1, 3, 1, 3);
  if (z0) {
    cross(z, zaxis, hinge);
    ang = magang(z, zaxis);
    arb_rotation(hinge, ang, rmtx);
    for (i = 1; i <= num; i++)
      for (j = 1; j <= 3; j++)
        nxyz[i][j] = dot(xyz[i], rmtx[j]);
    for (i = 1; i <= num; i++)
      nxyz[i][3] -= nxyz[1][3];
  }
  free_dmatrix(bxyz, 1, nmatch, 1, 3);
  free_dmatrix(rmtx, 1, 3, 1, 3);
}


x86 assembly (clang, -O0):
<prj2plane>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    0xe45(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe42(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xe3f(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe3c(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    -0x190(%rbp),%r9
mov    $0x1,%edi
lea    -0x138(%rbp),%r8
call   1080 <bring_atoms@plt>
mov    -0x138(%rbp),%rax
mov    %eax,%esi
mov    $0x1,%edx
mov    $0x3,%ecx
mov    %edx,%edi
call   1070 <dmatrix@plt>
mov    %rax,-0x118(%rbp)
movq   $0x1,-0x128(%rbp)
mov    -0x128(%rbp),%rax
cmp    -0x138(%rbp),%rax
jg     12d1 <prj2plane+0x141>
movq   $0x1,-0x130(%rbp)
cmpq   $0x3,-0x130(%rbp)
03
jg     12b5 <prj2plane+0x125>
mov    -0x20(%rbp),%rax
mov    -0x128(%rbp),%rcx
mov    -0x190(%rbp,%rcx,8),%rcx
ff
mov    (%rax,%rcx,8),%rax
mov    -0x130(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x118(%rbp),%rax
mov    -0x128(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x130(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x130(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x130(%rbp)
jmp    124f <prj2plane+0xbf>
jmp    12ba <prj2plane+0x12a>
mov    -0x128(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x128(%rbp)
jmp    1230 <prj2plane+0xa0>
mov    -0x118(%rbp),%rdi
mov    -0x138(%rbp),%rsi
lea    -0x110(%rbp),%rdx
lea    -0xf0(%rbp),%rcx
lea    -0xb0(%rbp),%r9
lea    -0x40(%rbp),%r8
call   1050 <ls_plane@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
lea    -0x110(%rbp),%rcx
mov    -0x30(%rbp),%r8
call   1090 <plane_xyz@plt>
mov    $0x1,%edx
mov    $0x3,%ecx
mov    %edx,%edi
mov    %ecx,%esi
call   1070 <dmatrix@plt>
mov    %rax,-0x120(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1353 <prj2plane+0x1c3>
jp     1353 <prj2plane+0x1c3>
jmp    14a2 <prj2plane+0x312>
lea    -0x110(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0xd0(%rbp),%rdx
call   10b0 <cross@plt>
lea    -0x110(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1060 <magang@plt>
movsd  %xmm0,-0x38(%rbp)
lea    -0xd0(%rbp),%rdi
movsd  -0x38(%rbp),%xmm0
mov    -0x120(%rbp),%rsi
call   1040 <arb_rotation@plt>
movq   $0x1,-0x128(%rbp)
mov    -0x128(%rbp),%rax
cmp    -0x8(%rbp),%rax
jg     1440 <prj2plane+0x2b0>
movq   $0x1,-0x130(%rbp)
cmpq   $0x3,-0x130(%rbp)
03
jg     1424 <prj2plane+0x294>
mov    -0x20(%rbp),%rax
mov    -0x128(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x120(%rbp),%rax
mov    -0x130(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <dot@plt>
mov    -0x30(%rbp),%rax
mov    -0x128(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x130(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x130(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x130(%rbp)
jmp    13be <prj2plane+0x22e>
jmp    1429 <prj2plane+0x299>
mov    -0x128(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x128(%rbp)
jmp    13a2 <prj2plane+0x212>
movq   $0x1,-0x128(%rbp)
mov    -0x128(%rbp),%rax
cmp    -0x8(%rbp),%rax
jg     149d <prj2plane+0x30d>
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%rax
movsd  0x18(%rax),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x128(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0x18(%rax),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rax)
mov    -0x128(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x128(%rbp)
jmp    144b <prj2plane+0x2bb>
jmp    14a2 <prj2plane+0x312>
mov    -0x118(%rbp),%rdi
mov    -0x138(%rbp),%rax
mov    %eax,%edx
mov    $0x1,%ecx
mov    $0x3,%r8d
mov    %ecx,%esi
call   10a0 <free_dmatrix@plt>
mov    -0x120(%rbp),%rdi
mov    $0x1,%ecx
mov    $0x3,%r8d
mov    %ecx,%esi
mov    %r8d,%edx
call   10a0 <free_dmatrix@plt>
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prj2plane>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x148,%rsp
mov    %r8,%r12
movsd  %xmm0,0x8(%rsp)
mov    %rcx,%rbx
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%r15
movaps 0xe53(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movapd 0xe36(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
mov    %rsp,%r8
lea    0x80(%rsp),%r9
mov    $0x1,%edi
mov    %r15,%rsi
call   1080 <bring_atoms@plt>
mov    (%rsp),%esi
mov    $0x1,%edi
mov    $0x1,%edx
mov    $0x3,%ecx
call   1070 <dmatrix@plt>
mov    %rax,%r14
mov    (%rsp),%rsi
test   %rsi,%rsi
jle    12d3 <prj2plane+0x143>
mov    $0x1,%eax
cmp    $0x1,%rsi
je     129f <prj2plane+0x10f>
mov    %rsi,%rcx
and    $0xfffffffffffffffe,%rcx
neg    %rcx
mov    $0x1,%eax
nopl   (%rax)
mov    0x80(%rsp,%rax,8),%rdx
mov    (%rbx,%rdx,8),%rdx
mov    (%r14,%rax,8),%rdi
movsd  0x8(%rdx),%xmm0
movsd  %xmm0,0x8(%rdi)
movsd  0x10(%rdx),%xmm0
movsd  %xmm0,0x10(%rdi)
movsd  0x18(%rdx),%xmm0
movsd  %xmm0,0x18(%rdi)
mov    0x88(%rsp,%rax,8),%rdx
mov    (%rbx,%rdx,8),%rdx
mov    0x8(%r14,%rax,8),%rdi
movsd  0x8(%rdx),%xmm0
movsd  %xmm0,0x8(%rdi)
movsd  0x10(%rdx),%xmm0
movsd  %xmm0,0x10(%rdi)
movsd  0x18(%rdx),%xmm0
movsd  %xmm0,0x18(%rdi)
lea    (%rcx,%rax,1),%rdx
add    $0x2,%rdx
add    $0x2,%rax
cmp    $0x1,%rdx
jne    1230 <prj2plane+0xa0>
test   $0x1,%sil
je     12d3 <prj2plane+0x143>
mov    0x80(%rsp,%rax,8),%rcx
mov    (%rbx,%rcx,8),%rcx
mov    (%r14,%rax,8),%rax
movsd  0x8(%rcx),%xmm0
movsd  %xmm0,0x8(%rax)
movsd  0x10(%rcx),%xmm0
movsd  %xmm0,0x10(%rax)
movsd  0x18(%rcx),%xmm0
movsd  %xmm0,0x18(%rax)
lea    0x40(%rsp),%r13
lea    0xd0(%rsp),%rbp
lea    0x38(%rsp),%r8
lea    0xf0(%rsp),%r9
mov    %r14,%rdi
mov    %r13,%rdx
mov    %rbp,%rcx
call   1050 <ls_plane@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %r13,%rcx
mov    %r12,%r8
call   1090 <plane_xyz@plt>
mov    $0x1,%edi
mov    $0x3,%esi
mov    $0x1,%edx
mov    $0x3,%ecx
call   1070 <dmatrix@plt>
mov    %rax,%r13
xorpd  %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jne    1341 <prj2plane+0x1b1>
jnp    14ac <prj2plane+0x31c>
lea    0x40(%rsp),%rbp
lea    0x10(%rsp),%rsi
lea    0x60(%rsp),%rdx
mov    %rbp,%rdi
call   10b0 <cross@plt>
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
call   1060 <magang@plt>
lea    0x60(%rsp),%rdi
mov    %r13,%rsi
call   1040 <arb_rotation@plt>
test   %r15,%r15
jle    14ac <prj2plane+0x31c>
xor    %ebp,%ebp
nopl   (%rax)
mov    0x8(%rbx,%rbp,8),%rdi
mov    0x8(%r13),%rsi
call   1030 <dot@plt>
mov    0x8(%r12,%rbp,8),%rax
movsd  %xmm0,0x8(%rax)
mov    0x8(%rbx,%rbp,8),%rdi
mov    0x10(%r13),%rsi
call   1030 <dot@plt>
mov    0x8(%r12,%rbp,8),%rax
movsd  %xmm0,0x10(%rax)
mov    0x8(%rbx,%rbp,8),%rdi
mov    0x18(%r13),%rsi
call   1030 <dot@plt>
mov    0x8(%r12,%rbp,8),%rax
movsd  %xmm0,0x18(%rax)
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1380 <prj2plane+0x1f0>
test   %r15,%r15
jle    14ac <prj2plane+0x31c>
mov    0x8(%r12),%rax
movsd  0x18(%rax),%xmm0
subsd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rax)
cmp    $0x1,%r15
je     14ac <prj2plane+0x31c>
lea    -0x1(%r15),%rdx
add    $0xfffffffffffffffe,%r15
mov    %edx,%ecx
and    $0x3,%ecx
mov    $0x2,%esi
cmp    $0x3,%r15
jb     1481 <prj2plane+0x2f1>
and    $0xfffffffffffffffc,%rdx
neg    %rdx
mov    $0x2,%esi
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rsi,8),%rdi
movsd  0x18(%rdi),%xmm0
subsd  0x18(%rax),%xmm0
movsd  %xmm0,0x18(%rdi)
mov    0x8(%r12,%rsi,8),%rdi
movsd  0x18(%rdi),%xmm0
subsd  0x18(%rax),%xmm0
movsd  %xmm0,0x18(%rdi)
mov    0x10(%r12,%rsi,8),%rdi
movsd  0x18(%rdi),%xmm0
subsd  0x18(%rax),%xmm0
movsd  %xmm0,0x18(%rdi)
mov    0x18(%r12,%rsi,8),%rdi
movsd  0x18(%rdi),%xmm0
subsd  0x18(%rax),%xmm0
movsd  %xmm0,0x18(%rdi)
lea    (%rdx,%rsi,1),%rdi
add    $0x4,%rdi
add    $0x4,%rsi
cmp    $0x2,%rdi
jne    1420 <prj2plane+0x290>
test   %rcx,%rcx
je     14ac <prj2plane+0x31c>
lea    (%r12,%rsi,8),%rdx
xor    %esi,%esi
nopl   0x0(%rax)
mov    (%rdx,%rsi,8),%rdi
movsd  0x18(%rdi),%xmm0
subsd  0x18(%rax),%xmm0
movsd  %xmm0,0x18(%rdi)
add    $0x1,%rsi
cmp    %rsi,%rcx
jne    1490 <prj2plane+0x300>
mov    (%rsp),%edx
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%ecx
mov    $0x3,%r8d
call   10a0 <free_dmatrix@plt>
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    $0x1,%ecx
mov    $0x3,%r8d
call   10a0 <free_dmatrix@plt>
add    $0x148,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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