#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 strcspn(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int strspn(char *, char *);
int getNextTok(char **ps, char *dest) {
  char *s;
  int l1, l2;
  l1 = strspn(*ps, " \t\r\n");
  l2 = strcspn(*ps + l1, " \t\r\n\0");
  strncpy(dest, *ps + l1, l2);
  dest[l2] = '\0';
  *ps += l1 + l2;
  return l2;
}


x86 assembly (clang, -O0):
<getNextTok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
lea    0xeb2(%rip),%rsi
call   1040 <strspn@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
lea    0xe9a(%rip),%rsi
call   1050 <strcspn@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
movslq -0x1c(%rbp),%rax
add    %rax,%rsi
mov    -0x20(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x1c(%rbp),%edx
add    -0x20(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNextTok>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    (%rdi),%rbx
lea    0xeb8(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strspn@plt>
movslq %eax,%rbp
add    %rbp,%rbx
lea    0xea8(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcspn@plt>
mov    %eax,%r12d
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncpy@plt>
movslq %r12d,%rax
movb   $0x0,(%r15,%rax,1)
add    %eax,%ebp
movslq %ebp,%rcx
add    %rcx,(%r14)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c" \09\0D\0A\00"
@.str.1 = [6 x i8] c" \09\0D\0A\00\00"
define i32 @getNextTok(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8** %0, i8*** %3
store i8* %1, i8** %4
%8 = load i8**, i8*** %3
%9 = load i8*, i8** %8
%10 = call i32 @strspn(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %10, i32* %6
%11 = load i8**, i8*** %3
%12 = load i8*, i8** %11
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = call i32 @strcspn(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i32 %16, i32* %7
%17 = load i8*, i8** %4
%18 = load i8**, i8*** %3
%19 = load i8*, i8** %18
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i32, i32* %7
%24 = call i32 @strncpy(i8* %17, i8* %22, i32 %23)
%25 = load i8*, i8** %4
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
store i8 0, i8* %28
%29 = load i32, i32* %6
%30 = load i32, i32* %7
%31 = add nsw i32 %29, %30
%32 = load i8**, i8*** %3
%33 = load i8*, i8** %32
%34 = sext i32 %31 to i64
%35 = getelementptr inbounds i8, i8* %33, i64 %34
store i8* %35, i8** %32
%36 = load i32, i32* %7
ret i32 %36
}

LLVM IR (-O2):
@.str = [5 x i8] c" \09\0D\0A\00"
@.str.1 = [6 x i8] c" \09\0D\0A\00\00"
define i32 @getNextTok(i8** nocapture %0, i8* %1) {
%3 = load i8*, i8** %0
%4 = tail call i32 @strspn(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %3, i64 %5
%7 = tail call i32 @strcspn(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @strncpy(i8* %1, i8* %6, i32 %7)
%9 = sext i32 %7 to i64
%10 = getelementptr inbounds i8, i8* %1, i64 %9
store i8 0, i8* %10
%11 = add nsw i32 %7, %4
%12 = load i8*, i8** %0
%13 = sext i32 %11 to i64
%14 = getelementptr inbounds i8, i8* %12, i64 %13
store i8* %14, i8** %0
ret i32 %7
}