#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*/ c_bnd_len(double *, double *, double *);
int /*<<< orphan*/ matmul(double **, double *, double *);
int /*<<< orphan*/ quaternion(double *, double, double *);
int /*<<< orphan*/ rotation_matrix(double *, double **);
void driver_rot(double obj_i[3], double obj_f[3], double tor2[3],
                double tor3[3], float dih_change) {
  double Us[3][3], p[4];
  double vec_rot[3], mat1[3], mat11[3];
  double angle, vec_len;
  int i;
  angle = dih_change * 0.25;
  c_bnd_len(tor2, tor3, &vec_len);
  for (i = 0; i < 3; i++)
    vec_rot[i] = (tor3[i] - tor2[i]) / vec_len;
  quaternion(vec_rot, angle, p);
  rotation_matrix(p, Us);
  for (i = 0; i < 3; i++)
    mat11[i] = obj_i[i] - tor3[i];
  matmul(Us, mat11, mat1);
  for (i = 0; i < 3; i++)
    obj_f[i] = mat1[i] + tor3[i];
  return;
}


x86 assembly (clang, -O0):
<driver_rot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe8f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x100(%rbp),%rdx
call   1060 <c_bnd_len@plt>
movl   $0x0,-0x104(%rbp)
cmpl   $0x3,-0x104(%rbp)
jge    11f4 <driver_rot+0xb4>
mov    -0x20(%rbp),%rax
movslq -0x104(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x104(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
divsd  -0x100(%rbp),%xmm0
ff
movslq -0x104(%rbp),%rax
movsd  %xmm0,-0xb0(%rbp,%rax,8)
ff ff
mov    -0x104(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x104(%rbp)
jmp    119b <driver_rot+0x5b>
lea    -0xb0(%rbp),%rdi
movsd  -0xf8(%rbp),%xmm0
ff
lea    -0x90(%rbp),%rsi
call   1040 <quaternion@plt>
lea    -0x90(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1030 <rotation_matrix@plt>
movl   $0x0,-0x104(%rbp)
cmpl   $0x3,-0x104(%rbp)
jge    127a <driver_rot+0x13a>
mov    -0x8(%rbp),%rax
movslq -0x104(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x104(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movslq -0x104(%rbp),%rax
movsd  %xmm0,-0xf0(%rbp,%rax,8)
ff ff
mov    -0x104(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x104(%rbp)
jmp    1229 <driver_rot+0xe9>
lea    -0x70(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
lea    -0xd0(%rbp),%rdx
call   1050 <matmul@plt>
movl   $0x0,-0x104(%rbp)
cmpl   $0x3,-0x104(%rbp)
jge    12ec <driver_rot+0x1ac>
movslq -0x104(%rbp),%rax
movsd  -0xd0(%rbp,%rax,8),%xmm0
ff ff
mov    -0x20(%rbp),%rax
movslq -0x104(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x104(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x104(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x104(%rbp)
jmp    129b <driver_rot+0x15b>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<driver_rot>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe0,%rsp
mov    %rcx,%rbx
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,(%rsp)
lea    0x8(%rsp),%rdx
mov    %r12,%rdi
mov    %rcx,%rsi
call   1060 <c_bnd_len@plt>
movsd  0x8(%rsp),%xmm0
movupd (%rbx),%xmm1
movupd (%r12),%xmm2
subpd  %xmm2,%xmm1
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
divpd  %xmm2,%xmm1
movapd %xmm1,0x50(%rsp)
movsd  0x10(%rbx),%xmm1
subsd  0x10(%r12),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x60(%rsp)
movsd  (%rsp),%xmm0
mulsd  0xe42(%rip),%xmm0
lea    0x50(%rsp),%rdi
lea    0x70(%rsp),%r12
mov    %r12,%rsi
call   1040 <quaternion@plt>
lea    0x90(%rsp),%r13
mov    %r12,%rdi
mov    %r13,%rsi
call   1030 <rotation_matrix@plt>
movupd (%r15),%xmm0
movupd (%rbx),%xmm1
subpd  %xmm1,%xmm0
movapd %xmm0,0x30(%rsp)
movsd  0x10(%r15),%xmm0
subsd  0x10(%rbx),%xmm0
movsd  %xmm0,0x40(%rsp)
lea    0x30(%rsp),%rsi
lea    0x10(%rsp),%rdx
mov    %r13,%rdi
call   1050 <matmul@plt>
movsd  0x10(%rsp),%xmm0
addsd  (%rbx),%xmm0
movsd  %xmm0,(%r14)
movsd  0x18(%rsp),%xmm0
addsd  0x8(%rbx),%xmm0
movsd  %xmm0,0x8(%r14)
movsd  0x20(%rsp),%xmm0
addsd  0x10(%rbx),%xmm0
movsd  %xmm0,0x10(%r14)
add    $0xe0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @driver_rot(double* %0, double* %1, double* %2, double* %3, float %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca float
%11 = alloca [3 x [3 x double]]
%12 = alloca [4 x double]
%13 = alloca [3 x double]
%14 = alloca [3 x double]
%15 = alloca [3 x double]
%16 = alloca double
%17 = alloca double
%18 = alloca i32
store double* %0, double** %6
store double* %1, double** %7
store double* %2, double** %8
store double* %3, double** %9
store float %4, float* %10
%19 = load float, float* %10
%20 = fpext float %19 to double
%21 = fmul double %20, 2.500000e-01
store double %21, double* %16
%22 = load double*, double** %8
%23 = load double*, double** %9
%24 = call i32 @c_bnd_len(double* %22, double* %23, double* %17)
store i32 0, i32* %18
br label %25
25: ; preds = %45, %5
%26 = load i32, i32* %18
%27 = icmp slt i32 %26, 3
br i1 %27, label %28, label %48
28: ; preds = %25
%29 = load double*, double** %9
%30 = load i32, i32* %18
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
%33 = load double, double* %32
%34 = load double*, double** %8
%35 = load i32, i32* %18
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double, double* %34, i64 %36
%38 = load double, double* %37
%39 = fsub double %33, %38
%40 = load double, double* %17
%41 = fdiv double %39, %40
%42 = load i32, i32* %18
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [3 x double], [3 x double]* %13, i64 0, i64 %43
store double %41, double* %44
br label %45
45: ; preds = %28
%46 = load i32, i32* %18
%47 = add nsw i32 %46, 1
store i32 %47, i32* %18
br label %25
48: ; preds = %25
%49 = getelementptr inbounds [3 x double], [3 x double]* %13, i64 0, i64 0
%50 = load double, double* %16
%51 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 0
%52 = call i32 @quaternion(double* %49, double %50, double* %51)
%53 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 0
%54 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %11, i64 0, i64 0
%55 = bitcast [3 x double]* %54 to double**
%56 = call i32 @rotation_matrix(double* %53, double** %55)
store i32 0, i32* %18
br label %57
57: ; preds = %75, %48
%58 = load i32, i32* %18
%59 = icmp slt i32 %58, 3
br i1 %59, label %60, label %78
60: ; preds = %57
%61 = load double*, double** %6
%62 = load i32, i32* %18
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %61, i64 %63
%65 = load double, double* %64
%66 = load double*, double** %9
%67 = load i32, i32* %18
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %66, i64 %68
%70 = load double, double* %69
%71 = fsub double %65, %70
%72 = load i32, i32* %18
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [3 x double], [3 x double]* %15, i64 0, i64 %73
store double %71, double* %74
br label %75
75: ; preds = %60
%76 = load i32, i32* %18
%77 = add nsw i32 %76, 1
store i32 %77, i32* %18
br label %57
78: ; preds = %57
%79 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %11, i64 0, i64 0
%80 = bitcast [3 x double]* %79 to double**
%81 = getelementptr inbounds [3 x double], [3 x double]* %15, i64 0, i64 0
%82 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 0
%83 = call i32 @matmul(double** %80, double* %81, double* %82)
store i32 0, i32* %18
br label %84
84: ; preds = %102, %78
%85 = load i32, i32* %18
%86 = icmp slt i32 %85, 3
br i1 %86, label %87, label %105
87: ; preds = %84
%88 = load i32, i32* %18
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 %89
%91 = load double, double* %90
%92 = load double*, double** %9
%93 = load i32, i32* %18
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds double, double* %92, i64 %94
%96 = load double, double* %95
%97 = fadd double %91, %96
%98 = load double*, double** %7
%99 = load i32, i32* %18
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds double, double* %98, i64 %100
store double %97, double* %101
br label %102
102: ; preds = %87
%103 = load i32, i32* %18
%104 = add nsw i32 %103, 1
store i32 %104, i32* %18
br label %84
105: ; preds = %84
ret void
}

LLVM IR (-O2):
define void @driver_rot(double* nocapture %0, double* nocapture writeonly %1, double* %2, double* %3, float %4) {
%6 = alloca [3 x [3 x double]]
%7 = alloca [4 x double]
%8 = alloca [3 x double]
%9 = alloca [3 x double]
%10 = alloca [3 x double]
%11 = alloca double
%12 = bitcast [3 x [3 x double]]* %6 to i8*
%13 = bitcast [4 x double]* %7 to i8*
%14 = bitcast [3 x double]* %8 to i8*
%15 = bitcast [3 x double]* %9 to i8*
%16 = bitcast [3 x double]* %10 to i8*
%17 = bitcast double* %11 to i8*
%18 = fpext float %4 to double
%19 = call i32 @c_bnd_len(double* %2, double* %3, double* %11)
%20 = load double, double* %11
%21 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%22 = getelementptr inbounds double, double* %3, i64 1
%23 = bitcast double* %3 to <2 x double>*
%24 = load <2 x double>, <2 x double>* %23
%25 = bitcast double* %2 to <2 x double>*
%26 = load <2 x double>, <2 x double>* %25
%27 = fsub <2 x double> %24, %26
%28 = insertelement <2 x double> poison, double %20, i64 0
%29 = shufflevector <2 x double> %28, <2 x double> poison, <2 x i32> zeroinitializer
%30 = fdiv <2 x double> %27, %29
%31 = bitcast [3 x double]* %8 to <2 x double>*
store <2 x double> %30, <2 x double>* %31
%32 = getelementptr inbounds double, double* %3, i64 2
%33 = load double, double* %32
%34 = getelementptr inbounds double, double* %2, i64 2
%35 = load double, double* %34
%36 = fsub double %33, %35
%37 = fdiv double %36, %20
%38 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 2
store double %37, double* %38
%39 = fmul double %18, 2.500000e-01
%40 = getelementptr inbounds [4 x double], [4 x double]* %7, i64 0, i64 0
%41 = call i32 @quaternion(double* %21, double %39, double* %40)
%42 = bitcast [3 x [3 x double]]* %6 to double**
%43 = call i32 @rotation_matrix(double* %40, double** %42)
%44 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%45 = bitcast double* %0 to <2 x double>*
%46 = load <2 x double>, <2 x double>* %45
%47 = bitcast double* %3 to <2 x double>*
%48 = load <2 x double>, <2 x double>* %47
%49 = fsub <2 x double> %46, %48
%50 = bitcast [3 x double]* %10 to <2 x double>*
store <2 x double> %49, <2 x double>* %50
%51 = getelementptr inbounds double, double* %0, i64 2
%52 = load double, double* %51
%53 = load double, double* %32
%54 = fsub double %52, %53
%55 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 2
store double %54, double* %55
%56 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%57 = call i32 @matmul(double** %42, double* %44, double* %56)
%58 = load double, double* %56
%59 = load double, double* %3
%60 = fadd double %58, %59
store double %60, double* %1
%61 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 1
%62 = load double, double* %61
%63 = load double, double* %22
%64 = fadd double %62, %63
%65 = getelementptr inbounds double, double* %1, i64 1
store double %64, double* %65
%66 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 2
%67 = load double, double* %66
%68 = load double, double* %32
%69 = fadd double %67, %68
%70 = getelementptr inbounds double, double* %1, i64 2
store double %69, double* %70
ret void
}