#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 ptoc3(double pr, double pe, double pp, double *cr, double *ct, double *cz) {
  double rcp;
  static double dtor = 1.74532925199432958e-2;
  rcp = dtor * pp;
  *cr = pr * sin(rcp);
  *ct = pe;
  *cz = pr * cos(rcp);
  return 0;
}


x86 assembly (clang, -O0):
<ptoc3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ptoc3>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x8(%rsp)
movapd %xmm2,%xmm0
mulsd  0xeb6(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,(%r15)
movsd  0x10(%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):
@ptoc3.dtor = internal global double 0x3F91DF46A2529D39
define i32 @ptoc3(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
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
%14 = load double, double* @ptoc3.dtor
%15 = load double, double* %9
%16 = fmul double %14, %15
store double %16, double* %13
%17 = load double, double* %7
%18 = load double, double* %13
%19 = call double @sin(double %18)
%20 = fmul double %17, %19
%21 = load double*, double** %10
store double %20, double* %21
%22 = load double, double* %8
%23 = load double*, double** %11
store double %22, double* %23
%24 = load double, double* %7
%25 = load double, double* %13
%26 = call double @cos(double %25)
%27 = fmul double %24, %26
%28 = load double*, double** %12
store double %27, double* %28
ret i32 0
}

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