#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 int /*<<< orphan*/ __m128;

/* Variables and functions */
int /*<<< orphan*/ _MM_SHUFFLE(int, int, int, int);
int /*<<< orphan*/ _mm_mul_ps(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_shuffle_ps(int /*<<< orphan*/ const,
                                  int /*<<< orphan*/ const, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_sub_ps(int /*<<< orphan*/, int /*<<< orphan*/);
__m128 cross(const __m128 a, const __m128 b) {
  return _mm_sub_ps(_mm_mul_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)),
                               _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 1, 0, 2))),
                    _mm_mul_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)),
                               _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 0, 2, 1))));
}


x86 assembly (clang, -O0):
<cross>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    $0x3,%edi
xor    %esi,%esi
mov    $0x2,%edx
mov    $0x1,%ecx
call   1030 <_MM_SHUFFLE@plt>
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    %eax,%edx
call   1040 <_mm_shuffle_ps@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    $0x3,%edi
mov    $0x1,%esi
xor    %edx,%edx
mov    $0x2,%ecx
call   1030 <_MM_SHUFFLE@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    %eax,%edx
call   1040 <_mm_shuffle_ps@plt>
mov    -0x24(%rbp),%edi
mov    %eax,%esi
call   1050 <_mm_mul_ps@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    $0x3,%edi
mov    $0x1,%esi
xor    %edx,%edx
mov    $0x2,%ecx
call   1030 <_MM_SHUFFLE@plt>
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
call   1040 <_mm_shuffle_ps@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x3,%edi
xor    %esi,%esi
mov    $0x2,%edx
mov    $0x1,%ecx
call   1030 <_MM_SHUFFLE@plt>
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    %eax,%edx
call   1040 <_mm_shuffle_ps@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%esi
call   1050 <_mm_mul_ps@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
call   1060 <_mm_sub_ps@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cross>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x3,%edi
xor    %esi,%esi
mov    $0x2,%edx
mov    $0x1,%ecx
call   1030 <_MM_SHUFFLE@plt>
mov    %ebp,%edi
mov    %ebp,%esi
mov    %eax,%edx
call   1040 <_mm_shuffle_ps@plt>
mov    %eax,%r14d
mov    $0x3,%edi
mov    $0x1,%esi
xor    %edx,%edx
mov    $0x2,%ecx
call   1030 <_MM_SHUFFLE@plt>
mov    %ebx,%edi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <_mm_shuffle_ps@plt>
mov    %r14d,%edi
mov    %eax,%esi
call   1050 <_mm_mul_ps@plt>
mov    %eax,%r14d
mov    $0x3,%edi
mov    $0x1,%esi
xor    %edx,%edx
mov    $0x2,%ecx
call   1030 <_MM_SHUFFLE@plt>
mov    %ebp,%edi
mov    %ebp,%esi
mov    %eax,%edx
call   1040 <_mm_shuffle_ps@plt>
mov    %eax,%ebp
mov    $0x3,%edi
xor    %esi,%esi
mov    $0x2,%edx
mov    $0x1,%ecx
call   1030 <_MM_SHUFFLE@plt>
mov    %ebx,%edi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <_mm_shuffle_ps@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1050 <_mm_mul_ps@plt>
mov    %r14d,%edi
mov    %eax,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <_mm_sub_ps@plt>

LLVM IR (-O0):
define i32 @cross(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @_MM_SHUFFLE(i32 3, i32 0, i32 2, i32 1)
%8 = call i32 @_mm_shuffle_ps(i32 %5, i32 %6, i32 %7)
%9 = load i32, i32* %4
%10 = load i32, i32* %4
%11 = call i32 @_MM_SHUFFLE(i32 3, i32 1, i32 0, i32 2)
%12 = call i32 @_mm_shuffle_ps(i32 %9, i32 %10, i32 %11)
%13 = call i32 @_mm_mul_ps(i32 %8, i32 %12)
%14 = load i32, i32* %3
%15 = load i32, i32* %3
%16 = call i32 @_MM_SHUFFLE(i32 3, i32 1, i32 0, i32 2)
%17 = call i32 @_mm_shuffle_ps(i32 %14, i32 %15, i32 %16)
%18 = load i32, i32* %4
%19 = load i32, i32* %4
%20 = call i32 @_MM_SHUFFLE(i32 3, i32 0, i32 2, i32 1)
%21 = call i32 @_mm_shuffle_ps(i32 %18, i32 %19, i32 %20)
%22 = call i32 @_mm_mul_ps(i32 %17, i32 %21)
%23 = call i32 @_mm_sub_ps(i32 %13, i32 %22)
ret i32 %23
}

LLVM IR (-O2):
define i32 @cross(i32 %0, i32 %1) {
%3 = tail call i32 @_MM_SHUFFLE(i32 3, i32 0, i32 2, i32 1)
%4 = tail call i32 @_mm_shuffle_ps(i32 %0, i32 %0, i32 %3)
%5 = tail call i32 @_MM_SHUFFLE(i32 3, i32 1, i32 0, i32 2)
%6 = tail call i32 @_mm_shuffle_ps(i32 %1, i32 %1, i32 %5)
%7 = tail call i32 @_mm_mul_ps(i32 %4, i32 %6)
%8 = tail call i32 @_MM_SHUFFLE(i32 3, i32 1, i32 0, i32 2)
%9 = tail call i32 @_mm_shuffle_ps(i32 %0, i32 %0, i32 %8)
%10 = tail call i32 @_MM_SHUFFLE(i32 3, i32 0, i32 2, i32 1)
%11 = tail call i32 @_mm_shuffle_ps(i32 %1, i32 %1, i32 %10)
%12 = tail call i32 @_mm_mul_ps(i32 %9, i32 %11)
%13 = tail call i32 @_mm_sub_ps(i32 %7, i32 %12)
ret i32 %13
}