#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 get_dp(double const, double const);
double sin(double);
void geom_polar_vec_adjust(const double *xp, const double *xm, double *fac) {
  double dphi = get_dp(xp[1], xm[1]);
  double adjust = sin(0.5 * dphi) / (0.5 * dphi);
  fac[0] = adjust;
  fac[1] = adjust;
  fac[2] = 1.0;
}


x86 assembly (clang, -O0):
<geom_polar_vec_adjust>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
call   1040 <get_dp@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  0xeb0(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
movsd  0xe9e(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
movsd  0xe61(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geom_polar_vec_adjust>:
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
movsd  0x8(%rdi),%xmm0
movsd  0x8(%rsi),%xmm1
call   1040 <get_dp@plt>
mulsd  0xec1(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1030 <sin@plt>
divsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  %xmm0,0x8(%rbx)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x10(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @geom_polar_vec_adjust(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** %4
%10 = getelementptr inbounds double, double* %9, i64 1
%11 = load double, double* %10
%12 = load double*, double** %5
%13 = getelementptr inbounds double, double* %12, i64 1
%14 = load double, double* %13
%15 = call double @get_dp(double %11, double %14)
store double %15, double* %7
%16 = load double, double* %7
%17 = fmul double 5.000000e-01, %16
%18 = call double @sin(double %17)
%19 = load double, double* %7
%20 = fmul double 5.000000e-01, %19
%21 = fdiv double %18, %20
store double %21, double* %8
%22 = load double, double* %8
%23 = load double*, double** %6
%24 = getelementptr inbounds double, double* %23, i64 0
store double %22, double* %24
%25 = load double, double* %8
%26 = load double*, double** %6
%27 = getelementptr inbounds double, double* %26, i64 1
store double %25, double* %27
%28 = load double*, double** %6
%29 = getelementptr inbounds double, double* %28, i64 2
store double 1.000000e+00, double* %29
ret void
}

LLVM IR (-O2):
define void @geom_polar_vec_adjust(double* nocapture %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = getelementptr inbounds double, double* %1, i64 1
%7 = load double, double* %6
%8 = tail call double @get_dp(double %5, double %7)
%9 = fmul double %8, 5.000000e-01
%10 = tail call double @sin(double %9)
%11 = fdiv double %10, %9
store double %11, double* %2
%12 = getelementptr inbounds double, double* %2, i64 1
store double %11, double* %12
%13 = getelementptr inbounds double, double* %2, i64 2
store double 1.000000e+00, double* %13
ret void
}