#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 */
int /*<<< orphan*/ glNormal3f(float, float, float);
float hypot(float, float);
void V3DHFNormalByCrossGridVectors(float v1i, float v1k, float v2j, float v2k) {
  float r[3];
  float m;
  r[0] = (float)(-v1k * v2j);
  r[1] = (float)(-v1i * v2k);
  r[2] = (float)(v1i * v2j);
  m = (float)hypot(hypot(r[0], r[1]), r[2]);
  if (m > 0.0)
    glNormal3f((r[0] / m), (r[2] / m), (-r[1] / m));
}


x86 assembly (clang, -O0):
<V3DHFNormalByCrossGridVectors>:
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  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
call   1030 <hypot@plt>
movss  -0x14(%rbp),%xmm1
call   1030 <hypot@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11e7 <V3DHFNormalByCrossGridVectors+0xc7>
movss  -0x1c(%rbp),%xmm0
divss  -0x20(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
divss  -0x20(%rbp),%xmm1
movss  -0x18(%rbp),%xmm2
movd   %xmm2,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
divss  -0x20(%rbp),%xmm2
call   1040 <glNormal3f@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<V3DHFNormalByCrossGridVectors>:
sub    $0x38,%rsp
movaps %xmm1,%xmm4
movaps 0xed2(%rip),%xmm1
xorps  %xmm1,%xmm4
mulss  %xmm2,%xmm4
xorps  %xmm0,%xmm1
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm4,0x20(%rsp)
movaps %xmm4,%xmm0
movaps %xmm1,0x10(%rsp)
call   1030 <hypot@plt>
movaps (%rsp),%xmm1
call   1030 <hypot@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1194 <V3DHFNormalByCrossGridVectors+0x74>
movaps 0x20(%rsp),%xmm3
divss  %xmm0,%xmm3
movaps (%rsp),%xmm1
divss  %xmm0,%xmm1
movaps 0x10(%rsp),%xmm2
xorps  0xe7c(%rip),%xmm2
divss  %xmm0,%xmm2
movaps %xmm3,%xmm0
add    $0x38,%rsp
jmp    1040 <glNormal3f@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
define void @V3DHFNormalByCrossGridVectors(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca [3 x float]
%10 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%11 = load float, float* %6
%12 = fneg float %11
%13 = load float, float* %7
%14 = fmul float %12, %13
%15 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
store float %14, float* %15
%16 = load float, float* %5
%17 = fneg float %16
%18 = load float, float* %8
%19 = fmul float %17, %18
%20 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 1
store float %19, float* %20
%21 = load float, float* %5
%22 = load float, float* %7
%23 = fmul float %21, %22
%24 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 2
store float %23, float* %24
%25 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
%26 = load float, float* %25
%27 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 1
%28 = load float, float* %27
%29 = call float @hypot(float %26, float %28)
%30 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 2
%31 = load float, float* %30
%32 = call float @hypot(float %29, float %31)
store float %32, float* %10
%33 = load float, float* %10
%34 = fpext float %33 to double
%35 = fcmp ogt double %34, 0.000000e+00
br i1 %35, label %36, label %51
36: ; preds = %4
%37 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
%38 = load float, float* %37
%39 = load float, float* %10
%40 = fdiv float %38, %39
%41 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 2
%42 = load float, float* %41
%43 = load float, float* %10
%44 = fdiv float %42, %43
%45 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 1
%46 = load float, float* %45
%47 = fneg float %46
%48 = load float, float* %10
%49 = fdiv float %47, %48
%50 = call i32 @glNormal3f(float %40, float %44, float %49)
br label %51
51: ; preds = %36, %4
ret void
}

LLVM IR (-O2):
define void @V3DHFNormalByCrossGridVectors(float %0, float %1, float %2, float %3) {
%5 = fneg float %1
%6 = fmul float %5, %2
%7 = fneg float %0
%8 = fmul float %7, %3
%9 = fmul float %0, %2
%10 = tail call float @hypot(float %6, float %8)
%11 = tail call float @hypot(float %10, float %9)
%12 = fcmp ogt float %11, 0.000000e+00
br i1 %12, label %13, label %19
13: ; preds = %4
%14 = fdiv float %6, %11
%15 = fdiv float %9, %11
%16 = fneg float %8
%17 = fdiv float %16, %11
%18 = tail call i32 @glNormal3f(float %14, float %15, float %17)
br label %19
19: ; preds = %13, %4
ret void
}