#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int strlen(char *);
int parse_bowtieline_get_readlength(char *line) {
  char tmpstr[1000];
  int numtab, j, i, readlen;
  char strand;
  numtab = 0;
  j = 0;
  for (i = 0; i <= strlen(line); i++) {
    if (line[i] == '\t' || line[i] == '\0') {
      numtab++;
      tmpstr[j] = '\0';
      if (numtab == 5)
        readlen = strlen(tmpstr);
      j = 0;
    } else {
      tmpstr[j] = line[i];
      j++;
    }
  }
  if (numtab < 7) {
    fprintf(stderr,
            "Error: input alignment file doesn't look like bowtieout file.\n");
    exit(1);
  }
  return (readlen);
}


x86 assembly (clang, -O0):
<parse_bowtieline_get_readlength>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x3f4(%rbp)
movl   $0x0,-0x3f8(%rbp)
movl   $0x0,-0x3fc(%rbp)
mov    -0x3fc(%rbp),%eax
mov    %eax,-0x408(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x408(%rbp),%eax
cmp    %ecx,%eax
jg     1242 <parse_bowtieline_get_readlength+0x112>
mov    -0x8(%rbp),%rax
movslq -0x3fc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x9,%eax
je     11b2 <parse_bowtieline_get_readlength+0x82>
mov    -0x8(%rbp),%rax
movslq -0x3fc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    11fe <parse_bowtieline_get_readlength+0xce>
mov    -0x3f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3f4(%rbp)
movslq -0x3f8(%rbp),%rax
movb   $0x0,-0x3f0(%rbp,%rax,1)
cmpl   $0x5,-0x3f4(%rbp)
jne    11ef <parse_bowtieline_get_readlength+0xbf>
lea    -0x3f0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x400(%rbp)
movl   $0x0,-0x3f8(%rbp)
jmp    1229 <parse_bowtieline_get_readlength+0xf9>
mov    -0x8(%rbp),%rax
movslq -0x3fc(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x3f8(%rbp),%rax
mov    %cl,-0x3f0(%rbp,%rax,1)
mov    -0x3f8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3f8(%rbp)
jmp    122e <parse_bowtieline_get_readlength+0xfe>
mov    -0x3fc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3fc(%rbp)
jmp    115d <parse_bowtieline_get_readlength+0x2d>
cmpl   $0x7,-0x3f4(%rbp)
jge    126e <parse_bowtieline_get_readlength+0x13e>
mov    0x2d8a(%rip),%rax
mov    (%rax),%edi
lea    0xda1(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x400(%rbp),%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_bowtieline_get_readlength>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3e8,%rsp
mov    %rdi,%r12
call   1030 <strlen@plt>
test   %eax,%eax
js     11c8 <parse_bowtieline_get_readlength+0x98>
xor    %r13d,%r13d
mov    $0xffffffffffffffff,%rbp
mov    %rsp,%r14
xor    %ebx,%ebx
jmp    1179 <parse_bowtieline_get_readlength+0x49>
xchg   %ax,%ax
mov    %al,(%rsp,%rbx,1)
add    $0x1,%ebx
mov    %r12,%rdi
call   1030 <strlen@plt>
cltq
add    $0x1,%rbp
cmp    %rax,%rbp
jge    11ad <parse_bowtieline_get_readlength+0x7d>
movzbl 0x1(%r12,%rbp,1),%eax
movslq %ebx,%rbx
cmp    $0x9,%al
je     118a <parse_bowtieline_get_readlength+0x5a>
test   %al,%al
jne    1160 <parse_bowtieline_get_readlength+0x30>
add    $0x1,%r13d
movb   $0x0,(%rsp,%rbx,1)
xor    %ebx,%ebx
cmp    $0x5,%r13d
jne    1166 <parse_bowtieline_get_readlength+0x36>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%r15d
mov    $0x5,%r13d
jmp    1166 <parse_bowtieline_get_readlength+0x36>
cmp    $0x6,%r13d
jle    11c8 <parse_bowtieline_get_readlength+0x98>
mov    %r15d,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
lea    0xe28(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [63 x i8] c"Error: input alignment file doesn't look like bowtieout file.\0A\00"
define i32 @parse_bowtieline_get_readlength(i8* %0) {
%2 = alloca i8*
%3 = alloca [1000 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i8* %0, i8** %2
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %9
9: ; preds = %54, %1
%10 = load i32, i32* %6
%11 = load i8*, i8** %2
%12 = call i32 @strlen(i8* %11)
%13 = icmp sle i32 %10, %12
br i1 %13, label %14, label %57
14: ; preds = %9
%15 = load i8*, i8** %2
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 9
br i1 %21, label %30, label %22
22: ; preds = %14
%23 = load i8*, i8** %2
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %42
30: ; preds = %22, %14
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %34
store i8 0, i8* %35
%36 = load i32, i32* %4
%37 = icmp eq i32 %36, 5
br i1 %37, label %38, label %41
38: ; preds = %30
%39 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%40 = call i32 @strlen(i8* %39)
store i32 %40, i32* %7
br label %41
41: ; preds = %38, %30
store i32 0, i32* %5
br label %53
42: ; preds = %22
%43 = load i8*, i8** %2
%44 = load i32, i32* %6
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
%47 = load i8, i8* %46
%48 = load i32, i32* %5
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %49
store i8 %47, i8* %50
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 1
store i32 %52, i32* %5
br label %53
53: ; preds = %42, %41
br label %54
54: ; preds = %53
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 1
store i32 %56, i32* %6
br label %9
57: ; preds = %9
%58 = load i32, i32* %4
%59 = icmp slt i32 %58, 7
br i1 %59, label %60, label %64
60: ; preds = %57
%61 = load i32, i32* @stderr
%62 = call i32 @fprintf(i32 %61, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%63 = call i32 @exit(i32 1)
unreachable
64: ; preds = %57
%65 = load i32, i32* %7
ret i32 %65
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [63 x i8] c"Error: input alignment file doesn't look like bowtieout file.\0A\00"
define i32 @parse_bowtieline_get_readlength(i8* %0) {
%2 = alloca [1000 x i8]
%3 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%4 = call i32 @strlen(i8* %0)
%5 = icmp slt i32 %4, 0
br i1 %5, label %34, label %6
6: ; preds = %1, %24
%7 = phi i64 [ %28, %24 ], [ 0, %1 ]
%8 = phi i32 [ %27, %24 ], [ 0, %1 ]
%9 = phi i32 [ %26, %24 ], [ undef, %1 ]
%10 = phi i32 [ %25, %24 ], [ 0, %1 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %7
%12 = load i8, i8* %11
switch i8 %12, label %20 [
i8 9, label %13
i8 0, label %13
]
13: ; preds = %6, %6
%14 = add nsw i32 %8, 1
%15 = sext i32 %10 to i64
%16 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %15
store i8 0, i8* %16
%17 = icmp eq i32 %14, 5
br i1 %17, label %18, label %24
18: ; preds = %13
%19 = call i32 @strlen(i8* %3)
br label %24
20: ; preds = %6
%21 = sext i32 %10 to i64
%22 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %21
store i8 %12, i8* %22
%23 = add nsw i32 %10, 1
br label %24
24: ; preds = %13, %18, %20
%25 = phi i32 [ %23, %20 ], [ 0, %18 ], [ 0, %13 ]
%26 = phi i32 [ %9, %20 ], [ %19, %18 ], [ %9, %13 ]
%27 = phi i32 [ %8, %20 ], [ 5, %18 ], [ %14, %13 ]
%28 = add nuw nsw i64 %7, 1
%29 = call i32 @strlen(i8* %0)
%30 = sext i32 %29 to i64
%31 = icmp slt i64 %7, %30
br i1 %31, label %6, label %32
32: ; preds = %24
%33 = icmp slt i32 %27, 7
br i1 %33, label %34, label %38
34: ; preds = %1, %32
%35 = load i32, i32* @stderr
%36 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %32
ret i32 %26
}