#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 *);
int /*<<< orphan*/ select(char *);
char *strtok(char *, char *);
int main() {
  char *token;
  char text[80] = "select from where";
  token = strtok(text, " ");
  printf("Token = %s\n", token);
  select(token);
  char text2[80] = "select foo where";
  token = strtok(text2, " ");
  printf("Token = %s\n", token);
  select(token);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xea3(%rip),%rsi
mov    $0x50,%edx
call   1040 <memcpy@plt>
lea    -0x60(%rbp),%rdi
lea    0xf2e(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xf1c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <select@plt>
lea    -0xb0(%rbp),%rdi
lea    0xeae(%rip),%rsi
mov    $0x50,%edx
call   1040 <memcpy@plt>
lea    -0xb0(%rbp),%rdi
lea    0xee6(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <select@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xa0,%rsp
movaps 0xefd(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xede(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xebf(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xea3(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xe87(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
lea    0xf1b(%rip),%r14
lea    0x50(%rsp),%rdi
mov    %r14,%rsi
call   1050 <strtok@plt>
mov    %rax,%rbx
lea    0xf06(%rip),%r15
mov    %r15,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <select@plt>
movaps 0xeda(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xebe(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xea2(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe86(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe6a(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    %r14,%rsi
call   1050 <strtok@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <select@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.text = [80 x i8] c"select from where\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [2 x i8] c" \00"
@.str.1 = [12 x i8] c"Token = %s\0A\00"
@__const.main.text2 = [80 x i8] c"select foo where\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [80 x i8]
%4 = alloca [80 x i8]
store i32 0, i32* %1
%5 = bitcast [80 x i8]* %3 to i8*
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%7 = call i8* @strtok(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %2
%8 = load i8*, i8** %2
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %2
%11 = call i32 @select(i8* %10)
%12 = bitcast [80 x i8]* %4 to i8*
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%14 = call i8* @strtok(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %14, i8** %2
%15 = load i8*, i8** %2
%16 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = load i8*, i8** %2
%18 = call i32 @select(i8* %17)
ret i32 0
}

LLVM IR (-O2):
@__const.main.text = [80 x i8] c"select from where\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [2 x i8] c" \00"
@.str.1 = [12 x i8] c"Token = %s\0A\00"
@__const.main.text2 = [80 x i8] c"select foo where\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = call i8* @strtok(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32 @select(i8* %4)
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%8 = call i8* @strtok(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = call i32 @select(i8* %8)
ret i32 0
}