#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 nt2int_rc(char);
int strlen(char *);
void get_rc_dna(char *dna, char *dna1) {
  char codon[5] = {'A', 'C', 'G', 'T', 'N'};
  int i;
  int dna_len = strlen(dna);
  for (i = 0; i < dna_len; i++) {
    dna1[dna_len - i - 1] = codon[nt2int_rc(dna[i])];
  }
}


x86 assembly (clang, -O0):
<get_rc_dna>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeca(%rip),%eax
mov    %eax,-0x15(%rbp)
mov    0xec5(%rip),%al
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1197 <get_rc_dna+0x77>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <nt2int_rc@plt>
mov    -0x15(%rbp,%rax,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1155 <get_rc_dna+0x35>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_rc_dna>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
test   %eax,%eax
jle    1171 <get_rc_dna+0x51>
mov    %eax,%ebx
mov    %eax,%r12d
add    $0xffffffff,%ebx
xor    %r13d,%r13d
lea    0xeb4(%rip),%rbp
nopl   0x0(%rax)
movsbl (%r15,%r13,1),%edi
call   1040 <nt2int_rc@plt>
movzbl (%rax,%rbp,1),%eax
movslq %ebx,%rbx
mov    %al,(%r14,%rbx,1)
add    $0x1,%r13
add    $0xffffffff,%ebx
cmp    %r13,%r12
jne    1150 <get_rc_dna+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@__const.get_rc_dna.codon = [5 x i8] c"ACGTN"
define void @get_rc_dna(i8* %0, i8* nocapture writeonly %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %21
5: ; preds = %2
%6 = zext i32 %3 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %19, %7 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = tail call i64 @nt2int_rc(i8 signext %10)
%12 = getelementptr inbounds [5 x i8], [5 x i8]* @__const.get_rc_dna.codon, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = trunc i64 %8 to i32
%15 = xor i32 %14, -1
%16 = add i32 %3, %15
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %1, i64 %17
store i8 %13, i8* %18
%19 = add nuw nsw i64 %8, 1
%20 = icmp eq i64 %19, %6
br i1 %20, label %21, label %7
21: ; preds = %7, %2
ret void
}