#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 *);
void print_tokens(char *line) {
  static char whitespace[] = " \t\f\r\v\n";
  char *token;
  for (token = strtok(line, whitespace); token != NULL;
       token = strtok(NULL, whitespace))
    printf("Next token is %s\n", token);
}


x86 assembly (clang, -O0):
<print_tokens>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0x2ef9(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1174 <print_tokens+0x54>
mov    -0x10(%rbp),%rsi
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0x2eca(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x10(%rbp)
jmp    1140 <print_tokens+0x20>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_tokens>:
push   %r14
push   %rbx
push   %rax
lea    0x2f05(%rip),%rsi
call   1040 <strtok@plt>
test   %rax,%rax
je     116a <print_tokens+0x4a>
lea    0xec4(%rip),%r14
lea    0x2eed(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <strtok@plt>
test   %rax,%rax
jne    1150 <print_tokens+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@print_tokens.whitespace = internal global [7 x i8] c" \09\0C\0D\0B\0A\00"
@.str = [18 x i8] c"Next token is %s\0A\00"
define void @print_tokens(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strtok(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @print_tokens.whitespace, i64 0, i64 0))
store i8* %5, i8** %3
br label %6
6: ; preds = %12, %1
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %14
9: ; preds = %6
%10 = load i8*, i8** %3
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %9
%13 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @print_tokens.whitespace, i64 0, i64 0))
store i8* %13, i8** %3
br label %6
14: ; preds = %6
ret void
}

LLVM IR (-O2):
@print_tokens.whitespace = internal global [7 x i8] c" \09\0C\0D\0B\0A\00"
@.str = [18 x i8] c"Next token is %s\0A\00"
define void @print_tokens(i8* %0) {
%2 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @print_tokens.whitespace, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %9, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %7, %4 ], [ %2, %1 ]
%6 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @print_tokens.whitespace, i64 0, i64 0))
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %4
9: ; preds = %4, %1
ret void
}