#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 *);
int /*<<< orphan*/ free_dmatrix(double **, int, long, int, int);
int /*<<< orphan*/ magang(double *, double *);
void rot_2_Yaxis(long num_residue, double *z, long **seidx, double **xyz) {
  double **nxyz, **rotmat, hinge[4];
  double Yphy[4] = {-9999.99, 0.0, 1.0, 0.0};
  long i, j, k, atmnum;
  rotmat = dmatrix(1, 3, 1, 3);
  cross(z, Yphy, hinge);
  arb_rotation(hinge, magang(Yphy, z), rotmat);
  nxyz = dmatrix(1, num_residue * 100, 1, 3);
  atmnum = 0;
  for (i = 1; i <= num_residue; i++) {
    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_dmatrix(nxyz, 1, num_residue * 100, 1, 3);
}


x86 assembly (clang, -O0):
<rot_2_Yaxis>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0xe7e(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xe7b(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xe78(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe75(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    $0x1,%edx
mov    $0x3,%esi
mov    $0x3,%ecx
mov    %edx,%edi
call   1060 <dmatrix@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x70(%rbp),%rsi
lea    -0x50(%rbp),%rdx
call   1080 <cross@plt>
lea    -0x50(%rbp),%rax
mov    %rax,-0x98(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <magang@plt>
mov    -0x98(%rbp),%rdi
mov    %eax,%esi
mov    -0x30(%rbp),%rdx
call   1040 <arb_rotation@plt>
imul   $0x64,-0x8(%rbp),%rsi
mov    $0x1,%edx
mov    $0x3,%ecx
mov    %edx,%edi
call   1060 <dmatrix@plt>
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x90(%rbp)
movq   $0x1,-0x78(%rbp)
mov    -0x78(%rbp),%rax
cmp    -0x8(%rbp),%rax
jg     1371 <rot_2_Yaxis+0x211>
mov    -0x18(%rbp),%rax
mov    -0x78(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    -0x78(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
cmp    0x10(%rcx),%rax
jg     135b <rot_2_Yaxis+0x1fb>
mov    -0x90(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x90(%rbp)
movq   $0x1,-0x88(%rbp)
cmpq   $0x3,-0x88(%rbp)
03
jg     12e2 <rot_2_Yaxis+0x182>
mov    -0x20(%rbp),%rax
mov    -0x80(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x30(%rbp),%rax
mov    -0x88(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <dot@plt>
mov    -0x28(%rbp),%rax
mov    -0x90(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x88(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x88(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
jmp    1282 <rot_2_Yaxis+0x122>
movq   $0x1,-0x88(%rbp)
cmpq   $0x3,-0x88(%rbp)
03
jg     1345 <rot_2_Yaxis+0x1e5>
mov    -0x28(%rbp),%rax
mov    -0x90(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x80(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x88(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x88(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
jmp    12ed <rot_2_Yaxis+0x18d>
jmp    134a <rot_2_Yaxis+0x1ea>
mov    -0x80(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x80(%rbp)
jmp    124b <rot_2_Yaxis+0xeb>
jmp    1360 <rot_2_Yaxis+0x200>
mov    -0x78(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x78(%rbp)
jmp    1229 <rot_2_Yaxis+0xc9>
mov    -0x28(%rbp),%rdi
imul   $0x64,-0x8(%rbp),%rdx
mov    $0x1,%ecx
mov    $0x3,%r8d
mov    %ecx,%esi
call   1070 <free_dmatrix@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rot_2_Yaxis>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rcx,(%rsp)
mov    %rdx,%r14
mov    %rsi,%rbp
mov    %rdi,%r15
movaps 0xe8e(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe72(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    $0x3,%esi
mov    $0x1,%edi
mov    $0x1,%edx
mov    $0x3,%ecx
call   1060 <dmatrix@plt>
mov    %rax,%r12
lea    0x30(%rsp),%r13
lea    0x50(%rsp),%rbx
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1080 <cross@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
call   1050 <magang@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r12,%rdx
call   1040 <arb_rotation@plt>
imul   $0x64,%r15,%rsi
mov    $0x1,%edi
mov    %rsi,0x10(%rsp)
mov    $0x1,%edx
mov    $0x3,%ecx
call   1060 <dmatrix@plt>
mov    (%rsp),%rbp
mov    %rax,%rdi
mov    %r15,0x18(%rsp)
test   %r15,%r15
jle    1312 <rot_2_Yaxis+0x1b2>
mov    %r14,%rdx
mov    $0x1,%ecx
xor    %r14d,%r14d
mov    %r12,0x28(%rsp)
mov    %rdi,0x8(%rsp)
mov    %rdx,0x20(%rsp)
mov    0x28(%rsp),%rbx
mov    0x8(%rsp),%r12
jmp    125d <rot_2_Yaxis+0xfd>
nopw   0x0(%rax,%rax,1)
mov    %r14,%r13
lea    0x1(%rcx),%rax
mov    %r13,%r14
cmp    0x18(%rsp),%rcx
mov    %rax,%rcx
mov    0x8(%rsp),%rdi
je     1312 <rot_2_Yaxis+0x1b2>
mov    (%rdx,%rcx,8),%rax
mov    0x8(%rax),%r15
cmp    0x10(%rax),%r15
jg     1240 <rot_2_Yaxis+0xe0>
add    $0xffffffffffffffff,%r15
mov    %rcx,(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%r14),%r13
mov    0x8(%rbp,%r15,8),%rdi
mov    0x8(%rbx),%rsi
call   1030 <dot@plt>
mov    0x8(%r12,%r14,8),%rax
movsd  %xmm0,0x8(%rax)
mov    0x8(%rbp,%r15,8),%rdi
mov    0x10(%rbx),%rsi
call   1030 <dot@plt>
mov    0x8(%r12,%r14,8),%rax
movsd  %xmm0,0x10(%rax)
mov    0x8(%rbp,%r15,8),%rdi
mov    0x18(%rbx),%rsi
call   1030 <dot@plt>
mov    0x20(%rsp),%rdx
mov    0x8(%r12,%r14,8),%rax
movsd  %xmm0,0x18(%rax)
mov    0x8(%rbp,%r15,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    (%rsp),%rcx
mov    (%rdx,%rcx,8),%rax
add    $0x1,%r15
mov    %r13,%r14
cmp    0x10(%rax),%r15
jl     1280 <rot_2_Yaxis+0x120>
jmp    1243 <rot_2_Yaxis+0xe3>
mov    $0x1,%esi
mov    0x10(%rsp),%rdx
mov    $0x1,%ecx
mov    $0x3,%r8d
call   1070 <free_dmatrix@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@__const.rot_2_Yaxis.Yphy = [4 x double] [double 0xC0C387FEB851EB85, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00]
define void @rot_2_Yaxis(i64 %0, double* %1, i64** nocapture %2, double** nocapture %3) {
%5 = alloca [4 x double]
%6 = alloca [4 x double]
%7 = bitcast [4 x double]* %5 to i8*
%8 = bitcast [4 x double]* %6 to i8*
%9 = tail call double** @dmatrix(i32 1, i64 3, i32 1, i32 3)
%10 = getelementptr inbounds [4 x double], [4 x double]* %6, i64 0, i64 0
%11 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 0
%12 = call i32 @cross(double* %1, double* %10, double* %11)
%13 = call i32 @magang(double* %10, double* %1)
%14 = call i32 @arb_rotation(double* %11, i32 %13, double** %9)
%15 = mul nsw i64 %0, 100
%16 = call double** @dmatrix(i32 1, i64 %15, i32 1, i32 3)
%17 = icmp slt i64 %0, 1
br i1 %17, label %71, label %18
18: ; preds = %4
%19 = getelementptr inbounds double*, double** %9, i64 1
%20 = getelementptr inbounds double*, double** %9, i64 2
%21 = getelementptr inbounds double*, double** %9, i64 3
br label %22
22: ; preds = %18, %67
%23 = phi i64 [ %68, %67 ], [ 0, %18 ]
%24 = phi i64 [ %69, %67 ], [ 1, %18 ]
%25 = getelementptr inbounds i64*, i64** %2, i64 %24
%26 = load i64*, i64** %25
%27 = getelementptr inbounds i64, i64* %26, i64 1
%28 = load i64, i64* %27
%29 = getelementptr inbounds i64, i64* %26, i64 2
%30 = load i64, i64* %29
%31 = icmp sgt i64 %28, %30
br i1 %31, label %67, label %32
32: ; preds = %22, %32
%33 = phi i64 [ %35, %32 ], [ %23, %22 ]
%34 = phi i64 [ %62, %32 ], [ %28, %22 ]
%35 = add nsw i64 %33, 1
%36 = getelementptr inbounds double*, double** %3, i64 %34
%37 = getelementptr inbounds double*, double** %16, i64 %35
%38 = load double*, double** %36
%39 = load double*, double** %19
%40 = call double @dot(double* %38, double* %39)
%41 = load double*, double** %37
%42 = getelementptr inbounds double, double* %41, i64 1
store double %40, double* %42
%43 = load double*, double** %36
%44 = load double*, double** %20
%45 = call double @dot(double* %43, double* %44)
%46 = load double*, double** %37
%47 = getelementptr inbounds double, double* %46, i64 2
store double %45, double* %47
%48 = load double*, double** %36
%49 = load double*, double** %21
%50 = call double @dot(double* %48, double* %49)
%51 = load double*, double** %37
%52 = getelementptr inbounds double, double* %51, i64 3
store double %50, double* %52
%53 = load double*, double** %36
%54 = getelementptr inbounds double, double* %51, i64 1
%55 = load double, double* %54
%56 = getelementptr inbounds double, double* %53, i64 1
store double %55, double* %56
%57 = getelementptr inbounds double, double* %51, i64 2
%58 = load double, double* %57
%59 = getelementptr inbounds double, double* %53, i64 2
store double %58, double* %59
%60 = load double, double* %52
%61 = getelementptr inbounds double, double* %53, i64 3
store double %60, double* %61
%62 = add nsw i64 %34, 1
%63 = load i64*, i64** %25
%64 = getelementptr inbounds i64, i64* %63, i64 2
%65 = load i64, i64* %64
%66 = icmp slt i64 %34, %65
br i1 %66, label %32, label %67
67: ; preds = %32, %22
%68 = phi i64 [ %23, %22 ], [ %35, %32 ]
%69 = add nuw i64 %24, 1
%70 = icmp eq i64 %24, %0
br i1 %70, label %71, label %22
71: ; preds = %67, %4
%72 = call i32 @free_dmatrix(double** %16, i32 1, i64 %15, i32 1, i32 3)
ret void
}