// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/gemmeta.c
// Function: do_record
static int do_record(deark *c, lctx *d, i64 pos, i64 *bytesused)
{
	int retval = 0;
	struct opcode_data op;
	i64 ptsin_size_bytes;
	i64 intin_size_bytes;
	i64 data_size_bytes;
	const struct opcode_info *opinfo;
	const char *opcode_name;

	*bytesused = 0;
	de_zeromem(&op, sizeof(struct opcode_data));

	de_dbg(c, "record at %d", (int)pos);
	de_dbg_indent(c, 1);

	op.opcode = de_getu16le(pos);
	op.ptsin_count = de_getu16le(pos+2);
	op.intin_count = de_getu16le(pos+4);
	op.func_id = de_getu16le(pos+6);

	ptsin_size_bytes = 4*op.ptsin_count;
	intin_size_bytes = 2*op.intin_count;
	data_size_bytes = ptsin_size_bytes + intin_size_bytes;

	op.ptsin_pos = pos + 8;
	op.intin_pos = pos + 8 + ptsin_size_bytes;

	opinfo = find_opcode_info(op.opcode);
	if(opinfo && opinfo->name)
		opcode_name = opinfo->name;
	else
		opcode_name = "?";

	de_dbg(c, "opcode=%d (%s), func_id=%d, #pts=%d, #int=%d (dlen=%d)",
		(int)op.opcode, opcode_name, (int)op.func_id,
		(int)op.ptsin_count, (int)op.intin_count,
		(int)data_size_bytes);

	*bytesused = 8 + data_size_bytes;

	if(opinfo && opinfo->fn) {
		opinfo->fn(c, d, &op);
	}

	if(op.opcode==65535) {
		goto done;
	}

	retval = 1;
done:
	de_dbg_indent(c, -1);
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x38, %edx
callq 0x19140
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
leaq 0x150c03(%rip), %rsi    # 0x1c1281
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x165280
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x2, %rsi
callq 0x165280
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x4, %rsi
callq 0x165280
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x6, %rsi
callq 0x165280
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
shlq $0x2, %rax
movq %rax, -0x68(%rbp)
movq -0x30(%rbp), %rax
shlq %rax
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rax
addq -0x70(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
addq $0x8, %rax
addq -0x68(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdi
callq 0x70820
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
je 0x70762
movq -0x80(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x70762
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x88(%rbp)
jmp 0x70770
leaq 0x1474c4(%rip), %rax    # 0x1b7c2d
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rax
movl %eax, %edx
movq -0x88(%rbp), %rcx
movq -0x40(%rbp), %rax
movl %eax, %r8d
movq -0x38(%rbp), %rax
movl %eax, %r9d
movq -0x30(%rbp), %rax
movl %eax, %r10d
movq -0x78(%rbp), %rax
leaq 0x13a660(%rip), %rsi    # 0x1aae01
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x15b0d0
movq -0x78(%rbp), %rcx
addq $0x8, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x80(%rbp)
je 0x707e7
movq -0x80(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x707e7
movq -0x80(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq *%rax
cmpq $0xffff, -0x48(%rbp)    # imm = 0xFFFF
jne 0x707f3
jmp 0x707fa
movl $0x1, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movl -0x24(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)