// File: /workspace/github_c_makefile_star2_O3/mijallen[P]SimpleHTTPServer/lib/libyaml/tests/run-dumper.c
// Function: copy_document
int copy_document(yaml_document_t *document_to, yaml_document_t *document_from)
{
    yaml_node_t *node;
    yaml_node_item_t *item;
    yaml_node_pair_t *pair;

    if (!yaml_document_initialize(document_to, document_from->version_directive,
                document_from->tag_directives.start,
                document_from->tag_directives.end,
                document_from->start_implicit, document_from->end_implicit))
        return 0;

    for (node = document_from->nodes.start;
            node < document_from->nodes.top; node ++) {
        switch (node->type) {
            case YAML_SCALAR_NODE:
                if (!yaml_document_add_scalar(document_to, node->tag,
                            node->data.scalar.value, node->data.scalar.length,
                            node->data.scalar.style)) goto error;
                break;
            case YAML_SEQUENCE_NODE:
                if (!yaml_document_add_sequence(document_to, node->tag,
                            node->data.sequence.style)) goto error;
                break;
            case YAML_MAPPING_NODE:
                if (!yaml_document_add_mapping(document_to, node->tag,
                            node->data.mapping.style)) goto error;
                break;
            default:
                assert(0);
                break;
        }
    }

    for (node = document_from->nodes.start;
            node < document_from->nodes.top; node ++) {
        switch (node->type) {
            case YAML_SEQUENCE_NODE:
                for (item = node->data.sequence.items.start;
                        item < node->data.sequence.items.top; item ++) {
                    if (!yaml_document_append_sequence_item(document_to,
                                node - document_from->nodes.start + 1,
                                *item)) goto error;
                }
                break;
            case YAML_MAPPING_NODE:
                for (pair = node->data.mapping.pairs.start;
                        pair < node->data.mapping.pairs.top; pair ++) {
                    if (!yaml_document_append_mapping_pair(document_to,
                                node - document_from->nodes.start + 1,
                                pair->key, pair->value)) goto error;
                }
                break;
            default:
                break;
        }
    }
    return 1;

error:
    yaml_document_delete(document_to);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rsi), %rsi
movq 0x20(%r14), %rdx
movq 0x28(%r14), %rcx
movl 0x30(%r14), %r8d
movl 0x34(%r14), %r9d
callq 0x1140
xorl %ebp, %ebp
testl %eax, %eax
je 0x14ab
movq (%r14), %r15
movq 0x10(%r14), %rax
cmpq %rax, %r15
jae 0x1413
movl (%r15), %eax
cmpl $0x3, %eax
je 0x13eb
cmpl $0x2, %eax
je 0x13d9
cmpl $0x1, %eax
jne 0x14b6
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdx
movl 0x18(%r15), %ecx
movl 0x20(%r15), %r8d
movq %rbx, %rdi
callq 0x1160
jmp 0x13fb
movq 0x8(%r15), %rsi
movl 0x28(%r15), %edx
movq %rbx, %rdi
callq 0x11a0
jmp 0x13fb
movq 0x8(%r15), %rsi
movl 0x28(%r15), %edx
movq %rbx, %rdi
callq 0x10e0
testl %eax, %eax
je 0x14a3
addq $0x60, %r15
movq 0x10(%r14), %rax
cmpq %rax, %r15
jb 0x13a9
movq (%r14), %r15
cmpq %rax, %r15
jae 0x149c
movl (%r15), %eax
cmpl $0x3, %eax
je 0x145b
cmpl $0x2, %eax
jne 0x1492
movq 0x10(%r15), %r12
cmpq 0x20(%r15), %r12
jae 0x1492
movq %r15, %rax
subq (%r14), %rax
shrq $0x5, %rax
imull $0xaaaaaaab, %eax, %esi # imm = 0xAAAAAAAB
incl %esi
movl (%r12), %edx
movq %rbx, %rdi
callq 0x10d0
testl %eax, %eax
je 0x14a3
addq $0x4, %r12
jmp 0x142d
movq 0x10(%r15), %r12
cmpq 0x20(%r15), %r12
jae 0x1492
movq %r15, %rax
subq (%r14), %rax
shrq $0x5, %rax
imull $0xaaaaaaab, %eax, %esi # imm = 0xAAAAAAAB
incl %esi
movl (%r12), %edx
movl 0x4(%r12), %ecx
movq %rbx, %rdi
callq 0x1200
testl %eax, %eax
je 0x14a3
addq $0x8, %r12
jmp 0x145f
addq $0x60, %r15
cmpq 0x10(%r14), %r15
jb 0x141c
movl $0x1, %ebp
jmp 0x14ab
movq %rbx, %rdi
callq 0x1130
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb47(%rip), %rdi       # 0x2004
leaq 0xb42(%rip), %rsi       # 0x2006
leaq 0xb48(%rip), %rcx       # 0x2013
movl $0x2c, %edx
callq 0x1120