// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
movl %esi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
movswl -0x2(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
movswl %ax, %edi
callq 0x58ba0
movw %ax, -0xe(%rbp)
movswq -0xe(%rbp), %rcx
leaq 0x256359(%rip), %rax    # 0x2805c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movw 0x2(%rax), %cx
addw $0x1, %cx
movw %cx, 0x2(%rax)
movswl -0xe(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
leaq 0x3e2832(%rip), %rcx    # 0x40cac0
movswl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x2a2bc
movslq -0x14(%rbp), %rcx
leaq 0x256320(%rip), %rax    # 0x2805c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2a284
movl -0x18(%rbp), %edi
addl $0x1, %edi
movl $0x1, %esi
callq 0x2b860
movl -0x18(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x1cb2d4(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x18(%rbp), %rdx
leaq 0x1cb2c2(%rip), %rcx    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rax)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movw %ax, %cx
movslq -0x18(%rbp), %rdx
leaq 0x1cb289(%rip), %rax    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rax
movw %cx, 0x8(%rax)
movl -0x8(%rbp), %ecx
movl -0x18(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
leaq 0x1cb26b(%rip), %rax    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl -0xc(%rbp), %ecx
movl -0x18(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
leaq 0x1cb24f(%rip), %rax    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl -0x18(%rbp), %eax
movswl %ax, %edi
callq 0x23550
movl -0x18(%rbp), %eax
cwtl
addl $0x1, %eax
movswl %ax, %edi
callq 0x23550
movslq -0x18(%rbp), %rcx
leaq 0x1cb220(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0xa(%rax), %eax
cmpl $0x0, %eax
jl 0x2a58f
movslq -0x18(%rbp), %rcx
leaq 0x1cb201(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0xa(%rax), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movswl %ax, %edi
callq 0x58ba0
movw %ax, -0xe(%rbp)
movswq -0xe(%rbp), %rcx
leaq 0x2561e8(%rip), %rax    # 0x2805c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movw 0x2(%rax), %cx
addw $0x1, %cx
movw %cx, 0x2(%rax)
movswl -0xe(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
leaq 0x3e26c1(%rip), %rcx    # 0x40cac0
movswl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x2a42d
movslq -0x14(%rbp), %rcx
leaq 0x2561af(%rip), %rax    # 0x2805c0
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2a3f5
movl -0x1c(%rbp), %edi
addl $0x1, %edi
movl $0x1, %esi
callq 0x2b860
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x1cb163(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x1c(%rbp), %rdx
leaq 0x1cb151(%rip), %rcx    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movw %ax, %cx
movslq -0x1c(%rbp), %rdx
leaq 0x1cb118(%rip), %rax    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rax
movw %cx, 0x8(%rax)
movl -0x8(%rbp), %ecx
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
leaq 0x1cb0fa(%rip), %rax    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl -0xc(%rbp), %ecx
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
leaq 0x1cb0de(%rip), %rax    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl -0x1c(%rbp), %eax
movswl %ax, %edi
callq 0x23550
movl -0x1c(%rbp), %eax
cwtl
addl $0x1, %eax
movswl %ax, %edi
callq 0x23550
movslq -0x1c(%rbp), %rcx
leaq 0x1cb0af(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0xa(%rax), %eax
movl %eax, -0x18(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movw %ax, %cx
movslq -0x18(%rbp), %rdx
leaq 0x1cb08d(%rip), %rax    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rax
movw %cx, 0xa(%rax)
movl -0x1c(%rbp), %eax
movw %ax, %cx
movl -0x18(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
leaq 0x1cb06c(%rip), %rax    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rax
movw %cx, 0xa(%rax)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movw %ax, %cx
movslq -0x1c(%rbp), %rdx
leaq 0x1cb04d(%rip), %rax    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rax
movw %cx, 0xa(%rax)
movl -0x18(%rbp), %eax
movw %ax, %cx
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
leaq 0x1cb02c(%rip), %rax    # 0x1f55b0
shlq $0x5, %rdx
addq %rdx, %rax
movw %cx, 0xa(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)