// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/aof.c
// Function: feedAppendOnlyFile
void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv, int argc) {
    sds buf = sdsempty();
    robj *tmpargv[3];

    /* The DB this command was targeting is not the same as the last command
     * we appended. To issue a SELECT command is needed. */
    if (dictid != server.aof_selected_db) {
        char seldb[64];

        snprintf(seldb,sizeof(seldb),"%d",dictid);
        buf = sdscatprintf(buf,"*2\r\n$6\r\nSELECT\r\n$%lu\r\n%s\r\n",
            (unsigned long)strlen(seldb),seldb);
        server.aof_selected_db = dictid;
    }

    if (cmd->proc == expireCommand || cmd->proc == pexpireCommand ||
        cmd->proc == expireatCommand) {
        /* Translate EXPIRE/PEXPIRE/EXPIREAT into PEXPIREAT */
        buf = catAppendOnlyExpireAtCommand(buf,cmd,argv[1],argv[2]);
    } else if (cmd->proc == setexCommand || cmd->proc == psetexCommand) {
        /* Translate SETEX/PSETEX to SET and PEXPIREAT */
        tmpargv[0] = createStringObject("SET",3);
        tmpargv[1] = argv[1];
        tmpargv[2] = argv[3];
        buf = catAppendOnlyGenericCommand(buf,3,tmpargv);
        decrRefCount(tmpargv[0]);
        buf = catAppendOnlyExpireAtCommand(buf,cmd,argv[1],argv[2]);
    } else if (cmd->proc == setCommand && argc > 3) {
        int i;
        robj *exarg = NULL, *pxarg = NULL;
        /* Translate SET [EX seconds][PX milliseconds] to SET and PEXPIREAT */
        buf = catAppendOnlyGenericCommand(buf,3,argv);
        for (i = 3; i < argc; i ++) {
            if (!strcasecmp(argv[i]->ptr, "ex")) exarg = argv[i+1];
            if (!strcasecmp(argv[i]->ptr, "px")) pxarg = argv[i+1];
        }
        serverAssert(!(exarg && pxarg));
        if (exarg)
            buf = catAppendOnlyExpireAtCommand(buf,server.expireCommand,argv[1],
                                               exarg);
        if (pxarg)
            buf = catAppendOnlyExpireAtCommand(buf,server.pexpireCommand,argv[1],
                                               pxarg);
    } else {
        /* All the other commands don't need translation or need the
         * same translation already operated in the command vector
         * for the replication itself. */
        buf = catAppendOnlyGenericCommand(buf,argc,argv);
    }

    /* Append to the AOF buffer. This will be flushed on disk just before
     * of re-entering the event loop, so before the client will get a
     * positive reply about the operation performed. */
    if (server.aof_state == AOF_ON)
        server.aof_buf = sdscatlen(server.aof_buf,buf,sdslen(buf));

    /* If a background append only file rewriting is in progress we want to
     * accumulate the differences between the child DB and the current one
     * in a buffer, so that when the child process will do its work we
     * can append the differences to the new append only file. */
    if (server.aof_child_pid != -1)
        aofRewriteBufferAppend((unsigned char*)buf,sdslen(buf));

    sdsfree(buf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
callq 0x384f0
movq %rax, -0x28(%rbp)
movl -0xc(%rbp), %eax
leaq 0x10652c(%rip), %rcx    # 0x1781d8
cmpl 0x6b4(%rcx), %eax
je 0x71d12
leaq -0x80(%rbp), %rdi
movl -0xc(%rbp), %ecx
movl $0x40, %esi
leaq 0xcf111(%rip), %rdx     # 0x140dd8
movb $0x0, %al
callq 0x26120
movq -0x28(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x264f0
movq -0xa0(%rbp), %rdi
movq %rax, %rdx
leaq -0x80(%rbp), %rcx
leaq 0xcdaaa(%rip), %rsi     # 0x13f7a1
movb $0x0, %al
callq 0x395b0
movq %rax, -0x28(%rbp)
movl -0xc(%rbp), %ecx
leaq 0x1064cc(%rip), %rax    # 0x1781d8
movl %ecx, 0x6b4(%rax)
movq -0x8(%rbp), %rax
leaq -0x2524d(%rip), %rcx    # 0x4cad0
cmpq %rcx, 0x8(%rax)
je 0x71d45
movq -0x8(%rbp), %rax
leaq -0x251fe(%rip), %rcx    # 0x4cb30
cmpq %rcx, 0x8(%rax)
je 0x71d45
movq -0x8(%rbp), %rax
leaq -0x2523f(%rip), %rcx    # 0x4cb00
cmpq %rcx, 0x8(%rax)
jne 0x71d6b
movq -0x28(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
callq 0x71b40
movq %rax, -0x28(%rbp)
jmp 0x71fb1
movq -0x8(%rbp), %rax
leaq -0x1a0b6(%rip), %rcx    # 0x57cc0
cmpq %rcx, 0x8(%rax)
je 0x71d8d
movq -0x8(%rbp), %rax
leaq -0x1a047(%rip), %rcx    # 0x57d40
cmpq %rcx, 0x8(%rax)
jne 0x71dff
leaq 0xd532c(%rip), %rdi     # 0x1470c0
movl $0x3, %esi
callq 0x486a0
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
leaq -0x40(%rbp), %rdx
movl $0x3, %esi
callq 0x719d0
movq %rax, -0x28(%rbp)
movq -0x40(%rbp), %rdi
callq 0x48f70
movq -0x28(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
callq 0x71b40
movq %rax, -0x28(%rbp)
jmp 0x71faf
movq -0x8(%rbp), %rax
leaq -0x1a48a(%rip), %rcx    # 0x57980
cmpq %rcx, 0x8(%rax)
jne 0x71f99
cmpl $0x3, -0x1c(%rbp)
jle 0x71f99
movq $0x0, -0x90(%rbp)
movq $0x0, -0x98(%rbp)
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x3, %esi
callq 0x719d0
movq %rax, -0x28(%rbp)
movl $0x3, -0x84(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x71ef7
movq -0x18(%rbp), %rax
movslq -0x84(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0xc9a2f(%rip), %rsi     # 0x13b8ac
callq 0x26300
cmpl $0x0, %eax
jne 0x71ea2
movq -0x18(%rbp), %rax
movl -0x84(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x90(%rbp)
movq -0x18(%rbp), %rax
movslq -0x84(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
leaq 0xcd900(%rip), %rsi     # 0x13f7bc
callq 0x26300
cmpl $0x0, %eax
jne 0x71ee1
movq -0x18(%rbp), %rax
movl -0x84(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x98(%rbp)
jmp 0x71ee3
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x71e54
cmpq $0x0, -0x90(%rbp)
je 0x71f0b
cmpq $0x0, -0x98(%rbp)
jne 0x71f0d
jmp 0x71f2f
leaq 0xcd8ab(%rip), %rdi     # 0x13f7bf
leaq 0xcd45c(%rip), %rsi     # 0x13f377
movl $0x224, %edx            # imm = 0x224
callq 0x76ce0
movl $0x1, %edi
callq 0x263c0
cmpq $0x0, -0x90(%rbp)
je 0x71f63
movq -0x28(%rbp), %rdi
leaq 0x106294(%rip), %rax    # 0x1781d8
movq 0x378(%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x90(%rbp), %rcx
callq 0x71b40
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x98(%rbp)
je 0x71f97
movq -0x28(%rbp), %rdi
leaq 0x106260(%rip), %rax    # 0x1781d8
movq 0x380(%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x98(%rbp), %rcx
callq 0x71b40
movq %rax, -0x28(%rbp)
jmp 0x71fad
movq -0x28(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x18(%rbp), %rdx
callq 0x719d0
movq %rax, -0x28(%rbp)
jmp 0x71faf
jmp 0x71fb1
leaq 0x106220(%rip), %rax    # 0x1781d8
cmpl $0x1, 0x668(%rax)
jne 0x72011
leaq 0x106210(%rip), %rax    # 0x1781d8
movq 0x6a8(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x28(%rbp), %rdi
callq 0x71850
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq %rax, %rdx
callq 0x39040
movq %rax, %rcx
leaq 0x1061ce(%rip), %rax    # 0x1781d8
movq %rcx, 0x6a8(%rax)
leaq 0x1061c0(%rip), %rax    # 0x1781d8
cmpl $-0x1, 0x69c(%rax)
je 0x72044
movq -0x28(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x28(%rbp), %rdi
callq 0x71850
movq -0xb8(%rbp), %rdi
movq %rax, %rsi
callq 0x707b0
movq -0x28(%rbp), %rdi
callq 0x38620
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)