// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/asf.c
// Function: handler_StreamProperties
static void handler_StreamProperties(deark *c, lctx *d, struct handler_params *hp)
{
	i64 pos = hp->dpos;
	i64 x;
	i64 tsdlen, ecdlen;
	unsigned int flags;
	u8 stream_type[16];
	u8 ec_type[16];
	char stream_type_string[50];
	char ec_type_string[50];
	char buf[64];

	if(hp->dlen<54) return;

	read_and_render_guid(c->infile, stream_type, pos,
		stream_type_string, sizeof(stream_type_string));
	de_dbg(c, "stream type: {%s} (%s)", stream_type_string, get_uuid_name(stream_type));
	pos += 16;

	read_and_render_guid(c->infile, ec_type, pos, ec_type_string, sizeof(ec_type_string));
	de_dbg(c, "error correction type: {%s} (%s)", ec_type_string, get_uuid_name(ec_type));
	pos += 16;

	x = de_geti64le(pos);
	de_dbg(c, "time offset: %"I64_FMT" (%s)", x, format_duration(x, buf, sizeof(buf)));
	pos += 8;

	tsdlen = de_getu32le_p(&pos);
	ecdlen = de_getu32le_p(&pos);

	flags = (unsigned int)de_getu16le_p(&pos);
	de_dbg(c, "flags: 0x%08x", flags);
	de_dbg_indent(c, 1);
	de_dbg(c, "stream number: %u", (unsigned int)(flags&0x7f));
	de_dbg_indent(c, -1);

	pos += 4; // reserved

	if(tsdlen) {
		de_dbg(c, "[%d bytes of type-specific data at %"I64_FMT"]", (int)tsdlen, pos);
		de_dbg_indent(c, 1);
		de_dbg_hexdump(c, c->infile, pos, tsdlen, 256, NULL, 0x1);
		de_dbg_indent(c, -1);
		pos += tsdlen;
	}
	if(ecdlen) {
		de_dbg(c, "[%d bytes of error correction data at %"I64_FMT"]", (int)ecdlen, pos);
		de_dbg_indent(c, 1);
		de_dbg_hexdump(c, c->infile, pos, ecdlen, 256, NULL, 0x1);
		de_dbg_indent(c, -1);
		pos += ecdlen;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf0, %rsp
movq %rdx, %rax
movq 0x10(%rdx), %rdx
movq %rdx, 0x8(%rsp)
cmpq $0x36, 0x18(%rax)
jl 0x1e810
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
leaq 0x20(%rsp), %r14
leaq 0x70(%rsp), %r15
movq %r14, %rsi
movq %r15, %rcx
callq 0x1e29d
movq %r14, %rdi
callq 0x1fa9b
leaq 0xf3e7a(%rip), %rsi     # 0x11249d
movq %rbx, %rdi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
leaq 0x8(%rsp), %r15
movq (%r15), %rdx
addq $0x10, %rdx
movq %rdx, (%r15)
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %r14
leaq 0x30(%rsp), %r12
movq %r14, %rsi
movq %r12, %rcx
callq 0x1e29d
movq %r14, %rdi
callq 0x1fa9b
leaq 0xf3e4a(%rip), %rsi     # 0x1124b4
movq %rbx, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
movq (%r15), %rsi
addq $0x10, %rsi
movq %rsi, (%r15)
movq 0x18(%rbx), %rdi
callq 0xef536
movq %rax, %r14
cvtsi2sd %rax, %xmm0
divsd 0xf3a33(%rip), %xmm0    # 0x1120d0
leaq 0xf3df0(%rip), %rdx     # 0x112494
leaq 0xb0(%rsp), %r12
movl $0x40, %esi
movq %r12, %rdi
movb $0x1, %al
callq 0xe8d67
leaq 0xf3e13(%rip), %rsi     # 0x1124d5
movq %rbx, %rdi
movq %r14, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0xe9226
addq $0x8, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef3a0
movq %rax, %r12
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef3a0
movq %rax, %r14
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef1ed
movq %rax, %r13
leaq 0x107ef4(%rip), %rsi    # 0x1265fe
movq %rbx, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
andl $0x7f, %r13d
leaq 0xf3dbc(%rip), %rsi     # 0x1124eb
movq %rbx, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq (%r15), %rcx
addq $0x4, %rcx
movq %rcx, (%r15)
testq %r12, %r12
je 0x1e7af
leaq 0xf3d9e(%rip), %rsi     # 0x1124fd
movq %rbx, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x18(%rbx), %rsi
movq 0x8(%rsp), %rdx
movl $0x1, (%rsp)
movl $0x100, %r8d            # imm = 0x100
movq %rbx, %rdi
movq %r12, %rcx
xorl %r9d, %r9d
callq 0xe975a
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
addq %r12, 0x8(%rsp)
testq %r14, %r14
je 0x1e810
movq 0x8(%rsp), %rcx
leaq 0xf3d65(%rip), %rsi     # 0x112525
movq %rbx, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x18(%rbx), %rsi
movq 0x8(%rsp), %rdx
movl $0x1, (%rsp)
movl $0x100, %r8d            # imm = 0x100
movq %rbx, %rdi
movq %r14, %rcx
xorl %r9d, %r9d
callq 0xe975a
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
addq %r14, 0x8(%rsp)
addq $0xf0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq