#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*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _MM_SHUFFLE(int, int, int /*<<< orphan*/,
                               int /*<<< orphan*/);
int /*<<< orphan*/ _mm_abs_epi32(int /*<<< orphan*/);
int /*<<< orphan*/ _mm_and_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_andnot_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_mul_epu32(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_or_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_setzero_si128();
int /*<<< orphan*/ _mm_shuffle_epi32(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_srai_epi32(int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_sub_epi64(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_xor_si128(int /*<<< orphan*/, int /*<<< orphan*/);
extern __attribute__((__gnu___, __always___, __artificial__)) __m128i
_MM_MUL_EPI32(__m128i a, __m128i b) {
  __m128i sign, zero, mul_us, a_neg, b_neg, mul_us_neg;
  sign = _mm_xor_si128(a, b);
  sign = _mm_srai_epi32(sign, 31);
  sign = _mm_shuffle_epi32(sign, _MM_SHUFFLE(2, 2, 0, 0));
  zero = _mm_setzero_si128();
  a_neg = _mm_abs_epi32(a);
  b_neg = _mm_abs_epi32(b);
  mul_us = _mm_mul_epu32(a_neg, b_neg);
  mul_us_neg = _mm_sub_epi64(zero, mul_us);
  mul_us_neg = _mm_and_si128(sign, mul_us_neg);
  mul_us = _mm_andnot_si128(sign, mul_us);
  return _mm_or_si128(mul_us, mul_us_neg);
}


x86 assembly (clang, -O0):
<_MM_MUL_EPI32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   10a0 <_mm_xor_si128@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x1f,%esi
call   1070 <_mm_srai_epi32@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    $0x2,%esi
xor    %ecx,%ecx
mov    %esi,%edi
mov    %ecx,%edx
call   1030 <_MM_SHUFFLE@plt>
mov    -0x24(%rbp),%edi
mov    %eax,%esi
call   1080 <_mm_shuffle_epi32@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1040 <_mm_setzero_si128@plt>
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <_mm_abs_epi32@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <_mm_abs_epi32@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   10c0 <_mm_mul_epu32@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1060 <_mm_sub_epi64@plt>
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x20(%rbp),%esi
call   10d0 <_mm_and_si128@plt>
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x14(%rbp),%esi
call   10b0 <_mm_andnot_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1090 <_mm_or_si128@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_MM_MUL_EPI32>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
call   10a0 <_mm_xor_si128@plt>
mov    %eax,%edi
mov    $0x1f,%esi
call   1070 <_mm_srai_epi32@plt>
mov    %eax,%ebx
mov    $0x2,%edi
mov    $0x2,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <_MM_SHUFFLE@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1080 <_mm_shuffle_epi32@plt>
mov    %eax,%r12d
xor    %eax,%eax
call   1040 <_mm_setzero_si128@plt>
mov    %eax,%r15d
mov    %ebp,%edi
call   1050 <_mm_abs_epi32@plt>
mov    %eax,%ebp
mov    %r14d,%edi
call   1050 <_mm_abs_epi32@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   10c0 <_mm_mul_epu32@plt>
mov    %eax,%ebp
mov    %r15d,%edi
mov    %eax,%esi
call   1060 <_mm_sub_epi64@plt>
mov    %r12d,%edi
mov    %eax,%esi
call   10d0 <_mm_and_si128@plt>
mov    %eax,%ebx
mov    %r12d,%edi
mov    %ebp,%esi
call   10b0 <_mm_andnot_si128@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <_mm_or_si128@plt>

LLVM IR (-O0):
define i32 @_MM_MUL_EPI32(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = call i32 @_mm_xor_si128(i32 %11, i32 %12)
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = call i32 @_mm_srai_epi32(i32 %14, i32 31)
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = call i32 @_MM_SHUFFLE(i32 2, i32 2, i32 0, i32 0)
%18 = call i32 @_mm_shuffle_epi32(i32 %16, i32 %17)
store i32 %18, i32* %5
%19 = call i32 (...) @_mm_setzero_si128()
store i32 %19, i32* %6
%20 = load i32, i32* %3
%21 = call i32 @_mm_abs_epi32(i32 %20)
store i32 %21, i32* %8
%22 = load i32, i32* %4
%23 = call i32 @_mm_abs_epi32(i32 %22)
store i32 %23, i32* %9
%24 = load i32, i32* %8
%25 = load i32, i32* %9
%26 = call i32 @_mm_mul_epu32(i32 %24, i32 %25)
store i32 %26, i32* %7
%27 = load i32, i32* %6
%28 = load i32, i32* %7
%29 = call i32 @_mm_sub_epi64(i32 %27, i32 %28)
store i32 %29, i32* %10
%30 = load i32, i32* %5
%31 = load i32, i32* %10
%32 = call i32 @_mm_and_si128(i32 %30, i32 %31)
store i32 %32, i32* %10
%33 = load i32, i32* %5
%34 = load i32, i32* %7
%35 = call i32 @_mm_andnot_si128(i32 %33, i32 %34)
store i32 %35, i32* %7
%36 = load i32, i32* %7
%37 = load i32, i32* %10
%38 = call i32 @_mm_or_si128(i32 %36, i32 %37)
ret i32 %38
}

LLVM IR (-O2):
define i32 @_MM_MUL_EPI32(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_xor_si128(i32 %0, i32 %1)
%4 = tail call i32 @_mm_srai_epi32(i32 %3, i32 31)
%5 = tail call i32 @_MM_SHUFFLE(i32 2, i32 2, i32 0, i32 0)
%6 = tail call i32 @_mm_shuffle_epi32(i32 %4, i32 %5)
%7 = tail call i32 (...) @_mm_setzero_si128()
%8 = tail call i32 @_mm_abs_epi32(i32 %0)
%9 = tail call i32 @_mm_abs_epi32(i32 %1)
%10 = tail call i32 @_mm_mul_epu32(i32 %8, i32 %9)
%11 = tail call i32 @_mm_sub_epi64(i32 %7, i32 %10)
%12 = tail call i32 @_mm_and_si128(i32 %6, i32 %11)
%13 = tail call i32 @_mm_andnot_si128(i32 %6, i32 %10)
%14 = tail call i32 @_mm_or_si128(i32 %13, i32 %12)
ret i32 %14
}