// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/t64.c
// Function: de_run_t64
static void de_run_t64(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	i64 pos;
	i64 i;

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

	pos = 32;
	d->version = de_getu16le(pos);
	de_dbg(c, "version: 0x%04x", (int)d->version);
	if(d->version!=0x100 && d->version!=0x101) {
		de_warn(c, "Unexpected version number. This might not be a T64 file.");
	}

	d->max_dir_entries = de_getu16le(pos+2);
	d->used_dir_entries = de_getu16le(pos+4);
	de_dbg(c, "max dir entries = %d, files = %d", (int)d->max_dir_entries, (int)d->used_dir_entries);

	pos += 32;
	for(i=0; i<d->max_dir_entries; i++) {
		do_dir_entry(c, d, i, pos+32*i);
	}

	de_free(c, d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movl $0x18, %esi
callq 0xe969b
movq %rax, %r14
movq 0x18(%rbx), %rdi
movl $0x20, %esi
callq 0xef1ca
movq %rax, (%r14)
leaq 0x6c88b(%rip), %rsi     # 0x13506d
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq %r14, (%rsp)
movq (%r14), %rax
andq $-0x2, %rax
cmpq $0x100, %rax            # imm = 0x100
je 0xc8812
leaq 0x72e54(%rip), %rsi     # 0x13b65c
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9b27
movq 0x18(%rbx), %rdi
movl $0x22, %esi
callq 0xef1ca
movq (%rsp), %r14
movq %rax, 0x8(%r14)
movq 0x18(%rbx), %rdi
movl $0x24, %esi
callq 0xef1ca
movq %rax, 0x10(%r14)
movl 0x8(%r14), %edx
leaq 0x72e50(%rip), %rsi     # 0x13b695
movq %rbx, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0xe9226
cmpq $0x0, 0x8(%r14)
jle 0xc8ab9
movl $0x5f, %r13d
xorl %r12d, %r12d
movq %r12, %rbp
shlq $0x5, %rbp
leaq 0x40(%rbp), %r14
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef0d5
testb %al, %al
je 0xc8a3a
movzbl %al, %r15d
movq %rbx, %rdi
leaq 0x72e2b(%rip), %rsi     # 0x13b6bd
movl %r12d, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x18(%rbx), %rdi
leaq 0x41(%rbp), %rsi
callq 0xef0d5
movzbl %al, %r14d
movq %rbx, %rdi
leaq 0x72e06(%rip), %rsi     # 0x13b6cd
movl %r15d, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0xe9226
testb %r14b, %r14b
je 0xc8a53
movq 0x18(%rbx), %rdi
leaq 0x42(%rbp), %rsi
movq %rsi, 0x18(%rsp)
callq 0xef1ca
movq %rax, %r15
movq 0x18(%rbx), %rdi
leaq 0x44(%rbp), %rsi
callq 0xef1ca
movq %rax, %r14
movq 0x18(%rbx), %rdi
leaq 0x48(%rbp), %rsi
callq 0xef37e
movq %rbx, %rdi
leaq 0x72df5(%rip), %rsi     # 0x13b70e
movq %r15, 0x20(%rsp)
movl %r15d, %edx
movq %r14, 0x8(%rsp)
movl %r14d, %ecx
movq %rax, 0x10(%rsp)
movl %eax, %r8d
xorl %eax, %eax
callq 0xe9226
addq $0x50, %rbp
movl $0x10, %r15d
movq %r13, %r14
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef0d5
cmpb $0x20, %al
jne 0xc8960
decq %r14
decq %r15
jne 0xc8945
xorl %r15d, %r15d
movq %rbx, %rdi
leaq 0x51bb8(%rip), %rsi     # 0x11a522
movl %r15d, %edx
xorl %eax, %eax
callq 0xe93cf
movq %rbx, %rdi
callq 0xf6870
movq %rax, %r14
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %rax, %rcx
xorl %r8d, %r8d
movl $0x15, %r9d
callq 0xf01b0
movq %r14, %rdi
callq 0xf74bd
movq %rbx, %rdi
leaq 0x73028(%rip), %rsi     # 0x13b9d4
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq %r14, %rdi
leaq 0x72d71(%rip), %rsi     # 0x13b731
movl $0x5, %edx
callq 0xf6a40
movq %rbx, %rdi
callq 0xea9a9
movq %rax, %rbp
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0xea9e4
movb $0x1, 0x8(%rbp)
movq 0x8(%rsp), %rax
subq 0x20(%rsp), %rax
js 0xc8a68
movq %rbx, %rdi
xorl %esi, %esi
movq %rbp, %rdx
xorl %ecx, %ecx
movq %rax, 0x8(%rsp)
callq 0xf037a
movq %rax, %r15
movq 0x18(%rbx), %rdi
movl $0x2, %edx
movq 0x18(%rsp), %rsi
movq %rax, %rcx
callq 0xefabc
movq 0x18(%rbx), %rdi
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r15, %rcx
callq 0xefabc
jmp 0xc8a7c
movq %rbx, %rdi
leaq 0x72c72(%rip), %rsi     # 0x13b6b6
movl %r12d, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0xe93cf
jmp 0xc8aa4
movq %rbx, %rdi
leaq 0x72c92(%rip), %rsi     # 0x13b6ef
xorl %edx, %edx
xorl %eax, %eax
callq 0xe9df7
jmp 0xc8a97
movq %rbx, %rdi
leaq 0x72cc4(%rip), %rsi     # 0x13b736
xorl %eax, %eax
callq 0xe9df7
xorl %r15d, %r15d
movq %r15, %rdi
callq 0xf0b13
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xea9b3
movq %r14, %rdi
callq 0xf6bb0
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
incq %r12
addq $0x20, %r13
movq (%rsp), %rax
cmpq 0x8(%rax), %r12
jl 0xc8865
movq %rbx, %rdi
movq (%rsp), %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe9752