// File: /workspace/github_c_makefile_star2_O3/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 $0x98, %rsp
movq %rcx, %r13
movl 0xd8(%rsp), %r14d
testl %r9d, %r9d
je 0x2adb
movl %r9d, %r15d
movl %r8d, %r12d
testl %r14d, %r14d
je 0x2b08
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movq %rdi, 0x48(%rsp)
movq %rsi, 0x50(%rsp)
movq %rdx, 0x60(%rsp)
movq %r13, 0x58(%rsp)
leal (%r15,%r15), %eax
movl %eax, 0x24(%rsp)
cltq
shlq $0x3, %rax
leaq (%rax,%rax,4), %rsi
movl $0x1, %edi
callq 0x10b0
movq %rax, 0x28(%rsp)
testq %rax, %rax
je 0x2b21
xorl %ebx, %ebx
leaq 0x20(%rsp), %rbp
leal (%r12,%rbx), %edi
movq %rbp, %rsi
movl $0x1, %edx
callq 0x2dd5
incl %ebx
cmpl %ebx, %r15d
jne 0x29d3
xorl %ebx, %ebx
movl 0xd0(%rsp), %ebp
leal (%rbx,%rbp), %edi
leaq 0x20(%rsp), %rsi
movl $0x2, %edx
callq 0x2dd5
incl %ebx
cmpl %ebx, %r14d
jne 0x29f4
cmpq $0x0, 0x40(%rsp)
je 0x2b6c
movslq 0x20(%rsp), %rdi
shlq $0x3, %rdi
callq 0x10f0
movq 0x30(%rsp), %rdx
testq %rdx, %rdx
je 0x2b2b
xorl %ecx, %ecx
movq 0x10(%rdx), %rdi
leaq 0x1(%rdi), %rsi
cmpq $0x2, %rsi
jb 0x2a95
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jle 0x2a7f
movl %ecx, %r8d
leal (%r8,%rsi), %r9d
shrl %r9d
movq (%rax,%r9,8), %r10
cmpq %rdi, 0x10(%r10)
ja 0x2a67
movl %r9d, %esi
jmp 0x2a6a
movl %r9d, %r8d
leal 0x1(%rsi), %r9d
cmpl %r8d, %r9d
jl 0x2a51
testl %esi, %esi
js 0x2a7f
movl %esi, %edi
movq (%rax,%rdi,8), %rdi
jmp 0x2a81
xorl %edi, %edi
movq %rdi, 0x20(%rdx)
incl %esi
movq %rdx, (%rax,%rsi,8)
xorl %edi, %edi
cmpl %ecx, %esi
sete %dil
addl %edi, %ecx
movq 0x18(%rdx), %rdx
testq %rdx, %rdx
jne 0x2a37
testl %ecx, %ecx
je 0x2b2b
movslq %ecx, %rcx
movq -0x8(%rax,%rcx,8), %rcx
movq $0x0, 0x18(%rcx)
movq 0x20(%rcx), %rdx
testq %rdx, %rdx
je 0x2bae
movq %rdx, %rbx
movq %rcx, 0x18(%rdx)
movq 0x20(%rdx), %rdx
movq %rbx, %rcx
testq %rdx, %rdx
jne 0x2ac3
jmp 0x2bb1
xorl %ebp, %ebp
testl %r14d, %r14d
je 0x2dc1
movl 0xd0(%rsp), %eax
cltq
movq 0xf0(%r13), %rcx
movb $0x1, -0x1(%rcx,%rax)
incq %rax
decl %r14d
jne 0x2aef
jmp 0x2dc1
movslq %r12d, %rax
movq 0x68(%r13), %rcx
movb $0x1, -0x1(%rcx,%rax)
incq %rax
decl %r15d
jne 0x2b0b
jmp 0x2ba7
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x2dc1
movq %rax, %rdi
callq 0x1030
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rax
movq (%rax), %rax
andq $-0x61, %rax
leaq 0x90(%rsp), %rsi
movq %rax, (%rsi)
movl %r12d, %edx
movl %r15d, %ecx
movl 0xd0(%rsp), %r8d
movl %r14d, %r9d
callq 0x4918
movl %eax, %ebp
jmp 0x2db7
movslq %r12d, %rax
movq 0x68(%r13), %rcx
movb $0x1, -0x1(%rcx,%rax)
incq %rax
decl %r15d
jne 0x2b6f
movl 0xd0(%rsp), %eax
cltq
movq 0xf0(%r13), %rcx
movb $0x1, -0x1(%rcx,%rax)
incq %rax
decl %r14d
jne 0x2b89
movq 0x28(%rsp), %rdi
callq 0x1030
xorl %ebp, %ebp
jmp 0x2dc1
movq %rcx, %rbx
movq %rax, %rdi
callq 0x1030
addl %r12d, %r15d
movq %r15, 0x78(%rsp)
movl 0xd0(%rsp), %eax
addl %eax, %r14d
movq 0x58(%rsp), %rcx
movq %rcx, 0x18(%rsp)
movq 0x60(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq 0x48(%rsp), %rcx
movq %rcx, 0x70(%rsp)
movq 0x50(%rsp), %rcx
movq %rcx, 0x68(%rsp)
movl %r14d, 0x4(%rsp)
movslq %r12d, %r15
movq %rax, 0x80(%rsp)
movslq %eax, %r13
movq 0x78(%rsp), %rax
movl %eax, (%rsp)
movl %r14d, %eax
movq %rax, 0x8(%rsp)
testq %rbx, %rbx
je 0x2c79
movslq 0x8(%rbx), %rbp
movslq 0x10(%rbx), %r14
movl %r14d, %eax
movl %ebp, (%rsp)
cmpq %r15, %rbp
movq %rax, 0x8(%rsp)
jle 0x2c79
cmpq %r13, %r14
jle 0x2c79
movq 0x18(%rsp), %rcx
movq 0x60(%rcx), %rax
movq 0xe8(%rcx), %rcx
movq 0x10(%rsp), %rdx
movq (%rdx), %r8
movq -0x10(%rax,%rbp,8), %rax
decq %rbp
movq -0x10(%rcx,%r14,8), %rcx
decq %r14
movq 0x8(%rax), %rdi
movq 0x10(%rax), %rsi
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rcx
callq 0x4349
testl %eax, %eax
jne 0x2c23
movq 0x80(%rsp), %r14
movq 0x8(%rsp), %rdx
cmpl %edx, %r14d
setl %al
cmpl (%rsp), %r12d
setl %cl
jge 0x2d12
cmpl %edx, %r14d
jge 0x2d12
movslq (%rsp), %rax
movq %rax, 0x88(%rsp)
movslq %edx, %rbp
incq %r13
incq %r15
movq 0x18(%rsp), %rcx
movq 0x60(%rcx), %rax
movq 0xe8(%rcx), %rcx
movq 0x10(%rsp), %rdx
movq (%rdx), %r8
movq -0x10(%rax,%r15,8), %rax
movq -0x10(%rcx,%r13,8), %rcx
movq 0x8(%rax), %rdi
movq 0x10(%rax), %rsi
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rcx
callq 0x4349
testl %eax, %eax
je 0x2d2c
incl %r12d
incl %r14d
cmpq %rbp, %r13
setl %al
cmpq 0x88(%rsp), %r15
setl %cl
jge 0x2d12
leaq 0x1(%r13), %rdx
incq %r15
cmpq %rbp, %r13
movq %rdx, %r13
jl 0x2caf
movq %r14, %rdx
testb %cl, %cl
jne 0x2d2f
testb %al, %al
movl 0x4(%rsp), %r14d
jne 0x2d34
testq %rbx, %rbx
jne 0x2d72
jmp 0x2db5
movq %r14, %rdx
movl 0x4(%rsp), %r14d
movl (%rsp), %r9d
subl %r12d, %r9d
movq %rdx, %rax
movq 0x8(%rsp), %r10
subl %eax, %r10d
movq 0x70(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rcx
movl %r12d, %r8d
pushq %r10
pushq %rax
callq 0x2944
addq $0x10, %rsp
testq %rbx, %rbx
je 0x2dad
testl %eax, %eax
jne 0x2dad
movq %rbx, %rax
movq 0x18(%rbx), %rbx
testq %rbx, %rbx
je 0x2d9c
movq 0x8(%rax), %r12
leaq 0x1(%r12), %rcx
cmpq %rcx, 0x8(%rbx)
jne 0x2da0
movq 0x10(%rax), %rcx
incq %rcx
cmpq %rcx, 0x10(%rbx)
je 0x2d72
jmp 0x2da0
movq 0x8(%rax), %r12
incl %r12d
movl 0x10(%rax), %eax
incl %eax
jmp 0x2bf8
xorl %ebp, %ebp
negl %eax
sbbl %ebp, %ebp
jmp 0x2db7
xorl %ebp, %ebp
movq 0x28(%rsp), %rdi
callq 0x1030
movl %ebp, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq