// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
movl $0x2, %edx
callq 0x3100
cmpq $0x2, %rax
je 0x5e22
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6134
jmp 0x5e24
movq -0x10(%rbp), %rax
movzwl (%rax), %edi
callq 0x31a0
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, (%rax)
movq -0x10(%rbp), %rax
movzwl (%rax), %eax
cmpl $0x1, %eax
jle 0x5e5d
callq 0x3040
movl $0x54, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6134
jmp 0x5e5f
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
movl $0x8, %edx
callq 0x3100
cmpq $0x8, %rax
je 0x5e86
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6134
jmp 0x5e88
movl $0x1, %edi
callq 0x3080
movzwl %ax, %eax
cmpl $0x1, %eax
jne 0x5eab
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x5f6b
movq -0x10(%rbp), %rcx
movabsq $-0x100000000000000, %rax # imm = 0xFF00000000000000
andq 0x8(%rcx), %rax
shrq $0x38, %rax
movq -0x10(%rbp), %rdx
movabsq $0xff000000000000, %rcx # imm = 0xFF000000000000
andq 0x8(%rdx), %rcx
shrq $0x28, %rcx
orq %rcx, %rax
movq -0x10(%rbp), %rdx
movabsq $0xff0000000000, %rcx   # imm = 0xFF0000000000
andq 0x8(%rdx), %rcx
shrq $0x18, %rcx
orq %rcx, %rax
movq -0x10(%rbp), %rdx
movabsq $0xff00000000, %rcx     # imm = 0xFF00000000
andq 0x8(%rdx), %rcx
shrq $0x8, %rcx
orq %rcx, %rax
movq -0x10(%rbp), %rdx
movabsq $0xff000000, %rcx       # imm = 0xFF000000
andq 0x8(%rdx), %rcx
shlq $0x8, %rcx
orq %rcx, %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
andq $0xff0000, %rcx         # imm = 0xFF0000
shlq $0x18, %rcx
orq %rcx, %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
andq $0xff00, %rcx           # imm = 0xFF00
shlq $0x28, %rcx
orq %rcx, %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
andq $0xff, %rcx
shlq $0x38, %rcx
orq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movl -0x8(%rbp), %edi
leaq -0x14(%rbp), %rsi
movl $0x4, %edx
callq 0x3100
cmpq $0x4, %rax
je 0x5f9a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6134
jmp 0x5f9c
movl -0x14(%rbp), %edi
callq 0x3200
movl %eax, -0x14(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
addq $0x10, %rsi
movl $0x4, %edx
callq 0x3100
cmpq $0x4, %rax
je 0x5fce
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6134
jmp 0x5fd0
movq -0x10(%rbp), %rax
movl 0x10(%rax), %edi
callq 0x3200
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x10(%rax)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
addq $0x14, %rsi
movl $0x4, %edx
callq 0x3100
cmpq $0x4, %rax
je 0x600c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6134
jmp 0x600e
movq -0x10(%rbp), %rax
movl 0x14(%rax), %edi
callq 0x3200
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x14(%rax)
movl -0x8(%rbp), %edi
leaq -0x1c(%rbp), %rsi
movl $0x4, %edx
callq 0x3100
cmpq $0x4, %rax
je 0x6046
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6134
jmp 0x6048
movl -0x1c(%rbp), %edi
callq 0x3200
movl %eax, -0x1c(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
addq $0x18, %rsi
movl $0x4, %edx
callq 0x3100
cmpq $0x4, %rax
je 0x607a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6134
jmp 0x607c
movq -0x10(%rbp), %rax
movl 0x18(%rax), %edi
callq 0x3200
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x18(%rax)
cmpl $0x0, -0x1c(%rbp)
jbe 0x60a4
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movq %rax, -0x28(%rbp)
jmp 0x60be
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rdx
imull 0x14(%rdx), %ecx
addl %ecx, %eax
movl %eax, %eax
movq %rax, -0x28(%rbp)
movl -0x8(%rbp), %edi
movq -0x28(%rbp), %rsi
movl $0x1, %edx
callq 0x30a0
cmpq $-0x1, %rax
jne 0x60de
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6134
jmp 0x60e0
movl -0x8(%rbp), %edi
leaq -0x18(%rbp), %rsi
movl $0x4, %edx
callq 0x3100
cmpq $0x4, %rax
je 0x6100
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6134
jmp 0x6102
movl -0x18(%rbp), %edi
callq 0x3200
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jne 0x6122
movq -0x10(%rbp), %rax
movl $0x1, 0x20(%rax)
jmp 0x612d
movq -0x10(%rbp), %rax
movl $0x0, 0x20(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)