#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 */
double cos(double);
double sin(double);
int drot3(double dxo, double dyo, double dzo, double phai, double thet,
          double psai, double *dx, double *dy, double *dz) {
  double rph, rth, rps, cph, sph, cth, sth, cps, sps;
  static double dtor = 1.74532925199432958e-2;
  rph = dtor * phai;
  rth = dtor * thet;
  rps = dtor * psai;
  cph = cos(rph);
  sph = sin(rph);
  cth = cos(rth);
  sth = sin(rth);
  cps = cos(rps);
  sps = sin(rps);
  *dx = (cph * cps - sph * cth * sps) * dxo +
        (sph * cps + cph * cth * sps) * dyo + sth * sps * dzo;
  *dy = (-cph * sps - sph * cth * cps) * dxo +
        (-sph * sps + cph * cth * cps) * dyo + sth * cps * dzo;
  *dz = sth * sph * dxo - sth * cph * dyo + cth * dzo;
  return 0;
}


x86 assembly (clang, -O0):
<drot3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%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  0x2ed3(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0x2ec1(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0x2eaf(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x60(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x68(%rbp),%xmm1
movsd  -0x88(%rbp),%xmm2
ff
movsd  -0x70(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
mulsd  -0x90(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm0
movsd  -0x88(%rbp),%xmm4
ff
movsd  -0x68(%rbp),%xmm3
mulsd  -0x78(%rbp),%xmm3
mulsd  -0x90(%rbp),%xmm3
ff
mulsd  %xmm4,%xmm0
addsd  %xmm3,%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  -0x90(%rbp),%xmm0
ff
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x68(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  -0x90(%rbp),%xmm2
ff
movsd  -0x70(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x90(%rbp),%xmm4
ff
movsd  -0x68(%rbp),%xmm3
mulsd  -0x78(%rbp),%xmm3
mulsd  -0x88(%rbp),%xmm3
ff
mulsd  %xmm4,%xmm0
addsd  %xmm3,%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x80(%rbp),%xmm1
mulsd  -0x70(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drot3>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movsd  %xmm2,0x48(%rsp)
movsd  %xmm1,0x38(%rsp)
movsd  %xmm0,0x40(%rsp)
movsd  0xeb4(%rip),%xmm1
movapd %xmm3,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  %xmm1,%xmm4
movsd  %xmm4,(%rsp)
mulsd  %xmm5,%xmm1
movsd  %xmm1,0x8(%rsp)
call   1040 <cos@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x28(%rsp)
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movapd 0xe45(%rip),%xmm1
movapd 0x10(%rsp),%xmm10
xorpd  %xmm10,%xmm1
movsd  0x28(%rsp),%xmm9
mulsd  %xmm9,%xmm1
movapd %xmm1,%xmm2
mulsd  %xmm0,%xmm2
movsd  0x30(%rsp),%xmm8
movapd %xmm8,%xmm3
movsd  0x20(%rsp),%xmm12
mulsd  %xmm12,%xmm3
addsd  %xmm2,%xmm3
movapd %xmm8,%xmm2
mulsd  %xmm9,%xmm2
movapd %xmm2,%xmm4
mulsd  %xmm0,%xmm4
movapd %xmm10,%xmm5
mulsd  %xmm12,%xmm5
addsd  %xmm4,%xmm5
movsd  0x38(%rsp),%xmm7
mulsd  %xmm7,%xmm5
movsd  0x40(%rsp),%xmm6
mulsd  %xmm6,%xmm3
addsd  %xmm5,%xmm3
movsd  (%rsp),%xmm11
movapd %xmm11,%xmm4
mulsd  %xmm0,%xmm4
movsd  0x48(%rsp),%xmm5
mulsd  %xmm5,%xmm4
addsd  %xmm3,%xmm4
movsd  %xmm4,(%rbx)
movapd %xmm12,%xmm4
mulsd  %xmm12,%xmm1
movapd %xmm8,%xmm3
mulsd  %xmm0,%xmm3
subsd  %xmm3,%xmm1
mulsd  %xmm12,%xmm2
mulsd  %xmm10,%xmm0
subsd  %xmm0,%xmm2
mulsd  %xmm7,%xmm2
mulsd  %xmm6,%xmm1
addsd  %xmm2,%xmm1
movapd %xmm4,%xmm2
mulsd  %xmm11,%xmm2
mulsd  %xmm5,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%r15)
movapd %xmm10,%xmm1
mulsd  %xmm11,%xmm1
movapd %xmm8,%xmm0
mulsd  %xmm11,%xmm0
mulsd  %xmm7,%xmm0
mulsd  %xmm6,%xmm1
subsd  %xmm0,%xmm1
movapd %xmm9,%xmm0
mulsd  %xmm5,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@drot3.dtor = internal global double 0x3F91DF46A2529D39
define i32 @drot3(double %0, double %1, double %2, double %3, double %4, double %5, double* %6, double* %7, double* %8) {
%10 = alloca double
%11 = alloca double
%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
store double %0, double* %10
store double %1, double* %11
store double %2, double* %12
store double %3, double* %13
store double %4, double* %14
store double %5, double* %15
store double* %6, double** %16
store double* %7, double** %17
store double* %8, double** %18
%28 = load double, double* @drot3.dtor
%29 = load double, double* %13
%30 = fmul double %28, %29
store double %30, double* %19
%31 = load double, double* @drot3.dtor
%32 = load double, double* %14
%33 = fmul double %31, %32
store double %33, double* %20
%34 = load double, double* @drot3.dtor
%35 = load double, double* %15
%36 = fmul double %34, %35
store double %36, double* %21
%37 = load double, double* %19
%38 = call double @cos(double %37)
store double %38, double* %22
%39 = load double, double* %19
%40 = call double @sin(double %39)
store double %40, double* %23
%41 = load double, double* %20
%42 = call double @cos(double %41)
store double %42, double* %24
%43 = load double, double* %20
%44 = call double @sin(double %43)
store double %44, double* %25
%45 = load double, double* %21
%46 = call double @cos(double %45)
store double %46, double* %26
%47 = load double, double* %21
%48 = call double @sin(double %47)
store double %48, double* %27
%49 = load double, double* %22
%50 = load double, double* %26
%51 = load double, double* %23
%52 = load double, double* %24
%53 = fmul double %51, %52
%54 = load double, double* %27
%55 = fmul double %53, %54
%56 = fneg double %55
%57 = call double @llvm.fmuladd.f64(double %49, double %50, double %56)
%58 = load double, double* %10
%59 = load double, double* %23
%60 = load double, double* %26
%61 = load double, double* %22
%62 = load double, double* %24
%63 = fmul double %61, %62
%64 = load double, double* %27
%65 = fmul double %63, %64
%66 = call double @llvm.fmuladd.f64(double %59, double %60, double %65)
%67 = load double, double* %11
%68 = fmul double %66, %67
%69 = call double @llvm.fmuladd.f64(double %57, double %58, double %68)
%70 = load double, double* %25
%71 = load double, double* %27
%72 = fmul double %70, %71
%73 = load double, double* %12
%74 = call double @llvm.fmuladd.f64(double %72, double %73, double %69)
%75 = load double*, double** %16
store double %74, double* %75
%76 = load double, double* %22
%77 = fneg double %76
%78 = load double, double* %27
%79 = load double, double* %23
%80 = load double, double* %24
%81 = fmul double %79, %80
%82 = load double, double* %26
%83 = fmul double %81, %82
%84 = fneg double %83
%85 = call double @llvm.fmuladd.f64(double %77, double %78, double %84)
%86 = load double, double* %10
%87 = load double, double* %23
%88 = fneg double %87
%89 = load double, double* %27
%90 = load double, double* %22
%91 = load double, double* %24
%92 = fmul double %90, %91
%93 = load double, double* %26
%94 = fmul double %92, %93
%95 = call double @llvm.fmuladd.f64(double %88, double %89, double %94)
%96 = load double, double* %11
%97 = fmul double %95, %96
%98 = call double @llvm.fmuladd.f64(double %85, double %86, double %97)
%99 = load double, double* %25
%100 = load double, double* %26
%101 = fmul double %99, %100
%102 = load double, double* %12
%103 = call double @llvm.fmuladd.f64(double %101, double %102, double %98)
%104 = load double*, double** %17
store double %103, double* %104
%105 = load double, double* %25
%106 = load double, double* %23
%107 = fmul double %105, %106
%108 = load double, double* %10
%109 = load double, double* %25
%110 = load double, double* %22
%111 = fmul double %109, %110
%112 = load double, double* %11
%113 = fmul double %111, %112
%114 = fneg double %113
%115 = call double @llvm.fmuladd.f64(double %107, double %108, double %114)
%116 = load double, double* %24
%117 = load double, double* %12
%118 = call double @llvm.fmuladd.f64(double %116, double %117, double %115)
%119 = load double*, double** %18
store double %118, double* %119
ret i32 0
}

LLVM IR (-O2):
define i32 @drot3(double %0, double %1, double %2, double %3, double %4, double %5, double* nocapture writeonly %6, double* nocapture writeonly %7, double* nocapture writeonly %8) {
%10 = fmul double %3, 0x3F91DF46A2529D39
%11 = fmul double %4, 0x3F91DF46A2529D39
%12 = fmul double %5, 0x3F91DF46A2529D39
%13 = tail call double @cos(double %10)
%14 = tail call double @sin(double %10)
%15 = tail call double @cos(double %11)
%16 = tail call double @sin(double %11)
%17 = tail call double @cos(double %12)
%18 = tail call double @sin(double %12)
%19 = fneg double %14
%20 = fmul double %15, %19
%21 = fmul double %20, %18
%22 = tail call double @llvm.fmuladd.f64(double %13, double %17, double %21)
%23 = fmul double %13, %15
%24 = fmul double %23, %18
%25 = tail call double @llvm.fmuladd.f64(double %14, double %17, double %24)
%26 = fmul double %25, %1
%27 = tail call double @llvm.fmuladd.f64(double %22, double %0, double %26)
%28 = fmul double %16, %18
%29 = tail call double @llvm.fmuladd.f64(double %28, double %2, double %27)
store double %29, double* %6
%30 = fneg double %13
%31 = fmul double %20, %17
%32 = tail call double @llvm.fmuladd.f64(double %30, double %18, double %31)
%33 = fmul double %23, %17
%34 = tail call double @llvm.fmuladd.f64(double %19, double %18, double %33)
%35 = fmul double %34, %1
%36 = tail call double @llvm.fmuladd.f64(double %32, double %0, double %35)
%37 = fmul double %16, %17
%38 = tail call double @llvm.fmuladd.f64(double %37, double %2, double %36)
store double %38, double* %7
%39 = fmul double %14, %16
%40 = fneg double %16
%41 = fmul double %13, %40
%42 = fmul double %41, %1
%43 = tail call double @llvm.fmuladd.f64(double %39, double %0, double %42)
%44 = tail call double @llvm.fmuladd.f64(double %15, double %2, double %43)
store double %44, double* %8
ret i32 0
}