// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/includes/load-service.h
// Function: dinit_load::parse_gid_param(file_pos_ref, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, string_view, char const*)
inline gid_t parse_gid_param(file_pos_ref input_pos, const std::string &param,
        ::string_view service_name, const char *setting_name)
{
    const char * gid_err_msg = "specified group id contains invalid numeric characters or is "
            "outside allowed range.";

    // Could be a name or a numeric id. But we should assume numeric first, just in case
    // a user manages to give themselves a username that parses as a number.
    std::size_t ind = 0;
    try {
        // POSIX does not specify whether uid_t is an signed or unsigned, but regardless
        // is is probably safe to assume that valid values are positive. We'll also assume
        // that the value range fits with "unsigned long long" since it seems unlikely
        // that would ever not be the case.
        static_assert((uintmax_t)std::numeric_limits<gid_t>::max()
                <= (uintmax_t)std::numeric_limits<unsigned long long>::max(), "gid_t is too large");
        unsigned long long v = std::stoull(param, &ind, 0);
        if (v > static_cast<unsigned long long>(std::numeric_limits<gid_t>::max())
                || ind != param.length()) {
            throw service_description_exc(service_name, std::string(setting_name) + ": " + gid_err_msg,
                    input_pos);
        }
        return v;
    }
    catch (std::out_of_range &exc) {
        throw service_description_exc(service_name, std::string(setting_name) + ": " + gid_err_msg,
                input_pos);
    }
    catch (std::invalid_argument &exc) {
        // Ok, so it doesn't look like a number: proceed...
    }

    errno = 0;
    struct group * grent = getgrnam(param.c_str());
    if (grent == nullptr) {
        // Maybe an error, maybe just no entry.
        if (errno == 0) {
            throw service_description_exc(service_name, std::string(setting_name) + ": specified group \""
                    + param + "\" does not exist in system database.", input_pos);
        }
        else {
            throw service_description_exc(service_name, std::string("error accessing group database: ")
                    + strerror(errno), input_pos);
        }
    }

    return grent->gr_gid;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %r9, %r14
movq %rdx, %r12
movl %edi, 0x80(%rsp)
movq %rsi, 0x88(%rsp)
movq %rcx, 0x70(%rsp)
movq %r8, 0x78(%rsp)
leaq 0xb0(%rsp), %rsi
andq $0x0, (%rsi)
movq %rdx, %rdi
xorl %edx, %edx
callq 0x14114
movq %rax, %rcx
shrq $0x20, %rcx
jne 0x13093
movq 0xb0(%rsp), %rcx
cmpq 0x8(%r12), %rcx
jne 0x13093
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x70
popq %rdi
callq 0x41d0
movq %rax, %r15
leaq 0x50(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0xc1fa
leaq 0x90(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
movq %r14, %rsi
callq 0xb9ce
leaq 0x4684(%rip), %rdx      # 0x17750
leaq 0x10(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0xcb22
leaq 0x5474(%rip), %rdx      # 0x18559
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xcb22
movb $0x1, %bpl
leaq 0x50(%rsp), %rsi
leaq 0x30(%rsp), %rdx
leaq 0x80(%rsp), %rcx
movq %r15, %rdi
callq 0x1205c
xorl %ebp, %ebp
leaq 0x10ae6(%rip), %rsi     # 0x23c00
leaq -0x1345(%rip), %rdx     # 0x11ddc
movq %r15, %rdi
callq 0x4610
jmp 0x133af
movq %rdx, %r13
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x41a0
jmp 0x13149
movq %rdx, %r13
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x10(%rsp), %rdi
callq 0x41a0
jmp 0x1315e
movq %rdx, %r13
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x90(%rsp), %rdi
callq 0x41a0
jmp 0x13176
movq %rdx, %r13
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x50(%rsp), %rdi
callq 0x41a0
testb %bpl, %bpl
jne 0x1318d
jmp 0x1319d
movq %rdx, %r13
movq %rax, %rbx
movq %r15, %rdi
callq 0x42d0
jmp 0x1319d
movq %rdx, %r13
movq %rax, %rbx
cmpl $0x2, %r13d
je 0x131df
cmpl $0x1, %r13d
jne 0x1349b
movq %rbx, %rdi
callq 0x4160
callq 0x4600
callq 0x4050
movq %rax, %rbx
andl $0x0, (%rax)
movq (%r12), %rdi
callq 0x4370
testq %rax, %rax
je 0x13282
movl 0x10(%rax), %eax
jmp 0x13081
movq %rbx, %rdi
callq 0x4160
pushq $0x70
popq %rdi
callq 0x41d0
movq %rax, %r15
leaq 0x50(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0xc1fa
leaq 0x90(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
movq %r14, %rsi
callq 0xb9ce
leaq 0x4530(%rip), %rdx      # 0x17750
leaq 0x10(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0xcb22
leaq 0x5320(%rip), %rdx      # 0x18559
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xcb22
movb $0x1, %bpl
leaq 0x50(%rsp), %rsi
leaq 0x30(%rsp), %rdx
leaq 0x80(%rsp), %rcx
movq %r15, %rdi
callq 0x1205c
xorl %ebp, %ebp
leaq 0x10992(%rip), %rsi     # 0x23c00
leaq -0x1499(%rip), %rdx     # 0x11ddc
movq %r15, %rdi
callq 0x4610
jmp 0x133af
movl (%rbx), %ebp
pushq $0x70
popq %rdi
callq 0x41d0
movq %rax, %r15
testl %ebp, %ebp
jne 0x13339
leaq 0x50(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0xc1fa
leaq 0xb8(%rsp), %rdi
leaq 0xf(%rsp), %rdx
movq %r14, %rsi
callq 0xb9ce
leaq 0x52eb(%rip), %rdx      # 0x185ad
leaq 0x90(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0xcb22
leaq 0x10(%rsp), %rdi
leaq 0x90(%rsp), %rsi
movq %r12, %rdx
callq 0xce5d
leaq 0x523a(%rip), %rdx      # 0x1852d
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xcb22
movb $0x1, %bpl
leaq 0x50(%rsp), %rsi
leaq 0x30(%rsp), %rdx
leaq 0x80(%rsp), %rcx
movq %r15, %rdi
callq 0x1205c
xorl %ebp, %ebp
leaq 0x108d8(%rip), %rsi     # 0x23c00
leaq -0x1553(%rip), %rdx     # 0x11ddc
movq %r15, %rdi
callq 0x4610
jmp 0x133af
leaq 0x50(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0xc1fa
leaq 0x5272(%rip), %rsi      # 0x185c1
leaq 0x10(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0xb9ce
movl (%rbx), %edi
callq 0x4130
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movq %rax, %rdx
callq 0xcb22
movb $0x1, %bpl
leaq 0x50(%rsp), %rsi
leaq 0x30(%rsp), %rdx
leaq 0x80(%rsp), %rcx
movq %r15, %rdi
callq 0x1205c
xorl %ebp, %ebp
leaq 0x10860(%rip), %rsi     # 0x23c00
leaq -0x15cb(%rip), %rdx     # 0x11ddc
movq %r15, %rdi
callq 0x4610
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x41a0
jmp 0x133c4
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x10(%rsp), %rdi
callq 0x41a0
jmp 0x133d6
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x90(%rsp), %rdi
callq 0x41a0
jmp 0x13407
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x41a0
jmp 0x133fa
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x10(%rsp), %rdi
jmp 0x1340f
movq %rax, %rbx
movb $0x1, %bpl
leaq 0xb8(%rsp), %rdi
callq 0x41a0
jmp 0x1343f
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x41a0
jmp 0x1342b
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x10(%rsp), %rdi
callq 0x41a0
jmp 0x13456
jmp 0x13439
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x50(%rsp), %rdi
callq 0x41a0
testb %bpl, %bpl
jne 0x1346a
jmp 0x1349b
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x90(%rsp), %rdi
callq 0x41a0
jmp 0x1347a
jmp 0x13467
movq %rax, %rbx
movq %r15, %rdi
callq 0x42d0
jmp 0x1349b
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x50(%rsp), %rdi
callq 0x41a0
testb %bpl, %bpl
jne 0x1348e
jmp 0x13496
movq %rax, %rbx
movq %r15, %rdi
callq 0x42d0
callq 0x4600
movq %rbx, %rdi
callq 0x4620
movq %rax, %rdi
callq 0xba09
nop