#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*/ printf(char *);
int nuc2num(char s) {
  switch (s) {
  case 'A':
    return 0;
  case 'a':
    return 0;
  case 'T':
    return 1;
  case 't':
    return 1;
  case 'C':
    return 2;
  case 'c':
    return 2;
  case 'G':
    return 3;
  case 'g':
    return 3;
  default:
    printf("Error happens in nuc2num(). Please check your input!\n");
    return -1;
  }
}


x86 assembly (clang, -O0):
<nuc2num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x33,%eax
ja     11a8 <nuc2num+0x98>
mov    -0x10(%rbp),%rax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    11bb <nuc2num+0xab>
movl   $0x0,-0x4(%rbp)
jmp    11bb <nuc2num+0xab>
movl   $0x1,-0x4(%rbp)
jmp    11bb <nuc2num+0xab>
movl   $0x1,-0x4(%rbp)
jmp    11bb <nuc2num+0xab>
movl   $0x2,-0x4(%rbp)
jmp    11bb <nuc2num+0xab>
movl   $0x2,-0x4(%rbp)
jmp    11bb <nuc2num+0xab>
movl   $0x3,-0x4(%rbp)
jmp    11bb <nuc2num+0xab>
movl   $0x3,-0x4(%rbp)
jmp    11bb <nuc2num+0xab>
lea    0xf21(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nuc2num>:
push   %rax
add    $0xffffffbf,%edi
cmp    $0x33,%edi
ja     1140 <nuc2num+0x30>
xor    %eax,%eax
lea    0xede(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0x2,%eax
pop    %rcx
ret
mov    $0x3,%eax
pop    %rcx
ret
mov    $0x1,%eax
pop    %rcx
ret
lea    0xf89(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [54 x i8] c"Error happens in nuc2num(). Please check your input!\0A\00"
define i32 @nuc2num(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %14 [
i32 65, label %6
i32 97, label %7
i32 84, label %8
i32 116, label %9
i32 67, label %10
i32 99, label %11
i32 71, label %12
i32 103, label %13
]
6: ; preds = %1
store i32 0, i32* %2
br label %16
7: ; preds = %1
store i32 0, i32* %2
br label %16
8: ; preds = %1
store i32 1, i32* %2
br label %16
9: ; preds = %1
store i32 1, i32* %2
br label %16
10: ; preds = %1
store i32 2, i32* %2
br label %16
11: ; preds = %1
store i32 2, i32* %2
br label %16
12: ; preds = %1
store i32 3, i32* %2
br label %16
13: ; preds = %1
store i32 3, i32* %2
br label %16
14: ; preds = %1
%15 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %16
16: ; preds = %14, %13, %12, %11, %10, %9, %8, %7, %6
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@str = [53 x i8] c"Error happens in nuc2num(). Please check your input!\00"
define i32 @nuc2num(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %9 [
i32 65, label %11
i32 97, label %11
i32 84, label %3
i32 116, label %4
i32 67, label %5
i32 99, label %6
i32 71, label %7
i32 103, label %8
]
3: ; preds = %1
br label %11
4: ; preds = %1
br label %11
5: ; preds = %1
br label %11
6: ; preds = %1
br label %11
7: ; preds = %1
br label %11
8: ; preds = %1
br label %11
9: ; preds = %1
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %1, %1, %9, %8, %7, %6, %5, %4, %3
%12 = phi i32 [ -1, %9 ], [ 3, %8 ], [ 3, %7 ], [ 2, %6 ], [ 2, %5 ], [ 1, %4 ], [ 1, %3 ], [ 0, %1 ], [ 0, %1 ]
ret i32 %12
}