#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_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_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);
  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    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1080 <_mm_xor_si128@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x1f,%esi
call   1060 <_mm_srai_epi32@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <_mm_setzero_si128@plt>
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <_mm_abs_epi32@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <_mm_abs_epi32@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   10a0 <_mm_mul_epu32@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1050 <_mm_sub_epi64@plt>
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x20(%rbp),%esi
call   10b0 <_mm_and_si128@plt>
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1090 <_mm_andnot_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1070 <_mm_or_si128@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_MM_MUL_EPI32>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
call   1080 <_mm_xor_si128@plt>
mov    %eax,%edi
mov    $0x1f,%esi
call   1060 <_mm_srai_epi32@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1030 <_mm_setzero_si128@plt>
mov    %eax,%r15d
mov    %ebx,%edi
call   1040 <_mm_abs_epi32@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   1040 <_mm_abs_epi32@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   10a0 <_mm_mul_epu32@plt>
mov    %eax,%ebx
mov    %r15d,%edi
mov    %eax,%esi
call   1050 <_mm_sub_epi64@plt>
mov    %r14d,%edi
mov    %eax,%esi
call   10b0 <_mm_and_si128@plt>
mov    %eax,%ebp
mov    %r14d,%edi
mov    %ebx,%esi
call   1090 <_mm_andnot_si128@plt>
mov    %eax,%edi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <_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 = call i32 (...) @_mm_setzero_si128()
store i32 %16, i32* %6
%17 = load i32, i32* %3
%18 = call i32 @_mm_abs_epi32(i32 %17)
store i32 %18, i32* %8
%19 = load i32, i32* %4
%20 = call i32 @_mm_abs_epi32(i32 %19)
store i32 %20, i32* %9
%21 = load i32, i32* %8
%22 = load i32, i32* %9
%23 = call i32 @_mm_mul_epu32(i32 %21, i32 %22)
store i32 %23, i32* %7
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = call i32 @_mm_sub_epi64(i32 %24, i32 %25)
store i32 %26, i32* %10
%27 = load i32, i32* %5
%28 = load i32, i32* %10
%29 = call i32 @_mm_and_si128(i32 %27, i32 %28)
store i32 %29, i32* %10
%30 = load i32, i32* %5
%31 = load i32, i32* %7
%32 = call i32 @_mm_andnot_si128(i32 %30, i32 %31)
store i32 %32, i32* %7
%33 = load i32, i32* %7
%34 = load i32, i32* %10
%35 = call i32 @_mm_or_si128(i32 %33, i32 %34)
ret i32 %35
}

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_setzero_si128()
%6 = tail call i32 @_mm_abs_epi32(i32 %0)
%7 = tail call i32 @_mm_abs_epi32(i32 %1)
%8 = tail call i32 @_mm_mul_epu32(i32 %6, i32 %7)
%9 = tail call i32 @_mm_sub_epi64(i32 %5, i32 %8)
%10 = tail call i32 @_mm_and_si128(i32 %4, i32 %9)
%11 = tail call i32 @_mm_andnot_si128(i32 %4, i32 %8)
%12 = tail call i32 @_mm_or_si128(i32 %11, i32 %10)
ret i32 %12
}