// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rcx
movq -0x18(%rbp), %rax
movl 0x30(%rax), %r8d
movq -0x18(%rbp), %rax
movl 0x34(%rax), %r9d
callq 0x1140
cmpl $0x0, %eax
jne 0x13c2
movl $0x0, -0x4(%rbp)
jmp 0x15e6
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x14b4
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x34(%rbp)
subl $0x1, %eax
je 0x1403
jmp 0x13ef
movl -0x34(%rbp), %eax
subl $0x2, %eax
je 0x143a
jmp 0x13f9
movl -0x34(%rbp), %eax
subl $0x3, %eax
je 0x145e
jmp 0x1482
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl 0x20(%rax), %r8d
callq 0x1160
cmpl $0x0, %eax
jne 0x1438
jmp 0x15d6
jmp 0x14a1
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rax
movl 0x28(%rax), %edx
callq 0x11a0
cmpl $0x0, %eax
jne 0x145c
jmp 0x15d6
jmp 0x14a1
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rax
movl 0x28(%rax), %edx
callq 0x10e0
cmpl $0x0, %eax
jne 0x1480
jmp 0x15d6
jmp 0x14a1
leaq 0x1b7b(%rip), %rdi      # 0x3004
leaq 0x1b76(%rip), %rsi      # 0x3006
movl $0x2c, %edx
leaq 0x1b77(%rip), %rcx      # 0x3013
callq 0x1120
jmp 0x14a3
movq -0x20(%rbp), %rax
addq $0x60, %rax
movq %rax, -0x20(%rbp)
jmp 0x13cd
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x15cd
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x38(%rbp)
subl $0x2, %eax
je 0x14ee
jmp 0x14e1
movl -0x38(%rbp), %eax
subl $0x3, %eax
je 0x1551
jmp 0x15b8
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jae 0x154f
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
subq %rcx, %rax
movl $0x60, %ecx
cqto
idivq %rcx
addq $0x1, %rax
movl %eax, %esi
movq -0x28(%rbp), %rax
movl (%rax), %edx
callq 0x10d0
cmpl $0x0, %eax
jne 0x153f
jmp 0x15d6
jmp 0x1541
movq -0x28(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x28(%rbp)
jmp 0x14fa
jmp 0x15ba
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jae 0x15b6
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
subq %rcx, %rax
movl $0x60, %ecx
cqto
idivq %rcx
addq $0x1, %rax
movl %eax, %esi
movq -0x30(%rbp), %rax
movl (%rax), %edx
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
callq 0x1200
cmpl $0x0, %eax
jne 0x15a6
jmp 0x15d6
jmp 0x15a8
movq -0x30(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x30(%rbp)
jmp 0x155d
jmp 0x15ba
jmp 0x15ba
jmp 0x15bc
movq -0x20(%rbp), %rax
addq $0x60, %rax
movq %rax, -0x20(%rbp)
jmp 0x14bf
movl $0x1, -0x4(%rbp)
jmp 0x15e6
movq -0x10(%rbp), %rdi
callq 0x1130
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop