#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 *strtok(char *, char *);
int main() {
  char sentence[] = "Adam is really cool.";
  char *word = strtok(sentence, " .");
  char *secondWord = strtok(NULL, " .");
  printf("%s\n", word);
  printf("%s\n", secondWord);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xec0(%rip),%al
mov    %al,-0xc(%rbp)
lea    -0x20(%rbp),%rdi
lea    0xeb3(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe9f(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%rsi
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movaps 0xed0(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x2e6c6f6f632079,%rax
mov    %rax,0xd(%rsp)
lea    0xecb(%rip),%r14
mov    %rsp,%rdi
mov    %r14,%rsi
call   1040 <strtok@plt>
mov    %rax,%r15
xor    %edi,%edi
mov    %r14,%rsi
call   1040 <strtok@plt>
mov    %rax,%rbx
lea    0xeac(%rip),%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.sentence = [21 x i8] c"Adam is really cool.\00"
@.str = [3 x i8] c" .\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [21 x i8]
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
%5 = bitcast [21 x i8]* %2 to i8*
%6 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%7 = call i8* @strtok(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %3
%8 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %8, i8** %4
%9 = load i8*, i8** %3
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = load i8*, i8** %4
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %11)
ret i32 0
}

LLVM IR (-O2):
@__const.main.sentence = [21 x i8] c"Adam is really cool.\00"
@.str = [3 x i8] c" .\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [21 x i8]
%2 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 0
%3 = call i8* @strtok(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}