// File: /workspace/github_cpp_makefile_star2_O1/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 0x5558
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 0x555b
cmpl %r9d, %r15d
jne 0x5558
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 0x5254
movzbl %al, %edi
callq 0x7cfe
movl %eax, %r14d
leal 0x1(%r12), %r13d
movq 0x8(%rsp), %rdi
movl %r13d, %esi
movl %r15d, %edx
movl %ebx, %ecx
callq 0x5254
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 0x5573
movq 0x8(%rsp), %rdi
movl %r13d, %esi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x5254
movq 0x8(%rsp), %rcx
andb $-0x10, %al
cmpb $0x40, %al
sete %al
movb $0x1, %r14b
testb %al, 0x7(%rsp)
jne 0x5573
movq %rcx, %r14
movq %rcx, %rdi
movl %r13d, %esi
movl 0x10(%rsp), %edx
movl %ebx, %ecx
callq 0x5254
andb $-0x10, %al
cmpb $0x40, %al
jne 0x556d
movq %r14, %rdi
movl %r13d, %esi
movl %r15d, %edx
movl %ebx, %ecx
callq 0x5254
movzbl %al, %edi
callq 0x7cfe
movq %r14, %rcx
movl %eax, %r14d
xorb $0x1, %r14b
jmp 0x5573
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 0x5254
andb $-0x10, %al
cmpb $0x40, %al
movl %ebp, 0x14(%rsp)
je 0x55fb
movq %r13, %rdi
movl %ebp, %esi
movl 0x1c(%rsp), %edx
movl %ebx, %ecx
callq 0x5254
andb $-0x10, %al
cmpb $0x40, %al
sete %al
testb %al, 0x7(%rsp)
jne 0x55fb
movq %r13, %rdi
movl 0x14(%rsp), %ebp
movl %ebp, %esi
movl 0x10(%rsp), %edx
movl %ebx, %ecx
callq 0x5254
andb $-0x10, %al
cmpb $0x40, %al
jne 0x55f3
movq %r13, %rdi
movl %ebp, %esi
movl %r15d, %edx
movl %ebx, %ecx
callq 0x5254
movzbl %al, %edi
callq 0x7cfe
xorb $0x1, %al
movl %eax, 0x18(%rsp)
jmp 0x55fb
movl $0x0, 0x18(%rsp)
leal 0x1(%rbx), %ebp
movq 0x8(%rsp), %rdi
movl %r12d, %esi
movl %r15d, %edx
movl %ebp, %ecx
callq 0x5254
movq 0x8(%rsp), %r13
andb $-0x10, %al
movb $0x1, %cl
cmpb $0x40, %al
je 0x567c
movq 0x8(%rsp), %rdi
movl %r12d, %esi
movl 0x1c(%rsp), %edx
movl %ebp, %ecx
callq 0x5254
movq 0x8(%rsp), %r13
andb $-0x10, %al
cmpb $0x40, %al
sete %al
movb $0x1, %cl
testb %al, 0x7(%rsp)
jne 0x567c
movq %r13, %rdi
movl %r12d, %esi
movl 0x10(%rsp), %edx
movl %ebp, %ecx
callq 0x5254
andb $-0x10, %al
cmpb $0x40, %al
jne 0x567a
movq %r13, %rdi
movl %r12d, %esi
movl %r15d, %edx
movl %ebp, %ecx
callq 0x5254
movzbl %al, %edi
callq 0x7cfe
movl %eax, %ecx
xorb $0x1, %cl
jmp 0x567c
xorl %ecx, %ecx
movl %ecx, 0x8(%rsp)
decl %ebx
movq %r13, %rdi
movl %r12d, %esi
movl %r15d, %edx
movl %ebx, %ecx
callq 0x5254
andb $-0x10, %al
cmpb $0x40, %al
jne 0x569c
movb $0x1, %al
jmp 0x56f1
movq %r13, %rdi
movl %r12d, %esi
movl 0x1c(%rsp), %edx
movl %ebx, %ecx
callq 0x5254
andb $-0x10, %al
cmpb $0x40, %al
sete %al
testb %al, 0x7(%rsp)
movb $0x1, %al
jne 0x56f1
movq %r13, %rdi
movl %r12d, %esi
movl 0x10(%rsp), %edx
movl %ebx, %ecx
callq 0x5254
andb $-0x10, %al
cmpb $0x40, %al
jne 0x56ef
movq %r13, %rdi
movl %r12d, %esi
movl %r15d, %edx
movl %ebx, %ecx
callq 0x5254
movzbl %al, %edi
callq 0x7cfe
xorb $0x1, %al
jmp 0x56f1
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 0x572c
cmpl $0x1, %edi
jne 0x5737
testb %r14b, %r14b
movl 0x14(%rsp), %edi
je 0x5769
movb $0x1, %sil
jmp 0x573b
movb $0x1, %r14b
movb $0x1, %sil
movb $0x1, %r8b
movb $0x1, %al
movl 0x14(%rsp), %edi
cmpl %edx, 0x24(%rsp)
je 0x555b
movl %esi, %r14d
cmpl %edx, %edi
je 0x555b
movl %r8d, %r14d
cmpl %ecx, %ebp
je 0x555b
cmpl %ecx, %ebx
sete %r14b
andb %al, %r14b
jmp 0x555b
testb %sil, %sil
je 0x5773
movb $0x1, %r14b
jmp 0x573b
orb %al, %r8b
movl %r8d, %eax
jmp 0x573b