// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/src/rdb.c
// Function: rdbSaveRioWithEOFMark
int rdbSaveRioWithEOFMark(rio *rdb, int *error) {
    char eofmark[RDB_EOF_MARK_SIZE];

    getRandomHexChars(eofmark,RDB_EOF_MARK_SIZE);
    if (error) *error = 0;
    if (rioWrite(rdb,"$EOF:",5) == 0) goto werr;
    if (rioWrite(rdb,eofmark,RDB_EOF_MARK_SIZE) == 0) goto werr;
    if (rioWrite(rdb,"\r\n",2) == 0) goto werr;
    if (rdbSaveRio(rdb,error) == C_ERR) goto werr;
    if (rioWrite(rdb,eofmark,RDB_EOF_MARK_SIZE) == 0) goto werr;
    return C_OK;

werr: /* Write error. */
    /* Set 'error' only if not already set by rdbSaveRio() call. */
    if (error && *error == 0) *error = errno;
    return C_ERR;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsp, %r15
movq %r15, %rdi
movl $0x28, %esi
callq 0x43699
testq %rbx, %rbx
je 0x4c999
movl $0x0, (%rbx)
movl $0x5, %ecx
leaq 0x790ac(%rip), %r12     # 0xc5a51
testq %rcx, %rcx
je 0x4ca08
movq %rcx, %rbp
movq 0x20(%r14), %rax
movq 0x38(%r14), %rcx
cmpq %rbp, %rcx
movq %rbp, %r13
cmovbq %rcx, %r13
testq %rcx, %rcx
cmoveq %rbp, %r13
testq %rax, %rax
je 0x4c9d6
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq *%rax
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq *0x8(%r14)
testq %rax, %rax
je 0x4c9f7
addq %r13, %r12
movq %rbp, %rcx
subq %r13, %rcx
addq %r13, 0x30(%r14)
jmp 0x4c9fa
movq %rbp, %rcx
testq %rax, %rax
jne 0x4c9a5
testq %rbp, %rbp
jne 0x4cb67
movl $0x28, %ecx
testq %rcx, %rcx
je 0x4ca70
movq %rcx, %r13
movq 0x20(%r14), %rax
movq 0x38(%r14), %rcx
cmpq %r13, %rcx
movq %r13, %r12
cmovbq %rcx, %r12
testq %rcx, %rcx
cmoveq %r13, %r12
testq %rax, %rax
je 0x4ca3e
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *%rax
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *0x8(%r14)
testq %rax, %rax
je 0x4ca5f
addq %r12, %r15
movq %r13, %rcx
subq %r12, %rcx
addq %r12, 0x30(%r14)
jmp 0x4ca62
movq %r13, %rcx
testq %rax, %rax
jne 0x4ca0d
testq %r13, %r13
jne 0x4cb67
movl $0x2, %ecx
leaq 0x7a2f4(%rip), %r15     # 0xc6d70
testq %rcx, %rcx
je 0x4cadf
movq %rcx, %r13
movq 0x20(%r14), %rax
movq 0x38(%r14), %rcx
cmpq %r13, %rcx
movq %r13, %r12
cmovbq %rcx, %r12
testq %rcx, %rcx
cmoveq %r13, %r12
testq %rax, %rax
je 0x4caad
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *%rax
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *0x8(%r14)
testq %rax, %rax
je 0x4cace
addq %r12, %r15
movq %r13, %rcx
subq %r12, %rcx
addq %r12, 0x30(%r14)
jmp 0x4cad1
movq %r13, %rcx
testq %rax, %rax
jne 0x4ca7c
testq %r13, %r13
jne 0x4cb67
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4c631
cmpl $-0x1, %eax
je 0x4cb67
movl $0x28, %ecx
movq %rsp, %r15
movq %rcx, %r13
testq %rcx, %rcx
je 0x4cb51
movq 0x20(%r14), %rax
movq 0x38(%r14), %rcx
cmpq %r13, %rcx
movq %r13, %r12
cmovbq %rcx, %r12
testq %rcx, %rcx
cmoveq %r13, %r12
testq %rax, %rax
je 0x4cb28
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *%rax
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *0x8(%r14)
testq %rax, %rax
je 0x4cb49
addq %r12, %r15
movq %r13, %rcx
subq %r12, %rcx
addq %r12, 0x30(%r14)
jmp 0x4cb4c
movq %r13, %rcx
testq %rax, %rax
jne 0x4caf7
xorl %ebp, %ebp
movq %r13, %rax
negq %rax
sbbl %ebp, %ebp
testq %rbx, %rbx
je 0x4cb86
testq %r13, %r13
jne 0x4cb6c
jmp 0x4cb86
testq %rbx, %rbx
je 0x4cb81
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x0, (%rbx)
jne 0x4cb86
callq 0x26890
movl (%rax), %eax
movl %eax, (%rbx)
jmp 0x4cb86
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq