// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/zip.c
// Function: do_zip64_eocd
static int do_zip64_eocd(deark *c, lctx *d)
{
	i64 pos;
	i64 n;
	int retval = 0;
	int saved_indent_level;
	UI ver, ver_hi, ver_lo;

	de_dbg_indent_save(c, &saved_indent_level);

	if(d->zip64_eocd_segnum!=0) {
		de_warn(c, "This might be a multi-segment Zip64 archive, which is not supported");
		retval = 1;
		d->is_zip64 = 0;
		goto done;
	}

	pos = d->zip64_eocd_pos;
	if(dbuf_memcmp(c->infile, pos, g_zipsig66, 4)) {
		de_warn(c, "Expected Zip64 end-of-central-directory record not found at %"I64_FMT, pos);
		retval = 1; // Maybe the eocd locator sig was a false positive?
		d->is_zip64 = 0;
		goto done;
	}

	de_dbg(c, "zip64 end-of-central-dir record at %"I64_FMT, pos);
	pos += 4;
	de_dbg_indent(c, 1);

	n = de_geti64le(pos); pos += 8;
	de_dbg(c, "size of zip64 eocd record: (12+)%"I64_FMT, n);

	ver = (UI)de_getu16le_p(&pos);
	ver_hi = (ver&0xff00)>>8;
	ver_lo = ver&0x00ff;
	de_dbg(c, "version made by: platform=%u (%s), ZIP spec=%u.%u",
		ver_hi, get_platform_name(ver_hi), (UI)(ver_lo/10), (UI)(ver_lo%10));

	ver = (UI)de_getu16le_p(&pos);
	ver_hi = (ver&0xff00)>>8;
	ver_lo = ver&0x00ff;
	de_dbg(c, "version needed: platform=%u (%s), ZIP spec=%u.%u",
		ver_hi, get_platform_name(ver_hi), (UI)(ver_lo/10), (UI)(ver_lo%10));

	n = de_getu32le_p(&pos);
	de_dbg(c, "this segment num: %"I64_FMT, n);

	d->eocd64.cdir_starting_seg_num = de_getu32le_p(&pos);
	d->eocd64.cdir_num_entries_this_seg = de_geti64le(pos); pos += 8;
	de_dbg(c, "central dir num entries on this segment: %"I64_FMT, d->eocd64.cdir_num_entries_this_seg);
	de_sanitize_count(&d->eocd64.cdir_num_entries_this_seg);
	d->eocd64.cdir_num_entries_total = de_geti64le(pos); pos += 8;
	de_dbg(c, "central dir num entries: %"I64_FMT, d->eocd64.cdir_num_entries_total);
	de_sanitize_count(&d->eocd64.cdir_num_entries_this_seg);
	d->eocd64.cdir_byte_size = de_geti64le(pos); pos += 8;
	de_dbg(c, "central dir size: %"I64_FMT, d->eocd64.cdir_byte_size);
	de_sanitize_length(&d->eocd64.cdir_byte_size);
	d->eocd64.cdir_offset = de_geti64le(pos); pos += 8;
	de_dbg(c, "central dir offset: %"I64_FMT", segment: %u",
		d->eocd64.cdir_offset, (UI)d->eocd64.cdir_starting_seg_num);
	de_sanitize_offset(&d->eocd64.cdir_offset);

	retval = 1;
done:
	de_dbg_indent_restore(c, saved_indent_level);
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x15b580
movq -0x10(%rbp), %rax
cmpq $0x0, 0x98(%rax)
je 0x14d3eb
movq -0x8(%rbp), %rdi
leaq 0x82d82(%rip), %rsi     # 0x1d014f
movb $0x0, %al
callq 0x15bc10
movl $0x1, -0x24(%rbp)
movq -0x10(%rbp), %rax
movb $0x0, 0xac(%rax)
jmp 0x14d746
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
leaq 0x831e5(%rip), %rdx     # 0x1d05f2
movl $0x4, %ecx
callq 0x166ab0
cmpl $0x0, %eax
je 0x14d449
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x82d68(%rip), %rsi     # 0x1d0193
movb $0x0, %al
callq 0x15bc10
movl $0x1, -0x24(%rbp)
movq -0x10(%rbp), %rax
movb $0x0, 0xac(%rax)
jmp 0x14d746
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x82d7b(%rip), %rsi     # 0x1d01d3
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x1657e0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x82d51(%rip), %rsi     # 0x1d01fa
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x1652c0
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
shrl $0x8, %eax
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
andl $0xff, %eax
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x30(%rbp), %edi
callq 0x14a1e0
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movl -0x34(%rbp), %eax
movl $0xa, %esi
xorl %edx, %edx
divl %esi
movl %eax, %r8d
movl -0x34(%rbp), %eax
movl $0xa, %esi
xorl %edx, %edx
divl %esi
movl %edx, %r9d
movl -0x44(%rbp), %edx
leaq 0x81dfa(%rip), %rsi     # 0x1cf31c
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x1652c0
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
shrl $0x8, %eax
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
andl $0xff, %eax
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x30(%rbp), %edi
callq 0x14a1e0
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movl -0x34(%rbp), %eax
movl $0xa, %esi
xorl %edx, %edx
divl %esi
movl %eax, %r8d
movl -0x34(%rbp), %eax
movl $0xa, %esi
xorl %edx, %edx
divl %esi
movl %edx, %r9d
movl -0x38(%rbp), %edx
leaq 0x82c83(%rip), %rsi     # 0x1d021e
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x165580
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x81951(%rip), %rsi     # 0x1cef17
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x165580
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x1657e0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rdx
leaq 0x81909(%rip), %rsi     # 0x1cef2d
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
addq $0x10, %rdi
callq 0x15f830
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x1657e0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdx
leaq 0x818e3(%rip), %rsi     # 0x1cef5a
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
addq $0x10, %rdi
callq 0x15f830
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x1657e0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rdx
leaq 0x818ad(%rip), %rsi     # 0x1cef77
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
addq $0x20, %rdi
callq 0x15f830
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x1657e0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movl %eax, %ecx
leaq 0x82b28(%rip), %rsi     # 0x1d024f
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
addq $0x28, %rdi
callq 0x15f830
movl $0x1, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x15b5a0
movl -0x24(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)