#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_add_epi32(int /*<<< orphan*/ const,
                                 int /*<<< orphan*/ const);
int /*<<< orphan*/ _mm_packs_epi32(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_srai_epi32(int /*<<< orphan*/, int);
__m128i wraplow_16bit_shift5(const __m128i in0, const __m128i in1,
                             const __m128i rounding) {
  __m128i temp[2];
  temp[0] = _mm_add_epi32(in0, rounding);
  temp[1] = _mm_add_epi32(in1, rounding);
  temp[0] = _mm_srai_epi32(temp[0], 5);
  temp[1] = _mm_srai_epi32(temp[1], 5);
  return _mm_packs_epi32(temp[0], temp[1]);
}


x86 assembly (clang, -O0):
<wraplow_16bit_shift5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <_mm_add_epi32@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <_mm_add_epi32@plt>
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x5,%esi
call   1050 <_mm_srai_epi32@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%edi
mov    $0x5,%esi
call   1050 <_mm_srai_epi32@plt>
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <_mm_packs_epi32@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wraplow_16bit_shift5>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edx,%esi
call   1040 <_mm_add_epi32@plt>
mov    %eax,%r14d
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <_mm_add_epi32@plt>
mov    %eax,%ebx
mov    %r14d,%edi
mov    $0x5,%esi
call   1050 <_mm_srai_epi32@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x5,%esi
call   1050 <_mm_srai_epi32@plt>
mov    %ebp,%edi
mov    %eax,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <_mm_packs_epi32@plt>

LLVM IR (-O0):
define i32 @wraplow_16bit_shift5(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [2 x i32]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %6
%10 = call i32 @_mm_add_epi32(i32 %8, i32 %9)
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
store i32 %10, i32* %11
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = call i32 @_mm_add_epi32(i32 %12, i32 %13)
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
store i32 %14, i32* %15
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%17 = load i32, i32* %16
%18 = call i32 @_mm_srai_epi32(i32 %17, i32 5)
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
store i32 %18, i32* %19
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%21 = load i32, i32* %20
%22 = call i32 @_mm_srai_epi32(i32 %21, i32 5)
%23 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
store i32 %22, i32* %23
%24 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%25 = load i32, i32* %24
%26 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%27 = load i32, i32* %26
%28 = call i32 @_mm_packs_epi32(i32 %25, i32 %27)
ret i32 %28
}

LLVM IR (-O2):
define i32 @wraplow_16bit_shift5(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @_mm_add_epi32(i32 %0, i32 %2)
%5 = tail call i32 @_mm_add_epi32(i32 %1, i32 %2)
%6 = tail call i32 @_mm_srai_epi32(i32 %4, i32 5)
%7 = tail call i32 @_mm_srai_epi32(i32 %5, i32 5)
%8 = tail call i32 @_mm_packs_epi32(i32 %6, i32 %7)
ret i32 %8
}