// File: /workspace/github_c_makefile_star2_O0/erikdubbelboer[P]discnt/src/ddb.c
// Function: ddbSaveBackground
int ddbSaveBackground(char *filename) {
    pid_t childpid;
    long long start;

    if (server.ddb_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);
        serverSetProcTitle("discnt-ddb-bgsave");
        retval = ddbSave(filename);
        if (retval == C_OK) {
            size_t private_dirty = zmalloc_get_private_dirty();

            if (private_dirty) {
                serverLog(LL_NOTICE,
                    "DDB: %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.ddb_save_time_start = time(NULL);
        server.ddb_child_pid = childpid;
        server.ddb_child_type = DDB_CHILD_TYPE_DISK;
        updateDictResizePolicy();
        return C_OK;
    }
    return C_OK; /* unreached */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
leaq 0x831d5(%rip), %rax     # 0xbf0e8
cmpl $-0x1, 0x6b0(%rax)
je 0x3bf28
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3c16c
leaq 0x831b9(%rip), %rax     # 0xbf0e8
movq 0x6a0(%rax), %rcx
leaq 0x831ab(%rip), %rax     # 0xbf0e8
movq %rcx, 0x6a8(%rax)
xorl %eax, %eax
movl %eax, %edi
callq 0x12530
movq %rax, %rcx
leaq 0x83191(%rip), %rax     # 0xbf0e8
movq %rcx, 0x6e0(%rax)
callq 0x18de0
movq %rax, -0x20(%rbp)
callq 0x12950
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jne 0x3bfe0
xorl %edi, %edi
callq 0x1bdf0
leaq 0x6d586(%rip), %rdi     # 0xa9508
callq 0x1d760
movq -0x10(%rbp), %rdi
callq 0x3bcd0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x3bfc6
callq 0x211e0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x3bfc4
movq -0x30(%rbp), %rdx
shrq $0x14, %rdx
movl $0x2, %edi
leaq 0x6d55d(%rip), %rsi     # 0xa951a
movb $0x0, %al
callq 0x18b10
jmp 0x3bfc6
movl -0x24(%rbp), %ecx
movl $0x1, %edi
xorl %eax, %eax
cmpl $0x0, %ecx
cmovel %eax, %edi
callq 0x18e80
jmp 0x3c165
callq 0x18de0
movq %rax, %rcx
movq -0x20(%rbp), %rax
subq %rax, %rcx
leaq 0x830f2(%rip), %rax     # 0xbf0e8
movq %rcx, 0x390(%rax)
callq 0x20de0
movq %rax, %xmm0
movaps 0x67462(%rip), %xmm1    # 0xa3470
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x67466(%rip), %xmm1    # 0xa3480
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x6a8ff(%rip), %xmm1    # 0xa6930
mulsd %xmm1, %xmm0
leaq 0x830ac(%rip), %rax     # 0xbf0e8
cvtsi2sdq 0x390(%rax), %xmm1
divsd %xmm1, %xmm0
movsd 0x673f7(%rip), %xmm1    # 0xa3448
divsd %xmm1, %xmm0
leaq 0x8308c(%rip), %rax     # 0xbf0e8
movsd %xmm0, 0x398(%rax)
leaq 0x8307d(%rip), %rax     # 0xbf0e8
cmpq $0x0, 0x670(%rax)
je 0x3c0c4
leaq 0x8306c(%rip), %rax     # 0xbf0e8
movq 0x390(%rax), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
cqto
idivq %rcx
leaq 0x83054(%rip), %rcx     # 0xbf0e8
cmpq 0x670(%rcx), %rax
jl 0x3c0c4
leaq 0x83044(%rip), %rax     # 0xbf0e8
movq 0x390(%rax), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
cqto
idivq %rcx
movq %rax, %rsi
leaq 0x6d487(%rip), %rdi     # 0xa9546
callq 0x37f70
cmpl $-0x1, -0x14(%rbp)
jne 0x3c106
leaq 0x83017(%rip), %rax     # 0xbf0e8
movl $0xffffffff, 0x6fc(%rax) # imm = 0xFFFFFFFF
callq 0x120b0
movl (%rax), %edi
callq 0x12900
movq %rax, %rdx
movl $0x3, %edi
leaq 0x6d455(%rip), %rsi     # 0xa954b
movb $0x0, %al
callq 0x18b10
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3c16c
movl -0x14(%rbp), %edx
movl $0x2, %edi
leaq 0x6d459(%rip), %rsi     # 0xa956e
movb $0x0, %al
callq 0x18b10
xorl %eax, %eax
movl %eax, %edi
callq 0x12530
movq %rax, %rcx
leaq 0x82fb9(%rip), %rax     # 0xbf0e8
movq %rcx, 0x6f0(%rax)
movl -0x14(%rbp), %ecx
leaq 0x82fa8(%rip), %rax     # 0xbf0e8
movl %ecx, 0x6b0(%rax)
leaq 0x82f9b(%rip), %rax     # 0xbf0e8
movl $0x1, 0x6f8(%rax)
callq 0x19460
movl $0x0, -0x4(%rbp)
jmp 0x3c16c
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)