#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 */
char *init_complement_ascii();
scalar_t__ malloc(int);
int strlen(char *);
char *GetReverseComplement(char *original) {
  static char *Complementascii = NULL;
  char *sourceptr, *destinptr;
  int length;
  char *buffer;
  if (Complementascii == NULL) {
    Complementascii = init_complement_ascii();
    if (NULL == Complementascii)
      return NULL;
  }
  length = strlen(original);
  buffer = (char *)malloc(sizeof(char) * (length + 1));
  if (buffer == NULL) {
    return NULL;
  }
  sourceptr = original;
  destinptr = buffer + length;
  *destinptr = '\0';
  destinptr--;
  while (*sourceptr != '\0') {
    (*destinptr) = Complementascii[(*sourceptr)];
    destinptr--;
    sourceptr++;
  }
  return buffer;
}


x86 assembly (clang, -O0):
<GetReverseComplement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,0x2efc(%rip)
jne    1179 <GetReverseComplement+0x49>
mov    $0x0,%al
call   1050 <init_complement_ascii@plt>
mov    %rax,0x2ee8(%rip)
xor    %eax,%eax
cmp    0x2edf(%rip),%rax
jne    1174 <GetReverseComplement+0x44>
movq   $0x0,-0x8(%rbp)
jmp    122b <GetReverseComplement+0xfb>
jmp    1179 <GetReverseComplement+0x49>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11b4 <GetReverseComplement+0x84>
movq   $0x0,-0x8(%rbp)
jmp    122b <GetReverseComplement+0xfb>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1223 <GetReverseComplement+0xf3>
mov    0x2e4b(%rip),%rax
mov    -0x18(%rbp),%rcx
movsbq (%rcx),%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11de <GetReverseComplement+0xae>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetReverseComplement>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
cmpq   $0x0,0x2f00(%rip)
jne    1158 <GetReverseComplement+0x28>
xor    %r14d,%r14d
xor    %eax,%eax
call   1050 <init_complement_ascii@plt>
mov    %rax,0x2eed(%rip)
test   %rax,%rax
je     11b5 <GetReverseComplement+0x85>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%r15d
lea    0x1(%r15),%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     11b2 <GetReverseComplement+0x82>
mov    %rax,%r14
movslq %r15d,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    (%rbx),%al
test   %al,%al
je     11b5 <GetReverseComplement+0x85>
add    %r14,%rcx
add    $0xffffffffffffffff,%rcx
add    $0x1,%rbx
nopl   0x0(%rax)
mov    0x2ea9(%rip),%rdx
movsbq %al,%rax
movzbl (%rdx,%rax,1),%eax
mov    %al,(%rcx)
movzbl (%rbx),%eax
add    $0xffffffffffffffff,%rcx
add    $0x1,%rbx
test   %al,%al
jne    1190 <GetReverseComplement+0x60>
jmp    11b5 <GetReverseComplement+0x85>
xor    %r14d,%r14d
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@GetReverseComplement.Complementascii = internal global i8* null
define i8* @GetReverseComplement(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %3
%8 = load i8*, i8** @GetReverseComplement.Complementascii
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %16
10: ; preds = %1
%11 = call i8* (...) @init_complement_ascii()
store i8* %11, i8** @GetReverseComplement.Complementascii
%12 = load i8*, i8** @GetReverseComplement.Complementascii
%13 = icmp eq i8* null, %12
br i1 %13, label %14, label %15
14: ; preds = %10
store i8* null, i8** %2
br label %57
15: ; preds = %10
br label %16
16: ; preds = %15, %1
%17 = load i8*, i8** %3
%18 = call i32 @strlen(i8* %17)
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = mul i64 1, %21
%23 = trunc i64 %22 to i32
%24 = call i64 @malloc(i32 %23)
%25 = inttoptr i64 %24 to i8*
store i8* %25, i8** %7
%26 = load i8*, i8** %7
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %29
28: ; preds = %16
store i8* null, i8** %2
br label %57
29: ; preds = %16
%30 = load i8*, i8** %3
store i8* %30, i8** %4
%31 = load i8*, i8** %7
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
store i8* %34, i8** %5
%35 = load i8*, i8** %5
store i8 0, i8* %35
%36 = load i8*, i8** %5
%37 = getelementptr inbounds i8, i8* %36, i32 -1
store i8* %37, i8** %5
br label %38
38: ; preds = %43, %29
%39 = load i8*, i8** %4
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %55
43: ; preds = %38
%44 = load i8*, i8** @GetReverseComplement.Complementascii
%45 = load i8*, i8** %4
%46 = load i8, i8* %45
%47 = sext i8 %46 to i64
%48 = getelementptr inbounds i8, i8* %44, i64 %47
%49 = load i8, i8* %48
%50 = load i8*, i8** %5
store i8 %49, i8* %50
%51 = load i8*, i8** %5
%52 = getelementptr inbounds i8, i8* %51, i32 -1
store i8* %52, i8** %5
%53 = load i8*, i8** %4
%54 = getelementptr inbounds i8, i8* %53, i32 1
store i8* %54, i8** %4
br label %38
55: ; preds = %38
%56 = load i8*, i8** %7
store i8* %56, i8** %2
br label %57
57: ; preds = %55, %28, %14
%58 = load i8*, i8** %2
ret i8* %58
}

LLVM IR (-O2):
@GetReverseComplement.Complementascii = internal unnamed_addr global i8* null
define i8* @GetReverseComplement(i8* %0) {
%2 = load i8*, i8** @GetReverseComplement.Complementascii
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i8* (...) @init_complement_ascii()
store i8* %5, i8** @GetReverseComplement.Complementascii
%6 = icmp eq i8* %5, null
br i1 %6, label %30, label %7
7: ; preds = %4, %1
%8 = tail call i32 @strlen(i8* %0)
%9 = add nsw i32 %8, 1
%10 = tail call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i8*
%12 = icmp eq i64 %10, 0
br i1 %12, label %30, label %13
13: ; preds = %7
%14 = sext i32 %8 to i64
%15 = getelementptr inbounds i8, i8* %11, i64 %14
store i8 0, i8* %15
%16 = load i8, i8* %0
%17 = icmp eq i8 %16, 0
br i1 %17, label %30, label %18
18: ; preds = %13, %18
%19 = phi i8 [ %28, %18 ], [ %16, %13 ]
%20 = phi i8* [ %22, %18 ], [ %15, %13 ]
%21 = phi i8* [ %27, %18 ], [ %0, %13 ]
%22 = getelementptr inbounds i8, i8* %20, i64 -1
%23 = load i8*, i8** @GetReverseComplement.Complementascii
%24 = sext i8 %19 to i64
%25 = getelementptr inbounds i8, i8* %23, i64 %24
%26 = load i8, i8* %25
store i8 %26, i8* %22
%27 = getelementptr inbounds i8, i8* %21, i64 1
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 0
br i1 %29, label %30, label %18
30: ; preds = %18, %13, %7, %4
%31 = phi i8* [ null, %4 ], [ null, %7 ], [ %11, %13 ], [ %11, %18 ]
ret i8* %31
}