#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);
float VectorProduct(float *Vector1, float *Vector2, float *Product) {
  int i, j, k;
  float ProductLength;
  ProductLength = 0.0;
  for (i = 0; i < 3; i++) {
    j = (i + 1) % 3;
    k = (j + 1) % 3;
    Product[i] = Vector1[j] * Vector2[k] - Vector1[k] * Vector2[j];
    ProductLength += Product[i] * Product[i];
  }
  return (sqrt(ProductLength));
}


x86 assembly (clang, -O0):
<VectorProduct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    11ef <VectorProduct+0xdf>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mulss  (%rax,%rcx,4),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm2
movss  -0x28(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1133 <VectorProduct+0x23>
movss  -0x28(%rbp),%xmm0
call   1030 <sqrt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VectorProduct>:
movss  0x4(%rdi),%xmm0
movss  0x4(%rsi),%xmm1
mulss  0x8(%rdi),%xmm1
mulss  0x8(%rsi),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,(%rdx)
mulss  %xmm0,%xmm0
xorps  %xmm1,%xmm1
addss  %xmm1,%xmm0
movss  0x8(%rdi),%xmm2
movss  0x8(%rsi),%xmm3
mulss  (%rdi),%xmm3
mulss  (%rsi),%xmm2
subss  %xmm3,%xmm2
movss  %xmm2,0x4(%rdx)
mulss  %xmm2,%xmm2
addss  %xmm0,%xmm2
movss  (%rdi),%xmm0
movss  (%rsi),%xmm3
mulss  0x4(%rdi),%xmm3
mulss  0x4(%rsi),%xmm0
subss  %xmm3,%xmm0
movss  %xmm0,0x8(%rdx)
mulss  %xmm0,%xmm0
addss  %xmm2,%xmm0
ucomiss %xmm1,%xmm0
jb     1187 <VectorProduct+0x77>
sqrtss %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define float @VectorProduct(float* %0, float* %1, float* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca float
store float* %0, float** %4
store float* %1, float** %5
store float* %2, float** %6
store float 0.000000e+00, float* %10
store i32 0, i32* %7
br label %11
11: ; preds = %60, %3
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 3
br i1 %13, label %14, label %63
14: ; preds = %11
%15 = load i32, i32* %7
%16 = add nsw i32 %15, 1
%17 = srem i32 %16, 3
store i32 %17, i32* %8
%18 = load i32, i32* %8
%19 = add nsw i32 %18, 1
%20 = srem i32 %19, 3
store i32 %20, i32* %9
%21 = load float*, float** %4
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds float, float* %21, i64 %23
%25 = load float, float* %24
%26 = load float*, float** %5
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds float, float* %26, i64 %28
%30 = load float, float* %29
%31 = load float*, float** %4
%32 = load i32, i32* %9
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds float, float* %31, i64 %33
%35 = load float, float* %34
%36 = load float*, float** %5
%37 = load i32, i32* %8
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds float, float* %36, i64 %38
%40 = load float, float* %39
%41 = fmul float %35, %40
%42 = fneg float %41
%43 = call float @llvm.fmuladd.f32(float %25, float %30, float %42)
%44 = load float*, float** %6
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds float, float* %44, i64 %46
store float %43, float* %47
%48 = load float*, float** %6
%49 = load i32, i32* %7
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds float, float* %48, i64 %50
%52 = load float, float* %51
%53 = load float*, float** %6
%54 = load i32, i32* %7
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds float, float* %53, i64 %55
%57 = load float, float* %56
%58 = load float, float* %10
%59 = call float @llvm.fmuladd.f32(float %52, float %57, float %58)
store float %59, float* %10
br label %60
60: ; preds = %14
%61 = load i32, i32* %7
%62 = add nsw i32 %61, 1
store i32 %62, i32* %7
br label %11
63: ; preds = %11
%64 = load float, float* %10
%65 = call float @sqrt(float %64)
ret float %65
}

LLVM IR (-O2):
define float @VectorProduct(float* nocapture %0, float* nocapture %1, float* nocapture writeonly %2) {
%4 = getelementptr inbounds float, float* %0, i64 1
%5 = load float, float* %4
%6 = getelementptr inbounds float, float* %1, i64 2
%7 = load float, float* %6
%8 = getelementptr inbounds float, float* %0, i64 2
%9 = load float, float* %8
%10 = getelementptr inbounds float, float* %1, i64 1
%11 = load float, float* %10
%12 = fneg float %9
%13 = fmul float %11, %12
%14 = tail call float @llvm.fmuladd.f32(float %5, float %7, float %13)
store float %14, float* %2
%15 = tail call float @llvm.fmuladd.f32(float %14, float %14, float 0.000000e+00)
%16 = load float, float* %8
%17 = load float, float* %1
%18 = load float, float* %0
%19 = load float, float* %6
%20 = fneg float %18
%21 = fmul float %19, %20
%22 = tail call float @llvm.fmuladd.f32(float %16, float %17, float %21)
%23 = getelementptr inbounds float, float* %2, i64 1
store float %22, float* %23
%24 = tail call float @llvm.fmuladd.f32(float %22, float %22, float %15)
%25 = load float, float* %0
%26 = load float, float* %10
%27 = load float, float* %4
%28 = load float, float* %1
%29 = fneg float %27
%30 = fmul float %28, %29
%31 = tail call float @llvm.fmuladd.f32(float %25, float %26, float %30)
%32 = getelementptr inbounds float, float* %2, i64 2
store float %31, float* %32
%33 = tail call float @llvm.fmuladd.f32(float %31, float %31, float %24)
%34 = tail call float @sqrt(float %33)
ret float %34
}