// File: /workspace/github_c_makefile_star2_O0/LemonBoy[P]autobahn/xdiff/xdiffi.c
// Function: xdl_do_diff
int xdl_do_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
		xdfenv_t *xe) {
	long ndiags;
	long *kvd, *kvdf, *kvdb;
	xdalgoenv_t xenv;
	diffdata_t dd1, dd2;

	if (XDF_DIFF_ALG(xpp->flags) == XDF_PATIENCE_DIFF)
		return xdl_do_patience_diff(mf1, mf2, xpp, xe);

	if (XDF_DIFF_ALG(xpp->flags) == XDF_HISTOGRAM_DIFF)
		return xdl_do_histogram_diff(mf1, mf2, xpp, xe);

	if (xdl_prepare_env(mf1, mf2, xpp, xe) < 0) {

		return -1;
	}

	/*
	 * Allocate and setup K vectors to be used by the differential algorithm.
	 * One is to store the forward path and one to store the backward path.
	 */
	ndiags = xe->xdf1.nreff + xe->xdf2.nreff + 3;
	if (!(kvd = (long *) xdl_malloc((2 * ndiags + 2) * sizeof(long)))) {

		xdl_free_env(xe);
		return -1;
	}
	kvdf = kvd;
	kvdb = kvdf + ndiags;
	kvdf += xe->xdf2.nreff + 1;
	kvdb += xe->xdf2.nreff + 1;

	xenv.mxcost = xdl_bogosqrt(ndiags);
	if (xenv.mxcost < XDL_MAX_COST_MIN)
		xenv.mxcost = XDL_MAX_COST_MIN;
	xenv.snake_cnt = XDL_SNAKE_CNT;
	xenv.heur_min = XDL_HEUR_MIN_COST;

	dd1.nrec = xe->xdf1.nreff;
	dd1.ha = xe->xdf1.ha;
	dd1.rchg = xe->xdf1.rchg;
	dd1.rindex = xe->xdf1.rindex;
	dd2.nrec = xe->xdf2.nreff;
	dd2.ha = xe->xdf2.ha;
	dd2.rchg = xe->xdf2.rchg;
	dd2.rindex = xe->xdf2.rindex;

	if (xdl_recs_cmp(&dd1, 0, dd1.nrec, &dd2, 0, dd2.nrec,
			 kvdf, kvdb, (xpp->flags & XDF_NEED_MINIMAL) != 0, &xenv) < 0) {

		xdl_free(kvd);
		xdl_free_env(xe);
		return -1;
	}

	xdl_free(kvd);

	return 0;
}

// Assembly:
pushq %rbx
subq $0xc0, %rsp
movq %rdi, 0xb0(%rsp)
movq %rsi, 0xa8(%rsp)
movq %rdx, 0xa0(%rsp)
movq %rcx, 0x98(%rsp)
movq 0xa0(%rsp), %rax
movq (%rax), %rax
andq $0x60, %rax
cmpq $0x20, %rax
jne 0x239e
movq 0xb0(%rsp), %rdi
movq 0xa8(%rsp), %rsi
movq 0xa0(%rsp), %rdx
movq 0x98(%rsp), %rcx
callq 0x3950
movl %eax, 0xbc(%rsp)
jmp 0x2671
movq 0xa0(%rsp), %rax
movq (%rax), %rax
andq $0x60, %rax
cmpq $0x40, %rax
jne 0x23e4
movq 0xb0(%rsp), %rdi
movq 0xa8(%rsp), %rsi
movq 0xa0(%rsp), %rdx
movq 0x98(%rsp), %rcx
callq 0xa990
movl %eax, 0xbc(%rsp)
jmp 0x2671
movq 0xb0(%rsp), %rdi
movq 0xa8(%rsp), %rsi
movq 0xa0(%rsp), %rdx
movq 0x98(%rsp), %rcx
callq 0x5770
cmpl $0x0, %eax
jge 0x241e
movl $0xffffffff, 0xbc(%rsp) # imm = 0xFFFFFFFF
jmp 0x2671
movq 0x98(%rsp), %rax
movq 0x78(%rax), %rax
movq 0x98(%rsp), %rcx
addq 0x100(%rcx), %rax
addq $0x3, %rax
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rdi
shlq %rdi
addq $0x2, %rdi
shlq $0x3, %rdi
callq 0x10f0
movq %rax, 0x88(%rsp)
cmpq $0x0, %rax
jne 0x2488
movq 0x98(%rsp), %rdi
callq 0x6080
movl $0xffffffff, 0xbc(%rsp) # imm = 0xFFFFFFFF
jmp 0x2671
movq 0x88(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rax
movq 0x90(%rsp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x78(%rsp)
movq 0x98(%rsp), %rax
movq 0x100(%rax), %rax
addq $0x1, %rax
shlq $0x3, %rax
addq 0x80(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x98(%rsp), %rax
movq 0x100(%rax), %rax
addq $0x1, %rax
shlq $0x3, %rax
addq 0x78(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x90(%rsp), %rdi
callq 0x6c60
movq %rax, 0x60(%rsp)
cmpq $0x100, 0x60(%rsp)      # imm = 0x100
jge 0x2522
movq $0x100, 0x60(%rsp)      # imm = 0x100
movq $0x14, 0x68(%rsp)
movq $0x100, 0x70(%rsp)      # imm = 0x100
movq 0x98(%rsp), %rax
movq 0x78(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x98(%rsp), %rax
movq 0x80(%rax), %rax
movq %rax, 0x48(%rsp)
movq 0x98(%rsp), %rax
movq 0x68(%rax), %rax
movq %rax, 0x58(%rsp)
movq 0x98(%rsp), %rax
movq 0x70(%rax), %rax
movq %rax, 0x50(%rsp)
movq 0x98(%rsp), %rax
movq 0x100(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x98(%rsp), %rax
movq 0x108(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x98(%rsp), %rax
movq 0xf0(%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x98(%rsp), %rax
movq 0xf8(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x40(%rsp), %rdx
movq 0x20(%rsp), %r9
movq 0x80(%rsp), %rbx
movq 0x78(%rsp), %r11
movq 0xa0(%rsp), %rax
movq (%rax), %rax
andq $0x2, %rax
cmpq $0x0, %rax
setne %al
andb $0x1, %al
movzbl %al, %r10d
leaq 0x40(%rsp), %rdi
xorl %eax, %eax
movl %eax, %r8d
leaq 0x20(%rsp), %rcx
leaq 0x60(%rsp), %rax
movq %r8, %rsi
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x1250
cmpl $0x0, %eax
jge 0x2659
movq 0x88(%rsp), %rdi
callq 0x1030
movq 0x98(%rsp), %rdi
callq 0x6080
movl $0xffffffff, 0xbc(%rsp) # imm = 0xFFFFFFFF
jmp 0x2671
movq 0x88(%rsp), %rdi
callq 0x1030
movl $0x0, 0xbc(%rsp)
movl 0xbc(%rsp), %eax
addq $0xc0, %rsp
popq %rbx
retq
nopw %cs:(%rax,%rax)