#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 *, int /*<<< orphan*/, double **);
int /*<<< orphan*/ cross(double *, double *, double *);
double **dmatrix(int, long, int, int);
double dot(double *, double *);
double *dvector(int, long);
int /*<<< orphan*/ free_dmatrix(double **, int, long, int, int);
int /*<<< orphan*/ free_dvector(double *, int, long);
int /*<<< orphan*/ ls_plane(double **, long, double *, double *, double *,
                            double *);
int /*<<< orphan*/ magang(double *, double *);
int /*<<< orphan*/ strcmp(char *, char *);
void rot_mol(long num_residue, char **AtomName, char **ResName, char *ChainID,
             long *ResSeq, double **xyz, long **seidx, long *RY) {
  double *adist, odist, ppos[4], z[4];
  double **Pxyz, **vxyz, **nxyz, **rotmat, hinge[4];
  double Yphy[4] = {-9999.99, 0.0, 1.0, 0.0};
  long i, j, k, Pnum, atmnum, inum = 0;
  Pxyz = dmatrix(1, num_residue, 1, 3);
  Pnum = 0;
  for (i = 1; i <= num_residue; i++) {
    if (RY[i] < 0)
      continue;
    for (j = seidx[i][1]; j <= seidx[i][2]; j++)
      if (!strcmp(AtomName[j], " P  ")) {
        Pnum++;
        for (k = 1; k <= 3; k++)
          Pxyz[Pnum][k] = xyz[j][k];
        break;
      }
  }
  vxyz = dmatrix(1, Pnum, 1, 3);
  for (i = 2; i <= Pnum; i++)
    for (j = 1; j <= 3; j++)
      vxyz[i - 1][j] = Pxyz[i][j] - Pxyz[i - 1][j];
  rotmat = dmatrix(1, 3, 1, 3);
  adist = dvector(1, Pnum);
  ls_plane(vxyz, Pnum - 1, z, ppos, &odist, adist);
  cross(z, Yphy, hinge);
  arb_rotation(hinge, magang(Yphy, z), rotmat);
  nxyz = dmatrix(1, Pnum * 100, 1, 3);
  atmnum = 0;
  for (i = 1; i <= num_residue; i++) {
    if (RY[i] < 0)
      continue;
    for (j = seidx[i][1]; j <= seidx[i][2]; j++) {
      atmnum++;
      for (k = 1; k <= 3; k++)
        nxyz[atmnum][k] = dot(xyz[j], rotmat[k]);
      for (k = 1; k <= 3; k++)
        xyz[j][k] = nxyz[atmnum][k];
    }
  }
  free_dvector(adist, 1, Pnum);
  free_dmatrix(nxyz, 1, Pnum * 100, 1, 3);
  free_dmatrix(Pxyz, 1, Pnum, 1, 3);
  free_dmatrix(vxyz, 1, Pnum - 1, 1, 3);
}


x86 assembly (clang, -O0):
<rot_mol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0xe2e(%rip),%rax
mov    %rax,-0xe0(%rbp)
mov    0xe28(%rip),%rax
mov    %rax,-0xd8(%rbp)
mov    0xe22(%rip),%rax
mov    %rax,-0xd0(%rbp)
mov    0xe1c(%rip),%rax
mov    %rax,-0xc8(%rbp)
movq   $0x0,-0x110(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x1,%edx
mov    $0x3,%ecx
mov    %edx,%edi
call   1080 <dmatrix@plt>
mov    %rax,-0x88(%rbp)
movq   $0x0,-0x100(%rbp)
movq   $0x1,-0xe8(%rbp)
mov    -0xe8(%rbp),%rax
cmp    -0x8(%rbp),%rax
jg     1382 <rot_mol+0x1e2>
mov    0x18(%rbp),%rax
mov    -0xe8(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jge    126c <rot_mol+0xcc>
jmp    136b <rot_mol+0x1cb>
mov    0x10(%rbp),%rax
mov    -0xe8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x8(%rax),%rax
mov    %rax,-0xf0(%rbp)
mov    -0xf0(%rbp),%rax
mov    0x10(%rbp),%rcx
mov    -0xe8(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
cmp    0x10(%rcx),%rax
jg     1366 <rot_mol+0x1c6>
mov    -0x10(%rbp),%rax
mov    -0xf0(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd64(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    134a <rot_mol+0x1aa>
mov    -0x100(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x100(%rbp)
movq   $0x1,-0xf8(%rbp)
cmpq   $0x3,-0xf8(%rbp)
03
jg     1345 <rot_mol+0x1a5>
mov    -0x30(%rbp),%rax
mov    -0xf0(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0xf8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x88(%rbp),%rax
mov    -0x100(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0xf8(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xf8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf8(%rbp)
jmp    12e7 <rot_mol+0x147>
jmp    1366 <rot_mol+0x1c6>
jmp    134f <rot_mol+0x1af>
mov    -0xf0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf0(%rbp)
jmp    1286 <rot_mol+0xe6>
jmp    136b <rot_mol+0x1cb>
mov    -0xe8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xe8(%rbp)
jmp    1240 <rot_mol+0xa0>
mov    -0x100(%rbp),%rsi
mov    $0x1,%edx
mov    $0x3,%ecx
mov    %edx,%edi
call   1080 <dmatrix@plt>
mov    %rax,-0x90(%rbp)
movq   $0x2,-0xe8(%rbp)
mov    -0xe8(%rbp),%rax
cmp    -0x100(%rbp),%rax
jg     146e <rot_mol+0x2ce>
movq   $0x1,-0xf0(%rbp)
cmpq   $0x3,-0xf0(%rbp)
03
jg     1452 <rot_mol+0x2b2>
mov    -0x88(%rbp),%rax
mov    -0xe8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0xf0(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x88(%rbp),%rax
mov    -0xe8(%rbp),%rcx
sub    $0x1,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0xf0(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x90(%rbp),%rax
mov    -0xe8(%rbp),%rcx
sub    $0x1,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0xf0(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xf0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf0(%rbp)
jmp    13cb <rot_mol+0x22b>
jmp    1457 <rot_mol+0x2b7>
mov    -0xe8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xe8(%rbp)
jmp    13ac <rot_mol+0x20c>
mov    $0x1,%edx
mov    $0x3,%esi
mov    $0x3,%ecx
mov    %edx,%edi
call   1080 <dmatrix@plt>
mov    %rax,-0xa0(%rbp)
mov    -0x100(%rbp),%rsi
mov    $0x1,%edi
call   1090 <dvector@plt>
mov    %rax,-0x38(%rbp)
mov    -0x90(%rbp),%rdi
mov    -0x100(%rbp),%rsi
sub    $0x1,%rsi
lea    -0x80(%rbp),%rdx
lea    -0x60(%rbp),%rcx
mov    -0x38(%rbp),%r9
lea    -0x40(%rbp),%r8
call   1050 <ls_plane@plt>
lea    -0x80(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
call   10c0 <cross@plt>
lea    -0xc0(%rbp),%rax
mov    %rax,-0x118(%rbp)
lea    -0xe0(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1060 <magang@plt>
mov    -0x118(%rbp),%rdi
mov    %eax,%esi
mov    -0xa0(%rbp),%rdx
call   1040 <arb_rotation@plt>
imul   $0x64,-0x100(%rbp),%rsi
64
mov    $0x1,%edx
mov    $0x3,%ecx
mov    %edx,%edi
call   1080 <dmatrix@plt>
mov    %rax,-0x98(%rbp)
movq   $0x0,-0x108(%rbp)
movq   $0x1,-0xe8(%rbp)
mov    -0xe8(%rbp),%rax
cmp    -0x8(%rbp),%rax
jg     16d4 <rot_mol+0x534>
mov    0x18(%rbp),%rax
mov    -0xe8(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jge    1573 <rot_mol+0x3d3>
jmp    16bd <rot_mol+0x51d>
mov    0x10(%rbp),%rax
mov    -0xe8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x8(%rax),%rax
mov    %rax,-0xf0(%rbp)
mov    -0xf0(%rbp),%rax
mov    0x10(%rbp),%rcx
mov    -0xe8(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
cmp    0x10(%rcx),%rax
jg     16b8 <rot_mol+0x518>
mov    -0x108(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x108(%rbp)
movq   $0x1,-0xf8(%rbp)
cmpq   $0x3,-0xf8(%rbp)
03
jg     1633 <rot_mol+0x493>
mov    -0x30(%rbp),%rax
mov    -0xf0(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0xa0(%rbp),%rax
mov    -0xf8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <dot@plt>
mov    -0x98(%rbp),%rax
mov    -0x108(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0xf8(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xf8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf8(%rbp)
jmp    15ca <rot_mol+0x42a>
movq   $0x1,-0xf8(%rbp)
cmpq   $0x3,-0xf8(%rbp)
03
jg     169c <rot_mol+0x4fc>
mov    -0x98(%rbp),%rax
mov    -0x108(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0xf8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0xf0(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0xf8(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xf8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf8(%rbp)
jmp    163e <rot_mol+0x49e>
jmp    16a1 <rot_mol+0x501>
mov    -0xf0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf0(%rbp)
jmp    158d <rot_mol+0x3ed>
jmp    16bd <rot_mol+0x51d>
mov    -0xe8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xe8(%rbp)
jmp    1547 <rot_mol+0x3a7>
mov    -0x38(%rbp),%rdi
mov    -0x100(%rbp),%rdx
mov    $0x1,%esi
call   10a0 <free_dvector@plt>
mov    -0x98(%rbp),%rdi
imul   $0x64,-0x100(%rbp),%rdx
64
mov    $0x1,%ecx
mov    $0x3,%r8d
mov    %ecx,%esi
call   10b0 <free_dmatrix@plt>
mov    -0x88(%rbp),%rdi
mov    -0x100(%rbp),%rdx
mov    $0x1,%ecx
mov    $0x3,%r8d
mov    %ecx,%esi
call   10b0 <free_dmatrix@plt>
mov    -0x90(%rbp),%rdi
mov    -0x100(%rbp),%rdx
sub    $0x1,%rdx
mov    $0x1,%ecx
mov    $0x3,%r8d
mov    %ecx,%esi
call   10b0 <free_dmatrix@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rot_mol>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    %r9,0x10(%rsp)
mov    %rsi,%r12
mov    %rdi,%r13
movaps 0xe4d(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movapd 0xe30(%rip),%xmm0
movapd %xmm0,0x60(%rsp)
mov    $0x1,%edi
mov    %r13,%rsi
mov    $0x1,%edx
mov    $0x3,%ecx
call   1080 <dmatrix@plt>
mov    %rax,0x8(%rsp)
test   %r13,%r13
jle    1334 <rot_mol+0x194>
mov    $0x1,%r15d
xor    %eax,%eax
mov    %rax,(%rsp)
lea    0xe12(%rip),%r14
mov    0x120(%rsp),%rcx
jmp    1269 <rot_mol+0xc9>
mov    0x10(%rsp),%rax
mov    (%rax,%rbx,8),%rax
mov    0x8(%rsp),%rcx
mov    (%rsp),%rdx
mov    0x8(%rcx,%rdx,8),%rcx
add    $0x1,%rdx
mov    %rdx,(%rsp)
movsd  0x8(%rax),%xmm0
movsd  %xmm0,0x8(%rcx)
movsd  0x10(%rax),%xmm0
movsd  %xmm0,0x10(%rcx)
movsd  0x18(%rax),%xmm0
movsd  %xmm0,0x18(%rcx)
mov    0x120(%rsp),%rcx
lea    0x1(%r15),%rax
cmp    %r13,%r15
mov    %rax,%r15
je     12af <rot_mol+0x10f>
mov    0x128(%rsp),%rax
cmpq   $0x0,(%rax,%r15,8)
js     125d <rot_mol+0xbd>
mov    (%rcx,%r15,8),%rax
mov    0x8(%rax),%rbx
mov    0x10(%rax),%rbp
cmp    %rbp,%rbx
jg     125d <rot_mol+0xbd>
add    $0x1,%rbp
nopl   (%rax)
mov    (%r12,%rbx,8),%rdi
mov    %r14,%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     1218 <rot_mol+0x78>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1290 <rot_mol+0xf0>
jmp    1255 <rot_mol+0xb5>
mov    $0x1,%edi
mov    (%rsp),%r15
mov    %r15,%rsi
mov    $0x1,%edx
mov    $0x3,%ecx
call   1080 <dmatrix@plt>
mov    %rax,%rbx
cmp    $0x2,%r15
jl     1350 <rot_mol+0x1b0>
mov    0x8(%rsp),%rdi
mov    0x8(%rdi),%rcx
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x8(%rdi,%rax,8),%rdx
mov    (%rbx,%rax,8),%rsi
movsd  0x8(%rdx),%xmm0
subsd  0x8(%rcx),%xmm0
movsd  %xmm0,0x8(%rsi)
movsd  0x10(%rdx),%xmm0
subsd  0x10(%rcx),%xmm0
movsd  %xmm0,0x10(%rsi)
movsd  0x18(%rdx),%xmm0
subsd  0x18(%rcx),%xmm0
movsd  %xmm0,0x18(%rsi)
add    $0x1,%rax
mov    %rdx,%rcx
cmp    %rax,%r15
jne    12f0 <rot_mol+0x150>
jmp    1350 <rot_mol+0x1b0>
xor    %r15d,%r15d
mov    $0x1,%edi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x3,%ecx
call   1080 <dmatrix@plt>
mov    %rax,%rbx
mov    $0x3,%esi
mov    $0x1,%edi
mov    $0x1,%edx
mov    $0x3,%ecx
call   1080 <dmatrix@plt>
mov    %rax,%r12
mov    $0x1,%edi
mov    %r15,%rsi
call   1090 <dvector@plt>
lea    -0x1(%r15),%rsi
lea    0xa0(%rsp),%rbp
lea    0xc0(%rsp),%rcx
lea    0x58(%rsp),%r8
mov    %rbx,0x38(%rsp)
mov    %rbx,%rdi
mov    %rsi,0x30(%rsp)
mov    %rbp,%rdx
mov    %rax,0x28(%rsp)
mov    %rax,%r9
call   1050 <ls_plane@plt>
lea    0x60(%rsp),%r14
lea    0x80(%rsp),%rbx
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   10c0 <cross@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1060 <magang@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r12,%rdx
call   1040 <arb_rotation@plt>
mov    %r15,(%rsp)
imul   $0x64,%r15,%rsi
mov    $0x1,%edi
mov    %rsi,0x20(%rsp)
mov    $0x1,%edx
mov    $0x3,%ecx
call   1080 <dmatrix@plt>
mov    %rax,%rbp
test   %r13,%r13
mov    0x120(%rsp),%rcx
jle    152b <rot_mol+0x38b>
mov    $0x1,%edx
xor    %r15d,%r15d
mov    %r13,0x40(%rsp)
mov    %rbp,0x18(%rsp)
mov    %r12,0x48(%rsp)
mov    0x10(%rsp),%r12
mov    0x18(%rsp),%r14
jmp    145d <rot_mol+0x2bd>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rbx
lea    0x1(%rdx),%rax
mov    %rbx,%r15
cmp    0x40(%rsp),%rdx
mov    %rax,%rdx
mov    0x18(%rsp),%rbp
je     152b <rot_mol+0x38b>
mov    0x128(%rsp),%rax
cmpq   $0x0,(%rax,%rdx,8)
js     1440 <rot_mol+0x2a0>
mov    (%rcx,%rdx,8),%rax
mov    0x8(%rax),%r13
cmp    0x10(%rax),%r13
jg     1440 <rot_mol+0x2a0>
add    $0xffffffffffffffff,%r13
mov    %rdx,0x50(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%r15),%rbx
mov    0x8(%r12,%r13,8),%rdi
mov    0x48(%rsp),%rbp
mov    0x8(%rbp),%rsi
call   1030 <dot@plt>
mov    0x8(%r14,%r15,8),%rax
movsd  %xmm0,0x8(%rax)
mov    0x8(%r12,%r13,8),%rdi
mov    0x10(%rbp),%rsi
call   1030 <dot@plt>
mov    0x8(%r14,%r15,8),%rax
movsd  %xmm0,0x10(%rax)
mov    0x8(%r12,%r13,8),%rdi
mov    0x18(%rbp),%rsi
call   1030 <dot@plt>
mov    0x50(%rsp),%rdx
mov    0x8(%r14,%r15,8),%rax
movsd  %xmm0,0x18(%rax)
mov    0x8(%r12,%r13,8),%rcx
movsd  0x8(%rax),%xmm0
movsd  %xmm0,0x8(%rcx)
movsd  0x10(%rax),%xmm0
movsd  %xmm0,0x10(%rcx)
movsd  0x18(%rax),%xmm0
movsd  %xmm0,0x18(%rcx)
mov    0x120(%rsp),%rcx
mov    (%rcx,%rdx,8),%rax
add    $0x1,%r13
mov    %rbx,%r15
cmp    0x10(%rax),%r13
jl     1490 <rot_mol+0x2f0>
jmp    1443 <rot_mol+0x2a3>
mov    0x28(%rsp),%rdi
mov    $0x1,%esi
mov    (%rsp),%rbx
mov    %rbx,%rdx
call   10a0 <free_dvector@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    0x20(%rsp),%rdx
mov    $0x1,%ecx
mov    $0x3,%r8d
call   10b0 <free_dmatrix@plt>
mov    0x8(%rsp),%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
mov    $0x1,%ecx
mov    $0x3,%r8d
call   10b0 <free_dmatrix@plt>
mov    0x38(%rsp),%rdi
mov    $0x1,%esi
mov    0x30(%rsp),%rdx
mov    $0x1,%ecx
mov    $0x3,%r8d
call   10b0 <free_dmatrix@plt>
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.rot_mol.Yphy = [4 x double] [double 0xC0C387FEB851EB85, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00]
@.str = [5 x i8] c" P \00"
define void @rot_mol(i64 %0, i8** %1, i8** %2, i8* %3, i64* %4, double** %5, i64** %6, i64* %7) {
%9 = alloca i64
%10 = alloca i8**
%11 = alloca i8**
%12 = alloca i8*
%13 = alloca i64*
%14 = alloca double**
%15 = alloca i64**
%16 = alloca i64*
%17 = alloca double*
%18 = alloca double
%19 = alloca [4 x double]
%20 = alloca [4 x double]
%21 = alloca double**
%22 = alloca double**
%23 = alloca double**
%24 = alloca double**
%25 = alloca [4 x double]
%26 = alloca [4 x double]
%27 = alloca i64
%28 = alloca i64
%29 = alloca i64
%30 = alloca i64
%31 = alloca i64
%32 = alloca i64
store i64 %0, i64* %9
store i8** %1, i8*** %10
store i8** %2, i8*** %11
store i8* %3, i8** %12
store i64* %4, i64** %13
store double** %5, double*** %14
store i64** %6, i64*** %15
store i64* %7, i64** %16
%33 = bitcast [4 x double]* %26 to i8*
store i64 0, i64* %32
%34 = load i64, i64* %9
%35 = call double** @dmatrix(i32 1, i64 %34, i32 1, i32 3)
store double** %35, double*** %21
store i64 0, i64* %30
store i64 1, i64* %27
br label %36
36: ; preds = %99, %8
%37 = load i64, i64* %27
%38 = load i64, i64* %9
%39 = icmp sle i64 %37, %38
br i1 %39, label %40, label %102
40: ; preds = %36
%41 = load i64*, i64** %16
%42 = load i64, i64* %27
%43 = getelementptr inbounds i64, i64* %41, i64 %42
%44 = load i64, i64* %43
%45 = icmp slt i64 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %40
br label %99
47: ; preds = %40
%48 = load i64**, i64*** %15
%49 = load i64, i64* %27
%50 = getelementptr inbounds i64*, i64** %48, i64 %49
%51 = load i64*, i64** %50
%52 = getelementptr inbounds i64, i64* %51, i64 1
%53 = load i64, i64* %52
store i64 %53, i64* %28
br label %54
54: ; preds = %95, %47
%55 = load i64, i64* %28
%56 = load i64**, i64*** %15
%57 = load i64, i64* %27
%58 = getelementptr inbounds i64*, i64** %56, i64 %57
%59 = load i64*, i64** %58
%60 = getelementptr inbounds i64, i64* %59, i64 2
%61 = load i64, i64* %60
%62 = icmp sle i64 %55, %61
br i1 %62, label %63, label %98
63: ; preds = %54
%64 = load i8**, i8*** %10
%65 = load i64, i64* %28
%66 = getelementptr inbounds i8*, i8** %64, i64 %65
%67 = load i8*, i8** %66
%68 = call i32 @strcmp(i8* %67, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%69 = icmp ne i32 %68, 0
br i1 %69, label %94, label %70
70: ; preds = %63
%71 = load i64, i64* %30
%72 = add nsw i64 %71, 1
store i64 %72, i64* %30
store i64 1, i64* %29
br label %73
73: ; preds = %90, %70
%74 = load i64, i64* %29
%75 = icmp sle i64 %74, 3
br i1 %75, label %76, label %93
76: ; preds = %73
%77 = load double**, double*** %14
%78 = load i64, i64* %28
%79 = getelementptr inbounds double*, double** %77, i64 %78
%80 = load double*, double** %79
%81 = load i64, i64* %29
%82 = getelementptr inbounds double, double* %80, i64 %81
%83 = load double, double* %82
%84 = load double**, double*** %21
%85 = load i64, i64* %30
%86 = getelementptr inbounds double*, double** %84, i64 %85
%87 = load double*, double** %86
%88 = load i64, i64* %29
%89 = getelementptr inbounds double, double* %87, i64 %88
store double %83, double* %89
br label %90
90: ; preds = %76
%91 = load i64, i64* %29
%92 = add nsw i64 %91, 1
store i64 %92, i64* %29
br label %73
93: ; preds = %73
br label %98
94: ; preds = %63
br label %95
95: ; preds = %94
%96 = load i64, i64* %28
%97 = add nsw i64 %96, 1
store i64 %97, i64* %28
br label %54
98: ; preds = %93, %54
br label %99
99: ; preds = %98, %46
%100 = load i64, i64* %27
%101 = add nsw i64 %100, 1
store i64 %101, i64* %27
br label %36
102: ; preds = %36
%103 = load i64, i64* %30
%104 = call double** @dmatrix(i32 1, i64 %103, i32 1, i32 3)
store double** %104, double*** %22
store i64 2, i64* %27
br label %105
105: ; preds = %141, %102
%106 = load i64, i64* %27
%107 = load i64, i64* %30
%108 = icmp sle i64 %106, %107
br i1 %108, label %109, label %144
109: ; preds = %105
store i64 1, i64* %28
br label %110
110: ; preds = %137, %109
%111 = load i64, i64* %28
%112 = icmp sle i64 %111, 3
br i1 %112, label %113, label %140
113: ; preds = %110
%114 = load double**, double*** %21
%115 = load i64, i64* %27
%116 = getelementptr inbounds double*, double** %114, i64 %115
%117 = load double*, double** %116
%118 = load i64, i64* %28
%119 = getelementptr inbounds double, double* %117, i64 %118
%120 = load double, double* %119
%121 = load double**, double*** %21
%122 = load i64, i64* %27
%123 = sub nsw i64 %122, 1
%124 = getelementptr inbounds double*, double** %121, i64 %123
%125 = load double*, double** %124
%126 = load i64, i64* %28
%127 = getelementptr inbounds double, double* %125, i64 %126
%128 = load double, double* %127
%129 = fsub double %120, %128
%130 = load double**, double*** %22
%131 = load i64, i64* %27
%132 = sub nsw i64 %131, 1
%133 = getelementptr inbounds double*, double** %130, i64 %132
%134 = load double*, double** %133
%135 = load i64, i64* %28
%136 = getelementptr inbounds double, double* %134, i64 %135
store double %129, double* %136
br label %137
137: ; preds = %113
%138 = load i64, i64* %28
%139 = add nsw i64 %138, 1
store i64 %139, i64* %28
br label %110
140: ; preds = %110
br label %141
141: ; preds = %140
%142 = load i64, i64* %27
%143 = add nsw i64 %142, 1
store i64 %143, i64* %27
br label %105
144: ; preds = %105
%145 = call double** @dmatrix(i32 1, i64 3, i32 1, i32 3)
store double** %145, double*** %24
%146 = load i64, i64* %30
%147 = call double* @dvector(i32 1, i64 %146)
store double* %147, double** %17
%148 = load double**, double*** %22
%149 = load i64, i64* %30
%150 = sub nsw i64 %149, 1
%151 = getelementptr inbounds [4 x double], [4 x double]* %20, i64 0, i64 0
%152 = getelementptr inbounds [4 x double], [4 x double]* %19, i64 0, i64 0
%153 = load double*, double** %17
%154 = call i32 @ls_plane(double** %148, i64 %150, double* %151, double* %152, double* %18, double* %153)
%155 = getelementptr inbounds [4 x double], [4 x double]* %20, i64 0, i64 0
%156 = getelementptr inbounds [4 x double], [4 x double]* %26, i64 0, i64 0
%157 = getelementptr inbounds [4 x double], [4 x double]* %25, i64 0, i64 0
%158 = call i32 @cross(double* %155, double* %156, double* %157)
%159 = getelementptr inbounds [4 x double], [4 x double]* %25, i64 0, i64 0
%160 = getelementptr inbounds [4 x double], [4 x double]* %26, i64 0, i64 0
%161 = getelementptr inbounds [4 x double], [4 x double]* %20, i64 0, i64 0
%162 = call i32 @magang(double* %160, double* %161)
%163 = load double**, double*** %24
%164 = call i32 @arb_rotation(double* %159, i32 %162, double** %163)
%165 = load i64, i64* %30
%166 = mul nsw i64 %165, 100
%167 = call double** @dmatrix(i32 1, i64 %166, i32 1, i32 3)
store double** %167, double*** %23
store i64 0, i64* %31
store i64 1, i64* %27
br label %168
168: ; preds = %246, %144
%169 = load i64, i64* %27
%170 = load i64, i64* %9
%171 = icmp sle i64 %169, %170
br i1 %171, label %172, label %249
172: ; preds = %168
%173 = load i64*, i64** %16
%174 = load i64, i64* %27
%175 = getelementptr inbounds i64, i64* %173, i64 %174
%176 = load i64, i64* %175
%177 = icmp slt i64 %176, 0
br i1 %177, label %178, label %179
178: ; preds = %172
br label %246
179: ; preds = %172
%180 = load i64**, i64*** %15
%181 = load i64, i64* %27
%182 = getelementptr inbounds i64*, i64** %180, i64 %181
%183 = load i64*, i64** %182
%184 = getelementptr inbounds i64, i64* %183, i64 1
%185 = load i64, i64* %184
store i64 %185, i64* %28
br label %186
186: ; preds = %242, %179
%187 = load i64, i64* %28
%188 = load i64**, i64*** %15
%189 = load i64, i64* %27
%190 = getelementptr inbounds i64*, i64** %188, i64 %189
%191 = load i64*, i64** %190
%192 = getelementptr inbounds i64, i64* %191, i64 2
%193 = load i64, i64* %192
%194 = icmp sle i64 %187, %193
br i1 %194, label %195, label %245
195: ; preds = %186
%196 = load i64, i64* %31
%197 = add nsw i64 %196, 1
store i64 %197, i64* %31
store i64 1, i64* %29
br label %198
198: ; preds = %217, %195
%199 = load i64, i64* %29
%200 = icmp sle i64 %199, 3
br i1 %200, label %201, label %220
201: ; preds = %198
%202 = load double**, double*** %14
%203 = load i64, i64* %28
%204 = getelementptr inbounds double*, double** %202, i64 %203
%205 = load double*, double** %204
%206 = load double**, double*** %24
%207 = load i64, i64* %29
%208 = getelementptr inbounds double*, double** %206, i64 %207
%209 = load double*, double** %208
%210 = call double @dot(double* %205, double* %209)
%211 = load double**, double*** %23
%212 = load i64, i64* %31
%213 = getelementptr inbounds double*, double** %211, i64 %212
%214 = load double*, double** %213
%215 = load i64, i64* %29
%216 = getelementptr inbounds double, double* %214, i64 %215
store double %210, double* %216
br label %217
217: ; preds = %201
%218 = load i64, i64* %29
%219 = add nsw i64 %218, 1
store i64 %219, i64* %29
br label %198
220: ; preds = %198
store i64 1, i64* %29
br label %221
221: ; preds = %238, %220
%222 = load i64, i64* %29
%223 = icmp sle i64 %222, 3
br i1 %223, label %224, label %241
224: ; preds = %221
%225 = load double**, double*** %23
%226 = load i64, i64* %31
%227 = getelementptr inbounds double*, double** %225, i64 %226
%228 = load double*, double** %227
%229 = load i64, i64* %29
%230 = getelementptr inbounds double, double* %228, i64 %229
%231 = load double, double* %230
%232 = load double**, double*** %14
%233 = load i64, i64* %28
%234 = getelementptr inbounds double*, double** %232, i64 %233
%235 = load double*, double** %234
%236 = load i64, i64* %29
%237 = getelementptr inbounds double, double* %235, i64 %236
store double %231, double* %237
br label %238
238: ; preds = %224
%239 = load i64, i64* %29
%240 = add nsw i64 %239, 1
store i64 %240, i64* %29
br label %221
241: ; preds = %221
br label %242
242: ; preds = %241
%243 = load i64, i64* %28
%244 = add nsw i64 %243, 1
store i64 %244, i64* %28
br label %186
245: ; preds = %186
br label %246
246: ; preds = %245, %178
%247 = load i64, i64* %27
%248 = add nsw i64 %247, 1
store i64 %248, i64* %27
br label %168
249: ; preds = %168
%250 = load double*, double** %17
%251 = load i64, i64* %30
%252 = call i32 @free_dvector(double* %250, i32 1, i64 %251)
%253 = load double**, double*** %23
%254 = load i64, i64* %30
%255 = mul nsw i64 %254, 100
%256 = call i32 @free_dmatrix(double** %253, i32 1, i64 %255, i32 1, i32 3)
%257 = load double**, double*** %21
%258 = load i64, i64* %30
%259 = call i32 @free_dmatrix(double** %257, i32 1, i64 %258, i32 1, i32 3)
%260 = load double**, double*** %22
%261 = load i64, i64* %30
%262 = sub nsw i64 %261, 1
%263 = call i32 @free_dmatrix(double** %260, i32 1, i64 %262, i32 1, i32 3)
ret void
}

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