void prod(int res, int *k_str, int *k_stl) {
  int x, y;
  switch (res) {
  case 0:
    x = 1;
    y = 0;
    break;
  case 1:
    x = 0;
    y = 1;
    break;
  case 2:
  case 3:
  case 6:
  case 12:
    x = 0;
    y = 2;
    break;
  case 4:
  case 5:
  case 10:
  case 13:
    x = 0;
    y = 0;
    break;
  case 7:
  case 8:
    x = 2;
    y = 2;
    break;
  case 9:
  case 11:
    x = 2;
    y = 0;
    break;
  case 14:
  case 15:
  case 16:
  case 17:
  case 18:
  case 19:
  case 20:
  case 21:
    x = 1;
    y = 1;
    break;
  default:
    x = -1;
    y = -1;
    break;
  }
  *k_str = y;
  *k_stl = x;
}


x86 assembly (clang, -O0):
<prod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x28(%rbp)
sub    $0x15,%rax
ja     11b9 <prod+0xb9>
mov    -0x28(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
jmp    11c7 <prod+0xc7>
movl   $0x0,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
jmp    11c7 <prod+0xc7>
movl   $0x0,-0x1c(%rbp)
movl   $0x2,-0x20(%rbp)
jmp    11c7 <prod+0xc7>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
jmp    11c7 <prod+0xc7>
movl   $0x2,-0x1c(%rbp)
movl   $0x2,-0x20(%rbp)
jmp    11c7 <prod+0xc7>
movl   $0x2,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
jmp    11c7 <prod+0xc7>
movl   $0x1,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
jmp    11c7 <prod+0xc7>
movl   $0xffffffff,-0x1c(%rbp)
movl   $0xffffffff,-0x20(%rbp)
mov    -0x20(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<prod>:
mov    $0xffffffff,%eax
mov    $0xffffffff,%ecx
cmp    $0x15,%edi
ja     1126 <prod+0x26>
movslq %edi,%rcx
lea    0xee7(%rip),%rax
mov    (%rax,%rcx,4),%eax
lea    0xf35(%rip),%rdi
mov    (%rdi,%rcx,4),%ecx
mov    %ecx,(%rsi)
mov    %eax,(%rdx)
ret

LLVM IR (-O0):
define void @prod(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%9 = load i32, i32* %4
switch i32 %9, label %17 [
i32 0, label %10
i32 1, label %11
i32 2, label %12
i32 3, label %12
i32 6, label %12
i32 12, label %12
i32 4, label %13
i32 5, label %13
i32 10, label %13
i32 13, label %13
i32 7, label %14
i32 8, label %14
i32 9, label %15
i32 11, label %15
i32 14, label %16
i32 15, label %16
i32 16, label %16
i32 17, label %16
i32 18, label %16
i32 19, label %16
i32 20, label %16
i32 21, label %16
]
10: ; preds = %3
store i32 1, i32* %7
store i32 0, i32* %8
br label %18
11: ; preds = %3
store i32 0, i32* %7
store i32 1, i32* %8
br label %18
12: ; preds = %3, %3, %3, %3
store i32 0, i32* %7
store i32 2, i32* %8
br label %18
13: ; preds = %3, %3, %3, %3
store i32 0, i32* %7
store i32 0, i32* %8
br label %18
14: ; preds = %3, %3
store i32 2, i32* %7
store i32 2, i32* %8
br label %18
15: ; preds = %3, %3
store i32 2, i32* %7
store i32 0, i32* %8
br label %18
16: ; preds = %3, %3, %3, %3, %3, %3, %3, %3
store i32 1, i32* %7
store i32 1, i32* %8
br label %18
17: ; preds = %3
store i32 -1, i32* %7
store i32 -1, i32* %8
br label %18
18: ; preds = %17, %16, %15, %14, %13, %12, %11, %10
%19 = load i32, i32* %8
%20 = load i32*, i32** %5
store i32 %19, i32* %20
%21 = load i32, i32* %7
%22 = load i32*, i32** %6
store i32 %21, i32* %22
ret void
}

LLVM IR (-O2):
@switch.table.prod = [22 x i32] [i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 2, i32 2, i32 2, i32 0, i32 2, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1]
@switch.table.prod.1 = [22 x i32] [i32 0, i32 1, i32 2, i32 2, i32 0, i32 0, i32 2, i32 2, i32 2, i32 0, i32 0, i32 0, i32 2, i32 0, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1]
define void @prod(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = icmp ult i32 %0, 22
br i1 %4, label %5, label %12
5: ; preds = %3
%6 = sext i32 %0 to i64
%7 = getelementptr inbounds [22 x i32], [22 x i32]* @switch.table.prod, i64 0, i64 %6
%8 = load i32, i32* %7
%9 = sext i32 %0 to i64
%10 = getelementptr inbounds [22 x i32], [22 x i32]* @switch.table.prod.1, i64 0, i64 %9
%11 = load i32, i32* %10
br label %12
12: ; preds = %3, %5
%13 = phi i32 [ %8, %5 ], [ -1, %3 ]
%14 = phi i32 [ %11, %5 ], [ -1, %3 ]
store i32 %14, i32* %1
store i32 %13, i32* %2
ret void
}