// File: /workspace/github_c_makefile_star2_O3/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 0x1e6eb
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
movq 0x10(%rdx), %r14
movq 0x18(%rdi), %rdi
leaq 0x40(%r14), %rsi
callq 0xeed61
movq %rax, %r15
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x60(%rsp), %r12
movq %r14, %rdx
movq %r12, %rcx
callq 0x1e3cf
leaq 0xf3efc(%rip), %rsi     # 0x1123d6
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
testb $0x1, %r15b
jne 0x1e605
leaq 0x10(%r14), %rsi
callq 0xeef09
leaq 0xf81f9(%rip), %rsi     # 0x1166fe
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
leaq 0x18(%r14), %rsi
movq 0x18(%rbx), %rdi
callq 0xeef09
movq %rax, %r13
leaq 0x20(%rsp), %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0x1fb49
leaq 0xf3eab(%rip), %rsi     # 0x1123e4
movq %rbx, %rdi
movq %r13, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0xe8617
leaq 0x20(%r14), %rsi
movq 0x18(%rbx), %rdi
callq 0xeef09
leaq 0xf3e9f(%rip), %rsi     # 0x1123fc
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
leaq 0x28(%r14), %rsi
movq 0x18(%rbx), %rdi
callq 0xeef09
movq %rax, %rbp
cvtsi2sd %rax, %xmm0
divsd 0xf3b59(%rip), %xmm0    # 0x1120e0
leaq 0xf3f16(%rip), %r13     # 0x1124a4
movl $0x40, %esi
movq %r12, %rdi
movq %r13, %rdx
movb $0x1, %al
callq 0xe8193
leaq 0xf3e6d(%rip), %rsi     # 0x112414
movq %rbx, %rdi
movq %rbp, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0xe8617
addq $0x30, %r14
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeef09
movq %rax, %rbp
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0xf3b06(%rip), %xmm0    # 0x1120e0
movl $0x40, %esi
movq %r12, %rdi
movq %r13, %rdx
movb $0x1, %al
callq 0xe8193
leaq 0xf3e39(%rip), %rsi     # 0x11242c
movq %rbx, %rdi
movq %rbp, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0xe8617
jmp 0x1e63c
leaq 0x18(%r14), %rsi
callq 0xeef09
movq %rax, %r12
leaq 0x20(%rsp), %r13
movq %rax, %rdi
movq %r13, %rsi
callq 0x1fb49
leaq 0xf3dbc(%rip), %rsi     # 0x1123e4
movq %rbx, %rdi
movq %r12, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0xe8617
addq $0x30, %r14
leaq 0x8(%r14), %rsi
movq 0x18(%rbx), %rdi
callq 0xeef09
leaq 0xf3df4(%rip), %rsi     # 0x112444
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
leaq 0x1081ca(%rip), %rsi    # 0x12682e
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe8617
addq $0x14, %r14
leaq 0x8(%rsp), %r15
movq %r14, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeed83
leaq 0xf3dc1(%rip), %rsi     # 0x112451
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeed83
leaq 0xf3dbb(%rip), %rsi     # 0x11246a
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeed83
leaq 0xf3db5(%rip), %rsi     # 0x112483
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq