// File: /workspace/github_cpp_makefile_star2_O2/kipa00[P]AplusB-mc/compiler/chunk.cpp
// Function: chunk::feed(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void chunk::feed(string attr, string val) {
	if (attr == "facing") {
		if (val == "east") {
			this->block |= EAST;
		} else if (val == "west") {
			this->block |= WEST;
		} else if (val == "south") {
			this->block |= SOUTH;
		} else if (val == "north") {
			this->block |= NORTH;
		} else {
			throw ATTR_VALUE_MISMATCH_ERROR;
		}
		this->attr |= ATTR_FACING;
	} else if (attr == "face") {
		if (val != "wall") {
			throw NOT_SUPPORTED_LEVER;
		}
		this->attr |= ATTR_FACE;
	} else if (attr == "power") {
		int power;
		if (sscanf(val.c_str(), "%d", &power) != 1 || !(0 <= power && power <= 15)) {
			throw ATTR_VALUE_MISMATCH_ERROR;
		}
		(this->block &= 240) |= power;
		this->attr |= ATTR_POWER;
	} else if (attr == "lit" || attr == "powered") {
		if (val == "true") {
			this->block |= POWERED;
		} else if (val != "false") {
			throw ATTR_VALUE_MISMATCH_ERROR;
		}
		this->attr |= attr == "lit" ? ATTR_LIT : ATTR_POWERED;
	} else if (attr == "delay") {
		int delay;
		if (sscanf(val.c_str(), "%d", &delay) != 1 || !(1 <= delay && delay <= 4)) {
			throw ATTR_VALUE_MISMATCH_ERROR;
		}
		this->block |= (delay - 1) << 3;
		this->attr |= ATTR_DELAY;
	} else if (attr == "mode") {
		if (val == "subtract") {
			this->block |= SUBTRACT;
		} else if (val != "compare") {
			throw ATTR_VALUE_MISMATCH_ERROR;
		}
		this->attr |= ATTR_MODE;
	} else if (attr == "locked") {
		if (val != "true" && val != "false") {
			throw ATTR_VALUE_MISMATCH_ERROR;
		}
		this->attr |= ATTR_LOCKED;
	} else if (attr == "east") {
		if (val != "none" && val != "side" && val != "up") {
			throw ATTR_VALUE_MISMATCH_ERROR;
		}
		this->attr |= ATTR_EAST;
	} else if (attr == "west") {
		if (val != "none" && val != "side" && val != "up") {
			throw ATTR_VALUE_MISMATCH_ERROR;
		}
		this->attr |= ATTR_WEST;
	} else if (attr == "south") {
		if (val != "none" && val != "side" && val != "up") {
			throw ATTR_VALUE_MISMATCH_ERROR;
		}
		this->attr |= ATTR_SOUTH;
	} else if (attr == "north") {
		if (val != "none" && val != "side" && val != "up") {
			throw ATTR_VALUE_MISMATCH_ERROR;
		}
		this->attr |= ATTR_NORTH;
	} else {
		fprintf(stderr, "Error: unknown attribute name '%s'\n", attr.c_str());
		throw UNKNOWN_ATTR_ERROR;
	}
#ifdef CHUNK_DEBUG
	printf("    %s : %s\n", attr.c_str(), val.c_str());
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x47af(%rip), %rsi      # 0x84ba
movq %r15, %rdi
callq 0x49b9
testb %al, %al
je 0x3d4c
leaq 0x47a3(%rip), %rsi      # 0x84c1
movq %r14, %rdi
callq 0x49b9
testb %al, %al
jne 0x3e44
leaq 0x4791(%rip), %rsi      # 0x84c6
movq %r14, %rdi
callq 0x49b9
testb %al, %al
je 0x3dd1
pushq $0x3
jmp 0x3e40
leaq 0x4784(%rip), %rsi      # 0x84d7
movq %r15, %rdi
callq 0x49b9
testb %al, %al
je 0x3d7f
leaq 0x4776(%rip), %rsi      # 0x84dc
movq %r14, %rdi
callq 0x49c6
testb %al, %al
jne 0x40ee
orb $0x2, 0x10(%rbx)
jmp 0x3e48
leaq 0x475b(%rip), %rsi      # 0x84e1
movq %r15, %rdi
callq 0x49b9
testb %al, %al
je 0x3de8
movq (%r14), %rdi
leaq 0x474b(%rip), %rsi      # 0x84e7
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x2130
cmpl $0x1, %eax
jne 0x40de
movl 0xc(%rsp), %eax
cmpl $0x10, %eax
jae 0x40de
movl $0xf0, %ecx
andl 0xc(%rbx), %ecx
orl %eax, %ecx
movl %ecx, 0xc(%rbx)
orb $0x4, 0x10(%rbx)
jmp 0x3e48
leaq 0x46f3(%rip), %rsi      # 0x84cb
movq %r14, %rdi
callq 0x49b9
testb %al, %al
je 0x3e27
pushq $0x2
jmp 0x3e40
leaq 0x46fb(%rip), %rsi      # 0x84ea
movq %r15, %rdi
callq 0x49b9
testb %al, %al
jne 0x3e0e
leaq 0x46ec(%rip), %rsi      # 0x84ee
movq %r15, %rdi
callq 0x49b9
testb %al, %al
je 0x3e87
leaq 0x46e1(%rip), %rsi      # 0x84f6
movq %r14, %rdi
callq 0x49b9
testb %al, %al
je 0x3e52
orb $0x4, 0xc(%rbx)
jmp 0x3e69
leaq 0x46a3(%rip), %rsi      # 0x84d1
movq %r14, %rdi
callq 0x49b9
testb %al, %al
je 0x40de
pushq $0x1
popq %rax
orl %eax, 0xc(%rbx)
orb $0x1, 0x10(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x46a2(%rip), %rsi      # 0x84fb
movq %r14, %rdi
callq 0x49c6
testb %al, %al
jne 0x40de
leaq 0x467a(%rip), %rsi      # 0x84ea
movq %r15, %rdi
callq 0x49b9
movzbl %al, %eax
leal 0x8(,%rax,8), %eax
orl %eax, 0x10(%rbx)
jmp 0x3e48
leaq 0x4673(%rip), %rsi      # 0x8501
movq %r15, %rdi
callq 0x49b9
testb %al, %al
je 0x3ef0
movq (%r14), %rdi
leaq 0x4643(%rip), %rsi      # 0x84e7
leaq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x2130
cmpl $0x1, %eax
jne 0x40de
movl 0x8(%rsp), %eax
leal -0x1(%rax), %ecx
cmpl $0x4, %ecx
jae 0x40de
leal -0x8(,%rax,8), %eax
movd %eax, %xmm0
movsd 0xc(%rbx), %xmm1
movaps 0x4490(%rip), %xmm2     # 0x8370
movss %xmm0, %xmm2            # xmm2 = xmm0[0],xmm2[1,2,3]
orps %xmm1, %xmm2
movlps %xmm2, 0xc(%rbx)
jmp 0x3e48
leaq 0x4610(%rip), %rsi      # 0x8507
movq %r15, %rdi
callq 0x49b9
testb %al, %al
je 0x3f1c
leaq 0x4602(%rip), %rsi      # 0x850c
movq %r14, %rdi
callq 0x49b9
testb %al, %al
je 0x3f62
orb $0x8, 0xc(%rbx)
jmp 0x3f79
leaq 0x45fa(%rip), %rsi      # 0x851d
movq %r15, %rdi
callq 0x49b9
testb %al, %al
je 0x3f82
leaq 0x45c0(%rip), %rsi      # 0x84f6
movq %r14, %rdi
callq 0x49c6
testb %al, %al
je 0x3f59
leaq 0x45b2(%rip), %rsi      # 0x84fb
movq %r14, %rdi
callq 0x49c6
testb %al, %al
jne 0x40de
orb $-0x80, 0x10(%rbx)
jmp 0x3e48
leaq 0x45ac(%rip), %rsi      # 0x8515
movq %r14, %rdi
callq 0x49c6
testb %al, %al
jne 0x40de
orb $0x40, 0x10(%rbx)
jmp 0x3e48
leaq 0x4538(%rip), %rsi      # 0x84c1
movq %r15, %rdi
callq 0x49b9
testb %al, %al
je 0x3fdb
leaq 0x4588(%rip), %rsi      # 0x8524
movq %r14, %rdi
callq 0x49c6
testb %al, %al
je 0x3fd2
leaq 0x457a(%rip), %rsi      # 0x8529
movq %r14, %rdi
callq 0x49c6
testb %al, %al
je 0x3fd2
leaq 0x456c(%rip), %rsi      # 0x852e
movq %r14, %rdi
callq 0x49c6
testb %al, %al
jne 0x40de
orb $0x1, 0x11(%rbx)
jmp 0x3e48
leaq 0x44e4(%rip), %rsi      # 0x84c6
movq %r15, %rdi
callq 0x49b9
testb %al, %al
je 0x4034
leaq 0x452f(%rip), %rsi      # 0x8524
movq %r14, %rdi
callq 0x49c6
testb %al, %al
je 0x402b
leaq 0x4521(%rip), %rsi      # 0x8529
movq %r14, %rdi
callq 0x49c6
testb %al, %al
je 0x402b
leaq 0x4513(%rip), %rsi      # 0x852e
movq %r14, %rdi
callq 0x49c6
testb %al, %al
jne 0x40de
orb $0x2, 0x11(%rbx)
jmp 0x3e48
leaq 0x4490(%rip), %rsi      # 0x84cb
movq %r15, %rdi
callq 0x49b9
testb %al, %al
je 0x4089
leaq 0x44d6(%rip), %rsi      # 0x8524
movq %r14, %rdi
callq 0x49c6
testb %al, %al
je 0x4080
leaq 0x44c8(%rip), %rsi      # 0x8529
movq %r14, %rdi
callq 0x49c6
testb %al, %al
je 0x4080
leaq 0x44ba(%rip), %rsi      # 0x852e
movq %r14, %rdi
callq 0x49c6
testb %al, %al
jne 0x40de
orb $0x4, 0x11(%rbx)
jmp 0x3e48
leaq 0x4441(%rip), %rsi      # 0x84d1
movq %r15, %rdi
callq 0x49b9
testb %al, %al
je 0x410d
leaq 0x4481(%rip), %rsi      # 0x8524
movq %r14, %rdi
callq 0x49c6
testb %al, %al
je 0x40d5
leaq 0x4473(%rip), %rsi      # 0x8529
movq %r14, %rdi
callq 0x49c6
testb %al, %al
je 0x40d5
leaq 0x4465(%rip), %rsi      # 0x852e
movq %r14, %rdi
callq 0x49c6
testb %al, %al
jne 0x40de
orb $0x8, 0x11(%rbx)
jmp 0x3e48
pushq $0x4
popq %rdi
callq 0x20b0
movl $0xfffffffe, (%rax)     # imm = 0xFFFFFFFE
jmp 0x40fc
pushq $0x4
popq %rdi
callq 0x20b0
movl $0xfffffff7, (%rax)     # imm = 0xFFFFFFF7
movq 0x7ec5(%rip), %rsi      # 0xbfc8
movq %rax, %rdi
xorl %edx, %edx
callq 0x2230
movq 0x7ecc(%rip), %rax      # 0xbfe0
movq (%rax), %rdi
movq (%r15), %rdx
leaq 0x4410(%rip), %rsi      # 0x8531
xorl %eax, %eax
callq 0x21f0
pushq $0x4
popq %rdi
callq 0x20b0
movl $0xfffffff9, (%rax)     # imm = 0xFFFFFFF9
jmp 0x40fc