// File: /workspace/github_c_makefile_star2_O1/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 0x1301f
cmpl $0x3, %eax
jne 0x1307f
movl %edx, %r15d
movq %rsi, %r14
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x12f2f
movabsq $0x100000001, %rcx      # imm = 0x100000001
cmpq %rcx, (%rax)
jne 0x13091
movq 0x10(%r14), %r13
cmpq 0x18(%r14), %r13
je 0x130a3
movq (%r13), %r12
movq 0x8(%r13), %rbp
movq %r12, %rdi
callq 0x20d0
testq %rax, %rax
je 0x130f5
cmpb $0x21, (%r12)
jne 0x13104
cmpb $0x21, -0x1(%r12,%rax)
jne 0x13113
movb (%rbp), %cl
cmpq $0x3, %rax
jl 0x12ff2
addq %r12, %rax
decq %rax
incq %r12
movzbl (%r12), %edx
leal -0x30(%rdx), %esi
cmpb $0xa, %sil
jb 0x12fab
movl %edx, %esi
andb $-0x21, %sil
addb $-0x41, %sil
cmpb $0x1a, %sil
jb 0x12fab
cmpl $0x2d, %edx
je 0x12fab
cmpl $0x5f, %edx
jne 0x130e6
movl $0x1, %esi
testb %dl, %dl
jns 0x12fea
movl %edx, %edi
andl $-0x20, %edi
movl $0x2, %esi
cmpl $0xc0, %edi
je 0x12fea
movl %edx, %edi
andl $-0x10, %edi
movl $0x3, %esi
cmpl $0xe0, %edi
je 0x12fea
andl $-0x8, %edx
xorl %esi, %esi
cmpl $0xf0, %edx
sete %sil
shll $0x2, %esi
addq %rsi, %r12
cmpq %rax, %r12
jb 0x12f7f
testb %cl, %cl
je 0x13122
movq (%r13), %rsi
movq 0x8(%r13), %rdx
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x13b6d
testl %eax, %eax
je 0x13135
addq $0x10, %r13
jmp 0x12f33
cmpl $0x0, 0x128(%rbx)
je 0x1305b
leaq 0x6cf9(%rip), %rsi      # 0x19d28
xorl %ebp, %ebp
movq %rbx, %rdi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x13c6a
testl %eax, %eax
je 0x13135
movq %rbx, %rdi
callq 0x13e0d
testl %eax, %eax
je 0x13135
movq %rbx, %rdi
callq 0x2190
testl %eax, %eax
je 0x13133
movl $0x11, 0xa8(%rbx)
movl $0x1, %ebp
jmp 0x13135
movl $0x7, (%rbx)
leaq 0x6cb3(%rip), %rax      # 0x19d3f
jmp 0x1312f
movl $0x7, (%rbx)
leaq 0x6cc7(%rip), %rax      # 0x19d65
jmp 0x1312f
leaq 0x677b(%rip), %rsi      # 0x19825
leaq 0x9d3f(%rip), %r12      # 0x1cdf0
xorl %ebp, %ebp
movq -0x8(%r12), %rdx
movq %rbx, %rdi
movl $0x1, %ecx
callq 0x13b6d
testl %eax, %eax
je 0x13135
movq (%r12), %rsi
addq $0x10, %r12
testq %rsi, %rsi
jne 0x130b3
testl %r15d, %r15d
je 0x130e1
cmpl $0x0, 0x7c(%rbx)
je 0x13146
xorl %r15d, %r15d
jmp 0x1314a
movl $0x7, (%rbx)
leaq 0x6ce8(%rip), %rax      # 0x19ddb
jmp 0x1312f
movl $0x7, (%rbx)
leaq 0x6c80(%rip), %rax      # 0x19d82
jmp 0x1312f
movl $0x7, (%rbx)
leaq 0x6c8e(%rip), %rax      # 0x19d9f
jmp 0x1312f
movl $0x7, (%rbx)
leaq 0x6c9e(%rip), %rax      # 0x19dbe
jmp 0x1312f
movl $0x7, (%rbx)
leaq 0x6ce3(%rip), %rax      # 0x19e12
movq %rax, 0x8(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x20(%r14), %r15d
cmpq $0x0, 0x8(%r14)
jne 0x1315b
movq 0x10(%r14), %rax
cmpq 0x18(%r14), %rax
je 0x1318f
cmpl $0x0, 0x128(%rbx)
je 0x1318f
leaq 0x6bbd(%rip), %rsi      # 0x19d28
xorl %ebp, %ebp
movq %rbx, %rdi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x13c6a
testl %eax, %eax
je 0x13135
movq %rbx, %rdi
callq 0x13e0d
testl %eax, %eax
je 0x13135
cmpq $0x0, 0x8(%r14)
je 0x131f0
leaq 0x6b8f(%rip), %rsi      # 0x19d2c
xorl %ebp, %ebp
movq %rbx, %rdi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x13c6a
testl %eax, %eax
je 0x13135
leaq 0x6b76(%rip), %rsi      # 0x19d32
xorl %ebp, %ebp
movq %rbx, %rdi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x13c6a
testl %eax, %eax
je 0x13135
movq %rbx, %rdi
callq 0x13e0d
xorl %r15d, %r15d
movl $0x0, %ebp
testl %eax, %eax
je 0x13135
movq 0x10(%r14), %r13
cmpq 0x18(%r14), %r13
je 0x13294
cmpq 0x18(%r14), %r13
je 0x13291
leaq 0x6b27(%rip), %r15      # 0x19d36
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x13c6a
testl %eax, %eax
je 0x13135
movq (%r13), %r12
movq %r12, %rdi
callq 0x20d0
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x13f0a
testl %eax, %eax
je 0x13135
movq 0x8(%r13), %r12
movq %r12, %rdi
callq 0x20d0
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
movl $0x1, %ecx
callq 0x1406a
testl %eax, %eax
je 0x13135
movq %rbx, %rdi
callq 0x13e0d
testl %eax, %eax
je 0x13135
addq $0x10, %r13
cmpq 0x18(%r14), %r13
jne 0x13211
xorl %r15d, %r15d
testl %r15d, %r15d
je 0x132a8
movl $0x3, 0xa8(%rbx)
jmp 0x13075
movq %rbx, %rdi
callq 0x13e0d
movl $0x0, %ebp
testl %eax, %eax
je 0x13135
leaq 0x6a77(%rip), %rsi      # 0x19d3b
xorl %ebp, %ebp
movq %rbx, %rdi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x13c6a
testl %eax, %eax
je 0x13135
cmpl $0x0, 0x7c(%rbx)
je 0x13299
movq %rbx, %rdi
callq 0x13e0d
testl %eax, %eax
jne 0x13299
jmp 0x13135