#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);
float _mm_cvtss_f32(int /*<<< orphan*/);
int /*<<< orphan*/ _mm_max_ps(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_shuffle_ps(int /*<<< orphan*/, int /*<<< orphan*/,
                                  int /*<<< orphan*/);
float hmax_ps(__m128 x) {
  x = _mm_max_ps(x, _mm_shuffle_ps(x, x, _MM_SHUFFLE(1, 0, 3, 2)));
  x = _mm_max_ps(x, _mm_shuffle_ps(x, x, _MM_SHUFFLE(2, 3, 0, 1)));
  return _mm_cvtss_f32(x);
}


x86 assembly (clang, -O0):
<hmax_ps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0x1,%edi
xor    %esi,%esi
mov    $0x3,%edx
mov    $0x2,%ecx
call   1040 <_MM_SHUFFLE@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    %eax,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
call   1060 <_mm_max_ps@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x2,%edi
mov    $0x3,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1040 <_MM_SHUFFLE@plt>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    %eax,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%esi
call   1060 <_mm_max_ps@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <_mm_cvtss_f32@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hmax_ps>:
push   %rbx
mov    %edi,%ebx
mov    $0x1,%edi
xor    %esi,%esi
mov    $0x3,%edx
mov    $0x2,%ecx
call   1040 <_MM_SHUFFLE@plt>
mov    %ebx,%edi
mov    %ebx,%esi
mov    %eax,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1060 <_mm_max_ps@plt>
mov    %eax,%ebx
mov    $0x2,%edi
mov    $0x3,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1040 <_MM_SHUFFLE@plt>
mov    %ebx,%edi
mov    %ebx,%esi
mov    %eax,%edx
call   1050 <_mm_shuffle_ps@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1060 <_mm_max_ps@plt>
mov    %eax,%edi
pop    %rbx
jmp    1030 <_mm_cvtss_f32@plt>

LLVM IR (-O0):
define float @hmax_ps(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @_MM_SHUFFLE(i32 1, i32 0, i32 3, i32 2)
%7 = call i32 @_mm_shuffle_ps(i32 %4, i32 %5, i32 %6)
%8 = call i32 @_mm_max_ps(i32 %3, i32 %7)
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = load i32, i32* %2
%11 = load i32, i32* %2
%12 = call i32 @_MM_SHUFFLE(i32 2, i32 3, i32 0, i32 1)
%13 = call i32 @_mm_shuffle_ps(i32 %10, i32 %11, i32 %12)
%14 = call i32 @_mm_max_ps(i32 %9, i32 %13)
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = call float @_mm_cvtss_f32(i32 %15)
ret float %16
}

LLVM IR (-O2):
define float @hmax_ps(i32 %0) {
%2 = tail call i32 @_MM_SHUFFLE(i32 1, i32 0, i32 3, i32 2)
%3 = tail call i32 @_mm_shuffle_ps(i32 %0, i32 %0, i32 %2)
%4 = tail call i32 @_mm_max_ps(i32 %0, i32 %3)
%5 = tail call i32 @_MM_SHUFFLE(i32 2, i32 3, i32 0, i32 1)
%6 = tail call i32 @_mm_shuffle_ps(i32 %4, i32 %4, i32 %5)
%7 = tail call i32 @_mm_max_ps(i32 %4, i32 %6)
%8 = tail call float @_mm_cvtss_f32(i32 %7)
ret float %8
}