// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pif.c
// Function: do_pif_main
static void do_pif_main(deark *c, de_module_params *mparams, int is_dvp)
{
	const char *tmps;
	struct pif_ctx *d = NULL;
	int is_oldfmt = 0;

	d = de_malloc(c, sizeof(struct pif_ctx));
	d->tmpstr = ucstring_create(c);

	d->input_encoding_ansi = de_get_input_encoding(c, NULL, DE_ENCODING_WINDOWS1252);

	d->input_encoding_oem = DE_ENCODING_CP437; // default
	tmps = de_get_ext_option(c, "oemenc");
	if(tmps) {
		d->input_encoding_oem = de_encoding_name_to_code(tmps);
		if(d->input_encoding_oem == DE_ENCODING_UNKNOWN) {
			d->input_encoding_oem = DE_ENCODING_CP437;
		}
	}

	d->pos_seen = de_inthashtable_create(c);

	if(!is_dvp && (c->infile->len < PIF_BASIC_SECTION_SIZE+22)) {
		is_oldfmt = 1;
	}

	if(is_oldfmt) {
		do_pif_section_basic(c, d, 0, PIF_BASIC_SECTION_SIZE);
	}
	else if(is_dvp) {
		do_pif_section_basic(c, d, 0, PIF_BASIC_SECTION_SIZE);
		do_dvp_extensions(c, d);
	}
	else {
		do_pif_sections(c, d);
	}

	if(d) {
		ucstring_destroy(d->tmpstr);
		de_inthashtable_destroy(c, d->pos_seen);
		de_free(c, d);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movl $0x28, %esi
callq 0xe969b
movq %rax, %r14
movq %rbx, %rdi
callq 0xf6870
movq %rax, 0x8(%r14)
movq %rbx, %rdi
xorl %esi, %esi
movl $0x9, %edx
callq 0xeb7d1
movl %eax, 0x4(%r14)
movl $0xd, (%r14)
leaq 0x652e2(%rip), %rsi     # 0x123126
movq %rbx, %rdi
callq 0xea6cb
testq %rax, %rax
je 0xbde66
movq %rax, %rdi
callq 0xed185
testl %eax, %eax
movl $0xd, %ecx
cmovnel %eax, %ecx
movl %ecx, (%r14)
movq %rbx, %rdi
callq 0xeb85a
movq %rax, 0x18(%r14)
testl %ebp, %ebp
je 0xbdef0
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xbe608
movq 0x8(%r14), %rdi
callq 0xf6883
movq 0x18(%rbx), %rdi
movq 0x8(%r14), %rcx
movl $0x171, %esi            # imm = 0x171
movl $0x2, %edx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0xf01b0
movq 0x8(%r14), %rdi
callq 0xf7557
leaq 0x7b025(%rip), %rsi     # 0x138ee1
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movl $0x17e, %esi            # imm = 0x17E
callq 0xef0d5
movzbl %al, %edx
leaq 0x7b00b(%rip), %rsi     # 0x138eec
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
jmp 0xbe5d9
movq 0x18(%rbx), %rax
cmpq $0x186, 0x18(%rax)      # imm = 0x186
jle 0xbe5cc
movq $0x171, 0x10(%r14)      # imm = 0x171
movq 0x10(%r14), %r15
cmpq $0xffff, %r15           # imm = 0xFFFF
je 0xbe5d9
movq $0xffff, 0x10(%r14)     # imm = 0xFFFF
leaq 0x16(%r15), %rax
movq 0x18(%rbx), %rcx
cmpq 0x18(%rcx), %rax
jg 0xbe5d9
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xbe81b
testl %eax, %eax
je 0xbe5d9
movq %r15, 0x18(%rsp)
movq %rbx, %rdi
leaq 0x24(%rsp), %rsi
callq 0xe958c
movq %rbx, %rdi
leaq 0x5e1db(%rip), %rsi     # 0x11c142
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x18(%rbx), %rdi
movq 0x18(%rsp), %rsi
movl 0x4(%r14), %r9d
movl $0x10, %edx
movl $0x10, %ecx
movl $0x1, %r8d
callq 0xefe67
movq %rax, %r15
movq 0x18(%rax), %rdi
callq 0xf7557
movq %rbx, %rdi
leaq 0x645bd(%rip), %rsi     # 0x122573
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
addq $0x10, 0x18(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %r13
movq %r13, %rsi
callq 0xef1ed
movq %rax, 0x10(%r14)
movq %rbx, %rdi
leaq 0x7af31(%rip), %rsi     # 0x138f16
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xef1ed
movq %rax, %r12
movq %rbx, %rdi
leaq 0x67dfd(%rip), %rsi     # 0x125e05
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xef1ed
movq %rax, %r13
movq %rbx, %rdi
leaq 0x74820(%rip), %rsi     # 0x13284b
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x10(%r14), %rbp
testq %r13, %r13
je 0xbe054
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xbe81b
testl %eax, %eax
je 0xbe5a6
movq %rbp, 0x10(%rsp)
movq %rbx, %rdi
leaq 0x7aec9(%rip), %rsi     # 0x138f2c
movq %r12, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x8(%r15), %rbp
movq %rbp, %rdi
leaq 0x7aebe(%rip), %rsi     # 0x138f49
callq 0x181a0
testl %eax, %eax
je 0xbe149
movq %rbp, %rdi
leaq 0x7aeb7(%rip), %rsi     # 0x138f59
callq 0x181a0
testl %eax, %eax
je 0xbe15c
movq %rbp, %rdi
leaq 0x7aeb0(%rip), %rsi     # 0x138f69
callq 0x181a0
testl %eax, %eax
je 0xbe1d4
movq %rbp, %rdi
leaq 0x7aea9(%rip), %rsi     # 0x138f79
callq 0x181a0
testl %eax, %eax
je 0xbe349
movq %rbp, %rdi
leaq 0x7aea2(%rip), %rsi     # 0x138f89
callq 0x181a0
testl %eax, %eax
je 0xbe4c7
movq %rbp, %rdi
leaq 0x7ae9b(%rip), %rsi     # 0x138f99
callq 0x181a0
testl %eax, %eax
je 0xbe573
movq %rbp, %rdi
leaq 0x7aea1(%rip), %rsi     # 0x138fb6
callq 0x181a0
movq 0x18(%rbx), %rsi
testl %eax, %eax
je 0xbe586
movl $0x1, (%rsp)
movl $0x100, %r8d            # imm = 0x100
movq %rbx, %rdi
movq %r12, %rdx
movq %r13, %rcx
xorl %r9d, %r9d
callq 0xe975a
jmp 0xbe5a1
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xbe608
jmp 0xbe5a1
movq %r12, 0x8(%rsp)
cmpq $0x6, %r13
jl 0xbe5a1
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %r12
movq %r12, %rsi
callq 0xef1ed
movq %rbx, %rdi
leaq 0x7ae4b(%rip), %rsi     # 0x138fd1
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef1ed
movq %rbx, %rdi
leaq 0x7ae38(%rip), %rsi     # 0x138fde
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef1ed
movq %rbx, %rdi
leaq 0x6af37(%rip), %rsi     # 0x1290fd
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
jmp 0xbe5a1
movq %r12, 0x8(%rsp)
cmpq $0x68, %r13
jl 0xbe5a1
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %r13
movq %r13, %rsi
callq 0xef1ed
movq %rbx, %rdi
leaq 0x7aded(%rip), %rsi     # 0x138feb
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xef1ed
movq %rbx, %rdi
leaq 0x7ade7(%rip), %rsi     # 0x139005
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
addq $0x4, 0x8(%rsp)
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xef1ed
movq %rbx, %rdi
leaq 0x7addb(%rip), %rsi     # 0x13901f
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xef1ed
movq %rbx, %rdi
leaq 0x7adc8(%rip), %rsi     # 0x13902c
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xef1ed
movq %rbx, %rdi
leaq 0x7ad4d(%rip), %rsi     # 0x138fd1
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xef1ed
movq %rbx, %rdi
leaq 0x7ad3a(%rip), %rsi     # 0x138fde
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xef3a0
movq %rbx, %rdi
leaq 0x7ad75(%rip), %rsi     # 0x139039
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xef1ed
movq %rbx, %rdi
leaq 0x7ad65(%rip), %rsi     # 0x139048
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
addq $0x28, %r12
movq %r12, 0x8(%rsp)
movq 0x8(%r14), %rdi
callq 0xf6883
movq 0x18(%rbx), %rdi
movq 0x8(%rsp), %rsi
movq 0x8(%r14), %rcx
movl (%r14), %r9d
movl $0x40, %edx
movl $0x1, %r8d
callq 0xf01b0
movq 0x8(%r14), %rdi
callq 0xf6900
movq 0x8(%r14), %rdi
callq 0xf7557
movq %rbx, %rdi
leaq 0x734a1(%rip), %rsi     # 0x1317db
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
jmp 0xbe5a1
movq %r12, 0x8(%rsp)
cmpq $0x1ac, %r13            # imm = 0x1AC
movq 0x10(%rsp), %rbp
jl 0xbe5a6
leaq 0x58(%r12), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%r14), %rdi
callq 0xf6883
movq 0x18(%rbx), %rdi
movq 0x8(%rsp), %rsi
movq 0x8(%r14), %rcx
movl 0x4(%r14), %r9d
movl $0x50, %edx
movl $0x1, %r8d
callq 0xf01b0
movq 0x8(%r14), %rdi
callq 0xf7557
movq %rbx, %rdi
leaq 0x7acb0(%rip), %rsi     # 0x139057
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
addq $0x50, 0x8(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0xef1ed
movq %rbx, %rdi
leaq 0x7ac98(%rip), %rsi     # 0x139067
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
leaq 0xea(%r12), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%r14), %rdi
callq 0xf6883
movq 0x18(%rbx), %rdi
movq 0x8(%rsp), %rsi
movq 0x8(%r14), %rcx
movl 0x4(%r14), %r9d
movl $0x20, %edx
movl $0x1, %r8d
callq 0xf01b0
movq 0x8(%r14), %rdi
callq 0xf7557
movq %rbx, %rdi
leaq 0x7ac50(%rip), %rsi     # 0x139073
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
addq $0x20, 0x8(%rsp)
movq 0x8(%r14), %rdi
callq 0xf6883
movq 0x18(%rbx), %rdi
movq 0x8(%rsp), %rsi
movq 0x8(%r14), %rcx
movl 0x4(%r14), %r9d
movl $0x20, %edx
movl $0x1, %r8d
callq 0xf01b0
movq 0x8(%r14), %rdi
callq 0xf7557
movq %rbx, %rdi
leaq 0x7ac15(%rip), %rsi     # 0x139085
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
addq $0x156, %r12            # imm = 0x156
movq %r12, 0x8(%rsp)
movq 0x8(%r14), %rdi
callq 0xf6883
movq 0x18(%rbx), %rdi
movq 0x8(%rsp), %rsi
movq 0x8(%r14), %rcx
movl (%r14), %r9d
movl $0x50, %edx
movl $0x1, %r8d
callq 0xf01b0
movq 0x8(%r14), %rdi
callq 0xf7557
movq %rbx, %rdi
leaq 0x7abd7(%rip), %rsi     # 0x139099
jmp 0xbe567
cmpq $0x8c, %r13
movq 0x10(%rsp), %rbp
jl 0xbe5a6
movq 0x18(%rsp), %r12
leaq 0xc(%r12), %r13
movq 0x8(%r14), %rdi
callq 0xf6883
movq 0x18(%rbx), %rdi
movq 0x8(%r14), %rcx
movl 0x4(%r14), %r9d
movl $0x40, %edx
movq %r13, %rsi
movl $0x1, %r8d
callq 0xf01b0
movq 0x8(%r14), %rdi
callq 0xf7557
movq %rbx, %rdi
leaq 0x7ab8a(%rip), %rsi     # 0x1390a8
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
addq $0x4c, %r12
movq 0x8(%r14), %rdi
callq 0xf6883
movq 0x18(%rbx), %rdi
movq 0x8(%r14), %rcx
movl 0x4(%r14), %r9d
movl $0x40, %edx
movq %r12, %rsi
movl $0x1, %r8d
callq 0xf01b0
movq 0x8(%r14), %rdi
callq 0xf7557
movq %rbx, %rdi
leaq 0x7ab56(%rip), %rsi     # 0x1390bd
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
jmp 0xbe5a6
movq 0x18(%rbx), %rdi
movq %r12, %rsi
movq %r13, %rdx
leaq 0x7aa25(%rip), %rcx     # 0x138fa9
jmp 0xbe596
movq %rsi, %rdi
movq %r12, %rsi
movq %r13, %rdx
leaq 0x7aa30(%rip), %rcx     # 0x138fc6
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xf0321
movq 0x10(%rsp), %rbp
movq %rbx, %rdi
movq %r15, %rsi
callq 0xf00aa
movl 0x24(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
cmpq $0xffff, %rbp           # imm = 0xFFFF
jne 0xbdf0a
jmp 0xbe5d9
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xbe608
movq 0x8(%r14), %rdi
callq 0xf6bb0
movq 0x18(%r14), %rsi
movq %rbx, %rdi
callq 0xeb864
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe9752
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq