unsigned int encode_Nucleotide(char n1) {
  if (n1 == 'A' || n1 == 'a') {
    return 0;
  } else if (n1 == 'G' || n1 == 'g') {
    return 1;
  } else if (n1 == 'C' || n1 == 'c') {
    return 2;
  } else if (n1 == 'T' || n1 == 't') {
    return 3;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<encode_Nucleotide>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
je     1124 <encode_Nucleotide+0x24>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jne    1130 <encode_Nucleotide+0x30>
movl   $0x0,-0x4(%rbp)
jmp    11a9 <encode_Nucleotide+0xa9>
movsbl -0x5(%rbp),%eax
cmp    $0x47,%eax
je     114a <encode_Nucleotide+0x4a>
movsbl -0x5(%rbp),%eax
cmp    $0x67,%eax
jne    1156 <encode_Nucleotide+0x56>
movl   $0x1,-0x4(%rbp)
jmp    11a9 <encode_Nucleotide+0xa9>
movsbl -0x5(%rbp),%eax
cmp    $0x43,%eax
je     1170 <encode_Nucleotide+0x70>
movsbl -0x5(%rbp),%eax
cmp    $0x63,%eax
jne    117c <encode_Nucleotide+0x7c>
movl   $0x2,-0x4(%rbp)
jmp    11a9 <encode_Nucleotide+0xa9>
movsbl -0x5(%rbp),%eax
cmp    $0x54,%eax
je     1196 <encode_Nucleotide+0x96>
movsbl -0x5(%rbp),%eax
cmp    $0x74,%eax
jne    11a2 <encode_Nucleotide+0xa2>
movl   $0x3,-0x4(%rbp)
jmp    11a9 <encode_Nucleotide+0xa9>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<encode_Nucleotide>:
and    $0xdf,%dil
cmp    $0x41,%dil
je     111c <encode_Nucleotide+0x1c>
cmp    $0x43,%dil
je     111f <encode_Nucleotide+0x1f>
cmp    $0x47,%dil
jne    1125 <encode_Nucleotide+0x25>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret
mov    $0x2,%eax
ret
xor    %eax,%eax
cmp    $0x54,%dil
sete   %al
lea    (%rax,%rax,2),%eax
ret

LLVM IR (-O0):
define i32 @encode_Nucleotide(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
%6 = icmp eq i32 %5, 65
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 97
br i1 %10, label %11, label %12
11: ; preds = %7, %1
store i32 0, i32* %2
br label %40
12: ; preds = %7
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 71
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 103
br i1 %19, label %20, label %21
20: ; preds = %16, %12
store i32 1, i32* %2
br label %40
21: ; preds = %16
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 67
br i1 %24, label %29, label %25
25: ; preds = %21
%26 = load i8, i8* %3
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 99
br i1 %28, label %29, label %30
29: ; preds = %25, %21
store i32 2, i32* %2
br label %40
30: ; preds = %25
%31 = load i8, i8* %3
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 84
br i1 %33, label %38, label %34
34: ; preds = %30
%35 = load i8, i8* %3
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 116
br i1 %37, label %38, label %39
38: ; preds = %34, %30
store i32 3, i32* %2
br label %40
39: ; preds = %34
store i32 0, i32* %2
br label %40
40: ; preds = %39, %38, %29, %20, %11
%41 = load i32, i32* %2
ret i32 %41
}

LLVM IR (-O2):
define i32 @encode_Nucleotide(i8 signext %0) {
%2 = and i8 %0, -33
switch i8 %2, label %3 [
i8 65, label %8
i8 71, label %6
i8 67, label %7
]
3: ; preds = %1
%4 = icmp eq i8 %2, 84
%5 = select i1 %4, i32 3, i32 0
br label %8
6: ; preds = %1
br label %8
7: ; preds = %1
br label %8
8: ; preds = %1, %7, %6, %3
%9 = phi i32 [ 0, %1 ], [ %5, %3 ], [ 1, %6 ], [ 2, %7 ]
ret i32 %9
}