// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/includes/load-service.h
// Function: dinit_load::read_config_name(__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>&, __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, bool, bool*)
inline string read_config_name(string_iterator & i, string_iterator end, bool env = false, bool *num = nullptr) noexcept
{
    using std::locale;
    using std::ctype;
    using std::use_facet;

    // To avoid the horror of locales, we'll use the classic facet only, to identify digits, control
    // characters and punctuation. (Unless something is totally crazy, we are talking about ASCII or
    // a superset of it, but using the facet allows us to avoid that assumption). However, we're only
    // working with "narrow" char type so accuracy is limited. In general, that's not going to matter
    // much, but may allow certain unicode punctuation characters to be used as part of a name for example.
    const ctype<char> & facet = use_facet<ctype<char>>(locale::classic());

    string rval;

    // For environment lookups, integers are valid names (particularly for argument)
    if (env && facet.is(ctype<char>::digit, *i)) {
        while (facet.is(ctype<char>::digit, *i)) {
            rval += *i;
            ++i;
        }
        if (num) {
            *num = true;
        }
        return rval;
    }

    // Don't allow empty name, numeric digit, or dash/dot at start of setting name
    if (i == end || (*i == '-' || *i == '.' || facet.is(ctype<char>::digit, *i))) {
        return {};
    }

    // Within the setting name, allow dash and dot unless parsing envvar name
    // also allow any non-control, non-punctuation non-space character.
    while (i != end && (((*i == '-' || *i == '.') && !env) || *i == '_'
            || (!facet.is(ctype<char>::cntrl, *i) && !facet.is(ctype<char>::punct, *i)
                    && !facet.is(ctype<char>::space, *i)))) {
        rval += *i;
        ++i;
    }
    return rval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, 0x20(%rsp)
movl %ecx, %ebp
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
callq 0x4400
movq %rax, %rdi
callq 0x4130
movq %rax, %r15
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x8(%rsp), %rax
andq $0x0, (%rax)
movb $0x0, 0x8(%rax)
movq (%r14), %rax
testb %bpl, %bpl
je 0xd42c
movzbl (%rax), %ecx
movq 0x30(%r15), %rdx
movzwl (%rdx,%rcx,2), %edx
btl $0xb, %edx
jb 0xd4a7
cmpq %r12, %rax
je 0xd49a
movzbl (%rax), %ecx
leal -0x2d(%rcx), %edx
cmpb $0x2, %dl
jb 0xd49a
movq 0x30(%r15), %rdx
testb $0x8, 0x1(%rdx,%rcx,2)
jne 0xd49a
cmpq %r12, %rax
je 0xd4e1
movzbl (%rax), %eax
cmpq $0x2d, %rax
jne 0xd460
testb %bpl, %bpl
jne 0xd475
jmp 0xd484
cmpq $0x2e, %rax
setne %cl
orb %bpl, %cl
cmpq $0x5f, %rax
setne %dl
testb %cl, %dl
je 0xd484
movq 0x30(%r15), %rcx
movzwl (%rcx,%rax,2), %ecx
testw $0x2006, %cx            # imm = 0x2006
jne 0xd4e1
movsbl %al, %esi
movq %rsp, %rdi
callq 0x42b0
movq (%r14), %rax
incq %rax
movq %rax, (%r14)
jmp 0xd447
leaq 0x10(%rbx), %r13
movq %r13, (%rbx)
leaq 0x8(%rbx), %rcx
jmp 0xd519
movq %rsp, %r12
movq 0x20(%rsp), %rbp
btl $0xb, %edx
jae 0xd4d8
movsbl %cl, %esi
movq %r12, %rdi
callq 0x42b0
movq (%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, (%r14)
movzbl 0x1(%rax), %ecx
movq 0x30(%r15), %rax
movzwl (%rax,%rcx,2), %edx
jmp 0xd4af
testq %rbp, %rbp
je 0xd4e1
movb $0x1, (%rbp)
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq (%rsp), %rcx
cmpq %r13, %rcx
je 0xd4ff
movq %rcx, (%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x10(%rbx)
jmp 0xd507
movups (%r13), %xmm0
movups %xmm0, (%rax)
leaq 0x8(%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rax, 0x8(%rbx)
movq %r13, (%rsp)
andq $0x0, (%rcx)
movb $0x0, (%r13)
movq %rsp, %rdi
callq 0x4150
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xd540
jmp 0xd540
movq %rax, %rdi
callq 0xac53