// File: /workspace/github_c_makefile_star2_O3/mijallen[P]SimpleHTTPServer/lib/libyaml/tests/example-reformatter.c
// Function: main
int
main(int argc, char *argv[])
{
    int help = 0;
    int canonical = 0;
    int unicode = 0;
    int k;
    int done = 0;

    yaml_parser_t parser;
    yaml_emitter_t emitter;
    yaml_event_t event;

    /* Clear the objects. */

    memset(&parser, 0, sizeof(parser));
    memset(&emitter, 0, sizeof(emitter));
    memset(&event, 0, sizeof(event));

    /* Analyze command line options. */

    for (k = 1; k < argc; k ++)
    {
        if (strcmp(argv[k], "-h") == 0
                || strcmp(argv[k], "--help") == 0) {
            help = 1;
        }

        else if (strcmp(argv[k], "-c") == 0
                || strcmp(argv[k], "--canonical") == 0) {
            canonical = 1;
        }

        else if (strcmp(argv[k], "-u") == 0
                || strcmp(argv[k], "--unicode") == 0) {
            unicode = 1;
        }

        else {
            fprintf(stderr, "Unrecognized option: %s\n"
                    "Try `%s --help` for more information.\n",
                    argv[k], argv[0]);
            return 1;
        }
    }

    /* Display the help string. */

    if (help)
    {
        printf("%s [--canonical] [--unicode] <input >output\n"
                "or\n%s -h | --help\nReformat a YAML stream\n\nOptions:\n"
                "-h, --help\t\tdisplay this help and exit\n"
                "-c, --canonical\t\toutput in the canonical YAML format\n"
                "-u, --unicode\t\toutput unescaped non-ASCII characters\n",
                argv[0], argv[0]);
        return 0;
    }

    /* Initialize the parser and emitter objects. */

    if (!yaml_parser_initialize(&parser))
        goto parser_error;

    if (!yaml_emitter_initialize(&emitter))
        goto emitter_error;

    /* Set the parser parameters. */

    yaml_parser_set_input_file(&parser, stdin);

    /* Set the emitter parameters. */

    yaml_emitter_set_output_file(&emitter, stdout);

    yaml_emitter_set_canonical(&emitter, canonical);
    yaml_emitter_set_unicode(&emitter, unicode);

    /* The main loop. */

    while (!done)
    {
        /* Get the next event. */

        if (!yaml_parser_parse(&parser, &event))
            goto parser_error;

        /* Check if this is the stream end. */

        if (event.type == YAML_STREAM_END_EVENT) {
            done = 1;
        }

        /* Emit the event. */

        if (!yaml_emitter_emit(&emitter, &event))
            goto emitter_error;
    }

    yaml_parser_delete(&parser);
    yaml_emitter_delete(&emitter);

    return 0;

parser_error:

    /* Display a parser error message. */

    switch (parser.error)
    {
        case YAML_MEMORY_ERROR:
            fprintf(stderr, "Memory error: Not enough memory for parsing\n");
            break;

        case YAML_READER_ERROR:
            if (parser.problem_value != -1) {
                fprintf(stderr, "Reader error: %s: #%X at %d\n", parser.problem,
                        parser.problem_value, parser.problem_offset);
            }
            else {
                fprintf(stderr, "Reader error: %s at %d\n", parser.problem,
                        parser.problem_offset);
            }
            break;

        case YAML_SCANNER_ERROR:
            if (parser.context) {
                fprintf(stderr, "Scanner error: %s at line %d, column %d\n"
                        "%s at line %d, column %d\n", parser.context,
                        parser.context_mark.line+1, parser.context_mark.column+1,
                        parser.problem, parser.problem_mark.line+1,
                        parser.problem_mark.column+1);
            }
            else {
                fprintf(stderr, "Scanner error: %s at line %d, column %d\n",
                        parser.problem, parser.problem_mark.line+1,
                        parser.problem_mark.column+1);
            }
            break;

        case YAML_PARSER_ERROR:
            if (parser.context) {
                fprintf(stderr, "Parser error: %s at line %d, column %d\n"
                        "%s at line %d, column %d\n", parser.context,
                        parser.context_mark.line+1, parser.context_mark.column+1,
                        parser.problem, parser.problem_mark.line+1,
                        parser.problem_mark.column+1);
            }
            else {
                fprintf(stderr, "Parser error: %s at line %d, column %d\n",
                        parser.problem, parser.problem_mark.line+1,
                        parser.problem_mark.column+1);
            }
            break;

        default:
            /* Couldn't happen. */
            fprintf(stderr, "Internal error\n");
            break;
    }

    yaml_parser_delete(&parser);
    yaml_emitter_delete(&emitter);

    return 1;

emitter_error:

    /* Display an emitter error message. */

    switch (emitter.error)
    {
        case YAML_MEMORY_ERROR:
            fprintf(stderr, "Memory error: Not enough memory for emitting\n");
            break;

        case YAML_WRITER_ERROR:
            fprintf(stderr, "Writer error: %s\n", emitter.problem);
            break;

        case YAML_EMITTER_ERROR:
            fprintf(stderr, "Emitter error: %s\n", emitter.problem);
            break;

        default:
            /* Couldn't happen. */
            fprintf(stderr, "Internal error\n");
            break;
    }

    yaml_parser_delete(&parser);
    yaml_emitter_delete(&emitter);

    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rsi, %r14
movl %edi, %r15d
leaq 0x78(%rsp), %rdi
xorl %ebx, %ebx
movl $0x1e0, %edx            # imm = 0x1E0
xorl %esi, %esi
callq 0x10a0
leaq 0x258(%rsp), %rdi
movl $0x1b0, %edx            # imm = 0x1B0
xorl %esi, %esi
callq 0x10a0
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
movl $0x0, %ebp
cmpl $0x2, %r15d
jl 0x1508
movl %r15d, %r12d
xorl %ebx, %ebx
movl $0x1, %ebp
movl $0x0, 0x8(%rsp)
movl $0x0, 0xc(%rsp)
movq (%r14,%rbp,8), %r13
movb (%r13), %r15b
cmpb $0x2d, %r15b
jne 0x1453
cmpb $0x68, 0x1(%r13)
jne 0x1419
cmpb $0x0, 0x2(%r13)
je 0x1496
movq %r13, %rdi
leaq 0xbf1(%rip), %rsi       # 0x2014
callq 0x10b0
testl %eax, %eax
je 0x1496
cmpb $0x63, 0x1(%r13)
jne 0x14a0
cmpb $0x0, 0x2(%r13)
je 0x14ce
movq %r13, %rdi
leaq 0xbd3(%rip), %rsi       # 0x201b
callq 0x10b0
testl %eax, %eax
jne 0x14b9
jmp 0x14ce
movq %r13, %rdi
leaq 0xbb7(%rip), %rsi       # 0x2014
callq 0x10b0
testl %eax, %eax
je 0x1496
movq %r13, %rdi
leaq 0xbab(%rip), %rsi       # 0x201b
callq 0x10b0
testl %eax, %eax
je 0x14ce
movq %r13, %rdi
leaq 0xba4(%rip), %rsi       # 0x2027
callq 0x10b0
movl $0x1, %ebx
testl %eax, %eax
je 0x14d6
jmp 0x16d8
movl $0x1, 0xc(%rsp)
jmp 0x14d6
movq %r13, %rdi
leaq 0xb71(%rip), %rsi       # 0x201b
callq 0x10b0
testl %eax, %eax
je 0x14ce
cmpb $0x2d, %r15b
jne 0x1479
cmpb $0x75, 0x1(%r13)
jne 0x1479
cmpb $0x0, 0x2(%r13)
jne 0x1479
movl $0x1, %ebx
jmp 0x14d6
movl $0x1, 0x8(%rsp)
incq %rbp
cmpq %rbp, %r12
jne 0x13fd
cmpl $0x0, 0xc(%rsp)
movl 0x8(%rsp), %ebp
je 0x1508
movq (%r14), %rdx
leaq 0xb79(%rip), %rdi       # 0x2070
xorl %ebx, %ebx
movq %rdx, %rsi
xorl %eax, %eax
callq 0x1080
jmp 0x1730
leaq 0x78(%rsp), %rdi
callq 0x10e0
testl %eax, %eax
je 0x15ec
leaq 0x258(%rsp), %rdi
callq 0x1060
testl %eax, %eax
je 0x15a4
movq 0x2aa6(%rip), %rax      # 0x3fd8
movq (%rax), %rsi
leaq 0x78(%rsp), %r14
movq %r14, %rdi
callq 0x1030
movq 0x2a87(%rip), %rax      # 0x3fd0
movq (%rax), %rsi
leaq 0x258(%rsp), %r15
movq %r15, %rdi
callq 0x1050
movq %r15, %rdi
movl %ebp, %esi
callq 0x10f0
movq %r15, %rdi
movl %ebx, %esi
callq 0x1110
xorl %ebp, %ebp
leaq 0x10(%rsp), %rbx
testl %ebp, %ebp
jne 0x15ce
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1040
testl %eax, %eax
je 0x15ec
xorl %ebp, %ebp
cmpl $0x2, 0x10(%rsp)
sete %bpl
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1090
testl %eax, %eax
jne 0x1577
movl 0x258(%rsp), %eax
movq 0x2a46(%rip), %rcx      # 0x3ff8
movq (%rcx), %rdi
cmpl $0x7, %eax
je 0x1626
cmpl $0x6, %eax
je 0x1615
cmpl $0x1, %eax
jne 0x1641
callq 0x1130
jmp 0x1714
leaq 0x78(%rsp), %rdi
callq 0x10d0
leaq 0x258(%rsp), %rdi
callq 0x1070
xorl %ebx, %ebx
jmp 0x1730
movl 0x78(%rsp), %eax
decl %eax
cmpl $0x3, %eax
ja 0x16d1
leaq 0xa02(%rip), %rcx       # 0x2004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x123a
jmp 0x1714
movq 0x260(%rsp), %rdx
leaq 0xcb1(%rip), %rsi       # 0x22d5
jmp 0x1635
movq 0x260(%rsp), %rdx
leaq 0xcb2(%rip), %rsi       # 0x22e7
xorl %eax, %eax
callq 0x10c0
jmp 0x1714
callq 0x114b
jmp 0x1714
movq 0xb0(%rsp), %rdx
movq 0x299e(%rip), %rax      # 0x3ff8
movq (%rax), %rsi
leaq 0x78(%rsp), %rdi
testq %rdx, %rdx
jne 0x16f8
callq 0x120e
jmp 0x1714
movq 0xb0(%rsp), %rdx
movq 0x2974(%rip), %rax      # 0x3ff8
movq (%rax), %rsi
leaq 0x78(%rsp), %rdi
testq %rdx, %rdx
jne 0x16ff
callq 0x11a4
jmp 0x1714
movl 0x90(%rsp), %ecx
movq 0x2952(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq 0x80(%rsp), %rdx
movq 0x88(%rsp), %r8
cmpl $-0x1, %ecx
jne 0x1706
leaq 0xae6(%rip), %rsi       # 0x21ab
movq %r8, %rcx
xorl %eax, %eax
callq 0x10c0
jmp 0x1714
callq 0x125c
jmp 0x1714
movq 0x2919(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq (%r14), %rcx
leaq 0x945(%rip), %rsi       # 0x2031
movq %r13, %rdx
xorl %eax, %eax
callq 0x10c0
jmp 0x172b
callq 0x11d0
jmp 0x1714
callq 0x1166
jmp 0x1714
leaq 0xa81(%rip), %rsi       # 0x218e
xorl %eax, %eax
callq 0x10c0
leaq 0x78(%rsp), %rdi
callq 0x10d0
leaq 0x258(%rsp), %rdi
callq 0x1070
movl $0x1, %ebx
movl %ebx, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq