// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/sis.c
// Function: do_file_record
static int do_file_record(deark *c, lctx *d, i64 idx,
	i64 pos1, i64 *bytes_consumed)
{
	i64 pos = pos1;
	int retval = 0;
	struct file_rec *fr = NULL;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	fr = de_malloc(c, sizeof(struct file_rec));
	fr->rec_pos = pos1;
	de_dbg(c, "file record[%d] at %"I64_FMT, (int)idx, fr->rec_pos);
	de_dbg_indent(c, 1);

	fr->rectype = (unsigned int)de_getu32le_p(&pos);
	de_dbg(c, "record type: 0x%08x (%s)", fr->rectype, get_file_rec_type_name(fr->rectype));

	if(fr->rectype==0x0 || fr->rectype==0x1) {
		if(!do_file_record_file(c, d, fr)) goto done;
	}
	else if(fr->rectype==0x3 || fr->rectype==0x4) { // *if*, *elseif*
		i64 n;
		n = de_getu32le_p(&pos);
		de_dbg(c, "size of conditional expression: %d", (int)n);
		pos += n;
		fr->rec_len = pos - pos1;
	}
	else if(fr->rectype==0x5 || fr->rectype==0x6) { // *else*, *endif*
		fr->rec_len = 4;
	}
	else {
		de_err(c, "Unsupported record type (0x%08x), can't continue", fr->rectype);
		goto done;
	}

	*bytes_consumed = fr->rec_len;
	retval = 1;
done:
	if(fr) {
		de_free(c, fr->ffi);
		ucstring_destroy(fr->name_src);
		ucstring_destroy(fr->name_dest);
		ucstring_destroy(fr->name_to_use);
		de_free(c, fr);
	}
	de_dbg_indent_restore(c, saved_indent_level);
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x44(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rdi
movl $0x40, %esi
callq 0x15b780
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
movq -0x40(%rbp), %rax
movq (%rax), %rcx
leaq 0x8afdc(%rip), %rsi     # 0x1ce6e1
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165580
movl %eax, %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x40(%rbp), %rax
movl 0x10(%rax), %edi
callq 0x1438c0
movq -0x60(%rbp), %rdi
movl -0x54(%rbp), %edx
movq %rax, %rcx
leaq 0x64336(%rip), %rsi     # 0x1a7a99
movb $0x0, %al
callq 0x15b0d0
movq -0x40(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x14377e
movq -0x40(%rbp), %rax
cmpl $0x1, 0x10(%rax)
jne 0x14379e
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x143970
cmpl $0x0, %eax
jne 0x143799
jmp 0x143854
jmp 0x14383e
movq -0x40(%rbp), %rax
cmpl $0x3, 0x10(%rax)
je 0x1437b2
movq -0x40(%rbp), %rax
cmpl $0x4, 0x10(%rax)
jne 0x1437fd
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x165580
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rax
movl %eax, %edx
leaq 0x8af20(%rip), %rsi     # 0x1ce6f8
movb $0x0, %al
callq 0x15b0d0
movq -0x50(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rcx
subq -0x20(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x14383c
movq -0x40(%rbp), %rax
cmpl $0x5, 0x10(%rax)
je 0x143811
movq -0x40(%rbp), %rax
cmpl $0x6, 0x10(%rax)
jne 0x14381f
movq -0x40(%rbp), %rax
movq $0x4, 0x8(%rax)
jmp 0x14383a
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rax
movl 0x10(%rax), %edx
leaq 0x8aeea(%rip), %rsi     # 0x1ce71b
movb $0x0, %al
callq 0x15bfb0
jmp 0x143854
jmp 0x14383c
jmp 0x14383e
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x34(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x1438a0
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x15b820
movq -0x40(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x171750
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x171750
movq -0x40(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x171750
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x15b820
movq -0x8(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x15b5a0
movl -0x34(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)