// File: /workspace/github_c_makefile_star2_O2/seojangho[P]clee/simclist.c
// Function: list_dump_getinfo_filedescriptor
int list_dump_getinfo_filedescriptor(int fd, list_dump_info_t *restrict info) {
    int32_t terminator_head, terminator_tail;
    uint32_t elemlen;
    off_t hop;


    /* version */
    READ_ERRCHECK(fd, & info->version, sizeof(info->version));
    info->version = ntohs(info->version);
    if (info->version > SIMCLIST_DUMPFORMAT_VERSION) {
        errno = EILSEQ;
        return -1;
    }

    /* timestamp */
    READ_ERRCHECK(fd, & info->timestamp, sizeof(info->timestamp));
    info->timestamp = hton64(info->timestamp);

    /* list terminator (to check thereafter) */
    READ_ERRCHECK(fd, & terminator_head, sizeof(terminator_head));
    terminator_head = ntohl(terminator_head);

    /* list size */
    READ_ERRCHECK(fd, & info->list_size, sizeof(info->list_size));
    info->list_size = ntohl(info->list_size);

    /* number of elements */
    READ_ERRCHECK(fd, & info->list_numels, sizeof(info->list_numels));
    info->list_numels = ntohl(info->list_numels);

    /* length of each element (for checking for consistency) */
    READ_ERRCHECK(fd, & elemlen, sizeof(elemlen));
    elemlen = ntohl(elemlen);

    /* list hash */
    READ_ERRCHECK(fd, & info->list_hash, sizeof(info->list_hash));
    info->list_hash = ntohl(info->list_hash);

    /* check consistency */
    if (elemlen > 0) {
        /* constant length, hop by size only */
        hop = info->list_size;
    } else {
        /* non-constant length, hop by size + all element length blocks */
        hop = info->list_size + elemlen*info->list_numels;
    }
    if (lseek(fd, hop, SEEK_CUR) == -1) {
        return -1;
    }

    /* read the trailing value and compare with terminator_head */
    READ_ERRCHECK(fd, & terminator_tail, sizeof(terminator_tail));
    terminator_tail = ntohl(terminator_tail);

    if (terminator_head == terminator_tail)
        info->consistent = 1;
    else
        info->consistent = 0;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movl %edi, %ebp
pushq $0x2
popq %rdx
callq 0x30e0
pushq $-0x1
popq %rbx
cmpq $0x2, %rax
jne 0x498f
movzwl (%r14), %eax
rolw $0x8, %ax
movw %ax, (%r14)
cmpw $0x2, %ax
jb 0x488d
callq 0x3040
movl $0x54, (%rax)
jmp 0x498f
leaq 0x8(%r14), %r15
pushq $0x8
popq %rdx
movl %ebp, %edi
movq %r15, %rsi
callq 0x30e0
cmpq $0x8, %rax
jne 0x498f
movq (%r15), %rax
bswapq %rax
movq %rax, (%r15)
leaq 0x10(%rsp), %rsi
pushq $0x4
popq %rdx
movl %ebp, %edi
callq 0x30e0
cmpq $0x4, %rax
jne 0x498f
movl 0x10(%rsp), %r13d
leaq 0x10(%r14), %r15
pushq $0x4
popq %rdx
movl %ebp, %edi
movq %r15, %rsi
callq 0x30e0
cmpq $0x4, %rax
jne 0x498f
movl 0x10(%r14), %eax
bswapl %eax
movl %eax, 0x10(%r14)
leaq 0x14(%r14), %r12
pushq $0x4
popq %rdx
movl %ebp, %edi
movq %r12, %rsi
callq 0x30e0
cmpq $0x4, %rax
jne 0x498f
movl (%r12), %eax
bswapl %eax
movl %eax, (%r12)
leaq 0x14(%rsp), %rsi
pushq $0x4
popq %rdx
movl %ebp, %edi
callq 0x30e0
cmpq $0x4, %rax
jne 0x498f
leaq 0x18(%r14), %r12
pushq $0x4
popq %rdx
movl %ebp, %edi
movq %r12, %rsi
callq 0x30e0
cmpq $0x4, %rax
jne 0x498f
movl (%r12), %eax
bswapl %eax
movl %eax, (%r12)
movl (%r15), %esi
pushq $0x1
popq %rdx
movl %ebp, %edi
callq 0x30a0
cmpq $-0x1, %rax
je 0x498f
leaq 0xc(%rsp), %rsi
pushq $0x4
popq %rdx
movl %ebp, %edi
callq 0x30e0
cmpq $0x4, %rax
jne 0x498f
cmpl 0xc(%rsp), %r13d
jne 0x4988
movl $0x1, 0x20(%r14)
jmp 0x498d
andl $0x0, 0x20(%r14)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq