// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/j2c.c
// Function: get_marker_info
static int get_marker_info(deark *c, lctx *d, struct page_ctx *pg, u8 seg_type,
	struct marker_info *mi)
{
	i64 k;

	de_zeromem(mi, sizeof(struct marker_info));
	mi->seg_type = seg_type;

	// First, try to find the segment type in the static marker info.
	for(k=0; k<(i64)DE_ARRAYCOUNT(marker_info1_arr); k++) {
		const struct marker_info1 *mi1 = &marker_info1_arr[k];

		if(mi1->seg_type == seg_type) {
			mi->flags = mi1->flags;
			mi->hfn = mi1->hfn;
			de_strlcpy(mi->shortname, mi1->shortname, sizeof(mi->shortname));
			if(mi1->longname) {
				de_snprintf(mi->longname, sizeof(mi->longname), "%s: %s",
					mi1->shortname, mi1->longname);
			}
			goto done;
		}
	}

	// Handle some pattern-based markers.

	// fcd15444-1: "The marker range 0xFF30 - 0xFF3F is reserved [...] for markers
	// without marker parameters."
	if(seg_type>=0x30 && seg_type<=0x3f) {
		mi->flags |= FLAG_NO_DATA;
	}

	de_strlcpy(mi->shortname, "???", sizeof(mi->shortname));
	de_strlcpy(mi->longname, "???", sizeof(mi->longname));
	return 0;

done:
	if(!mi->longname[0]) {
		// If no longname was set, use the shortname
		de_strlcpy(mi->longname, mi->shortname, sizeof(mi->longname));
	}
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %cl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movb %al, -0x21(%rbp)
movq %r8, -0x30(%rbp)
movq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x70, %edx
callq 0x19140
movb -0x21(%rbp), %cl
movq -0x30(%rbp), %rax
movb %cl, (%rax)
movq $0x0, -0x38(%rbp)
cmpq $0x13, -0x38(%rbp)
jge 0xc7941
movq -0x38(%rbp), %rcx
leaq 0x152a6c(%rip), %rax    # 0x21a310
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movzbl (%rax), %eax
movzbl -0x21(%rbp), %ecx
cmpl %ecx, %eax
jne 0xc792e
movq -0x40(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
movl $0xc, %edx
callq 0x15aa30
movq -0x40(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0xc792c
movq -0x30(%rbp), %rdi
addq $0x14, %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x40(%rbp), %rax
movq 0x10(%rax), %r8
movl $0x50, %esi
leaq 0x10d5a1(%rip), %rdx    # 0x1d4ec6
movb $0x0, %al
callq 0x15a980
jmp 0xc799e
jmp 0xc7930
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0xc788e
movzbl -0x21(%rbp), %eax
cmpl $0x30, %eax
jl 0xc7963
movzbl -0x21(%rbp), %eax
cmpl $0x3f, %eax
jg 0xc7963
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x4(%rax)
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
leaq 0xeebfe(%rip), %rsi     # 0x1b6570
movl $0xc, %edx
callq 0x15aa30
movq -0x30(%rbp), %rdi
addq $0x14, %rdi
leaq 0xeebe5(%rip), %rsi     # 0x1b6570
movl $0x50, %edx
callq 0x15aa30
movl $0x0, -0x4(%rbp)
jmp 0xc79c9
movq -0x30(%rbp), %rax
cmpb $0x0, 0x14(%rax)
jne 0xc79c2
movq -0x30(%rbp), %rdi
addq $0x14, %rdi
movq -0x30(%rbp), %rsi
addq $0x8, %rsi
movl $0x50, %edx
callq 0x15aa30
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)