#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 */
float acos(float);
scalar_t__ pow(float, int);
float sqrt(scalar_t__);
void thrust_heading(float target_coord_wcs_x, float target_coord_wcs_y,
                    float *thrust_heading_des) {
  float sat_coord_wcs_x, sat_coord_wcs_y;
  float P_sat_to_origin_x, P_sat_to_origin_y, P_sat_to_target_x,
      P_sat_to_target_y;
  float P_origin_to_target_x, P_origin_to_target_y, P_unit_sat_to_target_x,
      P_unit_sat_to_target_y;
  float i_unit_x = 1;
  P_sat_to_origin_x = (-1) * sat_coord_wcs_x;
  P_sat_to_origin_y = (-1) * sat_coord_wcs_y;
  P_origin_to_target_x = target_coord_wcs_x;
  P_origin_to_target_y = target_coord_wcs_y;
  P_sat_to_target_x = P_sat_to_origin_x + P_origin_to_target_x;
  P_sat_to_target_y = P_sat_to_origin_y + P_origin_to_target_y;
  P_unit_sat_to_target_x =
      (P_sat_to_target_x /
       sqrt(pow(P_sat_to_target_x, 2) + pow(P_sat_to_target_y, 2)));
  P_unit_sat_to_target_y =
      (P_sat_to_target_y /
       sqrt(pow(P_sat_to_target_x, 2) + pow(P_sat_to_target_y, 2)));
  *thrust_heading_des = acos(P_unit_sat_to_target_x * i_unit_x);
}


x86 assembly (clang, -O0):
<thrust_heading>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movss  0xeb6(%rip),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  0xea5(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xe93(%rip),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x1c(%rbp),%xmm0
addss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x20(%rbp),%xmm0
addss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x24(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %rax,-0x58(%rbp)
movss  -0x28(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    -0x58(%rbp),%rdi
add    %rax,%rdi
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x4c(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x24(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %rax,-0x48(%rbp)
movss  -0x28(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    -0x48(%rbp),%rdi
add    %rax,%rdi
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x40(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x34(%rbp),%xmm0
mulss  -0x3c(%rbp),%xmm0
call   1030 <acos@plt>
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thrust_heading>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
movss  0xec1(%rip),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %rax,%rbx
movss  0xeac(%rip),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
add    %rax,%rbx
mov    %rbx,%rdi
call   1050 <sqrt@plt>
movss  0xe8f(%rip),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %rax,%rbx
movss  0xe7a(%rip),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
add    %rax,%rbx
mov    %rbx,%rdi
call   1050 <sqrt@plt>
movss  0xe5d(%rip),%xmm0
call   1030 <acos@plt>
movss  %xmm0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @thrust_heading(float %0, float %1, float* %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float*
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
store float %0, float* %4
store float %1, float* %5
store float* %2, float** %6
store float 1.000000e+00, float* %17
%18 = load float, float* %7
%19 = fmul float -1.000000e+00, %18
store float %19, float* %9
%20 = load float, float* %8
%21 = fmul float -1.000000e+00, %20
store float %21, float* %10
%22 = load float, float* %4
store float %22, float* %13
%23 = load float, float* %5
store float %23, float* %14
%24 = load float, float* %9
%25 = load float, float* %13
%26 = fadd float %24, %25
store float %26, float* %11
%27 = load float, float* %10
%28 = load float, float* %14
%29 = fadd float %27, %28
store float %29, float* %12
%30 = load float, float* %11
%31 = load float, float* %11
%32 = call i64 @pow(float %31, i32 2)
%33 = load float, float* %12
%34 = call i64 @pow(float %33, i32 2)
%35 = add nsw i64 %32, %34
%36 = call float @sqrt(i64 %35)
%37 = fdiv float %30, %36
store float %37, float* %15
%38 = load float, float* %12
%39 = load float, float* %11
%40 = call i64 @pow(float %39, i32 2)
%41 = load float, float* %12
%42 = call i64 @pow(float %41, i32 2)
%43 = add nsw i64 %40, %42
%44 = call float @sqrt(i64 %43)
%45 = fdiv float %38, %44
store float %45, float* %16
%46 = load float, float* %15
%47 = load float, float* %17
%48 = fmul float %46, %47
%49 = call float @acos(float %48)
%50 = load float*, float** %6
store float %49, float* %50
ret void
}

LLVM IR (-O2):
define void @thrust_heading(float %0, float %1, float* nocapture writeonly %2) {
%4 = tail call i64 @pow(float 0x7FF8000000000000, i32 2)
%5 = tail call i64 @pow(float 0x7FF8000000000000, i32 2)
%6 = add nsw i64 %5, %4
%7 = tail call float @sqrt(i64 %6)
%8 = tail call i64 @pow(float 0x7FF8000000000000, i32 2)
%9 = tail call i64 @pow(float 0x7FF8000000000000, i32 2)
%10 = add nsw i64 %9, %8
%11 = tail call float @sqrt(i64 %10)
%12 = tail call float @acos(float 0x7FF8000000000000)
store float %12, float* %2
ret void
}