// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/includes/load-service.h
// Function: dinit_load::parse_timespec(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*, timespec&)
inline void parse_timespec(file_pos_ref input_pos, const std::string &paramval,
        const std::string &servicename, const char * paramname, timespec &ts)
{
    decltype(ts.tv_sec) isec = 0;
    decltype(ts.tv_nsec) insec = 0;
    auto max_secs = std::numeric_limits<decltype(isec)>::max() / 10;
    auto len = paramval.length();
    decltype(len) i;
    for (i = 0; i < len; i++) {
        char ch = paramval[i];
        if (ch == '.' || ch == ',') {
            i++;
            break;
        }
        if (ch < '0' || ch > '9') {
            throw service_description_exc(servicename, std::string("bad value for ") + paramname, input_pos);
        }
        // check for overflow
        if (isec >= max_secs) {
           throw service_description_exc(servicename, std::string("too-large value for ") + paramname, input_pos);
        }
        isec *= 10;
        isec += ch - '0';
    }
    decltype(insec) insec_m = 100000000; // 10^8
    for ( ; i < len; i++) {
        char ch = paramval[i];
        if (ch < '0' || ch > '9') {
            throw service_description_exc(servicename, std::string("bad value for ") + paramname, input_pos);
        }
        insec += (ch - '0') * insec_m;
        insec_m /= 10;
    }
    ts.tv_sec = isec;
    ts.tv_nsec = insec;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x58, %rsp
movq %r8, %r15
movq %rcx, %r14
movl %edi, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
movq (%rdx), %rcx
movq 0x8(%rdx), %rsi
movq %rsi, %rax
negq %rax
pushq $0x1
popq %rdi
xorl %r8d, %r8d
movabsq $0xccccccccccccccc, %rdx # imm = 0xCCCCCCCCCCCCCCC
leaq (%rax,%rdi), %r10
cmpq $0x1, %r10
je 0x137f5
movb -0x1(%rcx,%rdi), %r10b
movl %r10d, %r11d
andb $-0x3, %r11b
cmpb $0x2c, %r11b
je 0x137f8
leal -0x3a(%r10), %r11d
cmpb $-0xb, %r11b
jbe 0x138a3
cmpq %rdx, %r8
jge 0x13908
imulq $0xa, %r8, %r11
addb $-0x30, %r10b
movzbl %r10b, %r8d
addq %r11, %r8
incq %rdi
jmp 0x137ae
movq %rsi, %rdi
movl $0x5f5e100, %eax        # imm = 0x5F5E100
xorl %r10d, %r10d
pushq $0xa
popq %r11
cmpq %rsi, %rdi
jae 0x13829
movzbl (%rcx,%rdi), %edx
leal -0x3a(%rdx), %ebx
cmpb $-0xb, %bl
jbe 0x1383b
andl $0xf, %edx
imulq %rax, %rdx
addq %rdx, %r10
cqto
idivq %r11
incq %rdi
jmp 0x13804
movq %r8, (%r9)
movq %r10, 0x8(%r9)
addq $0x58, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x70
popq %rdi
callq 0x41d0
movq %rax, %rbx
leaq 0x4df3(%rip), %rsi      # 0x18640
leaq 0x18(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0xb9ce
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movq %r15, %rdx
callq 0xcb22
movb $0x1, %bpl
leaq 0x38(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1205c
xorl %ebp, %ebp
leaq 0x10371(%rip), %rsi     # 0x23c00
leaq -0x1aba(%rip), %rdx     # 0x11ddc
movq %rbx, %rdi
callq 0x4610
jmp 0x1396b
pushq $0x70
popq %rdi
callq 0x41d0
movq %rax, %rbx
leaq 0x4d8b(%rip), %rsi      # 0x18640
leaq 0x18(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0xb9ce
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movq %r15, %rdx
callq 0xcb22
movb $0x1, %bpl
leaq 0x38(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1205c
xorl %ebp, %ebp
leaq 0x10309(%rip), %rsi     # 0x23c00
leaq -0x1b22(%rip), %rdx     # 0x11ddc
movq %rbx, %rdi
callq 0x4610
jmp 0x1396b
pushq $0x70
popq %rdi
callq 0x41d0
movq %rax, %rbx
leaq 0x4d35(%rip), %rsi      # 0x1864f
leaq 0x18(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0xb9ce
leaq 0x38(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movq %r15, %rdx
callq 0xcb22
movb $0x1, %bpl
leaq 0x38(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1205c
xorl %ebp, %ebp
leaq 0x102a4(%rip), %rsi     # 0x23c00
leaq -0x1b87(%rip), %rdx     # 0x11ddc
movq %rbx, %rdi
callq 0x4610
jmp 0x13977
jmp 0x13986
jmp 0x13977
jmp 0x13986
jmp 0x1399d
jmp 0x1399d
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0x41a0
jmp 0x1398c
movq %rax, %r14
movb $0x1, %bpl
leaq 0x18(%rsp), %rdi
callq 0x41a0
testb %bpl, %bpl
jne 0x139a0
jmp 0x139a8
movq %rax, %r14
movq %rbx, %rdi
callq 0x42d0
movq %r14, %rdi
callq 0x4620