// File: /workspace/github_c_makefile_star2_O0/LemonBoy[P]autobahn/xdiff/xpatience.c
// Function: insert_record
static void insert_record(int line, struct hashmap *map, int pass)
{
	xrecord_t **records = pass == 1 ?
		map->env->xdf1.recs : map->env->xdf2.recs;
	xrecord_t *record = records[line - 1], *other;
	/*
	 * After xdl_prepare_env() (or more precisely, due to
	 * xdl_classify_record()), the "ha" member of the records (AKA lines)
	 * is _not_ the hash anymore, but a linearized version of it.  In
	 * other words, the "ha" member is guaranteed to start with 0 and
	 * the second record's ha can only be 0 or 1, etc.
	 *
	 * So we multiply ha by 2 in the hope that the hashing was
	 * "unique enough".
	 */
	int index = (int)((record->ha << 1) % map->alloc);

	while (map->entries[index].line1) {
		other = map->env->xdf1.recs[map->entries[index].line1 - 1];
		if (map->entries[index].hash != record->ha ||
				!xdl_recmatch(record->ptr, record->size,
					other->ptr, other->size,
					map->xpp->flags)) {
			if (++index >= map->alloc)
				index = 0;
			continue;
		}
		if (pass == 2)
			map->has_matches = 1;
		if (pass == 1 || map->entries[index].line2)
			map->entries[index].line2 = NON_UNIQUE;
		else
			map->entries[index].line2 = line;
		return;
	}
	if (pass == 2)
		return;
	map->entries[index].line1 = line;
	map->entries[index].hash = record->ha;
	if (!map->first)
		map->first = map->entries + index;
	if (map->last) {
		map->last->next = map->entries + index;
		map->entries[index].previous = map->last;
	}
	map->last = map->entries + index;
	map->nr++;
}

// Assembly:
subq $0x48, %rsp
movl %edi, 0x44(%rsp)
movq %rsi, 0x38(%rsp)
movl %edx, 0x34(%rsp)
cmpl $0x1, 0x34(%rsp)
jne 0x42bc
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x60(%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x42d1
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rax
movq 0xe8(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
movl 0x44(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
shlq %rax
movq 0x38(%rsp), %rcx
movslq 0x4(%rcx), %rcx
xorl %edx, %edx
divq %rcx
movl %edx, %eax
movl %eax, 0x14(%rsp)
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movslq 0x14(%rsp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x445e
movq 0x38(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x60(%rax), %rax
movq 0x38(%rsp), %rcx
movq 0x8(%rcx), %rcx
movslq 0x14(%rsp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x18(%rsp)
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movslq 0x14(%rsp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq 0x20(%rsp), %rcx
cmpq 0x18(%rcx), %rax
jne 0x43c3
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdx
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x38(%rsp), %rax
movq 0x40(%rax), %rax
movq (%rax), %r8
callq 0x7190
cmpl $0x0, %eax
jne 0x43e5
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
movq 0x38(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jl 0x43e0
movl $0x0, 0x14(%rsp)
jmp 0x4313
cmpl $0x2, 0x34(%rsp)
jne 0x43f9
movq 0x38(%rsp), %rax
movq $0x1, 0x20(%rax)
cmpl $0x1, 0x34(%rsp)
je 0x441c
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movslq 0x14(%rsp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x10(%rax)
je 0x443b
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movslq 0x14(%rsp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq $-0x1, 0x10(%rax)
jmp 0x4459
movslq 0x44(%rsp), %rcx
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movslq 0x14(%rsp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
jmp 0x454d
cmpl $0x2, 0x34(%rsp)
jne 0x446a
jmp 0x454d
movslq 0x44(%rsp), %rcx
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movslq 0x14(%rsp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movslq 0x14(%rsp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq 0x38(%rsp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x44d3
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rcx
movslq 0x14(%rsp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x38(%rsp), %rax
cmpq $0x0, 0x18(%rax)
je 0x4523
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rcx
movslq 0x14(%rsp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rcx
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rax
movq %rcx, 0x18(%rax)
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movslq 0x14(%rsp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x20(%rax)
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rcx
movslq 0x14(%rsp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x38(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)