#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*/ gt_agany(double, double, double *, double *, double,
                            double *);
int /*<<< orphan*/ gt_fullrot(double, double *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ rt(double, double, double, double *, double *);
void gtpt(double x1, double y1, double z1, double x2, double y2, double z2,
          double *xr, double *yr, double *zr, double vh, double fnr) {
  double brrt_x, brrt_y, brrt_z;
  double agxy, agz, bsl, drl;
  double rot_x, rot_y, rot_z;
  double afrt_x, afrt_y, afrt_z;
  double ag_a, frt;
  double ag_vh, bsl_vh;
  if (vh == 0) {
    brrt_x = x1 - x2;
    brrt_y = y1 - y2;
    brrt_z = z1 - z2;
    gt_agany(brrt_x, brrt_y, &ag_vh, &bsl_vh, fnr, &ag_a);
    gt_fullrot(ag_a, &frt);
    rt(frt, brrt_x, brrt_y, &afrt_x, &afrt_y);
    afrt_z = brrt_z;
    *xr = x1 + (afrt_x - brrt_x);
    *yr = y1 + (afrt_y - brrt_y);
    *zr = z1 + (afrt_z - brrt_z);
  } else if (vh == 1) {
    brrt_x = x1 - x2;
    brrt_y = y1 - y2;
    brrt_z = z1 - z2;
    gt_agany(brrt_y, brrt_z, &ag_vh, &bsl_vh, fnr, &ag_a);
    gt_fullrot(ag_a, &frt);
    rt(frt, brrt_y, brrt_z, &afrt_y, &afrt_z);
    afrt_x = brrt_x;
    *xr = x1 + (afrt_x - brrt_x);
    *yr = y1 + (afrt_y - brrt_y);
    *zr = z1 + (afrt_z - brrt_z);
  } else {
    printf("rotate Error!\n");
  }
}


x86 assembly (clang, -O0):
<gtpt>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
mov    %rdi,-0x38(%rbp)
mov    %rsi,-0x40(%rbp)
mov    %rdx,-0x48(%rbp)
movsd  %xmm6,-0x50(%rbp)
movsd  %xmm7,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1292 <gtpt+0x152>
jp     1292 <gtpt+0x152>
movsd  -0x8(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
lea    -0xd8(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
lea    -0xc8(%rbp),%rdx
call   1030 <gt_agany@plt>
movsd  -0xc8(%rbp),%xmm0
ff
lea    -0xd0(%rbp),%rdi
call   1060 <gt_fullrot@plt>
movsd  -0xd0(%rbp),%xmm0
ff
movsd  -0x60(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm2
lea    -0xb0(%rbp),%rdi
lea    -0xb8(%rbp),%rsi
call   1050 <rt@plt>
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  -0xb0(%rbp),%xmm1
ff
subsd  -0x60(%rbp),%xmm1
addsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm0
movsd  -0xb8(%rbp),%xmm1
ff
subsd  -0x68(%rbp),%xmm1
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
movsd  -0xc0(%rbp),%xmm1
ff
subsd  -0x70(%rbp),%xmm1
addsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    13bb <gtpt+0x27b>
movsd  -0x50(%rbp),%xmm0
movsd  0xd61(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    13aa <gtpt+0x26a>
jp     13aa <gtpt+0x26a>
movsd  -0x8(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
lea    -0xd8(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
lea    -0xc8(%rbp),%rdx
call   1030 <gt_agany@plt>
movsd  -0xc8(%rbp),%xmm0
ff
lea    -0xd0(%rbp),%rdi
call   1060 <gt_fullrot@plt>
movsd  -0xd0(%rbp),%xmm0
ff
movsd  -0x68(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
lea    -0xb8(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
call   1050 <rt@plt>
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
movsd  -0xb0(%rbp),%xmm1
ff
subsd  -0x60(%rbp),%xmm1
addsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm0
movsd  -0xb8(%rbp),%xmm1
ff
subsd  -0x68(%rbp),%xmm1
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
movsd  -0xc0(%rbp),%xmm1
ff
subsd  -0x70(%rbp),%xmm1
addsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    13b6 <gtpt+0x276>
lea    0xc57(%rip),%rdi
call   1040 <printf@plt>
jmp    13bb <gtpt+0x27b>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gtpt>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movapd %xmm0,%xmm8
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm6
jne    122e <gtpt+0xee>
jp     122e <gtpt+0xee>
movapd %xmm8,%xmm0
subsd  %xmm3,%xmm0
movsd  %xmm0,(%rsp)
movapd %xmm1,%xmm3
subsd  %xmm4,%xmm3
movsd  %xmm3,0x8(%rsp)
movapd %xmm2,%xmm4
subsd  %xmm5,%xmm4
movsd  %xmm4,0x10(%rsp)
lea    0x58(%rsp),%rdi
lea    0x50(%rsp),%rsi
lea    0x38(%rsp),%rdx
movsd  %xmm1,0x20(%rsp)
movapd %xmm3,%xmm1
movsd  %xmm2,0x28(%rsp)
movaps %xmm7,%xmm2
movsd  %xmm8,0x18(%rsp)
call   1030 <gt_agany@plt>
movsd  0x38(%rsp),%xmm0
lea    0x30(%rsp),%rdi
call   1060 <gt_fullrot@plt>
movsd  0x30(%rsp),%xmm0
lea    0x48(%rsp),%rdi
lea    0x40(%rsp),%rsi
movsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
call   1050 <rt@plt>
movsd  0x48(%rsp),%xmm0
subsd  (%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  0x40(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
addsd  0x20(%rsp),%xmm0
movsd  %xmm0,(%r15)
movsd  0x10(%rsp),%xmm0
subsd  %xmm0,%xmm0
jmp    1300 <gtpt+0x1c0>
ucomisd 0xdca(%rip),%xmm6
jne    1315 <gtpt+0x1d5>
jp     1315 <gtpt+0x1d5>
movapd %xmm8,%xmm0
subsd  %xmm3,%xmm0
movsd  %xmm0,0x10(%rsp)
movapd %xmm1,%xmm0
subsd  %xmm4,%xmm0
movsd  %xmm0,(%rsp)
movapd %xmm2,%xmm3
subsd  %xmm5,%xmm3
movsd  %xmm3,0x8(%rsp)
lea    0x58(%rsp),%rdi
lea    0x50(%rsp),%rsi
lea    0x38(%rsp),%rdx
movsd  %xmm1,0x20(%rsp)
movapd %xmm3,%xmm1
movsd  %xmm2,0x28(%rsp)
movaps %xmm7,%xmm2
movsd  %xmm8,0x18(%rsp)
call   1030 <gt_agany@plt>
movsd  0x38(%rsp),%xmm0
lea    0x30(%rsp),%rdi
call   1060 <gt_fullrot@plt>
movsd  0x30(%rsp),%xmm0
lea    0x40(%rsp),%rdi
lea    0x48(%rsp),%rsi
movsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
call   1050 <rt@plt>
movsd  0x10(%rsp),%xmm0
subsd  %xmm0,%xmm0
addsd  0x18(%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  0x40(%rsp),%xmm0
subsd  (%rsp),%xmm0
addsd  0x20(%rsp),%xmm0
movsd  %xmm0,(%r15)
movsd  0x48(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
addsd  0x28(%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xcec(%rip),%rdi
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"rotate Error!\0A\00"
define void @gtpt(double %0, double %1, double %2, double %3, double %4, double %5, double* %6, double* %7, double* %8, double %9, double %10) {
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
%32 = alloca double
%33 = alloca double
%34 = alloca double
%35 = alloca double
%36 = alloca double
%37 = alloca double
%38 = alloca double
%39 = alloca double
store double %0, double* %12
store double %1, double* %13
store double %2, double* %14
store double %3, double* %15
store double %4, double* %16
store double %5, double* %17
store double* %6, double** %18
store double* %7, double** %19
store double* %8, double** %20
store double %9, double* %21
store double %10, double* %22
%40 = load double, double* %21
%41 = fcmp oeq double %40, 0.000000e+00
br i1 %41, label %42, label %81
42: ; preds = %11
%43 = load double, double* %12
%44 = load double, double* %15
%45 = fsub double %43, %44
store double %45, double* %23
%46 = load double, double* %13
%47 = load double, double* %16
%48 = fsub double %46, %47
store double %48, double* %24
%49 = load double, double* %14
%50 = load double, double* %17
%51 = fsub double %49, %50
store double %51, double* %25
%52 = load double, double* %23
%53 = load double, double* %24
%54 = load double, double* %22
%55 = call i32 @gt_agany(double %52, double %53, double* %38, double* %39, double %54, double* %36)
%56 = load double, double* %36
%57 = call i32 @gt_fullrot(double %56, double* %37)
%58 = load double, double* %37
%59 = load double, double* %23
%60 = load double, double* %24
%61 = call i32 @rt(double %58, double %59, double %60, double* %33, double* %34)
%62 = load double, double* %25
store double %62, double* %35
%63 = load double, double* %12
%64 = load double, double* %33
%65 = load double, double* %23
%66 = fsub double %64, %65
%67 = fadd double %63, %66
%68 = load double*, double** %18
store double %67, double* %68
%69 = load double, double* %13
%70 = load double, double* %34
%71 = load double, double* %24
%72 = fsub double %70, %71
%73 = fadd double %69, %72
%74 = load double*, double** %19
store double %73, double* %74
%75 = load double, double* %14
%76 = load double, double* %35
%77 = load double, double* %25
%78 = fsub double %76, %77
%79 = fadd double %75, %78
%80 = load double*, double** %20
store double %79, double* %80
br label %126
81: ; preds = %11
%82 = load double, double* %21
%83 = fcmp oeq double %82, 1.000000e+00
br i1 %83, label %84, label %123
84: ; preds = %81
%85 = load double, double* %12
%86 = load double, double* %15
%87 = fsub double %85, %86
store double %87, double* %23
%88 = load double, double* %13
%89 = load double, double* %16
%90 = fsub double %88, %89
store double %90, double* %24
%91 = load double, double* %14
%92 = load double, double* %17
%93 = fsub double %91, %92
store double %93, double* %25
%94 = load double, double* %24
%95 = load double, double* %25
%96 = load double, double* %22
%97 = call i32 @gt_agany(double %94, double %95, double* %38, double* %39, double %96, double* %36)
%98 = load double, double* %36
%99 = call i32 @gt_fullrot(double %98, double* %37)
%100 = load double, double* %37
%101 = load double, double* %24
%102 = load double, double* %25
%103 = call i32 @rt(double %100, double %101, double %102, double* %34, double* %35)
%104 = load double, double* %23
store double %104, double* %33
%105 = load double, double* %12
%106 = load double, double* %33
%107 = load double, double* %23
%108 = fsub double %106, %107
%109 = fadd double %105, %108
%110 = load double*, double** %18
store double %109, double* %110
%111 = load double, double* %13
%112 = load double, double* %34
%113 = load double, double* %24
%114 = fsub double %112, %113
%115 = fadd double %111, %114
%116 = load double*, double** %19
store double %115, double* %116
%117 = load double, double* %14
%118 = load double, double* %35
%119 = load double, double* %25
%120 = fsub double %118, %119
%121 = fadd double %117, %120
%122 = load double*, double** %20
store double %121, double* %122
br label %125
123: ; preds = %81
%124 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %125
125: ; preds = %123, %84
br label %126
126: ; preds = %125, %42
ret void
}

LLVM IR (-O2):
@str = [14 x i8] c"rotate Error!\00"
define void @gtpt(double %0, double %1, double %2, double %3, double %4, double %5, double* nocapture writeonly %6, double* nocapture writeonly %7, double* nocapture writeonly %8, double %9, double %10) {
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = bitcast double* %12 to i8*
%20 = bitcast double* %13 to i8*
%21 = bitcast double* %14 to i8*
%22 = bitcast double* %15 to i8*
%23 = bitcast double* %16 to i8*
%24 = bitcast double* %17 to i8*
%25 = bitcast double* %18 to i8*
%26 = fcmp oeq double %9, 0.000000e+00
br i1 %26, label %27, label %44
27: ; preds = %11
%28 = fsub double %0, %3
%29 = fsub double %1, %4
%30 = fsub double %2, %5
%31 = call i32 @gt_agany(double %28, double %29, double* %17, double* %18, double %10, double* %15)
%32 = load double, double* %15
%33 = call i32 @gt_fullrot(double %32, double* %16)
%34 = load double, double* %16
%35 = call i32 @rt(double %34, double %28, double %29, double* %12, double* %13)
%36 = load double, double* %12
%37 = fsub double %36, %28
%38 = fadd double %37, %0
store double %38, double* %6
%39 = load double, double* %13
%40 = fsub double %39, %29
%41 = fadd double %40, %1
store double %41, double* %7
%42 = fsub double %30, %30
%43 = fadd double %42, %2
store double %43, double* %8
br label %65
44: ; preds = %11
%45 = fcmp oeq double %9, 1.000000e+00
br i1 %45, label %46, label %63
46: ; preds = %44
%47 = fsub double %0, %3
%48 = fsub double %1, %4
%49 = fsub double %2, %5
%50 = call i32 @gt_agany(double %48, double %49, double* %17, double* %18, double %10, double* %15)
%51 = load double, double* %15
%52 = call i32 @gt_fullrot(double %51, double* %16)
%53 = load double, double* %16
%54 = call i32 @rt(double %53, double %48, double %49, double* %13, double* %14)
%55 = fsub double %47, %47
%56 = fadd double %55, %0
store double %56, double* %6
%57 = load double, double* %13
%58 = fsub double %57, %48
%59 = fadd double %58, %1
store double %59, double* %7
%60 = load double, double* %14
%61 = fsub double %60, %49
%62 = fadd double %61, %2
store double %62, double* %8
br label %65
63: ; preds = %44
%64 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %65
65: ; preds = %46, %63, %27
ret void
}