#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 */
typedef int uint8_t;

/* Variables and functions */
uint8_t completion_code(uint8_t *sense) {
  uint8_t ret = 0xff;
  switch (sense[12]) {
  case 0x00:
    ret = 0x00;
    break;
  case 0x20:
  case 0x24:
  case 0x26:
  case 0x4b:
    ret = 0x01;
    break;
  case 0x12:
  case 0x21:
    ret = 0x02;
    break;
  case 0x27:
    ret = 0x03;
    break;
  case 0x14:
  case 0x16:
    ret = 0x04;
    break;
  case 0x30:
  case 0x64:
    ret = 0x0c;
    break;
  case 0x10:
  case 0x11:
    ret = 0x10;
    break;
  case 0x17:
  case 0x18:
    ret = 0x11;
    break;
  case 0x01:
  case 0x03:
  case 0x05:
  case 0x06:
  case 0x07:
  case 0x08:
  case 0x09:
  case 0x1B:
  case 0x1C:
  case 0x1D:
  case 0x40:
  case 0x41:
  case 0x42:
  case 0x43:
  case 0x44:
  case 0x45:
  case 0x46:
  case 0x47:
  case 0x48:
  case 0x49:
    ret = 0x20;
    break;
  case 0x15:
  case 0x02:
    ret = 0x40;
    break;
  case 0x25:
    ret = 0x80;
    break;
  case 0x04:
  case 0x28:
  case 0x29:
  case 0x2A:
  case 0x3a:
    ret = 0xaa;
    break;
  };
  return (ret);
}


x86 assembly (clang, -O0):
<completion_code>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0xff,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x30(%rax),%eax
mov    %rax,-0x18(%rbp)
sub    $0x64,%rax
ja     11c3 <completion_code+0xc3>
mov    -0x18(%rbp),%rax
lea    0xed1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0xc(%rbp)
jmp    11c3 <completion_code+0xc3>
movl   $0x1,-0xc(%rbp)
jmp    11c3 <completion_code+0xc3>
movl   $0x2,-0xc(%rbp)
jmp    11c3 <completion_code+0xc3>
movl   $0x3,-0xc(%rbp)
jmp    11c3 <completion_code+0xc3>
movl   $0x4,-0xc(%rbp)
jmp    11c3 <completion_code+0xc3>
movl   $0xc,-0xc(%rbp)
jmp    11c3 <completion_code+0xc3>
movl   $0x10,-0xc(%rbp)
jmp    11c3 <completion_code+0xc3>
movl   $0x11,-0xc(%rbp)
jmp    11c3 <completion_code+0xc3>
movl   $0x20,-0xc(%rbp)
jmp    11c3 <completion_code+0xc3>
movl   $0x40,-0xc(%rbp)
jmp    11c3 <completion_code+0xc3>
movl   $0x80,-0xc(%rbp)
jmp    11c3 <completion_code+0xc3>
movl   $0xaa,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<completion_code>:
movslq 0x30(%rdi),%rcx
mov    $0xff,%eax
cmp    $0x64,%rcx
ja     1119 <completion_code+0x19>
lea    0xeea(%rip),%rax
mov    (%rax,%rcx,4),%eax
ret

LLVM IR (-O0):
define i32 @completion_code(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 255, i32* %3
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 12
%6 = load i32, i32* %5
switch i32 %6, label %19 [
i32 0, label %7
i32 32, label %8
i32 36, label %8
i32 38, label %8
i32 75, label %8
i32 18, label %9
i32 33, label %9
i32 39, label %10
i32 20, label %11
i32 22, label %11
i32 48, label %12
i32 100, label %12
i32 16, label %13
i32 17, label %13
i32 23, label %14
i32 24, label %14
i32 1, label %15
i32 3, label %15
i32 5, label %15
i32 6, label %15
i32 7, label %15
i32 8, label %15
i32 9, label %15
i32 27, label %15
i32 28, label %15
i32 29, label %15
i32 64, label %15
i32 65, label %15
i32 66, label %15
i32 67, label %15
i32 68, label %15
i32 69, label %15
i32 70, label %15
i32 71, label %15
i32 72, label %15
i32 73, label %15
i32 21, label %16
i32 2, label %16
i32 37, label %17
i32 4, label %18
i32 40, label %18
i32 41, label %18
i32 42, label %18
i32 58, label %18
]
7: ; preds = %1
store i32 0, i32* %3
br label %19
8: ; preds = %1, %1, %1, %1
store i32 1, i32* %3
br label %19
9: ; preds = %1, %1
store i32 2, i32* %3
br label %19
10: ; preds = %1
store i32 3, i32* %3
br label %19
11: ; preds = %1, %1
store i32 4, i32* %3
br label %19
12: ; preds = %1, %1
store i32 12, i32* %3
br label %19
13: ; preds = %1, %1
store i32 16, i32* %3
br label %19
14: ; preds = %1, %1
store i32 17, i32* %3
br label %19
15: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
store i32 32, i32* %3
br label %19
16: ; preds = %1, %1
store i32 64, i32* %3
br label %19
17: ; preds = %1
store i32 128, i32* %3
br label %19
18: ; preds = %1, %1, %1, %1, %1
store i32 170, i32* %3
br label %19
19: ; preds = %1, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@switch.table.completion_code = [101 x i32] [i32 0, i32 32, i32 64, i32 32, i32 170, i32 32, i32 32, i32 32, i32 32, i32 32, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 16, i32 16, i32 2, i32 255, i32 4, i32 64, i32 4, i32 17, i32 17, i32 255, i32 255, i32 32, i32 32, i32 32, i32 255, i32 255, i32 1, i32 2, i32 255, i32 255, i32 1, i32 128, i32 1, i32 3, i32 170, i32 170, i32 170, i32 255, i32 255, i32 255, i32 255, i32 255, i32 12, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 170, i32 255, i32 255, i32 255, i32 255, i32 255, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 255, i32 1, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 12]
define i32 @completion_code(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 12
%3 = load i32, i32* %2
%4 = icmp ult i32 %3, 101
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [101 x i32], [101 x i32]* @switch.table.completion_code, i64 0, i64 %6
%8 = load i32, i32* %7
br label %9
9: ; preds = %5, %1
%10 = phi i32 [ 255, %1 ], [ %8, %5 ]
ret i32 %10
}