#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 asin(int);
double atan2(int, int);
int cos(double);
int sin(double);
int tan(double);
int amsp_coord_ecliptic2equatorial(double out[3], double const v[3], double e) {
  double g = v[0], b = v[1];
  out[0] = atan2(sin(g) * cos(e) - tan(b) * sin(e), cos(g));
  out[1] = asin(sin(b) * cos(e) + cos(b) * sin(e) * sin(g));
  out[2] = v[2];
  return 0;
}


x86 assembly (clang, -O0):
<amsp_coord_ecliptic2equatorial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <sin@plt>
mov    %eax,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1070 <cos@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1060 <tan@plt>
mov    %eax,-0x44(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
mov    -0x44(%rbp),%ecx
mov    %eax,%edx
mov    -0x40(%rbp),%eax
imul   %edx,%ecx
sub    %ecx,%eax
mov    %eax,-0x3c(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1070 <cos@plt>
mov    -0x3c(%rbp),%edi
mov    %eax,%esi
call   1030 <atan2@plt>
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
call   1040 <sin@plt>
mov    %eax,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1070 <cos@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1070 <cos@plt>
mov    %eax,-0x34(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x2c(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <sin@plt>
mov    -0x30(%rbp),%edi
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
imul   %ecx,%eax
add    %eax,%edi
call   1050 <asin@plt>
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<amsp_coord_ecliptic2equatorial>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
movsd  %xmm0,(%rsp)
mov    %rsi,%r14
mov    %rdi,%r15
movsd  (%rsi),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsi),%xmm1
movsd  %xmm1,0x8(%rsp)
call   1040 <sin@plt>
mov    %eax,%ebp
movsd  (%rsp),%xmm0
call   1070 <cos@plt>
imul   %eax,%ebp
movsd  0x8(%rsp),%xmm0
call   1060 <tan@plt>
mov    %eax,%ebx
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
imul   %ebx,%eax
sub    %eax,%ebp
movsd  0x10(%rsp),%xmm0
call   1070 <cos@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <atan2@plt>
movsd  %xmm0,(%r15)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
mov    %eax,%ebx
movsd  (%rsp),%xmm0
call   1070 <cos@plt>
imul   %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1070 <cos@plt>
mov    %eax,%ebp
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
imul   %eax,%ebp
movsd  0x10(%rsp),%xmm0
call   1040 <sin@plt>
imul   %eax,%ebp
add    %ebx,%ebp
mov    %ebp,%edi
call   1050 <asin@plt>
movsd  %xmm0,0x8(%r15)
movsd  0x10(%r14),%xmm0
movsd  %xmm0,0x10(%r15)
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @amsp_coord_ecliptic2equatorial(double* %0, double* %1, double %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double %2, double* %6
%9 = load double*, double** %5
%10 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
store double %11, double* %7
%12 = load double*, double** %5
%13 = getelementptr inbounds double, double* %12, i64 1
%14 = load double, double* %13
store double %14, double* %8
%15 = load double, double* %7
%16 = call i32 @sin(double %15)
%17 = load double, double* %6
%18 = call i32 @cos(double %17)
%19 = mul nsw i32 %16, %18
%20 = load double, double* %8
%21 = call i32 @tan(double %20)
%22 = load double, double* %6
%23 = call i32 @sin(double %22)
%24 = mul nsw i32 %21, %23
%25 = sub nsw i32 %19, %24
%26 = load double, double* %7
%27 = call i32 @cos(double %26)
%28 = call double @atan2(i32 %25, i32 %27)
%29 = load double*, double** %4
%30 = getelementptr inbounds double, double* %29, i64 0
store double %28, double* %30
%31 = load double, double* %8
%32 = call i32 @sin(double %31)
%33 = load double, double* %6
%34 = call i32 @cos(double %33)
%35 = mul nsw i32 %32, %34
%36 = load double, double* %8
%37 = call i32 @cos(double %36)
%38 = load double, double* %6
%39 = call i32 @sin(double %38)
%40 = mul nsw i32 %37, %39
%41 = load double, double* %7
%42 = call i32 @sin(double %41)
%43 = mul nsw i32 %40, %42
%44 = add nsw i32 %35, %43
%45 = call double @asin(i32 %44)
%46 = load double*, double** %4
%47 = getelementptr inbounds double, double* %46, i64 1
store double %45, double* %47
%48 = load double*, double** %5
%49 = getelementptr inbounds double, double* %48, i64 2
%50 = load double, double* %49
%51 = load double*, double** %4
%52 = getelementptr inbounds double, double* %51, i64 2
store double %50, double* %52
ret i32 0
}

LLVM IR (-O2):
define i32 @amsp_coord_ecliptic2equatorial(double* nocapture writeonly %0, double* nocapture %1, double %2) {
%4 = load double, double* %1
%5 = getelementptr inbounds double, double* %1, i64 1
%6 = load double, double* %5
%7 = tail call i32 @sin(double %4)
%8 = tail call i32 @cos(double %2)
%9 = mul nsw i32 %8, %7
%10 = tail call i32 @tan(double %6)
%11 = tail call i32 @sin(double %2)
%12 = mul nsw i32 %11, %10
%13 = sub nsw i32 %9, %12
%14 = tail call i32 @cos(double %4)
%15 = tail call double @atan2(i32 %13, i32 %14)
store double %15, double* %0
%16 = tail call i32 @sin(double %6)
%17 = tail call i32 @cos(double %2)
%18 = mul nsw i32 %17, %16
%19 = tail call i32 @cos(double %6)
%20 = tail call i32 @sin(double %2)
%21 = mul nsw i32 %20, %19
%22 = tail call i32 @sin(double %4)
%23 = mul nsw i32 %21, %22
%24 = add nsw i32 %23, %18
%25 = tail call double @asin(i32 %24)
%26 = getelementptr inbounds double, double* %0, i64 1
store double %25, double* %26
%27 = getelementptr inbounds double, double* %1, i64 2
%28 = load double, double* %27
%29 = getelementptr inbounds double, double* %0, i64 2
store double %28, double* %29
ret i32 0
}