void reverse_transcribe(char *contig, char *s, int n) {
  int i;
  char c;
  for (i = n - 1; i > -1; i--) {
    if (*(contig + i) == 'A')
      c = 'T';
    else if (*(contig + i) == 'C')
      c = 'G';
    else if (*(contig + i) == 'G')
      c = 'C';
    else if (*(contig + i) == 'T')
      c = 'A';
    else
      c = 'N';
    *s++ = c;
  }
}


x86 assembly (clang, -O0):
<reverse_transcribe>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jle    11cf <reverse_transcribe+0xcf>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x41,%eax
jne    1140 <reverse_transcribe+0x40>
movb   $0x54,-0x19(%rbp)
jmp    11ad <reverse_transcribe+0xad>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x43,%eax
jne    115e <reverse_transcribe+0x5e>
movb   $0x47,-0x19(%rbp)
jmp    11a8 <reverse_transcribe+0xa8>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x47,%eax
jne    117c <reverse_transcribe+0x7c>
movb   $0x43,-0x19(%rbp)
jmp    11a3 <reverse_transcribe+0xa3>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x54,%eax
jne    119a <reverse_transcribe+0x9a>
movb   $0x41,-0x19(%rbp)
jmp    119e <reverse_transcribe+0x9e>
movb   $0x4e,-0x19(%rbp)
jmp    11a3 <reverse_transcribe+0xa3>
jmp    11a8 <reverse_transcribe+0xa8>
jmp    11ad <reverse_transcribe+0xad>
mov    -0x19(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1118 <reverse_transcribe+0x18>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse_transcribe>:
test   %edx,%edx
jle    114f <reverse_transcribe+0x4f>
mov    %edx,%eax
test   $0x1,%al
je     114a <reverse_transcribe+0x4a>
add    $0xffffffffffffffff,%rax
mov    %eax,%ecx
mov    (%rdi,%rcx,1),%cl
add    $0xbf,%cl
cmp    $0x13,%cl
ja     1136 <reverse_transcribe+0x36>
mov    $0x54,%r8b
movzbl %cl,%ecx
lea    0xed8(%rip),%r9
movslq (%r9,%rcx,4),%rcx
add    %r9,%rcx
jmp    *%rcx
mov    $0x47,%r8b
jmp    1143 <reverse_transcribe+0x43>
mov    $0x4e,%r8b
jmp    1143 <reverse_transcribe+0x43>
mov    $0x43,%r8b
jmp    1143 <reverse_transcribe+0x43>
mov    $0x41,%r8b
mov    %r8b,(%rsi)
add    $0x1,%rsi
cmp    $0x1,%edx
jne    1150 <reverse_transcribe+0x50>
ret
add    $0xfffffffffffffffe,%rax
lea    0xf45(%rip),%r8
lea    0xeee(%rip),%r9
jmp    1198 <reverse_transcribe+0x98>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x41,%cl
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %cl,0x1(%rsi)
lea    -0x2(%rax),%rcx
add    $0x1,%rax
add    $0x2,%rsi
cmp    $0x1,%rax
mov    %rcx,%rax
jbe    114f <reverse_transcribe+0x4f>
lea    0x1(%rax),%ecx
movzbl (%rdi,%rcx,1),%edx
add    $0xbf,%dl
cmp    $0x13,%dl
ja     11d4 <reverse_transcribe+0xd4>
mov    $0x54,%cl
movzbl %dl,%edx
movslq (%r9,%rdx,4),%rdx
add    %r9,%rdx
jmp    *%rdx
mov    $0x47,%cl
jmp    11e0 <reverse_transcribe+0xe0>
nopl   0x0(%rax)
mov    $0x43,%cl
jmp    11e0 <reverse_transcribe+0xe0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x41,%cl
jmp    11e0 <reverse_transcribe+0xe0>
mov    $0x4e,%cl
cs nopw 0x0(%rax,%rax,1)
mov    %cl,(%rsi)
mov    %eax,%ecx
movzbl (%rdi,%rcx,1),%edx
add    $0xbf,%dl
cmp    $0x13,%dl
ja     1217 <reverse_transcribe+0x117>
mov    $0x54,%cl
movzbl %dl,%edx
movslq (%r8,%rdx,4),%rdx
add    %r8,%rdx
jmp    *%rdx
mov    $0x47,%cl
jmp    1180 <reverse_transcribe+0x80>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x43,%cl
jmp    1180 <reverse_transcribe+0x80>
mov    $0x4e,%cl
jmp    1180 <reverse_transcribe+0x80>

LLVM IR (-O0):
define void @reverse_transcribe(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = sub nsw i32 %9, 1
store i32 %10, i32* %7
br label %11
11: ; preds = %58, %3
%12 = load i32, i32* %7
%13 = icmp sgt i32 %12, -1
br i1 %13, label %14, label %61
14: ; preds = %11
%15 = load i8*, i8** %4
%16 = load i32, i32* %7
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 65
br i1 %21, label %22, label %23
22: ; preds = %14
store i8 84, i8* %8
br label %54
23: ; preds = %14
%24 = load i8*, i8** %4
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 67
br i1 %30, label %31, label %32
31: ; preds = %23
store i8 71, i8* %8
br label %53
32: ; preds = %23
%33 = load i8*, i8** %4
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 71
br i1 %39, label %40, label %41
40: ; preds = %32
store i8 67, i8* %8
br label %52
41: ; preds = %32
%42 = load i8*, i8** %4
%43 = load i32, i32* %7
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 84
br i1 %48, label %49, label %50
49: ; preds = %41
store i8 65, i8* %8
br label %51
50: ; preds = %41
store i8 78, i8* %8
br label %51
51: ; preds = %50, %49
br label %52
52: ; preds = %51, %40
br label %53
53: ; preds = %52, %31
br label %54
54: ; preds = %53, %22
%55 = load i8, i8* %8
%56 = load i8*, i8** %5
%57 = getelementptr inbounds i8, i8* %56, i32 1
store i8* %57, i8** %5
store i8 %55, i8* %56
br label %58
58: ; preds = %54
%59 = load i32, i32* %7
%60 = add nsw i32 %59, -1
store i32 %60, i32* %7
br label %11
61: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @reverse_transcribe(i8* nocapture %0, i8* nocapture writeonly %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %51
5: ; preds = %3
%6 = zext i32 %2 to i64
%7 = and i64 %6, 1
%8 = icmp eq i64 %7, 0
br i1 %8, label %21, label %9
9: ; preds = %5
%10 = add nsw i64 %6, -1
%11 = and i64 %10, 4294967295
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
switch i8 %13, label %17 [
i8 65, label %18
i8 67, label %16
i8 71, label %15
i8 84, label %14
]
14: ; preds = %9
br label %18
15: ; preds = %9
br label %18
16: ; preds = %9
br label %18
17: ; preds = %9
br label %18
18: ; preds = %17, %16, %15, %14, %9
%19 = phi i8 [ 71, %16 ], [ 67, %15 ], [ 65, %14 ], [ 78, %17 ], [ 84, %9 ]
%20 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %19, i8* %1
br label %21
21: ; preds = %18, %5
%22 = phi i64 [ %6, %5 ], [ %10, %18 ]
%23 = phi i8* [ %1, %5 ], [ %20, %18 ]
%24 = icmp eq i32 %2, 1
br i1 %24, label %51, label %25
25: ; preds = %21, %47
%26 = phi i64 [ %39, %47 ], [ %22, %21 ]
%27 = phi i8* [ %49, %47 ], [ %23, %21 ]
%28 = add nsw i64 %26, -1
%29 = and i64 %28, 4294967295
%30 = getelementptr inbounds i8, i8* %0, i64 %29
%31 = load i8, i8* %30
switch i8 %31, label %35 [
i8 65, label %36
i8 67, label %32
i8 71, label %33
i8 84, label %34
]
32: ; preds = %25
br label %36
33: ; preds = %25
br label %36
34: ; preds = %25
br label %36
35: ; preds = %25
br label %36
36: ; preds = %25, %32, %34, %35, %33
%37 = phi i8 [ 71, %32 ], [ 67, %33 ], [ 65, %34 ], [ 78, %35 ], [ 84, %25 ]
%38 = getelementptr inbounds i8, i8* %27, i64 1
store i8 %37, i8* %27
%39 = add nsw i64 %26, -2
%40 = and i64 %39, 4294967295
%41 = getelementptr inbounds i8, i8* %0, i64 %40
%42 = load i8, i8* %41
switch i8 %42, label %46 [
i8 65, label %47
i8 67, label %45
i8 71, label %44
i8 84, label %43
]
43: ; preds = %36
br label %47
44: ; preds = %36
br label %47
45: ; preds = %36
br label %47
46: ; preds = %36
br label %47
47: ; preds = %46, %45, %44, %43, %36
%48 = phi i8 [ 71, %45 ], [ 67, %44 ], [ 65, %43 ], [ 78, %46 ], [ 84, %36 ]
%49 = getelementptr inbounds i8, i8* %27, i64 2
store i8 %48, i8* %38
%50 = icmp ugt i64 %28, 1
br i1 %50, label %25, label %51
51: ; preds = %21, %47, %3
ret void
}