#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 */
int /*<<< orphan*/ strcpy(char *, char *);
size_t strlen(char *);
char *palindrome_conversion(char *des, char *str) {
  size_t i = 0, j = 0;
  char temp;
  j = strlen(str) - 1;
  while (j > i) {
    temp = str[i];
    str[i] = str[j];
    str[j] = temp;
    j--;
    i++;
  }
  for (i = 0; i < strlen(str); i++) {
    switch (str[i]) {
    case 'C': {
      str[i] = 'G';
      break;
    }
    case 'G': {
      str[i] = 'C';
      break;
    }
    case 'T': {
      str[i] = 'A';
      break;
    }
    case 'A': {
      str[i] = 'T';
      break;
    }
    default:
      break;
    }
  }
  strcpy(des, str);
  return des;
}


x86 assembly (clang, -O0):
<palindrome_conversion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    11ae <palindrome_conversion+0x8e>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x21(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x21(%rbp),%dl
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1151 <palindrome_conversion+0x31>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
jae    1268 <palindrome_conversion+0x148>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x38(%rbp)
sub    $0x13,%eax
ja     124d <palindrome_conversion+0x12d>
mov    -0x38(%rbp),%rax
lea    0xe00(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x47,(%rax,%rcx,1)
jmp    1252 <palindrome_conversion+0x132>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x43,(%rax,%rcx,1)
jmp    1252 <palindrome_conversion+0x132>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x41,(%rax,%rcx,1)
jmp    1252 <palindrome_conversion+0x132>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x54,(%rax,%rcx,1)
jmp    1252 <palindrome_conversion+0x132>
jmp    1252 <palindrome_conversion+0x132>
jmp    1257 <palindrome_conversion+0x137>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11b6 <palindrome_conversion+0x96>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<palindrome_conversion>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
add    $0xffffffffffffffff,%rax
je     1174 <palindrome_conversion+0x54>
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl -0x1(%r15,%rcx,1),%edx
movzbl (%r15,%rax,1),%ebx
mov    %bl,-0x1(%r15,%rcx,1)
mov    %dl,(%r15,%rax,1)
add    $0xffffffffffffffff,%rax
lea    0x1(%rcx),%rdx
cmp    %rcx,%rax
mov    %rdx,%rcx
ja     1150 <palindrome_conversion+0x30>
mov    (%r15),%al
test   %al,%al
je     11df <palindrome_conversion+0xbf>
mov    $0x1,%ebx
lea    0xe79(%rip),%r12
nopw   0x0(%rax,%rax,1)
movsbl %al,%ecx
add    $0xffffffbf,%ecx
cmp    $0x13,%ecx
ja     11c7 <palindrome_conversion+0xa7>
mov    $0x47,%al
movslq (%r12,%rcx,4),%rcx
add    %r12,%rcx
jmp    *%rcx
mov    $0x54,%al
jmp    11c2 <palindrome_conversion+0xa2>
nopw   0x0(%rax,%rax,1)
mov    $0x43,%al
jmp    11c2 <palindrome_conversion+0xa2>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x41,%al
mov    %al,-0x1(%r15,%rbx,1)
mov    %r15,%rdi
call   1040 <strlen@plt>
cmp    %rax,%rbx
jae    11df <palindrome_conversion+0xbf>
movzbl (%r15,%rbx,1),%eax
add    $0x1,%rbx
jmp    1190 <palindrome_conversion+0x70>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @palindrome_conversion(i8* returned %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = add i64 %3, -1
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %9, %2
%7 = load i8, i8* %1
%8 = icmp eq i8 %7, 0
br i1 %8, label %36, label %19
9: ; preds = %2, %9
%10 = phi i64 [ %17, %9 ], [ %4, %2 ]
%11 = phi i64 [ %16, %9 ], [ 0, %2 ]
%12 = getelementptr inbounds i8, i8* %1, i64 %11
%13 = load i8, i8* %12
%14 = getelementptr inbounds i8, i8* %1, i64 %10
%15 = load i8, i8* %14
store i8 %15, i8* %12
store i8 %13, i8* %14
%16 = add nuw i64 %11, 1
%17 = add i64 %10, -1
%18 = icmp ugt i64 %17, %16
br i1 %18, label %9, label %6
19: ; preds = %6, %33
%20 = phi i8 [ %35, %33 ], [ %7, %6 ]
%21 = phi i64 [ %30, %33 ], [ 0, %6 ]
%22 = getelementptr inbounds i8, i8* %1, i64 %21
%23 = sext i8 %20 to i32
switch i32 %23, label %29 [
i32 67, label %27
i32 71, label %24
i32 84, label %25
i32 65, label %26
]
24: ; preds = %19
br label %27
25: ; preds = %19
br label %27
26: ; preds = %19
br label %27
27: ; preds = %19, %26, %25, %24
%28 = phi i8 [ 67, %24 ], [ 65, %25 ], [ 84, %26 ], [ 71, %19 ]
store i8 %28, i8* %22
br label %29
29: ; preds = %27, %19
%30 = add nuw i64 %21, 1
%31 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%32 = icmp ult i64 %30, %31
br i1 %32, label %33, label %36
33: ; preds = %29
%34 = getelementptr inbounds i8, i8* %1, i64 %30
%35 = load i8, i8* %34
br label %19
36: ; preds = %29, %6
%37 = tail call i32 @strcpy(i8* %0, i8* %1)
ret i8* %0
}