// File: /workspace/github_c_makefile_star2_O1/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, 0x50(%rsp)
movq %rcx, 0x68(%rsp)
movq %rdx, 0x40(%rsp)
movq %rsi, 0x60(%rsp)
movq 0xb0(%rsp), %r15
xorl %ebp, %ebp
movl $0x0, %r14d
movl $0x0, %r13d
testq %r15, %r15
je 0x5e28
movl 0xc8(%rsp), %eax
testl %eax, %eax
movl $0x7, %ecx
cmovgl %eax, %ecx
movq %rcx, 0x38(%rsp)
incl %ecx
movq %rcx, 0x30(%rsp)
xorl %r13d, %r13d
xorl %r14d, %r14d
movq %rdi, 0x10(%rsp)
cmpl $0x0, 0x2c(%rsp)
je 0x58fb
cmpl $0x0, 0x8(%r15)
jne 0x58fb
movl 0x2c(%rsp), %eax
movl %eax, 0x8(%r15)
movl 0x8(%r15), %eax
testl %eax, %eax
je 0x597f
testb $0x3, %al
je 0x5e1c
movq %r15, 0x20(%rsp)
movl 0x10(%r15), %eax
subl %r13d, %eax
movl %r14d, %r12d
movslq %r14d, %r15
movq 0xb8(%rsp), %rcx
addq %rcx, %r15
testq %rcx, %rcx
cmoveq %rcx, %r15
testl %eax, %eax
jle 0x5af0
movslq %r13d, %r13
shlq $0x3, %r13
addq 0xe8(%rdi), %r13
movl %eax, %ebx
xorl %ebp, %ebp
xorl %r14d, %r14d
testq %r15, %r15
je 0x5969
movslq %r14d, %rdi
addq %r15, %rdi
movq (%r13,%rbp,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
callq 0x10d0
movq (%r13,%rbp,8), %rax
incq %rbp
addl 0x10(%rax), %r14d
cmpq %rbp, %rbx
jne 0x594c
jmp 0x5af3
movq $0x0, 0x48(%rsp)
movl $0x0, %r12d
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x59a3
callq 0x1070
movq %rax, %r12
incl %r12d
movq %r15, 0x20(%rsp)
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
movq 0x50(%rsp), %rbx
je 0x59c3
callq 0x1070
incl %eax
movq %rax, 0x48(%rsp)
movq %r12, 0x70(%rsp)
xorl %r15d, %r15d
movl $0x0, %eax
testq %rbx, %rbx
je 0x59df
movq %rbx, %rdi
callq 0x1070
incl %eax
movq %rax, 0x58(%rsp)
movq 0x10(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x20(%rsp), %rbx
movq %rbx, %rdx
callq 0x5ea4
movq %rax, 0x18(%rsp)
movl 0x10(%rbx), %eax
subl %r13d, %eax
movl %r14d, %r12d
movslq %r14d, %rbp
movq 0xb8(%rsp), %rcx
addq %rcx, %rbp
testq %rcx, %rcx
cmoveq %rcx, %rbp
testl %eax, %eax
jle 0x5a6b
movslq %r13d, %r13
shlq $0x3, %r13
movq 0x10(%rsp), %rcx
addq 0xe8(%rcx), %r13
movl %eax, %ebx
xorl %r14d, %r14d
xorl %r15d, %r15d
testq %rbp, %rbp
je 0x5a5a
movslq %r15d, %rdi
addq %rbp, %rdi
movq (%r13,%r14,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
callq 0x10d0
movq (%r13,%r14,8), %rax
incq %r14
addl 0x10(%rax), %r15d
cmpq %r14, %rbx
jne 0x5a3d
addl %r12d, %r15d
movq 0xb8(%rsp), %r13
testq %r13, %r13
je 0x5bda
movslq %r15d, %r15
leaq (%r15,%r13), %rdi
movl $0x3c, %esi
movq 0x38(%rsp), %rbx
movq %rbx, %rdx
callq 0x1090
addl %ebx, %r15d
movq 0x70(%rsp), %rbx
testl %ebx, %ebx
movl $0x0, %ebp
je 0x5aca
movslq %r15d, %r15
leaq (%r15,%r13), %rdi
incq %rdi
movb $0x20, -0x1(%rdi)
leal -0x1(%rbx), %eax
movslq %eax, %rdx
movq 0x60(%rsp), %rsi
callq 0x10d0
addl %ebx, %r15d
movq 0x18(%rsp), %rbx
testl %ebx, %ebx
je 0x5adf
movslq %r15d, %rax
incl %r15d
movb $0xd, (%r13,%rax)
movslq %r15d, %rax
incl %r15d
movb $0xa, (%r13,%rax)
jmp 0x5bf2
xorl %r14d, %r14d
addl %r12d, %r14d
movq 0x20(%rsp), %r15
movl 0x8(%r15), %ebp
testb $0x1, %bpl
jne 0x5b11
xorl %ebp, %ebp
movq 0xb8(%rsp), %rbx
jmp 0x5b60
movq 0x10(%rsp), %r12
movq %r12, %rdi
movq 0x40(%rsp), %rsi
movq %r15, %rdx
callq 0x5ea4
andl $0x2, %ebp
movslq %r14d, %r14
movq 0xb8(%rsp), %rbx
leaq (%rbx,%r14), %rsi
testq %rbx, %rbx
movl 0x10(%r15), %edx
movl 0x20(%r15), %ecx
cmoveq %rbx, %rsi
movq %rsi, (%rsp)
xorl %edi, %edi
movq %r12, %rsi
movl %eax, %r8d
movl %ebp, %r9d
callq 0x5f18
addl %eax, %r14d
xorl %ebp, %ebp
testb $0x2, 0x8(%r15)
je 0x5e0f
movq %r15, %rax
movslq %r14d, %r15
addq %rbx, %r15
testq %rbx, %rbx
movq 0x28(%rax), %r13
cmoveq %rbx, %r15
testl %r13d, %r13d
jle 0x5cae
movslq 0x18(%rax), %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 0x5bc5
movslq %ebx, %rdi
addq %r15, %rdi
movq (%rbp,%r12,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
callq 0x10d0
movq (%rbp,%r12,8), %rax
incq %r12
addl 0x10(%rax), %ebx
cmpq %r12, %r13
jne 0x5ba8
jmp 0x5cb0
movq 0x70(%rsp), %rax
addl 0x30(%rsp), %eax
movq 0x18(%rsp), %rbx
addl %ebx, %eax
addl %r15d, %eax
movl %eax, %r15d
xorl %ebp, %ebp
movslq %r15d, %r14
leaq (%r14,%r13), %rax
testq %r13, %r13
movq 0x20(%rsp), %r15
movl 0x10(%r15), %edx
movl 0x20(%r15), %ecx
cmoveq %r13, %rax
movq %rax, (%rsp)
xorl %edi, %edi
movq 0x10(%rsp), %r12
movq %r12, %rsi
movl %ebx, %r8d
movl $0x1, %r9d
callq 0x5f18
addl %eax, %r14d
cmpl $0x1, 0xc0(%rsp)
jne 0x5d0b
testq %r13, %r13
je 0x5cc7
movslq %r14d, %r14
leaq (%r14,%r13), %rdi
movl $0x7c, %esi
movq 0x38(%rsp), %rbx
movq %rbx, %rdx
callq 0x1090
addl %ebx, %r14d
movq 0x58(%rsp), %rax
testl %eax, %eax
je 0x5c8b
movslq %r14d, %r14
leaq (%r14,%r13), %rdi
incq %rdi
movb $0x20, -0x1(%rdi)
movq %rax, %rbx
decl %eax
movslq %eax, %rdx
movq 0x50(%rsp), %rsi
callq 0x10d0
addl %ebx, %r14d
movq 0x18(%rsp), %rbx
testl %ebx, %ebx
je 0x5ca0
movslq %r14d, %rax
incl %r14d
movb $0xd, (%r13,%rax)
movslq %r14d, %rax
incl %r14d
movb $0xa, (%r13,%rax)
jmp 0x5cd8
xorl %ebx, %ebx
addl %r14d, %ebx
movl %ebx, %r14d
xorl %ebp, %ebp
movq 0x10(%rsp), %rdi
movq 0x20(%rsp), %r15
jmp 0x5e14
movq 0x58(%rsp), %rax
addl 0x30(%rsp), %eax
addl %ebx, %eax
addl %r14d, %eax
movl %eax, %r14d
movslq %r14d, %r14
leaq (%r14,%r13), %rax
testq %r13, %r13
movl 0x30(%r15), %edx
movl 0x38(%r15), %ecx
cmoveq %r13, %rax
movq %rax, (%rsp)
movl $0x1, %edi
movq %r12, %rsi
movl %ebx, %r8d
movl $0x1, %r9d
callq 0x5f18
addl %eax, %r14d
testq %r13, %r13
je 0x5d50
movslq %r14d, %r14
leaq (%r14,%r13), %rdi
movl $0x3d, %esi
movq 0x38(%rsp), %rbx
movq %rbx, %rdx
callq 0x1090
addl %ebx, %r14d
movq 0x18(%rsp), %r12
testl %r12d, %r12d
je 0x5d42
movslq %r14d, %rax
incl %r14d
movb $0xd, (%r13,%rax)
movslq %r14d, %rax
incl %r14d
movb $0xa, (%r13,%rax)
jmp 0x5d5d
movq 0x30(%rsp), %rax
addl %ebx, %eax
addl %eax, %r14d
movq %rbx, %r12
movslq %r14d, %rbx
leaq (%rbx,%r13), %rax
testq %r13, %r13
movl 0x18(%r15), %edx
movl 0x28(%r15), %ecx
cmoveq %r13, %rax
movq %rax, (%rsp)
xorl %edi, %edi
movq 0x40(%rsp), %rsi
movl %r12d, %r8d
movl $0x1, %r9d
callq 0x5f18
addl %eax, %ebx
testq %r13, %r13
je 0x5dff
movslq %ebx, %r14
leaq (%r14,%r13), %rdi
movl $0x3e, %esi
movq 0x38(%rsp), %rbx
movq %rbx, %rdx
callq 0x1090
addl %ebx, %r14d
movq 0x48(%rsp), %rbx
testl %ebx, %ebx
je 0x5dd9
movslq %r14d, %r14
leaq (%r14,%r13), %rdi
incq %rdi
movb $0x20, -0x1(%rdi)
leal -0x1(%rbx), %eax
movslq %eax, %rdx
movq 0x68(%rsp), %rsi
callq 0x10d0
addl %ebx, %r14d
movq 0x10(%rsp), %rdi
cmpl $0x0, 0x18(%rsp)
je 0x5df1
movslq %r14d, %rax
incl %r14d
movb $0xd, (%r13,%rax)
movslq %r14d, %rax
incl %r14d
movb $0xa, (%r13,%rax)
jmp 0x5e14
movq 0x48(%rsp), %r14
addl 0x30(%rsp), %r14d
addl %r12d, %r14d
addl %ebx, %r14d
movq 0x10(%rsp), %rdi
movl 0x20(%r15), %r13d
addl 0x10(%r15), %r13d
movq (%r15), %r15
testq %r15, %r15
jne 0x58e5
movl 0xc0(%rdi), %eax
subl %r13d, %eax
movl %r14d, 0x20(%rsp)
movslq %r14d, %r14
movq 0xb8(%rsp), %rcx
addq %rcx, %r14
testq %rcx, %rcx
cmoveq %rcx, %r14
testl %eax, %eax
jle 0x5e8f
movslq %r13d, %r15
shlq $0x3, %r15
addq 0xe8(%rdi), %r15
movl %eax, %ebx
xorl %r12d, %r12d
xorl %ebp, %ebp
testq %r14, %r14
je 0x5e80
movslq %ebp, %rdi
addq %r14, %rdi
movq (%r15,%r12,8), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
callq 0x10d0
movq (%r15,%r12,8), %rax
incq %r12
addl 0x10(%rax), %ebp
cmpq %r12, %rbx
jne 0x5e64
addl 0x20(%rsp), %ebp
movl %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq