#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 encode_chrom(const char *chrom, size_t size) {
  static const uint8_t onecharmap[] = {
      0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      23, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 25,
      0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 23, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0,  0,  0, 0,
  };
  if ((size > 3) && ((chrom[0] == 'c') || (chrom[0] == 'C')) &&
      ((chrom[1] == 'h') || (chrom[1] == 'H')) &&
      ((chrom[2] == 'r') || (chrom[2] == 'R'))) {
    chrom += 3;
    size -= 3;
  }
  if (size == 0) {
    return 0;
  }
  if ((chrom[0] <= '9') && (chrom[0] >= '0')) {
    size_t i;
    uint8_t v = (chrom[0] - '0');
    for (i = 1; i < size; i++) {
      if ((chrom[i] > '9') || (chrom[i] < '0')) {
        return 0;
      }
      v = ((v * 10) + (chrom[i] - '0'));
    }
    return v;
  }
  if ((size == 1) ||
      ((size == 2) && ((chrom[1] == 'T') || (chrom[1] == 't')))) {
    return onecharmap[((uint8_t)chrom[0])];
  }
  return 0;
}


x86 assembly (clang, -O0):
<encode_chrom>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x3,-0x18(%rbp)
jbe    1193 <encode_chrom+0x93>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x63,%eax
je     1137 <encode_chrom+0x37>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x43,%eax
jne    1193 <encode_chrom+0x93>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x68,%eax
je     1159 <encode_chrom+0x59>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x48,%eax
jne    1193 <encode_chrom+0x93>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x72,%eax
je     117b <encode_chrom+0x7b>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x52,%eax
jne    1193 <encode_chrom+0x93>
mov    -0x10(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
sub    $0x3,%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11aa <encode_chrom+0xaa>
movl   $0x0,-0x4(%rbp)
jmp    12b2 <encode_chrom+0x1b2>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jg     1257 <encode_chrom+0x157>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     1257 <encode_chrom+0x157>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x24(%rbp)
movq   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    124c <encode_chrom+0x14c>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jg     1217 <encode_chrom+0x117>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jge    1223 <encode_chrom+0x123>
movl   $0x0,-0x4(%rbp)
jmp    12b2 <encode_chrom+0x1b2>
imul   $0xa,-0x24(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11df <encode_chrom+0xdf>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12b2 <encode_chrom+0x1b2>
cmpq   $0x1,-0x18(%rbp)
je     128f <encode_chrom+0x18f>
cmpq   $0x2,-0x18(%rbp)
jne    12ab <encode_chrom+0x1ab>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x54,%eax
je     128f <encode_chrom+0x18f>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x74,%eax
jne    12ab <encode_chrom+0x1ab>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movslq %eax,%rcx
lea    0xd60(%rip),%rax
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4(%rbp)
jmp    12b2 <encode_chrom+0x1b2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<encode_chrom>:
cmp    $0x4,%rsi
jb     112a <encode_chrom+0x2a>
mov    (%rdi),%al
or     $0x20,%al
cmp    $0x63,%al
jne    112f <encode_chrom+0x2f>
mov    0x1(%rdi),%al
or     $0x20,%al
cmp    $0x68,%al
jne    112f <encode_chrom+0x2f>
mov    0x2(%rdi),%al
or     $0x20,%al
cmp    $0x72,%al
jne    112f <encode_chrom+0x2f>
add    $0x3,%rdi
add    $0xfffffffffffffffd,%rsi
jmp    112f <encode_chrom+0x2f>
test   %rsi,%rsi
je     119c <encode_chrom+0x9c>
movzbl (%rdi),%ecx
lea    -0x30(%rcx),%eax
cmp    $0x9,%al
ja     1173 <encode_chrom+0x73>
add    $0xffffffd0,%ecx
cmp    $0x2,%rsi
jb     119f <encode_chrom+0x9f>
mov    $0x1,%edx
mov    %ecx,%eax
nopl   0x0(%rax)
movzbl (%rdi,%rdx,1),%r8d
lea    -0x3a(%r8),%ecx
cmp    $0xf6,%cl
jb     119c <encode_chrom+0x9c>
lea    (%rax,%rax,4),%eax
lea    (%r8,%rax,2),%eax
add    $0xffffffd0,%eax
add    $0x1,%rdx
cmp    %rdx,%rsi
jne    1150 <encode_chrom+0x50>
jmp    119b <encode_chrom+0x9b>
cmp    $0x1,%rsi
je     118c <encode_chrom+0x8c>
xor    %eax,%eax
cmp    $0x2,%rsi
jne    119b <encode_chrom+0x9b>
mov    0x1(%rdi),%dl
or     $0x20,%dl
cmp    $0x74,%dl
jne    119b <encode_chrom+0x9b>
movsbq %cl,%rax
lea    0xe69(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret
ret
xor    %eax,%eax
ret
mov    %ecx,%eax
ret

LLVM IR (-O0):
@encode_chrom.onecharmap = internal constant <{ [122 x i32], [134 x i32] }> <{ [122 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 25, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 23, i32 24, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 25, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 23, i32 24], [134 x i32] zeroinitializer }>
define i32 @encode_chrom(i8* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
store i8* %0, i8** %4
store i64 %1, i64* %5
%8 = load i64, i64* %5
%9 = icmp ugt i64 %8, 3
br i1 %9, label %10, label %51
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 99
br i1 %15, label %22, label %16
16: ; preds = %10
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 67
br i1 %21, label %22, label %51
22: ; preds = %16, %10
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i64 1
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 104
br i1 %27, label %34, label %28
28: ; preds = %22
%29 = load i8*, i8** %4
%30 = getelementptr inbounds i8, i8* %29, i64 1
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 72
br i1 %33, label %34, label %51
34: ; preds = %28, %22
%35 = load i8*, i8** %4
%36 = getelementptr inbounds i8, i8* %35, i64 2
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 114
br i1 %39, label %46, label %40
40: ; preds = %34
%41 = load i8*, i8** %4
%42 = getelementptr inbounds i8, i8* %41, i64 2
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 82
br i1 %45, label %46, label %51
46: ; preds = %40, %34
%47 = load i8*, i8** %4
%48 = getelementptr inbounds i8, i8* %47, i64 3
store i8* %48, i8** %4
%49 = load i64, i64* %5
%50 = sub i64 %49, 3
store i64 %50, i64* %5
br label %51
51: ; preds = %46, %40, %28, %16, %2
%52 = load i64, i64* %5
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %55
54: ; preds = %51
store i32 0, i32* %3
br label %134
55: ; preds = %51
%56 = load i8*, i8** %4
%57 = getelementptr inbounds i8, i8* %56, i64 0
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = icmp sle i32 %59, 57
br i1 %60, label %61, label %107
61: ; preds = %55
%62 = load i8*, i8** %4
%63 = getelementptr inbounds i8, i8* %62, i64 0
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp sge i32 %65, 48
br i1 %66, label %67, label %107
67: ; preds = %61
%68 = load i8*, i8** %4
%69 = getelementptr inbounds i8, i8* %68, i64 0
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = sub nsw i32 %71, 48
store i32 %72, i32* %7
store i64 1, i64* %6
br label %73
73: ; preds = %102, %67
%74 = load i64, i64* %6
%75 = load i64, i64* %5
%76 = icmp ult i64 %74, %75
br i1 %76, label %77, label %105
77: ; preds = %73
%78 = load i8*, i8** %4
%79 = load i64, i64* %6
%80 = getelementptr inbounds i8, i8* %78, i64 %79
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = icmp sgt i32 %82, 57
br i1 %83, label %91, label %84
84: ; preds = %77
%85 = load i8*, i8** %4
%86 = load i64, i64* %6
%87 = getelementptr inbounds i8, i8* %85, i64 %86
%88 = load i8, i8* %87
%89 = sext i8 %88 to i32
%90 = icmp slt i32 %89, 48
br i1 %90, label %91, label %92
91: ; preds = %84, %77
store i32 0, i32* %3
br label %134
92: ; preds = %84
%93 = load i32, i32* %7
%94 = mul nsw i32 %93, 10
%95 = load i8*, i8** %4
%96 = load i64, i64* %6
%97 = getelementptr inbounds i8, i8* %95, i64 %96
%98 = load i8, i8* %97
%99 = sext i8 %98 to i32
%100 = sub nsw i32 %99, 48
%101 = add nsw i32 %94, %100
store i32 %101, i32* %7
br label %102
102: ; preds = %92
%103 = load i64, i64* %6
%104 = add i64 %103, 1
store i64 %104, i64* %6
br label %73
105: ; preds = %73
%106 = load i32, i32* %7
store i32 %106, i32* %3
br label %134
107: ; preds = %61, %55
%108 = load i64, i64* %5
%109 = icmp eq i64 %108, 1
br i1 %109, label %125, label %110
110: ; preds = %107
%111 = load i64, i64* %5
%112 = icmp eq i64 %111, 2
br i1 %112, label %113, label %133
113: ; preds = %110
%114 = load i8*, i8** %4
%115 = getelementptr inbounds i8, i8* %114, i64 1
%116 = load i8, i8* %115
%117 = sext i8 %116 to i32
%118 = icmp eq i32 %117, 84
br i1 %118, label %125, label %119
119: ; preds = %113
%120 = load i8*, i8** %4
%121 = getelementptr inbounds i8, i8* %120, i64 1
%122 = load i8, i8* %121
%123 = sext i8 %122 to i32
%124 = icmp eq i32 %123, 116
br i1 %124, label %125, label %133
125: ; preds = %119, %113, %107
%126 = load i8*, i8** %4
%127 = getelementptr inbounds i8, i8* %126, i64 0
%128 = load i8, i8* %127
%129 = sext i8 %128 to i32
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds [256 x i32], [256 x i32]* bitcast (<{ [122 x i32], [134 x i32] }>* @encode_chrom.onecharmap to [256 x i32]*), i64 0, i64 %130
%132 = load i32, i32* %131
store i32 %132, i32* %3
br label %134
133: ; preds = %119, %110
store i32 0, i32* %3
br label %134
134: ; preds = %133, %125, %105, %91, %54
%135 = load i32, i32* %3
ret i32 %135
}

LLVM IR (-O2):
@encode_chrom.onecharmap = internal unnamed_addr constant <{ [122 x i32], [134 x i32] }> <{ [122 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 25, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 23, i32 24, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 25, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 23, i32 24], [134 x i32] zeroinitializer }>
define i32 @encode_chrom(i8* nocapture %0, i64 %1) {
%3 = icmp ugt i64 %1, 3
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = load i8, i8* %0
switch i8 %5, label %17 [
i8 99, label %6
i8 67, label %6
]
6: ; preds = %4, %4
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
switch i8 %8, label %17 [
i8 104, label %9
i8 72, label %9
]
9: ; preds = %6, %6
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
switch i8 %11, label %17 [
i8 114, label %12
i8 82, label %12
]
12: ; preds = %9, %9
%13 = getelementptr inbounds i8, i8* %0, i64 3
%14 = add i64 %1, -3
br label %17
15: ; preds = %2
%16 = icmp eq i64 %1, 0
br i1 %16, label %49, label %17
17: ; preds = %9, %6, %4, %12, %15
%18 = phi i64 [ %1, %15 ], [ %1, %9 ], [ %1, %6 ], [ %1, %4 ], [ %14, %12 ]
%19 = phi i8* [ %0, %15 ], [ %0, %9 ], [ %0, %6 ], [ %0, %4 ], [ %13, %12 ]
%20 = load i8, i8* %19
%21 = add i8 %20, -48
%22 = icmp ult i8 %21, 10
br i1 %22, label %23, label %41
23: ; preds = %17
%24 = zext i8 %20 to i32
%25 = add nsw i32 %24, -48
%26 = icmp ugt i64 %18, 1
br i1 %26, label %27, label %49
27: ; preds = %23, %34
%28 = phi i32 [ %38, %34 ], [ %25, %23 ]
%29 = phi i64 [ %39, %34 ], [ 1, %23 ]
%30 = getelementptr inbounds i8, i8* %19, i64 %29
%31 = load i8, i8* %30
%32 = add i8 %31, -58
%33 = icmp ult i8 %32, -10
br i1 %33, label %49, label %34
34: ; preds = %27
%35 = zext i8 %31 to i32
%36 = mul nsw i32 %28, 10
%37 = add i32 %36, -48
%38 = add i32 %37, %35
%39 = add nuw i64 %29, 1
%40 = icmp eq i64 %39, %18
br i1 %40, label %49, label %27
41: ; preds = %17
switch i64 %18, label %49 [
i64 1, label %45
i64 2, label %42
]
42: ; preds = %41
%43 = getelementptr inbounds i8, i8* %19, i64 1
%44 = load i8, i8* %43
switch i8 %44, label %49 [
i8 84, label %45
i8 116, label %45
]
45: ; preds = %42, %42, %41
%46 = sext i8 %20 to i64
%47 = getelementptr inbounds [256 x i32], [256 x i32]* bitcast (<{ [122 x i32], [134 x i32] }>* @encode_chrom.onecharmap to [256 x i32]*), i64 0, i64 %46
%48 = load i32, i32* %47
br label %49
49: ; preds = %34, %27, %23, %41, %42, %15, %45
%50 = phi i32 [ %48, %45 ], [ 0, %15 ], [ 0, %42 ], [ 0, %41 ], [ %25, %23 ], [ %38, %34 ], [ 0, %27 ]
ret i32 %50
}