// File: /workspace/github_c_makefile_star2_O0/LemonBoy[P]autobahn/xdiff/xmerge.c
// Function: xdl_refine_conflicts
static int xdl_refine_conflicts(xdfenv_t *xe1, xdfenv_t *xe2, xdmerge_t *m,
		xpparam_t const *xpp)
{
	for (; m; m = m->next) {
		mmfile_t t1, t2;
		xdfenv_t xe;
		xdchange_t *xscr, *x;
		int i1 = m->i1, i2 = m->i2;

		/* let's handle just the conflicts */
		if (m->mode)
			continue;

		/* no sense refining a conflict when one side is empty */
		if (m->chg1 == 0 || m->chg2 == 0)
			continue;

		/*
		 * This probably does not work outside git, since
		 * we have a very simple mmfile structure.
		 */
		t1.ptr = (char *)xe1->xdf2.recs[m->i1]->ptr;
		t1.size = xe1->xdf2.recs[m->i1 + m->chg1 - 1]->ptr
			+ xe1->xdf2.recs[m->i1 + m->chg1 - 1]->size - t1.ptr;
		t2.ptr = (char *)xe2->xdf2.recs[m->i2]->ptr;
		t2.size = xe2->xdf2.recs[m->i2 + m->chg2 - 1]->ptr
			+ xe2->xdf2.recs[m->i2 + m->chg2 - 1]->size - t2.ptr;
		if (xdl_do_diff(&t1, &t2, xpp, &xe) < 0)
			return -1;
		if (xdl_change_compact(&xe.xdf1, &xe.xdf2, xpp->flags) < 0 ||
		    xdl_change_compact(&xe.xdf2, &xe.xdf1, xpp->flags) < 0 ||
		    xdl_build_script(&xe, &xscr) < 0) {
			xdl_free_env(&xe);
			return -1;
		}
		if (!xscr) {
			/* If this happens, the changes are identical. */
			xdl_free_env(&xe);
			m->mode = 4;
			continue;
		}
		x = xscr;
		m->i1 = xscr->i1 + i1;
		m->chg1 = xscr->chg1;
		m->i2 = xscr->i2 + i2;
		m->chg2 = xscr->chg2;
		while (xscr->next) {
			xdmerge_t *m2 = xdl_malloc(sizeof(xdmerge_t));
			if (!m2) {
				xdl_free_env(&xe);
				xdl_free_script(x);
				return -1;
			}
			xscr = xscr->next;
			m2->next = m->next;
			m->next = m2;
			m = m2;
			m->mode = 0;
			m->i1 = xscr->i1 + i1;
			m->chg1 = xscr->chg1;
			m->i2 = xscr->i2 + i2;
			m->chg2 = xscr->chg2;
		}
		xdl_free_env(&xe);
		xdl_free_script(x);
	}
	return 0;
}

// Assembly:
subq $0x178, %rsp            # imm = 0x178
movq %rdi, 0x168(%rsp)
movq %rsi, 0x160(%rsp)
movq %rdx, 0x158(%rsp)
movq %rcx, 0x150(%rsp)
cmpq $0x0, 0x158(%rsp)
je 0x95df
movq 0x158(%rsp), %rax
movq 0x10(%rax), %rax
movl %eax, 0xc(%rsp)
movq 0x158(%rsp), %rax
movq 0x18(%rax), %rax
movl %eax, 0x8(%rsp)
movq 0x158(%rsp), %rax
cmpl $0x0, 0x8(%rax)
je 0x9209
jmp 0x95c7
movq 0x158(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x9227
movq 0x158(%rsp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x922c
jmp 0x95c7
movq 0x168(%rsp), %rax
movq 0xe8(%rax), %rax
movq 0x158(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movq %rax, 0x140(%rsp)
movq 0x168(%rsp), %rax
movq 0xe8(%rax), %rax
movq 0x158(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq 0x158(%rsp), %rdx
addq 0x20(%rdx), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movq 0x168(%rsp), %rcx
movq 0xe8(%rcx), %rcx
movq 0x158(%rsp), %rdx
movq 0x10(%rdx), %rdx
movq 0x158(%rsp), %rsi
addq 0x20(%rsi), %rdx
subq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
addq 0x10(%rcx), %rax
movq 0x140(%rsp), %rcx
subq %rcx, %rax
movq %rax, 0x148(%rsp)
movq 0x160(%rsp), %rax
movq 0xe8(%rax), %rax
movq 0x158(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movq %rax, 0x130(%rsp)
movq 0x160(%rsp), %rax
movq 0xe8(%rax), %rax
movq 0x158(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq 0x158(%rsp), %rdx
addq 0x28(%rdx), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movq 0x160(%rsp), %rcx
movq 0xe8(%rcx), %rcx
movq 0x158(%rsp), %rdx
movq 0x18(%rdx), %rdx
movq 0x158(%rsp), %rsi
addq 0x28(%rsi), %rdx
subq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
addq 0x10(%rcx), %rax
movq 0x130(%rsp), %rcx
subq %rcx, %rax
movq %rax, 0x138(%rsp)
movq 0x150(%rsp), %rdx
leaq 0x140(%rsp), %rdi
leaq 0x130(%rsp), %rsi
leaq 0x20(%rsp), %rcx
callq 0x2330
cmpl $0x0, %eax
jge 0x93ab
movl $0xffffffff, 0x174(%rsp) # imm = 0xFFFFFFFF
jmp 0x95ea
leaq 0x20(%rsp), %rdi
leaq 0x20(%rsp), %rsi
addq $0x88, %rsi
movq 0x150(%rsp), %rax
movq (%rax), %rdx
callq 0x2690
cmpl $0x0, %eax
jl 0x940b
leaq 0x20(%rsp), %rdi
addq $0x88, %rdi
leaq 0x20(%rsp), %rsi
movq 0x150(%rsp), %rax
movq (%rax), %rdx
callq 0x2690
cmpl $0x0, %eax
jl 0x940b
leaq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x3110
cmpl $0x0, %eax
jge 0x9425
leaq 0x20(%rsp), %rdi
callq 0x6080
movl $0xffffffff, 0x174(%rsp) # imm = 0xFFFFFFFF
jmp 0x95ea
cmpq $0x0, 0x18(%rsp)
jne 0x944b
leaq 0x20(%rsp), %rdi
callq 0x6080
movq 0x158(%rsp), %rax
movl $0x4, 0x8(%rax)
jmp 0x95c7
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rcx
movslq 0xc(%rsp), %rax
addq %rax, %rcx
movq 0x158(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x158(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rcx
movslq 0x8(%rsp), %rax
addq %rax, %rcx
movq 0x158(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rcx
movq 0x158(%rsp), %rax
movq %rcx, 0x28(%rax)
movq 0x18(%rsp), %rax
cmpq $0x0, (%rax)
je 0x95b3
movl $0x40, %edi
callq 0x10f0
movq %rax, (%rsp)
cmpq $0x0, (%rsp)
jne 0x9501
leaq 0x20(%rsp), %rdi
callq 0x6080
movq 0x10(%rsp), %rdi
callq 0x3360
movl $0xffffffff, 0x174(%rsp) # imm = 0xFFFFFFFF
jmp 0x95ea
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x158(%rsp), %rax
movq (%rax), %rcx
movq (%rsp), %rax
movq %rcx, (%rax)
movq (%rsp), %rcx
movq 0x158(%rsp), %rax
movq %rcx, (%rax)
movq (%rsp), %rax
movq %rax, 0x158(%rsp)
movq 0x158(%rsp), %rax
movl $0x0, 0x8(%rax)
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rcx
movslq 0xc(%rsp), %rax
addq %rax, %rcx
movq 0x158(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x158(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rcx
movslq 0x8(%rsp), %rax
addq %rax, %rcx
movq 0x158(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rcx
movq 0x158(%rsp), %rax
movq %rcx, 0x28(%rax)
jmp 0x94b9
leaq 0x20(%rsp), %rdi
callq 0x6080
movq 0x10(%rsp), %rdi
callq 0x3360
movq 0x158(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x158(%rsp)
jmp 0x91c7
movl $0x0, 0x174(%rsp)
movl 0x174(%rsp), %eax
addq $0x178, %rsp            # imm = 0x178
retq
nopl (%rax)