// File: /workspace/github_c_makefile_star2_O3/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 0x120bf
cmpl $0x3, %eax
jne 0x1211f
movq %rsi, %r14
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x1200b
movabsq $0x100000001, %rcx      # imm = 0x100000001
cmpq %rcx, (%rax)
jne 0x12131
movl %edx, 0x4(%rsp)
movq 0x10(%r14), %r15
cmpq 0x18(%r14), %r15
je 0x12140
movq (%r15), %r12
movq 0x8(%r15), %r13
movb (%r13), %bpl
movq %r12, %rdi
callq 0x20d0
testq %rax, %rax
je 0x1218c
cmpb $0x21, (%r12)
jne 0x12195
cmpb $0x21, -0x1(%r12,%rax)
jne 0x1219e
cmpq $0x3, %rax
jl 0x12093
addq %r12, %rax
decq %rax
leaq 0x1(%r12), %rcx
movzbl (%rcx), %edx
leal -0x30(%rdx), %esi
cmpb $0xa, %sil
jb 0x1208b
movl %edx, %esi
andb $-0x21, %sil
addb $-0x41, %sil
cmpb $0x1a, %sil
jb 0x1208b
cmpl $0x5f, %edx
je 0x1208b
cmpl $0x2d, %edx
jne 0x12183
incq %rcx
cmpq %rax, %rcx
jb 0x12061
testb %bpl, %bpl
je 0x121a7
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x12c2c
testl %eax, %eax
je 0x121ba
addq $0x10, %r15
jmp 0x12013
cmpl $0x0, 0x128(%rbx)
je 0x120fb
leaq 0x6cc9(%rip), %rsi      # 0x18d98
xorl %ebp, %ebp
movq %rbx, %rdi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x12d29
testl %eax, %eax
je 0x121ba
movq %rbx, %rdi
callq 0x12ecc
testl %eax, %eax
je 0x121ba
movq %rbx, %rdi
callq 0x2190
testl %eax, %eax
je 0x121b8
movl $0x11, 0xa8(%rbx)
movl $0x1, %ebp
jmp 0x121ba
movl $0x7, (%rbx)
leaq 0x6c83(%rip), %rax      # 0x18daf
jmp 0x121b4
movl $0x7, (%rbx)
leaq 0x6c97(%rip), %rax      # 0x18dd5
jmp 0x121b4
leaq 0x675a(%rip), %rsi      # 0x188a1
leaq 0xaca2(%rip), %r15      # 0x1cdf0
xorl %ebp, %ebp
movq -0x8(%r15), %rdx
movq %rbx, %rdi
movl $0x1, %ecx
callq 0x12c2c
testl %eax, %eax
je 0x121ba
movq (%r15), %rsi
addq $0x10, %r15
testq %rsi, %rsi
jne 0x12150
cmpl $0x0, 0x4(%rsp)
je 0x1217e
cmpl $0x0, 0x7c(%rbx)
je 0x121cb
xorl %r15d, %r15d
jmp 0x121cf
leaq 0x6cc1(%rip), %rax      # 0x18e4b
jmp 0x121ae
leaq 0x6c5f(%rip), %rax      # 0x18df2
jmp 0x121ae
leaq 0x6c73(%rip), %rax      # 0x18e0f
jmp 0x121ae
leaq 0x6c89(%rip), %rax      # 0x18e2e
jmp 0x121ae
leaq 0x6cd4(%rip), %rax      # 0x18e82
movl $0x7, (%rbx)
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
movq 0x8(%r14), %rax
testq %rax, %rax
jne 0x121e6
movq 0x10(%r14), %rcx
cmpq 0x18(%r14), %rcx
je 0x12288
cmpl $0x0, 0x128(%rbx)
je 0x1221e
leaq 0x6ba2(%rip), %rsi      # 0x18d98
xorl %ebp, %ebp
movq %rbx, %rdi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x12d29
testl %eax, %eax
je 0x121ba
movq %rbx, %rdi
callq 0x12ecc
testl %eax, %eax
je 0x121ba
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x12288
leaq 0x6b72(%rip), %rsi      # 0x18d9c
xorl %ebp, %ebp
movq %rbx, %rdi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x12d29
testl %eax, %eax
je 0x121ba
leaq 0x6b55(%rip), %rsi      # 0x18da2
xorl %ebp, %ebp
movq %rbx, %rdi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x12d29
testl %eax, %eax
je 0x121ba
movq %rbx, %rdi
callq 0x12ecc
testl %eax, %eax
je 0x121ba
movq 0x10(%r14), %r13
cmpq 0x18(%r14), %r13
jne 0x12296
jmp 0x12335
movq 0x10(%r14), %r13
cmpq 0x18(%r14), %r13
je 0x12321
leaq 0x6b09(%rip), %r15      # 0x18da6
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x12d29
testl %eax, %eax
je 0x121ba
movq (%r13), %r12
movq %r12, %rdi
callq 0x20d0
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x12fc7
testl %eax, %eax
je 0x121ba
movq 0x8(%r13), %r12
movq %r12, %rdi
callq 0x20d0
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
movl $0x1, %ecx
callq 0x13127
testl %eax, %eax
je 0x121ba
movq %rbx, %rdi
callq 0x12ecc
testl %eax, %eax
je 0x121ba
addq $0x10, %r13
cmpq 0x18(%r14), %r13
jne 0x1229f
jmp 0x12335
testl %r15d, %r15d
je 0x12335
movl $0x3, 0xa8(%rbx)
jmp 0x12115
movq %rbx, %rdi
callq 0x12ecc
movl $0x0, %ebp
testl %eax, %eax
je 0x121ba
leaq 0x6a5a(%rip), %rsi      # 0x18dab
xorl %ebp, %ebp
movq %rbx, %rdi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x12d29
testl %eax, %eax
je 0x121ba
cmpl $0x0, 0x7c(%rbx)
je 0x12326
movq %rbx, %rdi
callq 0x12ecc
testl %eax, %eax
jne 0x12326
jmp 0x121ba