// File: /workspace/github_cpp_makefile_star2_O1/rpavlik[P]edid-decode/edid-decode.cpp
// Function: edid_to_file(char const*, output_format)
static int edid_to_file(const char *to_file, enum output_format out_fmt)
{
	FILE *out;

	if (!strcmp(to_file, "-")) {
		to_file = "stdout";
		out = stdout;
	} else if ((out = fopen(to_file, "w")) == NULL) {
		perror(to_file);
		return -1;
	}
	if (out_fmt == OUT_FMT_DEFAULT)
		out_fmt = out == stdout ? OUT_FMT_HEX : OUT_FMT_RAW;

	switch (out_fmt) {
	default:
	case OUT_FMT_HEX:
		hexdumpedid(out, edid, state.edid_size);
		break;
	case OUT_FMT_RAW:
		fwrite(edid, state.edid_size, 1, out);
		break;
	case OUT_FMT_CARRAY:
		carraydumpedid(out, edid, state.edid_size);
		break;
	case OUT_FMT_XML:
		xmldumpedid(out, edid, state.edid_size);
		break;
	}

	if (out != stdout)
		fclose(out);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebp
movq %rdi, %r14
leaq 0x19520(%rip), %rsi     # 0x2135a
callq 0x3320
testl %eax, %eax
je 0x7e6c
leaq 0x18a78(%rip), %rsi     # 0x208c2
movq %r14, %rdi
callq 0x32b0
movq %rax, %rbx
testq %rax, %rax
jne 0x7e76
movq %r14, %rdi
callq 0x31e0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x8120
movq 0x3213d(%rip), %rax     # 0x39fb0
movq (%rax), %rbx
movq 0x32133(%rip), %rcx     # 0x39fb0
xorl %eax, %eax
cmpq (%rcx), %rbx
setne %al
incl %eax
testl %ebp, %ebp
cmovnel %ebp, %eax
movl 0x3284e(%rip), %ecx     # 0x3a6e0
movq %rcx, (%rsp)
cmpl $0x2, %eax
je 0x80f2
cmpl $0x3, %eax
je 0x7fba
cmpl $0x4, %eax
jne 0x8131
leaq 0x192d1(%rip), %rdi     # 0x21189
movl $0x37, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x3430
leaq 0x192f0(%rip), %rdi     # 0x211c1
movl $0xa, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x3430
leaq 0x192e2(%rip), %rdi     # 0x211cc
movl $0x27, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x3430
leaq 0x192f1(%rip), %rdi     # 0x211f4
movl $0xb, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x3430
cmpl $0x80, (%rsp)
jb 0x7f90
movq (%rsp), %rax
shrl $0x7, %eax
movq %rax, (%rsp)
leaq 0x37280(%rip), %r14     # 0x3f1b0
leaq 0x18584(%rip), %r12     # 0x204bb
leaq 0x192d4(%rip), %r13     # 0x21212
xorl %ebp, %ebp
movq %rbx, %rdi
leaq 0x192b6(%rip), %rsi     # 0x21200
movl %ebp, %edx
xorl %eax, %eax
callq 0x3330
xorl %r15d, %r15d
movzbl (%r14,%r15), %edx
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x3330
incq %r15
cmpq $0x80, %r15
jne 0x7f56
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x3330
incq %rbp
subq $-0x80, %r14
cmpq (%rsp), %rbp
jne 0x7f40
leaq 0x19287(%rip), %rdi     # 0x2121e
movl $0xc, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x3430
leaq 0x1927b(%rip), %rdi     # 0x2122b
movl $0xb, %esi
jmp 0x80eb
leaq 0x19158(%rip), %rdi     # 0x21119
movl $0x1f, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x3430
cmpl $0x80, (%rsp)
jb 0x80df
movq (%rsp), %rax
shrl $0x7, %eax
movq %rax, (%rsp)
leaq 0x371be(%rip), %r14     # 0x3f1b0
leaq 0x19149(%rip), %r12     # 0x21142
xorl %ebp, %ebp
testq %rbp, %rbp
je 0x800d
movl $0xa, %edi
movq %rbx, %rsi
callq 0x32e0
movq %rbp, 0x8(%rsp)
shlq $0x7, %rbp
movq %r14, 0x10(%rsp)
xorl %r15d, %r15d
leaq (%r15,%rbp), %rax
leaq 0x37187(%rip), %rcx     # 0x3f1b0
movzbl (%rcx,%rax), %edx
movq %rbx, %rdi
leaq 0x19102(%rip), %rsi     # 0x21139
xorl %eax, %eax
callq 0x3330
movl $0x1, %r13d
movzbl (%r14,%r13), %edx
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x3330
incq %r13
cmpq $0x8, %r13
jne 0x8044
movl $0xa, %edi
movq %rbx, %rsi
callq 0x32e0
leaq 0x8(%r15), %rax
addq $0x8, %r14
cmpq $0x78, %r15
movq %rax, %r15
jb 0x801e
xorl %eax, %eax
xorl %ecx, %ecx
movq 0x10(%rsp), %r14
addb (%r14,%rax), %cl
incq %rax
cmpq $0x7f, %rax
jne 0x8086
leaq 0x37116(%rip), %rax     # 0x3f1b0
addb 0x7f(%rbp,%rax), %cl
movq 0x8(%rsp), %rbp
je 0x80ce
xorl %eax, %eax
xorl %ecx, %ecx
addb (%r14,%rax), %cl
incq %rax
cmpq $0x7f, %rax
jne 0x80a9
negb %cl
movzbl %cl, %ecx
movq %rbx, %rdi
leaq 0x19086(%rip), %rsi     # 0x2114b
movl %ebp, %edx
xorl %eax, %eax
callq 0x3330
incq %rbp
subq $-0x80, %r14
cmpq (%rsp), %rbp
jne 0x7ffb
leaq 0x1909f(%rip), %rdi     # 0x21185
movl $0x3, %esi
movl $0x1, %edx
jmp 0x8102
leaq 0x370b7(%rip), %rdi     # 0x3f1b0
movl $0x1, %edx
movq (%rsp), %rsi
movq %rbx, %rcx
callq 0x3430
xorl %ebp, %ebp
movq 0x31e9d(%rip), %rax     # 0x39fb0
cmpq (%rax), %rbx
je 0x8120
movq %rbx, %rdi
callq 0x3240
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x80, (%rsp)
jb 0x810a
movq (%rsp), %rax
shrl $0x7, %eax
movq %rax, (%rsp)
leaq 0x37064(%rip), %r13     # 0x3f1b0
leaq 0x18f8d(%rip), %r12     # 0x210e0
xorl %ebp, %ebp
testq %rbp, %rbp
je 0x8167
movl $0xa, %edi
movq %rbx, %rsi
callq 0x32e0
movq %rbp, 0x8(%rsp)
shlq $0x7, %rbp
movq %r13, 0x10(%rsp)
xorl %r15d, %r15d
leaq (%r15,%rbp), %rax
leaq 0x3702d(%rip), %rcx     # 0x3f1b0
movzbl (%rcx,%rax), %edx
movq %rbx, %rdi
leaq 0x18f50(%rip), %rsi     # 0x210e1
xorl %eax, %eax
callq 0x3330
movl $0x1, %r14d
movzbl (%r13,%r14), %edx
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x3330
incq %r14
cmpq $0x10, %r14
jne 0x819e
movl $0xa, %edi
movq %rbx, %rsi
callq 0x32e0
leaq 0x10(%r15), %rax
addq $0x10, %r13
cmpq $0x70, %r15
movq %rax, %r15
jb 0x8178
xorl %eax, %eax
xorl %ecx, %ecx
movq 0x10(%rsp), %r13
addb (%r13,%rax), %cl
incq %rax
cmpq $0x7f, %rax
jne 0x81e1
leaq 0x36fba(%rip), %rax     # 0x3f1b0
addb 0x7f(%rbp,%rax), %cl
movq 0x8(%rsp), %rbp
je 0x822b
xorl %eax, %eax
xorl %ecx, %ecx
addb (%r13,%rax), %cl
incq %rax
cmpq $0x7f, %rax
jne 0x8205
negb %cl
movzbl %cl, %ecx
movq %rbx, %rdi
leaq 0x18ec4(%rip), %rsi     # 0x210e6
movl %ebp, %edx
xorl %eax, %eax
callq 0x3330
incq %rbp
subq $-0x80, %r13
cmpq (%rsp), %rbp
jne 0x8155
jmp 0x810a