// File: /workspace/github_c_makefile_star2_O3/LemonBoy[P]autobahn/xdiff/xmerge.c
// Function: xdl_fill_merge_buffer
static int xdl_fill_merge_buffer(xdfenv_t *xe1, const char *name1,
				 xdfenv_t *xe2, const char *name2,
				 const char *ancestor_name,
				 int favor,
				 xdmerge_t *m, char *dest, int style,
				 int marker_size)
{
	int size, i;

	for (size = i = 0; m; m = m->next) {
		if (favor && !m->mode)
			m->mode = favor;

		if (m->mode == 0)
			size = fill_conflict_hunk(xe1, name1, xe2, name2,
						  ancestor_name,
						  size, i, style, m, dest,
						  marker_size);
		else if (m->mode & 3) {
			/* Before conflicting part */
			size += xdl_recs_copy(xe1, i, m->i1 - i, 0, 0,
					      dest ? dest + size : NULL);
			/* Postimage from side #1 */
			if (m->mode & 1) {
				int needs_cr = is_cr_needed(xe1, xe2, m);

				size += xdl_recs_copy(xe1, m->i1, m->chg1, needs_cr, (m->mode & 2),
						      dest ? dest + size : NULL);
			}
			/* Postimage from side #2 */
			if (m->mode & 2)
				size += xdl_recs_copy(xe2, m->i2, m->chg2, 0, 0,
						      dest ? dest + size : NULL);
		} else
			continue;
		i = m->i1 + m->chg1;
	}
	size += xdl_recs_copy(xe1, i, xe1->xdf2.nrec - i, 0, 0,
			      dest ? dest + size : NULL);
	return size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %r9d, 0x2c(%rsp)
movq %r8, 0x58(%rsp)
movq %rcx, 0x68(%rsp)
movq %rdx, 0x40(%rsp)
movq %rsi, 0x60(%rsp)
movq %rdi, %r12
movq 0xb8(%rsp), %rbx
movq 0xb0(%rsp), %rax
xorl %r13d, %r13d
movl $0x0, %r14d
movl $0x0, %r15d
testq %rax, %rax
je 0x5ba5
movq %rax, %rdx
movl 0xc8(%rsp), %eax
testl %eax, %eax
movl $0x7, %ecx
cmovgl %eax, %ecx
movq %rcx, 0x38(%rsp)
incl %ecx
movq %rcx, 0x30(%rsp)
xorl %r15d, %r15d
xorl %r14d, %r14d
movq %r12, 0x20(%rsp)
movl 0x8(%rdx), %ebp
cmpl $0x0, 0x2c(%rsp)
movq %rdx, 0x8(%rsp)
je 0x5684
testl %ebp, %ebp
jne 0x568c
movl 0x2c(%rsp), %ebp
movl %ebp, 0x8(%rdx)
jmp 0x568c
testl %ebp, %ebp
je 0x57e6
testb $0x3, %bpl
je 0x5b78
movl 0x10(%rdx), %eax
subl %r15d, %eax
movl %r14d, 0x14(%rsp)
movslq %r14d, %r13
addq %rbx, %r13
testq %rbx, %rbx
cmoveq %rbx, %r13
testl %eax, %eax
jle 0x570c
movslq %r15d, %r15
shlq $0x3, %r15
addq 0xe8(%r12), %r15
movl %eax, %ebx
xorl %r12d, %r12d
xorl %r14d, %r14d
testq %r13, %r13
je 0x56e5
movslq %r14d, %rdi
addq %r13, %rdi
movq (%r15,%r12,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
callq 0x10e0
movq (%r15,%r12,8), %rax
incq %r12
addl 0x10(%rax), %r14d
cmpq %r12, %rbx
jne 0x56c9
movq 0x8(%rsp), %rdx
movl 0x8(%rdx), %ebp
movq 0x20(%rsp), %r12
movq 0xb8(%rsp), %rbx
jmp 0x5714
xorl %r14d, %r14d
movq 0x8(%rsp), %rdx
addl 0x14(%rsp), %r14d
testb $0x1, %bpl
je 0x576c
movq %r12, %rdi
movq 0x40(%rsp), %rsi
callq 0x5c1c
andl $0x2, %ebp
movslq %r14d, %r14
leaq (%rbx,%r14), %rsi
testq %rbx, %rbx
movq 0x8(%rsp), %rcx
movl 0x10(%rcx), %edx
movq 0x8(%rsp), %rcx
movl 0x20(%rcx), %ecx
cmoveq %rbx, %rsi
movq %rsi, (%rsp)
xorl %edi, %edi
movq %r12, %rsi
movl %eax, %r8d
movl %ebp, %r9d
callq 0x5c90
addl %eax, %r14d
movq 0x8(%rsp), %rdx
movl 0x8(%rdx), %ebp
testb $0x2, %bpl
jne 0x577a
xorl %r13d, %r13d
jmp 0x5b70
movslq %r14d, %r15
addq %rbx, %r15
testq %rbx, %rbx
movq 0x28(%rdx), %r13
cmoveq %rbx, %r15
testl %r13d, %r13d
jle 0x594a
movslq 0x18(%rdx), %rbp
shlq $0x3, %rbp
movq 0x40(%rsp), %rax
addq 0xe8(%rax), %rbp
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %r12d, %r12d
xorl %ebx, %ebx
testq %r15, %r15
je 0x57d1
movslq %ebx, %rdi
addq %r15, %rdi
movq (%rbp,%r12,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
callq 0x10e0
movq (%rbp,%r12,8), %rax
incq %r12
addl 0x10(%rax), %ebx
cmpq %r12, %r13
jne 0x57b4
jmp 0x594c
movq $0x0, 0x48(%rsp)
movl $0x0, %eax
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x580a
callq 0x1070
movq 0x8(%rsp), %rdx
incl %eax
movq %rax, 0x70(%rsp)
movl %r14d, 0x14(%rsp)
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
movq 0x58(%rsp), %r13
je 0x5834
callq 0x1070
movq 0x8(%rsp), %rdx
incl %eax
movq %rax, 0x48(%rsp)
xorl %r14d, %r14d
movl $0x0, %eax
testq %r13, %r13
je 0x5850
movq %r13, %rdi
callq 0x1070
movq 0x8(%rsp), %rdx
incl %eax
movq %rax, 0x50(%rsp)
movq %r12, %rdi
movq 0x40(%rsp), %rsi
movq %rdx, %r13
callq 0x5c1c
movq %rax, 0x18(%rsp)
movl 0x10(%r13), %eax
subl %r15d, %eax
movslq 0x14(%rsp), %rbp
addq %rbx, %rbp
testq %rbx, %rbx
cmoveq %rbx, %rbp
testl %eax, %eax
jle 0x58c7
movslq %r15d, %r15
shlq $0x3, %r15
addq 0xe8(%r12), %r15
movl %eax, %ebx
xorl %r13d, %r13d
xorl %r14d, %r14d
testq %rbp, %rbp
je 0x58b7
movslq %r14d, %rdi
addq %rbp, %rdi
movq (%r15,%r13,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
callq 0x10e0
movq (%r15,%r13,8), %rax
incq %r13
addl 0x10(%rax), %r14d
cmpq %r13, %rbx
jne 0x589b
addl 0x14(%rsp), %r14d
movq 0xb8(%rsp), %rbx
testq %rbx, %rbx
je 0x5967
movslq %r14d, %r14
leaq (%rbx,%r14), %rdi
movl $0x3c, %esi
movq 0x38(%rsp), %r15
movq %r15, %rdx
callq 0x1090
addl %r15d, %r14d
movq 0x70(%rsp), %r15
testl %r15d, %r15d
movq 0x18(%rsp), %rbp
je 0x592a
movslq %r14d, %r14
leaq (%rbx,%r14), %rdi
incq %rdi
movb $0x20, -0x1(%rdi)
leal -0x1(%r15), %eax
movslq %eax, %rdx
movq 0x60(%rsp), %rsi
callq 0x10e0
addl %r15d, %r14d
testl %ebp, %ebp
movl $0x0, %r13d
je 0x593e
movslq %r14d, %rax
incl %r14d
movb $0xd, (%rbx,%rax)
movslq %r14d, %rax
incl %r14d
movb $0xa, (%rbx,%rax)
jmp 0x5980
xorl %ebx, %ebx
addl %r14d, %ebx
movl %ebx, %r14d
xorl %r13d, %r13d
movq 0x20(%rsp), %r12
movq 0xb8(%rsp), %rbx
jmp 0x5b6b
movq 0x70(%rsp), %rax
addl 0x30(%rsp), %eax
movq 0x18(%rsp), %rbp
addl %ebp, %eax
addl %r14d, %eax
movl %eax, %r14d
xorl %r13d, %r13d
movslq %r14d, %r15
leaq (%rbx,%r15), %rax
testq %rbx, %rbx
movq 0x8(%rsp), %rcx
movl 0x10(%rcx), %edx
movl 0x20(%rcx), %ecx
cmoveq %rbx, %rax
movq %rax, (%rsp)
xorl %edi, %edi
movq %r12, %rsi
movl %ebp, %r8d
movl $0x1, %r9d
callq 0x5c90
addl %eax, %r15d
cmpl $0x1, 0xc0(%rsp)
jne 0x5a6e
testq %rbx, %rbx
je 0x5a28
movslq %r15d, %r14
leaq (%rbx,%r14), %rdi
movl $0x7c, %esi
movq 0x38(%rsp), %r15
movq %r15, %rdx
callq 0x1090
addl %r15d, %r14d
movq 0x50(%rsp), %rax
testl %eax, %eax
je 0x5a0e
movslq %r14d, %r14
leaq (%rbx,%r14), %rdi
incq %rdi
movb $0x20, -0x1(%rdi)
movq %rax, %r15
decl %eax
movslq %eax, %rdx
movq 0x58(%rsp), %rsi
callq 0x10e0
addl %r15d, %r14d
testl %ebp, %ebp
je 0x5a1c
movslq %r14d, %rax
incl %r14d
movb $0xd, (%rbx,%rax)
movslq %r14d, %rax
incl %r14d
movb $0xa, (%rbx,%rax)
jmp 0x5a38
movq 0x50(%rsp), %r14
addl 0x30(%rsp), %r14d
addl %ebp, %r14d
addl %r15d, %r14d
movslq %r14d, %r15
leaq (%rbx,%r15), %rax
testq %rbx, %rbx
movq 0x8(%rsp), %rcx
movl 0x30(%rcx), %edx
movl 0x38(%rcx), %ecx
cmoveq %rbx, %rax
movq %rax, (%rsp)
movl $0x1, %edi
movq %r12, %rsi
movl %ebp, %r8d
movl $0x1, %r9d
callq 0x5c90
addl %eax, %r15d
testq %rbx, %rbx
je 0x5ab1
movslq %r15d, %r15
leaq (%rbx,%r15), %rdi
movl $0x3d, %esi
movq 0x38(%rsp), %r14
movq %r14, %rdx
callq 0x1090
addl %r14d, %r15d
testl %ebp, %ebp
je 0x5a9d
movslq %r15d, %rax
incl %r15d
movb $0xd, (%rbx,%rax)
movslq %r15d, %rax
incl %r15d
movb $0xa, (%rbx,%rax)
movq %rbx, %rbp
movq 0x18(%rsp), %r12
jmp 0x5ac1
movq 0x30(%rsp), %rax
addl %ebp, %eax
addl %eax, %r15d
movq %rbp, %r12
movq %rbx, %rbp
movslq %r15d, %rbx
leaq (%rbx,%rbp), %rax
testq %rbp, %rbp
movq 0x8(%rsp), %rcx
movl 0x18(%rcx), %edx
movl 0x28(%rcx), %ecx
cmoveq %rbp, %rax
movq %rax, (%rsp)
xorl %edi, %edi
movq 0x40(%rsp), %rsi
movl %r12d, %r8d
movl $0x1, %r9d
callq 0x5c90
addl %eax, %ebx
testq %rbp, %rbp
je 0x5b86
movslq %ebx, %r14
leaq (%r14,%rbp), %rdi
movl $0x3e, %esi
movq 0x38(%rsp), %rbx
movq %rbx, %rdx
callq 0x1090
addl %ebx, %r14d
movq 0x48(%rsp), %r15
testl %r15d, %r15d
movq %rbp, %rbx
movq 0x68(%rsp), %rsi
je 0x5b49
movslq %r14d, %r14
leaq (%rbx,%r14), %rdi
incq %rdi
movb $0x20, -0x1(%rdi)
leal -0x1(%r15), %eax
movslq %eax, %rdx
callq 0x10e0
addl %r15d, %r14d
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %r12
testl %eax, %eax
je 0x5b61
movslq %r14d, %rax
incl %r14d
movb $0xd, (%rbx,%rax)
movslq %r14d, %rax
incl %r14d
movb $0xa, (%rbx,%rax)
movq 0x8(%rsp), %rdx
movl 0x20(%rdx), %r15d
addl 0x10(%rdx), %r15d
movq (%rdx), %rdx
testq %rdx, %rdx
jne 0x5668
jmp 0x5ba5
movq 0x48(%rsp), %r14
addl 0x30(%rsp), %r14d
addl %r12d, %r14d
addl %ebx, %r14d
movq %rbp, %rbx
movq 0x8(%rsp), %rdx
movq 0x20(%rsp), %r12
jmp 0x5b70
movl 0xc0(%r12), %eax
subl %r15d, %eax
movl %r14d, %ebp
movslq %r14d, %r14
addq %rbx, %r14
testq %rbx, %rbx
cmoveq %rbx, %r14
testl %eax, %eax
jle 0x5c07
movslq %r15d, %r15
shlq $0x3, %r15
addq 0xe8(%r12), %r15
movl %eax, %ebx
xorl %r12d, %r12d
xorl %r13d, %r13d
testq %r14, %r14
je 0x5bf7
movslq %r13d, %rdi
addq %r14, %rdi
movq (%r15,%r12,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
callq 0x10e0
movq (%r15,%r12,8), %rax
incq %r12
addl 0x10(%rax), %r13d
cmpq %r12, %rbx
jne 0x5bdb
addl %ebp, %r13d
movl %r13d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq