// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/redis-check-dump.c
// Function: main
int main(int argc, char **argv) {
    /* expect the first argument to be the dump file */
    if (argc <= 1) {
        printf("Usage: %s <dump.rdb>\n", argv[0]);
        exit(0);
    }

    int fd;
    off_t size;
    struct stat stat;
    void *data;

    fd = open(argv[1], O_RDONLY);
    if (fd < 1) {
        ERROR("Cannot open file: %s\n", argv[1]);
    }
    if (fstat(fd, &stat) == -1) {
        ERROR("Cannot stat: %s\n", argv[1]);
    } else {
        size = stat.st_size;
    }

    if (sizeof(size_t) == sizeof(int32_t) && size >= INT_MAX) {
        ERROR("Cannot check dump files >2GB on a 32-bit platform\n");
    }

    data = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
    if (data == MAP_FAILED) {
        ERROR("Cannot mmap: %s\n", argv[1]);
    }

    /* Initialize static vars */
    positions[0].data = data;
    positions[0].size = size;
    positions[0].offset = 0;
    errors.level = 0;

    /* Object types */
    sprintf(types[REDIS_STRING], "STRING");
    sprintf(types[REDIS_LIST], "LIST");
    sprintf(types[REDIS_SET], "SET");
    sprintf(types[REDIS_ZSET], "ZSET");
    sprintf(types[REDIS_HASH], "HASH");

    /* Object types only used for dumping to disk */
    sprintf(types[REDIS_EXPIRETIME], "EXPIRETIME");
    sprintf(types[REDIS_SELECTDB], "SELECTDB");
    sprintf(types[REDIS_EOF], "EOF");

    /* Double constants initialization */
    R_Zero = 0.0;
    R_PosInf = 1.0/R_Zero;
    R_NegInf = -1.0/R_Zero;
    R_Nan = R_Zero/R_Zero;

    process();

    munmap(data, size);
    close(fd);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x1, -0x8(%rbp)
jg 0x2f1b
movq -0x10(%rbp), %rax
movq (%rax), %rsi
leaq 0x1524(%rip), %rdi      # 0x4431
movb $0x0, %al
callq 0x1080
xorl %edi, %edi
callq 0x1130
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %esi, %esi
movb $0x0, %al
callq 0x1110
movl %eax, -0x14(%rbp)
cmpl $0x1, -0x14(%rbp)
jge 0x2f55
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x1503(%rip), %rdi      # 0x4447
movb $0x0, %al
callq 0x1080
movl $0x1, %edi
callq 0x1130
movl -0x14(%rbp), %edi
leaq -0xb0(%rbp), %rsi
callq 0x1150
cmpl $-0x1, %eax
jne 0x2f89
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x14e5(%rip), %rdi      # 0x445d
movb $0x0, %al
callq 0x1080
movl $0x1, %edi
callq 0x1130
movq -0x80(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rsi
movl -0x14(%rbp), %r8d
xorl %eax, %eax
movl %eax, %r9d
movl $0x1, %ecx
movq %r9, %rdi
movl %ecx, %edx
callq 0x1070
movq %rax, -0xb8(%rbp)
movq $-0x1, %rax
cmpq %rax, -0xb8(%rbp)
jne 0x2fe4
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x149b(%rip), %rdi      # 0x446e
movb $0x0, %al
callq 0x1080
movl $0x1, %edi
callq 0x1130
movq -0xb8(%rbp), %rax
movq %rax, 0x40de(%rip)      # 0x70d0
movq -0x20(%rbp), %rax
movq %rax, 0x40db(%rip)      # 0x70d8
movq $0x0, 0x40d8(%rip) # 0x70e0
movq $0x0, 0x82c5(%rip) # 0xb2d8
leaq 0x82e6(%rip), %rdi      # 0xb300
leaq 0x145e(%rip), %rsi      # 0x447f
movb $0x0, %al
callq 0x1120
leaq 0x82d1(%rip), %rdi      # 0xb300
addq $0x10, %rdi
leaq 0x144c(%rip), %rsi      # 0x4486
movb $0x0, %al
callq 0x1120
leaq 0x82b8(%rip), %rdi      # 0xb300
addq $0x20, %rdi
leaq 0x1439(%rip), %rsi      # 0x448c
movb $0x0, %al
callq 0x1120
leaq 0x829f(%rip), %rdi      # 0xb300
addq $0x30, %rdi
leaq 0x141f(%rip), %rsi      # 0x448b
movb $0x0, %al
callq 0x1120
leaq 0x8286(%rip), %rdi      # 0xb300
addq $0x40, %rdi
leaq 0x140b(%rip), %rsi      # 0x4490
movb $0x0, %al
callq 0x1120
leaq 0x826d(%rip), %rdi      # 0xb300
addq $0xfd0, %rdi            # imm = 0xFD0
leaq 0x13f4(%rip), %rsi      # 0x4495
movb $0x0, %al
callq 0x1120
leaq 0x8251(%rip), %rdi      # 0xb300
addq $0xfe0, %rdi            # imm = 0xFE0
leaq 0x13e3(%rip), %rsi      # 0x44a0
movb $0x0, %al
callq 0x1120
leaq 0x8235(%rip), %rdi      # 0xb300
addq $0xff0, %rdi            # imm = 0xFF0
leaq 0x11d8(%rip), %rsi      # 0x42b1
movb $0x0, %al
callq 0x1120
xorps %xmm0, %xmm0
movsd %xmm0, 0x9215(%rip)     # 0xc300
movsd 0xf55(%rip), %xmm0      # 0x4048
divsd 0x9205(%rip), %xmm0     # 0xc300
movsd %xmm0, 0x81e5(%rip)     # 0xb2e8
movsd 0xf35(%rip), %xmm0      # 0x4040
divsd 0x91ed(%rip), %xmm0     # 0xc300
movsd %xmm0, 0x81c5(%rip)     # 0xb2e0
movsd 0x91dd(%rip), %xmm0     # 0xc300
divsd 0x91d5(%rip), %xmm0     # 0xc300
movsd %xmm0, 0x81bd(%rip)     # 0xb2f0
callq 0x2ac0
movq -0xb8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x1100
movl -0x14(%rbp), %edi
callq 0x10a0
xorl %eax, %eax
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax,%rax)