#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 *strchr1(char const *, ...);
size_t strcspn1(char const *, char const *);
char *strpbrk(char const *, char *);
char *strrchr1(char const *, char);
size_t strspn1(char const *, char const *);
char *strstr1(char const *, char *);
char *strtok1(char *, char *);
int main() {
  const char *test = "This is only a test string ok";
  printf("---- strchr1 ----\n");
  printf("result1 = %s\n", strchr1(test, 'o'));
  char *result2 = strchr1(test, '7');
  if (result2 == NULL)
    printf("result2 = NULL\n");
  else
    printf("result2 != NULL\n");
  const char *test2 = "apy";
  size_t result = strcspn1(test, test2);
  printf("\n---- strcspn1 ----\n");
  printf("Length of the initial segment of the\n");
  printf("string '%s' not\n", test);
  printf("containing characters from '%s'\n", test2);
  printf("is %d\n", result);
  const char *test3 = "sith onT";
  result = strspn1(test, test3);
  printf("\n---- strspn1 ----\n");
  printf("Length of the initial segment of the\n");
  printf("string '%s' only\n", test);
  printf("containing characters from '%s'\n", test3);
  printf("is %d\n", result);
  printf("\n---- strpbrk1 ----\n");
  printf("result1 = %s\n", strpbrk(test, "lycra"));
  char *result3 = strchr1(test, "xzq");
  if (result3 == NULL)
    printf("result3 = NULL\n");
  else
    printf("result3 != NULL\n");
  printf("\n---- strrchr1 ----\n");
  printf("result1 = %s\n", strrchr1(test, 's'));
  char *result4 = strrchr1(test, 'x');
  if (result4 == NULL)
    printf("result4 = NULL\n");
  else
    printf("result4 != NULL\n");
  printf("\n---- strstr1 ----\n");
  printf("result1 = %s\n", strstr1(test, "tes"));
  char *result5 = strstr1(test, "frog");
  if (result5 == NULL)
    printf("result5 = NULL\n");
  else
    printf("result5 != NULL\n");
  printf("\n---- strstr1 ----\n");
  char string[] = "   This is a sentence, with 7 tokens";
  char *tokenPtr;
  printf("%s\n'%s'\n\n%s\n", "The string to be tokenised is: ", string,
         "The tokens are:");
  tokenPtr = strtok1(string, " ,");
  while (tokenPtr != NULL) {
    printf("%s\n", tokenPtr);
    tokenPtr = strtok1(NULL, " ,");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe57(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x6f,%esi
mov    $0x0,%al
call   1060 <strchr1@plt>
mov    %rax,%rsi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x37,%esi
mov    $0x0,%al
call   1060 <strchr1@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    120e <main+0x7e>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121c <main+0x8c>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3d(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10a0 <strcspn1@plt>
mov    %rax,-0x28(%rbp)
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe47(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1090 <strspn1@plt>
mov    %rax,-0x28(%rbp)
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rsi
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe0b(%rip),%rsi
call   1080 <strpbrk@plt>
mov    %rax,%rsi
lea    0xd11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xdf0(%rip),%rsi
mov    $0x0,%al
call   1060 <strchr1@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    135b <main+0x1cb>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1369 <main+0x1d9>
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x73,%esi
call   1040 <strrchr1@plt>
mov    %rax,%rsi
lea    0xca2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x78,%esi
call   1040 <strrchr1@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    13c6 <main+0x236>
lea    0xda2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13d4 <main+0x244>
lea    0xd9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xda2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xda4(%rip),%rsi
call   1070 <strstr1@plt>
mov    %rax,%rsi
lea    0xc35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xd87(%rip),%rsi
call   1070 <strstr1@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    1435 <main+0x2a5>
lea    0xd71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1443 <main+0x2b3>
lea    0xd6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
lea    0xda4(%rip),%rsi
mov    $0x25,%edx
call   1050 <memcpy@plt>
lea    -0x70(%rbp),%rdx
lea    0xd4a(%rip),%rdi
lea    0xd50(%rip),%rsi
lea    0xd69(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
lea    0xd67(%rip),%rsi
call   10b0 <strtok1@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
je     14d0 <main+0x340>
mov    -0x78(%rbp),%rsi
lea    0xd14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xd36(%rip),%rsi
call   10b0 <strtok1@plt>
mov    %rax,-0x78(%rbp)
jmp    149a <main+0x30a>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xf3c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe5f(%rip),%r12
mov    %r12,%rdi
mov    $0x6f,%esi
xor    %eax,%eax
call   1060 <strchr1@plt>
lea    0xe67(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    $0x37,%esi
xor    %eax,%eax
call   1060 <strchr1@plt>
test   %rax,%rax
lea    0xffd(%rip),%rax
lea    0xf02(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
lea    0xe3b(%rip),%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1090 <strcspn1@plt>
mov    %rax,%r14
lea    0xeed(%rip),%rdi
call   1030 <puts@plt>
lea    0xf08(%rip),%rdi
call   1030 <puts@plt>
lea    0xe12(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe12(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe1f(%rip),%r13
mov    %r13,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe12(%rip),%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1080 <strspn1@plt>
mov    %rax,%rbp
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
lea    0xea2(%rip),%rdi
call   1030 <puts@plt>
lea    0xdee(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe90(%rip),%rdi
call   1030 <puts@plt>
lea    0xd4f(%rip),%rsi
lea    0xd5c(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdb1(%rip),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <strchr1@plt>
test   %rax,%rax
lea    0xee1(%rip),%rax
lea    0xe65(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
lea    0xe65(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    $0x73,%esi
call   1050 <strrchr1@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    $0x78,%esi
call   1050 <strrchr1@plt>
test   %rax,%rax
lea    0xe85(%rip),%rax
lea    0xe3c(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
lea    0xe4c(%rip),%r15
mov    %r15,%rdi
call   1030 <puts@plt>
lea    0xd2e(%rip),%rsi
mov    %r12,%rdi
call   1070 <strstr1@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd16(%rip),%rsi
mov    %r12,%rdi
call   1070 <strstr1@plt>
test   %rax,%rax
lea    0xe22(%rip),%rax
lea    0xdf8(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
movaps 0xe59(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe3d(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x736e656b6f7420,%rax
mov    %rax,0x1d(%rsp)
lea    0xcc4(%rip),%rdi
lea    0xcca(%rip),%rsi
lea    0xce3(%rip),%rcx
mov    %rsp,%rbx
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xcdf(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <strtok1@plt>
test   %rax,%rax
je     1427 <main+0x2a7>
lea    0xccb(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rax,%rdi
call   1030 <puts@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   10a0 <strtok1@plt>
test   %rax,%rax
jne    1410 <main+0x290>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"This is only a test string ok\00"
@.str.1 = [19 x i8] c"---- strchr1 ----\0A\00"
@.str.2 = [14 x i8] c"result1 = %s\0A\00"
@.str.3 = [16 x i8] c"result2 = NULL\0A\00"
@.str.4 = [17 x i8] c"result2 != NULL\0A\00"
@.str.5 = [4 x i8] c"apy\00"
@.str.6 = [21 x i8] c"\0A---- strcspn1 ----\0A\00"
@.str.7 = [38 x i8] c"Length of the initial segment of the\0A\00"
@.str.8 = [17 x i8] c"string '%s' not\0A\00"
@.str.9 = [33 x i8] c"containing characters from '%s'\0A\00"
@.str.10 = [7 x i8] c"is %d\0A\00"
@.str.11 = [9 x i8] c"sith onT\00"
@.str.12 = [20 x i8] c"\0A---- strspn1 ----\0A\00"
@.str.13 = [18 x i8] c"string '%s' only\0A\00"
@.str.14 = [21 x i8] c"\0A---- strpbrk1 ----\0A\00"
@.str.15 = [6 x i8] c"lycra\00"
@.str.16 = [4 x i8] c"xzq\00"
@.str.17 = [16 x i8] c"result3 = NULL\0A\00"
@.str.18 = [17 x i8] c"result3 != NULL\0A\00"
@.str.19 = [21 x i8] c"\0A---- strrchr1 ----\0A\00"
@.str.20 = [16 x i8] c"result4 = NULL\0A\00"
@.str.21 = [17 x i8] c"result4 != NULL\0A\00"
@.str.22 = [20 x i8] c"\0A---- strstr1 ----\0A\00"
@.str.23 = [4 x i8] c"tes\00"
@.str.24 = [5 x i8] c"frog\00"
@.str.25 = [16 x i8] c"result5 = NULL\0A\00"
@.str.26 = [17 x i8] c"result5 != NULL\0A\00"
@__const.main.string = [37 x i8] c" This is a sentence, with 7 tokens\00"
@.str.27 = [13 x i8] c"%s\0A'%s'\0A\0A%s\0A\00"
@.str.28 = [32 x i8] c"The string to be tokenised is: \00"
@.str.29 = [16 x i8] c"The tokens are:\00"
@.str.30 = [3 x i8] c" ,\00"
@.str.31 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca [37 x i8]
%11 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8** %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%13 = load i8*, i8** %2
%14 = call i8* (i8*, ...) @strchr1(i8* %13, i32 111)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%16 = load i8*, i8** %2
%17 = call i8* (i8*, ...) @strchr1(i8* %16, i32 55)
store i8* %17, i8** %3
%18 = load i8*, i8** %3
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %22
20: ; preds = %0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %24
22: ; preds = %0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %24
24: ; preds = %22, %20
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8** %4
%25 = load i8*, i8** %2
%26 = load i8*, i8** %4
%27 = call i64 @strcspn1(i8* %25, i8* %26)
store i64 %27, i64* %5
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0))
%30 = load i8*, i8** %2
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* %30)
%32 = load i8*, i8** %4
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i8* %32)
%34 = load i64, i64* %5
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i64 %34)
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i8** %6
%36 = load i8*, i8** %2
%37 = load i8*, i8** %6
%38 = call i64 @strspn1(i8* %36, i8* %37)
store i64 %38, i64* %5
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0))
%41 = load i8*, i8** %2
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0), i8* %41)
%43 = load i8*, i8** %6
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i8* %43)
%45 = load i64, i64* %5
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i64 %45)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0))
%48 = load i8*, i8** %2
%49 = call i8* @strpbrk(i8* %48, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %49)
%51 = load i8*, i8** %2
%52 = call i8* (i8*, ...) @strchr1(i8* %51, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0))
store i8* %52, i8** %7
%53 = load i8*, i8** %7
%54 = icmp eq i8* %53, null
br i1 %54, label %55, label %57
55: ; preds = %24
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.17, i64 0, i64 0))
br label %59
57: ; preds = %24
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.18, i64 0, i64 0))
br label %59
59: ; preds = %57, %55
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.19, i64 0, i64 0))
%61 = load i8*, i8** %2
%62 = call i8* @strrchr1(i8* %61, i8 signext 115)
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %62)
%64 = load i8*, i8** %2
%65 = call i8* @strrchr1(i8* %64, i8 signext 120)
store i8* %65, i8** %8
%66 = load i8*, i8** %8
%67 = icmp eq i8* %66, null
br i1 %67, label %68, label %70
68: ; preds = %59
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0))
br label %72
70: ; preds = %59
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.21, i64 0, i64 0))
br label %72
72: ; preds = %70, %68
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.22, i64 0, i64 0))
%74 = load i8*, i8** %2
%75 = call i8* @strstr1(i8* %74, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.23, i64 0, i64 0))
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %75)
%77 = load i8*, i8** %2
%78 = call i8* @strstr1(i8* %77, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0))
store i8* %78, i8** %9
%79 = load i8*, i8** %9
%80 = icmp eq i8* %79, null
br i1 %80, label %81, label %83
81: ; preds = %72
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.25, i64 0, i64 0))
br label %85
83: ; preds = %72
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.26, i64 0, i64 0))
br label %85
85: ; preds = %83, %81
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.22, i64 0, i64 0))
%87 = bitcast [37 x i8]* %10 to i8*
%88 = getelementptr inbounds [37 x i8], [37 x i8]* %10, i64 0, i64 0
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.27, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.28, i64 0, i64 0), i8* %88, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.29, i64 0, i64 0))
%90 = getelementptr inbounds [37 x i8], [37 x i8]* %10, i64 0, i64 0
%91 = call i8* @strtok1(i8* %90, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.30, i64 0, i64 0))
store i8* %91, i8** %11
br label %92
92: ; preds = %95, %85
%93 = load i8*, i8** %11
%94 = icmp ne i8* %93, null
br i1 %94, label %95, label %99
95: ; preds = %92
%96 = load i8*, i8** %11
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.31, i64 0, i64 0), i8* %96)
%98 = call i8* @strtok1(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.30, i64 0, i64 0))
store i8* %98, i8** %11
br label %92
99: ; preds = %92
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"This is only a test string ok\00"
@.str.2 = [14 x i8] c"result1 = %s\0A\00"
@.str.5 = [4 x i8] c"apy\00"
@.str.8 = [17 x i8] c"string '%s' not\0A\00"
@.str.9 = [33 x i8] c"containing characters from '%s'\0A\00"
@.str.10 = [7 x i8] c"is %d\0A\00"
@.str.11 = [9 x i8] c"sith onT\00"
@.str.13 = [18 x i8] c"string '%s' only\0A\00"
@.str.16 = [4 x i8] c"xzq\00"
@.str.23 = [4 x i8] c"tes\00"
@.str.24 = [5 x i8] c"frog\00"
@__const.main.string = [37 x i8] c" This is a sentence, with 7 tokens\00"
@.str.27 = [13 x i8] c"%s\0A'%s'\0A\0A%s\0A\00"
@.str.28 = [32 x i8] c"The string to be tokenised is: \00"
@.str.29 = [16 x i8] c"The tokens are:\00"
@.str.30 = [3 x i8] c" ,\00"
@str = [18 x i8] c"---- strchr1 ----\00"
@str.32 = [16 x i8] c"result2 != NULL\00"
@str.33 = [20 x i8] c"\0A---- strcspn1 ----\00"
@str.35 = [19 x i8] c"\0A---- strspn1 ----\00"
@str.36 = [37 x i8] c"Length of the initial segment of the\00"
@str.37 = [20 x i8] c"\0A---- strpbrk1 ----\00"
@str.38 = [16 x i8] c"result3 != NULL\00"
@str.39 = [20 x i8] c"\0A---- strrchr1 ----\00"
@str.40 = [16 x i8] c"result4 != NULL\00"
@str.42 = [16 x i8] c"result5 != NULL\00"
@str.43 = [19 x i8] c"\0A---- strstr1 ----\00"
@str.44 = [15 x i8] c"result5 = NULL\00"
@str.45 = [15 x i8] c"result4 = NULL\00"
@str.46 = [15 x i8] c"result3 = NULL\00"
@str.47 = [15 x i8] c"result2 = NULL\00"
define i32 @main() {
%1 = alloca [37 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%3 = tail call i8* (i8*, ...) @strchr1(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 111)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%5 = tail call i8* (i8*, ...) @strchr1(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 55)
%6 = icmp eq i8* %5, null
%7 = select i1 %6, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str.47, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str.32, i64 0, i64 0)
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
%9 = tail call i64 @strcspn1(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.33, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.36, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i64 %9)
%15 = tail call i64 @strspn1(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.35, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.36, i64 0, i64 0))
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i64 %15)
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.37, i64 0, i64 0))
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 10))
%23 = tail call i8* (i8*, ...) @strchr1(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0))
%24 = icmp eq i8* %23, null
%25 = select i1 %24, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str.46, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str.38, i64 0, i64 0)
%26 = tail call i32 @puts(i8* dereferenceable(1) %25)
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.39, i64 0, i64 0))
%28 = tail call i8* @strrchr1(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8 signext 115)
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %28)
%30 = tail call i8* @strrchr1(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8 signext 120)
%31 = icmp eq i8* %30, null
%32 = select i1 %31, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str.45, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str.40, i64 0, i64 0)
%33 = tail call i32 @puts(i8* dereferenceable(1) %32)
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.43, i64 0, i64 0))
%35 = tail call i8* @strstr1(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.23, i64 0, i64 0))
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %35)
%37 = tail call i8* @strstr1(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0))
%38 = icmp eq i8* %37, null
%39 = select i1 %38, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str.44, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str.42, i64 0, i64 0)
%40 = tail call i32 @puts(i8* dereferenceable(1) %39)
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.43, i64 0, i64 0))
%42 = getelementptr inbounds [37 x i8], [37 x i8]* %1, i64 0, i64 0
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.27, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.28, i64 0, i64 0), i8* %42, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.29, i64 0, i64 0))
%44 = call i8* @strtok1(i8* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.30, i64 0, i64 0))
%45 = icmp eq i8* %44, null
br i1 %45, label %51, label %46
46: ; preds = %0, %46
%47 = phi i8* [ %49, %46 ], [ %44, %0 ]
%48 = call i32 @puts(i8* %47)
%49 = call i8* @strtok1(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.30, i64 0, i64 0))
%50 = icmp eq i8* %49, null
br i1 %50, label %51, label %46
51: ; preds = %46, %0
ret i32 0
}