// File: /workspace/github_c_makefile_star2_O3/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
movl %r8d, 0x1c(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
testq %rdi, %rdi
je 0x4368
movl %r9d, %ebp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r12
testq %rdx, %rdx
setne %al
testq %rcx, %rcx
setne %dl
movq %rcx, 0x38(%rsp)
cmpq %rcx, %r14
je 0x408e
andb %dl, %al
je 0x4387
movl $0x600, %edi            # imm = 0x600
callq 0x21a0
testq %rax, %rax
je 0x4277
movq %rax, %r15
testq %rbx, %rbx
je 0x40cd
movl $0x8, %edi
callq 0x21a0
testq %rax, %rax
je 0x426f
movq %rax, %r13
movq %r15, 0x10(%rsp)
movq (%rbx), %rax
movq %rax, (%r13)
jmp 0x40d5
movq %r15, 0x10(%rsp)
xorl %r13d, %r13d
cmpq 0x38(%rsp), %r14
je 0x41f3
movl $0x100, %edi            # imm = 0x100
callq 0x21a0
testq %rax, %rax
je 0x427e
movq %rax, %r15
movl %ebp, 0xc(%rsp)
movq %r12, 0x20(%rsp)
movq %r13, (%rsp)
movq %rax, %r13
addq $0x100, %r13            # imm = 0x100
movq %rax, %rbp
movq (%r14), %r12
testq %r12, %r12
je 0x4349
movq 0x8(%r14), %rbx
testq %rbx, %rbx
je 0x432a
movq %r12, %rdi
callq 0x20d0
movq %r12, %rdi
movq %rax, %rsi
callq 0x398c
testl %eax, %eax
je 0x428a
movq %rbx, %rdi
callq 0x20d0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x398c
testl %eax, %eax
je 0x428a
movq %r12, %rdi
callq 0x2220
movq %rax, %r12
movq %rbx, %rdi
callq 0x2220
movq %rax, %rbx
testq %r12, %r12
je 0x428f
testq %rbx, %rbx
je 0x428f
cmpq %r13, %r15
jne 0x41d4
movq %r12, 0x28(%rsp)
movq %rbx, 0x30(%rsp)
movq %rbp, %r13
movq %r15, %rbp
subq %r13, %rbp
leaq (,%rbp,2), %r12
movq %r13, %rdi
movq %r12, %rsi
callq 0x2130
testq %rax, %rax
je 0x4311
addq %rax, %rbp
addq %rax, %r12
movq %rbp, %r15
movq %rax, %rbp
movq 0x30(%rsp), %rbx
movq %r12, %r13
movq 0x28(%rsp), %r12
leaq 0x10(%r15), %rax
movq %r12, (%r15)
movq %rbx, 0x8(%r15)
addq $0x10, %r14
movq %rax, %r15
cmpq 0x38(%rsp), %r14
jne 0x4110
jmp 0x4204
movl %ebp, 0xc(%rsp)
movq %r12, 0x20(%rsp)
movq %r13, (%rsp)
xorl %ebp, %ebp
xorl %eax, %eax
movq 0x10(%rsp), %rdx
movq %rdx, %rcx
addq $0x600, %rcx            # imm = 0x600
movq 0x20(%rsp), %rsi
movq %rdx, (%rsi)
movq %rcx, 0x8(%rsi)
movq %rdx, 0x10(%rsi)
movq (%rsp), %rcx
movq %rcx, 0x18(%rsi)
movq %rbp, 0x20(%rsi)
movq %rax, 0x28(%rsi)
movl 0x1c(%rsp), %eax
movl %eax, 0x30(%rsi)
movl 0xc(%rsp), %eax
movl %eax, 0x34(%rsi)
movaps 0x40(%rsp), %xmm0
movups %xmm0, 0x38(%rsi)
movq 0x50(%rsp), %rax
movq %rax, 0x48(%rsi)
movaps 0x40(%rsp), %xmm0
movups %xmm0, 0x50(%rsi)
movq 0x50(%rsp), %rax
movq %rax, 0x60(%rsi)
movl $0x1, %ebp
jmp 0x4300
movq %r15, %rdi
callq 0x2040
xorl %ebp, %ebp
jmp 0x4300
xorl %ebx, %ebx
xorl %r12d, %r12d
xorl %r15d, %r15d
xorl %ebp, %ebp
jmp 0x4293
xorl %ebx, %ebx
xorl %r12d, %r12d
movq (%rsp), %r13
movq 0x10(%rsp), %rdi
callq 0x2040
testq %r13, %r13
je 0x42aa
movq %r13, %rdi
callq 0x2040
cmpq %r15, %rbp
je 0x42d7
movq -0x10(%r15), %rdi
movq -0x8(%r15), %r14
testq %rdi, %rdi
je 0x42c1
callq 0x2040
testq %r14, %r14
je 0x42ce
movq %r14, %rdi
callq 0x2040
addq $-0x10, %r15
cmpq %rbp, %r15
jne 0x42af
testq %rbp, %rbp
je 0x42e4
movq %rbp, %rdi
callq 0x2040
testq %r12, %r12
je 0x42f1
movq %r12, %rdi
callq 0x2040
xorl %ebp, %ebp
testq %rbx, %rbx
je 0x4300
movq %rbx, %rdi
callq 0x2040
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rsp), %rax
movq %r13, %rbp
movq %rax, %r13
movq 0x30(%rsp), %rbx
movq 0x28(%rsp), %r12
jmp 0x4293
leaq 0x1331b(%rip), %rdi     # 0x1764c
leaq 0x12d01(%rip), %rsi     # 0x17039
leaq 0x1359e(%rip), %rcx     # 0x178dd
movl $0x432, %edx            # imm = 0x432
callq 0x2100
leaq 0x132e6(%rip), %rdi     # 0x17636
leaq 0x12ce2(%rip), %rsi     # 0x17039
leaq 0x1357f(%rip), %rcx     # 0x178dd
movl $0x431, %edx            # imm = 0x431
callq 0x2100
leaq 0x1457f(%rip), %rdi     # 0x188ee
leaq 0x12cc3(%rip), %rsi     # 0x17039
leaq 0x13560(%rip), %rcx     # 0x178dd
movl $0x41d, %edx            # imm = 0x41D
callq 0x2100
leaq 0x1324b(%rip), %rdi     # 0x175d9
leaq 0x12ca4(%rip), %rsi     # 0x17039
leaq 0x13541(%rip), %rcx     # 0x178dd
movl $0x41f, %edx            # imm = 0x41F
callq 0x2100