// File: /workspace/github_c_makefile_star2_O3/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 0xb8102(%rip), %r12     # 0x1018a8
cmpl $-0x1, 0x69c(%r12)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jne 0x49973
cmpl $-0x1, 0x730(%r12)
jne 0x49973
movq %rdi, %r14
movq 0x720(%r12), %rax
movq %rax, 0x728(%r12)
xorl %edi, %edi
callq 0x26cd0
movq %rax, 0x760(%r12)
callq 0x2ffab
movq %rax, %r15
callq 0x26ab0
testl %eax, %eax
je 0x498ef
movl %eax, %ebp
callq 0x2ffab
subq %r15, %rax
movq %rax, 0x3c8(%r12)
callq 0x3847a
movq %rax, %xmm0
punpckldq 0x7913c(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x79144(%rip), %xmm0    # 0xc2970
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x79140(%rip), %xmm1    # 0xc2980
movq 0x3c8(%r12), %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd %xmm0, %xmm1
mulsd 0x72ce4(%rip), %xmm1    # 0xbc540
movsd %xmm1, 0x3d0(%r12)
movq 0xa18(%r12), %rcx
testq %rcx, %rcx
je 0x498a2
movabsq $0x20c49ba5e353f7cf, %rdx # imm = 0x20C49BA5E353F7CF
imulq %rdx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rdx
addq %rax, %rdx
cmpq %rcx, %rdx
jl 0x498a2
leaq 0x79354(%rip), %rdi     # 0xc2bee
movq %rdx, %rsi
callq 0x7eb75
cmpl $-0x1, %ebp
je 0x49945
leaq 0x79364(%rip), %rsi     # 0xc2c16
xorl %ebx, %ebx
movl $0x2, %edi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2fdad
xorl %edi, %edi
callq 0x26cd0
movq %rax, 0x770(%r12)
movl %ebp, 0x730(%r12)
movl $0x1, 0x77c(%r12)
callq 0x30423
jmp 0x49973
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x33c2a
leaq 0x792b2(%rip), %rdi     # 0xc2bb1
callq 0x3598c
movq %r14, %rdi
callq 0x49593
movl %eax, %ebp
testl %eax, %eax
jne 0x49936
callq 0x386a8
testq %rax, %rax
je 0x49936
shrq $0x14, %rax
leaq 0x7929b(%rip), %rsi     # 0xc2bc2
movl $0x2, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2fdad
xorl %edi, %edi
testl %ebp, %ebp
setne %dil
callq 0x3000c
jmp 0x49973
movl $0xffffffff, 0x780(%r12) # imm = 0xFFFFFFFF
callq 0x26880
movl (%rax), %edi
callq 0x26680
leaq 0x7928f(%rip), %rsi     # 0xc2bf3
movl $0x3, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2fdad
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq