// File: /workspace/github_c_makefile_star2_O0/mijallen[P]SimpleHTTPServer/lib/libyaml/src/parser.c
// Function: yaml_parser_process_directives
static int
yaml_parser_process_directives(yaml_parser_t *parser,
        yaml_version_directive_t **version_directive_ref,
        yaml_tag_directive_t **tag_directives_start_ref,
        yaml_tag_directive_t **tag_directives_end_ref)
{
    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 *default_tag_directive;
    yaml_version_directive_t *version_directive = NULL;
    struct {
        yaml_tag_directive_t *start;
        yaml_tag_directive_t *end;
        yaml_tag_directive_t *top;
    } tag_directives = { NULL, NULL, NULL };
    yaml_token_t *token;

    if (!STACK_INIT(parser, tag_directives, INITIAL_STACK_SIZE))
        goto error;

    token = PEEK_TOKEN(parser);
    if (!token) goto error;

    while (token->type == YAML_VERSION_DIRECTIVE_TOKEN ||
            token->type == YAML_TAG_DIRECTIVE_TOKEN)
    {
        if (token->type == YAML_VERSION_DIRECTIVE_TOKEN) {
            if (version_directive) {
                yaml_parser_set_parser_error(parser,
                        "found duplicate %YAML directive", token->start_mark);
                goto error;
            }
            if (token->data.version_directive.major != 1
                    || token->data.version_directive.minor != 1) {
                yaml_parser_set_parser_error(parser,
                        "found incompatible YAML document", token->start_mark);
                goto error;
            }
            version_directive = yaml_malloc(sizeof(yaml_version_directive_t));
            if (!version_directive) {
                parser->error = YAML_MEMORY_ERROR;
                goto error;
            }
            version_directive->major = token->data.version_directive.major;
            version_directive->minor = token->data.version_directive.minor;
        }

        else if (token->type == YAML_TAG_DIRECTIVE_TOKEN) {
            yaml_tag_directive_t value;
            value.handle = token->data.tag_directive.handle;
            value.prefix = token->data.tag_directive.prefix;

            if (!yaml_parser_append_tag_directive(parser, value, 0,
                        token->start_mark))
                goto error;
            if (!PUSH(parser, tag_directives, value))
                goto error;
        }

        SKIP_TOKEN(parser);
        token = PEEK_TOKEN(parser);
        if (!token) goto error;
    }
    
    for (default_tag_directive = default_tag_directives;
            default_tag_directive->handle; default_tag_directive++) {
        if (!yaml_parser_append_tag_directive(parser, *default_tag_directive, 1,
                    token->start_mark))
            goto error;
    }

    if (version_directive_ref) {
        *version_directive_ref = version_directive;
    }
    if (tag_directives_start_ref) {
        if (STACK_EMPTY(parser, tag_directives)) {
            *tag_directives_start_ref = *tag_directives_end_ref = NULL;
            STACK_DEL(parser, tag_directives);
        }
        else {
            *tag_directives_start_ref = tag_directives.start;
            *tag_directives_end_ref = tag_directives.top;
        }
    }
    else {
        STACK_DEL(parser, tag_directives);
    }

    return 1;

error:
    yaml_free(version_directive);
    while (!STACK_EMPTY(parser, tag_directives)) {
        yaml_tag_directive_t tag_directive = POP(parser, tag_directives);
        yaml_free(tag_directive.handle);
        yaml_free(tag_directive.prefix);
    }
    STACK_DEL(parser, tag_directives);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
leaq -0x60(%rbp), %rdi
leaq 0x141ea(%rip), %rsi     # 0x30db0
movl $0x30, %edx
callq 0x2180
movq $0x0, -0x70(%rbp)
leaq -0x88(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2120
movl $0x100, %edi            # imm = 0x100
callq 0x2080
movq %rax, -0x88(%rbp)
cmpq $0x0, %rax
je 0x1cc26
movq -0x88(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x88(%rbp), %rax
addq $0x100, %rax            # imm = 0x100
movq %rax, -0x80(%rbp)
movb $0x1, %al
testb $0x1, %al
jne 0x1cc3b
jmp 0x1cc36
movq -0x10(%rbp), %rax
movl $0x1, (%rax)
xorl %eax, %eax
testb $0x1, %al
jne 0x1cc3b
jmp 0x1d07a
movq -0x10(%rbp), %rax
cmpl $0x0, 0x130(%rax)
jne 0x1cc56
movq -0x10(%rbp), %rdi
callq 0x21c0
cmpl $0x0, %eax
je 0x1cc6a
movq -0x10(%rbp), %rax
movq 0x118(%rax), %rax
movq %rax, -0xb8(%rbp)
jmp 0x1cc75
xorl %eax, %eax
movq %rax, -0xb8(%rbp)
jmp 0x1cc75
movq -0xb8(%rbp), %rax
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x90(%rbp)
jne 0x1cc92
jmp 0x1d07a
jmp 0x1cc94
movq -0x90(%rbp), %rcx
movb $0x1, %al
cmpl $0x3, (%rcx)
movb %al, -0xb9(%rbp)
je 0x1ccbb
movq -0x90(%rbp), %rax
cmpl $0x4, (%rax)
sete %al
movb %al, -0xb9(%rbp)
movb -0xb9(%rbp), %al
testb $0x1, %al
jne 0x1ccca
jmp 0x1cf5e
movq -0x90(%rbp), %rax
cmpl $0x3, (%rax)
jne 0x1cdb7
cmpq $0x0, -0x70(%rbp)
je 0x1cd1a
movq -0x10(%rbp), %rdi
movq -0x90(%rbp), %rax
addq $0x20, %rax
leaq 0xfbcf(%rip), %rsi      # 0x2c8c6
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x1cb50
jmp 0x1d07a
movq -0x90(%rbp), %rax
cmpl $0x1, 0x8(%rax)
jne 0x1cd34
movq -0x90(%rbp), %rax
cmpl $0x1, 0xc(%rax)
je 0x1cd6d
movq -0x10(%rbp), %rdi
movq -0x90(%rbp), %rax
addq $0x20, %rax
leaq 0xfb9c(%rip), %rsi      # 0x2c8e6
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x1cb50
jmp 0x1d07a
movl $0x8, %edi
callq 0x2080
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x70(%rbp)
jne 0x1cd91
movq -0x10(%rbp), %rax
movl $0x1, (%rax)
jmp 0x1d07a
movq -0x90(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x70(%rbp), %rax
movl %ecx, (%rax)
movq -0x90(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0x70(%rbp), %rax
movl %ecx, 0x4(%rax)
jmp 0x1cea8
movq -0x90(%rbp), %rax
cmpl $0x4, (%rax)
jne 0x1cea6
movq -0x90(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xa0(%rbp)
movq -0x90(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x10(%rbp), %rdi
movq -0x90(%rbp), %rax
addq $0x20, %rax
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
xorl %ecx, %ecx
movq (%rax), %r8
movq %r8, (%rsp)
movq 0x8(%rax), %r8
movq %r8, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x1d120
cmpl $0x0, %eax
jne 0x1ce32
jmp 0x1d07a
movq -0x78(%rbp), %rax
cmpq -0x80(%rbp), %rax
jne 0x1ce63
leaq -0x88(%rbp), %rdi
leaq -0x88(%rbp), %rsi
addq $0x10, %rsi
leaq -0x88(%rbp), %rdx
addq $0x8, %rdx
callq 0x20e0
cmpl $0x0, %eax
je 0x1ce8f
movq -0x78(%rbp), %rax
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, -0x78(%rbp)
movq -0xa0(%rbp), %rcx
movq %rcx, (%rax)
movq -0x98(%rbp), %rcx
movq %rcx, 0x8(%rax)
movb $0x1, %al
testb $0x1, %al
jne 0x1cea4
jmp 0x1ce9f
movq -0x10(%rbp), %rax
movl $0x1, (%rax)
xorl %eax, %eax
testb $0x1, %al
jne 0x1cea4
jmp 0x1d07a
jmp 0x1cea6
jmp 0x1cea8
movq -0x10(%rbp), %rax
movl $0x0, 0x130(%rax)
movq -0x10(%rbp), %rax
movq 0x128(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x128(%rax)
movq -0x10(%rbp), %rax
movq 0x118(%rax), %rax
cmpl $0x2, (%rax)
sete %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xfc(%rax)
movq -0x10(%rbp), %rax
movq 0x118(%rax), %rcx
addq $0x50, %rcx
movq %rcx, 0x118(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x130(%rax)
jne 0x1cf1d
movq -0x10(%rbp), %rdi
callq 0x21c0
cmpl $0x0, %eax
je 0x1cf31
movq -0x10(%rbp), %rax
movq 0x118(%rax), %rax
movq %rax, -0xc8(%rbp)
jmp 0x1cf3c
xorl %eax, %eax
movq %rax, -0xc8(%rbp)
jmp 0x1cf3c
movq -0xc8(%rbp), %rax
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x90(%rbp)
jne 0x1cf59
jmp 0x1d07a
jmp 0x1cc94
leaq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpq $0x0, (%rax)
je 0x1cfc7
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rcx
movq -0x90(%rbp), %rax
addq $0x20, %rax
movq (%rcx), %rsi
movq 0x8(%rcx), %rdx
movl $0x1, %ecx
movq (%rax), %r8
movq %r8, (%rsp)
movq 0x8(%rax), %r8
movq %r8, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x1d120
cmpl $0x0, %eax
jne 0x1cfb7
jmp 0x1d07a
jmp 0x1cfb9
movq -0x68(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x68(%rbp)
jmp 0x1cf66
cmpq $0x0, -0x18(%rbp)
je 0x1cfd9
movq -0x70(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x20(%rbp)
je 0x1d047
movq -0x88(%rbp), %rax
cmpq -0x78(%rbp), %rax
jne 0x1d02c
movq -0x28(%rbp), %rax
movq $0x0, (%rax)
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq -0x88(%rbp), %rdi
callq 0x2140
movq $0x0, -0x80(%rbp)
movq $0x0, -0x78(%rbp)
movq $0x0, -0x88(%rbp)
jmp 0x1d045
movq -0x88(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x78(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
jmp 0x1d06e
movq -0x88(%rbp), %rdi
callq 0x2140
movq $0x0, -0x80(%rbp)
movq $0x0, -0x78(%rbp)
movq $0x0, -0x88(%rbp)
movl $0x1, -0x4(%rbp)
jmp 0x1d106
movq -0x70(%rbp), %rdi
callq 0x2140
movq -0x88(%rbp), %rax
cmpq -0x78(%rbp), %rax
sete %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x1d099
jmp 0x1d0d8
movq -0x78(%rbp), %rax
movq %rax, %rcx
addq $-0x10, %rcx
movq %rcx, -0x78(%rbp)
movq -0x10(%rax), %rcx
movq %rcx, -0xb0(%rbp)
movq -0x8(%rax), %rax
movq %rax, -0xa8(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x2140
movq -0xa8(%rbp), %rdi
callq 0x2140
jmp 0x1d083
movq -0x88(%rbp), %rdi
callq 0x2140
movq $0x0, -0x80(%rbp)
movq $0x0, -0x78(%rbp)
movq $0x0, -0x88(%rbp)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)