#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*/ ang2vec(double, double, double *);
int /*<<< orphan*/ printf(char *, double, double, double, double);
int /*<<< orphan*/ vec2ang(double *, double *, double *);
int main(void) {
  double theta, phi, th1, ph1;
  long nside;
  long ipix, npix, dpix, ip2, ip1, ns1, pp;
  double vec[3];
  nside = 1024;
  dpix = 1;
  theta = 0.5;
  phi = -0.4;
  ang2vec(theta, phi, vec);
  vec2ang(vec, &th1, &ph1);
  printf("%f %f, %f %f\n", theta, th1, phi, ph1);
  theta = -0.1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x400,-0x30(%rbp)
movq   $0x1,-0x48(%rbp)
movsd  0xeb6(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xea1(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    -0x80(%rbp),%rdi
call   1050 <ang2vec@plt>
lea    -0x80(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1030 <vec2ang@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
movsd  0xe48(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movsd  0xec3(%rip),%xmm0
movsd  0xec3(%rip),%xmm1
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <ang2vec@plt>
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1030 <vec2ang@plt>
movsd  0x8(%rsp),%xmm1
movsd  (%rsp),%xmm3
lea    0xe9c(%rip),%rdi
movsd  0xe84(%rip),%xmm0
movsd  0xe84(%rip),%xmm2
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%f %f, %f %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca [3 x double]
store i32 0, i32* %1
store i64 1024, i64* %6
store i64 1, i64* %9
store double 5.000000e-01, double* %2
store double -4.000000e-01, double* %3
%15 = load double, double* %2
%16 = load double, double* %3
%17 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 0
%18 = call i32 @ang2vec(double %15, double %16, double* %17)
%19 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 0
%20 = call i32 @vec2ang(double* %19, double* %4, double* %5)
%21 = load double, double* %2
%22 = load double, double* %4
%23 = load double, double* %3
%24 = load double, double* %5
%25 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %21, double %22, double %23, double %24)
store double -1.000000e-01, double* %2
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"%f %f, %f %f\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca [3 x double]
%4 = bitcast double* %1 to i8*
%5 = bitcast double* %2 to i8*
%6 = bitcast [3 x double]* %3 to i8*
%7 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%8 = call i32 @ang2vec(double 5.000000e-01, double -4.000000e-01, double* %7)
%9 = call i32 @vec2ang(double* %7, double* %1, double* %2)
%10 = load double, double* %1
%11 = load double, double* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double 5.000000e-01, double %10, double -4.000000e-01, double %11)
ret i32 0
}