#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);
int s_unit2(float a[], float b[], float eps) {
  float size;
  size = sqrt(a[0] * a[0] + a[1] * a[1]);
  if (size < 2 * eps)
    return (1);
  b[0] = a[0] / size;
  b[1] = a[1] / size;
  return (0);
}


x86 assembly (clang, -O0):
<s_unit2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulss  0x4(%rax),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrt@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm1
movss  0xe9a(%rip),%xmm0
mulss  -0x1c(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1180 <s_unit2+0x70>
movl   $0x1,-0x4(%rbp)
jmp    11b3 <s_unit2+0xa3>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
divss  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
divss  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x4(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_unit2>:
push   %r14
push   %rbx
push   %rax
movaps %xmm0,%xmm2
mov    %rsi,%r14
mov    %rdi,%rbx
movss  (%rdi),%xmm0
movss  0x4(%rdi),%xmm1
mulss  %xmm1,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1140 <s_unit2+0x30>
sqrtss %xmm0,%xmm0
jmp    1151 <s_unit2+0x41>
movss  %xmm2,0x4(%rsp)
call   1030 <sqrt@plt>
movss  0x4(%rsp),%xmm2
addss  %xmm2,%xmm2
mov    $0x1,%eax
ucomiss %xmm0,%xmm2
ja     117d <s_unit2+0x6d>
movss  (%rbx),%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,(%r14)
movss  0x4(%rbx),%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,0x4(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @s_unit2(float* %0, float* %1, float %2) {
%4 = alloca i32
%5 = alloca float*
%6 = alloca float*
%7 = alloca float
%8 = alloca float
store float* %0, float** %5
store float* %1, float** %6
store float %2, float* %7
%9 = load float*, float** %5
%10 = getelementptr inbounds float, float* %9, i64 0
%11 = load float, float* %10
%12 = load float*, float** %5
%13 = getelementptr inbounds float, float* %12, i64 0
%14 = load float, float* %13
%15 = load float*, float** %5
%16 = getelementptr inbounds float, float* %15, i64 1
%17 = load float, float* %16
%18 = load float*, float** %5
%19 = getelementptr inbounds float, float* %18, i64 1
%20 = load float, float* %19
%21 = fmul float %17, %20
%22 = call float @llvm.fmuladd.f32(float %11, float %14, float %21)
%23 = call float @sqrt(float %22)
store float %23, float* %8
%24 = load float, float* %8
%25 = load float, float* %7
%26 = fmul float 2.000000e+00, %25
%27 = fcmp olt float %24, %26
br i1 %27, label %28, label %29
28: ; preds = %3
store i32 1, i32* %4
br label %44
29: ; preds = %3
%30 = load float*, float** %5
%31 = getelementptr inbounds float, float* %30, i64 0
%32 = load float, float* %31
%33 = load float, float* %8
%34 = fdiv float %32, %33
%35 = load float*, float** %6
%36 = getelementptr inbounds float, float* %35, i64 0
store float %34, float* %36
%37 = load float*, float** %5
%38 = getelementptr inbounds float, float* %37, i64 1
%39 = load float, float* %38
%40 = load float, float* %8
%41 = fdiv float %39, %40
%42 = load float*, float** %6
%43 = getelementptr inbounds float, float* %42, i64 1
store float %41, float* %43
store i32 0, i32* %4
br label %44
44: ; preds = %29, %28
%45 = load i32, i32* %4
ret i32 %45
}

LLVM IR (-O2):
define i32 @s_unit2(float* nocapture %0, float* nocapture writeonly %1, float %2) {
%4 = load float, float* %0
%5 = getelementptr inbounds float, float* %0, i64 1
%6 = load float, float* %5
%7 = fmul float %6, %6
%8 = tail call float @llvm.fmuladd.f32(float %4, float %4, float %7)
%9 = tail call float @sqrt(float %8)
%10 = fmul float %2, 2.000000e+00
%11 = fcmp olt float %9, %10
br i1 %11, label %18, label %12
12: ; preds = %3
%13 = load float, float* %0
%14 = fdiv float %13, %9
store float %14, float* %1
%15 = load float, float* %5
%16 = fdiv float %15, %9
%17 = getelementptr inbounds float, float* %1, i64 1
store float %16, float* %17
br label %18
18: ; preds = %3, %12
%19 = phi i32 [ 0, %12 ], [ 1, %3 ]
ret i32 %19
}