#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*/ StrUtil_reverseString(char *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char);
int /*<<< orphan*/ stderr;
int toupper(char);
char *SeqUtil_reverseComplement(char *seqStr, int lenSeqStr) {
  int i;
  StrUtil_reverseString(seqStr, lenSeqStr);
  for (i = 0; i < lenSeqStr; i++) {
    switch (toupper(seqStr[i])) {
    case 'A':
      seqStr[i] = 'T';
      break;
    case 'C':
      seqStr[i] = 'G';
      break;
    case 'G':
      seqStr[i] = 'C';
      break;
    case 'T':
      seqStr[i] = 'A';
      break;
    case 'N':
      seqStr[i] = 'N';
      break;
    case 'R':
      seqStr[i] = 'Y';
      break;
    case 'Y':
      seqStr[i] = 'R';
      break;
    case 'M':
      seqStr[i] = 'K';
      break;
    case 'K':
      seqStr[i] = 'M';
      break;
    case 'S':
      seqStr[i] = 'W';
      break;
    case 'W':
      seqStr[i] = 'S';
      break;
    case 'H':
      seqStr[i] = 'D';
      break;
    case 'D':
      seqStr[i] = 'H';
      break;
    case 'B':
      seqStr[i] = 'V';
      break;
    case 'V':
      seqStr[i] = 'B';
      break;
    default:
      fprintf(stderr, "ERROR: Failed reverse complementing char = %c\n",
              seqStr[i]);
      return NULL;
    }
  }
  return seqStr;
}


x86 assembly (clang, -O0):
<SeqUtil_reverseComplement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <StrUtil_reverseString@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12d5 <SeqUtil_reverseComplement+0x1a5>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x18,%eax
ja     1294 <SeqUtil_reverseComplement+0x164>
mov    -0x20(%rbp),%rax
lea    0xe74(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x54,(%rax,%rcx,1)
jmp    12c2 <SeqUtil_reverseComplement+0x192>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x47,(%rax,%rcx,1)
jmp    12c2 <SeqUtil_reverseComplement+0x192>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x43,(%rax,%rcx,1)
jmp    12c2 <SeqUtil_reverseComplement+0x192>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x41,(%rax,%rcx,1)
jmp    12c2 <SeqUtil_reverseComplement+0x192>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x4e,(%rax,%rcx,1)
jmp    12c2 <SeqUtil_reverseComplement+0x192>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x59,(%rax,%rcx,1)
jmp    12c2 <SeqUtil_reverseComplement+0x192>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x52,(%rax,%rcx,1)
jmp    12c2 <SeqUtil_reverseComplement+0x192>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x4b,(%rax,%rcx,1)
jmp    12c2 <SeqUtil_reverseComplement+0x192>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x4d,(%rax,%rcx,1)
jmp    12c2 <SeqUtil_reverseComplement+0x192>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x57,(%rax,%rcx,1)
jmp    12c2 <SeqUtil_reverseComplement+0x192>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x53,(%rax,%rcx,1)
jmp    12c2 <SeqUtil_reverseComplement+0x192>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x44,(%rax,%rcx,1)
jmp    12c2 <SeqUtil_reverseComplement+0x192>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x48,(%rax,%rcx,1)
jmp    12c2 <SeqUtil_reverseComplement+0x192>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x56,(%rax,%rcx,1)
jmp    12c2 <SeqUtil_reverseComplement+0x192>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x42,(%rax,%rcx,1)
jmp    12c2 <SeqUtil_reverseComplement+0x192>
mov    0x2d45(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
lea    0xdb8(%rip),%rsi
movsbl (%rax,%rcx,1),%edx
call   1040 <fprintf@plt>
movq   $0x0,-0x8(%rbp)
jmp    12dd <SeqUtil_reverseComplement+0x1ad>
jmp    12c7 <SeqUtil_reverseComplement+0x197>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1152 <SeqUtil_reverseComplement+0x22>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SeqUtil_reverseComplement>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%ebp
mov    %rdi,%rbx
call   1050 <StrUtil_reverseString@plt>
test   %ebp,%ebp
jle    11a7 <SeqUtil_reverseComplement+0x77>
mov    %ebp,%r14d
xor    %ebp,%ebp
mov    $0x16e34cf,%r15d
lea    0xed7(%rip),%r12
nopl   0x0(%rax,%rax,1)
movsbl (%rbx,%rbp,1),%edi
call   1030 <toupper@plt>
add    $0xffffffbf,%eax
cmp    $0x19,%eax
jae    118c <SeqUtil_reverseComplement+0x5c>
bt     %eax,%r15d
jae    118c <SeqUtil_reverseComplement+0x5c>
cltq
movzbl (%rax,%r12,1),%eax
mov    %al,(%rbx,%rbp,1)
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1160 <SeqUtil_reverseComplement+0x30>
jmp    11a7 <SeqUtil_reverseComplement+0x77>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
movsbl (%rbx,%rbp,1),%edx
lea    0xe60(%rip),%rsi
call   1040 <fprintf@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [47 x i8] c"ERROR: Failed reverse complementing char = %c\0A\00"
define i8* @SeqUtil_reverseComplement(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = call i32 @StrUtil_reverseString(i8* %7, i32 %8)
store i32 0, i32* %6
br label %10
10: ; preds = %105, %2
%11 = load i32, i32* %6
%12 = load i32, i32* %5
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %108
14: ; preds = %10
%15 = load i8*, i8** %4
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = call i32 @toupper(i8 signext %19)
switch i32 %20, label %96 [
i32 65, label %21
i32 67, label %26
i32 71, label %31
i32 84, label %36
i32 78, label %41
i32 82, label %46
i32 89, label %51
i32 77, label %56
i32 75, label %61
i32 83, label %66
i32 87, label %71
i32 72, label %76
i32 68, label %81
i32 66, label %86
i32 86, label %91
]
21: ; preds = %14
%22 = load i8*, i8** %4
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
store i8 84, i8* %25
br label %104
26: ; preds = %14
%27 = load i8*, i8** %4
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
store i8 71, i8* %30
br label %104
31: ; preds = %14
%32 = load i8*, i8** %4
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
store i8 67, i8* %35
br label %104
36: ; preds = %14
%37 = load i8*, i8** %4
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
store i8 65, i8* %40
br label %104
41: ; preds = %14
%42 = load i8*, i8** %4
%43 = load i32, i32* %6
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
store i8 78, i8* %45
br label %104
46: ; preds = %14
%47 = load i8*, i8** %4
%48 = load i32, i32* %6
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %47, i64 %49
store i8 89, i8* %50
br label %104
51: ; preds = %14
%52 = load i8*, i8** %4
%53 = load i32, i32* %6
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8, i8* %52, i64 %54
store i8 82, i8* %55
br label %104
56: ; preds = %14
%57 = load i8*, i8** %4
%58 = load i32, i32* %6
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %57, i64 %59
store i8 75, i8* %60
br label %104
61: ; preds = %14
%62 = load i8*, i8** %4
%63 = load i32, i32* %6
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8, i8* %62, i64 %64
store i8 77, i8* %65
br label %104
66: ; preds = %14
%67 = load i8*, i8** %4
%68 = load i32, i32* %6
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8, i8* %67, i64 %69
store i8 87, i8* %70
br label %104
71: ; preds = %14
%72 = load i8*, i8** %4
%73 = load i32, i32* %6
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8, i8* %72, i64 %74
store i8 83, i8* %75
br label %104
76: ; preds = %14
%77 = load i8*, i8** %4
%78 = load i32, i32* %6
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8, i8* %77, i64 %79
store i8 68, i8* %80
br label %104
81: ; preds = %14
%82 = load i8*, i8** %4
%83 = load i32, i32* %6
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i8, i8* %82, i64 %84
store i8 72, i8* %85
br label %104
86: ; preds = %14
%87 = load i8*, i8** %4
%88 = load i32, i32* %6
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i8, i8* %87, i64 %89
store i8 86, i8* %90
br label %104
91: ; preds = %14
%92 = load i8*, i8** %4
%93 = load i32, i32* %6
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i8, i8* %92, i64 %94
store i8 66, i8* %95
br label %104
96: ; preds = %14
%97 = load i32, i32* @stderr
%98 = load i8*, i8** %4
%99 = load i32, i32* %6
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i8, i8* %98, i64 %100
%102 = load i8, i8* %101
%103 = call i32 @fprintf(i32 %97, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8 signext %102)
store i8* null, i8** %3
br label %110
104: ; preds = %91, %86, %81, %76, %71, %66, %61, %56, %51, %46, %41, %36, %31, %26, %21
br label %105
105: ; preds = %104
%106 = load i32, i32* %6
%107 = add nsw i32 %106, 1
store i32 %107, i32* %6
br label %10
108: ; preds = %10
%109 = load i8*, i8** %4
store i8* %109, i8** %3
br label %110
110: ; preds = %108, %96
%111 = load i8*, i8** %3
ret i8* %111
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [47 x i8] c"ERROR: Failed reverse complementing char = %c\0A\00"
@switch.table.SeqUtil_reverseComplement = [25 x i8] c"TVGHTTCDTTMTKNTTTYWATBSTR"
define i8* @SeqUtil_reverseComplement(i8* %0, i32 %1) {
%3 = tail call i32 @StrUtil_reverseString(i8* %0, i32 %1)
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %28
5: ; preds = %2
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %22
%8 = phi i64 [ 0, %5 ], [ %26, %22 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = tail call i32 @toupper(i8 signext %10)
%12 = add i32 %11, -65
%13 = icmp ult i32 %12, 25
br i1 %13, label %18, label %14
14: ; preds = %18, %7
%15 = load i32, i32* @stderr
%16 = load i8, i8* %9
%17 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8 signext %16)
br label %28
18: ; preds = %7
%19 = lshr i32 23999695, %12
%20 = and i32 %19, 1
%21 = icmp eq i32 %20, 0
br i1 %21, label %14, label %22
22: ; preds = %18
%23 = sext i32 %12 to i64
%24 = getelementptr inbounds [25 x i8], [25 x i8]* @switch.table.SeqUtil_reverseComplement, i64 0, i64 %23
%25 = load i8, i8* %24
store i8 %25, i8* %9
%26 = add nuw nsw i64 %8, 1
%27 = icmp eq i64 %26, %6
br i1 %27, label %28, label %7
28: ; preds = %22, %2, %14
%29 = phi i8* [ null, %14 ], [ %0, %2 ], [ %0, %22 ]
ret i8* %29
}