// File: /workspace/github_c_makefile_star2_O2/mijallen[P]SimpleHTTPServer/lib/libyaml/src/emitter.c
// Function: yaml_emitter_emit_document_start
static int
yaml_emitter_emit_document_start(yaml_emitter_t *emitter,
        yaml_event_t *event, int first)
{
    if (event->type == YAML_DOCUMENT_START_EVENT)
    {
        yaml_tag_directive_t default_tag_directives[] = {
            {(yaml_char_t *)"!", (yaml_char_t *)"!"},
            {(yaml_char_t *)"!!", (yaml_char_t *)"tag:yaml.org,2002:"},
            {NULL, NULL}
        };
        yaml_tag_directive_t *tag_directive;
        int implicit;

        if (event->data.document_start.version_directive) {
            if (!yaml_emitter_analyze_version_directive(emitter,
                        *event->data.document_start.version_directive))
                return 0;
        }

        for (tag_directive = event->data.document_start.tag_directives.start;
                tag_directive != event->data.document_start.tag_directives.end;
                tag_directive ++) {
            if (!yaml_emitter_analyze_tag_directive(emitter, *tag_directive))
                return 0;
            if (!yaml_emitter_append_tag_directive(emitter, *tag_directive, 0))
                return 0;
        }

        for (tag_directive = default_tag_directives;
                tag_directive->handle; tag_directive ++) {
            if (!yaml_emitter_append_tag_directive(emitter, *tag_directive, 1))
                return 0;
        }

        implicit = event->data.document_start.implicit;
        if (!first || emitter->canonical) {
            implicit = 0;
        }

        if ((event->data.document_start.version_directive ||
                    (event->data.document_start.tag_directives.start
                     != event->data.document_start.tag_directives.end)) &&
                emitter->open_ended)
        {
            if (!yaml_emitter_write_indicator(emitter, "...", 1, 0, 0))
                return 0;
            if (!yaml_emitter_write_indent(emitter))
                return 0;
        }

        if (event->data.document_start.version_directive) {
            implicit = 0;
            if (!yaml_emitter_write_indicator(emitter, "%YAML", 1, 0, 0))
                return 0;
            if (!yaml_emitter_write_indicator(emitter, "1.1", 1, 0, 0))
                return 0;
            if (!yaml_emitter_write_indent(emitter))
                return 0;
        }
        
        if (event->data.document_start.tag_directives.start
                != event->data.document_start.tag_directives.end) {
            implicit = 0;
            for (tag_directive = event->data.document_start.tag_directives.start;
                    tag_directive != event->data.document_start.tag_directives.end;
                    tag_directive ++) {
                if (!yaml_emitter_write_indicator(emitter, "%TAG", 1, 0, 0))
                    return 0;
                if (!yaml_emitter_write_tag_handle(emitter, tag_directive->handle,
                            strlen((char *)tag_directive->handle)))
                    return 0;
                if (!yaml_emitter_write_tag_content(emitter, tag_directive->prefix,
                            strlen((char *)tag_directive->prefix), 1))
                    return 0;
                if (!yaml_emitter_write_indent(emitter))
                    return 0;
            }
        }

        if (yaml_emitter_check_empty_document(emitter)) {
            implicit = 0;
        }

        if (!implicit) {
            if (!yaml_emitter_write_indent(emitter))
                return 0;
            if (!yaml_emitter_write_indicator(emitter, "---", 1, 0, 0))
                return 0;
            if (emitter->canonical) {
                if (!yaml_emitter_write_indent(emitter))
                    return 0;
            }
        }

        emitter->state = YAML_EMIT_DOCUMENT_CONTENT_STATE;

        return 1;
    }

    else if (event->type == YAML_STREAM_END_EVENT)
    {
        if (emitter->open_ended)
        {
            if (!yaml_emitter_write_indicator(emitter, "...", 1, 0, 0))
                return 0;
            if (!yaml_emitter_write_indent(emitter))
                return 0;
        }

        if (!yaml_emitter_flush(emitter))
            return 0;

        emitter->state = YAML_EMIT_END_STATE;

        return 1;
    }

    return yaml_emitter_set_emitter_error(emitter,
            "expected DOCUMENT-START or STREAM-END");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl (%rsi), %eax
cmpl $0x2, %eax
je 0x114b4
cmpl $0x3, %eax
jne 0x11503
movq %rsi, %r14
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x11406
movabsq $0x100000001, %rcx      # imm = 0x100000001
cmpq %rcx, (%rax)
jne 0x11521
movl %edx, 0x4(%rsp)
movq 0x10(%r14), %r12
xorl %r15d, %r15d
cmpq 0x18(%r14), %r12
je 0x11547
movq (%r12), %r13
movq 0x8(%r12), %rbp
movq %r13, %rdi
callq 0x20d0
testq %rax, %rax
je 0x11576
cmpb $0x21, (%r13)
jne 0x1157f
addq %r13, %rax
cmpb $0x21, -0x1(%rax)
jne 0x11588
movb (%rbp), %cl
decq %rax
leaq 0x1(%r13), %rdx
cmpq %rax, %rdx
jae 0x1148b
movzbl (%rdx), %esi
leal -0x30(%rsi), %edi
cmpb $0xa, %dil
jb 0x11486
movl %esi, %edi
andb $-0x21, %dil
addb $-0x41, %dil
cmpb $0x1a, %dil
jb 0x11486
cmpl $0x5f, %esi
je 0x11486
cmpl $0x2d, %esi
jne 0x11512
incq %rdx
jmp 0x11457
testb %cl, %cl
je 0x11591
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
callq 0x11fda
addq $0x10, %r12
testl %eax, %eax
jne 0x11411
jmp 0x11535
cmpl $0x0, 0x128(%rbx)
je 0x114e7
leaq 0x68c4(%rip), %rsi      # 0x17d88
pushq $0x1
popq %rdx
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x120e9
testl %eax, %eax
je 0x11535
movq %rbx, %rdi
callq 0x12283
testl %eax, %eax
je 0x11535
movq %rbx, %rdi
callq 0x2190
testl %eax, %eax
je 0x11532
movl $0x11, 0xa8(%rbx)
pushq $0x1
popq %r15
jmp 0x11535
movl $0x7, (%rbx)
leaq 0x688f(%rip), %rax      # 0x17d9f
jmp 0x1152e
leaq 0x6922(%rip), %rax      # 0x17e3b
movl $0x7, (%rbx)
jmp 0x1152e
movl $0x7, (%rbx)
leaq 0x6897(%rip), %rax      # 0x17dc5
movq %rax, 0x8(%rbx)
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb892(%rip), %r12      # 0x1cde0
pushq $0x1
popq %rbp
xorl %r15d, %r15d
movq (%r12), %rsi
testq %rsi, %rsi
je 0x1159d
movq 0x8(%r12), %rdx
movq %rbx, %rdi
movl %ebp, %ecx
callq 0x11fda
addq $0x10, %r12
testl %eax, %eax
jne 0x11554
jmp 0x11535
leaq 0x6865(%rip), %rax      # 0x17de2
jmp 0x11519
leaq 0x6879(%rip), %rax      # 0x17dff
jmp 0x11519
leaq 0x688f(%rip), %rax      # 0x17e1e
jmp 0x11519
leaq 0x68da(%rip), %rax      # 0x17e72
jmp 0x11519
cmpl $0x0, 0x4(%rsp)
je 0x115aa
cmpl $0x0, 0x7c(%rbx)
je 0x115af
xorl %r12d, %r12d
jmp 0x115b3
movl 0x20(%r14), %r12d
movq 0x8(%r14), %rax
testq %rax, %rax
jne 0x115ca
movq 0x10(%r14), %rcx
cmpq 0x18(%r14), %rcx
je 0x1166b
cmpl $0x0, 0x128(%rbx)
je 0x11609
leaq 0x67ae(%rip), %rsi      # 0x17d88
pushq $0x1
popq %rdx
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x120e9
testl %eax, %eax
je 0x11535
movq %rbx, %rdi
callq 0x12283
testl %eax, %eax
je 0x11535
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x1166b
leaq 0x6777(%rip), %rsi      # 0x17d8c
pushq $0x1
popq %rdx
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x120e9
testl %eax, %eax
je 0x11535
leaq 0x675b(%rip), %rsi      # 0x17d92
pushq $0x1
popq %rdx
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x120e9
testl %eax, %eax
je 0x11535
movq %rbx, %rdi
callq 0x12283
xorl %r12d, %r12d
movl $0x0, %r15d
testl %eax, %eax
je 0x11535
movq 0x10(%r14), %r13
cmpq 0x18(%r14), %r13
je 0x11711
pushq $0x1
popq %r12
xorl %r15d, %r15d
cmpq 0x18(%r14), %r13
je 0x11728
movq %rbx, %rdi
leaq 0x6702(%rip), %rsi      # 0x17d96
movl %r12d, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x120e9
testl %eax, %eax
je 0x11535
movl %r12d, %ebp
movq (%r13), %r12
movq %r12, %rdi
callq 0x20d0
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x1237b
testl %eax, %eax
je 0x11535
movq 0x8(%r13), %r12
movq %r12, %rdi
callq 0x20d0
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
movl %ebp, %r12d
movl %ebp, %ecx
callq 0x124d2
testl %eax, %eax
je 0x11535
movq %rbx, %rdi
callq 0x12283
addq $0x10, %r13
testl %eax, %eax
pushq $0x1
popq %rbp
jne 0x11680
jmp 0x11535
testl %r12d, %r12d
je 0x11728
movl $0x3, 0xa8(%rbx)
movl %ebp, %r15d
jmp 0x11535
movq %rbx, %rdi
callq 0x12283
testl %eax, %eax
je 0x11532
leaq 0x665c(%rip), %rsi      # 0x17d9b
pushq $0x1
popq %rdx
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x120e9
testl %eax, %eax
je 0x11535
cmpl $0x0, 0x7c(%rbx)
je 0x11716
movq %rbx, %rdi
callq 0x12283
testl %eax, %eax
jne 0x11716
jmp 0x11535