// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/build.c
// Function: clockdir
int clockdir(short wallstart)   //Returns: 0 is CW, 1 is CCW
{
	short i, themin;
	int minx, templong, x0, x1, x2, y0, y1, y2;

	minx = 0x7fffffff;
	themin = -1;
	i = wallstart-1;
	do
	{
		i++;
		if (wall[wall[i].point2].x < minx)
		{
			minx = wall[wall[i].point2].x;
			themin = i;
		}
	}
	while ((wall[i].point2 != wallstart) && (i < MAXWALLS));

	x0 = wall[themin].x;
	y0 = wall[themin].y;
	x1 = wall[wall[themin].point2].x;
	y1 = wall[wall[themin].point2].y;
	x2 = wall[wall[wall[themin].point2].point2].x;
	y2 = wall[wall[wall[themin].point2].point2].y;

	if ((y1 >= y2) && (y1 <= y0)) return(0);
	if ((y1 >= y0) && (y1 <= y2)) return(1);

	templong = (x0-x1)*(y2-y1) - (x2-x1)*(y0-y1);
	if (templong < 0)
		return(0);
	else
		return(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movw %di, %ax
movw %ax, -0x6(%rbp)
movl $0x7fffffff, -0x10(%rbp) # imm = 0x7FFFFFFF
movw $0xffff, -0xa(%rbp)     # imm = 0xFFFF
movswl -0x6(%rbp), %eax
subl $0x1, %eax
movw %ax, -0x8(%rbp)
movw -0x8(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x8(%rbp)
movswq -0x8(%rbp), %rcx
leaq 0x1cae55(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswq 0x8(%rax), %rcx
leaq 0x1cae42(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpl -0x10(%rbp), %eax
jge 0x2a7af
movswq -0x8(%rbp), %rcx
leaq 0x1cae28(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswq 0x8(%rax), %rcx
leaq 0x1cae15(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x10(%rbp)
movw -0x8(%rbp), %ax
movw %ax, -0xa(%rbp)
jmp 0x2a7b1
movswq -0x8(%rbp), %rcx
leaq 0x1cadf3(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x8(%rax), %ecx
movswl -0x6(%rbp), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x2d(%rbp)
je 0x2a7e4
movswl -0x8(%rbp), %eax
cmpl $0x4000, %eax           # imm = 0x4000
setl %al
movb %al, -0x2d(%rbp)
movb -0x2d(%rbp), %al
testb $0x1, %al
jne 0x2a743
movswq -0xa(%rbp), %rcx
leaq 0x1cadb5(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x18(%rbp)
movswq -0xa(%rbp), %rcx
leaq 0x1cad9d(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x24(%rbp)
movswq -0xa(%rbp), %rcx
leaq 0x1cad84(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswq 0x8(%rax), %rcx
leaq 0x1cad71(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
movswq -0xa(%rbp), %rcx
leaq 0x1cad59(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswq 0x8(%rax), %rcx
leaq 0x1cad46(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x28(%rbp)
movswq -0xa(%rbp), %rcx
leaq 0x1cad2d(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswq 0x8(%rax), %rcx
leaq 0x1cad1a(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswq 0x8(%rax), %rcx
leaq 0x1cad07(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x20(%rbp)
movswq -0xa(%rbp), %rcx
leaq 0x1cacef(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswq 0x8(%rax), %rcx
leaq 0x1cacdc(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movswq 0x8(%rax), %rcx
leaq 0x1cacc9(%rip), %rax    # 0x1f55b0
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jl 0x2a90d
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0x2a90d
movl $0x0, -0x4(%rbp)
jmp 0x2a95f
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jl 0x2a926
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jg 0x2a926
movl $0x1, -0x4(%rbp)
jmp 0x2a95f
movl -0x18(%rbp), %eax
subl -0x1c(%rbp), %eax
movl -0x2c(%rbp), %ecx
subl -0x28(%rbp), %ecx
imull %ecx, %eax
movl -0x20(%rbp), %ecx
subl -0x1c(%rbp), %ecx
movl -0x24(%rbp), %edx
subl -0x28(%rbp), %edx
imull %edx, %ecx
subl %ecx, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x2a958
movl $0x0, -0x4(%rbp)
jmp 0x2a95f
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)