#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*/ parse_subtoken(int *, int, char *);
char *strtok_r(char *, char *, char **);
void split_into_subtokens(bool *arr, int len, char *token) {
  char *savePtr = token;
  char *subtoken = strtok_r(savePtr, ",", &savePtr);
  while (subtoken) {
    parse_subtoken(arr, len, subtoken);
    subtoken = strtok_r(savePtr, ",", &savePtr);
  }
}


x86 assembly (clang, -O0):
<split_into_subtokens>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xeba(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1030 <strtok_r@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     118b <split_into_subtokens+0x6b>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x28(%rbp),%rdx
call   1040 <parse_subtoken@plt>
mov    -0x20(%rbp),%rdi
lea    0xe87(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1030 <strtok_r@plt>
mov    %rax,-0x28(%rbp)
jmp    1153 <split_into_subtokens+0x33>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<split_into_subtokens>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %rdx,(%rsp)
lea    0xec6(%rip),%rsi
mov    %rsp,%rdx
mov    %rax,%rdi
call   1030 <strtok_r@plt>
test   %rax,%rax
je     1181 <split_into_subtokens+0x61>
lea    0xeaf(%rip),%r14
mov    %rsp,%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
call   1040 <parse_subtoken@plt>
mov    (%rsp),%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <strtok_r@plt>
test   %rax,%rax
jne    1160 <split_into_subtokens+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c",\00"
define void @split_into_subtokens(i32* %0, i32 %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = load i8*, i8** %6
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = call i8* @strtok_r(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %7)
store i8* %11, i8** %8
br label %12
12: ; preds = %15, %3
%13 = load i8*, i8** %8
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load i32*, i32** %4
%17 = load i32, i32* %5
%18 = load i8*, i8** %8
%19 = call i32 @parse_subtoken(i32* %16, i32 %17, i8* %18)
%20 = load i8*, i8** %7
%21 = call i8* @strtok_r(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %7)
store i8* %21, i8** %8
br label %12
22: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c",\00"
define void @split_into_subtokens(i32* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
store i8* %2, i8** %4
%6 = call i8* @strtok_r(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %4)
%7 = icmp eq i8* %6, null
br i1 %7, label %14, label %8
8: ; preds = %3, %8
%9 = phi i8* [ %12, %8 ], [ %6, %3 ]
%10 = call i32 @parse_subtoken(i32* %0, i32 %1, i8* %9)
%11 = load i8*, i8** %4
%12 = call i8* @strtok_r(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %4)
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %8
14: ; preds = %8, %3
ret void
}