#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);
int /*<<< orphan*/ pix2ang_ring_z_phi(long, long, double *, double *);
double sin(double);
double sqrt(int);
void pix2vec_ring(long nside, long ipix, double *vec) {
  double z, phi;
  pix2ang_ring_z_phi(nside, ipix, &z, &phi);
  double stheta = sqrt((1. - z) * (1. + z));
  vec[0] = stheta * cos(phi);
  vec[1] = stheta * sin(phi);
  vec[2] = z;
}


x86 assembly (clang, -O0):
<pix2vec_ring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   1030 <pix2ang_ring_z_phi@plt>
movsd  0xe8f(%rip),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  0xe82(%rip),%xmm1
addsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pix2vec_ring>:
push   %rbx
sub    $0x20,%rsp
mov    %rdx,%rbx
lea    0x18(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1030 <pix2ang_ring_z_phi@plt>
movsd  0x18(%rsp),%xmm0
movsd  0xe9b(%rip),%xmm1
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
addsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  0x10(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rbx)
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x10(%rbx)
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @pix2vec_ring(i64 %0, i64 %1, double* %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca double
store i64 %0, i64* %4
store i64 %1, i64* %5
store double* %2, double** %6
%10 = load i64, i64* %4
%11 = load i64, i64* %5
%12 = call i32 @pix2ang_ring_z_phi(i64 %10, i64 %11, double* %7, double* %8)
%13 = load double, double* %7
%14 = fsub double 1.000000e+00, %13
%15 = load double, double* %7
%16 = fadd double 1.000000e+00, %15
%17 = fmul double %14, %16
%18 = fptosi double %17 to i32
%19 = call double @sqrt(i32 %18)
store double %19, double* %9
%20 = load double, double* %9
%21 = load double, double* %8
%22 = call double @cos(double %21)
%23 = fmul double %20, %22
%24 = load double*, double** %6
%25 = getelementptr inbounds double, double* %24, i64 0
store double %23, double* %25
%26 = load double, double* %9
%27 = load double, double* %8
%28 = call double @sin(double %27)
%29 = fmul double %26, %28
%30 = load double*, double** %6
%31 = getelementptr inbounds double, double* %30, i64 1
store double %29, double* %31
%32 = load double, double* %7
%33 = load double*, double** %6
%34 = getelementptr inbounds double, double* %33, i64 2
store double %32, double* %34
ret void
}

LLVM IR (-O2):
define void @pix2vec_ring(i64 %0, i64 %1, double* nocapture writeonly %2) {
%4 = alloca double
%5 = alloca double
%6 = bitcast double* %4 to i8*
%7 = bitcast double* %5 to i8*
%8 = call i32 @pix2ang_ring_z_phi(i64 %0, i64 %1, double* %4, double* %5)
%9 = load double, double* %4
%10 = fsub double 1.000000e+00, %9
%11 = fadd double %9, 1.000000e+00
%12 = fmul double %10, %11
%13 = fptosi double %12 to i32
%14 = call double @sqrt(i32 %13)
%15 = load double, double* %5
%16 = call double @cos(double %15)
%17 = fmul double %14, %16
store double %17, double* %2
%18 = load double, double* %5
%19 = call double @sin(double %18)
%20 = fmul double %14, %19
%21 = getelementptr inbounds double, double* %2, i64 1
store double %20, double* %21
%22 = load double, double* %4
%23 = getelementptr inbounds double, double* %2, i64 2
store double %22, double* %23
ret void
}