// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/asf.c
// Function: handler_ContentEncr
static void handler_ContentEncr(deark *c, lctx *d, struct handler_params *hp)
{
	i64 pos = hp->dpos;
	i64 xlen;
	de_ucstring *s = NULL;

	xlen = de_getu32le_p(&pos);
	if(pos+xlen > hp->dpos+hp->dlen) goto done;
	if(xlen>0) {
		de_dbg(c, "[%d bytes of secret data at %"I64_FMT"]", (int)xlen, pos);
		de_dbg_indent(c, 1);
		de_dbg_hexdump(c, c->infile, pos, xlen, 256, NULL, 0x0);
		de_dbg_indent(c, -1);
	}
	pos += xlen;

	s = ucstring_create(c);
	xlen = de_getu32le_p(&pos);
	if(pos+xlen > hp->dpos+hp->dlen) goto done;
	dbuf_read_to_ucstring_n(c->infile, pos, xlen, DE_DBG_MAX_STRLEN, s,
			0, DE_ENCODING_ASCII);
	ucstring_truncate_at_NUL(s);
	de_dbg(c, "protection type: \"%s\"", ucstring_getpsz_d(s));
	// TODO: What should we do if this is not "DRM"?
	pos += xlen;

	ucstring_empty(s);
	xlen = de_getu32le_p(&pos);
	if(pos+xlen > hp->dpos+hp->dlen) goto done;
	dbuf_read_to_ucstring_n(c->infile, pos, xlen, DE_DBG_MAX_STRLEN, s,
			0, DE_ENCODING_ASCII);
	ucstring_truncate_at_NUL(s);
	de_dbg(c, "key id: \"%s\"", ucstring_getpsz_d(s));
	pos += xlen;

	ucstring_empty(s);
	xlen = de_getu32le_p(&pos);
	if(pos+xlen > hp->dpos+hp->dlen) goto done;
	dbuf_read_to_ucstring_n(c->infile, pos, xlen, DE_DBG_MAX_STRLEN, s,
			0, DE_ENCODING_ASCII);
	ucstring_truncate_at_NUL(s);
	de_dbg(c, "license url: \"%s\"", ucstring_getpsz_d(s));
	pos += xlen;

done:
	ucstring_destroy(s);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r14
movq %rdi, %rbx
movq 0x10(%rdx), %rax
leaq 0x8(%rsp), %r12
movq %rax, (%r12)
movq 0x18(%rdi), %rdi
movq %r12, %rsi
callq 0xe40bf
movq %rax, %r15
movq (%r12), %rcx
addq %rcx, %rax
movq 0x18(%r14), %rdx
addq 0x10(%r14), %rdx
cmpq %rdx, %rax
jle 0x1eea7
xorl %r15d, %r15d
jmp 0x1f071
testq %r15, %r15
jle 0x1eeff
leaq 0xe6968(%rip), %rsi     # 0x10581b
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq 0x18(%rbx), %rsi
movq 0x8(%rsp), %rdx
andl $0x0, (%rsp)
movl $0x100, %r8d            # imm = 0x100
movq %rbx, %rdi
movq %r15, %rcx
xorl %r9d, %r9d
callq 0xded3a
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
addq 0x8(%rsp), %r15
movq %r15, %rax
leaq 0x8(%rsp), %r13
movq %rax, (%r13)
movq %rbx, %rdi
callq 0xeac74
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xe40bf
movq %rax, %r12
movq (%r13), %rsi
addq %rsi, %rax
movq 0x18(%r14), %rcx
addq 0x10(%r14), %rcx
cmpq %rcx, %rax
jg 0x1f071
movq 0x18(%rbx), %rdi
movl $0x1, (%rsp)
movl $0x1f4, %ecx            # imm = 0x1F4
movq %r12, %rdx
movq %r15, %r8
xorl %r9d, %r9d
callq 0xe4ced
movq %r15, %rdi
callq 0xeacc0
movq %r15, %rdi
callq 0xeb877
leaq 0xe68cd(%rip), %rsi     # 0x10583c
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
leaq 0x8(%rsp), %r13
addq %r12, (%r13)
movq %r15, %rdi
callq 0xeac85
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xe40bf
movq %rax, %r12
movq (%r13), %rsi
addq %rsi, %rax
movq 0x18(%r14), %rcx
addq 0x10(%r14), %rcx
cmpq %rcx, %rax
jg 0x1f071
movq 0x18(%rbx), %rdi
movl $0x1, (%rsp)
movl $0x1f4, %ecx            # imm = 0x1F4
movq %r12, %rdx
movq %r15, %r8
xorl %r9d, %r9d
callq 0xe4ced
movq %r15, %rdi
callq 0xeacc0
movq %r15, %rdi
callq 0xeb877
leaq 0xe6869(%rip), %rsi     # 0x105852
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
leaq 0x8(%rsp), %r13
addq %r12, (%r13)
movq %r15, %rdi
callq 0xeac85
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xe40bf
movq %rax, %r12
movq (%r13), %rsi
addq %rsi, %rax
movq 0x18(%r14), %rcx
addq 0x10(%r14), %rcx
cmpq %rcx, %rax
jg 0x1f071
movq 0x18(%rbx), %rdi
movl $0x1, (%rsp)
movl $0x1f4, %ecx            # imm = 0x1F4
movq %r12, %rdx
movq %r15, %r8
xorl %r9d, %r9d
callq 0xe4ced
movq %r15, %rdi
callq 0xeacc0
movq %r15, %rdi
callq 0xeb877
leaq 0xe6800(%rip), %rsi     # 0x10585f
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
addq %r12, 0x8(%rsp)
movq %r15, %rdi
callq 0xeaf3c
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq