int d7_shift_index(int x) {
  int d7[64] = {0, 1, 2, 3, 4,  5,  6,  7,  1, 2, 3, 4,  5,  6,  7,  8,
                2, 3, 4, 5, 6,  7,  8,  9,  3, 4, 5, 6,  7,  8,  9,  10,
                4, 5, 6, 7, 8,  9,  10, 11, 5, 6, 7, 8,  9,  10, 11, 12,
                6, 7, 8, 9, 10, 11, 12, 13, 7, 8, 9, 10, 11, 12, 13, 14};
  int s[15] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 0, 0};
  return s[d7[x]];
}


x86 assembly (clang, -O0):
<d7_shift_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xec4(%rip),%rsi
mov    $0x100,%edx
call   1040 <memcpy@plt>
lea    -0x150(%rbp),%rdi
xor    %esi,%esi
mov    $0x3c,%edx
call   1030 <memset@plt>
movl   $0x1,-0x130(%rbp)
movl   $0x2,-0x12c(%rbp)
movl   $0x3,-0x128(%rbp)
movl   $0x4,-0x124(%rbp)
movl   $0x5,-0x120(%rbp)
movslq -0x4(%rbp),%rax
movslq -0x110(%rbp,%rax,4),%rax
ff
mov    -0x150(%rbp,%rax,4),%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d7_shift_index>:
xorps  %xmm0,%xmm0
movups %xmm0,-0x1c(%rsp)
movaps %xmm0,-0x28(%rsp)
movaps %xmm0,-0x38(%rsp)
movaps %xmm0,-0x48(%rsp)
movaps 0xee2(%rip),%xmm0
movaps %xmm0,-0x28(%rsp)
movl   $0x5,-0x18(%rsp)
movslq %edi,%rax
lea    0xedb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
mov    -0x48(%rsp,%rax,4),%eax
ret

LLVM IR (-O0):
@__const.d7_shift_index.d7 = [64 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14]
define i32 @d7_shift_index(i32 %0) {
%2 = alloca i32
%3 = alloca [64 x i32]
%4 = alloca [15 x i32]
store i32 %0, i32* %2
%5 = bitcast [64 x i32]* %3 to i8*
%6 = bitcast [15 x i32]* %4 to i8*
%7 = bitcast i8* %6 to [15 x i32]*
%8 = getelementptr inbounds [15 x i32], [15 x i32]* %7, i32 0, i32 8
store i32 1, i32* %8
%9 = getelementptr inbounds [15 x i32], [15 x i32]* %7, i32 0, i32 9
store i32 2, i32* %9
%10 = getelementptr inbounds [15 x i32], [15 x i32]* %7, i32 0, i32 10
store i32 3, i32* %10
%11 = getelementptr inbounds [15 x i32], [15 x i32]* %7, i32 0, i32 11
store i32 4, i32* %11
%12 = getelementptr inbounds [15 x i32], [15 x i32]* %7, i32 0, i32 12
store i32 5, i32* %12
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [64 x i32], [64 x i32]* %3, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [15 x i32], [15 x i32]* %4, i64 0, i64 %17
%19 = load i32, i32* %18
ret i32 %19
}

LLVM IR (-O2):
@__const.d7_shift_index.d7 = [64 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14]
define i32 @d7_shift_index(i32 %0) {
%2 = alloca [15 x i32]
%3 = bitcast [15 x i32]* %2 to i8*
%4 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 8
%5 = bitcast i32* %4 to <4 x i32>*
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32>* %5
%6 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 12
store i32 5, i32* %6
%7 = sext i32 %0 to i64
%8 = getelementptr inbounds [64 x i32], [64 x i32]* @__const.d7_shift_index.d7, i64 0, i64 %7
%9 = load i32, i32* %8
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [15 x i32], [15 x i32]* %2, i64 0, i64 %10
%12 = load i32, i32* %11
ret i32 %12
}