// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/includes/dinit-client.h
// Function: get_service_description_dirs[abi:cxx11](int, cpbuffer<1024u>&)
inline std::vector<std::string> get_service_description_dirs(int socknum, cpbuffer_t &rbuffer)
{
    using namespace std;

    char buf[1] = { (char)cp_cmd::QUERY_LOAD_MECH };
    write_all_x(socknum, buf, 1);

    wait_for_reply(rbuffer, socknum);

    if (rbuffer[0] != (char)cp_rply::LOADER_MECH) {
        throw dinit_protocol_error();
    }

    // Packet type, load mechanism type, packet size:
    fill_buffer_to(rbuffer, socknum, 2 + sizeof(uint32_t));

    if (rbuffer[1] != SSET_TYPE_DIRLOAD) {
        throw dinit_unknown_sd_conf();
    }

    vector<string> paths;

    uint32_t pktsize;
    rbuffer.extract(&pktsize, 2, sizeof(uint32_t));

    fill_buffer_to(rbuffer, socknum, 2 + sizeof(uint32_t) * 3); // path entries, cwd length

    uint32_t path_entries;  // number of service directories
    rbuffer.extract(&path_entries, 2 + sizeof(uint32_t), sizeof(uint32_t));

    uint32_t cwd_len;
    rbuffer.extract(&cwd_len, 2 + sizeof(uint32_t) * 2, sizeof(uint32_t));
    rbuffer.consume(2 + sizeof(uint32_t) * 3);
    pktsize -= 2 + sizeof(uint32_t) * 3;

    // Read current working directory of daemon:
    std::string dinit_cwd = read_string(socknum, rbuffer, cwd_len);

    // dinit daemon base directory against which service paths are resolved is in dinit_cwd

    for (uint32_t i = 0; i < path_entries; ++i) {
        uint32_t plen;
        fill_buffer_to(rbuffer, socknum, sizeof(uint32_t));
        rbuffer.extract(&plen, 0, sizeof(uint32_t));
        rbuffer.consume(sizeof(uint32_t));
        //paths.push_back(read_string(socknum, rbuffer, plen));
        string sd_rel_path = read_string(socknum, rbuffer, plen);
        paths.push_back(combine_paths(dinit_cwd, sd_rel_path.c_str()));
    }

    return paths;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, 0x18(%rsp)
leaq 0x17(%rsp), %r15
movb $0xd, (%r15)
movl $0x1, %r12d
xorl %ebx, %ebx
movl %r12d, %edx
movl %ebp, %edi
movq %r15, %rsi
callq 0x4100
cmpl $-0x1, %eax
je 0xf752
addl %eax, %ebx
movslq %eax, %rcx
addq %rcx, %r15
subl %eax, %r12d
jmp 0xf75c
callq 0x4040
cmpl $0x4, (%rax)
jne 0xf7ce
testl %r12d, %r12d
jg 0xf733
cmpl $-0x1, %ebx
je 0xf7d2
movq %r14, %rdi
movl %ebp, %esi
callq 0xed47
movl 0x400(%r14), %eax
leal -0x400(%rax), %ecx
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %ecx
cmpb $0x40, (%r14,%rcx)
jne 0xfb7d
cmpl $0x5, 0x404(%r14)
ja 0xf7ff
movq %r14, %rdi
movl %ebp, %esi
callq 0xef52
testl %eax, %eax
jg 0xf790
cmpl $-0x1, %eax
jne 0xf7f7
callq 0x4040
cmpl $0x4, (%rax)
je 0xf790
movq %rax, %r15
movl $0x4, %edi
callq 0x4190
movl (%r15), %ecx
movl %ecx, (%rax)
jmp 0xfb4b
testl %ebx, %ebx
jg 0xf766
movl $0x4, %edi
callq 0x4190
movq %rax, %rbx
callq 0x4040
movl (%rax), %eax
movl %eax, (%rbx)
leaq 0xd361(%rip), %rsi      # 0x1cb50
movq %rbx, %rdi
jmp 0xfb55
testl %eax, %eax
je 0xfb3b
movl 0x400(%r14), %eax
leal 0x1(%rax), %ecx
addl $0xfffffc01, %eax       # imm = 0xFFFFFC01
cmpl $0x400, %ecx            # imm = 0x400
cmovbl %ecx, %eax
cmpb $0x1, (%r14,%rax)
jne 0xfb90
xorps %xmm0, %xmm0
movq 0x18(%rsp), %rax
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
cmpl $0xd, 0x404(%r14)
ja 0xf87b
movq %r14, %rdi
movl %ebp, %esi
callq 0xef52
testl %eax, %eax
jg 0xf835
cmpl $-0x1, %eax
jne 0xf873
callq 0x4040
cmpl $0x4, (%rax)
je 0xf835
movq %rax, %r15
movl $0x4, %edi
callq 0x4190
movl (%r15), %ecx
movl %ecx, (%rax)
jmp 0xfb6c
testl %eax, %eax
je 0xfb5c
movl 0x400(%r14), %ebx
leal 0x6(%rbx), %eax
leal -0x3fa(%rbx), %r15d
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %r15d
leal -0x3fd(%r15), %eax
movl %r15d, %esi
cmpl $0xfffffbfe, %eax       # imm = 0xFFFFFBFE
ja 0xf8db
movl $0x400, %r12d           # imm = 0x400
subl %r15d, %r12d
addq %r14, %rsi
leaq 0x10(%rsp), %rdi
movq %r12, %rdx
callq 0x4270
leaq (%rsp,%r12), %rdi
addq $0x10, %rdi
addl $0xfffffc04, %r15d      # imm = 0xFFFFFC04
movq %r14, %rsi
movq %r15, %rdx
callq 0x4270
jmp 0xf8e3
movl (%r14,%rsi), %eax
movl %eax, 0x10(%rsp)
leal 0xa(%rbx), %eax
leal -0x3f6(%rbx), %r15d
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %r15d
leal -0x3fd(%r15), %eax
movl %r15d, %esi
cmpl $0xfffffbfe, %eax       # imm = 0xFFFFFBFE
ja 0xf93f
movl $0x400, %r13d           # imm = 0x400
subl %r15d, %r13d
addq %r14, %rsi
leaq 0x24(%rsp), %r12
movq %r12, %rdi
movq %r13, %rdx
callq 0x4270
leaq (%rsp,%r13), %rdi
addq $0x24, %rdi
addl $0xfffffc04, %r15d      # imm = 0xFFFFFC04
movq %r14, %rsi
movq %r15, %rdx
callq 0x4270
jmp 0xf945
addq %r14, %rsi
movq %rsi, %r12
movl (%r12), %ecx
leal 0xe(%rbx), %eax
addl $0xfffffc0e, %ebx       # imm = 0xFFFFFC0E
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %ebx
movl %ebx, 0x400(%r14)
addl $-0xe, 0x404(%r14)
leaq 0x68(%rsp), %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x102c7
movl 0x10(%rsp), %eax
movl %eax, 0x20(%rsp)
testl %eax, %eax
je 0xfad4
xorl %r13d, %r13d
leaq 0x38(%rsp), %rbx
cmpl $0x3, 0x404(%r14)
ja 0xf9c4
movq %r14, %rdi
movl %ebp, %esi
callq 0xef52
testl %eax, %eax
jg 0xf990
cmpl $-0x1, %eax
jne 0xf9bc
callq 0x4040
cmpl $0x4, (%rax)
je 0xf990
jmp 0xfb06
testl %eax, %eax
je 0xfb1a
movl 0x400(%r14), %r12d
leal -0x400(%r12), %r15d
cmpl $0x400, %r12d           # imm = 0x400
cmovbl %r12d, %r15d
leal -0x3fd(%r15), %eax
cmpl $0xfffffbfe, %eax       # imm = 0xFFFFFBFE
ja 0xfa2c
movl $0x400, %ebx            # imm = 0x400
subl %r15d, %ebx
movl %r15d, %esi
addq %r14, %rsi
leaq 0xc(%rsp), %rdi
movq %rbx, %rdx
callq 0x4270
leaq (%rsp,%rbx), %rdi
addq $0xc, %rdi
leaq 0x38(%rsp), %rbx
addl $0xfffffc04, %r15d      # imm = 0xFFFFFC04
movq %r14, %rsi
movq %r15, %rdx
callq 0x4270
movl 0xc(%rsp), %ecx
jmp 0xfa37
movl %r15d, %eax
movl (%r14,%rax), %ecx
movl %ecx, 0xc(%rsp)
leal 0x4(%r12), %eax
addl $0xfffffc04, %r12d      # imm = 0xFFFFFC04
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %r12d
movl %r12d, 0x400(%r14)
addl $-0x4, 0x404(%r14)
leaq 0x28(%rsp), %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x102c7
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
movq 0x28(%rsp), %rcx
leaq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0x10080
movq 0x18(%rsp), %rdi
movq %r15, %rsi
callq 0x104c4
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xfaaf
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x42f0
movq 0x28(%rsp), %rdi
cmpq %rbx, %rdi
je 0xfac6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x42f0
incl %r13d
cmpl 0x20(%rsp), %r13d
jne 0xf990
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfaef
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x42f0
movq 0x18(%rsp), %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
movl $0x4, %edi
callq 0x4190
movl (%r15), %ecx
movl %ecx, (%rax)
jmp 0xfb2a
movl $0x4, %edi
callq 0x4190
movl $0x0, (%rax)
leaq 0xd00f(%rip), %rsi      # 0x1cb40
movq %rax, %rdi
xorl %edx, %edx
callq 0x44d0
movl $0x4, %edi
callq 0x4190
movl $0x0, (%rax)
leaq 0xcfee(%rip), %rsi      # 0x1cb40
movq %rax, %rdi
xorl %edx, %edx
callq 0x44d0
movl $0x4, %edi
callq 0x4190
movl $0x0, (%rax)
leaq 0xcfcd(%rip), %rsi      # 0x1cb40
movq %rax, %rdi
xorl %edx, %edx
callq 0x44d0
movl $0x1, %edi
callq 0x4190
leaq 0xcf72(%rip), %rsi      # 0x1cb00
jmp 0xfb52
movl $0x1, %edi
callq 0x4190
leaq 0xd147(%rip), %rsi      # 0x1cce8
jmp 0xfb52
jmp 0xfba5
movq %rax, %r14
jmp 0xfc0c
jmp 0xfbee
movq %rax, %r14
jmp 0xfbd0
movq %rax, %r14
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xfbd0
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x42f0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xfbf1
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x42f0
jmp 0xfbf1
movq %rax, %r14
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xfc0c
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x42f0
movq 0x18(%rsp), %rdi
callq 0xfc1e
movq %r14, %rdi
callq 0x44f0