void ReverseComplementSequence(char *text, int textsize) {
  int posleft, posright;
  char charleft, charright;
  for (posleft = 0, posright = (textsize - 1); posleft <= posright;
       posleft++, posright--) {
    charleft = text[posleft];
    charright = text[posright];
    if (charleft == 'A')
      charleft = 'T';
    else if (charleft == 'C')
      charleft = 'G';
    else if (charleft == 'G')
      charleft = 'C';
    else if (charleft == 'T')
      charleft = 'A';
    if (charright == 'A')
      charright = 'T';
    else if (charright == 'C')
      charright = 'G';
    else if (charright == 'G')
      charright = 'C';
    else if (charright == 'T')
      charright = 'A';
    text[posleft] = charright;
    text[posright] = charleft;
  }
}


x86 assembly (clang, -O0):
<ReverseComplementSequence>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     123a <ReverseComplementSequence+0x13a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x15(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x16(%rbp)
movsbl -0x15(%rbp),%eax
cmp    $0x41,%eax
jne    1159 <ReverseComplementSequence+0x59>
movb   $0x54,-0x15(%rbp)
jmp    11a5 <ReverseComplementSequence+0xa5>
movsbl -0x15(%rbp),%eax
cmp    $0x43,%eax
jne    116f <ReverseComplementSequence+0x6f>
movb   $0x47,-0x15(%rbp)
jmp    11a0 <ReverseComplementSequence+0xa0>
movsbl -0x15(%rbp),%eax
cmp    $0x47,%eax
jne    1185 <ReverseComplementSequence+0x85>
movb   $0x43,-0x15(%rbp)
jmp    119b <ReverseComplementSequence+0x9b>
movsbl -0x15(%rbp),%eax
cmp    $0x54,%eax
jne    1196 <ReverseComplementSequence+0x96>
movb   $0x41,-0x15(%rbp)
jmp    119b <ReverseComplementSequence+0x9b>
jmp    11a0 <ReverseComplementSequence+0xa0>
jmp    11a5 <ReverseComplementSequence+0xa5>
movsbl -0x16(%rbp),%eax
cmp    $0x41,%eax
jne    11bb <ReverseComplementSequence+0xbb>
movb   $0x54,-0x16(%rbp)
jmp    1207 <ReverseComplementSequence+0x107>
movsbl -0x16(%rbp),%eax
cmp    $0x43,%eax
jne    11d1 <ReverseComplementSequence+0xd1>
movb   $0x47,-0x16(%rbp)
jmp    1202 <ReverseComplementSequence+0x102>
movsbl -0x16(%rbp),%eax
cmp    $0x47,%eax
jne    11e7 <ReverseComplementSequence+0xe7>
movb   $0x43,-0x16(%rbp)
jmp    11fd <ReverseComplementSequence+0xfd>
movsbl -0x16(%rbp),%eax
cmp    $0x54,%eax
jne    11f8 <ReverseComplementSequence+0xf8>
movb   $0x41,-0x16(%rbp)
jmp    11fd <ReverseComplementSequence+0xfd>
jmp    1202 <ReverseComplementSequence+0x102>
jmp    1207 <ReverseComplementSequence+0x107>
mov    -0x16(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x15(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    111b <ReverseComplementSequence+0x1b>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReverseComplementSequence>:
test   %esi,%esi
jle    11b0 <ReverseComplementSequence+0xb0>
mov    %esi,%eax
add    $0xffffffffffffffff,%rax
xor    %ecx,%ecx
mov    $0x41,%r8d
jmp    113b <ReverseComplementSequence+0x3b>
nopl   0x0(%rax,%rax,1)
mov    $0x43,%r9b
mov    %r9b,(%rdi,%rcx,1)
mov    %sil,(%rdi,%rax,1)
add    $0x1,%rcx
lea    -0x1(%rax),%rdx
cmp    %rax,%rcx
mov    %rdx,%rax
jge    11b0 <ReverseComplementSequence+0xb0>
movzbl (%rdi,%rcx,1),%edx
mov    $0x54,%r9b
mov    $0x54,%sil
cmp    $0x41,%dl
je     117a <ReverseComplementSequence+0x7a>
cmp    $0x47,%dl
je     1160 <ReverseComplementSequence+0x60>
cmp    $0x43,%dl
jne    1170 <ReverseComplementSequence+0x70>
mov    $0x47,%sil
jmp    117a <ReverseComplementSequence+0x7a>
nopl   0x0(%rax)
mov    $0x43,%sil
jmp    117a <ReverseComplementSequence+0x7a>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0x54,%dl
movzbl %dl,%esi
cmove  %r8d,%esi
movzbl (%rdi,%rax,1),%edx
cmp    $0x41,%dl
je     1123 <ReverseComplementSequence+0x23>
cmp    $0x47,%dl
je     1120 <ReverseComplementSequence+0x20>
cmp    $0x43,%dl
jne    11a0 <ReverseComplementSequence+0xa0>
mov    $0x47,%r9b
jmp    1123 <ReverseComplementSequence+0x23>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x54,%dl
movzbl %dl,%r9d
cmove  %r8d,%r9d
jmp    1123 <ReverseComplementSequence+0x23>
ret

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

LLVM IR (-O2):
define void @ReverseComplementSequence(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %30
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %26
%7 = phi i64 [ 0, %4 ], [ %28, %26 ]
%8 = phi i64 [ %5, %4 ], [ %9, %26 ]
%9 = add nsw i64 %8, -1
%10 = getelementptr inbounds i8, i8* %0, i64 %7
%11 = load i8, i8* %10
%12 = getelementptr inbounds i8, i8* %0, i64 %9
%13 = load i8, i8* %12
switch i8 %11, label %16 [
i8 65, label %19
i8 67, label %14
i8 71, label %15
]
14: ; preds = %6
br label %19
15: ; preds = %6
br label %19
16: ; preds = %6
%17 = icmp eq i8 %11, 84
%18 = select i1 %17, i8 65, i8 %11
br label %19
19: ; preds = %6, %14, %16, %15
%20 = phi i8 [ 71, %14 ], [ 67, %15 ], [ %18, %16 ], [ 84, %6 ]
switch i8 %13, label %23 [
i8 65, label %26
i8 67, label %21
i8 71, label %22
]
21: ; preds = %19
br label %26
22: ; preds = %19
br label %26
23: ; preds = %19
%24 = icmp eq i8 %13, 84
%25 = select i1 %24, i8 65, i8 %13
br label %26
26: ; preds = %19, %21, %23, %22
%27 = phi i8 [ 71, %21 ], [ 67, %22 ], [ %25, %23 ], [ 84, %19 ]
store i8 %27, i8* %10
store i8 %20, i8* %12
%28 = add nuw nsw i64 %7, 1
%29 = icmp slt i64 %28, %9
br i1 %29, label %6, label %30
30: ; preds = %26, %2
ret void
}