char biosal_dna_helper_normalize_nucleotide(char nucleotide) {
  char default_value;
  default_value = 'A';
  switch (nucleotide) {
  case 't':
    return 'T';
  case 'a':
    return 'A';
  case 'g':
    return 'G';
  case 'c':
    return 'C';
  case 'T':
    return 'T';
  case 'A':
    return 'A';
  case 'G':
    return 'G';
  case 'C':
    return 'C';
  case 'n':
    return default_value;
  case '.':
    return default_value;
  default:
    return default_value;
  }
  return default_value;
}


x86 assembly (clang, -O0):
<biosal_dna_helper_normalize_nucleotide>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movb   $0x41,-0x3(%rbp)
movsbl -0x2(%rbp),%eax
add    $0xffffffd2,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x46,%eax
ja     1196 <biosal_dna_helper_normalize_nucleotide+0x96>
mov    -0x10(%rbp),%rax
lea    0xed1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x54,-0x1(%rbp)
jmp    119c <biosal_dna_helper_normalize_nucleotide+0x9c>
movb   $0x41,-0x1(%rbp)
jmp    119c <biosal_dna_helper_normalize_nucleotide+0x9c>
movb   $0x47,-0x1(%rbp)
jmp    119c <biosal_dna_helper_normalize_nucleotide+0x9c>
movb   $0x43,-0x1(%rbp)
jmp    119c <biosal_dna_helper_normalize_nucleotide+0x9c>
movb   $0x54,-0x1(%rbp)
jmp    119c <biosal_dna_helper_normalize_nucleotide+0x9c>
movb   $0x41,-0x1(%rbp)
jmp    119c <biosal_dna_helper_normalize_nucleotide+0x9c>
movb   $0x47,-0x1(%rbp)
jmp    119c <biosal_dna_helper_normalize_nucleotide+0x9c>
movb   $0x43,-0x1(%rbp)
jmp    119c <biosal_dna_helper_normalize_nucleotide+0x9c>
mov    -0x3(%rbp),%al
mov    %al,-0x1(%rbp)
jmp    119c <biosal_dna_helper_normalize_nucleotide+0x9c>
mov    -0x3(%rbp),%al
mov    %al,-0x1(%rbp)
jmp    119c <biosal_dna_helper_normalize_nucleotide+0x9c>
mov    -0x3(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<biosal_dna_helper_normalize_nucleotide>:
add    $0xffffffd2,%edi
cmp    $0x46,%edi
ja     111a <biosal_dna_helper_normalize_nucleotide+0x1a>
mov    $0x54,%al
lea    0xeef(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0x41,%al
ret
mov    $0x43,%al
ret
mov    $0x47,%al
ret

LLVM IR (-O0):
define signext i8 @biosal_dna_helper_normalize_nucleotide(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 65, i8* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
switch i32 %6, label %19 [
i32 116, label %7
i32 97, label %8
i32 103, label %9
i32 99, label %10
i32 84, label %11
i32 65, label %12
i32 71, label %13
i32 67, label %14
i32 110, label %15
i32 46, label %17
]
7: ; preds = %1
store i8 84, i8* %2
br label %21
8: ; preds = %1
store i8 65, i8* %2
br label %21
9: ; preds = %1
store i8 71, i8* %2
br label %21
10: ; preds = %1
store i8 67, i8* %2
br label %21
11: ; preds = %1
store i8 84, i8* %2
br label %21
12: ; preds = %1
store i8 65, i8* %2
br label %21
13: ; preds = %1
store i8 71, i8* %2
br label %21
14: ; preds = %1
store i8 67, i8* %2
br label %21
15: ; preds = %1
%16 = load i8, i8* %4
store i8 %16, i8* %2
br label %21
17: ; preds = %1
%18 = load i8, i8* %4
store i8 %18, i8* %2
br label %21
19: ; preds = %1
%20 = load i8, i8* %4
store i8 %20, i8* %2
br label %21
21: ; preds = %19, %17, %15, %14, %13, %12, %11, %10, %9, %8, %7
%22 = load i8, i8* %2
ret i8 %22
}

LLVM IR (-O2):
define signext i8 @biosal_dna_helper_normalize_nucleotide(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %11 [
i32 116, label %12
i32 97, label %3
i32 103, label %4
i32 99, label %5
i32 84, label %12
i32 65, label %6
i32 71, label %7
i32 67, label %8
i32 110, label %9
i32 46, label %10
]
3: ; preds = %1
br label %12
4: ; preds = %1
br label %12
5: ; preds = %1
br label %12
6: ; preds = %1
br label %12
7: ; preds = %1
br label %12
8: ; preds = %1
br label %12
9: ; preds = %1
br label %12
10: ; preds = %1
br label %12
11: ; preds = %1
br label %12
12: ; preds = %1, %1, %11, %10, %9, %8, %7, %6, %5, %4, %3
%13 = phi i8 [ 65, %11 ], [ 65, %10 ], [ 65, %9 ], [ 67, %8 ], [ 71, %7 ], [ 65, %6 ], [ 67, %5 ], [ 71, %4 ], [ 65, %3 ], [ 84, %1 ], [ 84, %1 ]
ret i8 %13
}