#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 GetReverseComplimentAnyCaseBase(char);
void GetReverseComplimentAnyCase(char *s, char *r, int length) {
  int i;
  for (i = length - 1; i >= 0; i--) {
    r[i] = GetReverseComplimentAnyCaseBase(s[length - 1 - i]);
  }
  r[length] = '\0';
}


x86 assembly (clang, -O0):
<GetReverseComplimentAnyCase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     116a <GetReverseComplimentAnyCase+0x5a>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
sub    -0x18(%rbp),%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <GetReverseComplimentAnyCaseBase@plt>
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    112c <GetReverseComplimentAnyCase+0x1c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetReverseComplimentAnyCase>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
test   %edx,%edx
jle    115f <GetReverseComplimentAnyCase+0x4f>
mov    %edx,%r14d
add    $0xffffffff,%edx
lea    0x1(%r14),%rbx
sub    %r14,%rdx
lea    (%rdx,%rdi,1),%r12
add    $0x1,%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl (%r12),%edi
call   1030 <GetReverseComplimentAnyCaseBase@plt>
mov    %al,-0x2(%r15,%rbx,1)
add    $0xffffffffffffffff,%rbx
add    $0x1,%r12
cmp    $0x1,%rbx
ja     1140 <GetReverseComplimentAnyCase+0x30>
jmp    1162 <GetReverseComplimentAnyCase+0x52>
movslq %edx,%r14
movb   $0x0,(%r15,%r14,1)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @GetReverseComplimentAnyCase(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = sub nsw i32 %8, 1
store i32 %9, i32* %7
br label %10
10: ; preds = %27, %3
%11 = load i32, i32* %7
%12 = icmp sge i32 %11, 0
br i1 %12, label %13, label %30
13: ; preds = %10
%14 = load i8*, i8** %4
%15 = load i32, i32* %6
%16 = sub nsw i32 %15, 1
%17 = load i32, i32* %7
%18 = sub nsw i32 %16, %17
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %14, i64 %19
%21 = load i8, i8* %20
%22 = call signext i8 @GetReverseComplimentAnyCaseBase(i8 signext %21)
%23 = load i8*, i8** %5
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
store i8 %22, i8* %26
br label %27
27: ; preds = %13
%28 = load i32, i32* %7
%29 = add nsw i32 %28, -1
store i32 %29, i32* %7
br label %10
30: ; preds = %10
%31 = load i8*, i8** %5
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
store i8 0, i8* %34
ret void
}

LLVM IR (-O2):
define void @GetReverseComplimentAnyCase(i8* nocapture %0, i8* nocapture writeonly %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = sext i32 %2 to i64
br label %20
7: ; preds = %3
%8 = add nsw i32 %2, -1
%9 = zext i32 %2 to i64
%10 = zext i32 %8 to i64
br label %11
11: ; preds = %7, %11
%12 = phi i64 [ %9, %7 ], [ %13, %11 ]
%13 = add nsw i64 %12, -1
%14 = sub nuw nsw i64 %10, %13
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = tail call signext i8 @GetReverseComplimentAnyCaseBase(i8 signext %16)
%18 = getelementptr inbounds i8, i8* %1, i64 %13
store i8 %17, i8* %18
%19 = icmp ugt i64 %12, 1
br i1 %19, label %11, label %20
20: ; preds = %11, %5
%21 = phi i64 [ %6, %5 ], [ %9, %11 ]
%22 = getelementptr inbounds i8, i8* %1, i64 %21
store i8 0, i8* %22
ret void
}