#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*/ _bitonic_merge_kernel4core(float *, float *);
int /*<<< orphan*/ _mm_loadu_ps(float *);
int /*<<< orphan*/ _mm_max_ps(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_min_ps(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_storeu_ps(float *, int /*<<< orphan*/);
void _bitonic_merge_kernel8core(float *a, float *b) {
  __m128 ma[2];
  __m128 mb[2];
  __m128 lo[2];
  __m128 hi[2];
  ma[0] = _mm_loadu_ps(a);
  mb[0] = _mm_loadu_ps(b);
  ma[1] = _mm_loadu_ps(a + 4);
  mb[1] = _mm_loadu_ps(b + 4);
  lo[0] = _mm_min_ps(ma[0], mb[0]);
  hi[0] = _mm_max_ps(ma[0], mb[0]);
  lo[1] = _mm_min_ps(ma[1], mb[1]);
  hi[1] = _mm_max_ps(ma[1], mb[1]);
  _mm_storeu_ps(&a[0], lo[0]);
  _mm_storeu_ps(&a[4], lo[1]);
  _mm_storeu_ps(&b[0], hi[1]);
  _mm_storeu_ps(&b[4], hi[0]);
  _bitonic_merge_kernel4core(&a[0], &a[4]);
  _bitonic_merge_kernel4core(&b[0], &b[4]);
}


x86 assembly (clang, -O0):
<_bitonic_merge_kernel8core>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <_mm_loadu_ps@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <_mm_loadu_ps@plt>
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x10,%rdi
call   1050 <_mm_loadu_ps@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x10,%rdi
call   1050 <_mm_loadu_ps@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1040 <_mm_min_ps@plt>
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1060 <_mm_max_ps@plt>
mov    %eax,-0x30(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1040 <_mm_min_ps@plt>
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1060 <_mm_max_ps@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%esi
call   1030 <_mm_storeu_ps@plt>
mov    -0x8(%rbp),%rdi
add    $0x10,%rdi
mov    -0x24(%rbp),%esi
call   1030 <_mm_storeu_ps@plt>
mov    -0x10(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   1030 <_mm_storeu_ps@plt>
mov    -0x10(%rbp),%rdi
add    $0x10,%rdi
mov    -0x30(%rbp),%esi
call   1030 <_mm_storeu_ps@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x10,%rsi
call   1070 <_bitonic_merge_kernel4core@plt>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
call   1070 <_bitonic_merge_kernel4core@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_bitonic_merge_kernel8core>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbp
mov    %rsi,0x10(%rsp)
mov    %rdi,%r13
call   1050 <_mm_loadu_ps@plt>
mov    %eax,%r14d
mov    %rbp,%rdi
call   1050 <_mm_loadu_ps@plt>
mov    %eax,%ebx
lea    0x10(%r13),%rdi
mov    %rdi,0x8(%rsp)
call   1050 <_mm_loadu_ps@plt>
mov    %eax,%r15d
add    $0x10,%rbp
mov    %rbp,%rdi
call   1050 <_mm_loadu_ps@plt>
mov    %eax,%r12d
mov    %r14d,%edi
mov    %ebx,%esi
call   1040 <_mm_min_ps@plt>
mov    %eax,(%rsp)
mov    %r14d,%edi
mov    %ebx,%esi
call   1060 <_mm_max_ps@plt>
mov    %eax,0x4(%rsp)
mov    %r15d,%edi
mov    %r12d,%esi
call   1040 <_mm_min_ps@plt>
mov    %eax,%r14d
mov    %r15d,%edi
mov    %r12d,%esi
call   1060 <_mm_max_ps@plt>
mov    %eax,%r15d
mov    %r13,%rdi
mov    (%rsp),%esi
call   1030 <_mm_storeu_ps@plt>
mov    0x8(%rsp),%r12
mov    %r12,%rdi
mov    %r14d,%esi
call   1030 <_mm_storeu_ps@plt>
mov    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15d,%esi
call   1030 <_mm_storeu_ps@plt>
mov    %rbp,%rdi
mov    0x4(%rsp),%esi
call   1030 <_mm_storeu_ps@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   1070 <_bitonic_merge_kernel4core@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <_bitonic_merge_kernel4core@plt>

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

LLVM IR (-O2):
define void @_bitonic_merge_kernel8core(float* %0, float* %1) {
%3 = tail call i32 @_mm_loadu_ps(float* %0)
%4 = tail call i32 @_mm_loadu_ps(float* %1)
%5 = getelementptr inbounds float, float* %0, i64 4
%6 = tail call i32 @_mm_loadu_ps(float* %5)
%7 = getelementptr inbounds float, float* %1, i64 4
%8 = tail call i32 @_mm_loadu_ps(float* %7)
%9 = tail call i32 @_mm_min_ps(i32 %3, i32 %4)
%10 = tail call i32 @_mm_max_ps(i32 %3, i32 %4)
%11 = tail call i32 @_mm_min_ps(i32 %6, i32 %8)
%12 = tail call i32 @_mm_max_ps(i32 %6, i32 %8)
%13 = tail call i32 @_mm_storeu_ps(float* %0, i32 %9)
%14 = tail call i32 @_mm_storeu_ps(float* %5, i32 %11)
%15 = tail call i32 @_mm_storeu_ps(float* %1, i32 %12)
%16 = tail call i32 @_mm_storeu_ps(float* %7, i32 %10)
%17 = tail call i32 @_bitonic_merge_kernel4core(float* %0, float* %5)
%18 = tail call i32 @_bitonic_merge_kernel4core(float* %1, float* %7)
ret void
}