#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*/ printf(char *, char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strtok(char *, char *);
int main(int argc, char **argv) {
  char test[256];
  char *one;
  char *two;
  char *three;
  strcpy(test, "   one    two    three");
  strtok(test, " ");
  one = strtok(NULL, " ");
  two = strtok(NULL, " ");
  three = strtok(NULL, " ");
  printf("one = %p '%s'\n", one, one);
  printf("two = %p '%s'\n", two, two);
  printf("three = %p '%s'\n", three, three);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x110(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1050 <strtok@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe9d(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x118(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe86(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x120(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe6f(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x128(%rbp)
mov    -0x118(%rbp),%rsi
mov    -0x118(%rbp),%rdx
lea    0xe50(%rip),%rdi
call   1040 <printf@plt>
mov    -0x120(%rbp),%rsi
mov    -0x120(%rbp),%rdx
lea    0xe45(%rip),%rdi
call   1040 <printf@plt>
mov    -0x128(%rbp),%rsi
mov    -0x128(%rbp),%rdx
lea    0xe3a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
lea    0xebd(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
lea    0xec2(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strtok@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   1050 <strtok@plt>
mov    %rax,%rbx
xor    %edi,%edi
mov    %r15,%rsi
call   1050 <strtok@plt>
mov    %rax,%r14
xor    %edi,%edi
mov    %r15,%rsi
call   1050 <strtok@plt>
mov    %rax,%r15
lea    0xe8b(%rip),%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
call   1040 <printf@plt>
lea    0xe88(%rip),%rdi
mov    %r14,%rsi
mov    %r14,%rdx
call   1040 <printf@plt>
lea    0xe85(%rip),%rdi
mov    %r15,%rsi
mov    %r15,%rdx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [23 x i8] c" one two three\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [15 x i8] c"one = %p '%s'\0A\00"
@.str.3 = [15 x i8] c"two = %p '%s'\0A\00"
@.str.4 = [17 x i8] c"three = %p '%s'\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%13 = call i8* @strtok(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %14, i8** %7
%15 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %15, i8** %8
%16 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %16, i8** %9
%17 = load i8*, i8** %7
%18 = load i8*, i8** %7
%19 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %17, i8* %18)
%20 = load i8*, i8** %8
%21 = load i8*, i8** %8
%22 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %20, i8* %21)
%23 = load i8*, i8** %9
%24 = load i8*, i8** %9
%25 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %23, i8* %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c" one two three\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [15 x i8] c"one = %p '%s'\0A\00"
@.str.3 = [15 x i8] c"two = %p '%s'\0A\00"
@.str.4 = [17 x i8] c"three = %p '%s'\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = call i8* @strtok(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %7, i8* %7)
%11 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %8, i8* %8)
%12 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %9, i8* %9)
ret i32 0
}