// File: /workspace/github_c_makefile_star2_O1/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 $0xb8, %rsp
movq %rcx, %r13
movl 0xf8(%rsp), %r15d
movl 0xf0(%rsp), %eax
testl %r9d, %r9d
je 0x2b6f
movl %r9d, %r12d
movl %r8d, %ebp
testl %r15d, %r15d
je 0x2b96
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x50(%rsp)
movq %rdi, 0x68(%rsp)
movq %rsi, 0x70(%rsp)
movq %rdx, 0x80(%rsp)
movq %r13, 0x78(%rsp)
leal (%r12,%r12), %eax
movl %eax, 0x44(%rsp)
cltq
shlq $0x3, %rax
leaq (%rax,%rax,4), %rbx
movq %rbx, %rdi
callq 0x10e0
movq %rax, 0x48(%rsp)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x2ea2
xorl %r14d, %r14d
movq %rax, 0x18(%rsp)
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x1090
leaq 0x40(%rsp), %rbx
leal (%r14,%rbp), %edi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x2eb7
incl %r14d
cmpl %r14d, %r12d
jne 0x2a6d
movq %rbp, 0x10(%rsp)
xorl %r14d, %r14d
leaq 0x40(%rsp), %rbx
movl 0xf0(%rsp), %ebp
leal (%r14,%rbp), %edi
movq %rbx, %rsi
movl $0x2, %edx
callq 0x2eb7
incl %r14d
cmpl %r14d, %r15d
jne 0x2a9a
cmpq $0x0, 0x18(%rsp)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
je 0x2ea2
cmpq $0x0, 0x60(%rsp)
je 0x2bb2
movslq 0x40(%rsp), %rdi
shlq $0x3, %rdi
callq 0x10e0
movq 0x50(%rsp), %rdx
testq %rdx, %rdx
movl 0xf0(%rsp), %ebx
movq 0x10(%rsp), %r13
je 0x2bee
xorl %ecx, %ecx
movq 0x10(%rdx), %rdi
leaq 0x1(%rdi), %rsi
cmpq $0x2, %rsi
jb 0x2b61
testl %ecx, %ecx
jle 0x2b3a
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
movl %ecx, %r8d
leal (%r8,%r9), %esi
shrl %esi
movq (%rax,%rsi,8), %r10
cmpq %rdi, 0x10(%r10)
jbe 0x2b2c
movl %esi, %r8d
movl %r9d, %esi
leal 0x1(%rsi), %r10d
movl %esi, %r9d
cmpl %r8d, %r10d
jl 0x2b16
jmp 0x2b3f
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
testl %esi, %esi
js 0x2b4b
movl %esi, %edi
movq (%rax,%rdi,8), %rdi
jmp 0x2b4d
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 0x2afb
jmp 0x2bf0
xorl %r14d, %r14d
testl %r15d, %r15d
je 0x2ea2
cltq
movq 0xf0(%r13), %rcx
movb $0x1, -0x1(%rcx,%rax)
incq %rax
decl %r15d
jne 0x2b7d
jmp 0x2ea2
movslq %ebp, %rax
movq 0x68(%r13), %rcx
movb $0x1, -0x1(%rcx,%rax)
incq %rax
decl %r12d
jne 0x2b99
xorl %r14d, %r14d
jmp 0x2ea2
movslq 0x10(%rsp), %rax
movl 0xf0(%rsp), %edx
movq 0x68(%r13), %rcx
movb $0x1, -0x1(%rcx,%rax)
incq %rax
decl %r12d
jne 0x2bbe
movslq %edx, %rax
movq 0xf0(%r13), %rcx
movb $0x1, -0x1(%rcx,%rax)
incq %rax
decl %r15d
jne 0x2bd2
xorl %r14d, %r14d
jmp 0x2e98
xorl %ecx, %ecx
testl %ecx, %ecx
je 0x2c22
movslq %ecx, %rcx
movq -0x8(%rax,%rcx,8), %rcx
movq $0x0, 0x18(%rcx)
movq 0x20(%rcx), %rdx
testq %rdx, %rdx
je 0x2c27
movq %rdx, %r14
movq %rcx, 0x18(%rdx)
movq 0x20(%rdx), %rdx
movq %r14, %rcx
testq %rdx, %rdx
jne 0x2c0d
jmp 0x2c2a
xorl %r14d, %r14d
jmp 0x2c2a
movq %rcx, %r14
movq %rax, %rdi
callq 0x1030
testq %r14, %r14
je 0x2e5b
addl %r13d, %r12d
movq %r12, 0xa0(%rsp)
addl %ebx, %r15d
movl %r15d, 0x34(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x80(%rsp), %rcx
movq %rcx, 0x28(%rsp)
movq 0x68(%rsp), %rcx
movq %rcx, 0x98(%rsp)
movq 0x70(%rsp), %rcx
movq %rcx, 0x90(%rsp)
movq %r13, 0x10(%rsp)
movslq %r13d, %r15
movq %rbx, %rbp
movslq %ebx, %r12
movq 0xa0(%rsp), %rax
movl %eax, 0xc(%rsp)
movl 0x34(%rsp), %eax
movq %rax, 0x20(%rsp)
testq %r14, %r14
je 0x2d06
movslq 0x8(%r14), %rbx
movslq 0x10(%r14), %r13
movl %r13d, %eax
movl %ebx, 0xc(%rsp)
cmpq %r15, %rbx
movq %rax, 0x20(%rsp)
jle 0x2d06
cmpq %r12, %r13
jle 0x2d06
movq 0x18(%rsp), %rcx
movq 0x60(%rcx), %rax
movq 0xe8(%rcx), %rcx
movq -0x10(%rax,%rbx,8), %rax
decq %rbx
movq -0x10(%rcx,%r13,8), %rcx
decq %r13
movq 0x8(%rax), %rdi
movq 0x10(%rax), %rsi
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rcx
movq 0x28(%rsp), %rax
movq (%rax), %r8
callq 0x44b5
testl %eax, %eax
jne 0x2caf
movq %rbp, %rax
movq 0x20(%rsp), %rdx
cmpl %edx, %eax
setl %bl
movq 0x10(%rsp), %rcx
cmpl 0xc(%rsp), %ecx
setl %cl
movq %r14, 0x38(%rsp)
jge 0x2dc1
movq %rax, %rbp
cmpl %edx, %eax
jge 0x2dc4
movslq 0xc(%rsp), %rax
movq %rax, 0xa8(%rsp)
movslq %edx, %r13
incq %r12
incq %r15
movl %ecx, %r14d
movq 0x18(%rsp), %rcx
movq 0x60(%rcx), %rax
movq 0xe8(%rcx), %rcx
movq -0x10(%rax,%r15,8), %rax
movq -0x10(%rcx,%r12,8), %rcx
movq 0x8(%rax), %rdi
movq 0x10(%rax), %rsi
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rcx
movq 0x28(%rsp), %rax
movq (%rax), %r8
callq 0x44b5
testl %eax, %eax
je 0x2dbc
movq 0x10(%rsp), %rax
incl %eax
movq %rax, 0x10(%rsp)
incl %ebp
cmpq %r13, %r12
setl %bl
cmpq 0xa8(%rsp), %r15
setl %cl
jge 0x2dc4
leaq 0x1(%r12), %rax
incq %r15
cmpq %r13, %r12
movq %rax, %r12
jl 0x2d4b
jmp 0x2dc4
movl %r14d, %ecx
jmp 0x2dc4
movq %rax, %rbp
testb $0x1, %cl
jne 0x2ddd
testb $0x1, %bl
jne 0x2ddd
movq 0x38(%rsp), %r14
testq %r14, %r14
jne 0x2e24
jmp 0x2be6
movq 0x10(%rsp), %r8
movl 0xc(%rsp), %r9d
subl %r8d, %r9d
movq 0x20(%rsp), %rax
subl %ebp, %eax
movq 0x98(%rsp), %rdi
movq 0x90(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x18(%rsp), %rcx
pushq %rax
pushq %rbp
callq 0x29bc
addq $0x10, %rsp
movq 0x38(%rsp), %r14
testq %r14, %r14
je 0x2e90
testl %eax, %eax
jne 0x2e90
movq %r14, %rax
movq 0x18(%r14), %r14
testq %r14, %r14
je 0x2e4a
movq 0x8(%rax), %rcx
incq %rcx
cmpq %rcx, 0x8(%r14)
jne 0x2e4a
movq 0x10(%rax), %rcx
incq %rcx
cmpq %rcx, 0x10(%r14)
je 0x2e24
movl 0x8(%rax), %r13d
movl 0x10(%rax), %ebx
incl %r13d
incl %ebx
jmp 0x2c7f
movq 0x78(%rsp), %rdi
movq 0x80(%rsp), %rax
movq (%rax), %rax
andq $-0x61, %rax
leaq 0xb0(%rsp), %rsi
movq %rax, (%rsi)
movl %r13d, %edx
movl %r12d, %ecx
movl %ebx, %r8d
movl %r15d, %r9d
callq 0x4b4d
movl %eax, %r14d
jmp 0x2e98
xorl %r14d, %r14d
negl %eax
sbbl %r14d, %r14d
movq 0x48(%rsp), %rdi
callq 0x1030
movl %r14d, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq