// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/includes/load-service.h
// Function: dinit_load::parse_uid_param(file_pos_ref, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char const*, unsigned int*)
inline uid_t parse_uid_param(file_pos_ref input_pos, const std::string &param,
        const std::string &service_name, const char *setting_name, gid_t *group_p)
{
    const char * uid_err_msg = "specified user 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 a signed or unsigned type, but regardless
        // is is probably safe to assume that valid values are positive. We'll also assert
        // that the value range fits within "unsigned long long" since it seems unlikely
        // that would ever not be the case.
        static_assert((uintmax_t)std::numeric_limits<uid_t>::max()
                <= (uintmax_t)std::numeric_limits<unsigned long long>::max(), "uid_t is too large");
        unsigned long long v = std::stoull(param, &ind, 0);
        if (v > static_cast<unsigned long long>(std::numeric_limits<uid_t>::max())
                || ind != param.length()) {
            throw service_description_exc(service_name, std::string(setting_name) + ": " + uid_err_msg, input_pos);
        }
        return v;
    }
    catch (std::out_of_range &exc) {
        throw service_description_exc(service_name, uid_err_msg, input_pos);
    }
    catch (std::invalid_argument &exc) {
        // Ok, so it doesn't look like a number: proceed...
    }

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

    if (group_p) {
        *group_p = pwent->pw_gid;
    }

    return pwent->pw_uid;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %r9, %r15
movq %r8, 0x60(%rsp)
movq %rcx, 0x38(%rsp)
movq %rdx, %r14
movl %edi, 0x68(%rsp)
movq %rsi, 0x70(%rsp)
movq (%rdx), %r12
callq 0x4060
movq %rax, %rbp
movl (%rax), %r13d
movl $0x0, (%rax)
leaq 0x18(%rsp), %rbx
movq %r12, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x44e0
movq (%rbx), %rcx
subq %r12, %rcx
je 0x1774f
movl (%rbp), %edx
cmpl $0x22, %edx
je 0x1775b
testl %edx, %edx
jne 0x1772e
movl %r13d, (%rbp)
movq %rax, %rdx
shrq $0x20, %rdx
jne 0x17767
cmpq 0x8(%r14), %rcx
jne 0x17767
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5dfe(%rip), %rdi      # 0x1d554
callq 0x4270
leaq 0x5df2(%rip), %rdi      # 0x1d554
callq 0x4550
movl $0x70, %edi
callq 0x41c0
movq %rax, %r13
leaq 0x78(%rsp), %rdi
leaq 0x98(%rsp), %rdx
movq 0x60(%rsp), %rsi
callq 0xfcc6
leaq 0x4fc0(%rip), %rsi      # 0x1c752
leaq 0x78(%rsp), %rdi
callq 0x46a0
leaq 0x50(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x177c1
movups (%rcx), %xmm0
leaq 0x50(%rsp), %rdx
movups %xmm0, (%rdx)
jmp 0x177ce
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
movq 0x8(%rax), %rdx
leaq 0x40(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x5cd8(%rip), %rsi      # 0x1d4c9
callq 0x46a0
leaq 0x28(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x1781b
movups (%rcx), %xmm0
leaq 0x28(%rsp), %rdx
movups %xmm0, (%rdx)
jmp 0x17828
movq %rdx, 0x18(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x28(%rsp)
movq 0x8(%rax), %rsi
leaq 0x18(%rsp), %rdx
movq %rsi, 0x8(%rdx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %bl
leaq 0x68(%rsp), %rcx
movq %r13, %rdi
movq 0x38(%rsp), %rsi
callq 0x16cc4
xorl %ebx, %ebx
leaq 0xe3bf(%rip), %rsi      # 0x25c20
leaq -0xda0(%rip), %rdx      # 0x16ac8
movq %r13, %rdi
callq 0x4620
jmp 0x17ba4
movq %rdx, %r12
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x178a5
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x178a5
movq %rdx, %r12
movq %rax, 0x8(%rsp)
movb $0x1, %bl
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x178cd
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x178cd
movq %rdx, %r12
movq %rax, 0x8(%rsp)
movb $0x1, %bl
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x178fa
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x178fa
movq %rdx, %r12
movq %rax, 0x8(%rsp)
movb $0x1, %bl
testb %bl, %bl
je 0x1791a
movq %r13, %rdi
callq 0x42d0
jmp 0x1791a
movq %rdx, %r12
movq %rax, 0x8(%rsp)
cmpl $0x0, (%rbp)
jne 0x1791a
movl %r13d, (%rbp)
cmpl $0x2, %r12d
je 0x17964
cmpl $0x1, %r12d
jne 0x17cbc
movq 0x8(%rsp), %rdi
callq 0x4170
callq 0x4600
movl $0x0, (%rbp)
movq (%r14), %rdi
callq 0x4300
testq %rax, %rax
je 0x179d2
testq %r15, %r15
je 0x1795c
movl 0x14(%rax), %ecx
movl %ecx, (%r15)
movl 0x10(%rax), %eax
jmp 0x1773d
movq 0x8(%rsp), %rdi
callq 0x4170
movl $0x70, %edi
callq 0x41c0
movq %rax, %r14
leaq 0x28(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x5b3e(%rip), %rsi      # 0x1d4c9
leaq 0x5b89(%rip), %rdx      # 0x1d51b
leaq 0x18(%rsp), %rdi
callq 0x127a8
movb $0x1, %bl
leaq 0x18(%rsp), %rdx
leaq 0x68(%rsp), %rcx
movq %r14, %rdi
movq 0x38(%rsp), %rsi
callq 0x16cc4
xorl %ebx, %ebx
leaq 0xe262(%rip), %rsi      # 0x25c20
leaq -0xefd(%rip), %rdx      # 0x16ac8
movq %r14, %rdi
callq 0x4620
jmp 0x17ba4
movl (%rbp), %ebx
movl $0x70, %edi
callq 0x41c0
movq %rax, %r15
testl %ebx, %ebx
jne 0x17a34
leaq 0x98(%rsp), %rdi
leaq 0x17(%rsp), %rdx
movq 0x60(%rsp), %rsi
callq 0xfcc6
leaq 0x5b18(%rip), %rsi      # 0x1d51c
leaq 0x98(%rsp), %rdi
callq 0x46a0
leaq 0x88(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x17a8b
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
jmp 0x17a9b
leaq 0x50(%rsp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x50f3(%rip), %rsi      # 0x1cb37
leaq 0x510b(%rip), %rdx      # 0x1cb56
leaq 0x40(%rsp), %rdi
callq 0x127a8
movl (%rbp), %edi
callq 0x4140
leaq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0x46a0
leaq 0x28(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x17af6
movups (%rcx), %xmm0
movups %xmm0, (%r14)
jmp 0x17b03
movq %rdx, 0x78(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x88(%rsp)
movq 0x8(%rax), %rdx
leaq 0x78(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x40(%rsp), %rdi
movq %r14, %rdx
callq 0x11d3f
leaq 0x5a64(%rip), %rsi      # 0x1d52f
leaq 0x40(%rsp), %rdi
callq 0x46a0
leaq 0x28(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x17b4e
movups (%rcx), %xmm0
movups %xmm0, (%r14)
jmp 0x17b5b
movq %rdx, 0x18(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x28(%rsp)
movq 0x8(%rax), %rsi
leaq 0x18(%rsp), %rdx
movq %rsi, 0x8(%rdx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %bpl
leaq 0x68(%rsp), %rcx
movq %r15, %rdi
movq 0x38(%rsp), %rsi
callq 0x16cc4
xorl %ebp, %ebp
leaq 0xe0e3(%rip), %rsi      # 0x25c20
leaq -0x107c(%rip), %rdx     # 0x16ac8
movq %r15, %rdi
callq 0x4620
jmp 0x17ba4
movq %rdx, 0x18(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x28(%rsp)
movq 0x8(%rax), %rsi
leaq 0x18(%rsp), %rdx
movq %rsi, 0x8(%rdx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %bpl
leaq 0x68(%rsp), %rcx
movq %r15, %rdi
movq 0x38(%rsp), %rsi
callq 0x16cc4
xorl %ebp, %ebp
leaq 0xe08b(%rip), %rsi      # 0x25c20
leaq -0x10d4(%rip), %rdx     # 0x16ac8
movq %r15, %rdi
callq 0x4620
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
je 0x17bca
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x17bca
movq %rax, 0x8(%rsp)
movb $0x1, %bpl
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x17bef
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x17bef
movq %rax, 0x8(%rsp)
movb $0x1, %bpl
movq 0x78(%rsp), %rdi
cmpq %rbx, %rdi
je 0x17c4a
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x17c4a
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rdi
cmpq %r14, %rdi
je 0x17c31
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x17c31
movq %rax, 0x8(%rsp)
movb $0x1, %bpl
movq 0x40(%rsp), %rdi
cmpq %rbx, %rdi
je 0x17c77
movq 0x50(%rsp), %rsi
jmp 0x17c63
movq %rax, 0x8(%rsp)
movb $0x1, %bpl
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x17c77
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x17c77
jmp 0x17c6f
movq %rax, 0x8(%rsp)
movb $0x1, %bpl
testb %bpl, %bpl
je 0x17cbc
movq %r15, %rdi
callq 0x42d0
jmp 0x17cbc
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x17cab
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x43a0
jmp 0x17cab
movq %rax, 0x8(%rsp)
movb $0x1, %bl
testb %bl, %bl
je 0x17cb7
movq %r14, %rdi
callq 0x42d0
callq 0x4600
movq 0x8(%rsp), %rdi
callq 0x4630
movq %rax, %rdi
callq 0xfd03