// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rcx, %r13
movl 0xc8(%rsp), %r12d
movl 0xc0(%rsp), %eax
testl %r9d, %r9d
je 0x2608
movl %r9d, %r14d
movl %r8d, %r15d
movq %rax, (%rsp)
testl %r12d, %r12d
je 0x26db
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
movq %rdi, 0x38(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x50(%rsp)
movq %r13, 0x48(%rsp)
leal (%r14,%r14), %eax
movl %eax, 0x14(%rsp)
cltq
imulq $0x28, %rax, %rsi
pushq $0x1
popq %rdi
callq 0x10b0
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x2725
xorl %ebx, %ebx
pushq $0x1
popq %rbp
cmpl %ebx, %r14d
je 0x2625
leal (%r15,%rbx), %edi
leaq 0x10(%rsp), %rsi
movl %ebp, %edx
callq 0x2915
incl %ebx
jmp 0x25ef
cltq
subl $0x1, %r12d
jb 0x276b
movq 0xf0(%r13), %rcx
movb $0x1, -0x1(%rcx,%rax)
incq %rax
jmp 0x260a
xorl %ebx, %ebx
pushq $0x2
popq %rbp
cmpl %ebx, %r12d
je 0x2649
movl 0xc0(%rsp), %eax
leal (%rax,%rbx), %edi
leaq 0x10(%rsp), %rsi
movl %ebp, %edx
callq 0x2915
incl %ebx
jmp 0x262a
cmpq $0x0, 0x30(%rsp)
je 0x272a
movq %r14, %rbx
leaq 0x20(%rsp), %r14
movslq -0x10(%r14), %rdi
shlq $0x3, %rdi
callq 0x10f0
xorl %ecx, %ecx
pushq $-0x1
popq %rdx
movq (%r14), %r14
testq %r14, %r14
je 0x26f6
movq 0x10(%r14), %rsi
leaq 0x1(%rsi), %rdi
cmpq $0x2, %rdi
jb 0x26d5
movl %ecx, %edi
movl %edx, %r8d
leal 0x1(%r8), %r9d
cmpl %edi, %r9d
jge 0x26af
leal (%r8,%rdi), %r9d
shrl %r9d
movq (%rax,%r9,8), %r10
cmpq %rsi, 0x10(%r10)
jbe 0x26aa
movl %r9d, %edi
movl %r8d, %r9d
movl %r9d, %r8d
jmp 0x268a
testl %r8d, %r8d
js 0x26bd
movl %r8d, %esi
movq (%rax,%rsi,8), %rsi
jmp 0x26bf
xorl %esi, %esi
movq %rsi, 0x20(%r14)
movl %r9d, %esi
movq %r14, (%rax,%rsi,8)
xorl %esi, %esi
cmpl %ecx, %r9d
sete %sil
addl %esi, %ecx
addq $0x18, %r14
jmp 0x266f
movslq %r15d, %rax
subl $0x1, %r14d
jb 0x276b
movq 0x68(%r13), %rcx
movb $0x1, -0x1(%rcx,%rax)
incq %rax
jmp 0x26de
testl %ecx, %ecx
je 0x2781
movslq %ecx, %rcx
movq -0x8(%rax,%rcx,8), %rcx
xorl %edx, %edx
movl 0xc0(%rsp), %r14d
movq %rcx, %r13
movq %rdx, 0x18(%rcx)
movq 0x20(%rcx), %rcx
movq %r13, %rdx
testq %rcx, %rcx
jne 0x2710
jmp 0x278c
pushq $-0x1
popq %rbx
jmp 0x276d
movslq %r15d, %rax
subl $0x1, %r14d
jb 0x2741
movq 0x68(%r13), %rcx
movb $0x1, -0x1(%rcx,%rax)
incq %rax
jmp 0x272d
movl 0xc0(%rsp), %eax
cltq
subl $0x1, %r12d
jb 0x2761
movq 0xf0(%r13), %rcx
movb $0x1, -0x1(%rcx,%rax)
incq %rax
jmp 0x274a
movq 0x18(%rsp), %rdi
callq 0x1030
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r13d, %r13d
movl 0xc0(%rsp), %r14d
movq %rax, %rdi
callq 0x1030
testq %r13, %r13
je 0x28d4
addl %r15d, %ebx
addl %r14d, %r12d
movl %r12d, 0xc(%rsp)
leaq 0x10(%rsp), %rax
movq 0x28(%rax), %rcx
movq %rcx, 0x70(%rsp)
movq 0x30(%rax), %rcx
movq %rcx, 0x68(%rsp)
movq 0x40(%rax), %rcx
movq %rcx, 0x60(%rsp)
movq 0x38(%rax), %rax
movq %rax, 0x58(%rsp)
movq %rbx, 0x78(%rsp)
movl %ebx, %r12d
movl 0xc(%rsp), %eax
movl %eax, %ebx
testq %r13, %r13
je 0x2818
movl 0x8(%r13), %ebp
movl 0x10(%r13), %r14d
movl %r14d, %ebx
movl %ebp, %r12d
cmpl %r15d, %ebp
jle 0x2818
cmpl (%rsp), %ebx
jle 0x2818
leal -0x1(%r12), %ebp
leal -0x1(%rbx), %r14d
leaq 0x10(%rsp), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x2a40
testl %eax, %eax
jne 0x27ec
movq (%rsp), %r14
movl %r12d, %ebp
subl %r15d, %ebp
jle 0x2845
cmpl %r14d, %ebx
jle 0x2845
leaq 0x10(%rsp), %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0x2a40
testl %eax, %eax
je 0x2859
incl %r15d
incl %r14d
jmp 0x281c
cmpl %r15d, %r12d
jg 0x2859
cmpl %r14d, %ebx
jg 0x2859
testq %r13, %r13
jne 0x2889
jmp 0x2904
subl %r14d, %ebx
movq 0x70(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq 0x58(%rsp), %rcx
movl %r15d, %r8d
movl %ebp, %r9d
pushq %rbx
pushq %r14
callq 0x2564
popq %rcx
popq %rdx
testq %r13, %r13
je 0x28cc
testl %eax, %eax
jne 0x28cc
movq 0x78(%rsp), %rbx
movq %r13, %rax
movq 0x18(%r13), %r13
testq %r13, %r13
je 0x28b7
movq 0x8(%rax), %r15
leaq 0x1(%r15), %rcx
cmpq %rcx, 0x8(%r13)
jne 0x28bb
movq 0x10(%rax), %rcx
incq %rcx
cmpq %rcx, 0x10(%r13)
je 0x288e
jmp 0x28bb
movq 0x8(%rax), %r15
incl %r15d
movl 0x10(%rax), %eax
incl %eax
movq %rax, (%rsp)
jmp 0x27d6
xorl %ebx, %ebx
negl %eax
sbbl %ebx, %ebx
jmp 0x2906
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rax
movq (%rax), %rax
andq $-0x61, %rax
leaq 0x80(%rsp), %rsi
movq %rax, (%rsi)
movl %r15d, %edx
movl %ebx, %ecx
movl %r14d, %r8d
movl %r12d, %r9d
callq 0x42ab
movl %eax, %ebx
jmp 0x2906
xorl %ebx, %ebx
movq 0x18(%rsp), %rdi
callq 0x1030
jmp 0x276d