#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
char *strtok(char *, char *);
int main() {
  char s[] = "GET  /index.html  HTTP/1.1";
  char ss[] = "info.php";
  char *p;
  printf("%s\n", strtok(s, " /"));
  printf("%s\n", strtok(NULL, " /"));
  printf("%s\n", strtok(ss, "."));
  printf("%s\n", strtok(NULL, "."));
  return 1;
  while ((p = strtok(s, " /"))) {
    printf("%s ", p);
    printf("\n");
    getchar();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec1(%rip),%ax
mov    %ax,-0x8(%rbp)
mov    0xeb9(%rip),%al
mov    %al,-0x6(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x29(%rbp)
mov    0xeae(%rip),%al
mov    %al,-0x21(%rbp)
lea    -0x20(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,%rsi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe84(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,%rsi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x29(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,%rsi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe45(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,%rsi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movups 0xedf(%rip),%xmm0
movups %xmm0,0x1b(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x7068702e6f666e69,%rax
70 68 70
mov    %rax,(%rsp)
movb   $0x0,0x8(%rsp)
lea    0xecd(%rip),%rbx
lea    0x10(%rsp),%rdi
mov    %rbx,%rsi
call   1040 <strtok@plt>
mov    %rax,%rdi
call   1030 <puts@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <strtok@plt>
mov    %rax,%rdi
call   1030 <puts@plt>
lea    0xea2(%rip),%rbx
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1040 <strtok@plt>
mov    %rax,%rdi
call   1030 <puts@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <strtok@plt>
mov    %rax,%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.s = [27 x i8] c"GET /index.html HTTP/1.1\00"
@__const.main.ss = [9 x i8] c"info.php\00"
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [3 x i8] c" /\00"
@.str.2 = [2 x i8] c".\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [27 x i8]
%3 = alloca [9 x i8]
%4 = alloca i8*
store i32 0, i32* %1
%5 = bitcast [27 x i8]* %2 to i8*
%6 = bitcast [9 x i8]* %3 to i8*
%7 = getelementptr inbounds [27 x i8], [27 x i8]* %2, i64 0, i64 0
%8 = call i8* @strtok(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%13 = call i8* @strtok(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
ret i32 1
}

LLVM IR (-O2):
@__const.main.s = [27 x i8] c"GET /index.html HTTP/1.1\00"
@__const.main.ss = [9 x i8] c"info.php\00"
@.str.1 = [3 x i8] c" /\00"
@.str.2 = [2 x i8] c".\00"
define i32 @main() {
%1 = alloca [27 x i8]
%2 = alloca [9 x i8]
%3 = getelementptr inbounds [27 x i8], [27 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%5 = call i8* @strtok(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) %5)
%7 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) %7)
%9 = call i8* @strtok(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) %9)
%11 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @puts(i8* dereferenceable(1) %11)
ret i32 1
}