// File: /workspace/github_c_makefile_star2_O2/mijallen[P]SimpleHTTPServer/lib/libyaml/src/api.c
// Function: yaml_document_initialize
YAML_DECLARE(int)
yaml_document_initialize(yaml_document_t *document,
        yaml_version_directive_t *version_directive,
        yaml_tag_directive_t *tag_directives_start,
        yaml_tag_directive_t *tag_directives_end,
        int start_implicit, int end_implicit)
{
    struct {
        yaml_error_type_t error;
    } context;
    struct {
        yaml_node_t *start;
        yaml_node_t *end;
        yaml_node_t *top;
    } nodes = { NULL, NULL, NULL };
    yaml_version_directive_t *version_directive_copy = NULL;
    struct {
        yaml_tag_directive_t *start;
        yaml_tag_directive_t *end;
        yaml_tag_directive_t *top;
    } tag_directives_copy = { NULL, NULL, NULL };
    yaml_tag_directive_t value = { NULL, NULL };
    yaml_mark_t mark = { 0, 0, 0 };

    assert(document);       /* Non-NULL document object is expected. */
    assert((tag_directives_start && tag_directives_end) ||
            (tag_directives_start == tag_directives_end));
                            /* Valid tag directives are expected. */

    if (!STACK_INIT(&context, nodes, INITIAL_STACK_SIZE)) goto error;

    if (version_directive) {
        version_directive_copy = yaml_malloc(sizeof(yaml_version_directive_t));
        if (!version_directive_copy) goto error;
        version_directive_copy->major = version_directive->major;
        version_directive_copy->minor = version_directive->minor;
    }

    if (tag_directives_start != tag_directives_end) {
        yaml_tag_directive_t *tag_directive;
        if (!STACK_INIT(&context, tag_directives_copy, INITIAL_STACK_SIZE))
            goto error;
        for (tag_directive = tag_directives_start;
                tag_directive != tag_directives_end; tag_directive ++) {
            assert(tag_directive->handle);
            assert(tag_directive->prefix);
            if (!yaml_check_utf8(tag_directive->handle,
                        strlen((char *)tag_directive->handle)))
                goto error;
            if (!yaml_check_utf8(tag_directive->prefix,
                        strlen((char *)tag_directive->prefix)))
                goto error;
            value.handle = yaml_strdup(tag_directive->handle);
            value.prefix = yaml_strdup(tag_directive->prefix);
            if (!value.handle || !value.prefix) goto error;
            if (!PUSH(&context, tag_directives_copy, value))
                goto error;
            value.handle = NULL;
            value.prefix = NULL;
        }
    }

    DOCUMENT_INIT(*document, nodes.start, nodes.end, version_directive_copy,
            tag_directives_copy.start, tag_directives_copy.top,
            start_implicit, end_implicit, mark, mark);

    return 1;

error:
    STACK_DEL(&context, nodes);
    yaml_free(version_directive_copy);
    while (!STACK_EMPTY(&context, tag_directives_copy)) {
        yaml_tag_directive_t value = POP(&context, tag_directives_copy);
        yaml_free(value.handle);
        yaml_free(value.prefix);
    }
    STACK_DEL(&context, tag_directives_copy);
    yaml_free(value.handle);
    yaml_free(value.prefix);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
andq $0x0, 0x40(%rsp)
testq %rdi, %rdi
je 0x40dc
movl %r9d, %r13d
movl %r8d, %r14d
movq %rdx, %rbp
movq %rsi, %r15
movq %rdi, %r12
testq %rdx, %rdx
setne %al
testq %rcx, %rcx
setne %dl
movq %rcx, 0x28(%rsp)
cmpq %rcx, %rbp
je 0x3e6f
andb %dl, %al
je 0x40fb
movl $0x600, %edi            # imm = 0x600
callq 0x21a0
movq %rax, %rbx
testq %rax, %rax
je 0x3ea3
movl %r14d, 0x24(%rsp)
testq %r15, %r15
je 0x3eb6
pushq $0x8
popq %rdi
callq 0x21a0
testq %rax, %rax
je 0x3ea3
movq %rax, %r14
movq (%r15), %rax
movq %rax, (%r14)
jmp 0x3eb9
xorl %ebp, %ebp
xorl %r13d, %r13d
xorl %r14d, %r14d
xorl %r12d, %r12d
xorl %r15d, %r15d
jmp 0x3fe8
xorl %r14d, %r14d
cmpq 0x28(%rsp), %rbp
je 0x3fba
movl %r13d, 0x20(%rsp)
movq %r12, 0x50(%rsp)
movl $0x100, %edi            # imm = 0x100
callq 0x21a0
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x3fc0
movq %rax, %r13
leaq 0x18(%rsp), %rax
movq %r13, (%rax)
movq %r13, %rax
addq $0x100, %rax            # imm = 0x100
leaq 0x10(%rsp), %rcx
movq %rax, (%rcx)
cmpq 0x28(%rsp), %rbp
je 0x4019
movq (%rbp), %r12
testq %r12, %r12
je 0x409e
movq 0x8(%rbp), %r15
testq %r15, %r15
je 0x40bd
movq %r12, %rdi
callq 0x20d0
movq %r12, %rdi
movq %rax, %rsi
callq 0x37d7
testl %eax, %eax
je 0x3fca
movq %r15, %rdi
callq 0x20d0
movq %r15, %rdi
movq %rax, %rsi
callq 0x37d7
testl %eax, %eax
je 0x3fca
movq %r12, %rdi
callq 0x20c0
movq %rax, %r12
movq %r15, %rdi
callq 0x20c0
movq %rax, %r15
testq %r12, %r12
je 0x3fd0
testq %r15, %r15
je 0x3fd0
cmpq 0x10(%rsp), %r13
jne 0x3f9d
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x20e0
testl %eax, %eax
je 0x3fd0
movq 0x18(%rsp), %r13
leaq 0x10(%r13), %rax
movq %rax, 0x18(%rsp)
movq %r12, (%r13)
movq %r15, 0x8(%r13)
addq $0x10, %rbp
movq %rax, %r13
jmp 0x3f02
xorl %eax, %eax
xorl %ecx, %ecx
jmp 0x402d
xorl %ebp, %ebp
xorl %r13d, %r13d
jmp 0x3eab
xorl %r12d, %r12d
xorl %r15d, %r15d
movq 0x8(%rsp), %r13
movq 0x18(%rsp), %rbp
jmp 0x3fe8
movq -0x10(%rbp), %rbx
movq -0x8(%rbp), %r14
addq $-0x10, %rbp
movq %rbx, %rdi
callq 0x2040
movq %r14, %rdi
callq 0x2040
cmpq %r13, %rbp
jne 0x3fdc
movq %r13, %rdi
callq 0x2040
movq %r12, %rdi
callq 0x2040
movq %r15, %rdi
callq 0x2040
xorl %eax, %eax
jmp 0x408f
movq 0x8(%rsp), %rcx
movq 0x18(%rsp), %rax
movq 0x50(%rsp), %r12
movl 0x20(%rsp), %r13d
movq %rbx, %rdx
addq $0x600, %rdx            # imm = 0x600
movq %rbx, (%r12)
movq %rdx, 0x8(%r12)
movq %rbx, 0x10(%r12)
movq %r14, 0x18(%r12)
movq %rcx, 0x20(%r12)
movq %rax, 0x28(%r12)
movl 0x24(%rsp), %eax
movl %eax, 0x30(%r12)
movl %r13d, 0x34(%r12)
movaps 0x30(%rsp), %xmm0
movups %xmm0, 0x38(%r12)
movq 0x40(%rsp), %rax
movq %rax, 0x48(%r12)
movaps 0x30(%rsp), %xmm0
movups %xmm0, 0x50(%r12)
movq 0x40(%rsp), %rax
movq %rax, 0x60(%r12)
pushq $0x1
popq %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x12591(%rip), %rdi     # 0x16636
leaq 0x11f8d(%rip), %rsi     # 0x16039
leaq 0x1282a(%rip), %rcx     # 0x168dd
movl $0x431, %edx            # imm = 0x431
callq 0x2100
leaq 0x12588(%rip), %rdi     # 0x1664c
leaq 0x11f6e(%rip), %rsi     # 0x16039
leaq 0x1280b(%rip), %rcx     # 0x168dd
movl $0x432, %edx            # imm = 0x432
callq 0x2100
leaq 0x137fb(%rip), %rdi     # 0x178de
leaq 0x11f4f(%rip), %rsi     # 0x16039
leaq 0x127ec(%rip), %rcx     # 0x168dd
movl $0x41d, %edx            # imm = 0x41D
callq 0x2100
leaq 0x124d7(%rip), %rdi     # 0x165d9
leaq 0x11f30(%rip), %rsi     # 0x16039
leaq 0x127cd(%rip), %rcx     # 0x168dd
movl $0x41f, %edx            # imm = 0x41F
callq 0x2100