// File: /workspace/github_c_makefile_star2_O3/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 $0x10aa8, %rsp          # imm = 0x10AA8
movq %rsi, %r14
cmpl $0x2, %edi
jl 0x1996
movl $0x1, %ebx
movl $0x0, 0xc(%rsp)
movl $0x0, 0x8(%rsp)
movslq %ebx, %rax
movq (%r14,%rax,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x197f
cmpb $0x63, 0x1(%rsi)
jne 0x1943
cmpb $0x0, 0x2(%rsi)
je 0x1987
cmpb $0x75, 0x1(%rsi)
jne 0x19a2
movl $0x1, 0xc(%rsp)
cmpb $0x0, 0x2(%rsi)
jne 0x19a2
leal -0x1(%rdi), %ebp
cmpl %ebp, %ebx
jge 0x197b
leaq (%r14,%rax,8), %rax
leaq 0x8(%rax), %rsi
movl %ebx, %ecx
notl %ecx
addl %ecx, %edi
movslq %edi, %rdx
shlq $0x3, %rdx
movq %rax, %rdi
callq 0x1210
movl %ebp, %edi
jmp 0x1981
incl %ebx
cmpl %edi, %ebx
jl 0x192b
jmp 0x1991
movl $0x1, 0x8(%rsp)
jmp 0x1957
cmpl $0x2, %edi
jge 0x19c4
movq (%r14), %rsi
leaq 0x7cf(%rip), %rdi       # 0x216f
jmp 0x19a9
leaq 0x7b0(%rip), %rdi       # 0x2159
xorl %eax, %eax
callq 0x1110
xorl %eax, %eax
addq $0x10aa8, %rsp          # imm = 0x10AA8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %edi, %eax
movq %rax, 0x20(%rsp)
movl $0x1, %r15d
leaq 0xaa0(%rsp), %rbp
leaq 0x240(%rsp), %r13
leaq 0x1d8(%rsp), %r12
movq %r14, 0x10(%rsp)
movq $0x0, (%rsp)
movl $0x10000, %edx          # imm = 0x10000
movq %rbp, %rdi
xorl %esi, %esi
callq 0x1150
movl $0x680, %edx            # imm = 0x680
leaq 0x420(%rsp), %rdi
xorl %esi, %esi
callq 0x1150
movq (%r14,%r15,8), %rdx
leaq 0x76f(%rip), %rdi       # 0x2193
movl %r15d, %esi
xorl %eax, %eax
callq 0x1110
movq 0x25ab(%rip), %rax      # 0x3fe0
movq (%rax), %rdi
callq 0x11e0
movq (%r14,%r15,8), %rdi
leaq 0x677(%rip), %rsi       # 0x20bf
callq 0x1220
testq %rax, %rax
je 0x1ddc
movq %rax, %rbx
movq %r13, %rdi
callq 0x11d0
testl %eax, %eax
je 0x1dbd
movq %r13, %rdi
movq %rbx, %r13
movq %rbx, %rsi
callq 0x1030
leaq 0x28(%rsp), %rdi
callq 0x10a0
testl %eax, %eax
je 0x1dfb
movq %rbp, %rbx
cmpl $0x0, 0x8(%rsp)
je 0x1aa2
leaq 0x28(%rsp), %rdi
movl $0x1, %esi
callq 0x1230
cmpl $0x0, 0xc(%rsp)
leaq 0x28(%rsp), %rbp
je 0x1abb
movq %rbp, %rdi
movl $0x1, %esi
callq 0x1250
movq %r15, 0x18(%rsp)
movl $0x10000, %edx          # imm = 0x10000
movq %rbp, %rdi
movq %rbx, %rsi
movq %rsp, %rcx
callq 0x1260
movq %rbp, %rdi
callq 0x10b0
leaq 0x240(%rsp), %rdi
movq %r12, %rsi
callq 0x1100
testl %eax, %eax
sete %r14b
je 0x1b64
leaq 0x420(%rsp), %rbp
xorl %r15d, %r15d
movq %r13, %rbx
leaq 0x240(%rsp), %r13
movq %r12, %rdi
callq 0x1050
testq %rax, %rax
je 0x1b74
cmpq $0x10, %r15
jae 0x1d7f
movq %rbp, %rdi
movq %r12, %rsi
callq 0x136c
testl %eax, %eax
leaq 0x28(%rsp), %rdi
je 0x1d9e
movq %r12, %rsi
callq 0x1080
testl %eax, %eax
je 0x1d30
movq %r13, %rdi
movq %r12, %rsi
callq 0x1100
addq $0x68, %rbp
incq %r15
testl %eax, %eax
sete %r14b
jne 0x1b09
jmp 0x1b7c
xorl %r15d, %r15d
movq %r13, %rbx
leaq 0x240(%rsp), %r13
jmp 0x1b7c
movq %r12, %rdi
callq 0x1130
movq %r13, %rdi
callq 0x11b0
movq %rbx, %rdi
callq 0x10c0
testl %eax, %eax
jne 0x1e1a
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
callq 0x1190
movq %rbx, %rdi
callq 0x10f0
testb $0x1, %r14b
leaq 0xaa0(%rsp), %rbp
jne 0x1c4e
movq %r13, %rdi
callq 0x11d0
testl %eax, %eax
je 0x1e39
movq (%rsp), %rdx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1090
movq %r13, %rdi
movq %r12, %rsi
callq 0x1100
xorl %ebx, %ebx
testl %eax, %eax
je 0x1cb0
leaq 0x420(%rsp), %rbp
movq %r12, %rdi
callq 0x1050
testq %rax, %rax
je 0x1c36
movq %rbp, %rdi
movq %r12, %rsi
callq 0x16b1
testl %eax, %eax
je 0x1cf0
incl %ebx
movq %r12, %rdi
callq 0x1130
movq %r13, %rdi
movq %r12, %rsi
callq 0x1100
addq $0x68, %rbp
testl %eax, %eax
jne 0x1bf7
jmp 0x1cb0
movq %r12, %rdi
callq 0x1130
movq %r13, %rdi
callq 0x11b0
leaq 0xaa0(%rsp), %rbp
testq %r15, %r15
je 0x1c6c
leaq 0x420(%rsp), %rbx
movq %rbx, %rdi
callq 0x1130
addq $0x68, %rbx
decq %r15
jne 0x1c5b
movq (%rsp), %rsi
leaq 0x74b(%rip), %rdi       # 0x23c2
xorl %eax, %eax
callq 0x1110
movq 0x10(%rsp), %r14
movq 0x18(%rsp), %r15
movq (%r14,%r15,8), %rdi
movq (%rsp), %rdx
movq %rbp, %rsi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x17ad
incq %r15
cmpq 0x20(%rsp), %r15
jne 0x19ee
jmp 0x19b0
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq (%rsp), %rdx
leaq 0xaa0(%rsp), %rsi
movl %ebx, %ecx
callq 0x17ad
leaq 0x62b(%rip), %rdi       # 0x2303
leaq 0x327(%rip), %rsi       # 0x2006
leaq 0x4dd(%rip), %rcx       # 0x21c3
movl $0x123, %edx            # imm = 0x123
callq 0x1120
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq (%rsp), %rdx
leaq 0xaa0(%rsp), %rsi
movl %ebx, %ecx
callq 0x17ad
leaq 0x646(%rip), %rdi       # 0x235e
leaq 0x2e7(%rip), %rsi       # 0x2006
leaq 0x49d(%rip), %rcx       # 0x21c3
movl $0x126, %edx            # imm = 0x126
callq 0x1120
leaq 0x28(%rsp), %rdi
callq 0x11c0
testl %eax, %eax
je 0x1d60
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq (%rsp), %rdx
leaq 0xaa0(%rsp), %rsi
movl %r15d, %ecx
callq 0x17ad
leaq 0x50f(%rip), %rdi       # 0x2276
leaq 0x298(%rip), %rsi       # 0x2006
leaq 0x44e(%rip), %rcx       # 0x21c3
movl $0x10e, %edx            # imm = 0x10E
callq 0x1120
leaq 0x496(%rip), %rdi       # 0x221c
leaq 0x279(%rip), %rsi       # 0x2006
leaq 0x42f(%rip), %rcx       # 0x21c3
movl $0x10b, %edx            # imm = 0x10B
callq 0x1120
leaq 0x497(%rip), %rdi       # 0x223c
leaq 0x25a(%rip), %rsi       # 0x2006
leaq 0x410(%rip), %rcx       # 0x21c3
movl $0x10c, %edx            # imm = 0x10C
callq 0x1120
leaq 0x416(%rip), %rdi       # 0x21da
leaq 0x23b(%rip), %rsi       # 0x2006
leaq 0x3f1(%rip), %rcx       # 0x21c3
movl $0xf6, %edx
callq 0x1120
leaq 0x2df(%rip), %rdi       # 0x20c2
leaq 0x21c(%rip), %rsi       # 0x2006
leaq 0x3d2(%rip), %rcx       # 0x21c3
movl $0xf4, %edx
callq 0x1120
leaq 0x3f8(%rip), %rdi       # 0x21fa
leaq 0x1fd(%rip), %rsi       # 0x2006
leaq 0x3b3(%rip), %rcx       # 0x21c3
movl $0xf8, %edx
callq 0x1120
leaq 0x4d4(%rip), %rdi       # 0x22f5
leaq 0x1de(%rip), %rsi       # 0x2006
leaq 0x394(%rip), %rcx       # 0x21c3
movl $0x117, %edx            # imm = 0x117
callq 0x1120
leaq 0x39a(%rip), %rdi       # 0x21da
leaq 0x1bf(%rip), %rsi       # 0x2006
leaq 0x375(%rip), %rcx       # 0x21c3
movl $0x11e, %edx            # imm = 0x11E
callq 0x1120