// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/replication.c
// Function: sendSynchronousCommand
char *sendSynchronousCommand(int flags, int fd, ...) {

    /* Create the command to send to the master, we use simple inline
     * protocol for simplicity as currently we only send simple strings. */
    if (flags & SYNC_CMD_WRITE) {
        char *arg;
        va_list ap;
        sds cmd = sdsempty();
        va_start(ap,fd);

        while(1) {
            arg = va_arg(ap, char*);
            if (arg == NULL) break;

            if (sdslen(cmd) != 0) cmd = sdscatlen(cmd," ",1);
            cmd = sdscat(cmd,arg);
        }
        cmd = sdscatlen(cmd,"\r\n",2);

        /* Transfer command to the server. */
        if (syncWrite(fd,cmd,sdslen(cmd),server.repl_syncio_timeout*1000)
            == -1)
        {
            sdsfree(cmd);
            return sdscatprintf(sdsempty(),"-Writing to master: %s",
                    strerror(errno));
        }
        sdsfree(cmd);
        va_end(ap);
    }

    /* Read the reply from the server. */
    if (flags & SYNC_CMD_READ) {
        char buf[256];

        if (syncReadLine(fd,buf,sizeof(buf),server.repl_syncio_timeout*1000)
            == -1)
        {
            return sdscatprintf(sdsempty(),"-Reading from master: %s",
                    strerror(errno));
        }
        server.repl_transfer_lastio = server.unixtime;
        return sdsnew(buf);
    }
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movl %esi, %ebx
movl %edi, %ebp
movq %rdx, 0x110(%rsp)
movq %rcx, 0x118(%rsp)
movq %r8, 0x120(%rsp)
movq %r9, 0x128(%rsp)
testb %al, %al
je 0x3e938
movaps %xmm0, 0x130(%rsp)
movaps %xmm1, 0x140(%rsp)
movaps %xmm2, 0x150(%rsp)
movaps %xmm3, 0x160(%rsp)
movaps %xmm4, 0x170(%rsp)
movaps %xmm5, 0x180(%rsp)
movaps %xmm6, 0x190(%rsp)
movaps %xmm7, 0x1a0(%rsp)
testb $0x2, %bpl
je 0x3ea2a
callq 0x3114c
movq %rax, %r14
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rsp)
leaq 0x1f0(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x100(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x776d8(%rip), %r15     # 0xb6051
pushq $0x1
popq %r12
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0x3e996
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0x3e9a4
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq (%rax), %r13
testq %r13, %r13
je 0x3e9da
movq %r14, %rdi
callq 0x3cf20
testq %rax, %rax
je 0x3e9ca
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x31758
movq %rax, %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x317b7
movq %rax, %r14
jmp 0x3e97d
leaq 0x767af(%rip), %rsi     # 0xb5190
pushq $0x2
popq %rdx
movq %r14, %rdi
callq 0x31758
movq %rax, %r14
movq %rax, %rdi
callq 0x3cf20
leaq 0xbaeaa(%rip), %rcx     # 0xf98a8
movslq 0x848(%rcx), %rcx
imulq $0x3e8, %rcx, %rcx      # imm = 0x3E8
movl %ebx, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x5a9e8
movq %rax, %r15
movq %r14, %rdi
callq 0x311c8
cmpq $-0x1, %r15
je 0x3ea79
testb $0x1, %bpl
jne 0x3ea37
xorl %eax, %eax
jmp 0x3eabe
leaq 0xbae6a(%rip), %r14     # 0xf98a8
movslq 0x848(%r14), %rax
imulq $0x3e8, %rax, %rcx      # imm = 0x3E8
movq %rsp, %rsi
movl $0x100, %edx            # imm = 0x100
movl %ebx, %edi
callq 0x5ab2a
cmpq $-0x1, %rax
je 0x3ea96
movq 0x978(%r14), %rax
movq %rax, 0x878(%r14)
movq %rsp, %rdi
callq 0x3115a
jmp 0x3eabe
callq 0x3114c
movq %rax, %rbx
callq 0x26880
movl (%rax), %edi
callq 0x26680
leaq 0x74b0b(%rip), %rsi     # 0xb359f
jmp 0x3eab1
callq 0x3114c
movq %rax, %rbx
callq 0x26880
movl (%rax), %edi
callq 0x26680
leaq 0x74b05(%rip), %rsi     # 0xb35b6
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x31a38
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq