#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*/ isspace(char);
char *ui_cmd_find_ws(char *input) {
  while (input && *input && !isspace(*input)) {
    input++;
  }
  if (!*input) {
    return NULL;
  } else {
    return input;
  }
}


x86 assembly (clang, -O0):
<ui_cmd_find_ws>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     1158 <ui_cmd_find_ws+0x48>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1158 <ui_cmd_find_ws+0x48>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1168 <ui_cmd_find_ws+0x58>
jmp    1179 <ui_cmd_find_ws+0x69>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <ui_cmd_find_ws+0xc>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1193 <ui_cmd_find_ws+0x83>
movq   $0x0,-0x8(%rbp)
jmp    119b <ui_cmd_find_ws+0x8b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ui_cmd_find_ws>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1138 <ui_cmd_find_ws+0x28>
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isspace@plt>
test   %eax,%eax
jne    1138 <ui_cmd_find_ws+0x28>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <ui_cmd_find_ws+0x10>
xor    %eax,%eax
cmpb   $0x0,(%rbx)
cmovne %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @ui_cmd_find_ws(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %1, %10
%6 = phi i8 [ %12, %10 ], [ %3, %1 ]
%7 = phi i8* [ %11, %10 ], [ %0, %1 ]
%8 = tail call i32 @isspace(i8 signext %6)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %10, %5, %1
%15 = phi i8* [ %0, %1 ], [ %11, %10 ], [ %7, %5 ]
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
%18 = select i1 %17, i8* null, i8* %15
ret i8* %18
}