// File: /workspace/github_c_makefile_star2_O0/LemonBoy[P]autobahn/xdiff/xpatience.c
// Function: patience_diff
static int patience_diff(mmfile_t *file1, mmfile_t *file2,
		xpparam_t const *xpp, xdfenv_t *env,
		int line1, int count1, int line2, int count2)
{
	struct hashmap map;
	struct entry *first;
	int result = 0;

	/* trivial case: one side is empty */
	if (!count1) {
		while(count2--)
			env->xdf2.rchg[line2++ - 1] = 1;
		return 0;
	} else if (!count2) {
		while(count1--)
			env->xdf1.rchg[line1++ - 1] = 1;
		return 0;
	}

	memset(&map, 0, sizeof(map));
	if (fill_hashmap(file1, file2, xpp, env, &map,
			line1, count1, line2, count2))
		return -1;

	/* are there any matching lines at all? */
	if (!map.has_matches) {
		while(count1--)
			env->xdf1.rchg[line1++ - 1] = 1;
		while(count2--)
			env->xdf2.rchg[line2++ - 1] = 1;
		xdl_free(map.entries);
		return 0;
	}

	first = find_longest_common_sequence(&map);
	if (first)
		result = walk_common_sequence(&map, first,
			line1, count1, line2, count2);
	else
		result = fall_back_to_classic_diff(&map,
			line1, count1, line2, count2);

	xdl_free(map.entries);
	return result;
}

// Assembly:
subq $0xa8, %rsp
movl 0xb8(%rsp), %eax
movl 0xb0(%rsp), %eax
movq %rdi, 0x98(%rsp)
movq %rsi, 0x90(%rsp)
movq %rdx, 0x88(%rsp)
movq %rcx, 0x80(%rsp)
movl %r8d, 0x7c(%rsp)
movl %r9d, 0x78(%rsp)
movl $0x0, 0x24(%rsp)
cmpl $0x0, 0x78(%rsp)
jne 0x3a86
jmp 0x3a30
movl 0xb8(%rsp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, 0xb8(%rsp)
cmpl $0x0, %eax
je 0x3a76
movq 0x80(%rsp), %rax
movq 0xf0(%rax), %rax
movl 0xb0(%rsp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0xb0(%rsp)
subl $0x1, %ecx
movslq %ecx, %rcx
movb $0x1, (%rax,%rcx)
jmp 0x3a30
movl $0x0, 0xa4(%rsp)
jmp 0x3c73
cmpl $0x0, 0xb8(%rsp)
jne 0x3ad9
jmp 0x3a92
movl 0x78(%rsp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, 0x78(%rsp)
cmpl $0x0, %eax
je 0x3ac9
movq 0x80(%rsp), %rax
movq 0x68(%rax), %rax
movl 0x7c(%rsp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0x7c(%rsp)
subl $0x1, %ecx
movslq %ecx, %rcx
movb $0x1, (%rax,%rcx)
jmp 0x3a92
movl $0x0, 0xa4(%rsp)
jmp 0x3c73
jmp 0x3adb
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
movl $0x48, %edx
callq 0x1090
movq 0x98(%rsp), %rdi
movq 0x90(%rsp), %rsi
movq 0x88(%rsp), %rdx
movq 0x80(%rsp), %rcx
movl 0x7c(%rsp), %r9d
movl 0x78(%rsp), %r11d
movl 0xb0(%rsp), %r10d
movl 0xb8(%rsp), %eax
leaq 0x30(%rsp), %r8
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
callq 0x3c90
cmpl $0x0, %eax
je 0x3b51
movl $0xffffffff, 0xa4(%rsp) # imm = 0xFFFFFFFF
jmp 0x3c73
cmpq $0x0, 0x50(%rsp)
jne 0x3bf5
jmp 0x3b5f
movl 0x78(%rsp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, 0x78(%rsp)
cmpl $0x0, %eax
je 0x3b96
movq 0x80(%rsp), %rax
movq 0x68(%rax), %rax
movl 0x7c(%rsp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0x7c(%rsp)
subl $0x1, %ecx
movslq %ecx, %rcx
movb $0x1, (%rax,%rcx)
jmp 0x3b5f
jmp 0x3b98
movl 0xb8(%rsp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, 0xb8(%rsp)
cmpl $0x0, %eax
je 0x3bde
movq 0x80(%rsp), %rax
movq 0xf0(%rax), %rax
movl 0xb0(%rsp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0xb0(%rsp)
subl $0x1, %ecx
movslq %ecx, %rcx
movb $0x1, (%rax,%rcx)
jmp 0x3b98
movq 0x38(%rsp), %rdi
callq 0x1030
movl $0x0, 0xa4(%rsp)
jmp 0x3c73
leaq 0x30(%rsp), %rdi
callq 0x3dd0
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0x3c39
movq 0x28(%rsp), %rsi
movl 0x7c(%rsp), %edx
movl 0x78(%rsp), %ecx
movl 0xb0(%rsp), %r8d
movl 0xb8(%rsp), %r9d
leaq 0x30(%rsp), %rdi
callq 0x3f50
movl %eax, 0x24(%rsp)
jmp 0x3c5e
movl 0x7c(%rsp), %esi
movl 0x78(%rsp), %edx
movl 0xb0(%rsp), %ecx
movl 0xb8(%rsp), %r8d
leaq 0x30(%rsp), %rdi
callq 0x4230
movl %eax, 0x24(%rsp)
movq 0x38(%rsp), %rdi
callq 0x1030
movl 0x24(%rsp), %eax
movl %eax, 0xa4(%rsp)
movl 0xa4(%rsp), %eax
addq $0xa8, %rsp
retq
nopw %cs:(%rax,%rax)