// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/zip.c
// Function: de_run_zip
static void de_run_zip(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	const char *s;
	u8 combine_mode = 0;
	de_encoding enc;

	combine_mode = (u8)de_get_ext_option_bool(c, "zip:combine", 0);
	if(combine_mode) {
		do_run_zip_combiner(c, mparams);
		return;
	}
	else {
		if(c->mp_data && c->mp_data->count>0) {
			de_err(c, "Multi-segment archives are only supported with \"-opt zip:combine\"");
			goto done;
		}
	}

	if(de_havemodcode(c, mparams, 'R')) {
		do_run_zip_relocator(c, mparams, 1, NULL);
		return;
	}

	s = de_get_ext_option(c, "zip:reloc");
	if(s) {
		do_run_zip_relocator(c, mparams, 0, s);
		return;
	}

	d = de_malloc(c, sizeof(lctx));

	enc = de_get_input_encoding(c, NULL, DE_ENCODING_CP437);
	d->default_enc_for_filenames = enc;
	d->default_enc_for_comments = enc;

	d->crco = de_crcobj_create(c, DE_CRCOBJ_CRC32_IEEE);

	if(de_get_ext_option(c, "zip:scanmode")) {
		de_run_zip_scanmode(c, d);
	}
	else {
		de_run_zip_normally(c, d);
	}

done:
	if(d) {
		de_crcobj_destroy(d->crco);
		de_free(c, d);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x66e52(%rip), %rsi     # 0x142db8
xorl %edx, %edx
callq 0xea727
testb %al, %al
je 0xdc092
movl $0xe0, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r14
movl $0x1, 0x4(%rax)
movq 0x30(%rbx), %rax
testq %rax, %rax
je 0xdbf9d
movl (%rax), %eax
incl %eax
movl %eax, 0x4(%r14)
movl 0x4(%r14), %edx
leaq 0x66e75(%rip), %rsi     # 0x142e1d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movslq 0x4(%r14), %rsi
movl $0x10, %edx
movq %rbx, %rdi
callq 0xea259
movq %rax, 0x88(%r14)
movslq 0x4(%r14), %r12
decq %r12
movq %rbx, %rdi
movl %r12d, %esi
callq 0xec0f5
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0xdc0ce
leaq 0x50(%r14), %rcx
movq %rbx, %rdi
movq %rax, %rsi
movl $0x1, %edx
callq 0xf93ef
testl %eax, %eax
je 0xdc2cf
movl %r12d, 0x48(%r14)
movq 0x50(%r14), %rdx
leaq 0x66e19(%rip), %rsi     # 0x142e2e
movq %rbx, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0xe9226
leaq 0x10(%rsp), %r13
movq (%r13), %rdi
movq 0x50(%r14), %rsi
leaq 0x8(%r14), %r15
movq %r15, %rdx
callq 0xdd3be
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq %rbx, %rdi
movq %r15, %rsi
callq 0xdd465
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq %rbx, %rdi
movl %r12d, %esi
movq %r13, %rdx
callq 0xec15f
cmpb $0x0, 0x40(%r14)
je 0xdc101
leaq 0x66de1(%rip), %rsi     # 0x142e61
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0xdc2d7
movq 0x30(%rbx), %rax
testq %rax, %rax
je 0xdc0d7
cmpl $0x0, (%rax)
jle 0xdc0d7
leaq 0x66d1d(%rip), %rsi     # 0x142dc4
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
testq %r14, %r14
je 0xdc31f
movq 0xb8(%r14), %rdi
callq 0xebe1d
jmp 0xdc314
movb $0x1, (%r14)
jmp 0xdc2d4
movq %rbx, %rdi
movq %r14, %rsi
movl $0x52, %edx
callq 0xea97e
testl %eax, %eax
je 0xdc32e
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
jmp 0xdc34d
cmpq %r12, (%r15)
jne 0xdc2cf
leaq 0x66e63(%rip), %rsi     # 0x142f74
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movl $0x78, %esi
movq %rbx, %rdi
callq 0xe969b
movq %r14, 0x8(%rax)
movb $0x1, 0x15(%rax)
leaq 0x1553(%rip), %rcx      # 0xdd697
movq %rcx, (%rax)
movq 0x20(%r14), %rcx
movq %rax, 0x8(%rsp)
movq %rcx, 0x30(%rax)
movl $0x100000, %esi         # imm = 0x100000
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf0faf
movq %rax, 0x78(%r14)
cmpl $0x0, 0x4(%r14)
jle 0xdc4d6
xorl %r12d, %r12d
xorl %ebp, %ebp
movq %r15, 0x20(%rsp)
movq %rbx, %rdi
movl %ebp, %esi
callq 0xec0f5
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0xdc4ca
movq 0x18(%rax), %r13
movq 0x10(%r14), %rcx
cmpq %rbp, %rcx
jg 0xdc1f8
cmpq %rbp, (%r15)
jle 0xdc1f8
movq 0x8(%rsp), %rdx
movq %rax, 0x18(%rdx)
movl %ebp, 0x10(%rdx)
cmpq %rcx, %rbp
jne 0xdc1bd
movq 0x30(%r14), %rax
jmp 0xdc1bf
xorl %eax, %eax
movq 0x8(%rsp), %r15
movq %rax, 0x20(%r15)
movq %r13, 0x28(%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0xdd6b9
movb 0x39(%r15), %al
movb %al, (%r14)
movb 0x3a(%r15), %cl
movb %cl, 0x1(%r14)
testb %al, %al
movq 0x20(%rsp), %r15
jne 0xdc1f8
movq 0x8(%rsp), %rax
movq 0x48(%rax), %r13
movq 0x88(%r14), %rax
movq %r13, (%rax,%r12)
cmpb $0x0, (%r14)
jne 0xdc4d6
testq %r12, %r12
je 0xdc217
xorl %r13d, %r13d
jmp 0xdc24d
movq 0x18(%rsp), %rdi
xorl %esi, %esi
callq 0xef32a
movl $0x0, %r13d
cmpl $0x504b0708, %eax       # imm = 0x504B0708
jne 0xdc24d
movq 0x88(%r14), %rax
addq $-0x4, (%rax,%r12)
movq $0x4, 0x80(%r14)
movl $0x4, %r13d
movq 0x78(%r14), %rax
movq 0x88(%r14), %rdx
movq 0x18(%rax), %rcx
movq %rcx, 0x8(%rdx,%r12)
movq (%rdx,%r12), %r8
movq %rbx, %rdi
leaq 0x66d22(%rip), %rsi     # 0x142f91
movl %ebp, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rsp), %rdi
movq 0x88(%r14), %rax
movq (%rax,%r12), %rdx
movq 0x18(%rdi), %rax
addq %rdx, %rax
cmpq $0xbebc201, %rax        # imm = 0xBEBC201
jge 0xdc4d0
movq 0x78(%r14), %rcx
movq %r13, %rsi
callq 0xefabc
movq %rbx, %rdi
movl %ebp, %esi
leaq 0x18(%rsp), %rdx
callq 0xec15f
incq %rbp
movslq 0x4(%r14), %rax
addq $0x10, %r12
cmpq %rax, %rbp
jl 0xdc17c
jmp 0xdc4d6
movb $0x1, 0x1(%r14)
xorl %r15d, %r15d
movq %r15, %rdi
callq 0xf0b13
testq %r14, %r14
je 0xdc31f
cmpb $0x0, 0x1(%r14)
je 0xdc2fc
leaq 0x66bbb(%rip), %rsi     # 0x142ead
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movq 0x78(%r14), %rdi
callq 0xf0b13
movq 0x88(%r14), %rsi
movq %rbx, %rdi
callq 0xe9752
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe9752
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x66ad1(%rip), %rsi     # 0x142e06
movq %rbx, %rdi
callq 0xea6cb
testq %rax, %rax
je 0xdc360
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %rax, %rcx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdc73f
movl $0xc0, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r14
movq %rbx, %rdi
xorl %esi, %esi
movl $0xd, %edx
callq 0xeb7d1
movl %eax, (%r14)
movl %eax, 0x4(%r14)
movq %rbx, %rdi
movl $0x10, %esi
callq 0xeba56
movq %rax, 0xb8(%r14)
leaq 0x66a6f(%rip), %rsi     # 0x142e10
movq %rbx, %rdi
callq 0xea6cb
testq %rax, %rax
je 0xdc4ba
movl $0x1, 0xb0(%r14)
xorl %r13d, %r13d
movq $0x0, 0x10(%rsp)
movq 0x18(%rbx), %rdi
movq 0x18(%rdi), %r8
leaq -0x4(%r8), %rax
cmpq %rax, %r13
jg 0xdc49b
subq %r13, %r8
movl $0x4, %edx
leaq 0x681eb(%rip), %rsi     # 0x1445d8
movq %r13, %rcx
leaq 0x10(%rsp), %r9
callq 0xf1a9c
testl %eax, %eax
je 0xdc49b
movq 0x10(%rsp), %r13
movq %rbx, %rdi
leaq 0x66e26(%rip), %rsi     # 0x143237
movq %r13, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq %rbx, %rdi
callq 0xddda9
movq %rax, %rbp
movq %r13, 0x18(%rax)
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
movq %r13, %r8
leaq 0x18(%rsp), %r9
callq 0xddde6
movb $0x1, %r15b
testl %eax, %eax
je 0xdc47b
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0xde96b
testl %eax, %eax
je 0xdc47b
movq 0x28(%rbp), %r12
subq %r13, %r12
addq 0x1e8(%rbp), %r12
xorl %r15d, %r15d
jmp 0xdc47e
xorl %r12d, %r12d
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xdefa7
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
testb %r15b, %r15b
je 0xdc4aa
xorl %eax, %eax
testb %al, %al
jne 0xdc3c0
jmp 0xdc0b4
testq %r12, %r12
setg %al
jg 0xdc4b5
xorl %r12d, %r12d
addq %r12, %r13
jmp 0xdc49d
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdca7e
jmp 0xdc0b4
movb $0x1, (%r14)
jmp 0xdc4d6
movw $0x101, (%r14)          # imm = 0x101
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
callq 0xe9752
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
cmpb $0x0, (%r14)
jne 0xdc2d4
leaq 0x48(%r14), %rsi
movq %r14, %rdi
callq 0xdd4df
leaq 0x90(%r14), %r12
movl 0x48(%r14), %ecx
movq 0x50(%r14), %r8
movq 0x58(%r14), %r9
leaq 0x66b18(%rip), %rdx     # 0x143038
xorl %r15d, %r15d
movl $0x50, %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0xe8d67
leaq 0x66949(%rip), %rsi     # 0x142e82
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xe9226
movl 0x10(%r14), %eax
leaq 0x60(%r14), %rsi
movl %eax, 0x60(%r14)
movq 0x30(%r14), %rax
movq %rax, 0x68(%r14)
movq %r14, %rdi
callq 0xdd4df
cmpb $0x0, (%r14)
jne 0xdc2d7
movl 0x60(%r14), %ecx
movq 0x68(%r14), %r8
movq 0x70(%r14), %r9
leaq 0x66ab9(%rip), %rdx     # 0x143038
xorl %r15d, %r15d
movl $0x50, %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0xe8d67
leaq 0x66903(%rip), %rsi     # 0x142e9b
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xe9226
cmpb $0x0, (%r14)
jne 0xdc2d7
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdd528
cmpb $0x0, (%r14)
jne 0xdc2d4
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdd5fc
cmpb $0x0, (%r14)
jne 0xdc2d4
leaq 0x6c3ef(%rip), %rsi     # 0x1489cf
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xf037a
movq %rax, %r15
movq 0x78(%r14), %rdi
movq 0x18(%rdi), %rdx
xorl %esi, %esi
movq %rax, %rcx
callq 0xefabc
jmp 0xdc2d7