#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_max_ps(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_min_ps(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_shuffle_ps(int /*<<< orphan*/, int /*<<< orphan*/,
                                  int /*<<< orphan*/);
int /*<<< orphan*/ _mm_unpackhi_ps(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_unpacklo_ps(int /*<<< orphan*/, int /*<<< orphan*/);
void sse_bitonic_merge_4(__m128 a, __m128 b, __m128 *res_lo, __m128 *res_hi) {
  b = _mm_shuffle_ps(b, b, _MM_SHUFFLE(0, 1, 2, 3));
  __m128 l1 = _mm_min_ps(a, b);
  __m128 h1 = _mm_max_ps(a, b);
  __m128 l1p = _mm_shuffle_ps(l1, h1, _MM_SHUFFLE(1, 0, 1, 0));
  __m128 h1p = _mm_shuffle_ps(l1, h1, _MM_SHUFFLE(3, 2, 3, 2));
  __m128 l2 = _mm_min_ps(l1p, h1p);
  __m128 h2 = _mm_max_ps(l1p, h1p);
  __m128 l2u = _mm_unpacklo_ps(l2, h2);
  __m128 h2u = _mm_unpackhi_ps(l2, h2);
  __m128 l2p = _mm_shuffle_ps(l2u, h2u, _MM_SHUFFLE(1, 0, 1, 0));
  __m128 h2p = _mm_shuffle_ps(l2u, h2u, _MM_SHUFFLE(3, 2, 3, 2));
  __m128 l3 = _mm_min_ps(l2p, h2p);
  __m128 h3 = _mm_max_ps(l2p, h2p);
  *res_lo = _mm_unpacklo_ps(l3, h3);
  *res_hi = _mm_unpackhi_ps(l3, h3);
}


x86 assembly (clang, -O0):
<sse_bitonic_merge_4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x6c(%rbp)
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
call   1040 <_MM_SHUFFLE@plt>
mov    -0x70(%rbp),%edi
mov    -0x6c(%rbp),%esi
mov    %eax,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1060 <_mm_min_ps@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <_mm_max_ps@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    $0x1,%edx
xor    %ecx,%ecx
mov    %edx,%edi
mov    %ecx,%esi
call   1040 <_MM_SHUFFLE@plt>
mov    -0x68(%rbp),%edi
mov    -0x64(%rbp),%esi
mov    %eax,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    $0x3,%edx
mov    $0x2,%ecx
mov    %edx,%edi
mov    %ecx,%esi
call   1040 <_MM_SHUFFLE@plt>
mov    -0x60(%rbp),%edi
mov    -0x5c(%rbp),%esi
mov    %eax,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
call   1060 <_mm_min_ps@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
call   1070 <_mm_max_ps@plt>
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x30(%rbp),%esi
call   1080 <_mm_unpacklo_ps@plt>
mov    %eax,-0x34(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x30(%rbp),%esi
call   1030 <_mm_unpackhi_ps@plt>
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    $0x1,%edx
xor    %ecx,%ecx
mov    %edx,%edi
mov    %ecx,%esi
call   1040 <_MM_SHUFFLE@plt>
mov    -0x58(%rbp),%edi
mov    -0x54(%rbp),%esi
mov    %eax,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    $0x3,%edx
mov    $0x2,%ecx
mov    %edx,%edi
mov    %ecx,%esi
call   1040 <_MM_SHUFFLE@plt>
mov    -0x50(%rbp),%edi
mov    -0x4c(%rbp),%esi
mov    %eax,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x40(%rbp),%esi
call   1060 <_mm_min_ps@plt>
mov    %eax,-0x44(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x40(%rbp),%esi
call   1070 <_mm_max_ps@plt>
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1080 <_mm_unpacklo_ps@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1030 <_mm_unpackhi_ps@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sse_bitonic_merge_4>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
call   1040 <_MM_SHUFFLE@plt>
mov    %ebp,%edi
mov    %ebp,%esi
mov    %eax,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %eax,%esi
call   1060 <_mm_min_ps@plt>
mov    %eax,%r12d
mov    %ebx,%edi
mov    %ebp,%esi
call   1070 <_mm_max_ps@plt>
mov    %eax,%ebx
mov    $0x1,%edi
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1040 <_MM_SHUFFLE@plt>
mov    %r12d,%edi
mov    %ebx,%esi
mov    %eax,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    %eax,%r13d
mov    $0x3,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x2,%ecx
call   1040 <_MM_SHUFFLE@plt>
mov    %r12d,%edi
mov    %ebx,%esi
mov    %eax,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    %eax,%ebx
mov    %r13d,%edi
mov    %eax,%esi
call   1060 <_mm_min_ps@plt>
mov    %eax,%ebp
mov    %r13d,%edi
mov    %ebx,%esi
call   1070 <_mm_max_ps@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
call   1080 <_mm_unpacklo_ps@plt>
mov    %eax,%r12d
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <_mm_unpackhi_ps@plt>
mov    %eax,%ebx
mov    $0x1,%edi
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1040 <_MM_SHUFFLE@plt>
mov    %r12d,%edi
mov    %ebx,%esi
mov    %eax,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    %eax,%r13d
mov    $0x3,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x2,%ecx
call   1040 <_MM_SHUFFLE@plt>
mov    %r12d,%edi
mov    %ebx,%esi
mov    %eax,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    %eax,%ebx
mov    %r13d,%edi
mov    %eax,%esi
call   1060 <_mm_min_ps@plt>
mov    %eax,%ebp
mov    %r13d,%edi
mov    %ebx,%esi
call   1070 <_mm_max_ps@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
call   1080 <_mm_unpacklo_ps@plt>
mov    %eax,(%r15)
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <_mm_unpackhi_ps@plt>
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @sse_bitonic_merge_4(i32 %0, i32 %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%21 = load i32, i32* %6
%22 = load i32, i32* %6
%23 = call i32 @_MM_SHUFFLE(i32 0, i32 1, i32 2, i32 3)
%24 = call i32 @_mm_shuffle_ps(i32 %21, i32 %22, i32 %23)
store i32 %24, i32* %6
%25 = load i32, i32* %5
%26 = load i32, i32* %6
%27 = call i32 @_mm_min_ps(i32 %25, i32 %26)
store i32 %27, i32* %9
%28 = load i32, i32* %5
%29 = load i32, i32* %6
%30 = call i32 @_mm_max_ps(i32 %28, i32 %29)
store i32 %30, i32* %10
%31 = load i32, i32* %9
%32 = load i32, i32* %10
%33 = call i32 @_MM_SHUFFLE(i32 1, i32 0, i32 1, i32 0)
%34 = call i32 @_mm_shuffle_ps(i32 %31, i32 %32, i32 %33)
store i32 %34, i32* %11
%35 = load i32, i32* %9
%36 = load i32, i32* %10
%37 = call i32 @_MM_SHUFFLE(i32 3, i32 2, i32 3, i32 2)
%38 = call i32 @_mm_shuffle_ps(i32 %35, i32 %36, i32 %37)
store i32 %38, i32* %12
%39 = load i32, i32* %11
%40 = load i32, i32* %12
%41 = call i32 @_mm_min_ps(i32 %39, i32 %40)
store i32 %41, i32* %13
%42 = load i32, i32* %11
%43 = load i32, i32* %12
%44 = call i32 @_mm_max_ps(i32 %42, i32 %43)
store i32 %44, i32* %14
%45 = load i32, i32* %13
%46 = load i32, i32* %14
%47 = call i32 @_mm_unpacklo_ps(i32 %45, i32 %46)
store i32 %47, i32* %15
%48 = load i32, i32* %13
%49 = load i32, i32* %14
%50 = call i32 @_mm_unpackhi_ps(i32 %48, i32 %49)
store i32 %50, i32* %16
%51 = load i32, i32* %15
%52 = load i32, i32* %16
%53 = call i32 @_MM_SHUFFLE(i32 1, i32 0, i32 1, i32 0)
%54 = call i32 @_mm_shuffle_ps(i32 %51, i32 %52, i32 %53)
store i32 %54, i32* %17
%55 = load i32, i32* %15
%56 = load i32, i32* %16
%57 = call i32 @_MM_SHUFFLE(i32 3, i32 2, i32 3, i32 2)
%58 = call i32 @_mm_shuffle_ps(i32 %55, i32 %56, i32 %57)
store i32 %58, i32* %18
%59 = load i32, i32* %17
%60 = load i32, i32* %18
%61 = call i32 @_mm_min_ps(i32 %59, i32 %60)
store i32 %61, i32* %19
%62 = load i32, i32* %17
%63 = load i32, i32* %18
%64 = call i32 @_mm_max_ps(i32 %62, i32 %63)
store i32 %64, i32* %20
%65 = load i32, i32* %19
%66 = load i32, i32* %20
%67 = call i32 @_mm_unpacklo_ps(i32 %65, i32 %66)
%68 = load i32*, i32** %7
store i32 %67, i32* %68
%69 = load i32, i32* %19
%70 = load i32, i32* %20
%71 = call i32 @_mm_unpackhi_ps(i32 %69, i32 %70)
%72 = load i32*, i32** %8
store i32 %71, i32* %72
ret void
}

LLVM IR (-O2):
define void @sse_bitonic_merge_4(i32 %0, i32 %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = tail call i32 @_MM_SHUFFLE(i32 0, i32 1, i32 2, i32 3)
%6 = tail call i32 @_mm_shuffle_ps(i32 %1, i32 %1, i32 %5)
%7 = tail call i32 @_mm_min_ps(i32 %0, i32 %6)
%8 = tail call i32 @_mm_max_ps(i32 %0, i32 %6)
%9 = tail call i32 @_MM_SHUFFLE(i32 1, i32 0, i32 1, i32 0)
%10 = tail call i32 @_mm_shuffle_ps(i32 %7, i32 %8, i32 %9)
%11 = tail call i32 @_MM_SHUFFLE(i32 3, i32 2, i32 3, i32 2)
%12 = tail call i32 @_mm_shuffle_ps(i32 %7, i32 %8, i32 %11)
%13 = tail call i32 @_mm_min_ps(i32 %10, i32 %12)
%14 = tail call i32 @_mm_max_ps(i32 %10, i32 %12)
%15 = tail call i32 @_mm_unpacklo_ps(i32 %13, i32 %14)
%16 = tail call i32 @_mm_unpackhi_ps(i32 %13, i32 %14)
%17 = tail call i32 @_MM_SHUFFLE(i32 1, i32 0, i32 1, i32 0)
%18 = tail call i32 @_mm_shuffle_ps(i32 %15, i32 %16, i32 %17)
%19 = tail call i32 @_MM_SHUFFLE(i32 3, i32 2, i32 3, i32 2)
%20 = tail call i32 @_mm_shuffle_ps(i32 %15, i32 %16, i32 %19)
%21 = tail call i32 @_mm_min_ps(i32 %18, i32 %20)
%22 = tail call i32 @_mm_max_ps(i32 %18, i32 %20)
%23 = tail call i32 @_mm_unpacklo_ps(i32 %21, i32 %22)
store i32 %23, i32* %2
%24 = tail call i32 @_mm_unpackhi_ps(i32 %21, i32 %22)
store i32 %24, i32* %3
ret void
}