// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/asf.c
// Function: handler_FileProperties
static void handler_FileProperties(deark *c, lctx *d, struct handler_params *hp)
{
	i64 pos = hp->dpos;
	i64 create_date;
	i64 x;
	unsigned int flags;
	u8 guid_raw[16];
	char guid_string[50];
	char buf[64];

	if(hp->dlen<80) return;

	// Some fields before the 'flags' field depend on it, so look ahead at it.
	flags = (unsigned int)de_getu32le(pos+64);

	read_and_render_guid(c->infile, guid_raw, pos, guid_string, sizeof(guid_string));
	de_dbg(c, "file id: {%s}", guid_string);
	pos += 16;

	if(!(flags&0x1)) {
		x = de_geti64le(pos);
		de_dbg(c, "file size: %"I64_FMT, x);
	}
	pos += 8;

	create_date = de_geti64le(pos);
	de_dbg(c, "creation date: %"I64_FMT" (%s)", create_date,
		format_date(create_date, buf, sizeof(buf)));
	pos += 8;

	if(!(flags&0x1)) {
		x = de_geti64le(pos);
		de_dbg(c, "data packets count: %"I64_FMT, x);
	}
	pos += 8;

	if(!(flags&0x1)) {
		x = de_geti64le(pos);
		de_dbg(c, "play duration: %"I64_FMT" (%s)", x, format_duration(x, buf, sizeof(buf)));
	}
	pos += 8;

	if(!(flags&0x1)) {
		x = de_geti64le(pos);
		de_dbg(c, "send duration: %"I64_FMT" (%s)", x, format_duration(x, buf, sizeof(buf)));
	}
	pos += 8;

	x = de_geti64le(pos);
	de_dbg(c, "preroll: %"I64_FMT, x);
	pos += 8;

	// Already read, above.
	de_dbg(c, "flags: 0x%08x", flags);
	pos += 4;

	x = de_getu32le_p(&pos);
	de_dbg(c, "min data packet size: %u", (unsigned int)x);

	x = de_getu32le_p(&pos);
	de_dbg(c, "max data packet size: %u", (unsigned int)x);

	x = de_getu32le_p(&pos);
	de_dbg(c, "max bitrate: %u bits/sec", (unsigned int)x);
}

// Assembly:
cmpq $0x50, 0x18(%rdx)
jl 0x1e1af
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa0, %rsp
movq %rdi, %rbx
movq 0x10(%rdx), %r14
movq 0x18(%rdi), %rdi
leaq 0x40(%r14), %rsi
callq 0xe409f
movq %rax, %r15
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x60(%rsp), %r12
movq %r14, %rdx
movq %r12, %rcx
callq 0x1decd
leaq 0xe73e5(%rip), %rsi     # 0x1053b6
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
testb $0x1, %r15b
jne 0x1e0ca
leaq 0x10(%r14), %rsi
callq 0xe418b
leaq 0xeb672(%rip), %rsi     # 0x10966e
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
leaq 0x18(%r14), %rsi
movq 0x18(%rbx), %rdi
callq 0xe418b
movq %rax, %r13
leaq 0x20(%rsp), %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0x1f60a
leaq 0xe7394(%rip), %rsi     # 0x1053c4
movq %rbx, %rdi
movq %r13, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0xde896
leaq 0x20(%r14), %rsi
movq 0x18(%rbx), %rdi
callq 0xe418b
leaq 0xe7388(%rip), %rsi     # 0x1053dc
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
leaq 0x28(%r14), %rsi
movq 0x18(%rbx), %rdi
callq 0xe418b
movq %rax, %r13
movq %rax, %rdi
movq %r12, %rsi
callq 0x1f658
leaq 0xe7371(%rip), %rsi     # 0x1053f4
movq %rbx, %rdi
movq %r13, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0xde896
addq $0x30, %r14
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe418b
movq %rax, %r13
movq %rax, %rdi
movq %r12, %rsi
callq 0x1f658
leaq 0xe7354(%rip), %rsi     # 0x10540c
movq %rbx, %rdi
movq %r13, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0xde896
jmp 0x1e101
leaq 0x18(%r14), %rsi
callq 0xe418b
movq %rax, %r12
leaq 0x20(%rsp), %r13
movq %rax, %rdi
movq %r13, %rsi
callq 0x1f60a
leaq 0xe72d7(%rip), %rsi     # 0x1053c4
movq %rbx, %rdi
movq %r12, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0xde896
addq $0x30, %r14
leaq 0x8(%r14), %rsi
movq 0x18(%rbx), %rdi
callq 0xe418b
leaq 0xe730f(%rip), %rsi     # 0x105424
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
leaq 0xfb505(%rip), %rsi     # 0x11962e
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xde896
addq $0x14, %r14
leaq 0x8(%rsp), %r15
movq %r14, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe40bf
leaq 0xe72dc(%rip), %rsi     # 0x105431
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe40bf
leaq 0xe72d6(%rip), %rsi     # 0x10544a
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe40bf
leaq 0xe72d0(%rip), %rsi     # 0x105463
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq