// File: xiangzejun[P]Optimizing_Implementations_of_Linear_Layers/main.cpp
// Function: main
int main()
{
	int counter = 100000;
	struct timeval start;
	struct timeval end;
	gettimeofday(&start, NULL);

	int num = 0;
	cout<<FILENAME<<endl;
	// while((num++) < 1)
	// srand(time(0));
	while(true)
	{
		vector<ROW> m = get_matrix();


		vector<xpair> seq = reduce(m);

		vector<ROW> tmp_m = get_reduced_matrix(seq, m);

		cout << "minimal = " << counter << "   current = " << seq.size() << endl << endl;

		if(seq.size() < counter)
		{
			counter = seq.size();
			print_seq(m, tmp_m, seq);
		}
	}

	gettimeofday(&end, NULL);
	float time  = 1000000 * (end.tv_sec - start.tv_sec) + end.tv_usec - start.tv_usec;
	time /= 1000000;
	cout << "Time used = " << time << endl;

	return 0;
}

// Assembly:
subq $0x158, %rsp            # imm = 0x158
movl $0x0, 0x154(%rsp)
movl $0x186a0, 0x150(%rsp) # imm = 0x186A0
leaq 0x140(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2240
movl $0x0, 0x12c(%rsp)
movq 0x10a98(%rip), %rdi     # 0x12fd8
leaq 0xbabd(%rip), %rsi      # 0xe004
callq 0x2140
movq %rax, %rdi
movq 0x10a72(%rip), %rsi     # 0x12fc8
callq 0x2170
leaq 0x110(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x87a0
movq 0x30(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0x2fc0
jmp 0x2581
leaq 0xf8(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0xc250
jmp 0x2598
leaq 0xe0(%rsp), %rdi
callq 0x30c0
leaq 0xa0(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x3120
jmp 0x25bc
leaq 0x88(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x2fc0
jmp 0x25d3
leaq 0xb8(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
leaq 0x88(%rsp), %rdx
callq 0x8c90
jmp 0x25f2
leaq 0x88(%rsp), %rdi
callq 0x30c0
leaq 0xa0(%rsp), %rdi
callq 0x3220
movq 0x109c5(%rip), %rdi     # 0x12fd8
leaq 0xb9f2(%rip), %rsi      # 0xe00c
callq 0x2140
movq %rax, 0x28(%rsp)
jmp 0x2626
movq 0x28(%rsp), %rdi
movl 0x150(%rsp), %esi
callq 0x2280
movq %rax, 0x20(%rsp)
jmp 0x263e
movq 0x20(%rsp), %rdi
leaq 0xb9cd(%rip), %rsi      # 0xe017
callq 0x2140
movq %rax, 0x18(%rsp)
jmp 0x2656
leaq 0xf8(%rsp), %rdi
callq 0x3280
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x2050
movq %rax, 0x10(%rsp)
jmp 0x2677
movq 0x10(%rsp), %rdi
movq 0x10945(%rip), %rsi     # 0x12fc8
callq 0x2170
movq %rax, 0x8(%rsp)
jmp 0x268f
movq 0x8(%rsp), %rdi
movq 0x1092d(%rip), %rsi     # 0x12fc8
callq 0x2170
jmp 0x26a2
leaq 0xf8(%rsp), %rdi
callq 0x3280
movslq 0x150(%rsp), %rcx
cmpq %rcx, %rax
jae 0x2863
leaq 0xf8(%rsp), %rdi
callq 0x3280
movl %eax, 0x150(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x2fc0
jmp 0x26e8
leaq 0x58(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x2fc0
jmp 0x26fc
leaq 0x40(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x3120
jmp 0x2710
leaq 0x70(%rsp), %rdi
leaq 0x58(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x28d0
jmp 0x2726
leaq 0x40(%rsp), %rdi
callq 0x3220
leaq 0x58(%rsp), %rdi
callq 0x30c0
leaq 0x70(%rsp), %rdi
callq 0x30c0
jmp 0x2863
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
jmp 0x28a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x30c0
jmp 0x28a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
jmp 0x289c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
jmp 0x27d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x30c0
leaq 0xa0(%rsp), %rdi
callq 0x3220
jmp 0x289c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
jmp 0x288f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
jmp 0x2857
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
jmp 0x284d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x3220
leaq 0x58(%rsp), %rdi
callq 0x30c0
leaq 0x70(%rsp), %rdi
callq 0x30c0
jmp 0x288f
leaq 0xb8(%rsp), %rdi
callq 0x30c0
leaq 0xf8(%rsp), %rdi
callq 0x3220
leaq 0x110(%rsp), %rdi
callq 0x30c0
jmp 0x255b
leaq 0xb8(%rsp), %rdi
callq 0x30c0
leaq 0xf8(%rsp), %rdi
callq 0x3220
leaq 0x110(%rsp), %rdi
callq 0x30c0
movq 0xd8(%rsp), %rdi
callq 0x22a0
nopw %cs:(%rax,%rax)