// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/aof.c
// Function: startAppendOnly
int startAppendOnly(void) {
    char cwd[MAXPATHLEN]; /* Current working dir path for error messages. */

    server.aof_last_fsync = server.unixtime;
    server.aof_fd = open(server.aof_filename,O_WRONLY|O_APPEND|O_CREAT,0644);
    serverAssert(server.aof_state == AOF_OFF);
    if (server.aof_fd == -1) {
        char *cwdp = getcwd(cwd,MAXPATHLEN);

        serverLog(LL_WARNING,
            "Redis needs to enable the AOF but can't open the "
            "append only file %s (in server root dir %s): %s",
            server.aof_filename,
            cwdp ? cwdp : "unknown",
            strerror(errno));
        return C_ERR;
    }
    if (server.rdb_child_pid != -1) {
        server.aof_rewrite_scheduled = 1;
        serverLog(LL_WARNING,"AOF was enabled but there is already a child process saving an RDB file on disk. An AOF background was scheduled to start when possible.");
    } else if (rewriteAppendOnlyFileBackground() == C_ERR) {
        close(server.aof_fd);
        serverLog(LL_WARNING,"Redis needs to enable the AOF but can't trigger a background AOF rewrite operation. Check the above logs for more info about the error.");
        return C_ERR;
    }
    /* We correctly switched on AOF, now wait for the rewrite to be complete
     * in order to append data on disk. */
    server.aof_state = AOF_WAIT_REWRITE;
    return C_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1030, %rsp           # imm = 0x1030
leaq 0x106e06(%rip), %rax    # 0x1781d8
movq 0x978(%rax), %rcx
leaq 0x106df8(%rip), %rax    # 0x1781d8
movq %rcx, 0x6c0(%rax)
leaq 0x106dea(%rip), %rax    # 0x1781d8
movq 0x670(%rax), %rdi
movl $0x441, %esi            # imm = 0x441
movl $0x1a4, %edx            # imm = 0x1A4
movb $0x0, %al
callq 0x266a0
movl %eax, %ecx
leaq 0x106dc9(%rip), %rax    # 0x1781d8
movl %ecx, 0x6b0(%rax)
leaq 0x106dbc(%rip), %rax    # 0x1781d8
cmpl $0x0, 0x668(%rax)
jne 0x71427
jmp 0x71449
leaq 0xcdf76(%rip), %rdi     # 0x13f3a4
leaq 0xcdf42(%rip), %rsi     # 0x13f377
movl $0xf3, %edx
callq 0x76ce0
movl $0x1, %edi
callq 0x263c0
leaq 0x106d88(%rip), %rax    # 0x1781d8
cmpl $-0x1, 0x6b0(%rax)
jne 0x714fe
leaq -0x1010(%rbp), %rdi
movl $0x1000, %esi           # imm = 0x1000
callq 0x26910
movq %rax, -0x1018(%rbp)
leaq 0x106d5c(%rip), %rax    # 0x1781d8
movq 0x670(%rax), %rax
movq %rax, -0x1020(%rbp)
cmpq $0x0, -0x1018(%rbp)
je 0x714a4
movq -0x1018(%rbp), %rax
movq %rax, -0x1028(%rbp)
jmp 0x714b4
leaq 0xca372(%rip), %rax     # 0x13b81d
movq %rax, -0x1028(%rbp)
jmp 0x714b4
movq -0x1028(%rbp), %rax
movq %rax, -0x1030(%rbp)
callq 0x26880
movl (%rax), %edi
callq 0x26690
movq -0x1020(%rbp), %rdx
movq -0x1030(%rbp), %rcx
movq %rax, %r8
movl $0x3, %edi
leaq 0xcded5(%rip), %rsi     # 0x13f3c0
movb $0x0, %al
callq 0x2fc60
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x71586
leaq 0x106cd3(%rip), %rax    # 0x1781d8
cmpl $-0x1, 0x730(%rax)
je 0x71534
leaq 0x106cc3(%rip), %rax    # 0x1781d8
movl $0x1, 0x698(%rax)
movl $0x3, %edi
leaq 0xcdef6(%rip), %rsi     # 0x13f421
movb $0x0, %al
callq 0x2fc60
jmp 0x7156e
callq 0x715a0
cmpl $-0x1, %eax
jne 0x7156c
leaq 0x106c93(%rip), %rax    # 0x1781d8
movl 0x6b0(%rax), %edi
callq 0x26180
movl $0x3, %edi
leaq 0xcdf4e(%rip), %rsi     # 0x13f4aa
movb $0x0, %al
callq 0x2fc60
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x71586
jmp 0x7156e
leaq 0x106c63(%rip), %rax    # 0x1781d8
movl $0x2, 0x668(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1030, %rsp           # imm = 0x1030
popq %rbp
retq
nopw %cs:(%rax,%rax)