#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*/ printf(char *, char *);
int strlen(char *);
char *tokenParser(char *, char *, int, char *);
char *refseqProt2RNAParser(char *header) {
  char *brastr = tokenParser(header, " ", 1, "refseqProt2RNAParser");
  int len = strlen(brastr);
  int i;
  if (brastr[0] == '(' && brastr[len - 1] == ')') {
    for (i = 1; i < len - 1; i++) {
      brastr[i - 1] = brastr[i];
    }
    brastr[i - 1] = '\0';
  } else {
    printf("Refseq header doesn't match expected format %s\n", header);
  }
  return brastr;
}


x86 assembly (clang, -O0):
<refseqProt2RNAParser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
mov    $0x1,%edx
lea    0xeaf(%rip),%rcx
call   1050 <tokenParser@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x28,%eax
jne    11e9 <refseqProt2RNAParser+0xb9>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x29,%eax
jne    11e9 <refseqProt2RNAParser+0xb9>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11d3 <refseqProt2RNAParser+0xa3>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1199 <refseqProt2RNAParser+0x69>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    11f9 <refseqProt2RNAParser+0xc9>
mov    -0x8(%rbp),%rsi
lea    0xe23(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<refseqProt2RNAParser>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
lea    0xeb1(%rip),%rsi
lea    0xeac(%rip),%rcx
mov    $0x1,%edx
call   1060 <tokenParser@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <strlen@plt>
cmpb   $0x28,(%rbx)
jne    119f <refseqProt2RNAParser+0x5f>
mov    %eax,%r14d
cltq
cmpb   $0x29,-0x1(%rax,%rbx,1)
jne    119f <refseqProt2RNAParser+0x5f>
cmp    $0x3,%r14d
jl     11b7 <refseqProt2RNAParser+0x77>
mov    %rbx,%rsi
add    $0x1,%rsi
add    $0xfffffffe,%r14d
mov    %rbx,%rdi
mov    %r14,%rdx
call   1050 <memmove@plt>
movb   $0x0,(%rbx,%r14,1)
jmp    11ae <refseqProt2RNAParser+0x6e>
lea    0xe71(%rip),%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %r14d,%r14d
movb   $0x0,(%rbx,%r14,1)
jmp    11ae <refseqProt2RNAParser+0x6e>

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [21 x i8] c"refseqProt2RNAParser\00"
@.str.2 = [48 x i8] c"Refseq header doesn't match expected format %s\0A\00"
define i8* @refseqProt2RNAParser(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @tokenParser(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %4
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 40
br i1 %14, label %15, label %50
15: ; preds = %1
%16 = load i8*, i8** %3
%17 = load i32, i32* %4
%18 = sub nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %16, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 41
br i1 %23, label %24, label %50
24: ; preds = %15
store i32 1, i32* %5
br label %25
25: ; preds = %41, %24
%26 = load i32, i32* %5
%27 = load i32, i32* %4
%28 = sub nsw i32 %27, 1
%29 = icmp slt i32 %26, %28
br i1 %29, label %30, label %44
30: ; preds = %25
%31 = load i8*, i8** %3
%32 = load i32, i32* %5
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = load i8, i8* %34
%36 = load i8*, i8** %3
%37 = load i32, i32* %5
%38 = sub nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %36, i64 %39
store i8 %35, i8* %40
br label %41
41: ; preds = %30
%42 = load i32, i32* %5
%43 = add nsw i32 %42, 1
store i32 %43, i32* %5
br label %25
44: ; preds = %25
%45 = load i8*, i8** %3
%46 = load i32, i32* %5
%47 = sub nsw i32 %46, 1
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %45, i64 %48
store i8 0, i8* %49
br label %53
50: ; preds = %15, %1
%51 = load i8*, i8** %2
%52 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i8* %51)
br label %53
53: ; preds = %50, %44
%54 = load i8*, i8** %3
ret i8* %54
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [21 x i8] c"refseqProt2RNAParser\00"
@.str.2 = [48 x i8] c"Refseq header doesn't match expected format %s\0A\00"
define i8* @refseqProt2RNAParser(i8* %0) {
%2 = tail call i8* @tokenParser(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @strlen(i8* %2)
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 40
br i1 %5, label %6, label %23
6: ; preds = %1
%7 = add nsw i32 %3, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %2, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 41
br i1 %11, label %12, label %23
12: ; preds = %6
%13 = icmp sgt i32 %3, 2
br i1 %13, label %14, label %20
14: ; preds = %12
%15 = getelementptr i8, i8* %2, i64 1
%16 = add nsw i32 %3, -2
%17 = zext i32 %16 to i64
%18 = add i32 %3, -2
%19 = zext i32 %18 to i64
br label %20
20: ; preds = %14, %12
%21 = phi i64 [ 0, %12 ], [ %19, %14 ]
%22 = getelementptr inbounds i8, i8* %2, i64 %21
store i8 0, i8* %22
br label %25
23: ; preds = %6, %1
%24 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %25
25: ; preds = %23, %20
ret i8* %2
}