// File: /workspace/github_cpp_makefile_star2_O1/aalto-speech[P]ftk/util/str.hh
// Function: str::split(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char const*, bool, unsigned int)
inline std::vector<std::string>
split(const std::string &str, const char *delims, bool group,
      unsigned int num_fields = 0)
{
    std::vector<std::string> fields;
    size_t begin = 0;
    size_t end = 0;

    fields.clear();
    bool delim_pending = false;
    while (begin < str.length()) {
        // If 'fields' fields was requested and, this is the last field,
        // include the rest.
        if (num_fields > 0 && fields.size() == num_fields - 1) {
            delim_pending = false;
            fields.push_back(str.substr(begin));
            break;
        }

        // Find the string before the next delim
        delim_pending = false;
        while (end < str.length()) {
            if (strchr(delims, str[end])) {
                delim_pending = true;
                break;
            }
            end++;
        }
        fields.push_back(str.substr(begin, end - begin));

        // Eat the delim or group of delims
        end++;
        if (group)
            while (end < str.length() && strchr(delims, str[end]))
                end++;

        begin = end;
    }

    if (delim_pending)
        fields.push_back("");

    return fields;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r8d, %r15d
movl %ecx, -0x64(%rbp)
movq %rdx, -0x60(%rbp)
movq %rsi, %r14
movq %rdi, %r13
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
callq 0x82e8
movq 0x8(%r14), %r12
testq %r12, %r12
je 0x7d30
leal -0x1(%r15), %eax
movq %rax, -0x78(%rbp)
xorl %ebx, %ebx
movq %r13, -0x70(%rbp)
movq %r14, -0x58(%rbp)
movq %r15, -0x80(%rbp)
testl %r15d, %r15d
je 0x7bed
movq 0x8(%r13), %rax
subq (%r13), %rax
sarq $0x5, %rax
cmpq -0x78(%rbp), %rax
je 0x7cfc
cmpq %r12, %rbx
setb -0x29(%rbp)
jae 0x7c37
movq (%r14), %r14
movsbl (%r14,%rbx), %esi
movq -0x60(%rbp), %rdi
callq 0x4130
movq %rbx, %r15
testq %rax, %rax
jne 0x7c4a
leaq 0x1(%rbx), %r15
movq %r15, %r13
cmpq %r15, %r12
je 0x7c3c
movsbl (%r14,%r13), %esi
movq -0x60(%rbp), %rdi
callq 0x4130
leaq 0x1(%r13), %r15
testq %rax, %rax
je 0x7c13
decq %r15
jmp 0x7c3f
movq %rbx, %r15
jmp 0x7c4a
movq %r12, %r15
cmpq %r12, %r13
setb -0x29(%rbp)
movq -0x70(%rbp), %r13
movq %r15, %rcx
subq %rbx, %rcx
leaq -0x50(%rbp), %r12
movq %r12, %rdi
movq -0x58(%rbp), %r14
movq %r14, %rsi
movq %rbx, %rdx
callq 0x43b0
movq %r13, %rdi
movq %r12, %rsi
callq 0x832e
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x7c83
callq 0x4350
incq %r15
cmpb $0x0, -0x64(%rbp)
je 0x7cba
movq 0x8(%r14), %rbx
cmpq %rbx, %r15
jae 0x7cba
movq (%r14), %r14
movsbl (%r14,%r15), %esi
movq -0x60(%rbp), %rdi
callq 0x4130
testq %rax, %rax
je 0x7cb6
incq %r15
cmpq %r15, %rbx
jne 0x7c98
movq %rbx, %r15
movq -0x58(%rbp), %r14
movq 0x8(%r14), %r12
movq %r15, %rbx
cmpq %r12, %r15
movq -0x80(%rbp), %r15
jb 0x7bd2
cmpb $0x0, -0x29(%rbp)
je 0x7d30
leaq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
movq %rax, (%rdi)
leaq 0x1e8b1(%rip), %rdx     # 0x26597
movq %rdx, %rsi
callq 0x5fa4
leaq -0x50(%rbp), %rsi
movq %r13, %rdi
callq 0x832e
jmp 0x7d1e
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq $-0x1, %rcx
callq 0x43b0
leaq -0x50(%rbp), %rsi
movq %r13, %rdi
callq 0x832e
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x7d30
callq 0x4350
movq %r13, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7d4f
jmp 0x7d4a
jmp 0x7d4f
jmp 0x7d4a
movq %rax, %r14
jmp 0x7d64
movq %rax, %r14
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x7d64
callq 0x4350
movq -0x70(%rbp), %rdi
callq 0x5d54
movq %r14, %rdi
callq 0x4650
nop