#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 */
char *ho_strtok_r(char *, char *, char **);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  char test[400];
  char *sep = ":/.?&#=";
  char *word, *phrase, *brkt, *brkb;
  strcpy(
      test,
      ":/http://fanyi.baidu.com/"
      "translate?query=#&keyfrom=baidu&smartresult=dict&lang=auto2zh#auto/zh/");
  for (word = ho_strtok_r(test, sep, &brkt); word;
       word = ho_strtok_r(NULL, sep, &brkt)) {
    printf("::wrod = %s\n", word);
  }
  printf("%p\n", brkt);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rax
mov    %rax,-0x1a8(%rbp)
lea    -0x1a0(%rbp),%rdi
lea    0xeaa(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x1a0(%rbp),%rdi
mov    -0x1a8(%rbp),%rsi
lea    -0x1c0(%rbp),%rdx
call   1050 <ho_strtok_r@plt>
mov    %rax,-0x1b0(%rbp)
cmpq   $0x0,-0x1b0(%rbp)
je     11c8 <main+0x98>
mov    -0x1b0(%rbp),%rsi
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1a8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
lea    -0x1c0(%rbp),%rdx
call   1050 <ho_strtok_r@plt>
mov    %rax,-0x1b0(%rbp)
jmp    1184 <main+0x54>
mov    -0x1c0(%rbp),%rsi
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1a0,%rsp
lea    0xec5(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xea9(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1050 <ho_strtok_r@plt>
test   %rax,%rax
je     119d <main+0x6d>
lea    0xef8(%rip),%r14
lea    0xe89(%rip),%r15
lea    0x8(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %edi,%edi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <ho_strtok_r@plt>
test   %rax,%rax
jne    1180 <main+0x50>
mov    0x8(%rsp),%rsi
lea    0xecc(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c":/.?&#=\00"
@.str.1 = [96 x i8] c":/http://fanyi.baidu.com/translate?query=#&keyfrom=baidu&smartresult=dict&lang=auto2zh#auto/zh/\00"
@.str.2 = [13 x i8] c"::wrod = %s\0A\00"
@.str.3 = [4 x i8] c"%p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [400 x i8]
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %3
%8 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 0
%9 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str.1, i64 0, i64 0))
%10 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 0
%11 = load i8*, i8** %3
%12 = call i8* @ho_strtok_r(i8* %10, i8* %11, i8** %6)
store i8* %12, i8** %4
br label %13
13: ; preds = %19, %0
%14 = load i8*, i8** %4
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load i8*, i8** %4
%18 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %16
%20 = load i8*, i8** %3
%21 = call i8* @ho_strtok_r(i8* null, i8* %20, i8** %6)
store i8* %21, i8** %4
br label %13
22: ; preds = %13
%23 = load i8*, i8** %6
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %23)
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [8 x i8] c":/.?&#=\00"
@.str.1 = [96 x i8] c":/http://fanyi.baidu.com/translate?query=#&keyfrom=baidu&smartresult=dict&lang=auto2zh#auto/zh/\00"
@.str.2 = [13 x i8] c"::wrod = %s\0A\00"
@.str.3 = [4 x i8] c"%p\0A\00"
define i32 @main() {
%1 = alloca [400 x i8]
%2 = alloca i8*
%3 = getelementptr inbounds [400 x i8], [400 x i8]* %1, i64 0, i64 0
%4 = bitcast i8** %2 to i8*
%5 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str.1, i64 0, i64 0))
%6 = call i8* @ho_strtok_r(i8* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2)
%7 = icmp eq i8* %6, null
br i1 %7, label %13, label %8
8: ; preds = %0, %8
%9 = phi i8* [ %11, %8 ], [ %6, %0 ]
%10 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%11 = call i8* @ho_strtok_r(i8* null, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2)
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %8
13: ; preds = %8, %0
%14 = load i8*, i8** %2
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %14)
ret i32 0
}