#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 */
typedef float GLfloat;
typedef float GLdouble;

/* Variables and functions */
int /*<<< orphan*/ glNormal3f(float, float, float);
float sqrt(float);
void normal3f(GLfloat x, GLfloat y, GLfloat z) {
  GLdouble mag;
  mag = sqrt(x * x + y * y + z * z);
  if (mag > 0.00001F) {
    x /= mag;
    y /= mag;
    z /= mag;
  }
  glNormal3f(x, y, z);
}


x86 assembly (clang, -O0):
<normal3f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x4(%rbp),%xmm2
movss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrt@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xe84(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11be <normal3f+0x9e>
movss  -0x10(%rbp),%xmm1
movss  -0x4(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x10(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x10(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
call   1040 <glNormal3f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normal3f>:
sub    $0x38,%rsp
movaps %xmm0,%xmm4
movaps %xmm1,%xmm0
mulss  %xmm1,%xmm0
movaps %xmm4,%xmm3
mulss  %xmm4,%xmm3
addss  %xmm0,%xmm3
movaps %xmm2,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm3,%xmm0
xorps  %xmm3,%xmm3
ucomiss %xmm3,%xmm0
jb     1152 <normal3f+0x32>
sqrtss %xmm0,%xmm0
jmp    1177 <normal3f+0x57>
movaps %xmm2,0x20(%rsp)
movss  %xmm1,0xc(%rsp)
movaps %xmm4,0x10(%rsp)
call   1030 <sqrt@plt>
movaps 0x10(%rsp),%xmm4
movss  0xc(%rsp),%xmm1
movaps 0x20(%rsp),%xmm2
ucomiss 0xe82(%rip),%xmm0
unpcklps %xmm4,%xmm2
jbe    118e <normal3f+0x6e>
divss  %xmm0,%xmm1
shufps $0x0,%xmm0,%xmm0
divps  %xmm0,%xmm2
movaps %xmm2,%xmm0
shufps $0x55,%xmm2,%xmm0
add    $0x38,%rsp
jmp    1040 <glNormal3f@plt>

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

LLVM IR (-O2):
define void @normal3f(float %0, float %1, float %2) {
%4 = fmul float %1, %1
%5 = tail call float @llvm.fmuladd.f32(float %0, float %0, float %4)
%6 = tail call float @llvm.fmuladd.f32(float %2, float %2, float %5)
%7 = tail call float @sqrt(float %6)
%8 = fcmp ogt float %7, 0x3EE4F8B580000000
%9 = insertelement <2 x float> poison, float %2, i64 0
%10 = insertelement <2 x float> %9, float %0, i64 1
br i1 %8, label %11, label %16
11: ; preds = %3
%12 = fdiv float %1, %7
%13 = insertelement <2 x float> poison, float %7, i64 0
%14 = shufflevector <2 x float> %13, <2 x float> poison, <2 x i32> zeroinitializer
%15 = fdiv <2 x float> %10, %14
br label %16
16: ; preds = %11, %3
%17 = phi float [ %12, %11 ], [ %1, %3 ]
%18 = phi <2 x float> [ %15, %11 ], [ %10, %3 ]
%19 = extractelement <2 x float> %18, i64 0
%20 = extractelement <2 x float> %18, i64 1
%21 = tail call i32 @glNormal3f(float %20, float %17, float %19)
ret void
}