#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 atan2(double const, double const);
double sqrt(double const);
void neu2azel(double *azel, const double *neu) {
  double ne;
  azel[0] = atan2(neu[1], neu[0]);
  if (azel[0] < 0.0)
    azel[0] += (2.0 * 3.1415926535898);
  ne = sqrt(neu[0] * neu[0] + neu[1] * neu[1]);
  azel[1] = atan2(neu[2], ne);
  return;
}


x86 assembly (clang, -O0):
<neu2azel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
call   1030 <atan2@plt>
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd (%rax),%xmm0
jbe    1173 <neu2azel+0x53>
mov    -0x8(%rbp),%rax
movsd  0xe95(%rip),%xmm0
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1030 <atan2@plt>
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<neu2azel>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movsd  (%rsi),%xmm1
movsd  0x8(%rsi),%xmm0
call   1030 <atan2@plt>
movsd  0xec0(%rip),%xmm1
addsd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
movapd %xmm0,%xmm3
cmpltsd %xmm2,%xmm3
andpd  %xmm3,%xmm1
andnpd %xmm0,%xmm3
orpd   %xmm1,%xmm3
movlpd %xmm3,(%r14)
movsd  (%rbx),%xmm0
movsd  0x8(%rbx),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd %xmm2,%xmm0
jb     1186 <neu2azel+0x66>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    118f <neu2azel+0x6f>
call   1040 <sqrt@plt>
movapd %xmm0,%xmm1
movsd  0x10(%rbx),%xmm0
call   1030 <atan2@plt>
movsd  %xmm0,0x8(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @neu2azel(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%6 = load double*, double** %4
%7 = getelementptr inbounds double, double* %6, i64 1
%8 = load double, double* %7
%9 = load double*, double** %4
%10 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
%12 = call double @atan2(double %8, double %11)
%13 = load double*, double** %3
%14 = getelementptr inbounds double, double* %13, i64 0
store double %12, double* %14
%15 = load double*, double** %3
%16 = getelementptr inbounds double, double* %15, i64 0
%17 = load double, double* %16
%18 = fcmp olt double %17, 0.000000e+00
br i1 %18, label %19, label %24
19: ; preds = %2
%20 = load double*, double** %3
%21 = getelementptr inbounds double, double* %20, i64 0
%22 = load double, double* %21
%23 = fadd double %22, 0x401921FB54442D28
store double %23, double* %21
br label %24
24: ; preds = %19, %2
%25 = load double*, double** %4
%26 = getelementptr inbounds double, double* %25, i64 0
%27 = load double, double* %26
%28 = load double*, double** %4
%29 = getelementptr inbounds double, double* %28, i64 0
%30 = load double, double* %29
%31 = load double*, double** %4
%32 = getelementptr inbounds double, double* %31, i64 1
%33 = load double, double* %32
%34 = load double*, double** %4
%35 = getelementptr inbounds double, double* %34, i64 1
%36 = load double, double* %35
%37 = fmul double %33, %36
%38 = call double @llvm.fmuladd.f64(double %27, double %30, double %37)
%39 = call double @sqrt(double %38)
store double %39, double* %5
%40 = load double*, double** %4
%41 = getelementptr inbounds double, double* %40, i64 2
%42 = load double, double* %41
%43 = load double, double* %5
%44 = call double @atan2(double %42, double %43)
%45 = load double*, double** %3
%46 = getelementptr inbounds double, double* %45, i64 1
store double %44, double* %46
ret void
}

LLVM IR (-O2):
define void @neu2azel(double* nocapture writeonly %0, double* nocapture %1) {
%3 = getelementptr inbounds double, double* %1, i64 1
%4 = load double, double* %3
%5 = load double, double* %1
%6 = tail call double @atan2(double %4, double %5)
%7 = fcmp olt double %6, 0.000000e+00
%8 = fadd double %6, 0x401921FB54442D28
%9 = select i1 %7, double %8, double %6
store double %9, double* %0
%10 = load double, double* %1
%11 = load double, double* %3
%12 = fmul double %11, %11
%13 = tail call double @llvm.fmuladd.f64(double %10, double %10, double %12)
%14 = tail call double @sqrt(double %13)
%15 = getelementptr inbounds double, double* %1, i64 2
%16 = load double, double* %15
%17 = tail call double @atan2(double %16, double %14)
%18 = getelementptr inbounds double, double* %0, i64 1
store double %17, double* %18
ret void
}