// File: /workspace/github_c_makefile_star2_O2/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 $0x38, %rsp
movq %rdi, %rbx
pushq $0x18
popq %rsi
callq 0xdecaf
movq %rax, %r15
movq 0x18(%rbx), %rdi
pushq $0x20
popq %rsi
callq 0xe3fa3
movq %rax, (%r15)
leaq 0x684eb(%rip), %rsi     # 0x128119
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq (%r15), %rax
andq $-0x2, %rax
cmpq $0x100, %rax            # imm = 0x100
je 0xbfc5a
leaq 0x6ead4(%rip), %rsi     # 0x12e724
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf05a
movq 0x18(%rbx), %rdi
pushq $0x22
popq %rsi
callq 0xe3fa3
movq %rax, 0x8(%r15)
movq 0x18(%rbx), %rdi
pushq $0x24
popq %rsi
callq 0xe3fa3
movq %rax, 0x10(%r15)
movl 0x8(%r15), %edx
leaq 0x6ead8(%rip), %rsi     # 0x12e75d
movq %rbx, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0xde896
pushq $0x5f
popq %rbp
xorl %r13d, %r13d
movq %r15, 0x10(%rsp)
cmpq 0x8(%r15), %r13
jge 0xbff07
movq %r13, %r12
shlq $0x5, %r12
leaq 0x40(%r12), %r14
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3eb4
testb %al, %al
je 0xbfdaf
movq %rbp, 0x8(%rsp)
movzbl %al, %ebp
movq %rbx, %rdi
leaq 0x6eaad(%rip), %rsi     # 0x12e785
movl %r13d, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0xdeba7
movq 0x18(%rbx), %rdi
leaq 0x41(%r12), %rsi
callq 0xe3eb4
movzbl %al, %r14d
movq %rbx, %rdi
leaq 0x6ea89(%rip), %rsi     # 0x12e795
movl %ebp, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0xde896
testb %r14b, %r14b
je 0xbfdcb
movq 0x18(%rbx), %rdi
leaq 0x42(%r12), %rsi
movq %rsi, 0x20(%rsp)
callq 0xe3fa3
movq %rax, %r15
movq 0x18(%rbx), %rdi
leaq 0x44(%r12), %rsi
callq 0xe3fa3
movq %rax, %r14
movq 0x18(%rbx), %rdi
leaq 0x48(%r12), %rsi
callq 0xe409f
movq %rbx, %rdi
leaq 0x6ea76(%rip), %rsi     # 0x12e7d6
movq %r15, 0x28(%rsp)
movl %r15d, %edx
movq %r14, 0x30(%rsp)
movl %r14d, %ecx
movq %rax, 0x18(%rsp)
movl %eax, %r8d
xorl %eax, %eax
callq 0xde896
addq $0x50, %r12
movq 0x8(%rsp), %r14
pushq $0x10
popq %rbp
pushq $0xf
popq %r15
testq %r15, %r15
js 0xbfde8
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3eb4
cmpb $0x20, %al
jne 0xbfdea
decq %r15
decq %rbp
decq %r14
jmp 0xbfd8f
movq %rbx, %rdi
leaq 0x6e9c5(%rip), %rsi     # 0x12e77e
movl %r13d, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0xde9f1
jmp 0xbfefb
movq %rbx, %rdi
leaq 0x6e9e2(%rip), %rsi     # 0x12e7b7
xorl %edx, %edx
xorl %eax, %eax
callq 0xdf2a5
movq 0x8(%rsp), %rbp
jmp 0xbfef0
xorl %ebp, %ebp
movq %rbx, %rdi
leaq 0x4d75e(%rip), %rsi     # 0x10d552
movl %ebp, %edx
xorl %eax, %eax
callq 0xde9f1
movq %rbx, %rdi
callq 0xeac74
movq %rax, %r14
movq 0x18(%rbx), %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %rax, %rcx
xorl %r8d, %r8d
pushq $0x15
popq %r9
callq 0xe4c9a
movq %r14, %rdi
callq 0xeb7e4
movq %rbx, %rdi
leaq 0x6ec2b(%rip), %rsi     # 0x12ea5e
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq %r14, %rdi
leaq 0x6e9b2(%rip), %rsi     # 0x12e7f9
pushq $0x5
popq %rdx
callq 0xeae42
movq %rbx, %rdi
callq 0xdfd1a
movq %rax, %r12
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0xdfd55
movb $0x1, 0x8(%r12)
movq 0x30(%rsp), %r15
subq 0x28(%rsp), %r15
js 0xbfeb8
movq %rbx, %rdi
xorl %esi, %esi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0xe4e62
movq %rax, %rbp
movq 0x18(%rbx), %rdi
movq 0x20(%rsp), %rsi
pushq $0x2
popq %rdx
movq %rax, %rcx
callq 0xe45f4
movq 0x18(%rbx), %rdi
movq 0x18(%rsp), %rsi
movq %r15, %rdx
movq %rbp, %rcx
callq 0xe45f4
jmp 0xbfecb
movq %rbx, %rdi
leaq 0x6e93c(%rip), %rsi     # 0x12e7fe
xorl %eax, %eax
callq 0xdf2a5
xorl %ebp, %ebp
movq %rbp, %rdi
callq 0xe5591
movq %rbx, %rdi
movq %r12, %rsi
callq 0xdfd24
movq %r14, %rdi
callq 0xeaf3c
movq 0x8(%rsp), %rbp
movq 0x10(%rsp), %r15
movq %rbx, %rdi
pushq $-0x1
popq %rsi
callq 0xdeba7
incq %r13
addq $0x20, %rbp
jmp 0xbfc9c
movq %rbx, %rdi
movq %r15, %rsi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xded32