// File: /workspace/github_c_makefile_star2_O2/mijallen[P]SimpleHTTPServer/lib/libyaml/tests/example-reformatter-alt.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_document_t document;

    /* Clear the objects. */

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

    /* 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_load(&parser, &document))
            goto parser_error;

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

        if (!yaml_document_get_root_node(&document)) {
            done = 1;
        }

        /* Emit the event. */

        if (!yaml_emitter_dump(&emitter, &document))
            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;

        case YAML_COMPOSER_ERROR:
            if (parser.context) {
                fprintf(stderr, "Composer 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, "Composer 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, %rbx
movl %edi, %r14d
leaq 0x10(%rsp), %rdi
movl $0x0, 0xc(%rsp)
movl $0x1e0, %edx            # imm = 0x1E0
xorl %esi, %esi
callq 0x10b0
leaq 0x258(%rsp), %rdi
movl $0x1b0, %edx            # imm = 0x1B0
xorl %esi, %esi
callq 0x10b0
xorps %xmm0, %xmm0
movaps %xmm0, 0x1f0(%rsp)
movaps %xmm0, 0x200(%rsp)
movaps %xmm0, 0x210(%rsp)
movaps %xmm0, 0x220(%rsp)
movaps %xmm0, 0x230(%rsp)
movaps %xmm0, 0x240(%rsp)
andq $0x0, 0x250(%rsp)
movslq %r14d, %r12
pushq $0x1
popq %rbp
movl $0x0, 0x8(%rsp)
xorl %r14d, %r14d
cmpq %r12, %rbp
jge 0x136a
movq (%rbx,%rbp,8), %r13
movb (%r13), %r15b
cmpb $0x2d, %r15b
jne 0x12e2
cmpb $0x68, 0x1(%r13)
jne 0x12e2
cmpb $0x0, 0x2(%r13)
je 0x134c
movq %r13, %rdi
leaq 0xd2c(%rip), %rsi       # 0x2018
callq 0x10c0
testl %eax, %eax
je 0x134c
cmpb $0x2d, %r15b
jne 0x1309
cmpb $0x63, 0x1(%r13)
jne 0x1309
cmpb $0x0, 0x2(%r13)
je 0x1355
movq %r13, %rdi
leaq 0xd0c(%rip), %rsi       # 0x201f
callq 0x10c0
testl %eax, %eax
je 0x1355
cmpb $0x2d, %r15b
jne 0x1330
cmpb $0x75, 0x1(%r13)
jne 0x1330
cmpb $0x0, 0x2(%r13)
je 0x1364
movq %r13, %rdi
leaq 0xcf1(%rip), %rsi       # 0x202b
callq 0x10c0
pushq $0x1
popq %r14
testl %eax, %eax
je 0x135c
jmp 0x14c7
pushq $0x1
popq %rax
movl %eax, 0xc(%rsp)
jmp 0x135c
pushq $0x1
popq %rax
movl %eax, 0x8(%rsp)
incq %rbp
jmp 0x12bd
pushq $0x1
popq %r14
jmp 0x135c
cmpl $0x0, 0xc(%rsp)
je 0x138c
movq (%rbx), %rdx
leaq 0xcf9(%rip), %rdi       # 0x2074
xorl %ebx, %ebx
movq %rdx, %rsi
xorl %eax, %eax
callq 0x10a0
jmp 0x16dc
leaq 0x10(%rsp), %rdi
callq 0x10f0
testl %eax, %eax
je 0x1490
leaq 0x258(%rsp), %rdi
callq 0x1070
testl %eax, %eax
je 0x1438
movq 0x2c1e(%rip), %rax      # 0x3fd8
movq (%rax), %rsi
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x1030
movq 0x2bff(%rip), %rax      # 0x3fd0
movq (%rax), %rsi
leaq 0x258(%rsp), %r15
movq %r15, %rdi
callq 0x1060
movq %r15, %rdi
movl 0x8(%rsp), %esi
callq 0x1100
movq %r15, %rdi
movl %r14d, %esi
callq 0x1120
xorl %ebp, %ebp
leaq 0x1f0(%rsp), %r14
testl %ebp, %ebp
jne 0x1472
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1090
testl %eax, %eax
je 0x1490
movq %r14, %rdi
callq 0x1040
xorl %ebp, %ebp
testq %rax, %rax
sete %bpl
movq %r15, %rdi
movq %r14, %rsi
callq 0x1050
testl %eax, %eax
jne 0x1405
movl 0x258(%rsp), %eax
movq 0x2bb2(%rip), %rcx      # 0x3ff8
movq (%rcx), %rcx
cmpl $0x7, %eax
je 0x14fb
cmpl $0x6, %eax
je 0x14ea
cmpl $0x1, %eax
jne 0x1606
leaq 0xead(%rip), %rdi       # 0x2318
pushq $0x2d
jmp 0x160f
leaq 0x10(%rsp), %rdi
callq 0x10e0
leaq 0x258(%rsp), %rdi
callq 0x1080
xorl %ebx, %ebx
jmp 0x16dc
movl 0x10(%rsp), %eax
decl %eax
cmpl $0x4, %eax
ja 0x15fc
leaq 0xb5e(%rip), %rcx       # 0x2004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x2b42(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0xca5(%rip), %rdi       # 0x2165
pushq $0x2c
jmp 0x160f
movq 0x2b2a(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq (%rbx), %rcx
leaq 0xb5a(%rip), %rsi       # 0x2035
movq %r13, %rdx
xorl %eax, %eax
callq 0x10d0
jmp 0x16d9
movq 0x260(%rsp), %rdx
leaq 0xe4d(%rip), %rsi       # 0x2346
jmp 0x150a
movq 0x260(%rsp), %rdx
leaq 0xe4e(%rip), %rsi       # 0x2358
movq %rcx, %rdi
xorl %eax, %eax
callq 0x10d0
jmp 0x16c2
movq 0x48(%rsp), %rdx
movq 0x2ad3(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
testq %rdx, %rdx
jne 0x161d
movq 0x18(%rsp), %rdx
movq 0x38(%rsp), %rcx
incq %rcx
movq 0x40(%rsp), %r8
incq %r8
leaq 0xd91(%rip), %rsi       # 0x22de
jmp 0x15b9
movq 0x48(%rsp), %rdx
movq 0x2a9d(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
testq %rdx, %rdx
jne 0x164b
movq 0x18(%rsp), %rdx
movq 0x38(%rsp), %rcx
incq %rcx
movq 0x40(%rsp), %r8
incq %r8
leaq 0xc86(%rip), %rsi       # 0x2209
jmp 0x15b9
movq 0x48(%rsp), %rdx
movq 0x2a67(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
testq %rdx, %rdx
jne 0x1679
movq 0x18(%rsp), %rdx
movq 0x38(%rsp), %rcx
incq %rcx
movq 0x40(%rsp), %r8
incq %r8
leaq 0xcba(%rip), %rsi       # 0x2273
xorl %eax, %eax
callq 0x10d0
jmp 0x16c2
movl 0x28(%rsp), %ecx
movq 0x2a28(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %r8
cmpl $-0x1, %ecx
jne 0x16b4
leaq 0xbc2(%rip), %rsi       # 0x21af
movq %r8, %rcx
xorl %eax, %eax
callq 0x10d0
jmp 0x16c2
movq 0x29f5(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0xcfb(%rip), %rdi       # 0x2308
pushq $0xf
popq %rsi
pushq $0x1
popq %rdx
callq 0x1110
jmp 0x16c2
movq 0x58(%rsp), %rcx
incq %rcx
movq 0x60(%rsp), %r8
incq %r8
movq 0x18(%rsp), %r9
movq 0x38(%rsp), %r10
incq %r10
movq 0x40(%rsp), %r11
incq %r11
leaq 0xc52(%rip), %rsi       # 0x229b
jmp 0x16a5
movq 0x58(%rsp), %rcx
incq %rcx
movq 0x60(%rsp), %r8
incq %r8
movq 0x18(%rsp), %r9
movq 0x38(%rsp), %r10
incq %r10
movq 0x40(%rsp), %r11
incq %r11
leaq 0xb50(%rip), %rsi       # 0x21c7
jmp 0x16a5
movq 0x58(%rsp), %rcx
incq %rcx
movq 0x60(%rsp), %r8
incq %r8
movq 0x18(%rsp), %r9
movq 0x38(%rsp), %r10
incq %r10
movq 0x40(%rsp), %r11
incq %r11
leaq 0xb8d(%rip), %rsi       # 0x2232
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x10d0
popq %rcx
popq %rdx
jmp 0x16c2
leaq 0xad7(%rip), %rsi       # 0x2192
xorl %eax, %eax
callq 0x10d0
leaq 0x10(%rsp), %rdi
callq 0x10e0
leaq 0x258(%rsp), %rdi
callq 0x1080
pushq $0x1
popq %rbx
movl %ebx, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq