#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);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strmov(char *, char *);
void GetNext(char *Src, char *Dest) {
  char *c = strchr(Src, ' ');
  if (c == NULL) {
    strcpy(Dest, Src);
    *Src = '\0';
  } else {
    *c = '\0';
    strcpy(Dest, Src);
    for (c++; *c == ' '; c++)
      ;
    strmov(Src, c);
  }
}


x86 assembly (clang, -O0):
<GetNext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x20,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1176 <GetNext+0x46>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
jmp    11c9 <GetNext+0x99>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    11bc <GetNext+0x8c>
jmp    11ab <GetNext+0x7b>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1196 <GetNext+0x66>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strmov@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetNext>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    $0x20,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     117a <GetNext+0x4a>
mov    %rax,%rbx
movb   $0x0,(%rax)
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
nopl   0x0(%rax,%rax,1)
cmpb   $0x20,0x1(%rbx)
lea    0x1(%rbx),%rbx
je     1160 <GetNext+0x30>
mov    %r14,%rdi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <strmov@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
movb   $0x0,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

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

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