// File: /workspace/github_c_makefile_star2_O0/mijallen[P]SimpleHTTPServer/lib/libyaml/tests/run-emitter.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_event_t event;
        unsigned char buffer[BUFFER_SIZE];
        size_t written = 0;
        yaml_event_t events[MAX_EVENTS];
        size_t event_number = 0;
        int done = 0;
        int count = 0;
        int error = 0;
        int k;
        memset(buffer, 0, BUFFER_SIZE);
        memset(events, 0, MAX_EVENTS*sizeof(yaml_event_t));

        printf("[%d] Parsing, emitting, and parsing 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);

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

            done = (event.type == YAML_STREAM_END_EVENT);
            assert(event_number < MAX_EVENTS);
            assert(copy_event(&(events[event_number++]), &event));
            assert(yaml_emitter_emit(&emitter, &event) || 
                    (yaml_emitter_flush(&emitter) && print_output(argv[number], buffer, written, count)));
            count ++;
        }

        yaml_parser_delete(&parser);
        assert(!fclose(file));
        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_parse(&parser, &event) || print_output(argv[number], buffer, written, count));
                done = (event.type == YAML_STREAM_END_EVENT);
                assert(compare_events(events+count, &event) || print_output(argv[number], buffer, written, count));
                yaml_event_delete(&event);
                count ++;
            }
            yaml_parser_delete(&parser);
        }

        for (k = 0; k < event_number; k ++) {
            yaml_event_delete(events+k);
        }

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

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2a450, %rsp          # imm = 0x2A450
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x1d85
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x1480(%rip), %rsi      # 0x311d
callq 0x1150
cmpl $0x0, %eax
jne 0x1cb0
movl $0x1, -0x18(%rbp)
jmp 0x1d14
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x145d(%rip), %rsi      # 0x3120
callq 0x1150
cmpl $0x0, %eax
jne 0x1cd6
movl $0x1, -0x1c(%rbp)
jmp 0x1d12
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x1d10
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x1426(%rip), %rdi      # 0x3123
movb $0x0, %al
callq 0x10f0
movl $0x0, -0x4(%rbp)
jmp 0x2317
jmp 0x1d12
jmp 0x1d14
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x1d77
movl -0x14(%rbp), %eax
movl -0x8(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x1d6c
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movslq -0x14(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
addq $0x8, %rsi
movl -0x8(%rbp), %eax
subl -0x14(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rdx
shlq $0x3, %rdx
callq 0x11e0
movl -0x8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x1d80
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1c7e
cmpl $0x2, -0x8(%rbp)
jge 0x1dac
movq -0x10(%rbp), %rax
movq (%rax), %rsi
leaq 0x13a0(%rip), %rdi      # 0x3139
movb $0x0, %al
callq 0x10f0
movl $0x0, -0x4(%rbp)
jmp 0x2317
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x2310
movq $0x0, -0x10428(%rbp)
movq $0x0, -0x2a438(%rbp)
movl $0x0, -0x2a43c(%rbp)
movl $0x0, -0x2a440(%rbp)
movl $0x0, -0x2a444(%rbp)
leaq -0x10420(%rbp), %rdi
xorl %esi, %esi
movl $0x10000, %edx          # imm = 0x10000
callq 0x1120
leaq -0x2a430(%rbp), %rdi
xorl %esi, %esi
movl $0x1a000, %edx          # imm = 0x1A000
callq 0x1120
movl -0x14(%rbp), %esi
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x132e(%rip), %rdi      # 0x315d
movb $0x0, %al
callq 0x10f0
movq 0x31a3(%rip), %rax      # 0x4fe0
movq (%rax), %rdi
callq 0x11c0
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x121d(%rip), %rsi      # 0x3075
callq 0x1200
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x1e6a
jmp 0x1e89
leaq 0x1207(%rip), %rdi      # 0x3078
leaq 0x1205(%rip), %rsi      # 0x307d
movl $0x10d, %edx            # imm = 0x10D
leaq 0x130a(%rip), %rcx      # 0x318e
callq 0x1110
leaq -0x208(%rbp), %rdi
callq 0x11b0
cmpl $0x0, %eax
je 0x1e9c
jmp 0x1ebb
leaq 0x1302(%rip), %rdi      # 0x31a5
leaq 0x11d3(%rip), %rsi      # 0x307d
movl $0x10f, %edx            # imm = 0x10F
leaq 0x12d8(%rip), %rcx      # 0x318e
callq 0x1110
movq -0x28(%rbp), %rsi
leaq -0x208(%rbp), %rdi
callq 0x1040
leaq -0x3b8(%rbp), %rdi
callq 0x10b0
cmpl $0x0, %eax
je 0x1ede
jmp 0x1efd
leaq 0x12e0(%rip), %rdi      # 0x31c5
leaq 0x1191(%rip), %rsi      # 0x307d
movl $0x111, %edx            # imm = 0x111
leaq 0x1296(%rip), %rcx      # 0x318e
callq 0x1110
cmpl $0x0, -0x18(%rbp)
je 0x1f14
leaq -0x3b8(%rbp), %rdi
movl $0x1, %esi
callq 0x1210
cmpl $0x0, -0x1c(%rbp)
je 0x1f2b
leaq -0x3b8(%rbp), %rdi
movl $0x1, %esi
callq 0x1240
leaq -0x10420(%rbp), %rsi
leaq -0x3b8(%rbp), %rdi
movl $0x10000, %edx          # imm = 0x10000
leaq -0x10428(%rbp), %rcx
callq 0x1250
cmpl $0x0, -0x2a43c(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x1f5f
jmp 0x20a6
leaq -0x208(%rbp), %rdi
leaq -0x420(%rbp), %rsi
callq 0x1050
cmpl $0x0, %eax
jne 0x1f86
movl $0x1, -0x2a444(%rbp)
jmp 0x20a6
cmpl $0x2, -0x420(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x2a43c(%rbp)
cmpq $0x400, -0x2a438(%rbp) # imm = 0x400
jae 0x1faa
jmp 0x1fc9
leaq 0x1236(%rip), %rdi      # 0x31e7
leaq 0x10c5(%rip), %rsi      # 0x307d
movl $0x122, %edx            # imm = 0x122
leaq 0x11ca(%rip), %rcx      # 0x318e
callq 0x1110
movq -0x2a438(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x2a438(%rbp)
leaq -0x2a430(%rbp), %rdi
imulq $0x68, %rax, %rax
addq %rax, %rdi
leaq -0x420(%rbp), %rsi
callq 0x1370
cmpl $0x0, %eax
je 0x1fff
jmp 0x201e
leaq 0x11fb(%rip), %rdi      # 0x3201
leaq 0x1070(%rip), %rsi      # 0x307d
movl $0x123, %edx            # imm = 0x123
leaq 0x1175(%rip), %rcx      # 0x318e
callq 0x1110
leaq -0x3b8(%rbp), %rdi
leaq -0x420(%rbp), %rsi
callq 0x1100
cmpl $0x0, %eax
jne 0x2071
leaq -0x3b8(%rbp), %rdi
callq 0x11a0
cmpl $0x0, %eax
je 0x2073
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq -0x10420(%rbp), %rsi
movq -0x10428(%rbp), %rdx
movl -0x2a440(%rbp), %ecx
callq 0x1aa0
cmpl $0x0, %eax
je 0x2073
jmp 0x2092
leaq 0x11b5(%rip), %rdi      # 0x322f
leaq 0xffc(%rip), %rsi       # 0x307d
movl $0x125, %edx            # imm = 0x125
leaq 0x1101(%rip), %rcx      # 0x318e
callq 0x1110
movl -0x2a440(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2a440(%rbp)
jmp 0x1f4a
leaq -0x208(%rbp), %rdi
callq 0x1190
movq -0x28(%rbp), %rdi
callq 0x10c0
cmpl $0x0, %eax
jne 0x20c2
jmp 0x20e1
leaq 0x11e2(%rip), %rdi      # 0x32ab
leaq 0xfad(%rip), %rsi       # 0x307d
movl $0x12a, %edx            # imm = 0x12A
leaq 0x10b2(%rip), %rcx      # 0x318e
callq 0x1110
leaq -0x3b8(%rbp), %rdi
callq 0x10d0
cmpl $0x0, -0x2a444(%rbp)
jne 0x2284
movl $0x0, -0x2a43c(%rbp)
movl $0x0, -0x2a440(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x11b0
cmpl $0x0, %eax
je 0x2121
jmp 0x2140
leaq 0x107d(%rip), %rdi      # 0x31a5
leaq 0xf4e(%rip), %rsi       # 0x307d
movl $0x130, %edx            # imm = 0x130
leaq 0x1053(%rip), %rcx      # 0x318e
callq 0x1110
leaq -0x10420(%rbp), %rsi
movq -0x10428(%rbp), %rdx
leaq -0x208(%rbp), %rdi
callq 0x10a0
cmpl $0x0, -0x2a43c(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x216f
jmp 0x2278
leaq -0x208(%rbp), %rdi
leaq -0x420(%rbp), %rsi
callq 0x1050
cmpl $0x0, %eax
jne 0x21b1
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq -0x10420(%rbp), %rsi
movq -0x10428(%rbp), %rdx
movl -0x2a440(%rbp), %ecx
callq 0x1aa0
cmpl $0x0, %eax
je 0x21b3
jmp 0x21d2
leaq 0x10ff(%rip), %rdi      # 0x32b9
leaq 0xebc(%rip), %rsi       # 0x307d
movl $0x135, %edx            # imm = 0x135
leaq 0xfc1(%rip), %rcx       # 0x318e
callq 0x1110
cmpl $0x2, -0x420(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x2a43c(%rbp)
leaq -0x2a430(%rbp), %rdi
movslq -0x2a440(%rbp), %rax
imulq $0x68, %rax, %rax
addq %rax, %rdi
leaq -0x420(%rbp), %rsi
callq 0x1510
cmpl $0x0, %eax
jne 0x2237
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq -0x10420(%rbp), %rsi
movq -0x10428(%rbp), %rdx
movl -0x2a440(%rbp), %ecx
callq 0x1aa0
cmpl $0x0, %eax
je 0x2239
jmp 0x2258
leaq 0x10d2(%rip), %rdi      # 0x3312
leaq 0xe36(%rip), %rsi       # 0x307d
movl $0x137, %edx            # imm = 0x137
leaq 0xf3b(%rip), %rcx       # 0x318e
callq 0x1110
leaq -0x420(%rbp), %rdi
callq 0x1220
movl -0x2a440(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2a440(%rbp)
jmp 0x215a
leaq -0x208(%rbp), %rdi
callq 0x1190
movl $0x0, -0x2a448(%rbp)
movslq -0x2a448(%rbp), %rax
cmpq -0x2a438(%rbp), %rax
jae 0x22c9
leaq -0x2a430(%rbp), %rdi
movslq -0x2a448(%rbp), %rax
imulq $0x68, %rax, %rax
addq %rax, %rdi
callq 0x1220
movl -0x2a448(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2a448(%rbp)
jmp 0x228e
movq -0x10428(%rbp), %rsi
leaq 0x1096(%rip), %rdi      # 0x336d
movb $0x0, %al
callq 0x10f0
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq -0x10420(%rbp), %rsi
movq -0x10428(%rbp), %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x1aa0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1db3
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x2a450, %rsp          # imm = 0x2A450
popq %rbp
retq