#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 */
typedef int /*<<< orphan*/ res;

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *xstrtok_r(char *, char *, char **);
int test_xstrtok_r(void) {
  char test[80], blah[80], mix[80];
  char *sep = "\\/:;=-";
  char *word, *phrase, *brkt, *brkb;
  char *res[] = {
      "This:blah",      "This:blat",      "This:blab",      "This:blag",
      "is.a:blah",      "is.a:blat",      "is.a:blab",      "is.a:blag",
      "test:blah",      "test:blat",      "test:blab",      "test:blag",
      "of:blah",        "of:blat",        "of:blab",        "of:blag",
      "the:blah",       "the:blat",       "the:blab",       "the:blag",
      "string:blah",    "string:blat",    "string:blab",    "string:blag",
      "tokenizer:blah", "tokenizer:blat", "tokenizer:blab", "tokenizer:blag",
      "function.:blah", "function.:blat", "function.:blab", "function.:blag"};
  int i = 0;
  strcpy(test, "This;is.a:test:of=the/string\\tokenizer-function.");
  for (word = xstrtok_r(test, sep, &brkt); word;
       word = xstrtok_r(NULL, sep, &brkt)) {
    strcpy(blah, "blah:blat:blab:blag");
    for (phrase = xstrtok_r(blah, sep, &brkb); phrase;
         phrase = xstrtok_r(NULL, sep, &brkb)) {
      sprintf(mix, "%s:%s", word, phrase);
      if (i >= (sizeof(res) / sizeof(res[0])))
        return -1;
      if (strcmp(mix, res[i++]) != 0)
        return -1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_xstrtok_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
lea    0xe9e(%rip),%rax
mov    %rax,-0x108(%rbp)
lea    -0x230(%rbp),%rdi
lea    0x2ba9(%rip),%rsi
mov    $0x100,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x234(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xfd5(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x60(%rbp),%rdi
mov    -0x108(%rbp),%rsi
lea    -0x120(%rbp),%rdx
call   1060 <xstrtok_r@plt>
mov    %rax,-0x110(%rbp)
cmpq   $0x0,-0x110(%rbp)
je     12d4 <test_xstrtok_r+0x184>
lea    -0xb0(%rbp),%rdi
lea    0xfc7(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x108(%rbp),%rsi
lea    -0x128(%rbp),%rdx
call   1060 <xstrtok_r@plt>
mov    %rax,-0x118(%rbp)
cmpq   $0x0,-0x118(%rbp)
je     12ac <test_xstrtok_r+0x15c>
lea    -0x100(%rbp),%rdi
mov    -0x110(%rbp),%rdx
mov    -0x118(%rbp),%rcx
lea    0xf8b(%rip),%rsi
call   1070 <sprintf@plt>
movslq -0x234(%rbp),%rax
cmp    $0x20,%rax
jb     1247 <test_xstrtok_r+0xf7>
movl   $0xffffffff,-0x4(%rbp)
jmp    12db <test_xstrtok_r+0x18b>
lea    -0x100(%rbp),%rdi
mov    -0x234(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x234(%rbp)
cltq
mov    -0x230(%rbp,%rax,8),%rsi
ff
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1284 <test_xstrtok_r+0x134>
movl   $0xffffffff,-0x4(%rbp)
jmp    12db <test_xstrtok_r+0x18b>
jmp    1289 <test_xstrtok_r+0x139>
mov    -0x108(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
lea    -0x128(%rbp),%rdx
call   1060 <xstrtok_r@plt>
mov    %rax,-0x118(%rbp)
jmp    11fb <test_xstrtok_r+0xab>
jmp    12b1 <test_xstrtok_r+0x161>
mov    -0x108(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
lea    -0x120(%rbp),%rdx
call   1060 <xstrtok_r@plt>
mov    %rax,-0x110(%rbp)
jmp    11b9 <test_xstrtok_r+0x69>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_xstrtok_r>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
lea    0x1013(%rip),%rsi
lea    0xb0(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xe91(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1050 <xstrtok_r@plt>
test   %rax,%rax
je     118e <test_xstrtok_r+0x4e>
mov    %rax,%r14
xor    %r12d,%r12d
lea    0x10(%rsp),%r13
jmp    11d1 <test_xstrtok_r+0x91>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%r12d
xor    %r15d,%r15d
xor    %edi,%edi
lea    0xe41(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1050 <xstrtok_r@plt>
mov    %rax,%r14
test   %rax,%rax
je     1191 <test_xstrtok_r+0x51>
lea    0x60(%rsp),%rbx
mov    %rbx,%rdi
lea    0xfbc(%rip),%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
lea    0xe11(%rip),%rsi
mov    %rsp,%rdx
call   1050 <xstrtok_r@plt>
test   %rax,%rax
je     11b3 <test_xstrtok_r+0x73>
mov    %r12d,%ebp
cmp    $0x21,%r12d
mov    $0x20,%ecx
cmovb  %ecx,%r12d
lea    0xfa5(%rip),%rcx
lea    (%rcx,%rbp,4),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
lea    0xf86(%rip),%rsi
mov    %r14,%rdx
mov    %rax,%rcx
call   1060 <sprintf@plt>
mov    $0xffffffff,%r15d
cmp    %rbp,%r12
je     1191 <test_xstrtok_r+0x51>
movslq (%rbx),%rsi
lea    0xf6a(%rip),%rax
add    %rax,%rsi
mov    %r13,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1191 <test_xstrtok_r+0x51>
add    $0x1,%rbp
xor    %edi,%edi
lea    0xd91(%rip),%rsi
mov    %rsp,%rdx
call   1050 <xstrtok_r@plt>
add    $0x4,%rbx
test   %rax,%rax
jne    1220 <test_xstrtok_r+0xe0>
jmp    11b0 <test_xstrtok_r+0x70>

LLVM IR (-O0):
@.str = [7 x i8] c"\\/:;=-\00"
@.str.1 = [10 x i8] c"This:blah\00"
@.str.2 = [10 x i8] c"This:blat\00"
@.str.3 = [10 x i8] c"This:blab\00"
@.str.4 = [10 x i8] c"This:blag\00"
@.str.5 = [10 x i8] c"is.a:blah\00"
@.str.6 = [10 x i8] c"is.a:blat\00"
@.str.7 = [10 x i8] c"is.a:blab\00"
@.str.8 = [10 x i8] c"is.a:blag\00"
@.str.9 = [10 x i8] c"test:blah\00"
@.str.10 = [10 x i8] c"test:blat\00"
@.str.11 = [10 x i8] c"test:blab\00"
@.str.12 = [10 x i8] c"test:blag\00"
@.str.13 = [8 x i8] c"of:blah\00"
@.str.14 = [8 x i8] c"of:blat\00"
@.str.15 = [8 x i8] c"of:blab\00"
@.str.16 = [8 x i8] c"of:blag\00"
@.str.17 = [9 x i8] c"the:blah\00"
@.str.18 = [9 x i8] c"the:blat\00"
@.str.19 = [9 x i8] c"the:blab\00"
@.str.20 = [9 x i8] c"the:blag\00"
@.str.21 = [12 x i8] c"string:blah\00"
@.str.22 = [12 x i8] c"string:blat\00"
@.str.23 = [12 x i8] c"string:blab\00"
@.str.24 = [12 x i8] c"string:blag\00"
@.str.25 = [15 x i8] c"tokenizer:blah\00"
@.str.26 = [15 x i8] c"tokenizer:blat\00"
@.str.27 = [15 x i8] c"tokenizer:blab\00"
@.str.28 = [15 x i8] c"tokenizer:blag\00"
@.str.29 = [15 x i8] c"function.:blah\00"
@.str.30 = [15 x i8] c"function.:blat\00"
@.str.31 = [15 x i8] c"function.:blab\00"
@.str.32 = [15 x i8] c"function.:blag\00"
@__const.test_xstrtok_r.res = [32 x i8*] [i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.29, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.31, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.32, i32 0, i32 0)]
@.str.33 = [49 x i8] c"This;is.a:test:of=the/string\\tokenizer-function.\00"
@.str.34 = [20 x i8] c"blah:blat:blab:blag\00"
@.str.35 = [6 x i8] c"%s:%s\00"
define i32 @test_xstrtok_r() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca [80 x i8]
%4 = alloca [80 x i8]
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca [32 x i8*]
%11 = alloca i32
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %5
%12 = bitcast [32 x i8*]* %10 to i8*
store i32 0, i32* %11
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%14 = call i32 @strcpy(i8* %13, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.33, i64 0, i64 0))
%15 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%16 = load i8*, i8** %5
%17 = call i8* @xstrtok_r(i8* %15, i8* %16, i8** %8)
store i8* %17, i8** %6
br label %18
18: ; preds = %54, %0
%19 = load i8*, i8** %6
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %57
21: ; preds = %18
%22 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%23 = call i32 @strcpy(i8* %22, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.34, i64 0, i64 0))
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%25 = load i8*, i8** %5
%26 = call i8* @xstrtok_r(i8* %24, i8* %25, i8** %9)
store i8* %26, i8** %7
br label %27
27: ; preds = %50, %21
%28 = load i8*, i8** %7
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %53
30: ; preds = %27
%31 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%32 = load i8*, i8** %6
%33 = load i8*, i8** %7
%34 = call i32 @sprintf(i8* %31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.35, i64 0, i64 0), i8* %32, i8* %33)
%35 = load i32, i32* %11
%36 = sext i32 %35 to i64
%37 = icmp uge i64 %36, 32
br i1 %37, label %38, label %39
38: ; preds = %30
store i32 -1, i32* %1
br label %58
39: ; preds = %30
%40 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%41 = load i32, i32* %11
%42 = add nsw i32 %41, 1
store i32 %42, i32* %11
%43 = sext i32 %41 to i64
%44 = getelementptr inbounds [32 x i8*], [32 x i8*]* %10, i64 0, i64 %43
%45 = load i8*, i8** %44
%46 = call i64 @strcmp(i8* %40, i8* %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %39
store i32 -1, i32* %1
br label %58
49: ; preds = %39
br label %50
50: ; preds = %49
%51 = load i8*, i8** %5
%52 = call i8* @xstrtok_r(i8* null, i8* %51, i8** %9)
store i8* %52, i8** %7
br label %27
53: ; preds = %27
br label %54
54: ; preds = %53
%55 = load i8*, i8** %5
%56 = call i8* @xstrtok_r(i8* null, i8* %55, i8** %8)
store i8* %56, i8** %6
br label %18
57: ; preds = %18
store i32 0, i32* %1
br label %58
58: ; preds = %57, %48, %38
%59 = load i32, i32* %1
ret i32 %59
}

LLVM IR (-O2):
@.str = [7 x i8] c"\\/:;=-\00"
@.str.1 = [10 x i8] c"This:blah\00"
@.str.2 = [10 x i8] c"This:blat\00"
@.str.3 = [10 x i8] c"This:blab\00"
@.str.4 = [10 x i8] c"This:blag\00"
@.str.5 = [10 x i8] c"is.a:blah\00"
@.str.6 = [10 x i8] c"is.a:blat\00"
@.str.7 = [10 x i8] c"is.a:blab\00"
@.str.8 = [10 x i8] c"is.a:blag\00"
@.str.9 = [10 x i8] c"test:blah\00"
@.str.10 = [10 x i8] c"test:blat\00"
@.str.11 = [10 x i8] c"test:blab\00"
@.str.12 = [10 x i8] c"test:blag\00"
@.str.13 = [8 x i8] c"of:blah\00"
@.str.14 = [8 x i8] c"of:blat\00"
@.str.15 = [8 x i8] c"of:blab\00"
@.str.16 = [8 x i8] c"of:blag\00"
@.str.17 = [9 x i8] c"the:blah\00"
@.str.18 = [9 x i8] c"the:blat\00"
@.str.19 = [9 x i8] c"the:blab\00"
@.str.20 = [9 x i8] c"the:blag\00"
@.str.21 = [12 x i8] c"string:blah\00"
@.str.22 = [12 x i8] c"string:blat\00"
@.str.23 = [12 x i8] c"string:blab\00"
@.str.24 = [12 x i8] c"string:blag\00"
@.str.25 = [15 x i8] c"tokenizer:blah\00"
@.str.26 = [15 x i8] c"tokenizer:blat\00"
@.str.27 = [15 x i8] c"tokenizer:blab\00"
@.str.28 = [15 x i8] c"tokenizer:blag\00"
@.str.29 = [15 x i8] c"function.:blah\00"
@.str.30 = [15 x i8] c"function.:blat\00"
@.str.31 = [15 x i8] c"function.:blab\00"
@.str.32 = [15 x i8] c"function.:blag\00"
@reltable.test_xstrtok_r = [32 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.1 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.2 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.3 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.4 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.5 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.6 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.7 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.8 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.9 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.10 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.11 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.12 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.13 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.14 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.15 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.16 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.17 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.18 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.19 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.20 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.21 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.22 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.23 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.24 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.25 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.26 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.27 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.28 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.29 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.30 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.31 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.32 to i64), i64 ptrtoint ([32 x i32]* @reltable.test_xstrtok_r to i64)) to i32)]
@.str.33 = [49 x i8] c"This;is.a:test:of=the/string\\tokenizer-function.\00"
@.str.34 = [20 x i8] c"blah:blat:blab:blag\00"
@.str.35 = [6 x i8] c"%s:%s\00"
define i32 @test_xstrtok_r() {
%1 = alloca [80 x i8]
%2 = alloca [80 x i8]
%3 = alloca [80 x i8]
%4 = alloca i8*
%5 = alloca i8*
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%9 = bitcast i8** %4 to i8*
%10 = bitcast i8** %5 to i8*
%11 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.33, i64 0, i64 0))
%12 = call i8* @xstrtok_r(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %4)
%13 = icmp eq i8* %12, null
br i1 %13, label %44, label %14
14: ; preds = %0, %40
%15 = phi i32 [ %41, %40 ], [ 0, %0 ]
%16 = phi i8* [ %42, %40 ], [ %12, %0 ]
%17 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.34, i64 0, i64 0))
%18 = call i8* @xstrtok_r(i8* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %5)
%19 = icmp eq i8* %18, null
br i1 %19, label %40, label %20
20: ; preds = %14
%21 = zext i32 %15 to i64
%22 = call i32 @llvm.umax.i32(i32 %15, i32 32)
%23 = zext i32 %22 to i64
br label %24
24: ; preds = %20, %34
%25 = phi i64 [ %21, %20 ], [ %35, %34 ]
%26 = phi i8* [ %18, %20 ], [ %36, %34 ]
%27 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.35, i64 0, i64 0), i8* %16, i8* %26)
%28 = icmp eq i64 %25, %23
br i1 %28, label %44, label %29
29: ; preds = %24
%30 = shl i64 %25, 2
%31 = call i8* @llvm.load.relative.i64(i8* bitcast ([32 x i32]* @reltable.test_xstrtok_r to i8*), i64 %30)
%32 = call i64 @strcmp(i8* %8, i8* %31)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %44
34: ; preds = %29
%35 = add nuw nsw i64 %25, 1
%36 = call i8* @xstrtok_r(i8* null, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %5)
%37 = icmp eq i8* %36, null
br i1 %37, label %38, label %24
38: ; preds = %34
%39 = trunc i64 %35 to i32
br label %40
40: ; preds = %38, %14
%41 = phi i32 [ %15, %14 ], [ %39, %38 ]
%42 = call i8* @xstrtok_r(i8* null, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %4)
%43 = icmp eq i8* %42, null
br i1 %43, label %44, label %14
44: ; preds = %40, %29, %24, %0
%45 = phi i32 [ 0, %0 ], [ -1, %24 ], [ -1, %29 ], [ 0, %40 ]
ret i32 %45
}