#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 */
size_t strlen(char *);
void parse_ensembl_header(char *header_str, char **parsed_header_str) {
  int i, term = 0;
  for (i = 0; i < strlen(header_str); i++) {
    if (header_str[i] == '\t' || header_str[i] == ' ') {
      (*parsed_header_str)[i] = '\0';
      term = 1;
      break;
    } else {
      (*parsed_header_str)[i] = header_str[i];
    }
  }
  if (term == 0)
    (*parsed_header_str)[strlen(header_str)] = '\0';
}


x86 assembly (clang, -O0):
<parse_ensembl_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jae    11c0 <parse_ensembl_header+0xb0>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x9,%eax
je     1179 <parse_ensembl_header+0x69>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    1194 <parse_ensembl_header+0x84>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x1,-0x18(%rbp)
jmp    11c0 <parse_ensembl_header+0xb0>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    11b2 <parse_ensembl_header+0xa2>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112e <parse_ensembl_header+0x1e>
cmpl   $0x0,-0x18(%rbp)
jne    11e9 <parse_ensembl_header+0xd9>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_ensembl_header>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    (%rdi),%al
test   %al,%al
je     115d <parse_ensembl_header+0x4d>
mov    $0x1,%ebx
cmp    $0x20,%al
je     1155 <parse_ensembl_header+0x45>
nopw   0x0(%rax,%rax,1)
cmp    $0x9,%al
je     1155 <parse_ensembl_header+0x45>
mov    (%r14),%rcx
mov    %al,-0x1(%rcx,%rbx,1)
mov    %r15,%rdi
call   1030 <strlen@plt>
cmp    %rbx,%rax
jbe    115d <parse_ensembl_header+0x4d>
movzbl (%r15,%rbx,1),%eax
add    $0x1,%rbx
cmp    $0x20,%al
jne    1130 <parse_ensembl_header+0x20>
add    $0xffffffff,%ebx
add    (%r14),%rbx
jmp    116e <parse_ensembl_header+0x5e>
mov    (%r14),%r14
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %rax,%rbx
add    %r14,%rbx
movb   $0x0,(%rbx)
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @parse_ensembl_header(i8* nocapture %0, i8** nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %21, label %5
5: ; preds = %2, %18
%6 = phi i8 [ %20, %18 ], [ %3, %2 ]
%7 = phi i64 [ %15, %18 ], [ 0, %2 ]
switch i8 %6, label %12 [
i8 9, label %8
i8 32, label %8
]
8: ; preds = %5, %5
%9 = and i64 %7, 4294967295
%10 = load i8*, i8** %1
%11 = getelementptr inbounds i8, i8* %10, i64 %9
br label %25
12: ; preds = %5
%13 = load i8*, i8** %1
%14 = getelementptr inbounds i8, i8* %13, i64 %7
store i8 %6, i8* %14
%15 = add nuw i64 %7, 1
%16 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%17 = icmp ugt i64 %16, %15
br i1 %17, label %18, label %21
18: ; preds = %12
%19 = getelementptr inbounds i8, i8* %0, i64 %15
%20 = load i8, i8* %19
br label %5
21: ; preds = %12, %2
%22 = load i8*, i8** %1
%23 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%24 = getelementptr inbounds i8, i8* %22, i64 %23
br label %25
25: ; preds = %8, %21
%26 = phi i8* [ %11, %8 ], [ %24, %21 ]
store i8 0, i8* %26
ret void
}