int obterValorMatrizBotoes(int rb, int coluna) {
  switch (rb) {
  case 0:
    switch (coluna) {
    case 1:
      return 1;
    case 2:
      return 5;
      break;
    case 3:
      return 9;
      break;
    case 4:
      return 13;
    }
    break;
  case 1:
    switch (coluna) {
    case 1:
      return 2;
    case 2:
      return 6;
      break;
    case 3:
      return 10;
      break;
    case 4:
      return 14;
    }
    break;
  case 2:
    switch (coluna) {
    case 1:
      return 3;
    case 2:
      return 7;
      break;
    case 3:
      return 11;
      break;
    case 4:
      return 15;
    }
    break;
  }
}


x86 assembly (clang, -O0):
<obterValorMatrizBotoes>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     113f <obterValorMatrizBotoes+0x3f>
jmp    111d <obterValorMatrizBotoes+0x1d>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     119d <obterValorMatrizBotoes+0x9d>
jmp    112e <obterValorMatrizBotoes+0x2e>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     11fb <obterValorMatrizBotoes+0xfb>
jmp    1259 <obterValorMatrizBotoes+0x159>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     1198 <obterValorMatrizBotoes+0x98>
mov    -0x18(%rbp),%rax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    1259 <obterValorMatrizBotoes+0x159>
movl   $0x5,-0x4(%rbp)
jmp    1259 <obterValorMatrizBotoes+0x159>
movl   $0x9,-0x4(%rbp)
jmp    1259 <obterValorMatrizBotoes+0x159>
movl   $0xd,-0x4(%rbp)
jmp    1259 <obterValorMatrizBotoes+0x159>
jmp    1259 <obterValorMatrizBotoes+0x159>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x3,%eax
ja     11f6 <obterValorMatrizBotoes+0xf6>
mov    -0x20(%rbp),%rax
lea    0xe53(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x2,-0x4(%rbp)
jmp    1259 <obterValorMatrizBotoes+0x159>
movl   $0x6,-0x4(%rbp)
jmp    1259 <obterValorMatrizBotoes+0x159>
movl   $0xa,-0x4(%rbp)
jmp    1259 <obterValorMatrizBotoes+0x159>
movl   $0xe,-0x4(%rbp)
jmp    1259 <obterValorMatrizBotoes+0x159>
jmp    1259 <obterValorMatrizBotoes+0x159>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x3,%eax
ja     1254 <obterValorMatrizBotoes+0x154>
mov    -0x28(%rbp),%rax
lea    0xde5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x3,-0x4(%rbp)
jmp    1259 <obterValorMatrizBotoes+0x159>
movl   $0x7,-0x4(%rbp)
jmp    1259 <obterValorMatrizBotoes+0x159>
movl   $0xb,-0x4(%rbp)
jmp    1259 <obterValorMatrizBotoes+0x159>
movl   $0xf,-0x4(%rbp)
jmp    1259 <obterValorMatrizBotoes+0x159>
jmp    1259 <obterValorMatrizBotoes+0x159>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<obterValorMatrizBotoes>:
cmp    $0x2,%edi
je     1123 <obterValorMatrizBotoes+0x23>
cmp    $0x1,%edi
je     1138 <obterValorMatrizBotoes+0x38>
test   %edi,%edi
jne    1137 <obterValorMatrizBotoes+0x37>
add    $0xfffffffe,%esi
mov    $0x1,%eax
cmp    $0x3,%esi
jae    1137 <obterValorMatrizBotoes+0x37>
lea    0x5(,%rsi,4),%eax
ret
add    $0xfffffffe,%esi
mov    $0x3,%eax
cmp    $0x3,%esi
jae    1137 <obterValorMatrizBotoes+0x37>
lea    0x7(,%rsi,4),%eax
ret
add    $0xfffffffe,%esi
mov    $0x2,%eax
cmp    $0x3,%esi
jae    1137 <obterValorMatrizBotoes+0x37>
lea    0x6(,%rsi,4),%eax
ret

LLVM IR (-O0):
define i32 @obterValorMatrizBotoes(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* %4
switch i32 %6, label %28 [
i32 0, label %7
i32 1, label %14
i32 2, label %21
]
7: ; preds = %2
%8 = load i32, i32* %5
switch i32 %8, label %13 [
i32 1, label %9
i32 2, label %10
i32 3, label %11
i32 4, label %12
]
9: ; preds = %7
store i32 1, i32* %3
br label %28
10: ; preds = %7
store i32 5, i32* %3
br label %28
11: ; preds = %7
store i32 9, i32* %3
br label %28
12: ; preds = %7
store i32 13, i32* %3
br label %28
13: ; preds = %7
br label %28
14: ; preds = %2
%15 = load i32, i32* %5
switch i32 %15, label %20 [
i32 1, label %16
i32 2, label %17
i32 3, label %18
i32 4, label %19
]
16: ; preds = %14
store i32 2, i32* %3
br label %28
17: ; preds = %14
store i32 6, i32* %3
br label %28
18: ; preds = %14
store i32 10, i32* %3
br label %28
19: ; preds = %14
store i32 14, i32* %3
br label %28
20: ; preds = %14
br label %28
21: ; preds = %2
%22 = load i32, i32* %5
switch i32 %22, label %27 [
i32 1, label %23
i32 2, label %24
i32 3, label %25
i32 4, label %26
]
23: ; preds = %21
store i32 3, i32* %3
br label %28
24: ; preds = %21
store i32 7, i32* %3
br label %28
25: ; preds = %21
store i32 11, i32* %3
br label %28
26: ; preds = %21
store i32 15, i32* %3
br label %28
27: ; preds = %21
br label %28
28: ; preds = %9, %10, %11, %12, %16, %17, %18, %19, %23, %24, %25, %26, %2, %27, %20, %13
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
define i32 @obterValorMatrizBotoes(i32 %0, i32 %1) {
switch i32 %0, label %21 [
i32 0, label %3
i32 1, label %6
i32 2, label %9
]
3: ; preds = %2
%4 = add i32 %1, -2
%5 = icmp ult i32 %4, 3
br i1 %5, label %12, label %21
6: ; preds = %2
%7 = add i32 %1, -2
%8 = icmp ult i32 %7, 3
br i1 %8, label %15, label %21
9: ; preds = %2
%10 = add i32 %1, -2
%11 = icmp ult i32 %10, 3
br i1 %11, label %18, label %21
12: ; preds = %3
%13 = shl i32 %4, 2
%14 = add i32 %13, 5
br label %21
15: ; preds = %6
%16 = shl i32 %7, 2
%17 = add i32 %16, 6
br label %21
18: ; preds = %9
%19 = shl i32 %10, 2
%20 = add i32 %19, 7
br label %21
21: ; preds = %18, %9, %15, %6, %12, %3, %2
%22 = phi i32 [ undef, %2 ], [ 1, %3 ], [ 2, %6 ], [ 3, %9 ], [ %14, %12 ], [ %17, %15 ], [ %20, %18 ]
ret i32 %22
}