// File: /workspace/github_c_makefile_star2_O3/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:
cmpq $0x36, 0x18(%rdx)
jl 0x1e92e
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf0, %rsp
movq %rdi, %rbx
movq 0x10(%rdx), %r14
movq 0x18(%rdi), %rdi
leaq 0x20(%rsp), %r15
leaq 0x70(%rsp), %r12
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x1e3cf
movq %r15, %rdi
callq 0x1fb9d
leaq 0xf3d74(%rip), %rsi     # 0x1124ad
movq %rbx, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe8617
leaq 0x10(%r14), %rdx
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %r15
leaq 0x30(%rsp), %r12
movq %r15, %rsi
movq %r12, %rcx
callq 0x1e3cf
movq %r15, %rdi
callq 0x1fb9d
leaq 0xf3d4f(%rip), %rsi     # 0x1124c4
movq %rbx, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe8617
leaq 0x20(%r14), %rsi
movq 0x18(%rbx), %rdi
callq 0xeef09
movq %rax, %r15
cvtsi2sd %rax, %xmm0
divsd 0xf393e(%rip), %xmm0    # 0x1120e0
leaq 0xf3cfb(%rip), %rdx     # 0x1124a4
leaq 0xb0(%rsp), %r12
movl $0x40, %esi
movq %r12, %rdi
movb $0x1, %al
callq 0xe8193
leaq 0xf3d1e(%rip), %rsi     # 0x1124e5
movq %rbx, %rdi
movq %r15, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0xe8617
addq $0x28, %r14
leaq 0x8(%rsp), %r12
movq %r14, (%r12)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xeed83
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xeed83
movq %rax, %r14
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xeebeb
movq %rax, %r13
leaq 0x108016(%rip), %rsi    # 0x12682e
movq %rbx, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
andl $0x7f, %r13d
leaq 0xf3cbe(%rip), %rsi     # 0x1124fb
movq %rbx, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq (%r12), %rcx
addq $0x4, %rcx
movq %rcx, (%r12)
testq %r15, %r15
je 0x1e8c7
leaq 0xf3c9e(%rip), %rsi     # 0x11250d
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rsi
movq 0x8(%rsp), %rdx
movl $0x1, (%rsp)
movl $0x100, %r8d            # imm = 0x100
movq %rbx, %rdi
movq %r15, %rcx
xorl %r9d, %r9d
callq 0xe8bea
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
addq 0x8(%rsp), %r15
movq %r15, 0x8(%rsp)
movq %r15, %rcx
testq %r14, %r14
je 0x1e91e
leaq 0xf3c62(%rip), %rsi     # 0x112535
movq %rbx, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
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 0xe8bea
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
addq $0xf0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq