// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/dsstore.c
// Function: do_record
static int do_record(deark *c, lctx *d, i64 pos1, i64 *bytes_consumed)
{
	i64 nlen;
	i64 pos = pos1;
	struct record_info ri;
	int retval = 0;

	de_zeromem(&ri, sizeof(struct record_info));

	nlen = de_getu32be_p(&pos);
	if(nlen>2048) goto done;
	ri.filename = ucstring_create(c);
	dbuf_read_to_ucstring(c->infile, pos, nlen*2, ri.filename, 0, DE_ENCODING_UTF16BE);
	de_dbg(c, "filename: \"%s\"", ucstring_getpsz_d(ri.filename));
	pos += 2*nlen;

	dbuf_read_fourcc(c->infile, pos, &ri.rtype, 4, 0x0);
	de_dbg(c, "record type: '%s'", ri.rtype.id_dbgstr);
	pos += 4;

	dbuf_read_fourcc(c->infile, pos, &ri.dtype, 4, 0x0);
	de_dbg(c, "data type: '%s'", ri.dtype.id_dbgstr);
	pos += 4;

	ri.dpos = pos;

	switch(ri.dtype.id) {
	case CODE_blob:
		do_blob(c, d, &ri);
		break;
	case CODE_bool:
		ri.dlen = 1;
		do_record_int(c, d, &ri, ri.dpos, ri.dlen);
		break;
	case CODE_comp:
		ri.dlen = 8;
		do_record_int(c, d, &ri, ri.dpos, ri.dlen);
		break;
	case CODE_dutc:
		ri.dlen = 8;
		do_record_date(c, d, &ri);
		break;
	case CODE_long:
		ri.dlen = 4;
		do_record_int(c, d, &ri, ri.dpos, ri.dlen);
		break;
	case CODE_shor:
		ri.dlen = 4;
		do_record_int(c, d, &ri, ri.dpos+2, 2);
		break;
	case CODE_type:
		ri.dlen = 4;
		break;
	case CODE_ustr:
		do_ustr(c, d, &ri);
		break;
	default:
		de_warn(c, "Unknown data type '%s'. Remaining records in this node cannot "
			"be processed.", ri.dtype.id_sanitized_sz);
		goto done;
	}
	if(ri.dlen<1) goto done;
	pos += ri.dlen;

	retval = 1;
done:
	*bytes_consumed = pos-pos1;
	ucstring_destroy(ri.filename);
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0xac(%rbp)
leaq -0xa8(%rbp), %rdi
xorl %esi, %esi
movl $0x78, %edx
callq 0x19140
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1654b0
movq %rax, -0x28(%rbp)
cmpq $0x800, -0x28(%rbp)     # imm = 0x800
jle 0x80064
jmp 0x8039c
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rdx
addq %rdx, %rdx
movq -0x98(%rbp), %rcx
xorl %r8d, %r8d
movl %r8d, -0xb8(%rbp)
movl $0x4, %r9d
movl %r9d, -0xbc(%rbp)
callq 0x1669f0
movq -0x8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x98(%rbp), %rdi
callq 0x172650
movq -0xc8(%rbp), %rdi
movq %rax, %rdx
movl -0xb8(%rbp), %eax
leaq 0x1474ab(%rip), %rsi    # 0x1c7583
movb %al, -0xb1(%rbp)
callq 0x15b0d0
movl -0xbc(%rbp), %ecx
movl -0xb8(%rbp), %r8d
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rax
leaq (%rax,%rdx,2), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq 0x169860
movb -0xb1(%rbp), %al
movq -0x8(%rbp), %rdi
leaq -0x80(%rbp), %rdx
leaq 0x12d89b(%rip), %rsi    # 0x1ad9c8
callq 0x15b0d0
movl -0xbc(%rbp), %ecx
movl -0xb8(%rbp), %r8d
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x169860
movb -0xb1(%rbp), %al
movq -0x8(%rbp), %rdi
leaq -0x50(%rbp), %rdx
leaq 0x12d865(%rip), %rsi    # 0x1ad9da
callq 0x15b0d0
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0xa8(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, -0xb0(%rbp)
subl $0x626c6f62, %eax       # imm = 0x626C6F62
je 0x8022f
jmp 0x801a7
movl -0xb0(%rbp), %eax
subl $0x626f6f6c, %eax       # imm = 0x626F6F6C
je 0x80248
jmp 0x801ba
movl -0xb0(%rbp), %eax
subl $0x636f6d70, %eax       # imm = 0x636F6D70
je 0x8027a
jmp 0x801cd
movl -0xb0(%rbp), %eax
subl $0x64757463, %eax       # imm = 0x64757463
je 0x802ac
jmp 0x801e0
movl -0xb0(%rbp), %eax
subl $0x6c6f6e67, %eax       # imm = 0x6C6F6E67
je 0x802d0
jmp 0x801f3
movl -0xb0(%rbp), %eax
subl $0x73686f72, %eax       # imm = 0x73686F72
je 0x802ff
jmp 0x80206
movl -0xb0(%rbp), %eax
subl $0x74797065, %eax       # imm = 0x74797065
je 0x80331
jmp 0x80219
movl -0xb0(%rbp), %eax
subl $0x75737472, %eax       # imm = 0x75737472
je 0x8033e
jmp 0x80354
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0xa8(%rbp), %rdx
callq 0x803d0
jmp 0x80377
movq $0x1, -0xa0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0xa8(%rbp), %rcx
movq -0xa0(%rbp), %r8
leaq -0xa8(%rbp), %rdx
callq 0x805a0
jmp 0x80377
movq $0x8, -0xa0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0xa8(%rbp), %rcx
movq -0xa0(%rbp), %r8
leaq -0xa8(%rbp), %rdx
callq 0x805a0
jmp 0x80377
movq $0x8, -0xa0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0xa8(%rbp), %rdx
callq 0x80600
jmp 0x80377
movq $0x4, -0xa0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0xa8(%rbp), %rcx
movq -0xa0(%rbp), %r8
leaq -0xa8(%rbp), %rdx
callq 0x805a0
jmp 0x80377
movq $0x4, -0xa0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0xa8(%rbp), %rcx
addq $0x2, %rcx
leaq -0xa8(%rbp), %rdx
movl $0x2, %r8d
callq 0x805a0
jmp 0x80377
movq $0x4, -0xa0(%rbp)
jmp 0x80377
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0xa8(%rbp), %rdx
callq 0x80690
jmp 0x80377
movq -0x8(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
addq $0x48, %rdx
addq $0x8, %rdx
leaq 0x12d67c(%rip), %rsi    # 0x1ad9ea
movb $0x0, %al
callq 0x15bc10
jmp 0x8039c
cmpq $0x1, -0xa0(%rbp)
jge 0x80383
jmp 0x8039c
movq -0xa0(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x1, -0xac(%rbp)
movq -0x30(%rbp), %rcx
subq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x98(%rbp), %rdi
callq 0x171750
movl -0xac(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)