// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/zip.c
// Function: de_run_zip_normally
static void de_run_zip_normally(deark *c, lctx *d)
{
	int eocd_found;

	if(c->detection_data && c->detection_data->zip_eocd_looked_for) {
		eocd_found = (int)c->detection_data->zip_eocd_found;
		d->eocd_pos = c->detection_data->zip_eocd_pos;
	}
	else {
		eocd_found = fmtutil_find_zip_eocd(c, c->infile, 0, &d->eocd_pos);
	}
	if(!eocd_found) {
		if(c->module_disposition==DE_MODDISP_AUTODETECT ||
			c->module_disposition==DE_MODDISP_EXPLICIT)
		{
			u32 bof_sig;

			bof_sig = (u32)de_getu32be(0);
			if(bof_sig==CODE_PK78) {
				de_err(c, "This looks like the first segment of a multi-segment ZIP archive.");
				print_multisegment_note(c, d);
				goto done;
			}
			if(bof_sig==CODE_PK34) {
				de_err(c, "ZIP central directory not found. "
					"You could try \"-opt zip:scanmode\".");
				goto done;
			}
		}
		de_err(c, "Not a valid ZIP file");
		goto done;
	}

	de_dbg(c, "end-of-central-dir record found at %"I64_FMT,
		d->eocd_pos);

	do_zip64_eocd_locator(c, d);

	if(d->is_zip64) {
		if(!do_zip64_eocd(c, d)) goto done;
	}

	check_for_resof_fmt(c, d);

	if(d->is_zip64)
		de_declare_fmt(c, "ZIP-Zip64");
	else if(d->is_resof)
		de_declare_fmt(c, "SOF/RESOF");
	else
		de_declare_fmt(c, "ZIP");

	if(!do_end_of_central_dir(c, d)) {
		goto done;
	}

	if(!do_central_dir(c, d)) {
		goto done;
	}

done:
	;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x147f44
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movzbl 0x6(%rax), %eax
cmpl $0x0, %eax
je 0x147f44
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movzbl 0x7(%rax), %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x88(%rax)
jmp 0x147f65
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x10(%rbp), %rcx
addq $0x88, %rcx
xorl %edx, %edx
callq 0x1750a0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x147ffd
movq -0x8(%rbp), %rax
cmpl $0x1, 0x24(%rax)
je 0x147f83
movq -0x8(%rbp), %rax
cmpl $0x2, 0x24(%rax)
jne 0x147fe6
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x165470
movl %eax, -0x18(%rbp)
cmpl $0x504b0708, -0x18(%rbp) # imm = 0x504B0708
jne 0x147fc4
movq -0x8(%rbp), %rdi
leaq 0x88047(%rip), %rsi     # 0x1cfff2
movb $0x0, %al
callq 0x15bfb0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x14d200
jmp 0x1480d4
cmpl $0x504b0304, -0x18(%rbp) # imm = 0x504B0304
jne 0x147fe4
movq -0x8(%rbp), %rdi
leaq 0x8805c(%rip), %rsi     # 0x1d0034
movb $0x0, %al
callq 0x15bfb0
jmp 0x1480d4
jmp 0x147fe6
movq -0x8(%rbp), %rdi
leaq 0x88087(%rip), %rsi     # 0x1d0078
movb $0x0, %al
callq 0x15bfb0
jmp 0x1480d4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rdx
leaq 0x870bb(%rip), %rsi     # 0x1cf0ce
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x14d240
movq -0x10(%rbp), %rax
cmpb $0x0, 0xac(%rax)
je 0x14804d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x14d390
cmpl $0x0, %eax
jne 0x14804b
jmp 0x1480d4
jmp 0x14804d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x14d760
movq -0x10(%rbp), %rax
cmpb $0x0, 0xac(%rax)
je 0x148079
movq -0x8(%rbp), %rdi
leaq 0x8801b(%rip), %rsi     # 0x1d008d
callq 0x15e380
jmp 0x1480aa
movq -0x10(%rbp), %rax
cmpb $0x0, 0xad(%rax)
je 0x148098
movq -0x8(%rbp), %rdi
leaq 0x88006(%rip), %rsi     # 0x1d0097
callq 0x15e380
jmp 0x1480a8
movq -0x8(%rbp), %rdi
leaq 0x69a29(%rip), %rsi     # 0x1b1acc
callq 0x15e380
jmp 0x1480aa
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x14d810
cmpl $0x0, %eax
jne 0x1480be
jmp 0x1480d4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x14dd90
cmpl $0x0, %eax
jne 0x1480d2
jmp 0x1480d4
jmp 0x1480d4
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)