// File: 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:
subq $0x48, %rsp
movq %rsi, 0x8(%rsp)
movq %rdi, %rax
movq 0x8(%rsp), %rdi
movq %rdi, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
movq %rax, 0x40(%rsp)
movq %rdi, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0xb4d3(%rip), %rsi      # 0x1346e
callq 0x9810
testb $0x1, %al
jne 0x7fa9
jmp 0x8084
movq 0x18(%rsp), %rdi
leaq 0xb4c0(%rip), %rsi      # 0x13475
callq 0x9810
testb $0x1, %al
jne 0x7fc0
jmp 0x7fd3
movq 0x20(%rsp), %rax
movl 0xc(%rax), %ecx
orl $0x0, %ecx
movl %ecx, 0xc(%rax)
jmp 0x8071
movq 0x18(%rsp), %rdi
leaq 0xb49b(%rip), %rsi      # 0x1347a
callq 0x9810
testb $0x1, %al
jne 0x7fea
jmp 0x7ffa
movq 0x20(%rsp), %rax
movl 0xc(%rax), %ecx
orl $0x3, %ecx
movl %ecx, 0xc(%rax)
jmp 0x806f
movq 0x18(%rsp), %rdi
leaq 0xb479(%rip), %rsi      # 0x1347f
callq 0x9810
testb $0x1, %al
jne 0x8011
jmp 0x8021
movq 0x20(%rsp), %rax
movl 0xc(%rax), %ecx
orl $0x2, %ecx
movl %ecx, 0xc(%rax)
jmp 0x806d
movq 0x18(%rsp), %rdi
leaq 0xb458(%rip), %rsi      # 0x13485
callq 0x9810
testb $0x1, %al
jne 0x8038
jmp 0x8048
movq 0x20(%rsp), %rax
movl 0xc(%rax), %ecx
orl $0x1, %ecx
movl %ecx, 0xc(%rax)
jmp 0x806b
movl $0x4, %edi
callq 0x20d0
movq %rax, %rdi
movl $0xfffffffe, (%rdi)     # imm = 0xFFFFFFFE
movq 0x11f66(%rip), %rsi     # 0x19fc8
xorl %eax, %eax
movl %eax, %edx
callq 0x22f0
jmp 0x806d
jmp 0x806f
jmp 0x8071
movq 0x20(%rsp), %rax
movl 0x10(%rax), %ecx
orl $0x1, %ecx
movl %ecx, 0x10(%rax)
jmp 0x869d
movq 0x10(%rsp), %rdi
leaq 0xb3fb(%rip), %rsi      # 0x1348b
callq 0x9810
testb $0x1, %al
jne 0x809b
jmp 0x80e8
movq 0x18(%rsp), %rdi
leaq 0xb3e9(%rip), %rsi      # 0x13490
callq 0x9840
testb $0x1, %al
jne 0x80b2
jmp 0x80d5
movl $0x4, %edi
callq 0x20d0
movq %rax, %rdi
movl $0xfffffff7, (%rdi)     # imm = 0xFFFFFFF7
movq 0x11efc(%rip), %rsi     # 0x19fc8
xorl %eax, %eax
movl %eax, %edx
callq 0x22f0
movq 0x20(%rsp), %rax
movl 0x10(%rax), %ecx
orl $0x2, %ecx
movl %ecx, 0x10(%rax)
jmp 0x869b
movq 0x10(%rsp), %rdi
leaq 0xb3a1(%rip), %rsi      # 0x13495
callq 0x9810
testb $0x1, %al
jne 0x8102
jmp 0x8182
movq 0x18(%rsp), %rdi
callq 0x20a0
movq %rax, %rdi
leaq 0xb385(%rip), %rsi      # 0x1349b
leaq 0x2c(%rsp), %rdx
movb $0x0, %al
callq 0x2190
cmpl $0x1, %eax
jne 0x8136
xorl %eax, %eax
cmpl 0x2c(%rsp), %eax
jg 0x8136
cmpl $0xf, 0x2c(%rsp)
jle 0x8159
movl $0x4, %edi
callq 0x20d0
movq %rax, %rdi
movl $0xfffffffe, (%rdi)     # imm = 0xFFFFFFFE
movq 0x11e78(%rip), %rsi     # 0x19fc8
xorl %eax, %eax
movl %eax, %edx
callq 0x22f0
movq 0x20(%rsp), %rax
movl 0x2c(%rsp), %ecx
movl 0xc(%rax), %edx
andl $0xf0, %edx
movl %edx, 0xc(%rax)
orl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movl 0x10(%rax), %ecx
orl $0x4, %ecx
movl %ecx, 0x10(%rax)
jmp 0x8699
movq 0x10(%rsp), %rdi
leaq 0xb310(%rip), %rsi      # 0x1349e
callq 0x9810
testb $0x1, %al
jne 0x81b1
movq 0x10(%rsp), %rdi
leaq 0xb2ff(%rip), %rsi      # 0x134a2
callq 0x9810
testb $0x1, %al
jne 0x81b1
jmp 0x8249
movq 0x18(%rsp), %rdi
leaq 0xb2ed(%rip), %rsi      # 0x134aa
callq 0x9810
testb $0x1, %al
jne 0x81c8
jmp 0x81d8
movq 0x20(%rsp), %rax
movl 0xc(%rax), %ecx
orl $0x4, %ecx
movl %ecx, 0xc(%rax)
jmp 0x8214
movq 0x18(%rsp), %rdi
leaq 0xb2cb(%rip), %rsi      # 0x134af
callq 0x9840
testb $0x1, %al
jne 0x81ef
jmp 0x8212
movl $0x4, %edi
callq 0x20d0
movq %rax, %rdi
movl $0xfffffffe, (%rdi)     # imm = 0xFFFFFFFE
movq 0x11dbf(%rip), %rsi     # 0x19fc8
xorl %eax, %eax
movl %eax, %edx
callq 0x22f0
jmp 0x8214
movq 0x10(%rsp), %rdi
leaq 0xb27e(%rip), %rsi      # 0x1349e
callq 0x9810
movb %al, %sil
movq 0x20(%rsp), %rax
movl $0x8, %ecx
movl $0x10, %edx
testb $0x1, %sil
cmovnel %edx, %ecx
orl 0x10(%rax), %ecx
movl %ecx, 0x10(%rax)
jmp 0x8697
movq 0x10(%rsp), %rdi
leaq 0xb260(%rip), %rsi      # 0x134b5
callq 0x9810
testb $0x1, %al
jne 0x8260
jmp 0x82dd
movq 0x18(%rsp), %rdi
callq 0x20a0
movq %rax, %rdi
leaq 0xb227(%rip), %rsi      # 0x1349b
leaq 0x28(%rsp), %rdx
movb $0x0, %al
callq 0x2190
cmpl $0x1, %eax
jne 0x8297
movl $0x1, %eax
cmpl 0x28(%rsp), %eax
jg 0x8297
cmpl $0x4, 0x28(%rsp)
jle 0x82ba
movl $0x4, %edi
callq 0x20d0
movq %rax, %rdi
movl $0xfffffffe, (%rdi)     # imm = 0xFFFFFFFE
movq 0x11d17(%rip), %rsi     # 0x19fc8
xorl %eax, %eax
movl %eax, %edx
callq 0x22f0
movq 0x20(%rsp), %rax
movl 0x28(%rsp), %ecx
subl $0x1, %ecx
shll $0x3, %ecx
orl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movl 0x10(%rax), %ecx
orl $0x20, %ecx
movl %ecx, 0x10(%rax)
jmp 0x8695
movq 0x10(%rsp), %rdi
leaq 0xb1d2(%rip), %rsi      # 0x134bb
callq 0x9810
testb $0x1, %al
jne 0x82f4
jmp 0x836a
movq 0x18(%rsp), %rdi
leaq 0xb1c0(%rip), %rsi      # 0x134c0
callq 0x9810
testb $0x1, %al
jne 0x830b
jmp 0x831b
movq 0x20(%rsp), %rax
movl 0xc(%rax), %ecx
orl $0x8, %ecx
movl %ecx, 0xc(%rax)
jmp 0x8357
movq 0x18(%rsp), %rdi
leaq 0xb1a2(%rip), %rsi      # 0x134c9
callq 0x9840
testb $0x1, %al
jne 0x8332
jmp 0x8355
movl $0x4, %edi
callq 0x20d0
movq %rax, %rdi
movl $0xfffffffe, (%rdi)     # imm = 0xFFFFFFFE
movq 0x11c7c(%rip), %rsi     # 0x19fc8
xorl %eax, %eax
movl %eax, %edx
callq 0x22f0
jmp 0x8357
movq 0x20(%rsp), %rax
movl 0x10(%rax), %ecx
orl $0x40, %ecx
movl %ecx, 0x10(%rax)
jmp 0x8693
movq 0x10(%rsp), %rdi
leaq 0xb15b(%rip), %rsi      # 0x134d1
callq 0x9810
testb $0x1, %al
jne 0x8381
jmp 0x83e8
movq 0x18(%rsp), %rdi
leaq 0xb11d(%rip), %rsi      # 0x134aa
callq 0x9840
testb $0x1, %al
jne 0x8398
jmp 0x83d2
movq 0x18(%rsp), %rdi
leaq 0xb10b(%rip), %rsi      # 0x134af
callq 0x9840
testb $0x1, %al
jne 0x83af
jmp 0x83d2
movl $0x4, %edi
callq 0x20d0
movq %rax, %rdi
movl $0xfffffffe, (%rdi)     # imm = 0xFFFFFFFE
movq 0x11bff(%rip), %rsi     # 0x19fc8
xorl %eax, %eax
movl %eax, %edx
callq 0x22f0
movq 0x20(%rsp), %rax
movl 0x10(%rax), %ecx
orl $0x80, %ecx
movl %ecx, 0x10(%rax)
jmp 0x8691
movq 0x10(%rsp), %rdi
leaq 0xb081(%rip), %rsi      # 0x13475
callq 0x9810
testb $0x1, %al
jne 0x83ff
jmp 0x847d
movq 0x18(%rsp), %rdi
leaq 0xb0cd(%rip), %rsi      # 0x134d8
callq 0x9840
testb $0x1, %al
jne 0x8416
jmp 0x8467
movq 0x18(%rsp), %rdi
leaq 0xb0bb(%rip), %rsi      # 0x134dd
callq 0x9840
testb $0x1, %al
jne 0x842d
jmp 0x8467
movq 0x18(%rsp), %rdi
leaq 0xb0a9(%rip), %rsi      # 0x134e2
callq 0x9840
testb $0x1, %al
jne 0x8444
jmp 0x8467
movl $0x4, %edi
callq 0x20d0
movq %rax, %rdi
movl $0xfffffffe, (%rdi)     # imm = 0xFFFFFFFE
movq 0x11b6a(%rip), %rsi     # 0x19fc8
xorl %eax, %eax
movl %eax, %edx
callq 0x22f0
movq 0x20(%rsp), %rax
movl 0x10(%rax), %ecx
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x10(%rax)
jmp 0x868f
movq 0x10(%rsp), %rdi
leaq 0xaff1(%rip), %rsi      # 0x1347a
callq 0x9810
testb $0x1, %al
jne 0x8494
jmp 0x8512
movq 0x18(%rsp), %rdi
leaq 0xb038(%rip), %rsi      # 0x134d8
callq 0x9840
testb $0x1, %al
jne 0x84ab
jmp 0x84fc
movq 0x18(%rsp), %rdi
leaq 0xb026(%rip), %rsi      # 0x134dd
callq 0x9840
testb $0x1, %al
jne 0x84c2
jmp 0x84fc
movq 0x18(%rsp), %rdi
leaq 0xb014(%rip), %rsi      # 0x134e2
callq 0x9840
testb $0x1, %al
jne 0x84d9
jmp 0x84fc
movl $0x4, %edi
callq 0x20d0
movq %rax, %rdi
movl $0xfffffffe, (%rdi)     # imm = 0xFFFFFFFE
movq 0x11ad5(%rip), %rsi     # 0x19fc8
xorl %eax, %eax
movl %eax, %edx
callq 0x22f0
movq 0x20(%rsp), %rax
movl 0x10(%rax), %ecx
orl $0x200, %ecx            # imm = 0x200
movl %ecx, 0x10(%rax)
jmp 0x868d
movq 0x10(%rsp), %rdi
leaq 0xaf61(%rip), %rsi      # 0x1347f
callq 0x9810
testb $0x1, %al
jne 0x8529
jmp 0x85a7
movq 0x18(%rsp), %rdi
leaq 0xafa3(%rip), %rsi      # 0x134d8
callq 0x9840
testb $0x1, %al
jne 0x8540
jmp 0x8591
movq 0x18(%rsp), %rdi
leaq 0xaf91(%rip), %rsi      # 0x134dd
callq 0x9840
testb $0x1, %al
jne 0x8557
jmp 0x8591
movq 0x18(%rsp), %rdi
leaq 0xaf7f(%rip), %rsi      # 0x134e2
callq 0x9840
testb $0x1, %al
jne 0x856e
jmp 0x8591
movl $0x4, %edi
callq 0x20d0
movq %rax, %rdi
movl $0xfffffffe, (%rdi)     # imm = 0xFFFFFFFE
movq 0x11a40(%rip), %rsi     # 0x19fc8
xorl %eax, %eax
movl %eax, %edx
callq 0x22f0
movq 0x20(%rsp), %rax
movl 0x10(%rax), %ecx
orl $0x400, %ecx            # imm = 0x400
movl %ecx, 0x10(%rax)
jmp 0x868b
movq 0x10(%rsp), %rdi
leaq 0xaed2(%rip), %rsi      # 0x13485
callq 0x9810
testb $0x1, %al
jne 0x85be
jmp 0x8639
movq 0x18(%rsp), %rdi
leaq 0xaf0e(%rip), %rsi      # 0x134d8
callq 0x9840
testb $0x1, %al
jne 0x85d5
jmp 0x8626
movq 0x18(%rsp), %rdi
leaq 0xaefc(%rip), %rsi      # 0x134dd
callq 0x9840
testb $0x1, %al
jne 0x85ec
jmp 0x8626
movq 0x18(%rsp), %rdi
leaq 0xaeea(%rip), %rsi      # 0x134e2
callq 0x9840
testb $0x1, %al
jne 0x8603
jmp 0x8626
movl $0x4, %edi
callq 0x20d0
movq %rax, %rdi
movl $0xfffffffe, (%rdi)     # imm = 0xFFFFFFFE
movq 0x119ab(%rip), %rsi     # 0x19fc8
xorl %eax, %eax
movl %eax, %edx
callq 0x22f0
movq 0x20(%rsp), %rax
movl 0x10(%rax), %ecx
orl $0x800, %ecx            # imm = 0x800
movl %ecx, 0x10(%rax)
jmp 0x8689
movq 0x10(%rsp), %rdi
movq 0x1199b(%rip), %rax     # 0x19fe0
movq (%rax), %rax
movq %rax, (%rsp)
callq 0x20a0
movq (%rsp), %rdi
movq %rax, %rdx
leaq 0xae86(%rip), %rsi      # 0x134e5
movb $0x0, %al
callq 0x2290
movl $0x4, %edi
callq 0x20d0
movq %rax, %rdi
movl $0xfffffff9, (%rdi)     # imm = 0xFFFFFFF9
movq 0x11948(%rip), %rsi     # 0x19fc8
xorl %eax, %eax
movl %eax, %edx
callq 0x22f0
jmp 0x868b
jmp 0x868d
jmp 0x868f
jmp 0x8691
jmp 0x8693
jmp 0x8695
jmp 0x8697
jmp 0x8699
jmp 0x869b
jmp 0x869d
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)