#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 *strchr(char *, char);
char *parse_datafile_line(char *str) {
  char *ptr = strchr(str, ' ');
  if (!ptr) {
    ptr = strchr(str, '\t');
  }
  if (ptr) {
    *ptr = 0;
    ptr++;
    while (*ptr == ' ' || *ptr == '\t') {
      ptr++;
    }
    return ptr;
  } else {
    return NULL;
  }
}


x86 assembly (clang, -O0):
<parse_datafile_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    114b <parse_datafile_line+0x3b>
mov    -0x10(%rbp),%rdi
mov    $0x9,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11bc <parse_datafile_line+0xac>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x19(%rbp)
je     118e <parse_datafile_line+0x7e>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    119e <parse_datafile_line+0x8e>
jmp    11af <parse_datafile_line+0x9f>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1169 <parse_datafile_line+0x59>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11c4 <parse_datafile_line+0xb4>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_datafile_line>:
push   %rbx
mov    %rdi,%rbx
mov    $0x20,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1135 <parse_datafile_line+0x25>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1153 <parse_datafile_line+0x43>
movb   $0x0,(%rax)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x20,%cl
je     1140 <parse_datafile_line+0x30>
cmp    $0x9,%cl
je     1140 <parse_datafile_line+0x30>
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @parse_datafile_line(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strchr(i8* %5, i8 signext 32)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %12, label %9
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i8* @strchr(i8* %10, i8 signext 9)
store i8* %11, i8** %4
br label %12
12: ; preds = %9, %1
%13 = load i8*, i8** %4
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %36
15: ; preds = %12
%16 = load i8*, i8** %4
store i8 0, i8* %16
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %4
br label %19
19: ; preds = %31, %15
%20 = load i8*, i8** %4
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 32
br i1 %23, label %29, label %24
24: ; preds = %19
%25 = load i8*, i8** %4
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 9
br label %29
29: ; preds = %24, %19
%30 = phi i1 [ true, %19 ], [ %28, %24 ]
br i1 %30, label %31, label %34
31: ; preds = %29
%32 = load i8*, i8** %4
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %4
br label %19
34: ; preds = %29
%35 = load i8*, i8** %4
store i8* %35, i8** %2
br label %37
36: ; preds = %12
store i8* null, i8** %2
br label %37
37: ; preds = %36, %34
%38 = load i8*, i8** %2
ret i8* %38
}

LLVM IR (-O2):
define i8* @parse_datafile_line(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 32)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 9)
%6 = icmp eq i8* %5, null
br i1 %6, label %14, label %7
7: ; preds = %1, %4
%8 = phi i8* [ %5, %4 ], [ %2, %1 ]
store i8 0, i8* %8
br label %9
9: ; preds = %13, %7
%10 = phi i8* [ %8, %7 ], [ %11, %13 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
switch i8 %12, label %14 [
i8 32, label %13
i8 9, label %13
]
13: ; preds = %9, %9
br label %9
14: ; preds = %9, %4
%15 = phi i8* [ null, %4 ], [ %11, %9 ]
ret i8* %15
}