// File: /workspace/github_cpp_makefile_star2_O3/xiangzejun[P]Optimizing_Implementations_of_Linear_Layers/reduce.cpp
// Function: get_table(std::vector<xpair, std::allocator<xpair>>, int**, int, int)
int** get_table(vector<xpair> seq, int ** table, int osize, int nsize)
{
	if(table != NULL)
	{
		for(int i = 0; i < osize; i++)
			delete[] table[i];
		delete[] table;
	}
	table = new int*[nsize];
	for(int i = 0; i < nsize; i++)
		table[i] = new int[nsize];

	int s = seq.size();
	for(int i = 0; i < s; i++)
	{
		table[i][i] = 1;
		for(int j = i + 1; j < s; j++)
		{
			if(exchange(seq[i], seq[j]))
				table[i][j] = 1;
			else
			{
				for(int k = j; k < s; k++)
					table[i][k] = 0;
				break;
			}
		}
		for(int j = i - 1; j >= 0; j--)
		{
			if(exchange(seq[i], seq[j]))
				table[i][j] = 1;
			else
			{
				for(int k = j; k >= 0; k--)
					table[i][k] = 0;
				break;
			}
		}
	}
	return table;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %ebx
movq %rdi, %r14
testq %rsi, %rsi
je 0x4f72
movq %rsi, %r15
testl %edx, %edx
jle 0x4f6a
movl %edx, %r12d
xorl %r13d, %r13d
movq (%r15,%r13,8), %rdi
testq %rdi, %rdi
je 0x4f62
callq 0x21c0
incq %r13
cmpq %r13, %r12
jne 0x4f54
movq %r15, %rdi
callq 0x21c0
movslq %ebx, %rbx
leaq (,%rbx,8), %rax
testl %ebx, %ebx
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0x2030
movq %rax, %r13
testl %ebx, %ebx
jle 0x4fb8
leaq (,%rbx,4), %r15
movl %ebx, %ebx
xorl %r12d, %r12d
movq %r15, %rdi
callq 0x2030
movq %rax, (%r13,%r12,8)
incq %r12
cmpq %r12, %rbx
jne 0x4fa3
movq %r13, 0x8(%rsp)
movq (%r14), %r15
movq 0x8(%r14), %rax
subq %r15, %rax
sarq $0x2, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rcx
movq %rcx, (%rsp)
testl %ecx, %ecx
jle 0x514b
movabsq $0x3fffffff8, %rcx      # imm = 0x3FFFFFFF8
movq (%rsp), %rax
movl %eax, %ebp
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
leaq (%rcx,%rax,4), %r11
leaq 0xc(%r15), %r12
movl $0x1, %ebx
xorl %r13d, %r13d
movq 0x8(%rsp), %rax
movq (%rax,%r13,8), %r14
movl $0x1, (%r14,%r13,4)
leaq 0x1(%r13), %rax
leaq (,%r13,2), %rcx
addq %r13, %rcx
movq %rcx, 0x10(%rsp)
movq %rax, 0x20(%rsp)
cmpq %rbp, %rax
jae 0x50c1
movq 0x10(%rsp), %rax
leaq (%r15,%rax,4), %rcx
movq %r12, %rsi
movq %r11, %rdx
movq %rbx, %rax
movq (%rcx), %r9
movq (%rsi), %rdi
movq %r9, %r8
shrq $0x20, %r8
movq %rdi, %r10
shrq $0x20, %r10
cmpq %r10, %r8
je 0x5078
cmpl %edi, %r9d
je 0x5078
cmpl %r10d, %r9d
je 0x5092
cmpl %edi, %r8d
je 0x5092
movl $0x1, (%r14,%rax,4)
incq %rax
addq $-0x4, %rdx
addq $0xc, %rsi
cmpq %rax, %rbp
jne 0x5050
jmp 0x50c1
cmpl (%rsp), %eax
jge 0x50c1
leaq (%r14,%rax,4), %rdi
movabsq $0x3fffffff8, %rax      # imm = 0x3FFFFFFF8
addq $0x4, %rax
andq %rax, %rdx
addq $0x4, %rdx
xorl %esi, %esi
movq %r11, 0x18(%rsp)
callq 0x20b0
movq 0x18(%rsp), %r11
testq %r13, %r13
movq 0x20(%rsp), %r13
je 0x5137
movq 0x10(%rsp), %rax
leaq (%r15,%rax,4), %rcx
movq %rbx, %rax
leal -0x2(%rax), %edx
movq (%rcx), %r8
leaq (%rdx,%rdx,2), %rsi
movq (%r15,%rsi,4), %rsi
movq %r8, %rdi
shrq $0x20, %rdi
movq %rsi, %r9
shrq $0x20, %r9
cmpq %r9, %rdi
je 0x5106
cmpl %esi, %r8d
je 0x5106
cmpl %r9d, %r8d
je 0x5119
cmpl %esi, %edi
je 0x5119
movl $0x1, (%r14,%rdx,4)
decq %rax
cmpq $0x1, %rax
jg 0x50d7
jmp 0x5137
decl %eax
testl %eax, %eax
jle 0x5137
leaq 0x4(,%rdx,4), %rdx
movq %r14, %rdi
xorl %esi, %esi
movq %r11, %r14
callq 0x20b0
movq %r14, %r11
incq %rbx
addq $-0x4, %r11
addq $0xc, %r12
cmpq %rbp, %r13
jne 0x500b
movq 0x8(%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq