#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 */
scalar_t__ malloc(int);
float *vec3_cross(float a[3], float b[3]) {
  float *r;
  r = (float *)malloc(3 * sizeof(float));
  r[0] = a[1] * b[2] - a[2] * b[1];
  r[1] = a[2] * b[0] - a[0] * b[2];
  r[2] = a[0] * b[1] - a[1] * b[0];
  return r;
}


x86 assembly (clang, -O0):
<vec3_cross>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xc,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm2
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulss  0x4(%rax),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x10(%rbp),%rax
mulss  0x8(%rax),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm2
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulss  (%rax),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec3_cross>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0xc,%edi
call   1030 <malloc@plt>
movss  0x4(%rbx),%xmm0
movss  0x4(%r14),%xmm1
mulss  0x8(%rbx),%xmm1
mulss  0x8(%r14),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,(%rax)
movss  0x8(%rbx),%xmm0
movss  0x8(%r14),%xmm1
mulss  (%rbx),%xmm1
mulss  (%r14),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,0x4(%rax)
movss  (%rbx),%xmm0
movss  (%r14),%xmm1
mulss  0x4(%rbx),%xmm1
mulss  0x4(%r14),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,0x8(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define float* @vec3_cross(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%6 = call i64 @malloc(i32 12)
%7 = inttoptr i64 %6 to float*
store float* %7, float** %5
%8 = load float*, float** %3
%9 = getelementptr inbounds float, float* %8, i64 1
%10 = load float, float* %9
%11 = load float*, float** %4
%12 = getelementptr inbounds float, float* %11, i64 2
%13 = load float, float* %12
%14 = load float*, float** %3
%15 = getelementptr inbounds float, float* %14, i64 2
%16 = load float, float* %15
%17 = load float*, float** %4
%18 = getelementptr inbounds float, float* %17, i64 1
%19 = load float, float* %18
%20 = fmul float %16, %19
%21 = fneg float %20
%22 = call float @llvm.fmuladd.f32(float %10, float %13, float %21)
%23 = load float*, float** %5
%24 = getelementptr inbounds float, float* %23, i64 0
store float %22, float* %24
%25 = load float*, float** %3
%26 = getelementptr inbounds float, float* %25, i64 2
%27 = load float, float* %26
%28 = load float*, float** %4
%29 = getelementptr inbounds float, float* %28, i64 0
%30 = load float, float* %29
%31 = load float*, float** %3
%32 = getelementptr inbounds float, float* %31, i64 0
%33 = load float, float* %32
%34 = load float*, float** %4
%35 = getelementptr inbounds float, float* %34, i64 2
%36 = load float, float* %35
%37 = fmul float %33, %36
%38 = fneg float %37
%39 = call float @llvm.fmuladd.f32(float %27, float %30, float %38)
%40 = load float*, float** %5
%41 = getelementptr inbounds float, float* %40, i64 1
store float %39, float* %41
%42 = load float*, float** %3
%43 = getelementptr inbounds float, float* %42, i64 0
%44 = load float, float* %43
%45 = load float*, float** %4
%46 = getelementptr inbounds float, float* %45, i64 1
%47 = load float, float* %46
%48 = load float*, float** %3
%49 = getelementptr inbounds float, float* %48, i64 1
%50 = load float, float* %49
%51 = load float*, float** %4
%52 = getelementptr inbounds float, float* %51, i64 0
%53 = load float, float* %52
%54 = fmul float %50, %53
%55 = fneg float %54
%56 = call float @llvm.fmuladd.f32(float %44, float %47, float %55)
%57 = load float*, float** %5
%58 = getelementptr inbounds float, float* %57, i64 2
store float %56, float* %58
%59 = load float*, float** %5
ret float* %59
}

LLVM IR (-O2):
define float* @vec3_cross(float* nocapture %0, float* nocapture %1) {
%3 = tail call i64 @malloc(i32 12)
%4 = inttoptr i64 %3 to float*
%5 = getelementptr inbounds float, float* %0, i64 1
%6 = load float, float* %5
%7 = getelementptr inbounds float, float* %1, i64 2
%8 = load float, float* %7
%9 = getelementptr inbounds float, float* %0, i64 2
%10 = load float, float* %9
%11 = getelementptr inbounds float, float* %1, i64 1
%12 = load float, float* %11
%13 = fneg float %10
%14 = fmul float %12, %13
%15 = tail call float @llvm.fmuladd.f32(float %6, float %8, float %14)
store float %15, float* %4
%16 = load float, float* %9
%17 = load float, float* %1
%18 = load float, float* %0
%19 = load float, float* %7
%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* %4, i64 1
store float %22, float* %23
%24 = load float, float* %0
%25 = load float, float* %11
%26 = load float, float* %5
%27 = load float, float* %1
%28 = fneg float %26
%29 = fmul float %27, %28
%30 = tail call float @llvm.fmuladd.f32(float %24, float %25, float %29)
%31 = getelementptr inbounds float, float* %4, i64 2
store float %30, float* %31
ret float* %4
}