// File: /workspace/github_cpp_makefile_star2_O1/ivan-tkatchev[P]makerpm/makerpm.cc
// Function: add_to_rpmprops(archive_entry*, mfile*, rpmprops_t&)
void add_to_rpmprops(struct archive_entry* entry, mfile* data, rpmprops_t& props) {

    props.files.push_back(rpmprops_t::file_t());

    rpmprops_t::file_t& f = props.files.back();

    uint64_t size = ::archive_entry_size(entry);

    if (size < 0xFFFFFFFF) {
        f.size = size;
    } else {
        f.longsize = size;
    }

    f.mode = ::archive_entry_mode(entry);
    f.rdev = ::archive_entry_rdev(entry);
    f.mtime = ::archive_entry_mtime(entry);

    const char* linkto = ::archive_entry_symlink(entry);
    if (linkto != NULL) {
        f.linkto = linkto;
    }

    f.device = ::archive_entry_dev(entry);
    f.inode = ::archive_entry_ino(entry);

    if (props.forceusername.size() > 0) {
        f.username = props.forceusername;

    } else {

        const char* uname = ::archive_entry_uname(entry);

        if (uname == NULL) {
            f.username = uid_to_uname(::archive_entry_uid(entry));
        } else {
            f.username = uname;
        }
    }

    if (props.forcegroupname.size() > 0) {
        f.groupname = props.forcegroupname;

    } else {

        const char* gname = ::archive_entry_gname(entry);

        if (gname == NULL) {
            f.groupname = gid_to_gname(::archive_entry_gid(entry));
        } else {
            f.groupname = gname;
        }
    }

    f.fname = ::archive_entry_pathname(entry);

    if (f.fname.size() < 2 ||
        f.fname[0] != '.' ||
        f.fname[1] != '/') {

        throw std::runtime_error("RPM requires a CPIO archive with relative paths that start with \"./\"!\n"
                                 "Malformed pathname in archive: " + f.fname);
    }

    unsigned char digest[16];
    if (data != nullptr) {
        ::MD5((const unsigned char*)data->addr, data->size, digest);
    } else {
        ::MD5((const unsigned char*)"", 0, digest);
    }
    f.digest = print_digest(digest, 16);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rdx, %r12
movq %rsi, %rbp
movq %rdi, %r15
leaq 0x408(%rdx), %r14
leaq 0x28(%rsp), %r13
movq %r13, %rdi
callq 0x12df6
movq %r14, %rdi
movq %r13, %rsi
callq 0x147a2
leaq 0xe8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10e0c
callq 0x32f0
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10e22
callq 0x32f0
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10e38
callq 0x32f0
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10e4b
callq 0x32f0
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10e5e
callq 0x32f0
movq 0x410(%r12), %r14
movq %r15, %rdi
callq 0x3640
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
cmpq %rcx, %rax
ja 0x10e81
movl %eax, -0xd0(%r14)
jmp 0x10e88
movq %rax, -0xc8(%r14)
movq %r15, %rdi
callq 0x3150
movw %ax, -0xc0(%r14)
movq %r15, %rdi
callq 0x3550
movw %ax, -0xbe(%r14)
movq %r15, %rdi
callq 0x31b0
movl %eax, -0xbc(%r14)
movq %r15, %rdi
callq 0x32b0
testq %rax, %rax
je 0x10f06
movq %rax, %r13
movq %r15, 0x8(%rsp)
movq %r12, %r15
movq %rbp, %r12
leaq -0x98(%r14), %rbp
movq -0x90(%r14), %rbx
movq %rax, %rdi
callq 0x3250
movq %rbp, %rdi
movq %r12, %rbp
movq %r15, %r12
movq 0x8(%rsp), %r15
xorl %esi, %esi
movq %rbx, %rdx
movq %r13, %rcx
movq %rax, %r8
callq 0x32d0
movq %r15, %rdi
callq 0x3210
movl %eax, -0x2c(%r14)
movq %r15, %rdi
callq 0x31a0
movl %eax, -0x28(%r14)
cmpq $0x0, 0x270(%r12)
je 0x10f3f
leaq 0x268(%r12), %rsi
leaq -0x70(%r14), %rdi
callq 0x3670
jmp 0x10fbf
movq %r15, %rdi
callq 0x3180
testq %rax, %rax
je 0x10f8a
movq %rax, %r13
leaq -0x70(%r14), %rbx
movq %r15, 0x8(%rsp)
movq %r12, %r15
movq %rbp, %r12
movq -0x68(%r14), %rbp
movq %rax, %rdi
callq 0x3250
movq %rbx, %rdi
xorl %esi, %esi
movq %rbp, %rdx
movq %r12, %rbp
movq %r15, %r12
movq 0x8(%rsp), %r15
movq %r13, %rcx
movq %rax, %r8
callq 0x32d0
jmp 0x10fbf
movq %r15, %rdi
callq 0x30f0
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
movl %eax, %esi
callq 0x10c95
leaq -0x70(%r14), %rdi
movq %rbx, %rsi
callq 0x32e0
movq (%rbx), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x10fbf
callq 0x32f0
cmpq $0x0, 0x290(%r12)
je 0x10fdf
addq $0x288, %r12            # imm = 0x288
leaq -0x50(%r14), %rdi
movq %r12, %rsi
callq 0x3670
jmp 0x11049
movq %r15, %rdi
callq 0x33b0
testq %rax, %rax
je 0x11014
movq %rax, %r12
leaq -0x50(%r14), %rbx
movq -0x48(%r14), %r13
movq %rax, %rdi
callq 0x3250
movq %rbx, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %r12, %rcx
movq %rax, %r8
callq 0x32d0
jmp 0x11049
movq %r15, %rdi
callq 0x31e0
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
movl %eax, %esi
callq 0x10d4b
leaq -0x50(%r14), %rdi
movq %rbx, %rsi
callq 0x32e0
movq (%rbx), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x11049
callq 0x32f0
movq %r15, %rdi
callq 0x3620
movq %rax, %rbx
leaq -0x20(%r14), %r15
movq -0x18(%r14), %r12
movq %rax, %rdi
callq 0x3250
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x32d0
cmpq $0x2, -0x18(%r14)
jb 0x11104
movq (%r15), %rax
cmpb $0x2e, (%rax)
jne 0x11104
cmpb $0x2f, 0x1(%rax)
jne 0x11104
testq %rbp, %rbp
je 0x110a4
movq (%rbp), %rdi
movq 0x10(%rbp), %rsi
leaq 0x10(%rsp), %rdx
jmp 0x110b2
leaq 0x8967(%rip), %rdi      # 0x19a12
leaq 0x10(%rsp), %rdx
xorl %esi, %esi
callq 0x3490
leaq 0x28(%rsp), %rbx
leaq 0x10(%rsp), %rsi
movl $0x10, %edx
movq %rbx, %rdi
callq 0x106a1
addq $-0xb8, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x32e0
movq (%rbx), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x110f2
callq 0x32f0
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x3240
movq %rax, %rbx
leaq 0x86c1(%rip), %rsi      # 0x197d9
leaq 0x28(%rsp), %rdi
movq %r15, %rdx
callq 0x12b16
movb $0x1, %bpl
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x31c0
xorl %ebp, %ebp
movq 0xbeaa(%rip), %rsi      # 0x1cfe8
movq 0xbe9b(%rip), %rdx      # 0x1cfe0
movq %rbx, %rdi
callq 0x3360
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x12e9c
jmp 0x11187
movq %rax, %r14
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1117a
callq 0x32f0
jmp 0x1117a
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x11187
movq %rbx, %rdi
callq 0x3500
movq %r14, %rdi
callq 0x3370