// File: /workspace/github_cpp_makefile_star2_O3/kipa00[P]AplusB-mc/compiler/analyze.cpp
// Function: redstone_into(world const&, int, int, int, int, int, int)
bool redstone_into(const world &w, int x, int y, int z, int ox, int oy, int oz) {
	if (abs(x - ox) + abs(y - oy) + abs(z - oz) != 1) return false;
	if (x == ox && y - 1 == oy && z == oz) return true;
	if (y != oy) return false;

	bool block_upper = is_opaque(w.getXYZ(x, y + 1, z));
#define f(dx,dz) (\
	(w.getXYZ(x + dx, y, z + dz) & BLOCK_ONLY) == REDSTONE_WIRE\
	|| ((w.getXYZ(x + dx, y + 1, z + dz) & BLOCK_ONLY) == REDSTONE_WIRE && !block_upper)\
	|| ((w.getXYZ(x + dx, y - 1, z + dz) & BLOCK_ONLY) == REDSTONE_WIRE && !is_opaque(w.getXYZ(x + dx, y, z + dz)))\
)
	bool east = f(1, 0);
	bool west = f(-1, 0);
	bool south = f(0, 1);
	bool north = f(0, -1);
#undef f
	int flag = east + west + south + north;
	if (!flag) {
		east = west = south = north = true;
	} else if (flag == 1) {
		if (east) west = true;
		else if (west) east = true;
		else if (south) north = true;
		else if (north) south = true;
	}
	if (x + 1 == ox) return east;
	else if (x - 1 == ox) return west;
	else if (z + 1 == oz) return south;
	else if (z - 1 == oz) return north;
	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %ebx
movl %edx, %r15d
movl %esi, %r12d
movl %esi, %eax
subl %r8d, %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
movl 0x60(%rsp), %esi
movl %edx, %eax
subl %r9d, %eax
movl %eax, %edx
negl %edx
cmovsl %eax, %edx
addl %ecx, %edx
movl %ebx, %eax
subl %esi, %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
addl %edx, %ecx
cmpl $0x1, %ecx
jne 0x54f0
movl %r12d, %eax
xorl %r8d, %eax
leal -0x1(%r15), %edx
movl %edx, %ecx
xorl %r9d, %ecx
orl %eax, %ecx
movl %ebx, %eax
xorl %esi, %eax
movb $0x1, %r14b
orl %ecx, %eax
je 0x54f3
cmpl %r9d, %r15d
jne 0x54f0
movl %r8d, 0x20(%rsp)
movl %edx, 0x10(%rsp)
leal 0x1(%r15), %ebp
movq %rdi, 0x8(%rsp)
movq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x51ec
movzbl %al, %edi
callq 0x7c5a
movl %eax, %r14d
leal 0x1(%r12), %r13d
movq 0x8(%rsp), %rdi
movl %r13d, %esi
movl %r15d, %edx
movl %ebx, %ecx
callq 0x51ec
movq 0x8(%rsp), %rcx
andb $-0x10, %al
movb $0x1, %dl
movl %edx, 0x18(%rsp)
notb %r14b
movb %r14b, 0x7(%rsp)
movb $0x1, %r14b
cmpb $0x40, %al
je 0x550b
movq 0x8(%rsp), %rdi
movl %r13d, %esi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x51ec
movq 0x8(%rsp), %rcx
andb $-0x10, %al
cmpb $0x40, %al
sete %al
movb $0x1, %r14b
testb %al, 0x7(%rsp)
jne 0x550b
movq %rcx, %r14
movq %rcx, %rdi
movl %r13d, %esi
movl 0x10(%rsp), %edx
movl %ebx, %ecx
callq 0x51ec
andb $-0x10, %al
cmpb $0x40, %al
jne 0x5505
movq %r14, %rdi
movl %r13d, %esi
movl %r15d, %edx
movl %ebx, %ecx
callq 0x51ec
movzbl %al, %edi
callq 0x7c5a
movq %r14, %rcx
movl %eax, %r14d
xorb $0x1, %r14b
jmp 0x550b
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rcx
xorl %r14d, %r14d
movl %ebp, 0x1c(%rsp)
movl %r13d, 0x24(%rsp)
leal -0x1(%r12), %ebp
movq %rcx, %r13
movq %rcx, %rdi
movl %ebp, %esi
movl %r15d, %edx
movl %ebx, %ecx
callq 0x51ec
andb $-0x10, %al
cmpb $0x40, %al
movl %ebp, 0x14(%rsp)
je 0x5593
movq %r13, %rdi
movl %ebp, %esi
movl 0x1c(%rsp), %edx
movl %ebx, %ecx
callq 0x51ec
andb $-0x10, %al
cmpb $0x40, %al
sete %al
testb %al, 0x7(%rsp)
jne 0x5593
movq %r13, %rdi
movl 0x14(%rsp), %ebp
movl %ebp, %esi
movl 0x10(%rsp), %edx
movl %ebx, %ecx
callq 0x51ec
andb $-0x10, %al
cmpb $0x40, %al
jne 0x558b
movq %r13, %rdi
movl %ebp, %esi
movl %r15d, %edx
movl %ebx, %ecx
callq 0x51ec
movzbl %al, %edi
callq 0x7c5a
xorb $0x1, %al
movl %eax, 0x18(%rsp)
jmp 0x5593
movl $0x0, 0x18(%rsp)
leal 0x1(%rbx), %ebp
movq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %r15d, %edx
movl %ebp, %ecx
callq 0x51ec
movq 0x8(%rsp), %r13
andb $-0x10, %al
movb $0x1, %cl
cmpb $0x40, %al
je 0x5614
movq 0x8(%rsp), %rdi
movl %r12d, %esi
movl 0x1c(%rsp), %edx
movl %ebp, %ecx
callq 0x51ec
movq 0x8(%rsp), %r13
andb $-0x10, %al
cmpb $0x40, %al
sete %al
movb $0x1, %cl
testb %al, 0x7(%rsp)
jne 0x5614
movq %r13, %rdi
movl %r12d, %esi
movl 0x10(%rsp), %edx
movl %ebp, %ecx
callq 0x51ec
andb $-0x10, %al
cmpb $0x40, %al
jne 0x5612
movq %r13, %rdi
movl %r12d, %esi
movl %r15d, %edx
movl %ebp, %ecx
callq 0x51ec
movzbl %al, %edi
callq 0x7c5a
movl %eax, %ecx
xorb $0x1, %cl
jmp 0x5614
xorl %ecx, %ecx
movl %ecx, 0x8(%rsp)
decl %ebx
movq %r13, %rdi
movl %r12d, %esi
movl %r15d, %edx
movl %ebx, %ecx
callq 0x51ec
andb $-0x10, %al
cmpb $0x40, %al
jne 0x5634
movb $0x1, %al
jmp 0x5689
movq %r13, %rdi
movl %r12d, %esi
movl 0x1c(%rsp), %edx
movl %ebx, %ecx
callq 0x51ec
andb $-0x10, %al
cmpb $0x40, %al
sete %al
testb %al, 0x7(%rsp)
movb $0x1, %al
jne 0x5689
movq %r13, %rdi
movl %r12d, %esi
movl 0x10(%rsp), %edx
movl %ebx, %ecx
callq 0x51ec
andb $-0x10, %al
cmpb $0x40, %al
jne 0x5687
movq %r13, %rdi
movl %r12d, %esi
movl %r15d, %edx
movl %ebx, %ecx
callq 0x51ec
movzbl %al, %edi
callq 0x7c5a
xorb $0x1, %al
jmp 0x5689
xorl %eax, %eax
movzbl %r14b, %edx
movl 0x18(%rsp), %esi
movzbl %sil, %ecx
addl %edx, %ecx
movl 0x8(%rsp), %r8d
movzbl %r8b, %edx
addl %ecx, %edx
movzbl %al, %edi
addl %edx, %edi
movl 0x60(%rsp), %ecx
movl 0x20(%rsp), %edx
je 0x56cc
cmpl $0x1, %edi
jne 0x56d7
testb %r14b, %r14b
movl 0x14(%rsp), %edi
jne 0x56c4
testb %sil, %sil
je 0x5709
movb $0x1, %r14b
movb $0x1, %sil
jmp 0x56db
movb $0x1, %r14b
movb $0x1, %sil
movb $0x1, %r8b
movb $0x1, %al
movl 0x14(%rsp), %edi
cmpl %edx, 0x24(%rsp)
je 0x54f3
movl %esi, %r14d
cmpl %edx, %edi
je 0x54f3
movl %r8d, %r14d
cmpl %ecx, %ebp
je 0x54f3
cmpl %ecx, %ebx
sete %r14b
andb %al, %r14b
jmp 0x54f3
orb %al, %r8b
xorl %r14d, %r14d
xorl %esi, %esi
movl %r8d, %eax
jmp 0x56db