// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/replication.c
// Function: replicationResurrectCachedMaster
void replicationResurrectCachedMaster(int newfd) {
    server.master = server.cached_master;
    server.cached_master = NULL;
    server.master->fd = newfd;
    server.master->flags &= ~(CLIENT_CLOSE_AFTER_REPLY|CLIENT_CLOSE_ASAP);
    server.master->authenticated = 1;
    server.master->lastinteraction = server.unixtime;
    server.repl_state = REPL_STATE_CONNECTED;

    /* Re-add to the list of clients. */
    listAddNodeTail(server.clients,server.master);
    if (aeCreateFileEvent(server.el, newfd, AE_READABLE,
                          readQueryFromClient, server.master)) {
        serverLog(LL_WARNING,"Error resurrecting the cached master, impossible to add the readable handler: %s", strerror(errno));
        freeClientAsync(server.master); /* Close ASAP. */
    }

    /* We may also need to install the write handler as well if there is
     * pending data in the write buffers. */
    if (clientHasPendingReplies(server.master)) {
        if (aeCreateFileEvent(server.el, newfd, AE_WRITABLE,
                          sendReplyToClient, server.master)) {
            serverLog(LL_WARNING,"Error resurrecting the cached master, impossible to add the writable handler: %s", strerror(errno));
            freeClientAsync(server.master); /* Close ASAP. */
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
leaq 0x127806(%rip), %rax    # 0x1781d8
movq 0x840(%rax), %rcx
leaq 0x1277f8(%rip), %rax    # 0x1781d8
movq %rcx, 0x838(%rax)
leaq 0x1277ea(%rip), %rax    # 0x1781d8
movq $0x0, 0x840(%rax)
movl -0x4(%rbp), %ecx
leaq 0x1277d5(%rip), %rax    # 0x1781d8
movq 0x838(%rax), %rax
movl %ecx, 0x8(%rax)
leaq 0x1277c4(%rip), %rax    # 0x1781d8
movq 0x838(%rax), %rax
movl 0x98(%rax), %ecx
andl $0xfffffbbf, %ecx       # imm = 0xFFFFFBBF
movl %ecx, 0x98(%rax)
leaq 0x1277a4(%rip), %rax    # 0x1781d8
movq 0x838(%rax), %rax
movl $0x1, 0x9c(%rax)
leaq 0x12778c(%rip), %rax    # 0x1781d8
movq 0x978(%rax), %rcx
leaq 0x12777e(%rip), %rax    # 0x1781d8
movq 0x838(%rax), %rax
movq %rcx, 0x88(%rax)
leaq 0x127769(%rip), %rax    # 0x1781d8
movl $0xf, 0x84c(%rax)
leaq 0x127758(%rip), %rax    # 0x1781d8
movq 0x1c8(%rax), %rdi
leaq 0x12774a(%rip), %rax    # 0x1781d8
movq 0x838(%rax), %rsi
callq 0x27000
leaq 0x127737(%rip), %rax    # 0x1781d8
movq 0x40(%rax), %rdi
movl -0x4(%rbp), %esi
leaq 0x127729(%rip), %rax    # 0x1781d8
movq 0x838(%rax), %r8
movl $0x1, %edx
leaq -0xe982(%rip), %rcx     # 0x42140
callq 0x2a8f0
cmpl $0x0, %eax
je 0x50b01
callq 0x26880
movl (%rax), %edi
callq 0x26690
movq %rax, %rdx
movl $0x3, %edi
leaq 0xec3a3(%rip), %rsi     # 0x13ce8a
movb $0x0, %al
callq 0x2fc60
leaq 0x1276e3(%rip), %rax    # 0x1781d8
movq 0x838(%rax), %rdi
callq 0x44460
leaq 0x1276d0(%rip), %rax    # 0x1781d8
movq 0x838(%rax), %rdi
callq 0x424d0
cmpl $0x0, %eax
je 0x50b82
leaq 0x1276b8(%rip), %rax    # 0x1781d8
movq 0x40(%rax), %rdi
movl -0x4(%rbp), %esi
leaq 0x1276aa(%rip), %rax    # 0x1781d8
movq 0x838(%rax), %r8
movl $0x2, %edx
leaq -0xc2c1(%rip), %rcx     # 0x44880
callq 0x2a8f0
cmpl $0x0, %eax
je 0x50b80
callq 0x26880
movl (%rax), %edi
callq 0x26690
movq %rax, %rdx
movl $0x3, %edi
leaq 0xec375(%rip), %rsi     # 0x13cedb
movb $0x0, %al
callq 0x2fc60
leaq 0x127664(%rip), %rax    # 0x1781d8
movq 0x838(%rax), %rdi
callq 0x44460
jmp 0x50b82
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)