#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_SHUFFLE(int, int, int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_and_si128(int /*<<< orphan*/, int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_set_epi32(int, int, int, int);
int /*<<< orphan*/ _mm_shuffle_epi32(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_slli_epi32(int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_srai_epi32(int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_xor_si128(int /*<<< orphan*/, int /*<<< orphan*/);
__m128i double_block(__m128i bl) {
  const __m128i mask = _mm_set_epi32(135, 1, 1, 1);
  __m128i tmp = _mm_srai_epi32(bl, 31);
  tmp = _mm_and_si128(tmp, mask);
  tmp = _mm_shuffle_epi32(tmp, _MM_SHUFFLE(2, 1, 0, 3));
  bl = _mm_slli_epi32(bl, 1);
  return _mm_xor_si128(bl, tmp);
}


x86 assembly (clang, -O0):
<double_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x87,%edi
mov    $0x1,%ecx
mov    %ecx,%esi
mov    %ecx,%edx
call   1040 <_mm_set_epi32@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1f,%esi
call   1050 <_mm_srai_epi32@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1090 <_mm_and_si128@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x2,%edi
mov    $0x1,%esi
xor    %edx,%edx
mov    $0x3,%ecx
call   1030 <_MM_SHUFFLE@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%esi
call   1060 <_mm_shuffle_epi32@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1080 <_mm_slli_epi32@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_block>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x87,%edi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1040 <_mm_set_epi32@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x1f,%esi
call   1050 <_mm_srai_epi32@plt>
mov    %eax,%edi
mov    %ebp,%esi
call   1090 <_mm_and_si128@plt>
mov    %eax,%ebp
mov    $0x2,%edi
mov    $0x1,%esi
xor    %edx,%edx
mov    $0x3,%ecx
call   1030 <_MM_SHUFFLE@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1060 <_mm_shuffle_epi32@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x1,%esi
call   1080 <_mm_slli_epi32@plt>
mov    %eax,%edi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1070 <_mm_xor_si128@plt>

LLVM IR (-O0):
define i32 @double_block(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 @_mm_set_epi32(i32 135, i32 1, i32 1, i32 1)
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = call i32 @_mm_srai_epi32(i32 %6, i32 31)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = call i32 @_mm_and_si128(i32 %8, i32 %9)
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = call i32 @_MM_SHUFFLE(i32 2, i32 1, i32 0, i32 3)
%13 = call i32 @_mm_shuffle_epi32(i32 %11, i32 %12)
store i32 %13, i32* %4
%14 = load i32, i32* %2
%15 = call i32 @_mm_slli_epi32(i32 %14, i32 1)
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = load i32, i32* %4
%18 = call i32 @_mm_xor_si128(i32 %16, i32 %17)
ret i32 %18
}

LLVM IR (-O2):
define i32 @double_block(i32 %0) {
%2 = tail call i32 @_mm_set_epi32(i32 135, i32 1, i32 1, i32 1)
%3 = tail call i32 @_mm_srai_epi32(i32 %0, i32 31)
%4 = tail call i32 @_mm_and_si128(i32 %3, i32 %2)
%5 = tail call i32 @_MM_SHUFFLE(i32 2, i32 1, i32 0, i32 3)
%6 = tail call i32 @_mm_shuffle_epi32(i32 %4, i32 %5)
%7 = tail call i32 @_mm_slli_epi32(i32 %0, i32 1)
%8 = tail call i32 @_mm_xor_si128(i32 %7, i32 %6)
ret i32 %8
}