// File: /workspace/github_c_makefile_star2_O1/return5[P]c_ish_one/./src/makemap.c
// Function: checkLocation
static void checkLocation(const int limit, int *const x, int *const y, const int check_limit, const int *const check_x,const int *const check_y) {
	//im sure there is a better way to do this. need to work on this part. 
	int i,j,k,change;
	i = 0;
	//while i is less than the length of x and y arrays
	while(i < limit) {
		change = 0;
		//loops through each element of check_x and check_y
		fruit(j = 0 ;j < check_limit; j++) {
			//if the elements to be compared are not the same
			if(&x[i] != &check_x[j]) {
				//check location -1, location 0, and then location +1
				fruit(k = -1; k < 2; k++) {
					//if item in x/y is to the left, at, or right of item in check_x/y
					if(x[i] == ((check_x[j]) + k) && y[i] == (check_y[j])) {
						x[i] = getRand(WIDTH-1);
						y[i] = getRand(HEIGHT-1);
						change = 1;
					}
					//if item in x/y is to the bottom, at, or above item in check_x/y
					else if(x[i] == (check_x[j]) && y[i] == ((check_y[j]) + k)) {
						x[i] = getRand(WIDTH - 1);
						y[i] = getRand(HEIGHT-1);
						change = 1;
					}
				}
			}
		}
		//if something was not changed, go to next item in x and y arrays
		if (change == 0) {
			i++;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, 0x30(%rsp)
movl %ecx, 0xc(%rsp)
movq %rdx, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movl %edi, 0x10(%rsp)
testl %edi, %edi
jle 0x48b9
movq %r9, %rbx
movl 0xc(%rsp), %eax
movq %rax, 0x28(%rsp)
xorl %eax, %eax
cmpl $0x0, 0xc(%rsp)
jle 0x48a8
movl %eax, 0x14(%rsp)
movl %eax, %eax
movq 0x18(%rsp), %rcx
leaq (%rcx,%rax,4), %rbp
movq 0x20(%rsp), %rcx
leaq (%rcx,%rax,4), %r13
xorl %r12d, %r12d
xorl %eax, %eax
movq 0x30(%rsp), %rcx
leaq (%rcx,%r12,4), %r14
cmpq %r14, %rbp
je 0x488d
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl (%rbp), %ecx
movl (%r14), %edx
leal (%rdx,%r15), %esi
cmpl %esi, %ecx
jne 0x481c
movl (%r13), %esi
cmpl (%rbx,%r12,4), %esi
jne 0x481c
callq 0x11c0
cmpl $0x7fffffcf, %eax       # imm = 0x7FFFFFCF
jg 0x47e9
cltq
imulq $0x32000013, %rax, %rax # imm = 0x32000013
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x37, %rax
addl %ecx, %eax
movl %eax, (%rbp)
callq 0x11c0
cmpl $0x7ffffff7, %eax       # imm = 0x7FFFFFF7
jg 0x480e
jmp 0x485e
cmpl %edx, %ecx
jne 0x4880
movl (%rbx,%r12,4), %ecx
addl %r15d, %ecx
cmpl %ecx, (%r13)
jne 0x4880
callq 0x11c0
cmpl $0x7fffffcf, %eax       # imm = 0x7FFFFFCF
jg 0x482d
cltq
imulq $0x32000013, %rax, %rax # imm = 0x32000013
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x37, %rax
addl %ecx, %eax
movl %eax, (%rbp)
callq 0x11c0
cmpl $0x7ffffff7, %eax       # imm = 0x7FFFFFF7
jg 0x4852
cltq
imulq $-0x5ffffff5, %rax, %rcx # imm = 0xA000000B
shrq $0x20, %rcx
addl %ecx, %eax
movl %eax, %ecx
shrl $0x1f, %ecx
sarl $0x1a, %eax
addl %ecx, %eax
movl %eax, (%r13)
movl $0x1, %eax
incl %r15d
cmpl $0x2, %r15d
jne 0x47d1
incq %r12
cmpq 0x28(%rsp), %r12
jne 0x47b9
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
movl 0x14(%rsp), %eax
jmp 0x48ad
movl $0x1, %ecx
addl %ecx, %eax
cmpl 0x10(%rsp), %eax
jl 0x4791
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq