#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 ptod3(double pr, double pe, double pp, double *dx, double *dy, double *dz) {
  double rpe, rpp;
  static double dtor = 1.74532925199432958e-2;
  rpe = dtor * pe;
  rpp = dtor * pp;
  *dx = pr * sin(rpp) * cos(rpe);
  *dy = pr * sin(rpp) * sin(rpe);
  *dz = pr * cos(rpp);
  return 0;
}


x86 assembly (clang, -O0):
<ptod3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
movsd  0x2ee5(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0x2ed3(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ptod3>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
movsd  0xec0(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x18(%rsp)
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  0x18(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%r15)
movsd  0x18(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r14)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@ptod3.dtor = internal global double 0x3F91DF46A2529D39
define i32 @ptod3(double %0, double %1, double %2, double* %3, double* %4, double* %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double
%14 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double* %3, double** %10
store double* %4, double** %11
store double* %5, double** %12
%15 = load double, double* @ptod3.dtor
%16 = load double, double* %8
%17 = fmul double %15, %16
store double %17, double* %13
%18 = load double, double* @ptod3.dtor
%19 = load double, double* %9
%20 = fmul double %18, %19
store double %20, double* %14
%21 = load double, double* %7
%22 = load double, double* %14
%23 = call double @sin(double %22)
%24 = fmul double %21, %23
%25 = load double, double* %13
%26 = call double @cos(double %25)
%27 = fmul double %24, %26
%28 = load double*, double** %10
store double %27, double* %28
%29 = load double, double* %7
%30 = load double, double* %14
%31 = call double @sin(double %30)
%32 = fmul double %29, %31
%33 = load double, double* %13
%34 = call double @sin(double %33)
%35 = fmul double %32, %34
%36 = load double*, double** %11
store double %35, double* %36
%37 = load double, double* %7
%38 = load double, double* %14
%39 = call double @cos(double %38)
%40 = fmul double %37, %39
%41 = load double*, double** %12
store double %40, double* %41
ret i32 0
}

LLVM IR (-O2):
define i32 @ptod3(double %0, double %1, double %2, double* nocapture writeonly %3, double* nocapture writeonly %4, double* nocapture writeonly %5) {
%7 = fmul double %1, 0x3F91DF46A2529D39
%8 = fmul double %2, 0x3F91DF46A2529D39
%9 = tail call double @sin(double %8)
%10 = fmul double %9, %0
%11 = tail call double @cos(double %7)
%12 = fmul double %10, %11
store double %12, double* %3
%13 = tail call double @sin(double %8)
%14 = fmul double %13, %0
%15 = tail call double @sin(double %7)
%16 = fmul double %14, %15
store double %16, double* %4
%17 = tail call double @cos(double %8)
%18 = fmul double %17, %0
store double %18, double* %5
ret i32 0
}