// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/cluster.c
// Function: clusterSaveConfig
int clusterSaveConfig(int do_fsync) {
    sds ci;
    size_t content_size;
    struct stat sb;
    int fd;

    server.cluster->todo_before_sleep &= ~CLUSTER_TODO_SAVE_CONFIG;

    /* Get the nodes description and concatenate our "vars" directive to
     * save currentEpoch and lastVoteEpoch. */
    ci = clusterGenNodesDescription(CLUSTER_NODE_HANDSHAKE);
    ci = sdscatprintf(ci,"vars currentEpoch %llu lastVoteEpoch %llu\n",
        (unsigned long long) server.cluster->currentEpoch,
        (unsigned long long) server.cluster->lastVoteEpoch);
    content_size = sdslen(ci);

    if ((fd = open(server.cluster_configfile,O_WRONLY|O_CREAT,0644))
        == -1) goto err;

    /* Pad the new payload if the existing file length is greater. */
    if (fstat(fd,&sb) != -1) {
        if (sb.st_size > (off_t)content_size) {
            ci = sdsgrowzero(ci,sb.st_size);
            memset(ci+content_size,'\n',sb.st_size-content_size);
        }
    }
    if (write(fd,ci,sdslen(ci)) != (ssize_t)sdslen(ci)) goto err;
    if (do_fsync) {
        server.cluster->todo_before_sleep &= ~CLUSTER_TODO_FSYNC_CONFIG;
        fsync(fd);
    }

    /* Truncate the file if needed to remove the final \n padding that
     * is just garbage. */
    if (content_size != sdslen(ci) && ftruncate(fd,content_size) == -1) {
        /* ftruncate() failing is not a critical error. */
    }
    close(fd);
    sdsfree(ci);
    return 0;

err:
    if (fd != -1) close(fd);
    sdsfree(ci);
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movl %edi, -0x8(%rbp)
leaq 0xfb533(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movl 0x60080(%rax), %ecx
andl $-0x5, %ecx
movl %ecx, 0x60080(%rax)
movl $0x20, %edi
callq 0x7cea0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0xfb504(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movq 0x8(%rax), %rdx
leaq 0xfb4f2(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movq 0x60078(%rax), %rcx
leaq 0xc4b44(%rip), %rsi     # 0x14183f
movb $0x0, %al
callq 0x395b0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7cf60
movq %rax, -0x18(%rbp)
leaq 0xfb4be(%rip), %rax     # 0x1781d8
movq 0x9a8(%rax), %rdi
movl $0x41, %esi
movl $0x1a4, %edx            # imm = 0x1A4
movb $0x0, %al
callq 0x266a0
movl %eax, -0xac(%rbp)
cmpl $-0x1, %eax
jne 0x7cd42
jmp 0x7ce6d
movl -0xac(%rbp), %edi
leaq -0xa8(%rbp), %rsi
callq 0x266f0
cmpl $-0x1, %eax
je 0x7cd90
movq -0x78(%rbp), %rax
cmpq -0x18(%rbp), %rax
jle 0x7cd8e
movq -0x10(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x38fa0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
addq -0x18(%rbp), %rdi
movq -0x78(%rbp), %rdx
subq -0x18(%rbp), %rdx
movl $0xa, %esi
callq 0x26110
jmp 0x7cd90
movl -0xac(%rbp), %eax
movl %eax, -0xc4(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7cf60
movl -0xc4(%rbp), %edi
movq -0xc0(%rbp), %rsi
movq %rax, %rdx
callq 0x26bc0
movq %rax, -0xb8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7cf60
movq %rax, %rcx
movq -0xb8(%rbp), %rax
cmpq %rcx, %rax
je 0x7cde9
jmp 0x7ce6d
cmpl $0x0, -0x8(%rbp)
je 0x7ce17
leaq 0xfb3e2(%rip), %rax     # 0x1781d8
movq 0x9b0(%rax), %rax
movl 0x60080(%rax), %ecx
andl $-0x9, %ecx
movl %ecx, 0x60080(%rax)
movl -0xac(%rbp), %edi
callq 0x26610
movq -0x18(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7cf60
movq %rax, %rcx
movq -0xd0(%rbp), %rax
cmpq %rcx, %rax
je 0x7ce50
movl -0xac(%rbp), %edi
movq -0x18(%rbp), %rsi
callq 0x26730
cmpl $-0x1, %eax
jne 0x7ce50
jmp 0x7ce50
movl -0xac(%rbp), %edi
callq 0x26180
movq -0x10(%rbp), %rdi
callq 0x38620
movl $0x0, -0x4(%rbp)
jmp 0x7ce91
cmpl $-0x1, -0xac(%rbp)
je 0x7ce81
movl -0xac(%rbp), %edi
callq 0x26180
movq -0x10(%rbp), %rdi
callq 0x38620
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq
nopl (%rax)