// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/replication.c
// Function: slaveofCommand
void slaveofCommand(client *c) {
    /* SLAVEOF is not allowed in cluster mode as replication is automatically
     * configured using the current address of the master node. */
    if (server.cluster_enabled) {
        addReplyError(c,"SLAVEOF not allowed in cluster mode.");
        return;
    }

    /* The special host/port combination "NO" "ONE" turns the instance
     * into a master. Otherwise the new master address is set. */
    if (!strcasecmp(c->argv[1]->ptr,"no") &&
        !strcasecmp(c->argv[2]->ptr,"one")) {
        if (server.masterhost) {
            replicationUnsetMaster();
            sds client = catClientInfoString(sdsempty(),c);
            serverLog(LL_NOTICE,"MASTER MODE enabled (user request from '%s')",
                client);
            sdsfree(client);
        }
    } else {
        long port;

        if ((getLongFromObjectOrReply(c, c->argv[2], &port, NULL) != C_OK))
            return;

        /* Check if we are already attached to the specified slave */
        if (server.masterhost && !strcasecmp(server.masterhost,c->argv[1]->ptr)
            && server.masterport == port) {
            serverLog(LL_NOTICE,"SLAVE OF would result into synchronization with the master we are already connected with. No operation performed.");
            addReplySds(c,sdsnew("+OK Already connected to specified master\r\n"));
            return;
        }
        /* There was no previous master or the user specified a different one,
         * we can continue. */
        replicationSetMaster(c->argv[1]->ptr, port);
        sds client = catClientInfoString(sdsempty(),c);
        serverLog(LL_NOTICE,"SLAVE OF %s:%d enabled (user request from '%s')",
            server.masterhost, server.masterport, client);
        sdsfree(client);
    }
    addReply(c,shared.ok);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x126855(%rip), %rax    # 0x1781d8
cmpl $0x0, 0x99c(%rax)
je 0x519a1
movq -0x8(%rbp), %rdi
leaq 0xeb32e(%rip), %rsi     # 0x13ccc5
callq 0x42f90
jmp 0x51b5b
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0xf2b16(%rip), %rsi     # 0x1444ce
callq 0x26300
cmpl $0x0, %eax
jne 0x51a33
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0xfa801(%rip), %rsi     # 0x14c1da
callq 0x26300
cmpl $0x0, %eax
jne 0x51a33
leaq 0x1267ee(%rip), %rax    # 0x1781d8
cmpq $0x0, 0x828(%rax)
je 0x51a2e
callq 0x51860
callq 0x384f0
movq %rax, %rdi
movq -0x8(%rbp), %rsi
callq 0x455c0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdx
movl $0x2, %edi
leaq 0xeb2cc(%rip), %rsi     # 0x13ccea
movb $0x0, %al
callq 0x2fc60
movq -0x10(%rbp), %rdi
callq 0x38620
jmp 0x51b47
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rsi
leaq -0x18(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x49f20
cmpl $0x0, %eax
je 0x51a5a
jmp 0x51b5b
leaq 0x126777(%rip), %rax    # 0x1781d8
cmpq $0x0, 0x828(%rax)
je 0x51adc
leaq 0x126766(%rip), %rax    # 0x1781d8
movq 0x828(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x26300
cmpl $0x0, %eax
jne 0x51adc
leaq 0x12673e(%rip), %rax    # 0x1781d8
movslq 0x830(%rax), %rax
cmpq -0x18(%rbp), %rax
jne 0x51adc
movl $0x2, %edi
leaq 0xeb264(%rip), %rsi     # 0x13cd17
movb $0x0, %al
callq 0x2fc60
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
leaq 0xeb2c0(%rip), %rdi     # 0x13cd89
callq 0x38510
movq -0x28(%rbp), %rdi
movq %rax, %rsi
callq 0x42e50
jmp 0x51b5b
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rax
movl %eax, %esi
callq 0x51790
callq 0x384f0
movq %rax, %rdi
movq -0x8(%rbp), %rsi
callq 0x455c0
movq %rax, -0x20(%rbp)
leaq 0x1266c5(%rip), %rax    # 0x1781d8
movq 0x828(%rax), %rdx
leaq 0x1266b7(%rip), %rax    # 0x1781d8
movl 0x830(%rax), %ecx
movq -0x20(%rbp), %r8
movl $0x2, %edi
leaq 0xeb27e(%rip), %rsi     # 0x13cdb5
movb $0x0, %al
callq 0x2fc60
movq -0x20(%rbp), %rdi
callq 0x38620
movq -0x8(%rbp), %rdi
leaq 0x1270ee(%rip), %rax    # 0x178c40
movq 0x8(%rax), %rsi
callq 0x42cc0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)