// File: /workspace/github_cpp_makefile_star2_O3/xiangzejun[P]Optimizing_Implementations_of_Linear_Layers/strategy.cpp
// Function: strgy3(std::vector<std::bitset<32ul>, std::allocator<std::bitset<32ul>>>&)
vector<xpair> strgy3(vector<ROW> &m)
{
	vector<xpair> tmp_seq;
	while(get_ones(m) != m.size())
	{
		vector<xpair> base_oper;
		base_oper.clear();
		int value = 0;

		int Reduced_Row = select_oper(m, base_oper, value, 0);

		vector<ROW> trans_m;
		get_trans_matrix(trans_m,m);

		int Reduced_Col = select_oper(trans_m, base_oper, Reduced_Row, 1);
		if (base_oper.size() >= 1)
			{
				int rand_num = rand_generator() % base_oper.size();
			
				if (!base_oper[rand_num].flag)
				{
					m[base_oper[rand_num].dst] ^= m[base_oper[rand_num].src];
					tmp_seq.push_back(base_oper[rand_num]);
				}
	
				else if (base_oper[rand_num].flag)
				{   
					vector<ROW> trans_tmp_m;
					get_trans_matrix(trans_tmp_m, m);
					trans_tmp_m[base_oper[rand_num].dst] ^= trans_tmp_m[base_oper[rand_num].src];
					get_trans_matrix(m, trans_tmp_m);
					tmp_seq.push_back(base_oper[rand_num]);
				}
			}
			else 
			{
				break;
			}
	}
    
	if (get_ones(m) != m.size())
	{ 
	    // int rnd = rand()%2;
		int rnd = rand_generator() % 2;
		if(rnd == 0)
		{
			vector<xpair> seq_2(strgy1(m));
			tmp_seq.insert(tmp_seq.end(), seq_2.begin(), seq_2.end());
		}
		else if(rnd == 1)
		{
			vector<xpair> seq_2(strgy2(m));
			tmp_seq.insert(tmp_seq.end(), seq_2.begin(), seq_2.end());
		}
	}
	
	int tab[SIZE] = {0};
	build_table(m, tab);
	vector<xpair> final_seq = update_seq_str(tmp_seq, tab);
	return final_seq;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rsi, %r14
movq %rdi, 0x28(%rsp)
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rax
movaps %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movabsq $0x3333333333333333, %rbx # imm = 0x3333333333333333
movabsq $0xf0f0f0f0f0f0f0f, %r15 # imm = 0xF0F0F0F0F0F0F0F
movabsq $0x101010101010101, %r12 # imm = 0x101010101010101
movq %rsi, 0x8(%rsp)
leaq 0x1b0(%rsp), %rdi
movq %r14, %rsi
callq 0x2ea0
movq 0x1b0(%rsp), %rdi
movq 0x1b8(%rsp), %rax
subq %rdi, %rax
je 0x3e0b
sarq $0x3, %rax
cmpq $0x1, %rax
adcq $0x0, %rax
xorl %edx, %edx
xorl %ecx, %ecx
movabsq $0x5555555555555555, %r9 # imm = 0x5555555555555555
movq (%rdi,%rdx,8), %rsi
movq %rsi, %r8
shrq %r8
andq %r9, %r8
subq %r8, %rsi
movq %rsi, %r8
andq %rbx, %r8
shrq $0x2, %rsi
andq %rbx, %rsi
addq %r8, %rsi
movq %rsi, %r8
shrq $0x4, %r8
addq %rsi, %r8
andq %r15, %r8
imulq %r12, %r8
shrq $0x38, %r8
addl %r8d, %ecx
incq %rdx
cmpq %rdx, %rax
jne 0x3d9e
movq 0x8(%rsp), %rax
movq 0x8(%rax), %r14
movq 0x8(%rsp), %rax
subq (%rax), %r14
movslq %ecx, %r13
sarq $0x3, %r14
movq 0x1c0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
cmpq %r13, %r14
jmp 0x3e2d
movq %r14, %rax
movq (%r14), %r14
movq 0x8(%rax), %r13
testq %rdi, %rdi
je 0x3e2a
movq 0x1c0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
cmpq %r14, %r13
movq 0x8(%rsp), %r14
je 0x4108
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
leaq 0x198(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x2ea0
movq %r13, %rdi
leaq 0x50(%rsp), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x453c
movl %eax, %r13d
movq 0x198(%rsp), %rdi
testq %rdi, %rdi
je 0x3e8d
movq 0x1a8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
xorps %xmm0, %xmm0
movaps %xmm0, 0xd0(%rsp)
movq $0x0, 0xe0(%rsp)
leaq 0x180(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2ea0
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
callq 0x3a85
movq 0x180(%rsp), %rdi
testq %rdi, %rdi
je 0x3ee7
movq 0x190(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
leaq 0x168(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2ea0
movq %rbp, %rdi
leaq 0x50(%rsp), %rsi
movl %r13d, %edx
movl $0x1, %ecx
callq 0x453c
movq 0x168(%rsp), %rdi
testq %rdi, %rdi
je 0x3f2c
movq 0x178(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x50(%rsp), %rbp
movq 0x58(%rsp), %r14
cmpq %rbp, %r14
je 0x40c6
leaq 0x623a(%rip), %rdi      # 0xa180
callq 0x4736
movq 0x50(%rsp), %rcx
movq 0x58(%rsp), %rsi
subq %rcx, %rsi
sarq $0x2, %rsi
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rsi
xorl %edx, %edx
divq %rsi
movslq %edx, %rax
leaq (%rax,%rax,2), %r13
cmpb $0x0, 0x8(%rcx,%r13,4)
je 0x405b
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
leaq 0x138(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x2ea0
leaq 0x30(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x3a85
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x3fd4
movq 0x148(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x50(%rsp), %rax
movslq (%rax,%r13,4), %rcx
movq 0x30(%rsp), %rdx
movslq 0x4(%rax,%r13,4), %rax
movq (%rdx,%rcx,8), %rcx
xorq %rcx, (%rdx,%rax,8)
leaq 0x120(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x2ea0
movq 0x8(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x3a85
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0x4030
movq 0x130(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
shlq $0x2, %r13
addq 0x50(%rsp), %r13
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x40a2
movl 0x8(%r13), %eax
movl %eax, 0x8(%rsi)
movq (%r13), %rax
movq %rax, (%rsi)
addq $0xc, 0x18(%rsp)
jmp 0x40af
leaq (%rcx,%r13,4), %rdx
movslq (%rdx), %rax
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
movslq 0x4(%rdx), %rsi
movq (%rcx,%rax,8), %rax
xorq %rax, (%rcx,%rsi,8)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x4096
movl 0x8(%rdx), %eax
movl %eax, 0x8(%rsi)
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0xc, 0x18(%rsp)
jmp 0x40c6
leaq 0x10(%rsp), %rdi
callq 0x479a
jmp 0x40c6
leaq 0x10(%rsp), %rdi
movq %r13, %rdx
callq 0x479a
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x40c6
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x40e3
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x40fa
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
cmpq %rbp, %r14
movq 0x8(%rsp), %r14
jne 0x3d5b
leaq 0x150(%rsp), %rdi
movq %r14, %rsi
callq 0x2ea0
movq 0x150(%rsp), %rdi
movq 0x158(%rsp), %rax
subq %rdi, %rax
je 0x41bd
sarq $0x3, %rax
cmpq $0x1, %rax
adcq $0x0, %rax
xorl %edx, %edx
xorl %ecx, %ecx
movabsq $0x5555555555555555, %r9 # imm = 0x5555555555555555
movq (%rdi,%rdx,8), %rsi
movq %rsi, %r8
shrq %r8
andq %r9, %r8
subq %r8, %rsi
movq %rsi, %r8
andq %rbx, %r8
shrq $0x2, %rsi
andq %rbx, %rsi
addq %r8, %rsi
movq %rsi, %r8
shrq $0x4, %r8
addq %rsi, %r8
andq %r15, %r8
imulq %r12, %r8
shrq $0x38, %r8
addl %r8d, %ecx
incq %rdx
cmpq %rdx, %rax
jne 0x414b
movq 0x8(%r14), %rbx
subq (%r14), %rbx
movslq %ecx, %r14
sarq $0x3, %rbx
movq 0x160(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
cmpq %r14, %rbx
movq 0x8(%rsp), %r14
movq 0x28(%rsp), %rbx
jne 0x41e8
jmp 0x425b
movq (%r14), %rbx
movq 0x8(%r14), %r14
testq %rdi, %rdi
je 0x41d9
movq 0x160(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
cmpq %rbx, %r14
movq 0x28(%rsp), %rbx
movq 0x8(%rsp), %r14
je 0x425b
leaq 0x5f91(%rip), %rdi      # 0xa180
callq 0x4736
testb $0x1, %al
jne 0x421f
leaq 0x50(%rsp), %rdi
movq %r14, %rsi
callq 0x3168
leaq 0x10(%rsp), %rdi
movq 0x8(%rdi), %rsi
movq 0x50(%rsp), %rdx
movq 0x58(%rsp), %rcx
callq 0x49f2
jmp 0x4244
leaq 0x50(%rsp), %rdi
movq %r14, %rsi
callq 0x32e3
leaq 0x10(%rsp), %rdi
movq 0x8(%rdi), %rsi
movq 0x50(%rsp), %rdx
movq 0x58(%rsp), %rcx
callq 0x49f2
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x425b
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
xorps %xmm0, %xmm0
movaps %xmm0, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
leaq 0x108(%rsp), %rdi
movq %r14, %rsi
callq 0x2ea0
leaq 0x108(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x3b4d
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x42d4
movq 0x118(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
leaq 0xf0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2f16
leaq 0xf0(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movq %rbx, %rdi
callq 0x3bc3
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x4318
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x432f
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq %rbx, %rax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x43fb
jmp 0x43fb
jmp 0x4491
jmp 0x4491
jmp 0x4491
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x4494
movq 0x100(%rsp), %rsi
jmp 0x4487
movq %rax, %rbx
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x4494
movq 0x118(%rsp), %rsi
jmp 0x4487
jmp 0x4491
jmp 0x4491
movq %rax, %rbx
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0x43ea
movq 0x130(%rsp), %rsi
jmp 0x43db
movq %rax, %rbx
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x43ea
movq 0x148(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x43ea
jmp 0x4402
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x445b
movq 0x40(%rsp), %rsi
jmp 0x4453
movq %rax, %rbx
jmp 0x4478
jmp 0x4402
movq %rax, %rbx
jmp 0x445b
movq %rax, %rbx
movq 0x198(%rsp), %rdi
testq %rdi, %rdi
je 0x4478
movq 0x1a8(%rsp), %rsi
jmp 0x4470
movq %rax, %rbx
movq 0x180(%rsp), %rdi
testq %rdi, %rdi
je 0x445b
movq 0x190(%rsp), %rsi
jmp 0x4453
movq %rax, %rbx
movq 0x168(%rsp), %rdi
testq %rdi, %rdi
je 0x445b
movq 0x178(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x4478
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x4494
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x4494
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x44ab
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq %rbx, %rdi
callq 0x2270