// File: ksherlock[P]wdc-utils/link.cpp
// Function: expr_error(bool, expression const&, char const*)
inline void expr_error(bool fatal, const expression &e, const char *msg) {
	warnx("%s:%04x %s", sections[e.section].name.c_str(), e.offset, msg);

	// pretty-print the expression...
	bool underflow = false;

	struct pair { std::string name; int precedence = 0; };

	std::vector<pair> stack;

	int p;
	for (auto &x : e.stack) {
		auto tag = x.tag;
		switch(tag) {

			case OP_VAL: {
				p = 0;
				char buffer[6];
				snprintf(buffer, sizeof(buffer), "$%02x", x.value);
				stack.emplace_back(pair{buffer, p});
				break;
			}
			case OP_SYM: {
				p = 0;
				stack.emplace_back(pair{symbols[x.section].name, p});
				break;
			}
			case OP_LOC: {
				p = 0;
				std::string tmp = sections[x.section].name;
				if (x.value) {
					char buffer[6];
					snprintf(buffer, sizeof(buffer), "$%02x", x.value);
					tmp.push_back('+');
					tmp.append(buffer);
					p = 3;
				}
				stack.emplace_back(pair{tmp, p});
				break;
			}

			case OP_NOT:
			case OP_NEG:
			case OP_FLP: {
				static const std::string ops[] = {
					".NOT.", "-", "\\"
				};
				p = 0;
				if (stack.empty()) {
					underflow = true;
				} else {
					auto &back = stack.back();
					if (p < back.precedence) {
						back.name = parenthesize(back.name);
					}
					back.name = ops[tag - OP_UNA] + back.name;
					back.precedence = p;
				}
				break;
			}

			case OP_EXP:
			case OP_MUL:
			case OP_DIV:
			case OP_MOD:
			case OP_SHR:
			case OP_SHL:
			case OP_ADD:
			case OP_SUB:
			case OP_AND:
			case OP_OR:
			case OP_XOR:
			case OP_EQ:
			case OP_GT:
			case OP_LT:
			case OP_UGT:
			case OP_ULT: {
				static const pair ops[] = {
					{ "**", 1 },
					{ "*", 2 },
					{ "/", 2 },
					{ ".MOD.", 2 },
					{ ">>", 2 },
					{ "<<", 2 },
					{ "+", 3 },
					{ "-", 3 },
					{ "&", 4 },
					{ "|", 5 },
					{ "^", 5 },
					{ "=", 6 },
					{ ">",  6},
					{ "<",  6},
					{ ".UGT.",  6},
					{ ".ULT.", 6 }
				};


				p = ops[tag - OP_BIN].precedence;
				if (stack.size() < 2) {
					underflow = true;
				} else {
					pair b = std::move(stack.back());
					stack.pop_back();
					pair &a = stack.back();

					if (p < b.precedence) b.name = parenthesize(b.name);
					if (p < a.precedence) a.name = parenthesize(a.name);

					a.name += ops[tag - OP_BIN].name + b.name;
					a.precedence = p;
				}
				break;
			}
			default:
				fprintf(stderr, "Unrecognized expression op %02x\n", tag);
				break;
		}

	}
	if (stack.size() == 1) {
		fprintf(stderr, "Expression: %s\n", stack.front().name.c_str());
	} else if (stack.empty() || underflow) {
		fprintf(stderr, "Expression underflow error.\n");
		fatal = true;
	} else {
		fprintf(stderr, "Expression overflow error.\n");
		fatal = true;
	}

	if (fatal) flags.errors++;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3a0, %rsp            # imm = 0x3A0
movb %dil, %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, %esi
leaq 0x347a6(%rip), %rdi     # 0x3f3e0
callq 0xa1c0
movq %rax, %rdi
callq 0x3130
movq %rax, %rsi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
movq -0x18(%rbp), %rcx
leaq 0x20ceb(%rip), %rdi     # 0x2b947
movb $0x0, %al
callq 0x3360
movb $0x0, -0x19(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xec90
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0xecb0
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdi
callq 0xece0
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0xed10
testb $0x1, %al
jne 0xacac
jmp 0xbc8e
leaq -0x50(%rbp), %rdi
callq 0xed50
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x238(%rbp)
subl $0x22, %eax
ja 0xbc63
movq -0x238(%rbp), %rax
leaq 0x204dd(%rip), %rcx     # 0x2b1c4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x0, -0x3c(%rbp)
movq -0x60(%rbp), %rax
movl 0x4(%rax), %ecx
leaq 0x20c4d(%rip), %rdx     # 0x2b952
xorl %eax, %eax
leaq -0x6a(%rbp), %rdi
movq %rdi, -0x248(%rbp)
movl $0x6, %esi
callq 0x34d0
leaq -0x99(%rbp), %rdi
movq %rdi, -0x240(%rbp)
callq 0x3550
movq -0x248(%rbp), %rsi
movq -0x240(%rbp), %rdx
leaq -0x98(%rbp), %rdi
callq 0xbea0
jmp 0xad4b
movl -0x3c(%rbp), %eax
movl %eax, -0x78(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0xed70
jmp 0xad63
leaq -0x98(%rbp), %rdi
callq 0xedf0
leaq -0x99(%rbp), %rdi
callq 0x3370
jmp 0xbc7e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xadb2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x98(%rbp), %rdi
callq 0xedf0
leaq -0x99(%rbp), %rdi
callq 0x3370
jmp 0xbd4f
movl $0x0, -0x3c(%rbp)
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, %esi
leaq 0x34656(%rip), %rdi     # 0x3f430
callq 0x9fb0
movq %rax, %rsi
leaq -0xd8(%rbp), %rdi
callq 0x3140
jmp 0xadf0
movl -0x3c(%rbp), %eax
movl %eax, -0xb8(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0xed70
jmp 0xae0b
leaq -0xd8(%rbp), %rdi
callq 0xedf0
jmp 0xbc7e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xbd4f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0xedf0
jmp 0xbd4f
movl $0x0, -0x3c(%rbp)
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, %esi
leaq 0x34573(%rip), %rdi     # 0x3f3e0
callq 0xa1c0
movq %rax, %rsi
leaq -0xf8(%rbp), %rdi
callq 0x3140
jmp 0xae83
movq -0x60(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0xaef3
movq -0x60(%rbp), %rax
movl 0x4(%rax), %ecx
leaq 0x20ab7(%rip), %rdx     # 0x2b952
xorl %eax, %eax
leaq -0xfe(%rbp), %rdi
movl $0x6, %esi
callq 0x34d0
leaq -0xf8(%rbp), %rdi
movl $0x2b, %esi
callq 0x32d0
jmp 0xaec1
leaq -0xf8(%rbp), %rdi
leaq -0xfe(%rbp), %rsi
callq 0x35d0
jmp 0xaed6
movl $0x3, -0x3c(%rbp)
jmp 0xaef3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xaf5e
leaq -0x128(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x3140
jmp 0xaf08
movl -0x3c(%rbp), %eax
movl %eax, -0x108(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0xed70
jmp 0xaf23
leaq -0x128(%rbp), %rdi
callq 0xedf0
leaq -0xf8(%rbp), %rdi
callq 0x31f0
jmp 0xbc7e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x128(%rbp), %rdi
callq 0xedf0
leaq -0xf8(%rbp), %rdi
callq 0x31f0
jmp 0xbd4f
cmpb $0x0, 0x346ca(%rip)     # 0x3f640
jne 0xb0b2
leaq 0x346bd(%rip), %rdi     # 0x3f640
callq 0x3580
cmpl $0x0, %eax
je 0xb0b2
movb $0x1, -0x134(%rbp)
leaq 0x34641(%rip), %rax     # 0x3f5e0
movq %rax, -0x258(%rbp)
movq %rax, -0x130(%rbp)
leaq -0x131(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0x3550
movq -0x258(%rbp), %rdi
movq -0x250(%rbp), %rdx
leaq 0x20983(%rip), %rsi     # 0x2b958
callq 0xbea0
jmp 0xafdc
leaq 0x3461d(%rip), %rax     # 0x3f600
movq %rax, -0x268(%rbp)
movq %rax, -0x130(%rbp)
leaq -0x132(%rbp), %rdi
movq %rdi, -0x260(%rbp)
callq 0x3550
movq -0x268(%rbp), %rdi
movq -0x260(%rbp), %rdx
leaq 0x20945(%rip), %rsi     # 0x2b95e
callq 0xbea0
jmp 0xb020
leaq 0x345f9(%rip), %rax     # 0x3f620
movq %rax, -0x278(%rbp)
movq %rax, -0x130(%rbp)
leaq -0x133(%rbp), %rdi
movq %rdi, -0x270(%rbp)
callq 0x3550
movq -0x278(%rbp), %rdi
movq -0x270(%rbp), %rdx
leaq 0x20903(%rip), %rsi     # 0x2b960
callq 0xbea0
jmp 0xb064
movb $0x0, -0x134(%rbp)
leaq -0x133(%rbp), %rdi
callq 0x3370
leaq -0x132(%rbp), %rdi
callq 0x3370
leaq -0x131(%rbp), %rdi
callq 0x3370
leaq -0x78c6(%rip), %rdi     # 0x37d0
xorl %eax, %eax
movl %eax, %esi
leaq 0x34277(%rip), %rdx     # 0x3f318
callq 0x32f0
leaq 0x34593(%rip), %rdi     # 0x3f640
callq 0x3210
movl $0x0, -0x3c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xee10
testb $0x1, %al
jne 0xb0cb
jmp 0xb19b
movb $0x1, -0x19(%rbp)
jmp 0xb245
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xb126
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xb11a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x133(%rbp), %rdi
callq 0x3370
leaq -0x132(%rbp), %rdi
callq 0x3370
leaq -0x131(%rbp), %rdi
callq 0x3370
testb $0x1, -0x134(%rbp)
jne 0xb13d
jmp 0xb18a
movq -0x130(%rbp), %rax
leaq 0x34495(%rip), %rcx     # 0x3f5e0
cmpq %rax, %rcx
movq %rax, -0x280(%rbp)
je 0xb188
movq -0x280(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x288(%rbp)
callq 0x31f0
movq -0x288(%rbp), %rax
leaq 0x34464(%rip), %rcx     # 0x3f5e0
cmpq %rcx, %rax
movq %rax, -0x280(%rbp)
jne 0xb157
jmp 0xb18a
leaq 0x344af(%rip), %rdi     # 0x3f640
callq 0x3200
jmp 0xbd4f
leaq -0x38(%rbp), %rdi
callq 0xee50
movq %rax, -0x140(%rbp)
movl -0x3c(%rbp), %eax
movq -0x140(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jge 0xb1ee
movq -0x140(%rbp), %rsi
leaq -0x160(%rbp), %rdi
callq 0xee90
jmp 0xb1cf
movq -0x140(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x33f0
leaq -0x160(%rbp), %rdi
callq 0x31f0
movl -0x64(%rbp), %eax
addl $-0xa, %eax
cltq
shlq $0x5, %rax
leaq 0x343df(%rip), %rsi     # 0x3f5e0
addq %rax, %rsi
movq -0x140(%rbp), %rdx
leaq -0x180(%rbp), %rdi
callq 0xd330
jmp 0xb219
movq -0x140(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x33f0
leaq -0x180(%rbp), %rdi
callq 0x31f0
movl -0x3c(%rbp), %ecx
movq -0x140(%rbp), %rax
movl %ecx, 0x20(%rax)
jmp 0xbc7e
cmpb $0x0, 0x3467f(%rip)     # 0x3f8d0
jne 0xb83d
leaq 0x34672(%rip), %rdi     # 0x3f8d0
callq 0x3580
cmpl $0x0, %eax
je 0xb83d
movb $0x1, -0x199(%rbp)
leaq 0x343d6(%rip), %rax     # 0x3f650
movq %rax, -0x298(%rbp)
movq %rax, -0x188(%rbp)
leaq -0x189(%rbp), %rdi
movq %rdi, -0x290(%rbp)
callq 0x3550
movq -0x298(%rbp), %rdi
movq -0x290(%rbp), %rdx
leaq 0x206b2(%rip), %rsi     # 0x2b962
callq 0xbea0
jmp 0xb2b7
movl $0x1, 0x343af(%rip)     # 0x3f670
leaq 0x343b0(%rip), %rax     # 0x3f678
movq %rax, -0x2a8(%rbp)
movq %rax, -0x188(%rbp)
leaq -0x18a(%rbp), %rdi
movq %rdi, -0x2a0(%rbp)
callq 0x3550
movq -0x2a8(%rbp), %rdi
movq -0x2a0(%rbp), %rdx
leaq 0x20665(%rip), %rsi     # 0x2b963
callq 0xbea0
jmp 0xb305
movl $0x2, 0x34389(%rip)     # 0x3f698
leaq 0x3438a(%rip), %rax     # 0x3f6a0
movq %rax, -0x2b8(%rbp)
movq %rax, -0x188(%rbp)
leaq -0x18b(%rbp), %rdi
movq %rdi, -0x2b0(%rbp)
callq 0x3550
movq -0x2b8(%rbp), %rdi
movq -0x2b0(%rbp), %rdx
leaq 0x20619(%rip), %rsi     # 0x2b965
callq 0xbea0
jmp 0xb353
movl $0x2, 0x34363(%rip)     # 0x3f6c0
leaq 0x34364(%rip), %rax     # 0x3f6c8
movq %rax, -0x2c8(%rbp)
movq %rax, -0x188(%rbp)
leaq -0x18c(%rbp), %rdi
movq %rdi, -0x2c0(%rbp)
callq 0x3550
movq -0x2c8(%rbp), %rdi
movq -0x2c0(%rbp), %rdx
leaq 0x205cd(%rip), %rsi     # 0x2b967
callq 0xbea0
jmp 0xb3a1
movl $0x2, 0x3433d(%rip)     # 0x3f6e8
leaq 0x3433e(%rip), %rax     # 0x3f6f0
movq %rax, -0x2d8(%rbp)
movq %rax, -0x188(%rbp)
leaq -0x18d(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
callq 0x3550
movq -0x2d8(%rbp), %rdi
movq -0x2d0(%rbp), %rdx
leaq 0x20585(%rip), %rsi     # 0x2b96d
callq 0xbea0
jmp 0xb3ef
movl $0x2, 0x34317(%rip)     # 0x3f710
leaq 0x34318(%rip), %rax     # 0x3f718
movq %rax, -0x2e8(%rbp)
movq %rax, -0x188(%rbp)
leaq -0x18e(%rbp), %rdi
movq %rdi, -0x2e0(%rbp)
callq 0x3550
movq -0x2e8(%rbp), %rdi
movq -0x2e0(%rbp), %rdx
leaq 0x2053a(%rip), %rsi     # 0x2b970
callq 0xbea0
jmp 0xb43d
movl $0x2, 0x342f1(%rip)     # 0x3f738
leaq 0x342f2(%rip), %rax     # 0x3f740
movq %rax, -0x2f8(%rbp)
movq %rax, -0x188(%rbp)
leaq -0x18f(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
callq 0x3550
movq -0x2f8(%rbp), %rdi
movq -0x2f0(%rbp), %rdx
leaq 0x204ef(%rip), %rsi     # 0x2b973
callq 0xbea0
jmp 0xb48b
movl $0x3, 0x342cb(%rip)     # 0x3f760
leaq 0x342cc(%rip), %rax     # 0x3f768
movq %rax, -0x308(%rbp)
movq %rax, -0x188(%rbp)
leaq -0x190(%rbp), %rdi
movq %rdi, -0x300(%rbp)
callq 0x3550
movq -0x308(%rbp), %rdi
movq -0x300(%rbp), %rdx
leaq 0x2048c(%rip), %rsi     # 0x2b95e
callq 0xbea0
jmp 0xb4d9
movl $0x3, 0x342a5(%rip)     # 0x3f788
leaq 0x342a6(%rip), %rax     # 0x3f790
movq %rax, -0x318(%rbp)
movq %rax, -0x188(%rbp)
leaq -0x191(%rbp), %rdi
movq %rdi, -0x310(%rbp)
callq 0x3550
movq -0x318(%rbp), %rdi
movq -0x310(%rbp), %rdx
leaq 0x20455(%rip), %rsi     # 0x2b975
callq 0xbea0
jmp 0xb527
movl $0x4, 0x3427f(%rip)     # 0x3f7b0
leaq 0x34280(%rip), %rax     # 0x3f7b8
movq %rax, -0x328(%rbp)
movq %rax, -0x188(%rbp)
leaq -0x192(%rbp), %rdi
movq %rdi, -0x320(%rbp)
callq 0x3550
movq -0x328(%rbp), %rdi
movq -0x320(%rbp), %rdx
leaq 0x20409(%rip), %rsi     # 0x2b977
callq 0xbea0
jmp 0xb575
movl $0x5, 0x34259(%rip)     # 0x3f7d8
leaq 0x3425a(%rip), %rax     # 0x3f7e0
movq %rax, -0x338(%rbp)
movq %rax, -0x188(%rbp)
leaq -0x193(%rbp), %rdi
movq %rdi, -0x330(%rbp)
callq 0x3550
movq -0x338(%rbp), %rdi
movq -0x330(%rbp), %rdx
leaq 0x203bd(%rip), %rsi     # 0x2b979
callq 0xbea0
jmp 0xb5c3
movl $0x5, 0x34233(%rip)     # 0x3f800
leaq 0x34234(%rip), %rax     # 0x3f808
movq %rax, -0x348(%rbp)
movq %rax, -0x188(%rbp)
leaq -0x194(%rbp), %rdi
movq %rdi, -0x340(%rbp)
callq 0x3550
movq -0x348(%rbp), %rdi
movq -0x340(%rbp), %rdx
leaq 0x20371(%rip), %rsi     # 0x2b97b
callq 0xbea0
jmp 0xb611
movl $0x6, 0x3420d(%rip)     # 0x3f828
leaq 0x3420e(%rip), %rax     # 0x3f830
movq %rax, -0x358(%rbp)
movq %rax, -0x188(%rbp)
leaq -0x195(%rbp), %rdi
movq %rdi, -0x350(%rbp)
callq 0x3550
movq -0x358(%rbp), %rdi
movq -0x350(%rbp), %rdx
leaq 0x20316(%rip), %rsi     # 0x2b96e
callq 0xbea0
jmp 0xb65f
movl $0x6, 0x341e7(%rip)     # 0x3f850
leaq 0x341e8(%rip), %rax     # 0x3f858
movq %rax, -0x368(%rbp)
movq %rax, -0x188(%rbp)
leaq -0x196(%rbp), %rdi
movq %rdi, -0x360(%rbp)
callq 0x3550
movq -0x368(%rbp), %rdi
movq -0x360(%rbp), %rdx
leaq 0x202cb(%rip), %rsi     # 0x2b971
callq 0xbea0
jmp 0xb6ad
movl $0x6, 0x341c1(%rip)     # 0x3f878
leaq 0x341c2(%rip), %rax     # 0x3f880
movq %rax, -0x378(%rbp)
movq %rax, -0x188(%rbp)
leaq -0x197(%rbp), %rdi
movq %rdi, -0x370(%rbp)
callq 0x3550
movq -0x378(%rbp), %rdi
movq -0x370(%rbp), %rdx
leaq 0x20289(%rip), %rsi     # 0x2b97d
callq 0xbea0
jmp 0xb6fb
movl $0x6, 0x3419b(%rip)     # 0x3f8a0
leaq 0x3419c(%rip), %rax     # 0x3f8a8
movq %rax, -0x388(%rbp)
movq %rax, -0x188(%rbp)
leaq -0x198(%rbp), %rdi
movq %rdi, -0x380(%rbp)
callq 0x3550
movq -0x388(%rbp), %rdi
movq -0x380(%rbp), %rdx
leaq 0x20241(%rip), %rsi     # 0x2b983
callq 0xbea0
jmp 0xb749
movl $0x6, 0x34175(%rip)     # 0x3f8c8
movb $0x0, -0x199(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x3370
leaq -0x197(%rbp), %rdi
callq 0x3370
leaq -0x196(%rbp), %rdi
callq 0x3370
leaq -0x195(%rbp), %rdi
callq 0x3370
leaq -0x194(%rbp), %rdi
callq 0x3370
leaq -0x193(%rbp), %rdi
callq 0x3370
leaq -0x192(%rbp), %rdi
callq 0x3370
leaq -0x191(%rbp), %rdi
callq 0x3370
leaq -0x190(%rbp), %rdi
callq 0x3370
leaq -0x18f(%rbp), %rdi
callq 0x3370
leaq -0x18e(%rbp), %rdi
callq 0x3370
leaq -0x18d(%rbp), %rdi
callq 0x3370
leaq -0x18c(%rbp), %rdi
callq 0x3370
leaq -0x18b(%rbp), %rdi
callq 0x3370
leaq -0x18a(%rbp), %rdi
callq 0x3370
leaq -0x189(%rbp), %rdi
callq 0x3370
leaq -0x8001(%rip), %rdi     # 0x3820
xorl %eax, %eax
movl %eax, %esi
leaq 0x33aec(%rip), %rdx     # 0x3f318
callq 0x32f0
leaq 0x34098(%rip), %rdi     # 0x3f8d0
callq 0x3210
movl -0x64(%rbp), %eax
subl $0x14, %eax
movslq %eax, %rcx
leaq 0x33e03(%rip), %rax     # 0x3f650
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x20(%rax), %eax
movl %eax, -0x3c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xef30
cmpq $0x2, %rax
jae 0xbafe
movb $0x1, -0x19(%rbp)
jmp 0xbc61
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xba89
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xba7d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xba71
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xba65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xba59
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xba4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xba41
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xba35
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xba29
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xba1d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xba11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xba05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xb9f9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xb9ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xb9e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x3370
leaq -0x197(%rbp), %rdi
callq 0x3370
leaq -0x196(%rbp), %rdi
callq 0x3370
leaq -0x195(%rbp), %rdi
callq 0x3370
leaq -0x194(%rbp), %rdi
callq 0x3370
leaq -0x193(%rbp), %rdi
callq 0x3370
leaq -0x192(%rbp), %rdi
callq 0x3370
leaq -0x191(%rbp), %rdi
callq 0x3370
leaq -0x190(%rbp), %rdi
callq 0x3370
leaq -0x18f(%rbp), %rdi
callq 0x3370
leaq -0x18e(%rbp), %rdi
callq 0x3370
leaq -0x18d(%rbp), %rdi
callq 0x3370
leaq -0x18c(%rbp), %rdi
callq 0x3370
leaq -0x18b(%rbp), %rdi
callq 0x3370
leaq -0x18a(%rbp), %rdi
callq 0x3370
leaq -0x189(%rbp), %rdi
callq 0x3370
testb $0x1, -0x199(%rbp)
jne 0xbaa0
jmp 0xbaed
movq -0x188(%rbp), %rax
leaq 0x33ba2(%rip), %rcx     # 0x3f650
cmpq %rax, %rcx
movq %rax, -0x390(%rbp)
je 0xbaeb
movq -0x390(%rbp), %rdi
addq $-0x28, %rdi
movq %rdi, -0x398(%rbp)
callq 0xedf0
movq -0x398(%rbp), %rax
leaq 0x33b71(%rip), %rcx     # 0x3f650
cmpq %rcx, %rax
movq %rax, -0x390(%rbp)
jne 0xbaba
jmp 0xbaed
leaq 0x33ddc(%rip), %rdi     # 0x3f8d0
callq 0x3200
jmp 0xbd4f
leaq -0x38(%rbp), %rdi
callq 0xee50
movq %rax, %rsi
leaq -0x1c8(%rbp), %rdi
callq 0xef60
leaq -0x38(%rbp), %rdi
callq 0xefa0
leaq -0x38(%rbp), %rdi
callq 0xee50
movq %rax, -0x1d0(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x1a8(%rbp), %eax
jge 0xbb87
leaq -0x1f0(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0xee90
jmp 0xbb4f
leaq -0x1c8(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x33f0
leaq -0x1f0(%rbp), %rdi
callq 0x31f0
jmp 0xbb87
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xbc50
movl -0x3c(%rbp), %eax
movq -0x1d0(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jge 0xbbca
movq -0x1d0(%rbp), %rsi
leaq -0x210(%rbp), %rdi
callq 0xee90
jmp 0xbbab
movq -0x1d0(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x33f0
leaq -0x210(%rbp), %rdi
callq 0x31f0
movl -0x64(%rbp), %eax
addl $-0x14, %eax
cltq
leaq (%rax,%rax,4), %rcx
leaq 0x33a73(%rip), %rax     # 0x3f650
leaq (%rax,%rcx,8), %rsi
leaq -0x230(%rbp), %rdi
leaq -0x1c8(%rbp), %rdx
callq 0xd330
jmp 0xbbf6
movq -0x1d0(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x3410
jmp 0xbc0b
leaq -0x230(%rbp), %rdi
callq 0x31f0
movl -0x3c(%rbp), %ecx
movq -0x1d0(%rbp), %rax
movl %ecx, 0x20(%rax)
leaq -0x1c8(%rbp), %rdi
callq 0xedf0
jmp 0xbc61
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x31f0
leaq -0x1c8(%rbp), %rdi
callq 0xedf0
jmp 0xbd4f
jmp 0xbc7e
movq 0x33366(%rip), %rax     # 0x3efd0
movq (%rax), %rdi
movl -0x64(%rbp), %edx
leaq 0x1fd12(%rip), %rsi     # 0x2b989
movb $0x0, %al
callq 0x3470
jmp 0xbc80
leaq -0x50(%rbp), %rdi
callq 0xefd0
jmp 0xac96
leaq -0x38(%rbp), %rdi
callq 0xef30
cmpq $0x1, %rax
jne 0xbcd9
movq 0x3332c(%rip), %rax     # 0x3efd0
movq (%rax), %rax
movq %rax, -0x3a0(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xeff0
movq %rax, %rdi
callq 0x3130
movq -0x3a0(%rbp), %rdi
movq %rax, %rdx
leaq 0x1fcda(%rip), %rsi     # 0x2b9aa
movb $0x0, %al
callq 0x3470
jmp 0xbd28
leaq -0x38(%rbp), %rdi
callq 0xee10
testb $0x1, %al
jne 0xbcec
testb $0x1, -0x19(%rbp)
je 0xbd0a
movq 0x332dd(%rip), %rax     # 0x3efd0
movq (%rax), %rdi
leaq 0x1fcbd(%rip), %rsi     # 0x2b9ba
movb $0x0, %al
callq 0x3470
movb $0x1, -0x1(%rbp)
jmp 0xbd26
movq 0x332bf(%rip), %rax     # 0x3efd0
movq (%rax), %rdi
leaq 0x1fcbc(%rip), %rsi     # 0x2b9d7
movb $0x0, %al
callq 0x3470
movb $0x1, -0x1(%rbp)
jmp 0xbd28
testb $0x1, -0x1(%rbp)
je 0xbd3d
movl 0x33664(%rip), %eax     # 0x3f398
addl $0x1, %eax
movl %eax, 0x3365b(%rip)     # 0x3f398
leaq -0x38(%rbp), %rdi
callq 0xf020
addq $0x3a0, %rsp            # imm = 0x3A0
popq %rbp
retq
leaq -0x38(%rbp), %rdi
callq 0xf020
movq -0xa8(%rbp), %rdi
callq 0x3540
nopw %cs:(%rax,%rax)
nop