#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 */
size_t strlen(char *);
void reverseComplementSequence(char *str) {
  size_t length = strlen(str);
  size_t i;
  for (i = 0; i < length - 1 - i; i++) {
    char c = str[i];
    str[i] = str[length - 1 - i];
    str[length - 1 - i] = c;
  }
  for (i = 0; i < length; i++) {
    switch (str[i]) {
    case 'A':
    case 'a':
      str[i] = 'T';
      break;
    case 'C':
    case 'c':
      str[i] = 'G';
      break;
    case 'G':
    case 'g':
      str[i] = 'C';
      break;
    default:
      str[i] = 'A';
      break;
    }
  }
}


x86 assembly (clang, -O0):
<reverseComplementSequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
sub    -0x18(%rbp),%rcx
cmp    %rcx,%rax
jae    119d <reverseComplementSequence+0x8d>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x19(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
sub    -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x19(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
sub    -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1131 <reverseComplementSequence+0x21>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    127a <reverseComplementSequence+0x16a>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x20(%rbp)
sub    $0x41,%eax
je     1225 <reverseComplementSequence+0x115>
jmp    11d0 <reverseComplementSequence+0xc0>
mov    -0x20(%rbp),%eax
sub    $0x43,%eax
je     1236 <reverseComplementSequence+0x126>
jmp    11e1 <reverseComplementSequence+0xd1>
mov    -0x20(%rbp),%eax
sub    $0x47,%eax
je     1247 <reverseComplementSequence+0x137>
jmp    11f2 <reverseComplementSequence+0xe2>
mov    -0x20(%rbp),%eax
sub    $0x61,%eax
je     1225 <reverseComplementSequence+0x115>
jmp    1203 <reverseComplementSequence+0xf3>
mov    -0x20(%rbp),%eax
sub    $0x63,%eax
je     1236 <reverseComplementSequence+0x126>
jmp    1214 <reverseComplementSequence+0x104>
mov    -0x20(%rbp),%eax
sub    $0x67,%eax
je     1247 <reverseComplementSequence+0x137>
jmp    1258 <reverseComplementSequence+0x148>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x54,(%rax,%rcx,1)
jmp    1264 <reverseComplementSequence+0x154>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x47,(%rax,%rcx,1)
jmp    1264 <reverseComplementSequence+0x154>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x43,(%rax,%rcx,1)
jmp    1264 <reverseComplementSequence+0x154>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x41,(%rax,%rcx,1)
jmp    1269 <reverseComplementSequence+0x159>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11a5 <reverseComplementSequence+0x95>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverseComplementSequence>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %rax,%rdi
add    $0xffffffffffffffff,%rdi
je     115d <reverseComplementSequence+0x4d>
mov    $0x1,%edx
mov    %rdi,%rsi
nopl   (%rax)
movzbl -0x1(%r14,%rdx,1),%ecx
movzbl (%r14,%rsi,1),%ebx
mov    %bl,-0x1(%r14,%rdx,1)
mov    %cl,(%r14,%rsi,1)
add    $0xffffffffffffffff,%rsi
lea    0x1(%rdx),%rcx
cmp    %rsi,%rdx
mov    %rcx,%rdx
jb     1130 <reverseComplementSequence+0x20>
test   %rax,%rax
je     1279 <reverseComplementSequence+0x169>
movabs $0x100000001,%r10
test   %rdi,%rdi
je     122e <reverseComplementSequence+0x11e>
mov    %rax,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %ecx,%ecx
movabs $0x400000004,%r9
movabs $0x4000000040,%r8
jmp    11a4 <reverseComplementSequence+0x94>
nop
mov    $0x47,%dl
mov    %dl,0x1(%r14,%rcx,1)
add    $0x2,%rcx
cmp    %rcx,%rsi
je     1230 <reverseComplementSequence+0x120>
movsbl (%r14,%rcx,1),%edi
add    $0xffffffbf,%edi
cmp    $0x26,%edi
ja     11e4 <reverseComplementSequence+0xd4>
bt     %rdi,%r10
jb     11e0 <reverseComplementSequence+0xd0>
bt     %rdi,%r9
jb     11d0 <reverseComplementSequence+0xc0>
bt     %rdi,%r8
jae    11e4 <reverseComplementSequence+0xd4>
mov    $0x43,%dl
jmp    11f0 <reverseComplementSequence+0xe0>
nopw   0x0(%rax,%rax,1)
mov    $0x47,%dl
jmp    11f0 <reverseComplementSequence+0xe0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x54,%dl
jmp    11f0 <reverseComplementSequence+0xe0>
mov    $0x41,%dl
cs nopw 0x0(%rax,%rax,1)
mov    %dl,(%r14,%rcx,1)
movsbl 0x1(%r14,%rcx,1),%edi
add    $0xffffffbf,%edi
cmp    $0x26,%edi
ja     1227 <reverseComplementSequence+0x117>
bt     %rdi,%r10
jb     1220 <reverseComplementSequence+0x110>
bt     %rdi,%r9
jb     1190 <reverseComplementSequence+0x80>
bt     %rdi,%r8
jae    1227 <reverseComplementSequence+0x117>
mov    $0x43,%dl
jmp    1192 <reverseComplementSequence+0x82>
nopl   0x0(%rax,%rax,1)
mov    $0x54,%dl
jmp    1192 <reverseComplementSequence+0x82>
mov    $0x41,%dl
jmp    1192 <reverseComplementSequence+0x82>
xor    %ecx,%ecx
test   $0x1,%al
je     1279 <reverseComplementSequence+0x169>
movsbl (%r14,%rcx,1),%eax
add    $0xffffffbf,%eax
cmp    $0x26,%eax
ja     1273 <reverseComplementSequence+0x163>
bt     %rax,%r10
jb     126f <reverseComplementSequence+0x15f>
movabs $0x400000004,%rdx
bt     %rax,%rdx
jb     126b <reverseComplementSequence+0x15b>
movabs $0x4000000040,%rdx
bt     %rax,%rdx
jae    1273 <reverseComplementSequence+0x163>
mov    $0x43,%al
jmp    1275 <reverseComplementSequence+0x165>
mov    $0x47,%al
jmp    1275 <reverseComplementSequence+0x165>
mov    $0x54,%al
jmp    1275 <reverseComplementSequence+0x165>
mov    $0x41,%al
mov    %al,(%r14,%rcx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @reverseComplementSequence(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, -1
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %12
5: ; preds = %12
%6 = icmp eq i64 %2, 0
br i1 %6, label %58, label %7
7: ; preds = %1, %5
%8 = and i64 %2, 1
%9 = icmp eq i64 %3, 0
br i1 %9, label %46, label %10
10: ; preds = %7
%11 = and i64 %2, -2
br label %23
12: ; preds = %1, %12
%13 = phi i64 [ %21, %12 ], [ %3, %1 ]
%14 = phi i64 [ %19, %12 ], [ 0, %1 ]
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = getelementptr inbounds i8, i8* %0, i64 %13
%18 = load i8, i8* %17
store i8 %18, i8* %15
store i8 %16, i8* %17
%19 = add nuw i64 %14, 1
%20 = sub nuw i64 -2, %14
%21 = add i64 %20, %2
%22 = icmp ult i64 %19, %21
br i1 %22, label %12, label %5
23: ; preds = %41, %10
%24 = phi i64 [ 0, %10 ], [ %43, %41 ]
%25 = phi i64 [ 0, %10 ], [ %44, %41 ]
%26 = getelementptr inbounds i8, i8* %0, i64 %24
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
switch i32 %28, label %31 [
i32 65, label %32
i32 97, label %32
i32 67, label %29
i32 99, label %29
i32 71, label %30
i32 103, label %30
]
29: ; preds = %23, %23
br label %32
30: ; preds = %23, %23
br label %32
31: ; preds = %23
br label %32
32: ; preds = %23, %23, %29, %30, %31
%33 = phi i8 [ 71, %29 ], [ 67, %30 ], [ 65, %31 ], [ 84, %23 ], [ 84, %23 ]
store i8 %33, i8* %26
%34 = or i64 %24, 1
%35 = getelementptr inbounds i8, i8* %0, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
switch i32 %37, label %40 [
i32 65, label %41
i32 97, label %41
i32 67, label %39
i32 99, label %39
i32 71, label %38
i32 103, label %38
]
38: ; preds = %32, %32
br label %41
39: ; preds = %32, %32
br label %41
40: ; preds = %32
br label %41
41: ; preds = %40, %39, %38, %32, %32
%42 = phi i8 [ 71, %39 ], [ 67, %38 ], [ 65, %40 ], [ 84, %32 ], [ 84, %32 ]
store i8 %42, i8* %35
%43 = add nuw i64 %24, 2
%44 = add i64 %25, 2
%45 = icmp eq i64 %44, %11
br i1 %45, label %46, label %23
46: ; preds = %41, %7
%47 = phi i64 [ 0, %7 ], [ %43, %41 ]
%48 = icmp eq i64 %8, 0
br i1 %48, label %58, label %49
49: ; preds = %46
%50 = getelementptr inbounds i8, i8* %0, i64 %47
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
switch i32 %52, label %55 [
i32 65, label %56
i32 97, label %56
i32 67, label %54
i32 99, label %54
i32 71, label %53
i32 103, label %53
]
53: ; preds = %49, %49
br label %56
54: ; preds = %49, %49
br label %56
55: ; preds = %49
br label %56
56: ; preds = %55, %54, %53, %49, %49
%57 = phi i8 [ 71, %54 ], [ 67, %53 ], [ 65, %55 ], [ 84, %49 ], [ 84, %49 ]
store i8 %57, i8* %50
br label %58
58: ; preds = %56, %46, %5
ret void
}