// File: /workspace/github_c_makefile_star2_O1/jonof[P]jftekwar/jfbuild/src/build.c
// Function: insertpoint
void insertpoint(short linehighlight, int dax, int day)
{
	short sucksect;
	int i, j, k;

	j = linehighlight;
	sucksect = sectorofwall((short)j);

	sector[sucksect].wallnum++;
	for(i=sucksect+1;i<numsectors;i++)
		sector[i].wallptr++;

	movewalls((int)j+1,+1L);
	Bmemcpy(&wall[j+1],&wall[j],sizeof(walltype));

	wall[j].point2 = j+1;
	wall[j+1].x = dax;
	wall[j+1].y = day;
	fixrepeats((short)j);
	fixrepeats((short)j+1);

	if (wall[j].nextwall >= 0)
	{
		k = wall[j].nextwall;

		sucksect = sectorofwall((short)k);

		sector[sucksect].wallnum++;
		for(i=sucksect+1;i<numsectors;i++)
			sector[i].wallptr++;

		movewalls((int)k+1,+1L);
		Bmemcpy(&wall[k+1],&wall[k],sizeof(walltype));

		wall[k].point2 = k+1;
		wall[k+1].x = dax;
		wall[k+1].y = day;
		fixrepeats((short)k);
		fixrepeats((short)k+1);

		j = wall[k].nextwall;
		wall[j].nextwall = k+1;
		wall[j+1].nextwall = k;
		wall[k].nextwall = j+1;
		wall[k+1].nextwall = j;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %ebp
movl %edi, %r14d
callq 0x3bae9
movswq %ax, %rcx
leaq (%rcx,%rcx,4), %rcx
leaq 0x2264c2(%rip), %rsi    # 0x242a60
incw 0x2(%rsi,%rcx,8)
movswl %ax, %edx
leaq 0x3b29b3(%rip), %rcx    # 0x3cef60
movswl (%rcx), %ecx
incl %edx
cmpl %ecx, %edx
jge 0x1c5db
movslq %ecx, %rdx
movswq %ax, %rax
leaq (%rax,%rax,4), %rcx
leaq (%rsi,%rcx,8), %rcx
addq $0x28, %rcx
notq %rax
addq %rdx, %rax
incw (%rcx)
addq $0x28, %rcx
decq %rax
jne 0x1c5cf
movslq %r14d, %r13
shlq $0x5, %r13
movl %r14d, %r15d
incl %r15d
movl %r15d, %edi
movl $0x1, %esi
callq 0x1d235
leaq 0x19b454(%rip), %r12    # 0x1b7a50
movswq %r14w, %rax
movq %rax, %r14
shlq $0x5, %r14
movaps (%r12,%r14), %xmm0
movaps 0x10(%r12,%r14), %xmm1
movaps %xmm0, 0x20(%r13,%r12)
movaps %xmm1, 0x30(%r13,%r12)
movw %r15w, 0x8(%r12,%r14)
movl %ebp, 0x20(%r13,%r12)
movl %ebx, 0x24(%r13,%r12)
movswl %ax, %edi
callq 0x17c3a
movswl %r15w, %edi
callq 0x17c3a
movswl 0xa(%r12,%r14), %r13d
testl %r13d, %r13d
js 0x1c72a
movswl %r13w, %r14d
movl %r14d, %edi
callq 0x3bae9
movswq %ax, %rcx
leaq (%rcx,%rcx,4), %rcx
leaq 0x2263f7(%rip), %rsi    # 0x242a60
incw 0x2(%rsi,%rcx,8)
movswl %ax, %edx
leaq 0x3b28e8(%rip), %rcx    # 0x3cef60
movswl (%rcx), %ecx
incl %edx
cmpl %ecx, %edx
jge 0x1c6a6
movslq %ecx, %rdx
movswq %ax, %rax
leaq (%rax,%rax,4), %rcx
leaq (%rsi,%rcx,8), %rcx
addq $0x28, %rcx
notq %rax
addq %rdx, %rax
incw (%rcx)
addq $0x28, %rcx
decq %rax
jne 0x1c69a
leal 0x1(%r13), %r15d
movl %r15d, %edi
movl $0x1, %esi
callq 0x1d235
movl %r13d, %r13d
shlq $0x5, %r13
movaps (%r12,%r13), %xmm0
movaps 0x10(%r12,%r13), %xmm1
movaps %xmm0, 0x20(%r12,%r13)
movaps %xmm1, 0x30(%r12,%r13)
movw %r15w, 0x8(%r12,%r13)
movl %ebp, 0x20(%r12,%r13)
movl %ebx, 0x24(%r12,%r13)
movl %r14d, %edi
callq 0x17c3a
movswl %r15w, %ebx
movl %ebx, %edi
callq 0x17c3a
movswq 0xa(%r12,%r13), %rax
movq %rax, %rcx
shlq $0x5, %rcx
movw %bx, 0xa(%r12,%rcx)
movq %rax, %rcx
incq %rcx
movq %rcx, %rdx
shlq $0x5, %rdx
movw %r14w, 0xa(%r12,%rdx)
movw %cx, 0xa(%r12,%r13)
movw %ax, 0x2a(%r12,%r13)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq