// File: /workspace/github_c_makefile_star2_O3/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 $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x67cc6(%rip), %rsi     # 0x143298
xorl %edx, %edx
callq 0xe9bd0
testb %al, %al
je 0xdb607
movl $0xe0, %esi
movq %rbx, %rdi
callq 0xe8b2b
movq %rax, %r14
movl $0x1, 0x4(%rax)
movq 0x30(%rbx), %rax
testq %rax, %rax
je 0xdb63c
movl (%rax), %edx
incl %edx
movl %edx, 0x4(%r14)
jmp 0xdb641
movq 0x30(%rbx), %rax
testq %rax, %rax
je 0xdb733
cmpl $0x0, (%rax)
jle 0xdb733
leaq 0x67c80(%rip), %rsi     # 0x1432a4
movq %rbx, %rdi
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe9295
movl $0x1, %edx
leaq 0x67cb5(%rip), %rsi     # 0x1432fd
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movslq 0x4(%r14), %rsi
movl $0x10, %edx
movq %rbx, %rdi
callq 0xe96f7
movq %rax, 0x88(%r14)
movslq 0x4(%r14), %r12
decq %r12
movq %rbx, %rdi
movl %r12d, %esi
callq 0xebaf7
movq %rax, (%rsp)
testq %rax, %rax
je 0xdb72a
movq %rax, %r13
leaq 0x50(%r14), %rcx
movq %rbx, %rdi
movq %rax, %rsi
movl $0x1, %edx
callq 0xf8ed5
testl %eax, %eax
je 0xdb90d
movl %r12d, 0x48(%r14)
movq 0x50(%r14), %rdx
leaq 0x67c57(%rip), %rsi     # 0x14330e
movq %rbx, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0xe8617
movq 0x50(%r14), %rsi
leaq 0x8(%r14), %r15
movq %r13, %rdi
movq %r15, %rdx
callq 0xdca1a
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %rbx, %rdi
movq %r15, %rsi
callq 0xdcac1
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq %rsp, %rdx
movq %rbx, %rdi
movl %r12d, %esi
callq 0xebb50
cmpb $0x0, 0x40(%r14)
je 0xdb75d
leaq 0x67c29(%rip), %rsi     # 0x143341
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0xdb915
movb $0x1, (%r14)
jmp 0xdb912
movq %rbx, %rdi
movq %r14, %rsi
movl $0x52, %edx
callq 0xea4d9
testl %eax, %eax
je 0xdb967
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
jmp 0xdb986
cmpq %r12, (%r15)
jne 0xdb90d
leaq 0x67ce7(%rip), %rsi     # 0x143454
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movl $0x78, %esi
movq %rbx, %rdi
callq 0xe8b2b
movq %r14, 0x8(%rax)
movb $0x1, 0x15(%rax)
leaq 0x1553(%rip), %rcx      # 0xdccf3
movq %rcx, (%rax)
movq 0x20(%r14), %rcx
movq %rax, 0x10(%rsp)
movq %rcx, 0x30(%rax)
movl $0x100000, %esi         # imm = 0x100000
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf09c5
movq %rax, 0x78(%r14)
cmpl $0x0, 0x4(%r14)
jle 0xdbb29
xorl %r12d, %r12d
xorl %ebp, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0xebaf7
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0xdbb10
movq 0x18(%rax), %r13
movq 0x10(%r14), %rcx
cmpq %rbp, %rcx
jg 0xdb844
cmpq %rbp, (%r15)
jle 0xdb844
movq 0x10(%rsp), %rsi
movq %rax, 0x18(%rsi)
movl %ebp, 0x10(%rsi)
cmpq %rcx, %rbp
jne 0xdb814
movq 0x30(%r14), %rax
jmp 0xdb816
xorl %eax, %eax
movq %rax, 0x20(%rsi)
movq %r13, 0x28(%rsi)
movq %rbx, %rdi
callq 0xdcd15
movq 0x10(%rsp), %rdx
movb 0x39(%rdx), %al
movb %al, (%r14)
movb 0x3a(%rdx), %cl
movb %cl, 0x1(%r14)
testb %al, %al
jne 0xdbb1e
movq 0x48(%rdx), %r13
movq 0x88(%r14), %rdx
cmpb $0x0, (%r14)
movq %r13, (%rdx,%r12)
jne 0xdbb29
testq %r12, %r12
jne 0xdb88f
movq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0xeed0d
movq 0x88(%r14), %rdx
cmpl $0x504b0708, %eax       # imm = 0x504B0708
jne 0xdb88f
addq $-0x4, (%rdx)
movq $0x4, 0x80(%r14)
movl $0x4, %r13d
jmp 0xdb892
xorl %r13d, %r13d
movq 0x78(%r14), %rax
movq 0x18(%rax), %rcx
movq %rcx, 0x8(%rdx,%r12)
movq (%rdx,%r12), %r8
movq %rbx, %rdi
leaq 0x67bc4(%rip), %rsi     # 0x143471
movl %ebp, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x8(%rsp), %rdi
movq 0x88(%r14), %rax
movq (%rax,%r12), %rdx
movq 0x18(%rdi), %rax
addq %rdx, %rax
cmpq $0xbebc201, %rax        # imm = 0xBEBC201
jge 0xdbb16
movq 0x78(%r14), %rcx
movq %r13, %rsi
callq 0xef481
movq %rbx, %rdi
movl %ebp, %esi
leaq 0x8(%rsp), %rdx
callq 0xebb50
incq %rbp
movslq 0x4(%r14), %rax
addq $0x10, %r12
cmpq %rax, %rbp
jl 0xdb7d3
jmp 0xdbb29
movb $0x1, 0x1(%r14)
xorl %r15d, %r15d
movq %r15, %rdi
callq 0xf052b
cmpb $0x0, 0x1(%r14)
je 0xdb935
leaq 0x67a62(%rip), %rsi     # 0x14338d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movq 0x78(%r14), %rdi
callq 0xf052b
movq 0x88(%r14), %rsi
movq %rbx, %rdi
callq 0xe8be2
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe8be2
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x67978(%rip), %rsi     # 0x1432e6
movq %rbx, %rdi
callq 0xe9b74
testq %rax, %rax
je 0xdb999
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %rax, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdbd95
movl $0xc0, %esi
movq %rbx, %rdi
callq 0xe8b2b
movq %rax, %r14
movq %rbx, %rdi
xorl %esi, %esi
movl $0xd, %edx
callq 0xeb220
movl %eax, (%r14)
movl %eax, 0x4(%r14)
movq %rbx, %rdi
movl $0x10, %esi
callq 0xeb499
movq %rax, 0xb8(%r14)
leaq 0x67916(%rip), %rsi     # 0x1432f0
movq %rbx, %rdi
callq 0xe9b74
testq %rax, %rax
je 0xdbaf4
movl $0x1, 0xb0(%r14)
movq $0x0, (%rsp)
movq 0x18(%rbx), %rdi
movq 0x18(%rdi), %r8
cmpq $0x4, %r8
jl 0xdbaff
xorl %r15d, %r15d
subq %r15, %r8
movl $0x4, %edx
leaq 0x69096(%rip), %rsi     # 0x144ab8
movq %r15, %rcx
movq %rsp, %r9
callq 0xf149c
testl %eax, %eax
je 0xdbaff
movq (%rsp), %r13
movq %rbx, %rdi
leaq 0x67cd4(%rip), %rsi     # 0x143717
movq %r13, %rdx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %rbx, %rdi
callq 0xdd40c
movq %rax, %rbp
movq %r13, 0x18(%rax)
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
movq %r13, %r8
leaq 0x8(%rsp), %r9
callq 0xdd449
movb $0x1, %r12b
testl %eax, %eax
je 0xdbaad
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0xddfb3
testl %eax, %eax
je 0xdbaad
movq 0x28(%rbp), %r15
subq %r13, %r15
addq 0x1e8(%rbp), %r15
xorl %r12d, %r12d
jmp 0xdbab0
xorl %r15d, %r15d
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xde5bf
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
testb %r12b, %r12b
jne 0xdbaff
testq %r15, %r15
jle 0xdbaff
addq %r13, %r15
movq $0x0, (%rsp)
movq 0x18(%rbx), %rdi
movq 0x18(%rdi), %r8
leaq -0x4(%r8), %rax
cmpq %rax, %r15
jle 0xdba13
jmp 0xdbaff
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdc0c7
movq 0xb8(%r14), %rdi
callq 0xeb858
jmp 0xdb94d
movb $0x1, (%r14)
jmp 0xdbb29
movw $0x101, (%r14)          # imm = 0x101
jmp 0xdbb29
movq 0x88(%r14), %rax
movq %r13, (%rax,%r12)
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
callq 0xe8be2
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
cmpb $0x0, (%r14)
jne 0xdb912
leaq 0x48(%r14), %rsi
movq %r14, %rdi
callq 0xdcb3b
leaq 0x90(%r14), %r12
movl 0x48(%r14), %ecx
movq 0x50(%r14), %r8
movq 0x58(%r14), %r9
leaq 0x679a5(%rip), %rdx     # 0x143518
xorl %r15d, %r15d
movl $0x50, %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0xe8193
leaq 0x677d6(%rip), %rsi     # 0x143362
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8617
movl 0x10(%r14), %eax
movq %r14, %rsi
addq $0x60, %rsi
movl %eax, 0x60(%r14)
movq 0x30(%r14), %rax
movq %rax, 0x68(%r14)
movq %r14, %rdi
callq 0xdcb3b
cmpb $0x0, (%r14)
jne 0xdb915
movl 0x60(%r14), %ecx
movq 0x68(%r14), %r8
movq 0x70(%r14), %r9
leaq 0x67943(%rip), %rdx     # 0x143518
xorl %r15d, %r15d
movl $0x50, %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0xe8193
leaq 0x6778d(%rip), %rsi     # 0x14337b
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8617
cmpb $0x0, (%r14)
jne 0xdb915
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdcb84
cmpb $0x0, (%r14)
jne 0xdb912
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdcc58
cmpb $0x0, (%r14)
jne 0xdb912
leaq 0x6d331(%rip), %rsi     # 0x148f67
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xefda1
movq %rax, %r15
movq 0x78(%r14), %rdi
movq 0x18(%rdi), %rdx
xorl %esi, %esi
movq %rax, %rcx
callq 0xef481
jmp 0xdb915