#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 *Begin(char *);
char *End(char *);
char *strncpy(char *, char *, int);
char *GetWord_noexp(char *begin, char *word) {
  char *end;
  if (!begin) {
    *word = '\0';
    return NULL;
  }
  end = End(begin);
  word = strncpy(word, begin, end - begin);
  word[end - begin] = '\0';
  begin = Begin(end);
  return begin;
}


x86 assembly (clang, -O0):
<GetWord_noexp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115f <GetWord_noexp+0x2f>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    11b2 <GetWord_noexp+0x82>
mov    -0x10(%rbp),%rdi
call   1040 <End@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1030 <strncpy@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rdx
sub    %rdx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rdi
call   1050 <Begin@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetWord_noexp>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
test   %rdi,%rdi
je     1177 <GetWord_noexp+0x47>
mov    %rdi,%rbx
call   1040 <End@plt>
mov    %rax,%r15
mov    %rax,%r12
sub    %rbx,%r12
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r12d,%edx
call   1030 <strncpy@plt>
movb   $0x0,(%rax,%r12,1)
mov    %r15,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <Begin@plt>
movb   $0x0,(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @GetWord_noexp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = load i8*, i8** %5
store i8 0, i8* %10
store i8* null, i8** %3
br label %33
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = call i8* @End(i8* %12)
store i8* %13, i8** %6
%14 = load i8*, i8** %5
%15 = load i8*, i8** %4
%16 = load i8*, i8** %6
%17 = load i8*, i8** %4
%18 = ptrtoint i8* %16 to i64
%19 = ptrtoint i8* %17 to i64
%20 = sub i64 %18, %19
%21 = trunc i64 %20 to i32
%22 = call i8* @strncpy(i8* %14, i8* %15, i32 %21)
store i8* %22, i8** %5
%23 = load i8*, i8** %5
%24 = load i8*, i8** %6
%25 = load i8*, i8** %4
%26 = ptrtoint i8* %24 to i64
%27 = ptrtoint i8* %25 to i64
%28 = sub i64 %26, %27
%29 = getelementptr inbounds i8, i8* %23, i64 %28
store i8 0, i8* %29
%30 = load i8*, i8** %6
%31 = call i8* @Begin(i8* %30)
store i8* %31, i8** %4
%32 = load i8*, i8** %4
store i8* %32, i8** %3
br label %33
33: ; preds = %11, %9
%34 = load i8*, i8** %3
ret i8* %34
}

LLVM IR (-O2):
define i8* @GetWord_noexp(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %5
4: ; preds = %2
store i8 0, i8* %1
br label %14
5: ; preds = %2
%6 = tail call i8* @End(i8* %0)
%7 = ptrtoint i8* %6 to i64
%8 = ptrtoint i8* %0 to i64
%9 = sub i64 %7, %8
%10 = trunc i64 %9 to i32
%11 = tail call i8* @strncpy(i8* %1, i8* %0, i32 %10)
%12 = getelementptr inbounds i8, i8* %11, i64 %9
store i8 0, i8* %12
%13 = tail call i8* @Begin(i8* %6)
br label %14
14: ; preds = %5, %4
%15 = phi i8* [ %13, %5 ], [ null, %4 ]
ret i8* %15
}