// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/rdb.c
// Function: rdbSaveBackground
int rdbSaveBackground(char *filename) {
    pid_t childpid;
    long long start;

    if (server.aof_child_pid != -1 || server.rdb_child_pid != -1) return C_ERR;

    server.dirty_before_bgsave = server.dirty;
    server.lastbgsave_try = time(NULL);

    start = ustime();
    if ((childpid = fork()) == 0) {
        int retval;

        /* Child */
        closeListeningSockets(0);
        redisSetProcTitle("redis-rdb-bgsave");
        retval = rdbSave(filename);
        if (retval == C_OK) {
            size_t private_dirty = zmalloc_get_private_dirty();

            if (private_dirty) {
                serverLog(LL_NOTICE,
                    "RDB: %zu MB of memory used by copy-on-write",
                    private_dirty/(1024*1024));
            }
        }
        exitFromChild((retval == C_OK) ? 0 : 1);
    } else {
        /* Parent */
        server.stat_fork_time = ustime()-start;
        server.stat_fork_rate = (double) zmalloc_used_memory() * 1000000 / server.stat_fork_time / (1024*1024*1024); /* GB per second. */
        latencyAddSampleIfNeeded("fork",server.stat_fork_time/1000);
        if (childpid == -1) {
            server.lastbgsave_status = C_ERR;
            serverLog(LL_WARNING,"Can't save in background: fork: %s",
                strerror(errno));
            return C_ERR;
        }
        serverLog(LL_NOTICE,"Background saving started by pid %d",childpid);
        server.rdb_save_time_start = time(NULL);
        server.rdb_child_pid = childpid;
        server.rdb_child_type = RDB_CHILD_TYPE_DISK;
        updateDictResizePolicy();
        return C_OK;
    }
    return C_OK; /* unreached */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0xb7d37(%rip), %r12     # 0xf98a8
cmpl $-0x1, 0x69c(%r12)
pushq $-0x1
popq %rbx
jne 0x41d1c
cmpl $-0x1, 0x730(%r12)
jne 0x41d1c
movq %rdi, %r14
movq 0x720(%r12), %rax
movq %rax, 0x728(%r12)
xorl %edi, %edi
callq 0x26cd0
movq %rax, 0x760(%r12)
callq 0x2b88b
movq %rax, %r15
callq 0x26ab0
testl %eax, %eax
je 0x41c9f
movl %eax, %ebp
callq 0x2b88b
subq %r15, %rax
movq %rax, 0x3c8(%r12)
callq 0x32960
movq %rax, %xmm0
punpckldq 0x72433(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x7243b(%rip), %xmm0    # 0xb4030
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x72437(%rip), %xmm1    # 0xb4040
movq 0x3c8(%r12), %rax
cvtsi2sd %rax, %xmm0
divsd %xmm0, %xmm1
mulsd 0x6c80e(%rip), %xmm1    # 0xae430
movsd %xmm1, 0x3d0(%r12)
movq 0xa18(%r12), %rcx
testq %rcx, %rcx
je 0x41c57
movl $0x3e8, %esi            # imm = 0x3E8
cqto
idivq %rsi
cmpq %rcx, %rax
jl 0x41c57
leaq 0x7265f(%rip), %rdi     # 0xb42ae
movq %rax, %rsi
callq 0x71e85
cmpl $-0x1, %ebp
je 0x41cf3
leaq 0x7266f(%rip), %rsi     # 0xb42d6
xorl %ebx, %ebx
pushq $0x2
popq %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2b699
xorl %edi, %edi
callq 0x26cd0
movq %rax, 0x770(%r12)
movl %ebp, 0x730(%r12)
movl $0x1, 0x77c(%r12)
callq 0x2bb7f
jmp 0x41d1c
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x2edf6
leaq 0x725c2(%rip), %rdi     # 0xb4271
callq 0x308b2
movq %r14, %rdi
callq 0x41971
movl %eax, %ebp
testl %eax, %eax
jne 0x41ce4
callq 0x32b90
testq %rax, %rax
je 0x41ce4
shrq $0x14, %rax
leaq 0x725ab(%rip), %rsi     # 0xb4282
pushq $0x2
popq %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2b699
xorl %edi, %edi
testl %ebp, %ebp
setne %dil
callq 0x2b8c0
jmp 0x41d1c
orl $-0x1, 0x780(%r12)
callq 0x26880
movl (%rax), %edi
callq 0x26680
leaq 0x725a4(%rip), %rsi     # 0xb42b3
pushq $0x3
popq %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2b699
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq