LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/galign.c
// Function: append_cigar1
static void append_cigar1(void *km, mg64_v *c, int32_t op, int32_t len)
{
	if (c->n > 0 && (c->a[c->n - 1]&0xf) == op) {
		c->a[c->n - 1] += (uint64_t)len<<4;
	} else {
		if (c->n == c->m) {
			c->m += (c->m>>1) + 16;
			KREALLOC(km, c->a, c->m);
		}
		c->a[c->n++] = (uint64_t)len<<4 | op;
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %ecx, %r14d
movl %edx, %ebp
movq %rsi, %rbx
movslq (%rsi), %rcx
testq %rcx, %rcx
jle 0x1b74b
movq 0x8(%rbx), %rax
movq -0x8(%rax,%rcx,8), %rdx
movl %edx, %esi
andl $0xf, %esi
cmpl %ebp, %esi
jne 0x1b74b
movslq %r14d, %rsi
shlq $0x4, %rsi
addq %rsi, %rdx
movq %rdx, -0x8(%rax,%rcx,8)
jmp 0x1b790
cmpl 0x4(%rbx), %ecx
jne 0x1b774
movl %ecx, %eax
sarl %eax
addl %ecx, %eax
addl $0x10, %eax
movl %eax, 0x4(%rbx)
movq 0x8(%rbx), %rsi
movslq %eax, %rdx
shlq $0x3, %rdx
callq 0x31ed
movq %rax, 0x8(%rbx)
movl (%rbx), %ecx
jmp 0x1b778
movq 0x8(%rbx), %rax
movslq %r14d, %rdx
shlq $0x4, %rdx
movl %ebp, %esi
orq %rdx, %rsi
leal 0x1(%rcx), %edx
movl %edx, (%rbx)
movslq %ecx, %rcx
movq %rsi, (%rax,%rcx,8)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/gcmisc.c
// Function: mg_gchain_restore_order
void mg_gchain_restore_order(void *km, mg_gchains_t *gcs)
{
	int32_t i, n_a, n_lc;
	mg_llchain_t *lc;
	mg128_t *a;
	KMALLOC(km, lc, gcs->n_lc);
	KMALLOC(km, a, gcs->n_a);
	for (i = 0, n_a = n_lc = 0; i < gcs->n_gc; ++i) {
		mg_gchain_t *gc = &gcs->gc[i];
		assert(gc->cnt > 0);
		memcpy(&lc[n_lc], &gcs->lc[gc->off], gc->cnt * sizeof(mg_llchain_t));
		memcpy(&a[n_a], &gcs->a[gcs->lc[gc->off].off], gc->n_anchor * sizeof(mg128_t));
		n_lc += gc->cnt, n_a += gc->n_anchor;
	}
	memcpy(gcs->lc, lc, gcs->n_lc * sizeof(mg_llchain_t));
	memcpy(gcs->a, a, gcs->n_a * sizeof(mg128_t));
	kfree(km, lc); kfree(km, a);
	for (i = 0, n_lc = 0; i < gcs->n_gc; ++i) {
		mg_gchain_t *gc = &gcs->gc[i];
		gc->off = n_lc;
		n_lc += gc->cnt;
	}
	for (i = 0, n_a = 0; i < gcs->n_lc; ++i) {
		mg_llchain_t *lc = &gcs->lc[i];
		lc->off = n_a;
		n_a += lc->cnt;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movslq 0xc(%rsi), %rax
shlq $0x2, %rax
leaq (%rax,%rax,4), %rsi
callq 0x30e5
movq %rax, 0x8(%rsp)
movslq 0x10(%rbx), %rsi
shlq $0x4, %rsi
movq %r14, 0x10(%rsp)
movq %r14, %rdi
callq 0x30e5
movq %rax, (%rsp)
cmpl $0x0, 0x8(%rbx)
jle 0x1c274
xorl %r13d, %r13d
movl $0x10, %ebp
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x18(%rbx), %r12
movslq -0x4(%r12,%rbp), %rax
testq %rax, %rax
jle 0x1c322
movslq %r15d, %r15
leaq (%r15,%r15,4), %rcx
movq 0x8(%rsp), %rdx
leaq (%rdx,%rcx,4), %rdi
movslq -0x8(%r12,%rbp), %rcx
leaq (%rcx,%rcx,4), %rsi
shlq $0x2, %rsi
addq 0x20(%rbx), %rsi
shlq $0x2, %rax
leaq (%rax,%rax,4), %rdx
callq 0x2230
movslq %r14d, %r14
movq %r14, %rdi
shlq $0x4, %rdi
addq (%rsp), %rdi
movq 0x20(%rbx), %rax
movslq -0x8(%r12,%rbp), %rcx
leaq (%rcx,%rcx,4), %rcx
movslq (%rax,%rcx,4), %rsi
shlq $0x4, %rsi
addq 0x28(%rbx), %rsi
movslq (%r12,%rbp), %rdx
shlq $0x4, %rdx
callq 0x2230
addl -0x4(%r12,%rbp), %r15d
addl (%r12,%rbp), %r14d
incq %r13
movslq 0x8(%rbx), %rax
addq $0x68, %rbp
cmpq %rax, %r13
jl 0x1c1e3
movq 0x20(%rbx), %rdi
movslq 0xc(%rbx), %rax
shlq $0x2, %rax
leaq (%rax,%rax,4), %rdx
movq 0x8(%rsp), %r15
movq %r15, %rsi
callq 0x2230
movq 0x28(%rbx), %rdi
movslq 0x10(%rbx), %rdx
shlq $0x4, %rdx
movq (%rsp), %r12
movq %r12, %rsi
callq 0x2230
movq 0x10(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x301f
movq %r14, %rdi
movq %r12, %rsi
callq 0x301f
movslq 0x8(%rbx), %rcx
testq %rcx, %rcx
jle 0x1c2ea
movq 0x18(%rbx), %rax
imulq $0x68, %rcx, %rcx
xorl %edx, %edx
xorl %esi, %esi
movl %esi, 0x8(%rax,%rdx)
addl 0xc(%rax,%rdx), %esi
addq $0x68, %rdx
cmpq %rdx, %rcx
jne 0x1c2d9
movslq 0xc(%rbx), %rcx
testq %rcx, %rcx
jle 0x1c313
movq 0x20(%rbx), %rax
shlq $0x2, %rcx
leaq (%rcx,%rcx,4), %rcx
xorl %edx, %edx
xorl %esi, %esi
movl %esi, (%rax,%rdx)
addl 0x4(%rax,%rdx), %esi
addq $0x14, %rdx
cmpq %rdx, %rcx
jne 0x1c303
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd837(%rip), %rdi      # 0x29b60
leaq 0xd83c(%rip), %rsi      # 0x29b6c
leaq 0xd83e(%rip), %rcx      # 0x29b75
movl $0x11, %edx
callq 0x2160
// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/gcmisc.c
// Function: mg_gchain_restore_offset
void mg_gchain_restore_offset(mg_gchains_t *gcs)
{
	int32_t i, j, n_a, n_lc;
	for (i = 0, n_a = n_lc = 0; i < gcs->n_gc; ++i) {
		mg_gchain_t *gc = &gcs->gc[i];
		gc->off = n_lc;
		for (j = 0, gc->n_anchor = 0; j < gc->cnt; ++j) {
			mg_llchain_t *lc = &gcs->lc[n_lc + j];
			lc->off = n_a;
			n_a += lc->cnt;
			gc->n_anchor += lc->cnt;
		}
		n_lc += gc->cnt;
	}
	assert(n_lc == gcs->n_lc && n_a == gcs->n_a);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movslq 0x8(%rdi), %rcx
testq %rcx, %rcx
jle 0x1c3cb
movq 0x18(%rdi), %rdx
xorl %esi, %esi
xorl %r9d, %r9d
xorl %eax, %eax
imulq $0x68, %rsi, %r10
movl %r9d, 0x8(%rdx,%r10)
movl $0x0, 0x10(%rdx,%r10)
movslq 0xc(%rdx,%r10), %r8
testq %r8, %r8
jle 0x1c3bb
addq %rdx, %r10
movq 0x20(%rdi), %r11
movslq %r9d, %rbx
leaq (%rbx,%rbx,4), %rbx
leaq (%r11,%rbx,4), %r11
addq $0x4, %r11
leaq (,%r8,4), %rbx
leaq (%rbx,%rbx,4), %rbx
xorl %r14d, %r14d
xorl %ebp, %ebp
movl %eax, -0x4(%r11,%r14)
movl (%r11,%r14), %r15d
addl %r15d, %eax
addl %r15d, %ebp
addq $0x14, %r14
cmpq %r14, %rbx
jne 0x1c39f
movl %ebp, 0x10(%r10)
addl %r9d, %r8d
incq %rsi
movl %r8d, %r9d
cmpq %rcx, %rsi
jne 0x1c35c
jmp 0x1c3d0
xorl %eax, %eax
xorl %r8d, %r8d
cmpl 0xc(%rdi), %r8d
jne 0x1c3e6
cmpl 0x10(%rdi), %eax
jne 0x1c3e6
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd7bd(%rip), %rdi      # 0x29baa
leaq 0xd778(%rip), %rsi      # 0x29b6c
leaq 0xd7d4(%rip), %rcx      # 0x29bcf
movl $0x34, %edx
callq 0x2160
// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/gcmisc.c
// Function: mg_gchain_sort_by_score
void mg_gchain_sort_by_score(void *km, mg_gchains_t *gcs)
{
	mg128_t *z;
	mg_gchain_t *gc;
	int32_t i;
	KMALLOC(km, z, gcs->n_gc);
	KMALLOC(km, gc, gcs->n_gc);
	for (i = 0; i < gcs->n_gc; ++i)
		z[i].x = (uint64_t)gcs->gc[i].score << 32 | gcs->gc[i].hash, z[i].y = i;
	radix_sort_128x(z, z + gcs->n_gc);
	for (i = gcs->n_gc - 1; i >= 0; --i)
		gc[gcs->n_gc - 1 - i] = gcs->gc[z[i].y];
	memcpy(gcs->gc, gc, gcs->n_gc * sizeof(mg_gchain_t));
	kfree(km, z); kfree(km, gc);
	mg_gchain_restore_order(km, gcs); // this put gcs in the proper order
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movslq 0x8(%rsi), %rsi
shlq $0x4, %rsi
callq 0x30e5
movq %rax, %r15
movslq 0x8(%rbx), %rax
imulq $0x68, %rax, %rsi
movq %r14, %rdi
callq 0x30e5
movq %rax, %r12
movslq 0x8(%rbx), %rsi
testq %rsi, %rsi
jle 0x1c471
movq 0x18(%rbx), %rax
leaq 0x8(%r15), %rcx
addq $0x14, %rax
xorl %edx, %edx
movl (%rax), %edi
movl 0x24(%rax), %r8d
shlq $0x20, %rdi
orq %rdi, %r8
movq %r8, -0x8(%rcx)
movq %rdx, (%rcx)
incq %rdx
addq $0x10, %rcx
addq $0x68, %rax
cmpq %rdx, %rsi
jne 0x1c44d
shlq $0x4, %rsi
addq %r15, %rsi
movq %r15, %rdi
callq 0xf27f
movslq 0x8(%rbx), %rcx
testq %rcx, %rcx
jle 0x1c4ce
leaq 0x1(%rcx), %rax
movl %ecx, %edx
negl %edx
shlq $0x4, %rcx
leaq (%rcx,%r15), %r8
addq $-0x8, %r8
movl 0x8(%rbx), %ecx
addl %edx, %ecx
imulq $0x68, (%r8), %rsi
movslq %ecx, %rcx
imulq $0x68, %rcx, %rdi
addq 0x18(%rbx), %rsi
addq %r12, %rdi
movl $0xd, %ecx
rep  movsq (%rsi), %es:(%rdi)
decq %rax
incl %edx
addq $-0x10, %r8
cmpq $0x1, %rax
ja 0x1c49d
movl 0x8(%rbx), %ecx
movq 0x18(%rbx), %rdi
movslq %ecx, %rax
imulq $0x68, %rax, %rdx
movq %r12, %rsi
callq 0x2230
movq %r14, %rdi
movq %r15, %rsi
callq 0x301f
movq %r14, %rdi
movq %r12, %rsi
callq 0x301f
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1c188
// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/gcmisc.c
// Function: mg_gchain_flt_sub
int mg_gchain_flt_sub(float pri_ratio, int min_diff, int best_n, int n, mg_gchain_t *r)
{
	if (pri_ratio > 0.0f && n > 0) {
		int i, k, n_2nd = 0;
		for (i = k = 0; i < n; ++i) {
			int p = r[i].parent;
			if (p == i) { // primary
				r[i].flt = 0, ++k;
			} else if ((r[i].score >= r[p].score * pri_ratio || r[i].score + min_diff >= r[p].score) && n_2nd < best_n) {
				if (!(r[i].qs == r[p].qs && r[i].qe == r[p].qe && r[i].ps == r[p].ps && r[i].pe == r[p].pe)) // not identical hits; TODO: check path as well
					r[i].flt = 0, ++n_2nd, ++k;
				else r[i].flt = 1;
			} else r[i].flt = 1;
		}
		return k;
	}
	return n;
}

// Assembly:
movl %edx, %eax
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
setbe %dl
testl %eax, %eax
setle %r8b
orb %dl, %r8b
jne 0x1c93f
pushq %rbp
pushq %r14
pushq %rbx
movl %eax, %edx
leaq 0x44(%rcx), %r8
xorl %r9d, %r9d
xorl %r10d, %r10d
xorl %eax, %eax
movl -0x40(%r8), %r11d
cmpq %r11, %r9
jne 0x1c8ac
andb $-0x2, 0x1(%r8)
jmp 0x1c929
movslq %r11d, %r11
movl -0x30(%r8), %ebx
xorps %xmm1, %xmm1
cvtsi2ss %ebx, %xmm1
imulq $0x68, %r11, %r11
movl 0x14(%rcx,%r11), %ebp
xorps %xmm2, %xmm2
cvtsi2ss %ebp, %xmm2
mulss %xmm0, %xmm2
ucomiss %xmm2, %xmm1
setae %r14b
addl %edi, %ebx
cmpl %ebp, %ebx
setge %bl
orb %r14b, %bl
cmpl %esi, %r10d
setl %bpl
andb %bl, %bpl
cmpb $0x1, %bpl
jne 0x1c91a
addq %rcx, %r11
movl -0x2c(%r8), %ebx
cmpl 0x18(%r11), %ebx
jne 0x1c921
movl -0x28(%r8), %ebx
cmpl 0x1c(%r11), %ebx
jne 0x1c921
movl -0x20(%r8), %ebx
cmpl 0x24(%r11), %ebx
jne 0x1c921
movl -0x1c(%r8), %ebx
cmpl 0x28(%r11), %ebx
jne 0x1c921
orb $0x1, 0x1(%r8)
jmp 0x1c92b
andb $-0x2, 0x1(%r8)
incl %r10d
incl %eax
incq %r9
addq $0x68, %r8
cmpq %r9, %rdx
jne 0x1c89c
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/map-algo.c
// Function: collect_long_gaps
static int *collect_long_gaps(void *km, int as1, int cnt1, mg128_t *a, int min_gap, int *n_)
{
	int i, n, *K;
	*n_ = 0;
	for (i = 1, n = 0; i < cnt1; ++i) { // count the number of gaps longer than min_gap
		int gap = ((int32_t)a[as1 + i].y - a[as1 + i - 1].y) - ((int32_t)a[as1 + i].x - a[as1 + i - 1].x);
		if (gap < -min_gap || gap > min_gap) ++n;
	}
	if (n <= 1) return 0;
	K = (int*)kmalloc(km, n * sizeof(int));
	for (i = 1, n = 0; i < cnt1; ++i) { // store the positions of long gaps
		int gap = ((int32_t)a[as1 + i].y - a[as1 + i - 1].y) - ((int32_t)a[as1 + i].x - a[as1 + i - 1].x);
		if (gap < -min_gap || gap > min_gap)
			K[n++] = i;
	}
	*n_ = n;
	return K;
}

// Assembly:
movl $0x0, (%r9)
xorl %eax, %eax
cmpl $0x2, %edx
jl 0x1ed49
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %ebp
movl %edx, %r15d
movl %r8d, %r12d
negl %r12d
movslq %esi, %r14
movl %edx, %r13d
shlq $0x4, %r14
leaq (%rcx,%r14), %r11
movq %r13, %rdx
shlq $0x4, %rdx
movl $0x10, %esi
movl -0x8(%r11,%rsi), %r8d
movl 0x8(%r11,%rsi), %r10d
addl (%r11,%rsi), %r8d
subl %r8d, %r10d
addl -0x10(%r11,%rsi), %r10d
cmpl %r12d, %r10d
setl %r8b
cmpl %ebp, %r10d
setg %r10b
orb %r8b, %r10b
movzbl %r10b, %r8d
addl %r8d, %eax
addq $0x10, %rsi
cmpq %rsi, %rdx
jne 0x1ec90
xorl %ebx, %ebx
cmpl $0x2, %eax
jae 0x1ecd2
xorl %eax, %eax
jmp 0x1ed3b
movq %rcx, 0x8(%rsp)
movl %eax, %esi
shlq $0x2, %rsi
movq %r9, 0x10(%rsp)
callq 0x30e5
movq 0x10(%rsp), %r8
cmpl $0x2, %r15d
jl 0x1ed38
movq 0x8(%rsp), %rcx
addq %r14, %rcx
addq $0x18, %rcx
xorl %ebx, %ebx
movl $0x1, %edx
movl -0x10(%rcx), %esi
movl (%rcx), %edi
addl -0x8(%rcx), %esi
subl %esi, %edi
addl -0x18(%rcx), %edi
cmpl %r12d, %edi
setge %sil
cmpl %ebp, %edi
setle %dil
testb %dil, %sil
jne 0x1ed2c
movslq %ebx, %rsi
incl %ebx
movl %edx, (%rax,%rsi,4)
incq %rdx
addq $0x10, %rcx
cmpq %rdx, %r13
jne 0x1ed05
movl %ebx, (%r8)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/gmap.c
// Function: mg_map_file_frag
int mg_map_file_frag(const mg_idx_t *idx, int n_segs, const char **fn, const mg_mapopt_t *opt, int n_threads, double *c_seg, double *c_link)
{
	int i, pl_threads;
	pipeline_t pl;
	if (n_segs < 1) return -1;
	memset(&pl, 0, sizeof(pipeline_t));
	pl.n_fp = n_segs;
	pl.fp = open_bseqs(pl.n_fp, fn);
	if (pl.fp == 0) return -1;
	pl.opt = opt, pl.gi = idx;
	pl.n_threads = n_threads > 1? n_threads : 1;
	pl.mini_batch_size = opt->mini_batch_size;
	pl.c_seg = c_seg, pl.c_link = c_link;
	pl_threads = n_threads == 1? 1 : (opt->flag&MG_M_2_IO_THREADS)? 3 : 2;
	kt_pipeline(pl_threads, worker_pipeline, &pl, 3);

	free(pl.str.s);
	for (i = 0; i < pl.n_fp; ++i)
		mg_bseq_close(pl.fp[i]);
	free(pl.fp);
	return 0;
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %esi, %esi
jle 0x20f29
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %r8d, %ebp
movq %rcx, %r15
movq %rdx, %r13
movq %rdi, 0x8(%rsp)
movq %r9, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rsp)
movups %xmm0, 0x40(%rsp)
movups %xmm0, 0x30(%rsp)
movq $0x0, 0x50(%rsp)
movl %esi, 0x28(%rsp)
movl %esi, %r12d
movl $0x8, %esi
movq %r12, %rdi
callq 0x21e0
movq %rax, %r14
xorl %ebx, %ebx
movq (%r13,%rbx,8), %rdi
callq 0xf440
movq %rax, (%r14,%rbx,8)
testq %rax, %rax
je 0x20ee9
incq %rbx
cmpq %rbx, %r12
jne 0x20e1a
movq %r14, 0x38(%rsp)
movq %r15, 0x30(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x40(%rsp)
cmpl $0x2, %ebp
movl $0x1, %edi
movl $0x1, %eax
cmovgel %ebp, %eax
movl %eax, 0x24(%rsp)
movq 0x8(%r15), %rax
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x60(%rsp)
cmpl $0x1, %ebp
je 0x20e96
movb 0x2(%r15), %al
andb $0x8, %al
cmpb $0x1, %al
movl $0x3, %edi
sbbl $0x0, %edi
leaq 0xac(%rip), %rsi        # 0x20f49
leaq 0x18(%rsp), %rbx
movq %rbx, %rdx
movl $0x3, %ecx
callq 0x3568
movq 0x38(%rbx), %rdi
callq 0x2040
cmpl $0x0, 0x10(%rbx)
jle 0x20edb
xorl %ebx, %ebx
movq 0x38(%rsp), %rax
movq (%rax,%rbx,8), %rdi
callq 0xf4eb
incq %rbx
movslq 0x28(%rsp), %rax
cmpq %rax, %rbx
jl 0x20ec0
movq 0x38(%rsp), %rdi
callq 0x2040
xorl %eax, %eax
jmp 0x20f1b
leaq 0x11510(%rip), %rax     # 0x32400
cmpl $0x0, (%rax)
jg 0x20f2a
testq %rbx, %rbx
je 0x20f0e
xorl %r15d, %r15d
movq (%r14,%r15,8), %rdi
callq 0xf4eb
incq %r15
cmpq %r15, %rbx
jne 0x20efd
movq %r14, %rdi
callq 0x2040
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x110c7(%rip), %rax     # 0x31ff8
movq (%rax), %rdi
movq (%r13,%rbx,8), %rdx
leaq 0x90f2(%rip), %rsi      # 0x2a032
xorl %eax, %eax
callq 0x2210
jmp 0x20ef5
// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/gmap.c
// Function: mg_map_files
int mg_map_files(gfa_t *g, int n_fn, const char **fn, const mg_idxopt_t *ipt, const mg_mapopt_t *opt0, int n_threads)
{
	mg_mapopt_t opt = *opt0;
	mg_idx_t *gi;
	int i, ret = 0;
	double *cov_seg = 0, *cov_link = 0;
	if ((gi = mg_index(g, ipt, n_threads, &opt)) == 0) return -1;
	if (opt.flag & MG_M_CAL_COV) {
		KCALLOC(0, cov_seg,  g->n_seg);
		KCALLOC(0, cov_link, g->n_arc);
	}
	if (opt.flag & MG_M_FRAG_MODE) {
		ret = mg_map_file_frag(gi, n_fn, fn, &opt, n_threads, cov_seg, cov_link);
	} else {
		for (i = 0; i < n_fn; ++i) {
			ret = mg_map_file_frag(gi, 1, &fn[i], &opt, n_threads, cov_seg, cov_link);
			if (ret != 0) break;
		}
	}
	if (opt.flag & MG_M_CAL_COV) {
		gfa_aux_update_cv(g, "dc", cov_seg, cov_link);
		free(cov_seg); free(cov_link);
	}
	mg_idx_destroy(gi);
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %r9d, %ebp
movq %rcx, %rbx
movq %rdx, %r15
movl %esi, 0x14(%rsp)
movq %rdi, %r13
leaq 0x20(%rsp), %r14
movl $0xa8, %edx
movq %r14, %rdi
movq %r8, %rsi
callq 0x2230
movq %r13, %rdi
movq %rbx, %rsi
movl %ebp, %edx
movq %r14, %rcx
callq 0x15c5f
testq %rax, %rax
je 0x215c4
movq %rax, %r14
movq 0x20(%rsp), %rax
btl $0xe, %eax
movq %r13, 0x18(%rsp)
jb 0x215ce
xorl %r12d, %r12d
xorl %r13d, %r13d
jmp 0x215f9
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x21692
movl 0x4(%r13), %esi
movl $0x8, %edx
xorl %edi, %edi
callq 0x2f84
movq %rax, %r12
movq 0x40(%r13), %rsi
movl $0x8, %edx
xorl %edi, %edi
callq 0x2f84
movq %rax, %r13
movq 0x20(%rsp), %rax
movl 0x14(%rsp), %esi
testb $0x40, %al
jne 0x21639
xorl %ebx, %ebx
testl %esi, %esi
jle 0x2165c
movl %esi, %ebx
movq %r13, (%rsp)
movq %r14, %rdi
movl $0x1, %esi
movq %r15, %rdx
leaq 0x20(%rsp), %rcx
movl %ebp, %r8d
movq %r12, %r9
callq 0x20db8
testl %eax, %eax
jne 0x21657
addq $0x8, %r15
decq %rbx
jne 0x21609
xorl %ebx, %ebx
jmp 0x2165c
movq %r13, (%rsp)
leaq 0x20(%rsp), %rcx
movq %r14, %rdi
movq %r15, %rdx
movl %ebp, %r8d
movq %r12, %r9
callq 0x20db8
movl %eax, %ebx
jmp 0x2165c
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testb $0x40, 0x21(%rsp)
je 0x2168a
leaq 0x89c5(%rip), %rsi      # 0x2a02f
movq 0x18(%rsp), %rdi
movq %r12, %rdx
movq %r13, %rcx
callq 0x6577
movq %r12, %rdi
callq 0x2040
movq %r13, %rdi
callq 0x2040
movq %r14, %rdi
callq 0x152d1
movl %ebx, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/ggen.c
// Function: mg_ggen_aug
int mg_ggen_aug(gfa_t *g, int32_t n_fn, const char **fn, const mg_idxopt_t *ipt, const mg_mapopt_t *opt0, const mg_ggopt_t *go, int n_threads)
{
	int i;
	mg_mapopt_t opt = *opt0;
	if (g == 0) return -1;
	for (i = 0; i < n_fn; ++i) {
		mg_idx_t *gi;
		maprst_t *r;
		if ((gi = mg_index(g, ipt, n_threads, &opt)) == 0) return -1;
		r = ggen_map(gi, &opt, fn[i], n_threads);
		if (opt0->flag & MG_M_CIGAR)
			mg_ggsimple_cigar(0, go, g, r->n_seq, r->seq, r->gcs);
		else
			mg_ggsimple(0, go, g, r->n_seq, r->seq, r->gcs);
		mg_free_maprst(r);
		mg_idx_destroy(gi);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %r9, 0x8(%rsp)
movq %rcx, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movl %esi, %ebx
movq %rdi, %r13
leaq 0x30(%rsp), %rdi
movl $0xa8, %edx
movq %r8, 0x18(%rsp)
movq %r8, %rsi
callq 0x2230
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %r13, %r13
je 0x24817
testl %ebx, %ebx
jle 0x2480e
movl 0x110(%rsp), %r15d
movl %ebx, %eax
movq %rax, 0x10(%rsp)
xorl %ebp, %ebp
leaq 0x30(%rsp), %rbx
movq %r13, %rdi
movq 0x28(%rsp), %rsi
movl %r15d, %edx
movq %rbx, %rcx
callq 0x15c5f
testq %rax, %rax
je 0x24812
movq %rax, %r12
movq 0x20(%rsp), %rax
movq (%rax,%rbp,8), %rdx
movq %r12, %rdi
movq %rbx, %rsi
movl %r15d, %r14d
movl %r15d, %ecx
callq 0x24829
movq 0x18(%rsp), %rcx
testb $0x4, 0x3(%rcx)
movq %rax, %r15
movl (%rax), %ecx
movq 0x8(%rax), %r8
movq 0x10(%rax), %r9
jne 0x247de
xorl %edi, %edi
movq 0x8(%rsp), %rsi
movq %r13, %rdx
callq 0x21f8b
jmp 0x247ed
xorl %edi, %edi
movq 0x8(%rsp), %rsi
movq %r13, %rdx
callq 0x2330a
movq %r15, %rdi
callq 0x249c3
movq %r12, %rdi
callq 0x152d1
incq %rbp
cmpq %rbp, 0x10(%rsp)
movl %r14d, %r15d
jne 0x24780
xorl %eax, %eax
jmp 0x24817
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/ggen.c
// Function: ggen_map
static maprst_t *ggen_map(const mg_idx_t *gi, const mg_mapopt_t *opt, const char *fn, int n_threads)
{
	mg_bseq_file_t *fp;
	maprst_t *r;
	step_t s;
	int i;

	fp = mg_bseq_open(fn);
	if (fp == 0) return 0;

	KCALLOC(0, r, 1);
	r->seq = mg_bseq_read(fp, 1ULL<<62, 0, 0, 0, &r->n_seq);
	mg_bseq_close(fp);
	if (mg_verbose >= 3)
		fprintf(stderr, "[M::%s::%.3f*%.2f] loaded file \"%s\"\n", __func__,
				realtime() - mg_realtime0, cputime() / (realtime() - mg_realtime0), fn);
	for (i = 0; i < r->n_seq; ++i) {
		r->seq[i].rid = i;
		mg_toupper(r->seq[i].l_seq, r->seq[i].seq);
	}
	KCALLOC(0, r->gcs, r->n_seq);

	s.gi = gi, s.opt = opt, s.r = r;
	KCALLOC(0, s.buf, n_threads);
	for (i = 0; i < n_threads; ++i) s.buf[i] = mg_tbuf_init();
	kt_for(n_threads, worker_for, &s, r->n_seq);
	if (mg_verbose >= 3)
		fprintf(stderr, "[M::%s::%.3f*%.2f] mapped %d sequence(s) to the graph\n", __func__,
				realtime() - mg_realtime0, cputime() / (realtime() - mg_realtime0), r->n_seq);
	for (i = 0; i < n_threads; ++i) mg_tbuf_destroy(s.buf[i]);
	free(s.buf);
	return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %ebp
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r15
movq %rdx, %rdi
callq 0xf440
testq %rax, %rax
je 0x24998
movq %rax, %r13
movl $0x1, %esi
movl $0x18, %edx
xorl %edi, %edi
callq 0x2f84
movq %rax, %rbx
movabsq $0x4000000000000000, %rsi # imm = 0x4000000000000000
movq %r13, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %rax, %r9
callq 0xf557
movq %rax, 0x8(%rbx)
movq %r13, %rdi
callq 0xf4eb
leaq 0xdb67(%rip), %r13      # 0x32400
cmpl $0x3, (%r13)
jge 0x249ac
movslq (%rbx), %rsi
testq %rsi, %rsi
jle 0x248fd
xorl %eax, %eax
movl %esi, %edx
movq 0x8(%rbx), %rsi
leaq (%rax,%rax,4), %rdi
movl %eax, 0x4(%rsi,%rdi,8)
movslq (%rsi,%rdi,8), %rcx
testq %rcx, %rcx
jle 0x248f2
movq 0x10(%rsi,%rdi,8), %rdx
xorl %esi, %esi
movzbl (%rdx,%rsi), %edi
leal -0x7b(%rdi), %r8d
leal -0x20(%rdi), %r9d
cmpb $-0x1a, %r8b
movzbl %r9b, %r8d
cmovbl %edi, %r8d
movb %r8b, (%rdx,%rsi)
incq %rsi
cmpq %rsi, %rcx
jne 0x248cc
movl (%rbx), %edx
incq %rax
movslq %edx, %rsi
cmpq %rsi, %rax
jl 0x248b0
movl $0x8, %edx
xorl %edi, %edi
callq 0x2f84
movq %rax, 0x10(%rbx)
movq %r15, 0x10(%rsp)
movq %r14, 0x8(%rsp)
movq %rbx, 0x20(%rsp)
movslq %ebp, %r15
movl $0x8, %edx
xorl %edi, %edi
movq %r15, %rsi
callq 0x2f84
movq %rax, 0x18(%rsp)
movl %ebp, %r12d
testl %r15d, %r15d
jle 0x24952
movq %rax, %r14
xorl %r15d, %r15d
callq 0x1ce24
movq %rax, (%r14,%r15,8)
incq %r15
cmpq %r15, %r12
jne 0x24941
movslq (%rbx), %rcx
leaq 0x5b0(%rip), %rsi       # 0x24f0c
leaq 0x8(%rsp), %rdx
movl %ebp, %edi
callq 0x33a0
cmpl $0x3, (%r13)
jge 0x249b9
testl %ebp, %ebp
jle 0x2498c
xorl %r14d, %r14d
movq 0x18(%rsp), %rax
movq (%rax,%r14,8), %rdi
callq 0x1ce50
incq %r14
cmpq %r14, %r12
jne 0x24976
movq 0x18(%rsp), %rdi
callq 0x2040
jmp 0x2499a
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
callq 0x29a8
jmp 0x248a4
movq %rbx, %rdi
callq 0x2a1c
jmp 0x2496f
// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/ggen.c
// Function: mg_free_maprst
static void mg_free_maprst(maprst_t *r)
{
	int i;
	for (i = 0; i < r->n_seq; ++i) {
		mg_gchain_free(r->gcs[i]);
		free(r->seq[i].seq); free(r->seq[i].name);
	}
	free(r->gcs); free(r->seq);
	free(r);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, (%rdi)
jle 0x24a0e
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x10(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x1ac90
movq 0x8(%rbx), %rax
movq 0x10(%rax,%r14), %rdi
callq 0x2040
movq 0x8(%rbx), %rax
movq 0x8(%rax,%r14), %rdi
callq 0x2040
incq %r15
movslq (%rbx), %rax
addq $0x28, %r14
cmpq %rax, %r15
jl 0x249d6
movq 0x10(%rbx), %rdi
callq 0x2040
movq 0x8(%rbx), %rdi
callq 0x2040
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2040
// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/ggen.c
// Function: mg_ggen_cov
int mg_ggen_cov(gfa_t *g, int32_t n_fn, const char **fn, const mg_idxopt_t *ipt, const mg_mapopt_t *opt0, const mg_ggopt_t *go, int n_threads)
{
	int32_t i;
	mg_mapopt_t opt = *opt0;
	mg_idx_t *gi;
	double *cov_seg, *cov_link;
	int64_t j;
	if ((gi = mg_index(g, ipt, n_threads, &opt)) == 0) return -1;
	KCALLOC(0, cov_seg,  g->n_seg);
	KCALLOC(0, cov_link, g->n_arc);
	for (i = 0; i < n_fn; ++i) {
		maprst_t *r;
		r = ggen_map(gi, &opt, fn[i], n_threads);
		mg_cov_asm(g, r->n_seq, r->gcs, go->min_mapq, go->min_map_len, cov_seg, cov_link);
		mg_free_maprst(r);
	}
	mg_idx_destroy(gi);
	for (j = 0; j < g->n_seg; ++j) cov_seg[j] /= n_fn;
	for (j = 0; j < g->n_arc; ++j) cov_link[j] /= n_fn;
	gfa_aux_update_cv(g, "cf", cov_seg, cov_link);
	free(cov_seg); free(cov_link);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %r9, %r12
movq %rcx, %rbx
movq %rdx, 0x30(%rsp)
movl %esi, %ebp
movq %rdi, %r13
movl 0x120(%rsp), %r15d
leaq 0x40(%rsp), %r14
movl $0xa8, %edx
movq %r14, %rdi
movq %r8, %rsi
callq 0x2230
movq %r13, %rdi
movq %rbx, %rsi
movl %r15d, %ebx
movl %r15d, %edx
movq %r14, %rcx
callq 0x15c5f
testq %rax, %rax
je 0x24baf
movl 0x4(%r13), %esi
movl $0x8, %edx
movq %rax, 0x28(%rsp)
xorl %edi, %edi
callq 0x2f84
movq %rax, 0x18(%rsp)
movq 0x40(%r13), %rsi
movl $0x8, %edx
xorl %edi, %edi
callq 0x2f84
movq 0x30(%rsp), %rcx
movq %rax, %r15
movl %ebp, 0x14(%rsp)
testl %ebp, %ebp
movq %r13, 0x20(%rsp)
jle 0x24b2c
movq %r12, %r14
movl 0x14(%rsp), %eax
movq %rax, 0x38(%rsp)
xorl %ebp, %ebp
movq (%rcx,%rbp,8), %rdx
movq 0x28(%rsp), %rdi
leaq 0x40(%rsp), %rsi
movq %rcx, %r12
movl %ebx, %ecx
callq 0x24829
movl %ebx, %r13d
movq %rax, %rbx
movl (%rax), %esi
movq 0x10(%rax), %rdx
movl 0xc(%r14), %ecx
movl 0x10(%r14), %r8d
movq %r15, (%rsp)
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %r9
callq 0x1f1f6
movq %rbx, %rdi
movl %r13d, %ebx
callq 0x249c3
movq %r12, %rcx
incq %rbp
cmpq %rbp, 0x38(%rsp)
jne 0x24ad5
movq 0x28(%rsp), %rdi
callq 0x152d1
movq 0x20(%rsp), %rdi
movl 0x4(%rdi), %eax
cvtsi2sdl 0x14(%rsp), %xmm0
testq %rax, %rax
movq 0x18(%rsp), %rbx
je 0x24b66
xorl %ecx, %ecx
movsd (%rbx,%rcx,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rbx,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x24b50
movq 0x40(%rdi), %rax
testq %rax, %rax
je 0x24b89
xorl %ecx, %ecx
movsd (%r15,%rcx,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%r15,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x24b71
leaq 0x5aab(%rip), %rsi      # 0x2a63b
movq %rbx, %rdx
movq %r15, %rcx
callq 0x6577
movq %rbx, %rdi
callq 0x2040
movq %r15, %rdi
callq 0x2040
xorl %eax, %eax
jmp 0x24bb4
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/ggen.c
// Function: mg_ggen_call
int mg_ggen_call(gfa_t *g, const char *fn, const mg_idxopt_t *ipt, const mg_mapopt_t *opt0, const mg_ggopt_t *go, int n_threads)
{
	mg_mapopt_t opt = *opt0;
	mg_idx_t *gi;
	maprst_t *r;
	if ((gi = mg_index(g, ipt, n_threads, &opt)) == 0) return -1;
	r = ggen_map(gi, &opt, fn, n_threads);
	mg_call_asm(g, r->n_seq, r->seq, r->gcs, go->min_mapq, go->min_map_len);
	mg_free_maprst(r);
	mg_idx_destroy(gi);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %r9d, %ebp
movq %r8, %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
movq %rsp, %r13
movl $0xa8, %edx
movq %r13, %rdi
movq %rcx, %rsi
callq 0x2230
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
movq %r13, %rcx
callq 0x15c5f
testq %rax, %rax
je 0x24c52
movq %rax, %r15
movq %rsp, %rsi
movq %rax, %rdi
movq %r12, %rdx
movl %ebp, %ecx
callq 0x24829
movq %rax, %r12
movl (%rax), %esi
movq 0x8(%rax), %rdx
movq 0x10(%rax), %rcx
movl 0xc(%rbx), %r8d
movl 0x10(%rbx), %r9d
movq %r14, %rdi
callq 0x24fbc
movq %r12, %rdi
callq 0x249c3
movq %r15, %rdi
callq 0x152d1
xorl %eax, %eax
jmp 0x24c57
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/ggen.c
// Function: worker_for
static void worker_for(void *_data, long i, int tid) // kt_for() callback
{
    step_t *s = (step_t*)_data;
	if (mg_dbg_flag & MG_DBG_QNAME)
		fprintf(stderr, "QR\t%s\t%d\t%d\n", s->r->seq[i].name, tid, s->r->seq[i].l_seq);
	if ((s->opt->flag & MG_M_SKIP_GCHECK) == 0 && mg_verbose >= 2) {
		if (gfa_sseq_get(s->gi->g, s->r->seq[i].name) >= 0)
			fprintf(stderr, "[W::%s] stable sequence \"%s\" already present in the graph. This will lead to inconsistent rGFA.\n",
					__func__, s->r->seq[i].name);
	}
	s->r->gcs[i] = mg_map(s->gi, s->r->seq[i].l_seq, s->r->seq[i].seq, s->buf[tid], s->opt, s->r->seq[i].name);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xd759(%rip), %rax      # 0x32678
testb $0x2, (%rax)
jne 0x24f9c
movq (%r14), %rax
testb $0x2, 0x3(%rax)
jne 0x24f5a
leaq 0xd4cc(%rip), %rax      # 0x32400
cmpl $0x2, (%rax)
jl 0x24f5a
movq 0x8(%r14), %rax
movq 0x18(%r14), %rcx
movq (%rax), %rdi
movq 0x8(%rcx), %rax
leaq (%rbx,%rbx,4), %rcx
movq 0x8(%rax,%rcx,8), %rsi
callq 0x5089
testl %eax, %eax
jns 0x24fae
movq (%r14), %r8
movq 0x8(%r14), %rdi
movq 0x18(%r14), %rax
movq 0x8(%rax), %rax
leaq (%rbx,%rbx,4), %r9
movl (%rax,%r9,8), %esi
movq 0x10(%rax,%r9,8), %rdx
movq 0x10(%r14), %rcx
movslq %ebp, %r10
movq (%rcx,%r10,8), %rcx
movq 0x8(%rax,%r9,8), %r9
callq 0x1e9e0
movq 0x18(%r14), %rcx
movq 0x10(%rcx), %rcx
movq %rax, (%rcx,%rbx,8)
popq %rbx
popq %r14
popq %rbp
retq
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x2a90
jmp 0x24f24
leaq 0x18(%r14), %rdi
movq %rbx, %rsi
callq 0x2ac2
jmp 0x24f5a
// File: /workspace/github_c_makefile_star2_O3/kopytjuk[P]wasm-image-converter/src/converter.cpp
// Function: resolveImageType(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
ImageType resolveImageType(const string ext){
  if (ext == ".jpg" | ext==".jpeg"){
    return JpegImage;
  } else if (ext == ".png"){
    return PngImage;
  } else {
    return UnknownImage;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x8cf3(%rip), %rsi      # 0xe18c
callq 0x41a0
movl %eax, %r14d
leaq 0x8ce9(%rip), %rsi      # 0xe191
movq %rbx, %rdi
callq 0x41a0
movl %eax, %ecx
movl $0x1, %eax
testl %r14d, %r14d
je 0x54da
testl %ecx, %ecx
je 0x54da
leaq 0x8cd0(%rip), %rsi      # 0xe197
movq %rbx, %rdi
callq 0x41a0
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
addl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/kopytjuk[P]wasm-image-converter/src/converter.cpp
// Function: convert_image(char**, int&, ImageType, char**, int&, ImageType)
void convert_image(char** inp, int& insize, ImageType intype, char** outp, 
  int& outsize, ImageType outtype){

  cout << "Decoding image..." << endl;

  cout << "First 10 bytes: ";
  utils::print_first_bytes(*inp, 10);

  rgb8_image_t imageData;

  char_array_to_image(inp, insize, imageData, intype);

  cout << "Image decoded! Encoding..." << endl;
  
  image_to_char_array(imageData, outtype, outp, outsize);

  cout << "Image encoded to desired format!" << endl;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r9d, -0x2c(%rbp)
movq %r8, -0x38(%rbp)
movq %rcx, %r15
movl %edx, %r12d
movq %rsi, %rbx
movq %rdi, %r13
movq 0xeacd(%rip), %r14      # 0x13fd8
leaq 0x8c8a(%rip), %rsi      # 0xe19c
movl $0x11, %edx
movq %r14, %rdi
callq 0x45a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x44f0
movsbl %al, %esi
movq %r14, %rdi
callq 0x4060
movq %rax, %rdi
callq 0x43b0
leaq 0x8c61(%rip), %rsi      # 0xe1ae
movl $0x10, %edx
movq %r14, %rdi
callq 0x45a0
movq (%r13), %rdi
movl $0xa, %esi
callq 0xd72d
xorl %eax, %eax
leaq -0x80(%rbp), %rdx
movq %rax, 0x10(%rdx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rdx)
movq $0x3, 0x18(%rdx)
movq %rax, 0x38(%rdx)
movaps %xmm0, 0x20(%rdx)
movl (%rbx), %esi
movq %r13, %rdi
movl %r12d, %ecx
callq 0x5660
movq 0xea3c(%rip), %rbx      # 0x13fd8
leaq 0x8c1c(%rip), %rsi      # 0xe1bf
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x45a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x44f0
movsbl %al, %esi
movq 0xea0a(%rip), %rdi      # 0x13fd8
callq 0x4060
movq %rax, %rdi
callq 0x43b0
leaq -0x80(%rbp), %rdi
movl -0x2c(%rbp), %esi
movq %r15, %rdx
movq -0x38(%rbp), %rcx
callq 0x578e
movq 0xe9e3(%rip), %rbx      # 0x13fd8
leaq 0x8bde(%rip), %rsi      # 0xe1da
movl $0x20, %edx
movq %rbx, %rdi
callq 0x45a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x44f0
movsbl %al, %esi
movq 0xe9b1(%rip), %rdi      # 0x13fd8
callq 0x4060
movq %rax, %rdi
callq 0x43b0
leaq -0x80(%rbp), %rdi
callq 0x5aac
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x5aac
movq %rbx, %rdi
callq 0x48b0
// File: /workspace/github_c_makefile_star2_O3/kopytjuk[P]wasm-image-converter/src/converter.cpp
// Function: char_array_to_image(char**, int, boost::gil::image<boost::gil::pixel<unsigned char, boost::gil::layout<boost::mp11::mp_list<boost::gil::red_t, boost::gil::green_t, boost::gil::blue_t>, boost::mp11::mp_list<std::integral_constant<int, 0>, std::integral_constant<int, 1>, std::integral_constant<int, 2>>>>, false, std::allocator<unsigned char>>&, ImageType)
void char_array_to_image(char **arr, int arr_size, rgb8_image_t &img, ImageType type) {
  
  stringstream arr_stream(ios_base::in | ios_base::out | ios_base::binary);
  arr_stream.write(*arr, arr_size);
  arr_stream.seekg(0);

  switch (type) {
    case JpegImage:
      read_image( arr_stream, img, jpeg_tag() );
      break;
    case PngImage:
      read_image( arr_stream, img, png_tag() );
      break;
    default:
      cout << "Cannot convert input image type! Exiting." << endl;
      break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x190, %rsp            # imm = 0x190
movl %ecx, %r14d
movq %rdx, %rbx
movl %esi, %r15d
movq %rdi, %r12
leaq -0x1b0(%rbp), %rdi
movl $0x1c, %esi
callq 0x4400
leaq -0x1a0(%rbp), %rdi
movq (%r12), %rsi
movslq %r15d, %rdx
callq 0x4600
leaq -0x1b0(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x45f0
testl %r14d, %r14d
je 0x56d4
cmpl $0x1, %r14d
jne 0x56eb
leaq -0x1b0(%rbp), %rdi
leaq -0x21(%rbp), %rdx
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x5b14
jmp 0x5731
leaq -0x1b0(%rbp), %rdi
leaq -0x21(%rbp), %rdx
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x5c61
jmp 0x5731
movq 0xe8e6(%rip), %rbx      # 0x13fd8
leaq 0x8b02(%rip), %rsi      # 0xe1fb
movl $0x29, %edx
movq %rbx, %rdi
callq 0x45a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x44f0
movsbl %al, %esi
movq 0xe8b4(%rip), %rdi      # 0x13fd8
callq 0x4060
movq %rax, %rdi
callq 0x43b0
movq 0xe868(%rip), %rsi      # 0x13fa0
leaq -0x1b0(%rbp), %rdi
callq 0x43e0
leaq -0x130(%rbp), %rdi
callq 0x4210
addq $0x190, %rsp            # imm = 0x190
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5764
jmp 0x5764
movq %rax, %rbx
movq 0xe832(%rip), %rsi      # 0x13fa0
leaq -0x1b0(%rbp), %rdi
callq 0x43e0
leaq -0x130(%rbp), %rdi
callq 0x4210
movq %rbx, %rdi
callq 0x48b0
// File: /workspace/github_c_makefile_star2_O3/kopytjuk[P]wasm-image-converter/src/utils.cpp
// Function: utils::filesize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int utils::filesize(std::string fn){
    
    int size;

    std::ifstream file (fn, std::ios::in | std::ios::binary | std::ios::ate);

    if (file.is_open())
    {
        file.seekg(0, std::ios::end);
        size = file.tellg();
        file.close();
        return size;

    } else{
        return -1;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdi, %rsi
leaq -0x210(%rbp), %rdi
movl $0xe, %edx
callq 0x47a0
leaq -0x198(%rbp), %rdi
callq 0x4150
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testb %al, %al
je 0xd8f0
leaq -0x210(%rbp), %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x4620
leaq -0x210(%rbp), %rdi
callq 0x4870
movq %rax, %rbx
leaq -0x210(%rbp), %rdi
callq 0x4120
leaq -0x210(%rbp), %rdi
callq 0x4170
movl %ebx, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %rbp
retq
jmp 0xd90a
movq %rax, %rbx
leaq -0x210(%rbp), %rdi
callq 0x4170
movq %rbx, %rdi
callq 0x48b0
// File: /workspace/github_c_makefile_star2_O3/craigbarnes[P]lua-gumbo/gumbo/util.c
// Function: do_trim
static const char *do_trim(const char *str, size_t *n)
{
    size_t len = *n;
    while (len && ascii_isspace(*str)) {
        len--;
        str++;
    }

    const char *end = str + len - 1;
    while (len && ascii_isspace(*end)) {
        len--;
        end--;
    }

    *n = len;
    return str;
}

// Assembly:
movq %rdi, %rax
movq (%rsi), %r9
testq %r9, %r9
je 0x1370
leaq (%rax,%r9), %r10
movq %r9, %rdx
negq %rdx
leaq 0xcfd(%rip), %r8        # 0x2050
xorl %ecx, %ecx
movq %rax, %rdi
movzbl (%rdi), %r11d
testb $0x1, (%r8,%r11)
je 0x1374
incq %rdi
incq %rdx
jne 0x1358
movq %r10, %rax
jmp 0x13a9
xorl %ecx, %ecx
jmp 0x13a9
addq %r9, %rax
decq %rax
leaq 0x1(%rdx), %r10
xorl %ecx, %ecx
xorl %r9d, %r9d
movzbl (%rax,%r9), %r11d
testb $0x1, (%r8,%r11)
je 0x13a0
leaq -0x1(%r9), %r11
cmpq %r9, %r10
movq %r11, %r9
jne 0x1383
movq %rdi, %rax
jmp 0x13a9
subq %rdx, %r9
movq %rdi, %rax
movq %r9, %rcx
movq %rcx, (%rsi)
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/skoren[P]bacValidation/samToErrorRate.C
// Function: rc(char*, int)
char *rc(char *input, int len) {
   char *seq = new char[len+1];
   input+=len-1;
   for (int i = 0; i < len; i++) {
      seq[i]=basemap[*input];
      input--;
   }
   return seq;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
leal 0x1(%r14), %eax
movslq %eax, %rdi
callq 0x3030
testl %r14d, %r14d
jle 0xa52c
movl %r14d, %ecx
leaq 0x24ac(%rip), %rdx      # 0xc9c0
movq %rax, %rsi
movsbq -0x1(%rbx,%rcx), %rdi
movb (%rdi,%rdx), %dil
movb %dil, (%rsi)
incq %rsi
decq %rcx
jne 0xa517
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/lecram[P]congif/term.c
// Function: new_term
Term *
new_term(int rows, int cols)
{
    size_t size = sizeof(Term) + rows*sizeof(Cell *) + rows*cols*sizeof(Cell);
    Term *term = malloc(size);
    if (!term)
        return NULL;
    term->rows = rows;
    term->cols = cols;
    term->addr = (Cell **) &term[1];
    term->cells = (Cell *) &term->addr[rows];
    reset(term);
    term->plt_dirty = 0;
    return term;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movslq %edi, %r15
movl %r15d, %eax
imull %esi, %eax
cltq
shlq $0x2, %rax
leaq (%rax,%r15,8), %rdi
addq $0x1a0, %rdi            # imm = 0x1A0
callq 0x1150
movq %rax, %r14
testq %rax, %rax
je 0x1759
movl %r15d, (%r14)
movl %ebx, 0x4(%r14)
leaq 0x1a0(%r14), %rax
movq %rax, 0x20(%r14)
leaq (%r14,%r15,8), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movq %rax, 0x28(%r14)
movq %r14, %rdi
callq 0x1762
movb $0x0, 0x19d(%r14)
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/lecram[P]congif/term.c
// Function: reset
static void
reset(Term *term)
{
    int i, j;

    term->row = term->col = 0;
    term->top = 0;
    term->bot = term->rows - 1;
    term->mode = def_mode;
    term->attr = def_attr;
    term->pair = def_pair;
    term->cs_array[0] = CS_BMP;
    term->cs_array[1] = CS_VTG;
    term->cs_index = 0;
    term->state = S_ANY;
    term->parlen = 0;
    if (memcmp(term->plt, def_plt, sizeof(term->plt) != 0)) {
        term->plt_dirty = 1;
    }
    memcpy(term->plt, def_plt, sizeof(term->plt));
    term->plt_local = 0;
    for (i = 0; i < term->rows; i++) {
        term->addr[i] = &term->cells[i*term->cols];
        for (j = 0; j < term->cols; j++)
            term->addr[i][j] = (Cell) {EMPTY, def_attr, def_pair};
    }
    save_cursor(term);
    save_misc(term);
}

// Assembly:
xorl %ecx, %ecx
movq %rcx, 0x8(%rdi)
movl %ecx, 0x10(%rdi)
movl (%rdi), %eax
leal -0x1(%rax), %edx
movl %edx, 0x14(%rdi)
movl $0x70000580, 0x18(%rdi) # imm = 0x70000580
movabsq $0x200000000, %rdx      # imm = 0x200000000
movq %rdx, 0x30(%rdi)
movl %ecx, 0x38(%rdi)
movq %rcx, 0x60(%rdi)
leaq 0x16c(%rdi), %rdx
movq 0x6a73(%rip), %rsi      # 0x8210
movb 0x16c(%rdi), %r8b
cmpb (%rsi), %r8b
je 0x17b0
movb $0x1, 0x19d(%rdi)
movups (%rsi), %xmm0
movdqu 0x10(%rsi), %xmm1
movups 0x20(%rsi), %xmm2
movups %xmm2, 0x20(%rdx)
movdqu %xmm1, 0x10(%rdx)
movups %xmm0, (%rdx)
movb $0x0, 0x19c(%rdi)
testl %eax, %eax
jle 0x183a
movl 0x4(%rdi), %edx
xorl %ecx, %ecx
movl %ecx, %esi
imull %edx, %esi
movslq %esi, %rsi
shlq $0x2, %rsi
addq 0x28(%rdi), %rsi
movq 0x20(%rdi), %r8
movq %rsi, (%r8,%rcx,8)
testl %edx, %edx
jle 0x1813
xorl %eax, %eax
movq 0x20(%rdi), %rdx
movq (%rdx,%rcx,8), %rdx
movl $0x70000020, (%rdx,%rax,4) # imm = 0x70000020
incq %rax
movslq 0x4(%rdi), %rdx
cmpq %rdx, %rax
jl 0x17f6
movl (%rdi), %eax
incq %rcx
movslq %eax, %rsi
cmpq %rsi, %rcx
jl 0x17d8
movq 0x8(%rdi), %xmm1
movzwl 0x18(%rdi), %esi
movb 0x1a(%rdi), %dl
movb 0x1b(%rdi), %al
movsd 0x30(%rdi), %xmm0
movl 0x38(%rdi), %ecx
andl $0x40, %esi
jmp 0x184c
pxor %xmm1, %xmm1
movsd 0x37ca(%rip), %xmm0     # 0x5010
movb $0x70, %al
xorl %edx, %edx
xorl %esi, %esi
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
movdqu %xmm1, 0x3c(%rdi)
movl %esi, 0x4c(%rdi)
movb %dl, 0x50(%rdi)
movb %al, 0x51(%rdi)
movlps %xmm0, 0x54(%rdi)
movl %ecx, 0x5c(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/lecram[P]congif/term.c
// Function: addchar
static void
addchar(Term *term, uint16_t code)
{
    Cell cell = (Cell) {code, term->attr, term->pair};
    if (term->col >= term->cols) {
        if (term->mode & M_AUTOWRAP) {
            term->col = 0;
            if (term->row < term->bot)
                term->row++;
            else
                scroll_down(term);
        } else {
            term->col = term->cols - 1;
        }
    }
    if (!within_bounds(term, term->row, term->col))
        return;
    if (term->mode & M_INSERT) {
        Cell next;
        int col;
        for (col = term->col; col < term->cols; col++) {
            next = term->addr[term->row][col];
            term->addr[term->row][col] = cell;
            cell = next;
        }
    } else {
        term->addr[term->row][term->col] = cell;
    }
    term->col++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movb 0x1a(%rdi), %r14b
movb 0x1b(%rdi), %r15b
movl 0x4(%rdi), %eax
movl 0xc(%rdi), %edx
cmpl %eax, %edx
jl 0x281c
testb $-0x80, 0x18(%rbx)
jne 0x27f9
decl %eax
movl %eax, 0xc(%rbx)
movl %eax, %edx
jmp 0x281c
movl $0x0, 0xc(%rbx)
movl 0x8(%rbx), %eax
cmpl 0x14(%rbx), %eax
jge 0x2811
incl %eax
movl %eax, 0x8(%rbx)
xorl %edx, %edx
jmp 0x281c
movq %rbx, %rdi
callq 0x2a56
movl 0xc(%rbx), %edx
movl 0x8(%rbx), %esi
movq %rbx, %rdi
callq 0x2adf
testl %eax, %eax
je 0x2899
testb $0x2, 0x18(%rbx)
jne 0x2851
movq 0x20(%rbx), %rax
movslq 0x8(%rbx), %rcx
movq (%rax,%rcx,8), %rax
movslq 0xc(%rbx), %rcx
movw %bp, (%rax,%rcx,4)
movb %r14b, 0x2(%rax,%rcx,4)
movb %r15b, 0x3(%rax,%rcx,4)
jmp 0x2896
movslq 0xc(%rbx), %rax
cmpl 0x4(%rbx), %eax
jge 0x2896
movq 0x20(%rbx), %rcx
movslq 0x8(%rbx), %rdx
movq (%rcx,%rdx,8), %rcx
movzwl (%rcx,%rax,4), %edx
movb 0x2(%rcx,%rax,4), %sil
movb 0x3(%rcx,%rax,4), %dil
movw %bp, (%rcx,%rax,4)
movb %r14b, 0x2(%rcx,%rax,4)
movb %r15b, 0x3(%rcx,%rax,4)
incq %rax
movslq 0x4(%rbx), %rcx
movl %edx, %ebp
movl %esi, %r14d
movl %edi, %r15d
cmpq %rcx, %rax
jl 0x285a
incl 0xc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/lecram[P]congif/term.c
// Function: do_linux_osc
static int
do_linux_osc(Term *term)
{
    int i;
    uint8_t buf[4] = {0,0,0,0};
    if (term->partial[0] == 'R')
    {
        if (memcmp(term->plt, def_plt, sizeof(term->plt) != 0))
            term->plt_dirty = 1;
        memcpy(term->plt, def_plt, sizeof(term->plt));
        term->plt_local = 0;
        return 1;
    }
    if (term->partial[0] != 'P' || term->parlen != 8)
        return 0;

    for (i=1; i<8; i++) {
        /* isxdigit is locale broken */
        int ch = term->partial[i];
        if (ch >= '0' && ch <= '9')
            buf[i>>1] = (buf[i>>1] << 4) + (ch - '0');
        else if (ch >= 'a' && ch <= 'f')
            buf[i>>1] = (buf[i>>1] << 4) + (ch - 'a' + 10);
        else if (ch >= 'A' && ch <= 'F')
            buf[i>>1] = (buf[i>>1] << 4) + (ch - 'A' + 10);
        else
            return 0;
    }
    for(i=0; i<3; i++) {
        if (term->plt[buf[0]*3+i] != buf[i+1]) {
            term->plt[buf[0]*3+i] = buf[i+1];
            term->plt_local = term->plt_dirty = 1;
        }
    }

    return 1;
}

// Assembly:
movl $0x0, -0x4(%rsp)
movzbl 0x6c(%rdi), %ecx
xorl %eax, %eax
cmpl $0x50, %ecx
je 0x29a7
cmpl $0x52, %ecx
jne 0x2a52
leaq 0x16c(%rdi), %rax
movq 0x589c(%rip), %rcx      # 0x8210
movb 0x16c(%rdi), %dl
cmpb (%rcx), %dl
je 0x2985
movb $0x1, 0x19d(%rdi)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups 0x20(%rcx), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movb $0x0, 0x19c(%rdi)
jmp 0x2a4d
cmpl $0x8, 0x64(%rdi)
jne 0x2a52
xorl %eax, %eax
movb 0x6d(%rdi,%rax), %cl
incq %rax
leal -0x30(%rcx), %edx
cmpb $0x9, %dl
ja 0x29d9
movl %eax, %ecx
shrl %ecx
movb -0x4(%rsp,%rcx), %sil
shlb $0x4, %sil
orb %dl, %sil
movb %sil, -0x4(%rsp,%rcx)
jmp 0x2a15
leal -0x61(%rcx), %edx
cmpb $0x5, %dl
ja 0x29f6
movl %eax, %edx
shrl %edx
movb -0x4(%rsp,%rdx), %sil
shlb $0x4, %sil
addb %sil, %cl
addb $-0x57, %cl
jmp 0x2a11
leal -0x41(%rcx), %edx
cmpb $0x5, %dl
ja 0x2a53
movl %eax, %edx
shrl %edx
movb -0x4(%rsp,%rdx), %sil
shlb $0x4, %sil
addb %sil, %cl
addb $-0x37, %cl
movb %cl, -0x4(%rsp,%rdx)
cmpq $0x7, %rax
jne 0x29b3
movzbl -0x4(%rsp), %eax
leaq (%rax,%rax,2), %rax
addq %rdi, %rax
addq $0x16c, %rax            # imm = 0x16C
xorl %ecx, %ecx
movb -0x3(%rsp,%rcx), %dl
cmpb %dl, (%rax,%rcx)
je 0x2a44
movb %dl, (%rax,%rcx)
movw $0x101, 0x19c(%rdi)     # imm = 0x101
incq %rcx
cmpq $0x3, %rcx
jne 0x2a2f
movl $0x1, %eax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/lecram[P]congif/term.c
// Function: scroll_down
static void
scroll_down(Term *term)
{
    int row, col;
    Cell *addr;

    if (!within_bounds(term, term->top, 0))
        return;
    if (!within_bounds(term, term->bot, 0))
        return;
    addr = term->addr[term->top];
    for (row = term->top; row < term->bot; row++)
        term->addr[row] = term->addr[row+1];
    term->addr[term->bot] = addr;
    for (col = 0; col < term->cols; col++)
        term->addr[term->bot][col] = BLANK;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x10(%rdi), %esi
xorl %edx, %edx
callq 0x2adf
testl %eax, %eax
je 0x2add
movl 0x14(%rbx), %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2adf
testl %eax, %eax
je 0x2add
movq 0x20(%rbx), %rsi
movslq 0x10(%rbx), %rdx
movq (%rsi,%rdx,8), %rax
movslq 0x14(%rbx), %rcx
cmpl %ecx, %edx
jge 0x2aaa
movq 0x20(%rbx), %rsi
movq 0x8(%rsi,%rdx,8), %rdi
movq %rdi, (%rsi,%rdx,8)
leaq 0x1(%rdx), %rsi
movq %rsi, %rdx
cmpq %rsi, %rcx
jne 0x2a8d
movq 0x20(%rbx), %rsi
movq %rax, (%rsi,%rcx,8)
cmpl $0x0, 0x4(%rbx)
jle 0x2add
xorl %eax, %eax
movq 0x20(%rbx), %rcx
movslq 0x14(%rbx), %rdx
movq (%rcx,%rdx,8), %rcx
movzwl 0x1a(%rbx), %edx
movw $0x20, (%rcx,%rax,4)
movw %dx, 0x2(%rcx,%rax,4)
incq %rax
movslq 0x4(%rbx), %rcx
cmpq %rcx, %rax
jl 0x2ab6
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/lecram[P]congif/term.c
// Function: within_bounds
static int
within_bounds(Term *term, int row, int col)
{
    if (row < 0 || row >= term->rows || col < 0 || col > term->cols) {
        logfmt("position %d,%d is out of bounds %d,%d\n",
               row+1, col+1, term->rows, term->cols);
        return 0;
    } else {
        return 1;
    }
}

// Assembly:
pushq %rbx
movl (%rdi), %ecx
testl %esi, %esi
js 0x2b00
cmpl %esi, %ecx
setle %al
testl %edx, %edx
sets %r8b
orb %al, %r8b
jne 0x2b00
movl $0x1, %ebx
cmpl %edx, 0x4(%rdi)
jge 0x2b18
incl %esi
incl %edx
movl 0x4(%rdi), %r8d
leaq 0x2d29(%rip), %rdi      # 0x5838
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x28a4
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/lecram[P]congif/term.c
// Function: scroll_up
static void
scroll_up(Term *term)
{
    int row, col;
    Cell *addr;

    if (!within_bounds(term, term->top, 0))
        return;
    if (!within_bounds(term, term->bot, 0))
        return;
    addr = term->addr[term->bot];
    for (row = term->bot; row > term->top; row--)
        term->addr[row] = term->addr[row-1];
    term->addr[term->top] = addr;
    for (col = 0; col < term->cols; col++)
        term->addr[term->top][col] = BLANK;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x10(%rdi), %esi
xorl %edx, %edx
callq 0x2adf
testl %eax, %eax
je 0x2b9f
movl 0x14(%rbx), %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2adf
testl %eax, %eax
je 0x2b9f
movq 0x20(%rbx), %rsi
movslq 0x14(%rbx), %rdx
movq (%rsi,%rdx,8), %rax
movslq 0x10(%rbx), %rcx
cmpl %ecx, %edx
jle 0x2b6c
movq 0x20(%rbx), %rsi
movq -0x8(%rsi,%rdx,8), %rdi
movq %rdi, (%rsi,%rdx,8)
decq %rdx
cmpq %rcx, %rdx
jg 0x2b53
movq 0x20(%rbx), %rsi
movq %rax, (%rsi,%rcx,8)
cmpl $0x0, 0x4(%rbx)
jle 0x2b9f
xorl %eax, %eax
movq 0x20(%rbx), %rcx
movslq 0x10(%rbx), %rdx
movq (%rcx,%rdx,8), %rcx
movzwl 0x1a(%rbx), %edx
movw $0x20, (%rcx,%rax,4)
movw %dx, 0x2(%rcx,%rax,4)
incq %rax
movslq 0x4(%rbx), %rcx
cmpq %rcx, %rax
jl 0x2b78
popq %rbx
retq