// File: /workspace/github_c_makefile_star2_O0/lh3[P]minigraph/ggen.c
// Function: mg_path2seq
int32_t mg_path2seq(void *km, const gfa_t *g, const mg_gchains_t *gcs, int32_t ls, int32_t le, int32_t voff[2], char **seq_, int32_t *cap_) // NB: [ls,le] is a CLOSED interval
{
	extern unsigned char gfa_comp_table[256];
	int32_t i, k, l = 0, cap = *cap_;
	char *seq = *seq_;
	assert(0 <= ls && ls <= le && le < gcs->n_lc);
	for (k = ls; k <= le; ++k) {
		uint32_t v = gcs->lc[k].v, len = g->seg[v>>1].len;
		int32_t st = 0, en = len, tmp;
		if (k == ls) st = voff[0];
		if (k == le) en = voff[1];
		assert(0 <= st && st <= en && en <= len);
		if (en - st + l + 1 > cap) {
			cap = en - st + l + 1;
			kroundup32(cap);
			KREALLOC(km, seq, cap);
		}
		if (v&1) {
			uint8_t *ss = (uint8_t*)g->seg[v>>1].seq;
			tmp = st, st = len - en, en = len - tmp;
			for (i = en - 1; i >= st; --i)
				seq[l++] = gfa_comp_table[ss[i]];
		} else {
			memcpy(&seq[l], &g->seg[v>>1].seq[st], en - st);
			l += en - st;
		}
	}
	if (l == 0 && cap == 0) {
		cap = 8;
		KREALLOC(km, seq, cap);
	}
	seq[l] = 0;
	*seq_ = seq, *cap_ = cap;
	return l;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movq %r9, -0x28(%rbp)
movl $0x0, -0x34(%rbp)
movq 0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x38(%rbp)
movq 0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
xorl %eax, %eax
cmpl -0x1c(%rbp), %eax
jg 0x3869f
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jg 0x3869f
movl -0x20(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x3869f
jmp 0x386be
leaq 0x5e40(%rip), %rdi      # 0x3e4e6
leaq 0x5e5f(%rip), %rsi      # 0x3e50c
movl $0x99, %edx
leaq 0x5e5a(%rip), %rcx      # 0x3e513
callq 0x2170
movl -0x1c(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x20(%rbp), %eax
jg 0x388d8
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x30(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x44(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jne 0x38722
movq -0x28(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4c(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x20(%rbp), %eax
jne 0x38734
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x50(%rbp)
xorl %eax, %eax
cmpl -0x4c(%rbp), %eax
jg 0x3874d
movl -0x4c(%rbp), %eax
cmpl -0x50(%rbp), %eax
jg 0x3874d
movl -0x50(%rbp), %eax
cmpl -0x48(%rbp), %eax
ja 0x3874d
jmp 0x3876c
leaq 0x5e31(%rip), %rdi      # 0x3e585
leaq 0x5db1(%rip), %rsi      # 0x3e50c
movl $0x9f, %edx
leaq 0x5dac(%rip), %rcx      # 0x3e513
callq 0x2170
movl -0x50(%rbp), %eax
subl -0x4c(%rbp), %eax
addl -0x34(%rbp), %eax
addl $0x1, %eax
cmpl -0x38(%rbp), %eax
jle 0x387f2
movl -0x50(%rbp), %eax
subl -0x4c(%rbp), %eax
addl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
sarl %eax
orl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
sarl $0x2, %eax
orl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
sarl $0x4, %eax
orl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
sarl $0x8, %eax
orl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
sarl $0x10, %eax
orl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movslq -0x38(%rbp), %rdx
shlq $0x0, %rdx
callq 0x2ae0
movq %rax, -0x40(%rbp)
movl -0x44(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x38882
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x44(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rax
movq %rax, -0x60(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x48(%rbp), %eax
subl -0x50(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x48(%rbp), %eax
subl -0x54(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jl 0x38880
movq -0x60(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0xc993(%rip), %rax      # 0x451f0
movb (%rax,%rcx), %dl
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x34(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x38840
jmp 0x388c8
movq -0x40(%rbp), %rdi
movslq -0x34(%rbp), %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x44(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rsi
movslq -0x4c(%rbp), %rax
addq %rax, %rsi
movl -0x50(%rbp), %eax
subl -0x4c(%rbp), %eax
movslq %eax, %rdx
callq 0x2230
movl -0x50(%rbp), %eax
subl -0x4c(%rbp), %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0x388ca
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x386c4
cmpl $0x0, -0x34(%rbp)
jne 0x38904
cmpl $0x0, -0x38(%rbp)
jne 0x38904
movl $0x8, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movslq -0x38(%rbp), %rdx
shlq $0x0, %rdx
callq 0x2ae0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movslq -0x34(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x40(%rbp), %rcx
movq 0x10(%rbp), %rax
movq %rcx, (%rax)
movl -0x38(%rbp), %ecx
movq 0x18(%rbp), %rax
movl %ecx, (%rax)
movl -0x34(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)