// File: /workspace/github_c_makefile_star2_O1/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:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq 0x10(%rdx), %rsi
movq %rsi, 0x8(%rsp)
cmpq $0x50, 0x18(%rdx)
jl 0x1e5c2
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
addq $0x40, %rsi
callq 0xef37e
movq %rax, %r14
movq 0x18(%rbx), %rdi
movq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rsi
leaq 0x60(%rsp), %r15
movq %r15, %rcx
callq 0x1e29d
leaq 0xf401a(%rip), %rsi     # 0x1123c6
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x8(%rsp), %rsi
addq $0x10, %rsi
movq %rsi, 0x8(%rsp)
testb $0x1, %r14b
jne 0x1e3ea
movq 0x18(%rbx), %rdi
callq 0xef536
leaq 0xf8271(%rip), %rsi     # 0x11664e
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x8(%rsp), %rsi
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
movq 0x18(%rbx), %rdi
callq 0xef536
movq %rax, %r15
leaq 0x20(%rsp), %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0x1fa47
leaq 0xf3fb9(%rip), %rsi     # 0x1123d4
movq %rbx, %rdi
movq %r15, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0xe9226
movq 0x8(%rsp), %rsi
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
testb $0x1, %r14b
jne 0x1e45c
movq 0x18(%rbx), %rdi
callq 0xef536
leaq 0xf3f9d(%rip), %rsi     # 0x1123ec
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x8(%rsp), %rsi
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
testb $0x1, %r14b
jne 0x1e4bb
movq 0x18(%rbx), %rdi
callq 0xef536
movq %rax, %r15
cvtsi2sd %rax, %xmm0
divsd 0xf3c47(%rip), %xmm0    # 0x1120d0
leaq 0xf4004(%rip), %rdx     # 0x112494
leaq 0x20(%rsp), %r12
movl $0x40, %esi
movq %r12, %rdi
movb $0x1, %al
callq 0xe8d67
leaq 0xf3f59(%rip), %rsi     # 0x112404
movq %rbx, %rdi
movq %r15, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0xe9226
movq 0x8(%rsp), %rsi
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
testb $0x1, %r14b
jne 0x1e51d
movq 0x18(%rbx), %rdi
callq 0xef536
movq %rax, %r15
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0xf3be5(%rip), %xmm0    # 0x1120d0
leaq 0xf3fa2(%rip), %rdx     # 0x112494
leaq 0x20(%rsp), %r12
movl $0x40, %esi
movq %r12, %rdi
movb $0x1, %al
callq 0xe8d67
leaq 0xf3f0f(%rip), %rsi     # 0x11241c
movq %rbx, %rdi
movq %r15, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0xe9226
leaq 0x8(%rsp), %r15
movq (%r15), %rsi
addq $0x8, %rsi
movq %rsi, (%r15)
movq 0x18(%rbx), %rdi
callq 0xef536
leaq 0xf3ef8(%rip), %rsi     # 0x112434
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
addq $0x8, (%r15)
leaq 0x1080aa(%rip), %rsi    # 0x1265fe
movq %rbx, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0xe9226
addq $0x4, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef3a0
leaq 0xf3ec9(%rip), %rsi     # 0x112441
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef3a0
leaq 0xf3ec3(%rip), %rsi     # 0x11245a
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef3a0
leaq 0xf3ebd(%rip), %rsi     # 0x112473
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq