int grid_get_bombs_from_dimension(int *bombs, int row_dim, int col_dim) {
  if (row_dim == 8)
    *bombs = 10;
  else if (row_dim == 12)
    *bombs = 26;
  else if (row_dim == 16)
    *bombs = 60;
  else if (row_dim == 2)
    *bombs = 0;
  return 0;
}


x86 assembly (clang, -O0):
<grid_get_bombs_from_dimension>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x8,-0xc(%rbp)
jne    1127 <grid_get_bombs_from_dimension+0x27>
mov    -0x8(%rbp),%rax
movl   $0xa,(%rax)
jmp    117c <grid_get_bombs_from_dimension+0x7c>
cmpl   $0xc,-0xc(%rbp)
jne    1140 <grid_get_bombs_from_dimension+0x40>
mov    -0x8(%rbp),%rax
movl   $0x1a,(%rax)
jmp    1177 <grid_get_bombs_from_dimension+0x77>
cmpl   $0x10,-0xc(%rbp)
jne    1159 <grid_get_bombs_from_dimension+0x59>
mov    -0x8(%rbp),%rax
movl   $0x3c,(%rax)
jmp    1172 <grid_get_bombs_from_dimension+0x72>
cmpl   $0x2,-0xc(%rbp)
jne    116d <grid_get_bombs_from_dimension+0x6d>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
jmp    1172 <grid_get_bombs_from_dimension+0x72>
jmp    1177 <grid_get_bombs_from_dimension+0x77>
jmp    117c <grid_get_bombs_from_dimension+0x7c>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<grid_get_bombs_from_dimension>:
add    $0xfffffffe,%esi
ror    %esi
cmp    $0x7,%esi
ja     1123 <grid_get_bombs_from_dimension+0x23>
mov    $0xa9,%eax
bt     %esi,%eax
jae    1123 <grid_get_bombs_from_dimension+0x23>
movslq %esi,%rax
lea    0xee2(%rip),%rcx
mov    (%rcx,%rax,4),%eax
mov    %eax,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @grid_get_bombs_from_dimension(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = icmp eq i32 %7, 8
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = load i32*, i32** %4
store i32 10, i32* %10
br label %29
11: ; preds = %3
%12 = load i32, i32* %5
%13 = icmp eq i32 %12, 12
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = load i32*, i32** %4
store i32 26, i32* %15
br label %28
16: ; preds = %11
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 16
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = load i32*, i32** %4
store i32 60, i32* %20
br label %27
21: ; preds = %16
%22 = load i32, i32* %5
%23 = icmp eq i32 %22, 2
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = load i32*, i32** %4
store i32 0, i32* %25
br label %26
26: ; preds = %24, %21
br label %27
27: ; preds = %26, %19
br label %28
28: ; preds = %27, %14
br label %29
29: ; preds = %28, %9
ret i32 0
}

LLVM IR (-O2):
@switch.table.grid_get_bombs_from_dimension = [8 x i32] [i32 0, i32 10, i32 10, i32 10, i32 10, i32 26, i32 10, i32 60]
define i32 @grid_get_bombs_from_dimension(i32* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = add i32 %1, -2
%5 = tail call i32 @llvm.fshl.i32(i32 %4, i32 %4, i32 31)
%6 = icmp ult i32 %5, 8
br i1 %6, label %7, label %16
7: ; preds = %3
%8 = trunc i32 %5 to i8
%9 = lshr i8 -87, %8
%10 = and i8 %9, 1
%11 = icmp eq i8 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %7
%13 = sext i32 %5 to i64
%14 = getelementptr inbounds [8 x i32], [8 x i32]* @switch.table.grid_get_bombs_from_dimension, i64 0, i64 %13
%15 = load i32, i32* %14
store i32 %15, i32* %0
br label %16
16: ; preds = %7, %3, %12
ret i32 0
}