// File: /workspace/github_c_makefile_star2_O2/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 $0x68, %rsp
movl %r9d, 0x24(%rsp)
movq %r8, 0x50(%rsp)
movq %rcx, 0x58(%rsp)
movq %rdx, 0x30(%rsp)
movq %rsi, 0x60(%rsp)
movq %rdi, %rbp
movq 0xa8(%rsp), %rbx
movq 0xa0(%rsp), %r14
movl 0xb8(%rsp), %eax
testl %eax, %eax
pushq $0x7
popq %rcx
cmovgl %eax, %ecx
movq %rcx, 0x40(%rsp)
incl %ecx
movq %rcx, 0x28(%rsp)
xorl %r12d, %r12d
xorl %r13d, %r13d
movq %rdi, 0x18(%rsp)
movslq %r12d, %r15
testq %r14, %r14
je 0x5231
movl 0x8(%r14), %eax
cmpl $0x0, 0x24(%rsp)
je 0x4e72
testl %eax, %eax
jne 0x4e7a
movl 0x24(%rsp), %eax
movl %eax, 0x8(%r14)
jmp 0x4e7a
testl %eax, %eax
je 0x4f37
testb $0x3, %al
je 0x4f2f
movl 0x10(%r14), %edx
subl %r13d, %edx
leaq (%rbx,%r15), %r9
testq %rbx, %rbx
cmoveq %rbx, %r9
movq %rbp, %rdi
movl %r13d, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5267
movl %r15d, %r12d
addl %eax, %r12d
movq %rbp, %r15
movl 0x8(%r14), %ebp
testb $0x1, %bpl
je 0x4ef4
movq %r15, %rdi
movq 0x30(%rsp), %rsi
movq %r14, %rdx
callq 0x5285
andl $0x2, %ebp
movslq %r12d, %r12
leaq (%rbx,%r12), %r9
testq %rbx, %rbx
movl 0x10(%r14), %esi
movl 0x20(%r14), %edx
cmoveq %rbx, %r9
movq %r15, %rdi
movl %eax, %ecx
movl %ebp, %r8d
callq 0x5267
addl %eax, %r12d
movl 0x8(%r14), %ebp
testb $0x2, %bpl
je 0x4f22
movslq %r12d, %r12
leaq (%rbx,%r12), %r9
testq %rbx, %rbx
movl 0x18(%r14), %esi
movl 0x28(%r14), %edx
cmoveq %rbx, %r9
movq 0x30(%rsp), %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5267
addl %eax, %r12d
movq 0x18(%rsp), %rbp
movl 0x20(%r14), %r13d
addl 0x10(%r14), %r13d
movq (%r14), %r14
jmp 0x4e4d
movq $0x0, 0x48(%rsp)
movl $0x0, %ebp
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x4f59
callq 0x1070
movq %rax, %rbp
incl %ebp
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x4f6f
callq 0x1070
incl %eax
movq %rax, 0x48(%rsp)
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x4f87
callq 0x1070
incl %eax
movq %rax, 0x38(%rsp)
jmp 0x4f90
movq $0x0, 0x38(%rsp)
movq 0x18(%rsp), %r12
movq %r12, %rdi
movq 0x30(%rsp), %rsi
movq %r14, %rdx
callq 0x5285
movq %rax, 0x10(%rsp)
movl 0x10(%r14), %edx
subl %r13d, %edx
movq 0xa8(%rsp), %rbx
leaq (%rbx,%r15), %r9
testq %rbx, %rbx
cmoveq %rbx, %r9
movq %r12, %rdi
movl %r13d, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5267
addl %eax, %r15d
movq 0x10(%rsp), %rcx
testq %rbx, %rbx
je 0x5048
movslq %r15d, %r15
leaq (%rbx,%r15), %rdi
pushq $0x3c
popq %rsi
movq 0x40(%rsp), %r13
movq %r13, %rdx
callq 0x1090
addl %r13d, %r15d
testl %ebp, %ebp
movq 0x60(%rsp), %rsi
pushq $0x1
popq %r12
je 0x5024
movslq %r15d, %r15
leaq (%rbx,%r15), %rdi
incq %rdi
movb $0x20, -0x1(%rdi)
leal -0x1(%rbp), %eax
movslq %eax, %rdx
callq 0x10e0
addl %ebp, %r15d
movq 0x18(%rsp), %rbp
movq 0x10(%rsp), %rcx
testl %ecx, %ecx
je 0x503c
movslq %r15d, %rax
incl %r15d
movb $0xd, (%rbx,%rax)
movslq %r15d, %rax
incl %r15d
movb $0xa, (%rbx,%rax)
jmp 0x5062
addl 0x28(%rsp), %ebp
addl %ecx, %ebp
addl %r15d, %ebp
movl %ebp, %r15d
movq 0x18(%rsp), %rbp
movq 0x40(%rsp), %r13
pushq $0x1
popq %r12
movslq %r15d, %r15
leaq (%rbx,%r15), %r9
testq %rbx, %rbx
movl 0x10(%r14), %esi
movl 0x20(%r14), %edx
cmoveq %rbx, %r9
movq %rbp, %rdi
movl %r12d, %r8d
callq 0x5267
addl %eax, %r15d
cmpl $0x1, 0xb0(%rsp)
jne 0x5140
testq %rbx, %rbx
je 0x50fe
movslq %r15d, %r15
leaq (%rbx,%r15), %rdi
pushq $0x7c
popq %rsi
movq %r13, %rdx
callq 0x1090
addl %r13d, %r15d
movq 0x38(%rsp), %rax
testl %eax, %eax
je 0x50de
movslq %r15d, %r15
leaq (%rbx,%r15), %rdi
incq %rdi
movb $0x20, -0x1(%rdi)
movq %rax, %r12
decl %eax
movslq %eax, %rdx
movq 0x50(%rsp), %rsi
callq 0x10e0
addl %r12d, %r15d
pushq $0x1
popq %r12
movq 0x10(%rsp), %r8
testl %r8d, %r8d
je 0x50f2
movslq %r15d, %rax
incl %r15d
movb $0xd, (%rbx,%rax)
movslq %r15d, %rax
incl %r15d
movb $0xa, (%rbx,%rax)
jmp 0x5115
movq 0x38(%rsp), %rax
addl 0x28(%rsp), %eax
movq 0x10(%rsp), %r8
addl %r8d, %eax
addl %r15d, %eax
movl %eax, %r15d
movslq %r15d, %r15
leaq (%rbx,%r15), %rax
testq %rbx, %rbx
movl 0x30(%r14), %edx
movl 0x38(%r14), %ecx
cmoveq %rbx, %rax
movq %rax, (%rsp)
movl %r12d, %edi
movq %rbp, %rsi
movl %r12d, %r9d
callq 0x52f9
addl %eax, %r15d
testq %rbx, %rbx
je 0x5179
movslq %r15d, %r15
leaq (%rbx,%r15), %rdi
pushq $0x3d
popq %rsi
movq %r13, %rdx
callq 0x1090
addl %r13d, %r15d
movq 0x10(%rsp), %rcx
testl %ecx, %ecx
je 0x516d
movslq %r15d, %rax
incl %r15d
movb $0xd, (%rbx,%rax)
movslq %r15d, %rax
incl %r15d
movb $0xa, (%rbx,%rax)
jmp 0x5188
movq 0x28(%rsp), %rax
movq 0x10(%rsp), %rcx
addl %ecx, %eax
addl %eax, %r15d
movslq %r15d, %r15
leaq (%rbx,%r15), %r9
testq %rbx, %rbx
movl 0x18(%r14), %esi
movl 0x28(%r14), %edx
cmoveq %rbx, %r9
movq 0x30(%rsp), %rdi
movq %rcx, %r13
movl %r12d, %r8d
callq 0x5267
addl %eax, %r15d
testq %rbx, %rbx
je 0x521c
movslq %r15d, %r12
leaq (%rbx,%r12), %rdi
pushq $0x3e
popq %rsi
movq 0x40(%rsp), %r15
movq %r15, %rdx
callq 0x1090
addl %r15d, %r12d
movq 0x48(%rsp), %r15
testl %r15d, %r15d
je 0x51fc
movslq %r12d, %r12
leaq (%rbx,%r12), %rdi
incq %rdi
movb $0x20, -0x1(%rdi)
leal -0x1(%r15), %eax
movslq %eax, %rdx
movq 0x58(%rsp), %rsi
callq 0x10e0
addl %r15d, %r12d
cmpl $0x0, 0x10(%rsp)
je 0x520d
movslq %r12d, %rax
incl %r12d
movb $0xd, (%rbx,%rax)
movslq %r12d, %rax
incl %r12d
movb $0xa, (%rbx,%rax)
jmp 0x4f27
movq 0x48(%rsp), %r12
addl 0x28(%rsp), %r12d
addl %r13d, %r12d
addl %r15d, %r12d
jmp 0x4f27
movl 0xc0(%rbp), %edx
subl %r13d, %edx
leaq (%rbx,%r15), %r9
testq %rbx, %rbx
cmoveq %rbx, %r9
movq %rbp, %rdi
movl %r13d, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5267
addl %r15d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq