#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 M_PI;
double acos(double);
double fabs(double);
double hypot(double, double);
double dtheta(double x1, double y1, double x2, double y2) {
  double cos_th = (x1 * x2 + y1 * y2) / hypot(x1, y1) / hypot(x2, y2) / 2.0;
  double th = acos(cos_th) * 180.0 / M_PI;
  double dth = fabs(90.0 - th);
  return dth;
}


x86 assembly (clang, -O0):
<dtheta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1040 <hypot@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1040 <hypot@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  0xe80(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1030 <acos@plt>
movsd  0xe5d(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    0x2e22(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe39(%rip),%xmm0
subsd  -0x30(%rbp),%xmm0
movaps 0xe1d(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dtheta>:
sub    $0x18,%rsp
movsd  %xmm3,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
movapd %xmm1,%xmm4
mulsd  %xmm3,%xmm4
movapd %xmm0,%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm4,%xmm3
movsd  %xmm3,(%rsp)
call   1040 <hypot@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1040 <hypot@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
mulsd  0xe82(%rip),%xmm1
movapd %xmm1,%xmm0
call   1030 <acos@plt>
mulsd  0xe79(%rip),%xmm0
mov    0x2e52(%rip),%rax
divsd  (%rax),%xmm0
addsd  0xe6e(%rip),%xmm0
andpd  0xe76(%rip),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @dtheta(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%12 = load double, double* %5
%13 = load double, double* %7
%14 = load double, double* %6
%15 = load double, double* %8
%16 = fmul double %14, %15
%17 = call double @llvm.fmuladd.f64(double %12, double %13, double %16)
%18 = load double, double* %5
%19 = load double, double* %6
%20 = call double @hypot(double %18, double %19)
%21 = fdiv double %17, %20
%22 = load double, double* %7
%23 = load double, double* %8
%24 = call double @hypot(double %22, double %23)
%25 = fdiv double %21, %24
%26 = fdiv double %25, 2.000000e+00
store double %26, double* %9
%27 = load double, double* %9
%28 = call double @acos(double %27)
%29 = fmul double %28, 1.800000e+02
%30 = load double, double* @M_PI
%31 = fdiv double %29, %30
store double %31, double* %10
%32 = load double, double* %10
%33 = fsub double 9.000000e+01, %32
%34 = call double @llvm.fabs.f64(double %33)
store double %34, double* %11
%35 = load double, double* %11
ret double %35
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @dtheta(double %0, double %1, double %2, double %3) {
%5 = fmul double %1, %3
%6 = tail call double @llvm.fmuladd.f64(double %0, double %2, double %5)
%7 = tail call double @hypot(double %0, double %1)
%8 = fdiv double %6, %7
%9 = tail call double @hypot(double %2, double %3)
%10 = fdiv double %8, %9
%11 = fmul double %10, 5.000000e-01
%12 = tail call double @acos(double %11)
%13 = fmul double %12, 1.800000e+02
%14 = load double, double* @M_PI
%15 = fdiv double %13, %14
%16 = fsub double 9.000000e+01, %15
%17 = tail call double @llvm.fabs.f64(double %16)
ret double %17
}