#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 *findspace(char *src) {
  register char *t1;
  register char *t2;
  t1 = strchr(src, ' ');
  t2 = strchr(src, '\t');
  if (t1 && t2) {
    if (t1 < t2)
      t2 = NULL;
    else
      t1 = NULL;
  }
  if (t1)
    return t1;
  return t2;
}


x86 assembly (clang, -O0):
<findspace>:
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)
mov    -0x10(%rbp),%rdi
mov    $0x9,%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     117e <findspace+0x6e>
cmpq   $0x0,-0x20(%rbp)
je     117e <findspace+0x6e>
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1171 <findspace+0x61>
movq   $0x0,-0x20(%rbp)
jmp    1179 <findspace+0x69>
movq   $0x0,-0x18(%rbp)
jmp    117e <findspace+0x6e>
cmpq   $0x0,-0x18(%rbp)
je     1196 <findspace+0x86>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    119e <findspace+0x8e>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findspace>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x20,%esi
call   1030 <strchr@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x9,%esi
call   1030 <strchr@plt>
test   %rbx,%rbx
setne  %cl
test   %rax,%rax
setne  %dl
xor    %esi,%esi
cmp    %rax,%rbx
mov    $0x0,%edi
cmovb  %rbx,%rdi
cmovae %rax,%rsi
test   %dl,%cl
cmove  %rbx,%rdi
cmovne %rsi,%rax
test   %rdi,%rdi
cmovne %rdi,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @findspace(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i8* @strchr(i8* %6, i8 signext 32)
store i8* %7, i8** %4
%8 = load i8*, i8** %3
%9 = call i8* @strchr(i8* %8, i8 signext 9)
store i8* %9, i8** %5
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %22
12: ; preds = %1
%13 = load i8*, i8** %5
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load i8*, i8** %4
%17 = load i8*, i8** %5
%18 = icmp ult i8* %16, %17
br i1 %18, label %19, label %20
19: ; preds = %15
store i8* null, i8** %5
br label %21
20: ; preds = %15
store i8* null, i8** %4
br label %21
21: ; preds = %20, %19
br label %22
22: ; preds = %21, %12, %1
%23 = load i8*, i8** %4
%24 = icmp ne i8* %23, null
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = load i8*, i8** %4
store i8* %26, i8** %2
br label %29
27: ; preds = %22
%28 = load i8*, i8** %5
store i8* %28, i8** %2
br label %29
29: ; preds = %27, %25
%30 = load i8*, i8** %2
ret i8* %30
}

LLVM IR (-O2):
define i8* @findspace(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 32)
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 9)
%4 = icmp ne i8* %2, null
%5 = icmp ne i8* %3, null
%6 = select i1 %4, i1 %5, i1 false
%7 = icmp ult i8* %2, %3
%8 = select i1 %7, i8* %2, i8* null
%9 = select i1 %6, i8* %8, i8* %2
%10 = select i1 %6, i1 %7, i1 false
%11 = select i1 %10, i8* null, i8* %3
%12 = icmp eq i8* %9, null
%13 = select i1 %12, i8* %11, i8* %9
ret i8* %13
}