#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 sqrtf(float);
float nsvg__normalize(float *x, float *y) {
  float d = sqrtf((*x) * (*x) + (*y) * (*y));
  if (d > 1e-6f) {
    float id = 1.0f / d;
    *x *= id;
    *y *= id;
  }
  return d;
}


x86 assembly (clang, -O0):
<nsvg__normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x10(%rbp),%rax
mulss  (%rax),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrtf@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  0xea1(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    119c <nsvg__normalize+0x8c>
movss  0xe94(%rip),%xmm0
divss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mulss  (%rax),%xmm0
movss  %xmm0,(%rax)
movss  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulss  (%rax),%xmm0
movss  %xmm0,(%rax)
movss  -0x14(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nsvg__normalize>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
mulss  %xmm1,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1145 <nsvg__normalize+0x35>
sqrtss %xmm0,%xmm0
ucomiss 0xebf(%rip),%xmm0
ja     1153 <nsvg__normalize+0x43>
jmp    1175 <nsvg__normalize+0x65>
call   1030 <sqrtf@plt>
ucomiss 0xeaf(%rip),%xmm0
jbe    1175 <nsvg__normalize+0x65>
movss  0xea9(%rip),%xmm1
divss  %xmm0,%xmm1
movss  (%rbx),%xmm2
mulss  %xmm1,%xmm2
movss  %xmm2,(%rbx)
mulss  (%r14),%xmm1
movss  %xmm1,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define float @nsvg__normalize(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca float
%6 = alloca float
store float* %0, float** %3
store float* %1, float** %4
%7 = load float*, float** %3
%8 = load float, float* %7
%9 = load float*, float** %3
%10 = load float, float* %9
%11 = load float*, float** %4
%12 = load float, float* %11
%13 = load float*, float** %4
%14 = load float, float* %13
%15 = fmul float %12, %14
%16 = call float @llvm.fmuladd.f32(float %8, float %10, float %15)
%17 = call float @sqrtf(float %16)
store float %17, float* %5
%18 = load float, float* %5
%19 = fcmp ogt float %18, 0x3EB0C6F7A0000000
br i1 %19, label %20, label %31
20: ; preds = %2
%21 = load float, float* %5
%22 = fdiv float 1.000000e+00, %21
store float %22, float* %6
%23 = load float, float* %6
%24 = load float*, float** %3
%25 = load float, float* %24
%26 = fmul float %25, %23
store float %26, float* %24
%27 = load float, float* %6
%28 = load float*, float** %4
%29 = load float, float* %28
%30 = fmul float %29, %27
store float %30, float* %28
br label %31
31: ; preds = %20, %2
%32 = load float, float* %5
ret float %32
}

LLVM IR (-O2):
define float @nsvg__normalize(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
%5 = fmul float %4, %4
%6 = tail call float @llvm.fmuladd.f32(float %3, float %3, float %5)
%7 = tail call float @sqrtf(float %6)
%8 = fcmp ogt float %7, 0x3EB0C6F7A0000000
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = fdiv float 1.000000e+00, %7
%11 = load float, float* %0
%12 = fmul float %10, %11
store float %12, float* %0
%13 = load float, float* %1
%14 = fmul float %10, %13
store float %14, float* %1
br label %15
15: ; preds = %9, %2
ret float %7
}