// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x440, %rsp            # imm = 0x440
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x24(%rbp)
leaq -0x208(%rbp), %rdi
xorl %esi, %esi
movl $0x1e0, %edx            # imm = 0x1E0
callq 0x10a0
leaq -0x3b8(%rbp), %rdi
xorl %esi, %esi
movl $0x1b0, %edx            # imm = 0x1B0
callq 0x10a0
leaq -0x420(%rbp), %rdi
xorl %esi, %esi
movl $0x68, %edx
callq 0x10a0
movl $0x1, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x13a8
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xd70(%rip), %rsi       # 0x2014
callq 0x10b0
cmpl $0x0, %eax
je 0x12cb
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xd56(%rip), %rsi       # 0x2017
callq 0x10b0
cmpl $0x0, %eax
jne 0x12d7
movl $0x1, -0x14(%rbp)
jmp 0x1398
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xd34(%rip), %rsi       # 0x201e
callq 0x10b0
cmpl $0x0, %eax
je 0x1311
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xd1a(%rip), %rsi       # 0x2021
callq 0x10b0
cmpl $0x0, %eax
jne 0x131a
movl $0x1, -0x18(%rbp)
jmp 0x1396
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xd00(%rip), %rsi       # 0x202d
callq 0x10b0
cmpl $0x0, %eax
je 0x1354
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xce6(%rip), %rsi       # 0x2030
callq 0x10b0
cmpl $0x0, %eax
jne 0x135d
movl $0x1, -0x1c(%rbp)
jmp 0x1394
movq 0x2c94(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rcx
leaq 0xcb9(%rip), %rsi       # 0x203a
movb $0x0, %al
callq 0x10c0
movl $0x1, -0x4(%rbp)
jmp 0x17b3
jmp 0x1396
jmp 0x1398
jmp 0x139a
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1285
cmpl $0x0, -0x14(%rbp)
je 0x13d6
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0xcb6(%rip), %rdi       # 0x2079
movb $0x0, %al
callq 0x1080
movl $0x0, -0x4(%rbp)
jmp 0x17b3
leaq -0x208(%rbp), %rdi
callq 0x10e0
cmpl $0x0, %eax
jne 0x13ec
jmp 0x14c8
leaq -0x3b8(%rbp), %rdi
callq 0x1060
cmpl $0x0, %eax
jne 0x1402
jmp 0x16f3
movq 0x2bcf(%rip), %rax      # 0x3fd8
movq (%rax), %rsi
leaq -0x208(%rbp), %rdi
callq 0x1030
movq 0x2bb1(%rip), %rax      # 0x3fd0
movq (%rax), %rsi
leaq -0x3b8(%rbp), %rdi
callq 0x1050
movl -0x18(%rbp), %esi
leaq -0x3b8(%rbp), %rdi
callq 0x10f0
movl -0x1c(%rbp), %esi
leaq -0x3b8(%rbp), %rdi
callq 0x1100
cmpl $0x0, -0x24(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x145b
jmp 0x14a4
leaq -0x208(%rbp), %rdi
leaq -0x420(%rbp), %rsi
callq 0x1040
cmpl $0x0, %eax
jne 0x1475
jmp 0x14c8
cmpl $0x2, -0x420(%rbp)
jne 0x1485
movl $0x1, -0x24(%rbp)
leaq -0x3b8(%rbp), %rdi
leaq -0x420(%rbp), %rsi
callq 0x1090
cmpl $0x0, %eax
jne 0x14a2
jmp 0x16f3
jmp 0x144c
leaq -0x208(%rbp), %rdi
callq 0x10d0
leaq -0x3b8(%rbp), %rdi
callq 0x1070
movl $0x0, -0x4(%rbp)
jmp 0x17b3
movl -0x208(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x428(%rbp)
subl $0x3, %eax
ja 0x16b7
movq -0x428(%rbp), %rax
leaq 0xb14(%rip), %rcx       # 0x2004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x2af8(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xc60(%rip), %rsi       # 0x216a
movb $0x0, %al
callq 0x10c0
jmp 0x16cf
cmpl $-0x1, -0x1f0(%rbp)
je 0x154d
movq 0x2ad2(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq -0x200(%rbp), %rdx
movl -0x1f0(%rbp), %ecx
movq -0x1f8(%rbp), %r8
leaq 0xc53(%rip), %rsi       # 0x2197
movb $0x0, %al
callq 0x10c0
jmp 0x1573
movq 0x2aa4(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq -0x200(%rbp), %rdx
movq -0x1f8(%rbp), %rcx
leaq 0xc48(%rip), %rsi       # 0x21b4
movb $0x0, %al
callq 0x10c0
jmp 0x16cf
cmpq $0x0, -0x1d0(%rbp)
je 0x15df
movq 0x2a6f(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq -0x1d0(%rbp), %rdx
movq -0x1c0(%rbp), %rcx
addq $0x1, %rcx
movq -0x1b8(%rbp), %r8
addq $0x1, %r8
movq -0x200(%rbp), %r9
movq -0x1e0(%rbp), %r10
addq $0x1, %r10
movq -0x1d8(%rbp), %rax
addq $0x1, %rax
leaq 0xbff(%rip), %rsi       # 0x21cc
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x10c0
jmp 0x1614
movq 0x2a12(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq -0x200(%rbp), %rdx
movq -0x1e0(%rbp), %rcx
addq $0x1, %rcx
movq -0x1d8(%rbp), %r8
addq $0x1, %r8
leaq 0xc01(%rip), %rsi       # 0x220e
movb $0x0, %al
callq 0x10c0
jmp 0x16cf
cmpq $0x0, -0x1d0(%rbp)
je 0x1680
movq 0x29ce(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq -0x1d0(%rbp), %rdx
movq -0x1c0(%rbp), %rcx
addq $0x1, %rcx
movq -0x1b8(%rbp), %r8
addq $0x1, %r8
movq -0x200(%rbp), %r9
movq -0x1e0(%rbp), %r10
addq $0x1, %r10
movq -0x1d8(%rbp), %rax
addq $0x1, %rax
leaq 0xbc9(%rip), %rsi       # 0x2237
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x10c0
jmp 0x16b5
movq 0x2971(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq -0x200(%rbp), %rdx
movq -0x1e0(%rbp), %rcx
addq $0x1, %rcx
movq -0x1d8(%rbp), %r8
addq $0x1, %r8
leaq 0xbca(%rip), %rsi       # 0x2278
movb $0x0, %al
callq 0x10c0
jmp 0x16cf
movq 0x293a(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xbd8(%rip), %rsi       # 0x22a0
movb $0x0, %al
callq 0x10c0
leaq -0x208(%rbp), %rdi
callq 0x10d0
leaq -0x3b8(%rbp), %rdi
callq 0x1070
movl $0x1, -0x4(%rbp)
jmp 0x17b3
movl -0x3b8(%rbp), %eax
movl %eax, -0x42c(%rbp)
subl $0x1, %eax
je 0x1720
jmp 0x1706
movl -0x42c(%rbp), %eax
subl $0x6, %eax
je 0x173a
jmp 0x1713
movl -0x42c(%rbp), %eax
subl $0x7, %eax
je 0x175b
jmp 0x177c
movq 0x28d1(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xb7f(%rip), %rsi       # 0x22b0
movb $0x0, %al
callq 0x10c0
jmp 0x1794
movq 0x28b7(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq -0x3b0(%rbp), %rdx
leaq 0xb8c(%rip), %rsi       # 0x22de
movb $0x0, %al
callq 0x10c0
jmp 0x1794
movq 0x2896(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq -0x3b0(%rbp), %rdx
leaq 0xb7d(%rip), %rsi       # 0x22f0
movb $0x0, %al
callq 0x10c0
jmp 0x1794
movq 0x2875(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xb13(%rip), %rsi       # 0x22a0
movb $0x0, %al
callq 0x10c0
leaq -0x208(%rbp), %rdi
callq 0x10d0
leaq -0x3b8(%rbp), %rdi
callq 0x1070
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x440, %rsp            # imm = 0x440
popq %rbp
retq