#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 */
#define EOF 128
int strlen(char *);
void velvetifySequence(char *str) {
  int i = strlen(str) - 1;
  char c;
  for (i = strlen(str) - 1; i >= 0; i--) {
    c = str[i];
    switch (c) {
    case '\n':
    case '\r':
    case EOF:
      str[i] = '\0';
      break;
    case 'A':
    case 'a':
      str[i] = 'A';
      break;
    case 'C':
    case 'c':
      str[i] = 'C';
      break;
    case 'G':
    case 'g':
      str[i] = 'G';
      break;
    case 'T':
    case 't':
      str[i] = 'T';
      break;
    default:
      str[i] = 'N';
    }
  }
}


x86 assembly (clang, -O0):
<velvetifySequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1287 <velvetifySequence+0x177>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0xa,%eax
je     1213 <velvetifySequence+0x103>
jmp    1167 <velvetifySequence+0x57>
mov    -0x14(%rbp),%eax
sub    $0xd,%eax
je     1213 <velvetifySequence+0x103>
jmp    1178 <velvetifySequence+0x68>
mov    -0x14(%rbp),%eax
sub    $0x41,%eax
je     1224 <velvetifySequence+0x114>
jmp    1189 <velvetifySequence+0x79>
mov    -0x14(%rbp),%eax
sub    $0x43,%eax
je     1235 <velvetifySequence+0x125>
jmp    119a <velvetifySequence+0x8a>
mov    -0x14(%rbp),%eax
sub    $0x47,%eax
je     1246 <velvetifySequence+0x136>
jmp    11ab <velvetifySequence+0x9b>
mov    -0x14(%rbp),%eax
sub    $0x54,%eax
je     1257 <velvetifySequence+0x147>
jmp    11bc <velvetifySequence+0xac>
mov    -0x14(%rbp),%eax
sub    $0x61,%eax
je     1224 <velvetifySequence+0x114>
jmp    11cd <velvetifySequence+0xbd>
mov    -0x14(%rbp),%eax
sub    $0x63,%eax
je     1235 <velvetifySequence+0x125>
jmp    11de <velvetifySequence+0xce>
mov    -0x14(%rbp),%eax
sub    $0x67,%eax
je     1246 <velvetifySequence+0x136>
jmp    11ef <velvetifySequence+0xdf>
mov    -0x14(%rbp),%eax
sub    $0x74,%eax
je     1257 <velvetifySequence+0x147>
jmp    1200 <velvetifySequence+0xf0>
mov    -0x14(%rbp),%eax
sub    $0x80,%eax
jne    1268 <velvetifySequence+0x158>
jmp    1213 <velvetifySequence+0x103>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1274 <velvetifySequence+0x164>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x41,(%rax,%rcx,1)
jmp    1274 <velvetifySequence+0x164>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x43,(%rax,%rcx,1)
jmp    1274 <velvetifySequence+0x164>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x47,(%rax,%rcx,1)
jmp    1274 <velvetifySequence+0x164>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x54,(%rax,%rcx,1)
jmp    1274 <velvetifySequence+0x164>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x4e,(%rax,%rcx,1)
jmp    1279 <velvetifySequence+0x169>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <velvetifySequence+0x2a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<velvetifySequence>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    117a <velvetifySequence+0x6a>
mov    %eax,%ecx
test   $0x1,%cl
je     1175 <velvetifySequence+0x65>
add    $0xffffffffffffffff,%rcx
mov    %ecx,%edx
movsbl (%rbx,%rdx,1),%edi
lea    -0x41(%rdi),%esi
cmp    $0x33,%esi
ja     1153 <velvetifySequence+0x43>
lea    0xebb(%rip),%rdi
movslq (%rdi,%rsi,4),%rsi
add    %rdi,%rsi
jmp    *%rsi
mov    $0x41,%sil
jmp    1171 <velvetifySequence+0x61>
xor    %esi,%esi
cmp    $0xa,%edi
je     1171 <velvetifySequence+0x61>
cmp    $0xd,%edi
je     1171 <velvetifySequence+0x61>
mov    $0x4e,%sil
jmp    1171 <velvetifySequence+0x61>
mov    $0x43,%sil
jmp    1171 <velvetifySequence+0x61>
mov    $0x47,%sil
jmp    1171 <velvetifySequence+0x61>
mov    $0x54,%sil
mov    %sil,(%rbx,%rdx,1)
cmp    $0x1,%eax
jne    117c <velvetifySequence+0x6c>
pop    %rbx
ret
add    $0xfffffffffffffffe,%rcx
lea    0x1019(%rip),%r8
lea    0xf42(%rip),%rdx
jmp    11b5 <velvetifySequence+0xa5>
mov    $0x54,%dil
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %dil,(%rbx,%rsi,1)
lea    -0x2(%rcx),%rax
add    $0x1,%rcx
cmp    $0x1,%rcx
mov    %rax,%rcx
jbe    117a <velvetifySequence+0x6a>
lea    0x1(%rcx),%esi
movsbl (%rbx,%rsi,1),%eax
lea    -0x41(%rax),%edi
cmp    $0x33,%edi
ja     11e0 <velvetifySequence+0xd0>
movslq (%rdx,%rdi,4),%rax
add    %rdx,%rax
jmp    *%rax
mov    $0x41,%dil
jmp    1200 <velvetifySequence+0xf0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %edi,%edi
cmp    $0xa,%eax
je     1200 <velvetifySequence+0xf0>
cmp    $0xd,%eax
je     1200 <velvetifySequence+0xf0>
mov    $0x4e,%dil
jmp    1200 <velvetifySequence+0xf0>
mov    $0x43,%dil
jmp    1200 <velvetifySequence+0xf0>
mov    $0x47,%dil
jmp    1200 <velvetifySequence+0xf0>
mov    $0x54,%dil
xchg   %ax,%ax
mov    %dil,(%rbx,%rsi,1)
mov    %ecx,%esi
movsbl (%rbx,%rsi,1),%eax
lea    -0x41(%rax),%edi
cmp    $0x33,%edi
ja     1220 <velvetifySequence+0x110>
movslq (%r8,%rdi,4),%rax
add    %r8,%rax
jmp    *%rax
mov    $0x41,%dil
jmp    11a0 <velvetifySequence+0x90>
xor    %edi,%edi
cmp    $0xa,%eax
je     11a0 <velvetifySequence+0x90>
cmp    $0xd,%eax
je     11a0 <velvetifySequence+0x90>
mov    $0x4e,%dil
jmp    11a0 <velvetifySequence+0x90>
mov    $0x43,%dil
jmp    11a0 <velvetifySequence+0x90>
mov    $0x47,%dil
jmp    11a0 <velvetifySequence+0x90>

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

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