// File: /workspace/github_c_makefile_star2_O2/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, %r13
movl %edi, %r14d
leal -0x1(%r14), %ebx
movl $0x0, 0x14(%rsp)
pushq $0x1
popq %rbp
movl %ebp, %r15d
movl $0x0, 0x20(%rsp)
movslq %r15d, %r15
cmpl %r14d, %r15d
jge 0x19a0
movq (%r13,%r15,8), %rsi
cmpb $0x2d, (%rsi)
je 0x193b
incq %r15
jmp 0x1927
cmpb $0x63, 0x1(%rsi)
jne 0x194a
cmpb $0x0, 0x2(%rsi)
movl %ebp, %r12d
je 0x1967
cmpb $0x75, 0x1(%rsi)
jne 0x1c7b
cmpb $0x0, 0x2(%rsi)
movl 0x14(%rsp), %r12d
movl %ebp, 0x20(%rsp)
jne 0x1c7b
decl %r14d
cmpl %r14d, %r15d
jge 0x1996
leaq (,%r15,8), %rdi
addq %r13, %rdi
leaq 0x8(,%r15,8), %rsi
addq %r13, %rsi
movl %ebx, %eax
subl %r15d, %eax
movslq %eax, %rdx
shlq $0x3, %rdx
callq 0x1210
decq %rbx
movl %r12d, 0x14(%rsp)
jmp 0x1924
cmpl $0x2, %r14d
jge 0x19cc
movq (%r13), %rsi
leaq 0x7be(%rip), %rdi       # 0x216f
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 %r13, 0x18(%rsp)
movl %r14d, %eax
movq %rax, 0x30(%rsp)
pushq $0x1
popq %r15
leaq 0xab0(%rsp), %rbp
leaq 0x8d0(%rsp), %r13
leaq 0xa0(%rsp), %r14
leaq 0x38(%rsp), %r12
cmpq 0x30(%rsp), %r15
je 0x19b8
andq $0x0, 0x8(%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 0x18(%rsp), %rbx
movq (%rbx,%r15,8), %rdx
leaq 0x759(%rip), %rdi       # 0x2193
movl %r15d, %esi
xorl %eax, %eax
callq 0x1110
movq 0x2595(%rip), %rax      # 0x3fe0
movq (%rax), %rdi
callq 0x11e0
movq %r15, 0x28(%rsp)
movq (%rbx,%r15,8), %rdi
leaq 0x65c(%rip), %rsi       # 0x20bf
callq 0x1220
testq %rax, %rax
je 0x1d09
movq %rax, %r15
movq %r13, %rdi
callq 0x11d0
testl %eax, %eax
je 0x1d28
movq %r14, %rbx
movq %r13, %rdi
movq %r15, %rsi
callq 0x1030
movq %r14, %rdi
callq 0x10a0
testl %eax, %eax
je 0x1d66
cmpl $0x0, 0x14(%rsp)
je 0x1ab4
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0x1230
cmpl $0x0, 0x20(%rsp)
je 0x1ac6
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0x1250
movl $0x10000, %edx          # imm = 0x10000
movq %rbx, %rdi
movq %rbp, %rsi
leaq 0x8(%rsp), %rcx
callq 0x1260
movq %rbx, %rdi
callq 0x10b0
xorl %ebx, %ebx
movb $0x1, %bpl
movl $0x0, 0x24(%rsp)
testb $0x1, %bpl
je 0x1b65
movq %r13, %rdi
movq %r12, %rsi
callq 0x1100
testl %eax, %eax
je 0x1b65
movq %r12, %rdi
callq 0x1050
testq %rax, %rax
setne %bpl
jne 0x1b20
movq %r12, %rdi
callq 0x1130
jmp 0x1af0
cmpq $0x10, %rbx
jae 0x1e17
imulq $0x68, %rbx, %rax
leaq (%rsp,%rax), %rdi
addq $0x250, %rdi            # imm = 0x250
movq %r12, %rsi
callq 0x136c
testl %eax, %eax
je 0x1df8
movq %r14, %rdi
movq %r12, %rsi
callq 0x1080
testl %eax, %eax
je 0x1da4
incq %rbx
incl 0x24(%rsp)
jmp 0x1af0
movq %r13, %rdi
callq 0x11b0
movq %r15, %rdi
callq 0x10c0
testl %eax, %eax
jne 0x1d47
movq %r14, %rdi
callq 0x1190
movq %r14, %rdi
callq 0x10f0
testb $0x1, %bpl
jne 0x1c1e
movq %r13, %rdi
callq 0x11d0
testl %eax, %eax
leaq 0xab0(%rsp), %rsi
je 0x1d85
movq 0x8(%rsp), %rdx
movq %r13, %rdi
callq 0x1090
xorl %ebp, %ebp
movb $0x1, %r15b
movq %r13, %rdi
testb $0x1, %r15b
je 0x1c19
movq %r12, %rsi
callq 0x1100
testl %eax, %eax
je 0x1c87
movq %r12, %rdi
callq 0x1050
testq %rax, %rax
setne %r15b
je 0x1c0f
movslq %ebp, %rax
imulq $0x68, %rax, %rax
leaq (%rsp,%rax), %rdi
addq $0x250, %rdi            # imm = 0x250
movq %r12, %rsi
callq 0x169d
testl %eax, %eax
je 0x1cc8
incl %ebp
movq %r12, %rdi
callq 0x1130
jmp 0x1bc1
callq 0x11b0
leaq 0x250(%rsp), %r15
leaq 0xab0(%rsp), %rbp
subq $0x1, %rbx
jb 0x1c42
movq %r15, %rdi
callq 0x1130
addq $0x68, %r15
jmp 0x1c2e
movq 0x8(%rsp), %rsi
leaq 0x774(%rip), %rdi       # 0x23c2
xorl %eax, %eax
callq 0x1110
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %r15
movq (%rax,%r15,8), %rdi
movq 0x8(%rsp), %rdx
movq %rbp, %rsi
pushq $-0x1
popq %rcx
callq 0x17a6
incq %r15
jmp 0x19fa
leaq 0x4d7(%rip), %rdi       # 0x2159
jmp 0x19b1
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x8(%rsp), %rdx
leaq 0xab0(%rsp), %rsi
movl %ebp, %ecx
callq 0x17a6
leaq 0x653(%rip), %rdi       # 0x2303
leaq 0x34f(%rip), %rsi       # 0x2006
leaq 0x505(%rip), %rcx       # 0x21c3
movl $0x123, %edx            # imm = 0x123
callq 0x1120
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x8(%rsp), %rdx
leaq 0xab0(%rsp), %rsi
movl %ebp, %ecx
callq 0x17a6
leaq 0x66d(%rip), %rdi       # 0x235e
leaq 0x30e(%rip), %rsi       # 0x2006
leaq 0x4c4(%rip), %rcx       # 0x21c3
movl $0x126, %edx            # imm = 0x126
callq 0x1120
leaq 0x3b2(%rip), %rdi       # 0x20c2
leaq 0x2ef(%rip), %rsi       # 0x2006
leaq 0x4a5(%rip), %rcx       # 0x21c3
movl $0xf4, %edx
callq 0x1120
leaq 0x4ab(%rip), %rdi       # 0x21da
leaq 0x2d0(%rip), %rsi       # 0x2006
leaq 0x486(%rip), %rcx       # 0x21c3
movl $0xf6, %edx
callq 0x1120
leaq 0x5a7(%rip), %rdi       # 0x22f5
leaq 0x2b1(%rip), %rsi       # 0x2006
leaq 0x467(%rip), %rcx       # 0x21c3
movl $0x117, %edx            # imm = 0x117
callq 0x1120
leaq 0x48d(%rip), %rdi       # 0x21fa
leaq 0x292(%rip), %rsi       # 0x2006
leaq 0x448(%rip), %rcx       # 0x21c3
movl $0xf8, %edx
callq 0x1120
leaq 0x44e(%rip), %rdi       # 0x21da
leaq 0x273(%rip), %rsi       # 0x2006
leaq 0x429(%rip), %rcx       # 0x21c3
movl $0x11e, %edx            # imm = 0x11E
callq 0x1120
leaq 0xa0(%rsp), %rdi
callq 0x11c0
testl %eax, %eax
je 0x1dd9
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x8(%rsp), %rdx
leaq 0xab0(%rsp), %rsi
movl 0x24(%rsp), %ecx
callq 0x17a6
leaq 0x496(%rip), %rdi       # 0x2276
leaq 0x21f(%rip), %rsi       # 0x2006
leaq 0x3d5(%rip), %rcx       # 0x21c3
movl $0x10e, %edx            # imm = 0x10E
callq 0x1120
leaq 0x43d(%rip), %rdi       # 0x223c
leaq 0x200(%rip), %rsi       # 0x2006
leaq 0x3b6(%rip), %rcx       # 0x21c3
movl $0x10c, %edx            # imm = 0x10C
callq 0x1120
leaq 0x3fe(%rip), %rdi       # 0x221c
leaq 0x1e1(%rip), %rsi       # 0x2006
leaq 0x397(%rip), %rcx       # 0x21c3
movl $0x10b, %edx            # imm = 0x10B
callq 0x1120