#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 */

/* Variables and functions */
int abs(int const);
const char *IntWallStyle(const int i) {
  static const char *wallStyles[] = {"steel", "brick",    "carbon", "steelwood",
                                     "stone", "plasteel", "granite"};
  return wallStyles[abs(i) % 7];
}


x86 assembly (clang, -O0):
<IntWallStyle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <abs@plt>
mov    $0x7,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
lea    0x2efb(%rip),%rax
mov    (%rax,%rcx,8),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IntWallStyle>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
imul   $0x24924925,%rax,%rcx
shr    $0x20,%rcx
mov    %eax,%edx
sub    %ecx,%edx
shr    %edx
add    %ecx,%edx
shr    $0x2,%edx
lea    0x0(,%rdx,8),%ecx
sub    %ecx,%edx
add    %eax,%edx
lea    0xed1(%rip),%rcx
movslq (%rcx,%rdx,4),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
@IntWallStyle.wallStyles = internal global [7 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i32 0, i32 0)]
@.str = [6 x i8] c"steel\00"
@.str.1 = [6 x i8] c"brick\00"
@.str.2 = [7 x i8] c"carbon\00"
@.str.3 = [10 x i8] c"steelwood\00"
@.str.4 = [6 x i8] c"stone\00"
@.str.5 = [9 x i8] c"plasteel\00"
@.str.6 = [8 x i8] c"granite\00"
define i8* @IntWallStyle(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @abs(i32 %3)
%5 = srem i32 %4, 7
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [7 x i8*], [7 x i8*]* @IntWallStyle.wallStyles, i64 0, i64 %6
%8 = load i8*, i8** %7
ret i8* %8
}

LLVM IR (-O2):
@reltable.IntWallStyle = internal unnamed_addr constant [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str to i64), i64 ptrtoint ([7 x i32]* @reltable.IntWallStyle to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.IntWallStyle to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.IntWallStyle to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.IntWallStyle to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.IntWallStyle to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.IntWallStyle to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.IntWallStyle to i64)) to i32)]
@.str = [6 x i8] c"steel\00"
@.str.1 = [6 x i8] c"brick\00"
@.str.2 = [7 x i8] c"carbon\00"
@.str.3 = [10 x i8] c"steelwood\00"
@.str.4 = [6 x i8] c"stone\00"
@.str.5 = [9 x i8] c"plasteel\00"
@.str.6 = [8 x i8] c"granite\00"
define i8* @IntWallStyle(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%3 = urem i32 %2, 7
%4 = zext i32 %3 to i64
%5 = shl i64 %4, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.IntWallStyle to i8*), i64 %5)
ret i8* %6
}