#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_and_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_andnot_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_cmpeq_epi16(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_cmpgt_epi16(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_or_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_slli_epi16(int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_sub_epi16(int /*<<< orphan*/, int /*<<< orphan*/);
extern __attribute__((__gnu___, __always___, __artificial__)) __m128i
_MM_MIN_EPU16(__m128i a, __m128i b) {
  __m128i c8000, b_s, a_s, cmp;
  c8000 = _mm_cmpeq_epi16(a, a);
  c8000 = _mm_slli_epi16(c8000, 15);
  b_s = _mm_sub_epi16(b, c8000);
  a_s = _mm_sub_epi16(a, c8000);
  cmp = _mm_cmpgt_epi16(b_s, a_s);
  a_s = _mm_and_si128(cmp, a);
  b_s = _mm_andnot_si128(cmp, b);
  return _mm_or_si128(a_s, b_s);
}


x86 assembly (clang, -O0):
<_MM_MIN_EPU16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1050 <_mm_cmpeq_epi16@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0xf,%esi
call   1090 <_mm_slli_epi16@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <_mm_sub_epi16@plt>
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <_mm_sub_epi16@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <_mm_cmpgt_epi16@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1080 <_mm_and_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <_mm_andnot_si128@plt>
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1060 <_mm_or_si128@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_MM_MIN_EPU16>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %edi,%ebp
mov    %edi,%esi
call   1050 <_mm_cmpeq_epi16@plt>
mov    %eax,%edi
mov    $0xf,%esi
call   1090 <_mm_slli_epi16@plt>
mov    %eax,%ebx
mov    %r14d,%edi
mov    %eax,%esi
call   1030 <_mm_sub_epi16@plt>
mov    %eax,%r15d
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <_mm_sub_epi16@plt>
mov    %r15d,%edi
mov    %eax,%esi
call   1040 <_mm_cmpgt_epi16@plt>
mov    %eax,%ebx
mov    %eax,%edi
mov    %ebp,%esi
call   1080 <_mm_and_si128@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %r14d,%esi
call   1070 <_mm_andnot_si128@plt>
mov    %ebp,%edi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <_mm_or_si128@plt>

LLVM IR (-O0):
define i32 @_MM_MIN_EPU16(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%9 = load i32, i32* %3
%10 = load i32, i32* %3
%11 = call i32 @_mm_cmpeq_epi16(i32 %9, i32 %10)
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = call i32 @_mm_slli_epi16(i32 %12, i32 15)
store i32 %13, i32* %5
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = call i32 @_mm_sub_epi16(i32 %14, i32 %15)
store i32 %16, i32* %6
%17 = load i32, i32* %3
%18 = load i32, i32* %5
%19 = call i32 @_mm_sub_epi16(i32 %17, i32 %18)
store i32 %19, i32* %7
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = call i32 @_mm_cmpgt_epi16(i32 %20, i32 %21)
store i32 %22, i32* %8
%23 = load i32, i32* %8
%24 = load i32, i32* %3
%25 = call i32 @_mm_and_si128(i32 %23, i32 %24)
store i32 %25, i32* %7
%26 = load i32, i32* %8
%27 = load i32, i32* %4
%28 = call i32 @_mm_andnot_si128(i32 %26, i32 %27)
store i32 %28, i32* %6
%29 = load i32, i32* %7
%30 = load i32, i32* %6
%31 = call i32 @_mm_or_si128(i32 %29, i32 %30)
ret i32 %31
}

LLVM IR (-O2):
define i32 @_MM_MIN_EPU16(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_cmpeq_epi16(i32 %0, i32 %0)
%4 = tail call i32 @_mm_slli_epi16(i32 %3, i32 15)
%5 = tail call i32 @_mm_sub_epi16(i32 %1, i32 %4)
%6 = tail call i32 @_mm_sub_epi16(i32 %0, i32 %4)
%7 = tail call i32 @_mm_cmpgt_epi16(i32 %5, i32 %6)
%8 = tail call i32 @_mm_and_si128(i32 %7, i32 %0)
%9 = tail call i32 @_mm_andnot_si128(i32 %7, i32 %1)
%10 = tail call i32 @_mm_or_si128(i32 %8, i32 %9)
ret i32 %10
}