#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_srli_si128(int /*<<< orphan*/, int);
__m128i ShiftDigits_SSE2(__m128i a, unsigned digit) {
  switch (digit) {
  case 0:
    return a;
  case 1:
    return _mm_srli_si128(a, 1);
  case 2:
    return _mm_srli_si128(a, 2);
  case 3:
    return _mm_srli_si128(a, 3);
  case 4:
    return _mm_srli_si128(a, 4);
  case 5:
    return _mm_srli_si128(a, 5);
  case 6:
    return _mm_srli_si128(a, 6);
  case 7:
    return _mm_srli_si128(a, 7);
  case 8:
    return _mm_srli_si128(a, 8);
  }
  return a;
}


x86 assembly (clang, -O0):
<ShiftDigits_SSE2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x8,%rax
ja     11f6 <ShiftDigits_SSE2+0xe6>
mov    -0x18(%rbp),%rax
lea    0xec6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11fc <ShiftDigits_SSE2+0xec>
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
call   1030 <_mm_srli_si128@plt>
mov    %eax,-0x4(%rbp)
jmp    11fc <ShiftDigits_SSE2+0xec>
mov    -0x8(%rbp),%edi
mov    $0x2,%esi
call   1030 <_mm_srli_si128@plt>
mov    %eax,-0x4(%rbp)
jmp    11fc <ShiftDigits_SSE2+0xec>
mov    -0x8(%rbp),%edi
mov    $0x3,%esi
call   1030 <_mm_srli_si128@plt>
mov    %eax,-0x4(%rbp)
jmp    11fc <ShiftDigits_SSE2+0xec>
mov    -0x8(%rbp),%edi
mov    $0x4,%esi
call   1030 <_mm_srli_si128@plt>
mov    %eax,-0x4(%rbp)
jmp    11fc <ShiftDigits_SSE2+0xec>
mov    -0x8(%rbp),%edi
mov    $0x5,%esi
call   1030 <_mm_srli_si128@plt>
mov    %eax,-0x4(%rbp)
jmp    11fc <ShiftDigits_SSE2+0xec>
mov    -0x8(%rbp),%edi
mov    $0x6,%esi
call   1030 <_mm_srli_si128@plt>
mov    %eax,-0x4(%rbp)
jmp    11fc <ShiftDigits_SSE2+0xec>
mov    -0x8(%rbp),%edi
mov    $0x7,%esi
call   1030 <_mm_srli_si128@plt>
mov    %eax,-0x4(%rbp)
jmp    11fc <ShiftDigits_SSE2+0xec>
mov    -0x8(%rbp),%edi
mov    $0x8,%esi
call   1030 <_mm_srli_si128@plt>
mov    %eax,-0x4(%rbp)
jmp    11fc <ShiftDigits_SSE2+0xec>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShiftDigits_SSE2>:
lea    -0x1(%rsi),%eax
cmp    $0x7,%eax
ja     111d <ShiftDigits_SSE2+0xd>
jmp    1030 <_mm_srli_si128@plt>
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @ShiftDigits_SSE2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
switch i32 %6, label %33 [
i32 0, label %7
i32 1, label %9
i32 2, label %12
i32 3, label %15
i32 4, label %18
i32 5, label %21
i32 6, label %24
i32 7, label %27
i32 8, label %30
]
7: ; preds = %2
%8 = load i32, i32* %4
store i32 %8, i32* %3
br label %35
9: ; preds = %2
%10 = load i32, i32* %4
%11 = call i32 @_mm_srli_si128(i32 %10, i32 1)
store i32 %11, i32* %3
br label %35
12: ; preds = %2
%13 = load i32, i32* %4
%14 = call i32 @_mm_srli_si128(i32 %13, i32 2)
store i32 %14, i32* %3
br label %35
15: ; preds = %2
%16 = load i32, i32* %4
%17 = call i32 @_mm_srli_si128(i32 %16, i32 3)
store i32 %17, i32* %3
br label %35
18: ; preds = %2
%19 = load i32, i32* %4
%20 = call i32 @_mm_srli_si128(i32 %19, i32 4)
store i32 %20, i32* %3
br label %35
21: ; preds = %2
%22 = load i32, i32* %4
%23 = call i32 @_mm_srli_si128(i32 %22, i32 5)
store i32 %23, i32* %3
br label %35
24: ; preds = %2
%25 = load i32, i32* %4
%26 = call i32 @_mm_srli_si128(i32 %25, i32 6)
store i32 %26, i32* %3
br label %35
27: ; preds = %2
%28 = load i32, i32* %4
%29 = call i32 @_mm_srli_si128(i32 %28, i32 7)
store i32 %29, i32* %3
br label %35
30: ; preds = %2
%31 = load i32, i32* %4
%32 = call i32 @_mm_srli_si128(i32 %31, i32 8)
store i32 %32, i32* %3
br label %35
33: ; preds = %2
%34 = load i32, i32* %4
store i32 %34, i32* %3
br label %35
35: ; preds = %33, %30, %27, %24, %21, %18, %15, %12, %9, %7
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
define i32 @ShiftDigits_SSE2(i32 %0, i32 %1) {
%3 = add i32 %1, -1
%4 = icmp ult i32 %3, 8
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @_mm_srli_si128(i32 %0, i32 %1)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %0, %2 ], [ %6, %5 ]
ret i32 %8
}