// File: /workspace/github_c_makefile_star2_O1/mijallen[P]SimpleHTTPServer/lib/libyaml/tests/run-dumper.c
// Function: main
int
main(int argc, char *argv[])
{
    int number;
    int canonical = 0;
    int unicode = 0;

    number = 1;
    while (number < argc) {
        if (strcmp(argv[number], "-c") == 0) {
            canonical = 1;
        }
        else if (strcmp(argv[number], "-u") == 0) {
            unicode = 1;
        }
        else if (argv[number][0] == '-') {
            printf("Unknown option: '%s'\n", argv[number]);
            return 0;
        }
        if (argv[number][0] == '-') {
            if (number < argc-1) {
                memmove(argv+number, argv+number+1, (argc-number-1)*sizeof(char *));
            }
            argc --;
        }
        else {
            number ++;
        }
    }

    if (argc < 2) {
        printf("Usage: %s [-c] [-u] file1.yaml ...\n", argv[0]);
        return 0;
    }

    for (number = 1; number < argc; number ++)
    {
        FILE *file;
        yaml_parser_t parser;
        yaml_emitter_t emitter;

        yaml_document_t document;
        unsigned char buffer[BUFFER_SIZE];
        size_t written = 0;
        yaml_document_t documents[MAX_DOCUMENTS];
        size_t document_number = 0;
        int done = 0;
        int count = 0;
        int error = 0;
        int k;
        memset(buffer, 0, BUFFER_SIZE);
        memset(documents, 0, MAX_DOCUMENTS*sizeof(yaml_document_t));

        printf("[%d] Loading, dumping, and loading again '%s': ", number, argv[number]);
        fflush(stdout);

        file = fopen(argv[number], "rb");
        assert(file);

        assert(yaml_parser_initialize(&parser));
        yaml_parser_set_input_file(&parser, file);
        assert(yaml_emitter_initialize(&emitter));
        if (canonical) {
            yaml_emitter_set_canonical(&emitter, 1);
        }
        if (unicode) {
            yaml_emitter_set_unicode(&emitter, 1);
        }
        yaml_emitter_set_output_string(&emitter, buffer, BUFFER_SIZE, &written);
        yaml_emitter_open(&emitter);

        while (!done)
        {
            if (!yaml_parser_load(&parser, &document)) {
                error = 1;
                break;
            }

            done = (!yaml_document_get_root_node(&document));
            if (!done) {
                assert(document_number < MAX_DOCUMENTS);
                assert(copy_document(&(documents[document_number++]), &document));
                assert(yaml_emitter_dump(&emitter, &document) || 
                        (yaml_emitter_flush(&emitter) && print_output(argv[number], buffer, written, count)));
                count ++;
            }
            else {
                yaml_document_delete(&document);
            }
        }

        yaml_parser_delete(&parser);
        assert(!fclose(file));
        yaml_emitter_close(&emitter);
        yaml_emitter_delete(&emitter);

        if (!error)
        {
            count = done = 0;
            assert(yaml_parser_initialize(&parser));
            yaml_parser_set_input_string(&parser, buffer, written);

            while (!done)
            {
                assert(yaml_parser_load(&parser, &document) || print_output(argv[number], buffer, written, count));
                done = (!yaml_document_get_root_node(&document));
                if (!done) {
                    assert(compare_documents(documents+count, &document) || print_output(argv[number], buffer, written, count));
                    count ++;
                }
                yaml_document_delete(&document);
            }
            yaml_parser_delete(&parser);
        }

        for (k = 0; k < document_number; k ++) {
            yaml_document_delete(documents+k);
        }

        printf("PASSED (length: %d)\n", written);
        print_output(argv[number], buffer, written, -1);
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10ab8, %rsp          # imm = 0x10AB8
movq %rsi, %rbx
movl %edi, %r14d
movb $0x1, 0xf(%rsp)
cmpl $0x2, %edi
movq %rsi, 0x20(%rsp)
jl 0x19ee
movl $0x1, %r13d
movl $0x0, 0x10(%rsp)
leaq 0x807(%rip), %r15       # 0x2159
xorl %ebp, %ebp
movslq %r13d, %r12
movq (%rbx,%r12,8), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1170
testl %eax, %eax
je 0x1987
movq %rbx, %rdi
leaq 0x7e8(%rip), %rsi       # 0x215c
callq 0x1170
testl %eax, %eax
je 0x198e
cmpb $0x2d, (%rbx)
jne 0x1996
jmp 0x1ccb
movl $0x1, %ebp
jmp 0x1996
movl $0x1, 0x10(%rsp)
cmpb $0x2d, (%rbx)
jne 0x19ca
leal -0x1(%r14), %ebx
cmpl %ebx, %r13d
jge 0x19c5
movq 0x20(%rsp), %rax
leaq (%rax,%r12,8), %rdi
leaq 0x8(%rdi), %rsi
movl %r13d, %eax
notl %eax
addl %eax, %r14d
movslq %r14d, %rdx
shlq $0x3, %rdx
callq 0x1210
movl %ebx, %r14d
jmp 0x19cd
incl %r13d
cmpl %r14d, %r13d
movq 0x20(%rsp), %rbx
jl 0x1954
testl %ebp, %ebp
sete 0xf(%rsp)
cmpl $0x0, 0x10(%rsp)
sete 0xe(%rsp)
jmp 0x19f3
movb $0x1, 0xe(%rsp)
cmpl $0x2, %r14d
jge 0x1a08
movq (%rbx), %rsi
leaq 0x772(%rip), %rdi       # 0x2175
jmp 0x1cd5
movl %r14d, %eax
movq %rax, 0x28(%rsp)
movl $0x1, %r14d
leaq 0xab0(%rsp), %rbp
leaq 0x8d0(%rsp), %r13
leaq 0x1e8(%rsp), %r12
movq $0x0, 0x18(%rsp)
movl $0x10000, %edx          # imm = 0x10000
movq %rbp, %rdi
xorl %esi, %esi
callq 0x1150
movl $0x680, %edx            # imm = 0x680
leaq 0x250(%rsp), %rdi
xorl %esi, %esi
callq 0x1150
movq (%rbx,%r14,8), %rdx
leaq 0x734(%rip), %rdi       # 0x2199
movl %r14d, %esi
xorl %eax, %eax
callq 0x1110
movq 0x256a(%rip), %rax      # 0x3fe0
movq (%rax), %rdi
callq 0x11e0
movq (%rbx,%r14,8), %rdi
leaq 0x636(%rip), %rsi       # 0x20bf
callq 0x1220
testq %rax, %rax
je 0x1dff
movq %rax, %rbx
movq %r13, %rdi
callq 0x11d0
testl %eax, %eax
je 0x1e1e
movq %r13, %rdi
movq %rbx, %rsi
callq 0x1030
leaq 0x38(%rsp), %rdi
callq 0x10a0
testl %eax, %eax
je 0x1e3d
cmpb $0x0, 0xf(%rsp)
jne 0x1add
leaq 0x38(%rsp), %rdi
movl $0x1, %esi
callq 0x1230
movq %rbx, 0x30(%rsp)
cmpb $0x0, 0xe(%rsp)
jne 0x1af8
leaq 0x38(%rsp), %rdi
movl $0x1, %esi
callq 0x1250
movq %r14, 0x10(%rsp)
movl $0x10000, %edx          # imm = 0x10000
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
leaq 0x18(%rsp), %rcx
callq 0x1260
movq %rbx, %rdi
callq 0x10b0
movq %r13, %rdi
movq %r12, %rsi
callq 0x1100
testl %eax, %eax
je 0x1baa
xorl %r14d, %r14d
xorl %ebx, %ebx
movq %r12, %rdi
callq 0x1050
movq %rax, %rbp
testq %rax, %rax
setne %r15b
je 0x1b8c
cmpq $0x10, %r14
jae 0x1d72
imulq $0x68, %r14, %rax
leaq (%rsp,%rax), %rdi
addq $0x250, %rdi            # imm = 0x250
movq %r12, %rsi
callq 0x136c
testl %eax, %eax
je 0x1de0
leaq 0x38(%rsp), %rdi
movq %r12, %rsi
callq 0x1080
testl %eax, %eax
je 0x1d91
incq %r14
incl %ebx
jmp 0x1b94
movq %r12, %rdi
callq 0x1130
testq %rbp, %rbp
je 0x1bb0
movq %r13, %rdi
movq %r12, %rsi
callq 0x1100
testl %eax, %eax
jne 0x1b33
jmp 0x1bb0
movb $0x1, %r15b
xorl %r14d, %r14d
movq %r13, %rdi
callq 0x11b0
movq 0x30(%rsp), %rdi
callq 0x10c0
testl %eax, %eax
jne 0x1e5c
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
callq 0x1190
movq %rbx, %rdi
callq 0x10f0
testb %r15b, %r15b
leaq 0xab0(%rsp), %rbp
jne 0x1c6a
movq %r13, %rdi
callq 0x11d0
testl %eax, %eax
je 0x1e7b
movq 0x18(%rsp), %rdx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1090
xorl %ebx, %ebx
movq %r13, %rdi
movq %r12, %rsi
callq 0x1100
testl %eax, %eax
je 0x1cf0
movq %r12, %rdi
callq 0x1050
movq %rax, %r15
testq %rax, %rax
je 0x1c55
movslq %ebx, %rax
imulq $0x68, %rax, %rax
leaq (%rsp,%rax), %rdi
addq $0x250, %rdi            # imm = 0x250
movq %r12, %rsi
callq 0x16be
testl %eax, %eax
je 0x1d31
incl %ebx
movq %r12, %rdi
callq 0x1130
testq %r15, %r15
jne 0x1c0e
movq %r13, %rdi
callq 0x11b0
testq %r14, %r14
je 0x1c88
leaq 0x250(%rsp), %rbx
movq %rbx, %rdi
callq 0x1130
addq $0x68, %rbx
decq %r14
jne 0x1c77
movq 0x18(%rsp), %rsi
leaq 0x734(%rip), %rdi       # 0x23c8
xorl %eax, %eax
callq 0x1110
movq 0x20(%rsp), %rbx
movq 0x10(%rsp), %r14
movq (%rbx,%r14,8), %rdi
movq 0x18(%rsp), %rdx
movq %rbp, %rsi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x17c7
incq %r14
cmpq 0x28(%rsp), %r14
jne 0x1a2e
jmp 0x1cdc
leaq 0x48d(%rip), %rdi       # 0x215f
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1110
xorl %eax, %eax
addq $0x10ab8, %rsp          # imm = 0x10AB8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x18(%rsp), %rdx
leaq 0xab0(%rsp), %rsi
movl %ebx, %ecx
callq 0x17c7
leaq 0x5f0(%rip), %rdi       # 0x2309
leaq 0x2e6(%rip), %rsi       # 0x2006
leaq 0x4a2(%rip), %rcx       # 0x21c9
movl $0x123, %edx            # imm = 0x123
callq 0x1120
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x18(%rsp), %rdx
leaq 0xab0(%rsp), %rsi
movl %ebx, %ecx
callq 0x17c7
leaq 0x60a(%rip), %rdi       # 0x2364
leaq 0x2a5(%rip), %rsi       # 0x2006
leaq 0x461(%rip), %rcx       # 0x21c9
movl $0x126, %edx            # imm = 0x126
callq 0x1120
leaq 0x4a9(%rip), %rdi       # 0x2222
leaq 0x286(%rip), %rsi       # 0x2006
leaq 0x442(%rip), %rcx       # 0x21c9
movl $0x10b, %edx            # imm = 0x10B
callq 0x1120
leaq 0x38(%rsp), %rdi
callq 0x11c0
testl %eax, %eax
je 0x1dc1
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x18(%rsp), %rdx
leaq 0xab0(%rsp), %rsi
movl %ebx, %ecx
callq 0x17c7
leaq 0x4b4(%rip), %rdi       # 0x227c
leaq 0x237(%rip), %rsi       # 0x2006
leaq 0x3f3(%rip), %rcx       # 0x21c9
movl $0x10e, %edx            # imm = 0x10E
callq 0x1120
leaq 0x45b(%rip), %rdi       # 0x2242
leaq 0x218(%rip), %rsi       # 0x2006
leaq 0x3d4(%rip), %rcx       # 0x21c9
movl $0x10c, %edx            # imm = 0x10C
callq 0x1120
leaq 0x2bc(%rip), %rdi       # 0x20c2
leaq 0x1f9(%rip), %rsi       # 0x2006
leaq 0x3b5(%rip), %rcx       # 0x21c9
movl $0xf4, %edx
callq 0x1120
leaq 0x3bb(%rip), %rdi       # 0x21e0
leaq 0x1da(%rip), %rsi       # 0x2006
leaq 0x396(%rip), %rcx       # 0x21c9
movl $0xf6, %edx
callq 0x1120
leaq 0x3bc(%rip), %rdi       # 0x2200
leaq 0x1bb(%rip), %rsi       # 0x2006
leaq 0x377(%rip), %rcx       # 0x21c9
movl $0xf8, %edx
callq 0x1120
leaq 0x498(%rip), %rdi       # 0x22fb
leaq 0x19c(%rip), %rsi       # 0x2006
leaq 0x358(%rip), %rcx       # 0x21c9
movl $0x117, %edx            # imm = 0x117
callq 0x1120
leaq 0x35e(%rip), %rdi       # 0x21e0
leaq 0x17d(%rip), %rsi       # 0x2006
leaq 0x339(%rip), %rcx       # 0x21c9
movl $0x11e, %edx            # imm = 0x11E
callq 0x1120