#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 *copy_string(char *);
int /*<<< orphan*/ fatal(char *);
int /*<<< orphan*/ free(char *);
scalar_t__ strchr(char *, char);
scalar_t__ strlen(char *);
char *fasta_name(char *line) {
  char *buf, *s, *t;
  if (!line)
    return copy_string("");
  if (strlen(line) == 0)
    return copy_string("");
  if (line[0] != '>')
    fatal("missing FastA header line");
  buf = copy_string(line);
  s = buf + 1;
  while (strchr(" \t", *s))
    ++s;
  while (!strchr(" \t\n\0", *s))
    ++s;
  *s = '\0';
  while (s[-1] == '|')
    *--s = 0;
  while (!strchr(" \t>|", s[-1]))
    --s;
  t = copy_string(s);
  free(buf);
  return t;
}


x86 assembly (clang, -O0):
<fasta_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    117c <fasta_name+0x2c>
lea    0xeae(%rip),%rdi
call   1040 <copy_string@plt>
mov    %rax,-0x8(%rbp)
jmp    12d4 <fasta_name+0x184>
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%rax
jne    11a4 <fasta_name+0x54>
lea    0xe86(%rip),%rdi
call   1040 <copy_string@plt>
mov    %rax,-0x8(%rbp)
jmp    12d4 <fasta_name+0x184>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3e,%eax
je     11c0 <fasta_name+0x70>
lea    0xe45(%rip),%rdi
call   1070 <fatal@plt>
mov    -0x10(%rbp),%rdi
call   1040 <copy_string@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
lea    0xe36(%rip),%rdi
movsbl (%rax),%esi
call   1060 <strchr@plt>
cmp    $0x0,%rax
je     1207 <fasta_name+0xb7>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11d9 <fasta_name+0x89>
jmp    120c <fasta_name+0xbc>
mov    -0x20(%rbp),%rax
lea    0xe0b(%rip),%rdi
movsbl (%rax),%esi
call   1060 <strchr@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1235 <fasta_name+0xe5>
jmp    1246 <fasta_name+0xf6>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    120c <fasta_name+0xbc>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x7c,%eax
jne    1276 <fasta_name+0x126>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x0,-0x1(%rax)
jmp    124d <fasta_name+0xfd>
jmp    127b <fasta_name+0x12b>
mov    -0x20(%rbp),%rax
lea    0xd97(%rip),%rdi
movsbl -0x1(%rax),%esi
call   1060 <strchr@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12a5 <fasta_name+0x155>
jmp    12b6 <fasta_name+0x166>
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    127b <fasta_name+0x12b>
mov    -0x20(%rbp),%rdi
call   1040 <copy_string@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fasta_name>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     115a <fasta_name+0x1a>
mov    %rdi,%rbx
mov    (%rdi),%al
cmp    $0x3e,%al
je     117d <fasta_name+0x3d>
test   %al,%al
jne    1171 <fasta_name+0x31>
lea    0xebb(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <copy_string@plt>
lea    0xe88(%rip),%rdi
call   1060 <fatal@plt>
mov    %rbx,%rdi
call   1040 <copy_string@plt>
mov    %rax,%r14
mov    %rax,%rbx
add    $0xffffffffffffffff,%rbx
lea    0xe84(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
movsbl 0x2(%rbx),%esi
mov    %r15,%rdi
call   1050 <strchr@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    11a0 <fasta_name+0x60>
lea    0xe66(%rip),%r15
nopl   0x0(%rax)
movsbl 0x1(%rbx),%esi
add    $0x1,%rbx
mov    %r15,%rdi
call   1050 <strchr@plt>
test   %rax,%rax
je     11c0 <fasta_name+0x80>
movb   $0x0,(%rbx)
cmpb   $0x7c,-0x1(%rbx)
jne    11f3 <fasta_name+0xb3>
xchg   %ax,%ax
lea    -0x1(%rbx),%r12
movb   $0x0,-0x1(%rbx)
cmpb   $0x7c,-0x2(%rbx)
mov    %r12,%rbx
je     11e0 <fasta_name+0xa0>
jmp    11f6 <fasta_name+0xb6>
mov    %rbx,%r12
add    $0x1,%r12
lea    0xe1c(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl -0x2(%r12),%esi
mov    %r15,%rdi
call   1050 <strchr@plt>
add    $0xffffffffffffffff,%r12
test   %rax,%rax
je     1210 <fasta_name+0xd0>
mov    %r12,%rdi
call   1040 <copy_string@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [26 x i8] c"missing FastA header line\00"
@.str.2 = [3 x i8] c" \09\00"
@.str.3 = [5 x i8] c" \09\0A\00\00"
@.str.4 = [5 x i8] c" \09>|\00"
define i8* @fasta_name(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %1
%10 = call i8* @copy_string(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i8* %10, i8** %2
br label %76
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = call i64 @strlen(i8* %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i8* @copy_string(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i8* %16, i8** %2
br label %76
17: ; preds = %11
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i64 0
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 62
br i1 %22, label %23, label %25
23: ; preds = %17
%24 = call i32 @fatal(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %25
25: ; preds = %23, %17
%26 = load i8*, i8** %3
%27 = call i8* @copy_string(i8* %26)
store i8* %27, i8** %4
%28 = load i8*, i8** %4
%29 = getelementptr inbounds i8, i8* %28, i64 1
store i8* %29, i8** %5
br label %30
30: ; preds = %35, %25
%31 = load i8*, i8** %5
%32 = load i8, i8* %31
%33 = call i64 @strchr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8 signext %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %30
%36 = load i8*, i8** %5
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %5
br label %30
38: ; preds = %30
br label %39
39: ; preds = %45, %38
%40 = load i8*, i8** %5
%41 = load i8, i8* %40
%42 = call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8 signext %41)
%43 = icmp ne i64 %42, 0
%44 = xor i1 %43, true
br i1 %44, label %45, label %48
45: ; preds = %39
%46 = load i8*, i8** %5
%47 = getelementptr inbounds i8, i8* %46, i32 1
store i8* %47, i8** %5
br label %39
48: ; preds = %39
%49 = load i8*, i8** %5
store i8 0, i8* %49
br label %50
50: ; preds = %56, %48
%51 = load i8*, i8** %5
%52 = getelementptr inbounds i8, i8* %51, i64 -1
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = icmp eq i32 %54, 124
br i1 %55, label %56, label %59
56: ; preds = %50
%57 = load i8*, i8** %5
%58 = getelementptr inbounds i8, i8* %57, i32 -1
store i8* %58, i8** %5
store i8 0, i8* %58
br label %50
59: ; preds = %50
br label %60
60: ; preds = %67, %59
%61 = load i8*, i8** %5
%62 = getelementptr inbounds i8, i8* %61, i64 -1
%63 = load i8, i8* %62
%64 = call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8 signext %63)
%65 = icmp ne i64 %64, 0
%66 = xor i1 %65, true
br i1 %66, label %67, label %70
67: ; preds = %60
%68 = load i8*, i8** %5
%69 = getelementptr inbounds i8, i8* %68, i32 -1
store i8* %69, i8** %5
br label %60
70: ; preds = %60
%71 = load i8*, i8** %5
%72 = call i8* @copy_string(i8* %71)
store i8* %72, i8** %6
%73 = load i8*, i8** %4
%74 = call i32 @free(i8* %73)
%75 = load i8*, i8** %6
store i8* %75, i8** %2
br label %76
76: ; preds = %70, %15, %9
%77 = load i8*, i8** %2
ret i8* %77
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [26 x i8] c"missing FastA header line\00"
@.str.2 = [3 x i8] c" \09\00"
@.str.3 = [5 x i8] c" \09\0A\00\00"
@.str.4 = [5 x i8] c" \09>|\00"
define i8* @fasta_name(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i8* @copy_string(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %45
5: ; preds = %1
%6 = load i8, i8* %0
switch i8 %6, label %9 [
i8 0, label %7
i8 62, label %11
]
7: ; preds = %5
%8 = tail call i8* @copy_string(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %45
9: ; preds = %5
%10 = tail call i32 @fatal(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %5, %9
%12 = tail call i8* @copy_string(i8* %0)
br label %13
13: ; preds = %13, %11
%14 = phi i8* [ %12, %11 ], [ %15, %13 ]
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = load i8, i8* %15
%17 = tail call i64 @strchr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8 signext %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %13
19: ; preds = %13, %19
%20 = phi i8* [ %24, %19 ], [ %15, %13 ]
%21 = load i8, i8* %20
%22 = tail call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8 signext %21)
%23 = icmp eq i64 %22, 0
%24 = getelementptr inbounds i8, i8* %20, i64 1
br i1 %23, label %19, label %25
25: ; preds = %19
store i8 0, i8* %20
%26 = getelementptr inbounds i8, i8* %20, i64 -1
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 124
br i1 %28, label %29, label %34
29: ; preds = %25, %29
%30 = phi i8* [ %31, %29 ], [ %26, %25 ]
store i8 0, i8* %30
%31 = getelementptr inbounds i8, i8* %30, i64 -1
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, 124
br i1 %33, label %29, label %34
34: ; preds = %29, %25
%35 = phi i8* [ %20, %25 ], [ %30, %29 ]
br label %36
36: ; preds = %34, %36
%37 = phi i8* [ %38, %36 ], [ %35, %34 ]
%38 = getelementptr inbounds i8, i8* %37, i64 -1
%39 = load i8, i8* %38
%40 = tail call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8 signext %39)
%41 = icmp eq i64 %40, 0
br i1 %41, label %36, label %42
42: ; preds = %36
%43 = tail call i8* @copy_string(i8* %37)
%44 = tail call i32 @free(i8* %12)
br label %45
45: ; preds = %42, %7, %3
%46 = phi i8* [ %8, %7 ], [ %43, %42 ], [ %4, %3 ]
ret i8* %46
}