#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*/ exit(int);
int /*<<< orphan*/ printf(char *, char);
int base_to_n(char base) {
  int n = -1;
  switch (base) {
  case 'A':
  case 'a':
    n = 1;
    break;
  case 'C':
  case 'c':
    n = 2;
    break;
  case 'G':
  case 'g':
    n = 3;
    break;
  case 'T':
  case 't':
    n = 4;
    break;
  case 'N':
  case 'n':
    n = 5;
    break;
  default:
    printf("Error: Unknown base %c\n", base);
    exit(3);
    break;
  }
  return n;
}


x86 assembly (clang, -O0):
<base_to_n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0xffffffff,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x33,%eax
ja     119b <base_to_n+0x7b>
mov    -0x10(%rbp),%rax
lea    0xeaa(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x8(%rbp)
jmp    11b5 <base_to_n+0x95>
movl   $0x2,-0x8(%rbp)
jmp    11b5 <base_to_n+0x95>
movl   $0x3,-0x8(%rbp)
jmp    11b5 <base_to_n+0x95>
movl   $0x4,-0x8(%rbp)
jmp    11b5 <base_to_n+0x95>
movl   $0x5,-0x8(%rbp)
jmp    11b5 <base_to_n+0x95>
lea    0xf2e(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <exit@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<base_to_n>:
push   %rax
lea    -0x41(%rdi),%ecx
cmp    $0x33,%ecx
ja     115a <base_to_n+0x3a>
mov    $0x1,%eax
lea    0xecb(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x2,%eax
pop    %rcx
ret
mov    $0x3,%eax
pop    %rcx
ret
mov    $0x5,%eax
pop    %rcx
ret
mov    $0x4,%eax
pop    %rcx
ret
movsbl %dil,%esi
lea    0xf6b(%rip),%rdi
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Error: Unknown base %c\0A\00"
define i32 @base_to_n(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 -1, i32* %3
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
switch i32 %5, label %11 [
i32 65, label %6
i32 97, label %6
i32 67, label %7
i32 99, label %7
i32 71, label %8
i32 103, label %8
i32 84, label %9
i32 116, label %9
i32 78, label %10
i32 110, label %10
]
6: ; preds = %1, %1
store i32 1, i32* %3
br label %15
7: ; preds = %1, %1
store i32 2, i32* %3
br label %15
8: ; preds = %1, %1
store i32 3, i32* %3
br label %15
9: ; preds = %1, %1
store i32 4, i32* %3
br label %15
10: ; preds = %1, %1
store i32 5, i32* %3
br label %15
11: ; preds = %1
%12 = load i8, i8* %2
%13 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8 signext %12)
%14 = call i32 @exit(i32 3)
unreachable
15: ; preds = %10, %9, %8, %7, %6
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@.str = [24 x i8] c"Error: Unknown base %c\0A\00"
define i32 @base_to_n(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %7 [
i32 65, label %10
i32 97, label %10
i32 67, label %3
i32 99, label %3
i32 71, label %4
i32 103, label %4
i32 84, label %5
i32 116, label %5
i32 78, label %6
i32 110, label %6
]
3: ; preds = %1, %1
br label %10
4: ; preds = %1, %1
br label %10
5: ; preds = %1, %1
br label %10
6: ; preds = %1, %1
br label %10
7: ; preds = %1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8 signext %0)
%9 = tail call i32 @exit(i32 3)
unreachable
10: ; preds = %1, %1, %6, %5, %4, %3
%11 = phi i32 [ 5, %6 ], [ 4, %5 ], [ 3, %4 ], [ 2, %3 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %11
}