#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 /*<<< orphan*/ assert(int /*<<< orphan*/);
void mapCharToCodeBIN(unsigned int *code, unsigned int *valid, char in) {
  switch (in) {
  case '0':
    *code = 0u;
    *valid = 1u;
    break;
  case '1':
    *code = 1u;
    *valid = 1u;
    break;
  case '-':
    *code = 2u;
    *valid = 0u;
    break;
  case 'N':
    *code = 2u;
    *valid = 0u;
    break;
  default:
    assert(0);
  }
}


x86 assembly (clang, -O0):
<mapCharToCodeBIN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
add    $0xffffffd3,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x21,%eax
ja     11b3 <mapCharToCodeBIN+0xa3>
mov    -0x20(%rbp),%rax
lea    0xeba(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    11ba <mapCharToCodeBIN+0xaa>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    11ba <mapCharToCodeBIN+0xaa>
mov    -0x8(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
jmp    11ba <mapCharToCodeBIN+0xaa>
mov    -0x8(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
jmp    11ba <mapCharToCodeBIN+0xaa>
xor    %edi,%edi
call   1030 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mapCharToCodeBIN>:
add    $0xffffffd3,%edx
cmp    $0x21,%edx
ja     1135 <mapCharToCodeBIN+0x25>
lea    0xee1(%rip),%rax
movslq (%rax,%rdx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
movl   $0x2,(%rdi)
movl   $0x0,(%rsi)
ret
xor    %edi,%edi
jmp    1030 <assert@plt>
movl   $0x0,(%rdi)
movl   $0x1,(%rsi)
ret
movl   $0x1,(%rdi)
movl   $0x1,(%rsi)
ret

LLVM IR (-O0):
define void @mapCharToCodeBIN(i32* %0, i32* %1, i8 signext %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i8
store i32* %0, i32** %4
store i32* %1, i32** %5
store i8 %2, i8* %6
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
switch i32 %8, label %21 [
i32 48, label %9
i32 49, label %12
i32 45, label %15
i32 78, label %18
]
9: ; preds = %3
%10 = load i32*, i32** %4
store i32 0, i32* %10
%11 = load i32*, i32** %5
store i32 1, i32* %11
br label %23
12: ; preds = %3
%13 = load i32*, i32** %4
store i32 1, i32* %13
%14 = load i32*, i32** %5
store i32 1, i32* %14
br label %23
15: ; preds = %3
%16 = load i32*, i32** %4
store i32 2, i32* %16
%17 = load i32*, i32** %5
store i32 0, i32* %17
br label %23
18: ; preds = %3
%19 = load i32*, i32** %4
store i32 2, i32* %19
%20 = load i32*, i32** %5
store i32 0, i32* %20
br label %23
21: ; preds = %3
%22 = call i32 @assert(i32 0)
br label %23
23: ; preds = %21, %18, %15, %12, %9
ret void
}

LLVM IR (-O2):
define void @mapCharToCodeBIN(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i8 signext %2) {
%4 = sext i8 %2 to i32
switch i32 %4, label %9 [
i32 48, label %5
i32 49, label %6
i32 45, label %7
i32 78, label %8
]
5: ; preds = %3
store i32 0, i32* %0
store i32 1, i32* %1
br label %11
6: ; preds = %3
store i32 1, i32* %0
store i32 1, i32* %1
br label %11
7: ; preds = %3
store i32 2, i32* %0
store i32 0, i32* %1
br label %11
8: ; preds = %3
store i32 2, i32* %0
store i32 0, i32* %1
br label %11
9: ; preds = %3
%10 = tail call i32 @assert(i32 0)
br label %11
11: ; preds = %9, %8, %7, %6, %5
ret void
}