#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 sqrt(float);
void normalizeInPlace(float *x, float *y) {
  float a = *x;
  float b = *y;
  float li = sqrt(a * a + b * b);
  if (li == 0.0f) {
    return;
  }
  li = 1.0f / li;
  *x *= li;
  *y *= li;
}


x86 assembly (clang, -O0):
<normalizeInPlace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x14(%rbp),%xmm2
movss  -0x18(%rbp),%xmm1
mulss  -0x18(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrt@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    117c <normalizeInPlace+0x6c>
jp     117c <normalizeInPlace+0x6c>
jmp    11b0 <normalizeInPlace+0xa0>
movss  0xe7c(%rip),%xmm0
divss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mulss  (%rax),%xmm0
movss  %xmm0,(%rax)
movss  -0x1c(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mulss  (%rax),%xmm0
movss  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normalizeInPlace>:
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     113c <normalizeInPlace+0x2c>
sqrtss %xmm0,%xmm0
jmp    1144 <normalizeInPlace+0x34>
call   1030 <sqrt@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    114b <normalizeInPlace+0x3b>
jnp    116d <normalizeInPlace+0x5d>
movss  0xead(%rip),%xmm1
divss  %xmm0,%xmm1
movss  (%rbx),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,(%rbx)
mulss  (%r14),%xmm1
movss  %xmm1,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @normalizeInPlace(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 @sqrt(float %6)
%8 = fcmp oeq float %7, 0.000000e+00
br i1 %8, label %15, label %9
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 = %2, %9
ret void
}