#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 acosf(float);
float nsvg__vecrat(float, float, float, float);
float nsvg__vecang(float ux, float uy, float vx, float vy) {
  float r = nsvg__vecrat(ux, uy, vx, vy);
  if (r < -1.0f)
    r = -1.0f;
  if (r > 1.0f)
    r = 1.0f;
  return ((ux * vy < uy * vx) ? -1.0f : 1.0f) * acosf(r);
}


x86 assembly (clang, -O0):
<nsvg__vecang>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  -0x10(%rbp),%xmm3
call   1040 <nsvg__vecrat@plt>
movss  %xmm0,-0x14(%rbp)
movss  0xe9e(%rip),%xmm0
ucomiss -0x14(%rbp),%xmm0
jbe    1179 <nsvg__vecang+0x59>
movss  0xe8c(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  0xe7e(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    119c <nsvg__vecang+0x7c>
movss  0xe6d(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
movss  0xe48(%rip),%xmm3
movss  0xe44(%rip),%xmm2
cmpltss %xmm1,%xmm0
movaps %xmm0,%xmm1
andps  %xmm3,%xmm1
andnps %xmm2,%xmm0
orps   %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <acosf@plt>
movaps %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
mulss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nsvg__vecang>:
sub    $0x28,%rsp
movss  %xmm3,0x8(%rsp)
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x4(%rsp)
movaps %xmm0,0x10(%rsp)
call   1040 <nsvg__vecrat@plt>
movss  0xeb8(%rip),%xmm1
maxss  %xmm0,%xmm1
movss  0xeb0(%rip),%xmm0
minss  %xmm1,%xmm0
movaps 0x10(%rsp),%xmm1
mulss  0x8(%rsp),%xmm1
movaps %xmm1,0x10(%rsp)
movss  0x4(%rsp),%xmm1
mulss  0xc(%rsp),%xmm1
movss  %xmm1,0x4(%rsp)
call   1030 <acosf@plt>
movaps 0xe8a(%rip),%xmm1
xorps  %xmm0,%xmm1
movaps 0x10(%rsp),%xmm3
cmpltss 0x4(%rsp),%xmm3
movaps %xmm3,%xmm2
andnps %xmm0,%xmm2
andps  %xmm1,%xmm3
orps   %xmm2,%xmm3
movaps %xmm3,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @nsvg__vecang(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%10 = load float, float* %5
%11 = load float, float* %6
%12 = load float, float* %7
%13 = load float, float* %8
%14 = call float @nsvg__vecrat(float %10, float %11, float %12, float %13)
store float %14, float* %9
%15 = load float, float* %9
%16 = fcmp olt float %15, -1.000000e+00
br i1 %16, label %17, label %18
17: ; preds = %4
store float -1.000000e+00, float* %9
br label %18
18: ; preds = %17, %4
%19 = load float, float* %9
%20 = fcmp ogt float %19, 1.000000e+00
br i1 %20, label %21, label %22
21: ; preds = %18
store float 1.000000e+00, float* %9
br label %22
22: ; preds = %21, %18
%23 = load float, float* %5
%24 = load float, float* %8
%25 = fmul float %23, %24
%26 = load float, float* %6
%27 = load float, float* %7
%28 = fmul float %26, %27
%29 = fcmp olt float %25, %28
%30 = zext i1 %29 to i64
%31 = select i1 %29, float -1.000000e+00, float 1.000000e+00
%32 = load float, float* %9
%33 = call float @acosf(float %32)
%34 = fmul float %31, %33
ret float %34
}

LLVM IR (-O2):
define float @nsvg__vecang(float %0, float %1, float %2, float %3) {
%5 = tail call float @nsvg__vecrat(float %0, float %1, float %2, float %3)
%6 = fcmp olt float %5, -1.000000e+00
%7 = select i1 %6, float -1.000000e+00, float %5
%8 = fcmp ogt float %7, 1.000000e+00
%9 = select i1 %8, float 1.000000e+00, float %7
%10 = fmul float %0, %3
%11 = fmul float %1, %2
%12 = fcmp olt float %10, %11
%13 = tail call float @acosf(float %9)
%14 = fneg float %13
%15 = select i1 %12, float %14, float %13
ret float %15
}