// File: /workspace/github_cpp_makefile_star2_O2/JohnCGriffin[P]BrainForked/bf_optimizations.cpp
// Function: bf::optimizations(std::vector<bf::Instruction, std::allocator<bf::Instruction>> const&, bool)
Instructions optimizations(const Instructions& instrs, bool take_second_pass)
    {
	Instructions result;
	const int sz = instrs.size();

	for(int i=0; i<sz; i++){

#define AT(x) instrs.at(i+x)
#define VAL(x) instrs.at(i+x).val


	    auto pattern  = [&](Actions actions){ return matches(instrs, i, actions); };


	    //////////////////////////////////////////////
	    // The following block contains optimizations
	    // for non-terminals, available in pass two.
	    //////////////////////////////////////////////

	    {
		if(pattern({ZERO, MOVE}) && VAL(1) == 1){
		    result.push_back({ ZEROM1 });
		    i++;
		    continue;
		}

		if(pattern({MOVE, ZERO}) && VAL(0) == 1){
		    result.push_back({ M1ZERO });
		    i++;
		    continue;
		}

		if(pattern({FALSEJUMP, MOVE, ZERO, MXDECR1, TRUEJUMP }) &&
		   VAL(1) == 1 && VAL(3) == -1){
		    result.push_back({ZERO2IF});
		    i+=4;
		    continue;
		}

		if(pattern({ MOVE, GIVE, MOVE}) &&
		   VAL(2) == VAL(1) &&
		   VAL(0) == -VAL(2)){
		    result.push_back({ TAKE, VAL(0) });
		    i+=2;
		    continue;
		}

		if(pattern({FALSEJUMP, MOVE, GIVE, MOVE, TRUEJUMP})){
		    result.push_back({VALUE, VAL(1) });
		    result.push_back({VALUE, VAL(2) });
		    result.push_back({WHILEMGM, VAL(3) });
		    i += 4;
		    continue;
		}

		if(pattern({DECR1MX, GIVE, MOVE}) &&
		   VAL(0) == -VAL(1) && VAL(0) == -VAL(2)){
		    result.push_back({INCR, -1});
		    result.push_back({TAKE, VAL(0)});
		    i += 2;
		    continue;
		}

		if(pattern({ADVANCE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, WHILEIM3}) &&
		   VAL(1) == -1 && VAL(3) ==1 && VAL(5) == 1 && (VAL(2) + VAL(4) + VAL(6) == 0)){
		    result.push_back({VALUE, VAL(2)});
		    result.push_back({VALUE, (short) (VAL(4)+VAL(2))});
		    result.push_back({WHILEDECROI2});
		    i += 7;
		    continue;
		}
	    }


	    ///////////////////////////////////////////////////
	    //	All that follow are primitives for first pass.
	    //////////////////////////////////////////////////
	    {
		// subtract value from current cell and add it to another cell
		if(pattern({ FALSEJUMP, INCR, MOVE, INCR, MOVE, TRUEJUMP }) &&
		   VAL(1) == -1 && VAL(3) == 1 && VAL(2) == -VAL(4)){
		    result.push_back( { GIVE, VAL(2) } );
		    i += 5;
		    continue;
		}

		// alternate version decrements last
		// subtract value from current cell and add it to another cell
		if(pattern({ FALSEJUMP, MOVE, INCR, MOVE, INCR, TRUEJUMP }) &&
		   VAL(2) == 1 && VAL(4) == -1 && VAL(1) == -VAL(3)){
		    result.push_back( { GIVE, VAL(1) });
		    i += 5;
		    continue;
		}

		// [+>-<<<---->>>>>]
		if(pattern({ FALSEJUMP, INCR, MOVE, INCR, MOVE, INCR, MOVE, TRUEJUMP})){
		    result.push_back({ ADVANCE, 6 });
		    for(int j=0; j<6; j++){
			result.push_back({ VALUE, VAL(j+1) });
		    }
		    result.push_back({ WHILEIM3 });
		    i += 7;
		    continue;
		}

		// [+>-<]
		if(pattern({ FALSEJUMP, INCR, MOVE, INCR, MOVE, TRUEJUMP})){
		    result.push_back({ ADVANCE, 4 });
		    for(int j=0; j<4; j++){
			result.push_back({ VALUE, VAL(j+1) });
		    }
		    result.push_back({ WHILEIM2 });
		    i += 5;
		    continue;
		}

		// >>+++<<
		if(pattern({ MOVE, INCR, MOVE}) && AT(0).val == -AT(2).val){
		    result.push_back({VALUE, VAL(0)});
		    result.push_back({OFFINCR, VAL(1)});
		    i+=2;
		    continue;
		}

		if(pattern({ INCR, MOVE}) && VAL(0) == -1){
		    result.push_back({ DECR1MX, VAL(1) });
		    i++;
		    continue;
		}

		if(pattern({ INCR, MOVE}) && VAL(0) == 1){
		    result.push_back({ INCR1MX, VAL(1) });
		    i++;
		    continue;
		}

		if(pattern({ MOVE, INCR }) && VAL(1) == 1){
		    result.push_back({ MXINCR1, VAL(0) });
		    i++;
		    continue;
		}

		if(pattern({ MOVE, INCR }) && VAL(1) == -1){
		    result.push_back({ MXDECR1, VAL(0) });
		    i++;
		    continue;
		}

		// [-]
		if(pattern({ FALSEJUMP, INCR, TRUEJUMP })){
		    while(result.back().action == ZERO || result.back().action == INCR){
			result.pop_back();
		    }
		    result.push_back({ ZERO });
		    i+=2;
		    continue;
		}

		// move while, e.g. [<<<]
		if(pattern({ FALSEJUMP, MOVE, TRUEJUMP })){
		    result.push_back({ MOVEWHILE, VAL(1) });
		    i += 2;
		    continue;
		}
	    }

	    result.push_back(instrs.at(i));
	}

	if(take_second_pass){
	    result = optimizations(result,false);
	}

	return result;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, 0x44(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movq 0x8(%rsi), %r15
subq (%rsi), %r15
shrq $0x4, %r15
xorl %eax, %eax
leaq 0x10(%rsp), %r12
pushq $0x2
popq %r13
movl %eax, 0xc(%rsp)
cmpl %r15d, %eax
jge 0x4e0f
movq %r14, 0x30(%rsp)
leaq 0xc(%rsp), %rax
movq %rax, 0x38(%rsp)
movabsq $0x700000016, %rax      # imm = 0x700000016
movq %rax, 0x10(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4ec0
testb %al, %al
je 0x4298
movslq 0xc(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x4f30
cmpw $0x1, 0x4(%rax)
jne 0x4298
movl $0x18, 0x10(%rsp)
andw $0x0, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
jmp 0x42ee
movabsq $0x1600000007, %rax     # imm = 0x1600000007
movq %rax, 0x10(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4ec0
testb %al, %al
je 0x42f9
movslq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x4f30
cmpw $0x1, 0x4(%rax)
jne 0x42f9
movl $0x6, 0x10(%rsp)
andw $0x0, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
movl 0xc(%rsp), %eax
incl %eax
jmp 0x4db2
movups 0x1ffc(%rip), %xmm0     # 0x62fc
movaps %xmm0, 0x10(%rsp)
movl $0x10, 0x20(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
pushq $0x5
popq %rdx
callq 0x4ec0
testb %al, %al
je 0x4354
movslq 0xc(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x4f30
cmpw $0x1, 0x4(%rax)
jne 0x4354
movslq 0xc(%rsp), %rsi
addq $0x3, %rsi
movq %r14, %rdi
callq 0x4f30
cmpw $-0x1, 0x4(%rax)
je 0x4a37
movq %r13, %rbp
movabsq $0x300000007, %rax      # imm = 0x300000007
movq %rax, 0x10(%rsp)
movl $0x7, 0x18(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
pushq $0x3
popq %rdx
callq 0x4ec0
testb %al, %al
je 0x4416
movslq 0xc(%rsp), %rsi
addq $0x2, %rsi
movq %r14, %rdi
callq 0x4f30
movzwl 0x4(%rax), %r13d
movslq 0xc(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x4f30
cmpw 0x4(%rax), %r13w
jne 0x4416
movslq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x4f30
movswl 0x4(%rax), %r13d
movslq 0xc(%rsp), %rsi
addq $0x2, %rsi
movq %r14, %rdi
callq 0x4f30
movswl 0x4(%rax), %eax
addl %eax, %r13d
jne 0x4416
movl $0xe, 0x10(%rsp)
movslq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x4f30
movq %rbp, %r13
movzwl 0x4(%rax), %eax
movw %ax, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
jmp 0x4dab
movups 0x1ef3(%rip), %xmm0     # 0x6310
movaps %xmm0, 0x10(%rsp)
movl $0x10, 0x20(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
pushq $0x5
popq %rdx
callq 0x4ec0
testb %al, %al
je 0x44e9
movq %rbp, %r13
movl $0x11, 0x10(%rsp)
movslq 0xc(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x4f30
movzwl 0x4(%rax), %eax
movw %ax, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
movl $0x11, 0x10(%rsp)
movslq 0xc(%rsp), %rsi
addq $0x2, %rsi
movq %r14, %rdi
callq 0x4f30
movzwl 0x4(%rax), %eax
movw %ax, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
movl $0x15, 0x10(%rsp)
movslq 0xc(%rsp), %rsi
addq $0x3, %rsi
movq %r14, %rdi
callq 0x4f30
movzwl 0x4(%rax), %eax
movw %ax, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
movl 0xc(%rsp), %eax
addl $0x4, %eax
jmp 0x4db2
movabsq $0x300000001, %rax      # imm = 0x300000001
movq %rax, 0x10(%rsp)
movl $0x7, 0x18(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
pushq $0x3
popq %rdx
callq 0x4ec0
testb %al, %al
je 0x45c9
movslq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x4f30
movswl 0x4(%rax), %r13d
movslq 0xc(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x4f30
movswl 0x4(%rax), %eax
addl %eax, %r13d
jne 0x45c9
movslq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x4f30
movswl 0x4(%rax), %r13d
movslq 0xc(%rsp), %rsi
addq $0x2, %rsi
movq %r14, %rdi
callq 0x4f30
movswl 0x4(%rax), %eax
addl %eax, %r13d
jne 0x45c9
movl $0x4, 0x10(%rsp)
orw $-0x1, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
movq %rbp, %r13
movl $0xe, 0x10(%rsp)
movslq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x4f30
movzwl 0x4(%rax), %eax
movw %ax, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
jmp 0x4dab
movups 0x1d94(%rip), %xmm0     # 0x6364
movaps %xmm0, 0x20(%rsp)
movups 0x1d78(%rip), %xmm0     # 0x6354
movaps %xmm0, 0x10(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
pushq $0x8
popq %rdx
callq 0x4ec0
testb %al, %al
je 0x4740
movslq 0xc(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x4f30
cmpw $-0x1, 0x4(%rax)
jne 0x4740
movslq 0xc(%rsp), %rsi
addq $0x3, %rsi
movq %r14, %rdi
callq 0x4f30
cmpw $0x1, 0x4(%rax)
jne 0x4740
movslq 0xc(%rsp), %rsi
addq $0x5, %rsi
movq %r14, %rdi
callq 0x4f30
cmpw $0x1, 0x4(%rax)
jne 0x4740
movslq 0xc(%rsp), %rsi
addq $0x2, %rsi
movq %r14, %rdi
callq 0x4f30
movswl 0x4(%rax), %eax
movl %eax, 0x40(%rsp)
movslq 0xc(%rsp), %rsi
addq $0x4, %rsi
movq %r14, %rdi
callq 0x4f30
movswl 0x4(%rax), %r13d
movslq 0xc(%rsp), %rsi
addq $0x6, %rsi
movq %r14, %rdi
callq 0x4f30
addl 0x40(%rsp), %r13d
movswl 0x4(%rax), %eax
addl %r13d, %eax
jne 0x4740
movl $0x11, 0x10(%rsp)
movslq 0xc(%rsp), %rsi
addq $0x2, %rsi
movq %r14, %rdi
callq 0x4f30
movzwl 0x4(%rax), %eax
movw %ax, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
movl $0x11, 0x10(%rsp)
movslq 0xc(%rsp), %rsi
addq $0x4, %rsi
movq %r14, %rdi
callq 0x4f30
movzwl 0x4(%rax), %r13d
movslq 0xc(%rsp), %rsi
addq $0x2, %rsi
movq %r14, %rdi
callq 0x4f30
addw 0x4(%rax), %r13w
movw %r13w, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
movl $0x12, 0x10(%rsp)
andw $0x0, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
jmp 0x4a2b
movups 0x1bf5(%rip), %xmm0     # 0x633c
movaps %xmm0, 0x10(%rsp)
movabsq $0x1000000007, %rax     # imm = 0x1000000007
movq %rax, 0x20(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
pushq $0x6
popq %rdx
callq 0x4ec0
testb %al, %al
je 0x480e
movslq 0xc(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x4f30
cmpw $-0x1, 0x4(%rax)
jne 0x480e
movslq 0xc(%rsp), %rsi
addq $0x3, %rsi
movq %r14, %rdi
callq 0x4f30
cmpw $0x1, 0x4(%rax)
jne 0x480e
movslq 0xc(%rsp), %rsi
addq $0x2, %rsi
movq %r14, %rdi
callq 0x4f30
movswl 0x4(%rax), %r13d
movslq 0xc(%rsp), %rsi
addq $0x4, %rsi
movq %r14, %rdi
callq 0x4f30
movswl 0x4(%rax), %eax
addl %eax, %r13d
jne 0x480e
movl $0x3, 0x10(%rsp)
movslq 0xc(%rsp), %rsi
addq $0x2, %rsi
movq %r14, %rdi
callq 0x4f30
movzwl 0x4(%rax), %eax
movw %ax, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
jmp 0x4b42
movups 0x1b0f(%rip), %xmm0     # 0x6324
movaps %xmm0, 0x10(%rsp)
movabsq $0x1000000004, %rax     # imm = 0x1000000004
movq %rax, 0x20(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
pushq $0x6
popq %rdx
callq 0x4ec0
testb %al, %al
je 0x48e5
movslq 0xc(%rsp), %rsi
addq $0x2, %rsi
movq %r14, %rdi
callq 0x4f30
cmpw $0x1, 0x4(%rax)
jne 0x48e5
movslq 0xc(%rsp), %rsi
addq $0x4, %rsi
movq %r14, %rdi
callq 0x4f30
cmpw $-0x1, 0x4(%rax)
jne 0x48e5
movslq 0xc(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x4f30
movswl 0x4(%rax), %r13d
movslq 0xc(%rsp), %rsi
addq $0x3, %rsi
movq %r14, %rdi
callq 0x4f30
movswl 0x4(%rax), %eax
addl %eax, %r13d
jne 0x48e5
movl $0x3, 0x10(%rsp)
movslq 0xc(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x4f30
movq %rbp, %r13
movzwl 0x4(%rax), %eax
movw %ax, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
movl 0xc(%rsp), %eax
addl $0x5, %eax
jmp 0x4db2
movups 0x1a98(%rip), %xmm0     # 0x6384
movaps %xmm0, 0x20(%rsp)
movups 0x1a7c(%rip), %xmm0     # 0x6374
movaps %xmm0, 0x10(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
pushq $0x8
popq %rdx
callq 0x4ec0
testb %al, %al
je 0x4975
andl $0x0, 0x10(%rsp)
movw $0x6, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
pushq $0x1
popq %r13
cmpl $0x7, %r13d
je 0x4a0c
movl $0x11, 0x10(%rsp)
movl 0xc(%rsp), %eax
addl %r13d, %eax
movslq %eax, %rsi
movq %r14, %rdi
callq 0x4f30
movzwl 0x4(%rax), %eax
movw %ax, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
incl %r13d
jmp 0x4932
movups 0x19c0(%rip), %xmm0     # 0x633c
movaps %xmm0, 0x10(%rsp)
movabsq $0x1000000007, %rax     # imm = 0x1000000007
movq %rax, 0x20(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
pushq $0x6
popq %rdx
callq 0x4ec0
testb %al, %al
je 0x4a5b
andl $0x0, 0x10(%rsp)
movw $0x4, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
pushq $0x1
popq %r13
cmpl $0x5, %r13d
je 0x4b23
movl $0x11, 0x10(%rsp)
movl 0xc(%rsp), %eax
addl %r13d, %eax
movslq %eax, %rsi
movq %r14, %rdi
callq 0x4f30
movzwl 0x4(%rax), %eax
movw %ax, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
incl %r13d
jmp 0x49c9
movl $0x14, 0x10(%rsp)
andw $0x0, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
movl 0xc(%rsp), %eax
addl $0x7, %eax
jmp 0x4b49
movl $0x17, 0x10(%rsp)
andw $0x0, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
jmp 0x44dd
movabsq $0x400000007, %rax      # imm = 0x400000007
movq %rax, 0x10(%rsp)
movl $0x7, 0x18(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
pushq $0x3
popq %rdx
callq 0x4ec0
testb %al, %al
je 0x4b55
movslq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x4f30
movswl 0x4(%rax), %r13d
movslq 0xc(%rsp), %rsi
addq $0x2, %rsi
movq %r14, %rdi
callq 0x4f30
movswl 0x4(%rax), %eax
addl %eax, %r13d
jne 0x4b55
movl $0x11, 0x10(%rsp)
movslq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x4f30
movq %rbp, %r13
movzwl 0x4(%rax), %eax
movw %ax, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
movl $0xb, 0x10(%rsp)
movslq 0xc(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x4f30
movzwl 0x4(%rax), %eax
movw %ax, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
jmp 0x4dab
movl $0x13, 0x10(%rsp)
andw $0x0, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
movl 0xc(%rsp), %eax
addl $0x5, %eax
movl %eax, 0xc(%rsp)
movq %rbp, %r13
jmp 0x4db6
movabsq $0x700000004, %rax      # imm = 0x700000004
movq %rax, 0x10(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %r13
movq %rbp, %rdx
callq 0x4ec0
testb %al, %al
je 0x4b93
movslq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x4f30
cmpw $-0x1, 0x4(%rax)
je 0x4cf6
movabsq $0x700000004, %rax      # imm = 0x700000004
movq %rax, 0x10(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4ec0
testb %al, %al
je 0x4c01
movslq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x4f30
cmpw $0x1, 0x4(%rax)
jne 0x4c01
movl $0x5, 0x10(%rsp)
movslq 0xc(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x4f30
movzwl 0x4(%rax), %eax
movw %ax, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
jmp 0x42ee
movabsq $0x400000007, %rax      # imm = 0x400000007
movq %rax, 0x10(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4ec0
testb %al, %al
je 0x4c6f
movslq 0xc(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x4f30
cmpw $0x1, 0x4(%rax)
jne 0x4c6f
movl $0xa, 0x10(%rsp)
movslq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x4f30
movzwl 0x4(%rax), %eax
movw %ax, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
jmp 0x42ee
movabsq $0x400000007, %rax      # imm = 0x400000007
movq %rax, 0x10(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4ec0
testb %al, %al
je 0x4cad
movslq 0xc(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x4f30
cmpw $-0x1, 0x4(%rax)
je 0x4ddb
movabsq $0x400000002, %rax      # imm = 0x400000002
movq %rax, 0x10(%rsp)
movl $0x10, 0x18(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
pushq $0x3
popq %rdx
callq 0x4ec0
testb %al, %al
je 0x4d2d
movq 0x8(%rbx), %rax
addq $-0x10, %rax
movl (%rax), %ecx
cmpl $0x16, %ecx
je 0x4cf0
cmpl $0x4, %ecx
jne 0x4d8c
movq %rax, 0x8(%rbx)
jmp 0x4cdc
movl $0x1, 0x10(%rsp)
movslq 0xc(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x4f30
movzwl 0x4(%rax), %eax
movw %ax, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
jmp 0x42ee
movabsq $0x700000002, %rax      # imm = 0x700000002
movq %rax, 0x10(%rsp)
movl $0x10, 0x18(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
pushq $0x3
popq %rdx
callq 0x4ec0
testb %al, %al
je 0x4dbd
movl $0x8, 0x10(%rsp)
movslq 0xc(%rsp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x4f30
movzwl 0x4(%rax), %eax
movw %ax, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
jmp 0x4dab
movl $0x16, 0x10(%rsp)
andw $0x0, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
movl 0xc(%rsp), %eax
addl $0x2, %eax
movl %eax, 0xc(%rsp)
incl %eax
jmp 0x4221
movslq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x4f30
movq %rbx, %rdi
movq %rax, %rsi
callq 0x4f52
movl 0xc(%rsp), %eax
jmp 0x4db6
movl $0x9, 0x10(%rsp)
movslq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x4f30
movzwl 0x4(%rax), %eax
movw %ax, 0x14(%rsp)
andq $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30ba
jmp 0x42ee
cmpb $0x0, 0x44(%rsp)
je 0x4e3d
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x41e8
leaq 0x10(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2e72
movq %r14, %rdi
callq 0x37c8
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
jmp 0x4ead
movq %rax, %r14
movq %rbx, %rdi
callq 0x37c8
movq %r14, %rdi
callq 0x22c0