// File: /workspace/github_cpp_makefile_star2_O1/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 $0x38, %rsp
movl %ecx, %ebx
movq %rdi, %r14
testq %rsi, %rsi
je 0x4f66
movq %rsi, %r15
testl %edx, %edx
jle 0x4f5e
movl %edx, %r12d
xorl %r13d, %r13d
movq (%r15,%r13,8), %rdi
testq %rdi, %rdi
je 0x4f56
callq 0x21c0
incq %r13
cmpq %r13, %r12
jne 0x4f48
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 0x4fac
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 0x4f97
movq %r13, 0x10(%rsp)
movq (%r14), %r15
movq 0x8(%r14), %rax
subq %r15, %rax
sarq $0x2, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rcx
movq %rcx, 0x8(%rsp)
testl %ecx, %ecx
jle 0x5161
movabsq $0x3fffffffc, %rcx      # imm = 0x3FFFFFFFC
movq 0x8(%rsp), %rax
movl %eax, %ebp
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
leaq (%rcx,%rax,4), %r11
addq $-0x4, %r11
leaq 0xc(%r15), %rax
movq %rax, 0x18(%rsp)
movl $0x1, %ebx
movq $-0x4, %r13
xorl %r12d, %r12d
movq 0x10(%rsp), %rax
movq (%rax,%r12,8), %r14
movl $0x1, (%r14,%r12,4)
leaq 0x1(%r12), %rax
leaq (%r12,%r12,2), %rcx
movq %rcx, 0x20(%rsp)
movq %rax, 0x30(%rsp)
cmpq %rbp, %rax
jae 0x50c0
movq 0x20(%rsp), %rax
leaq (%r15,%rax,4), %rcx
movq 0x18(%rsp), %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 0x507a
cmpl %edi, %r9d
je 0x507a
cmpl %r10d, %r9d
je 0x5094
cmpl %edi, %r8d
je 0x5094
movl $0x1, (%r14,%rax,4)
incq %rax
addq $-0x4, %rdx
addq $0xc, %rsi
cmpq %rax, %rbp
jne 0x5052
jmp 0x50c0
cmpl 0x8(%rsp), %eax
jge 0x50c0
leaq (%r14,%rax,4), %rdi
movabsq $0x3fffffffc, %rax      # imm = 0x3FFFFFFFC
andq %rax, %rdx
addq $0x4, %rdx
xorl %esi, %esi
movq %r11, 0x28(%rsp)
callq 0x20b0
movq 0x28(%rsp), %r11
testq %r12, %r12
movq 0x30(%rsp), %r12
je 0x5147
movq 0x20(%rsp), %rax
leaq (%r15,%rax,4), %rcx
movq %r13, %rdx
movq %rbx, %rax
leal -0x2(%rax), %esi
movq (%rcx), %r9
leaq (%rsi,%rsi,2), %rdi
movq (%r15,%rdi,4), %rdi
movq %r9, %r8
shrq $0x20, %r8
movq %rdi, %r10
shrq $0x20, %r10
cmpq %r10, %r8
je 0x5109
cmpl %edi, %r9d
je 0x5109
cmpl %r10d, %r9d
je 0x5120
cmpl %edi, %r8d
je 0x5120
movl $0x1, (%r14,%rsi,4)
decq %rax
addq $-0x4, %rdx
cmpq $0x1, %rax
jg 0x50d9
jmp 0x5147
decl %eax
testl %eax, %eax
jle 0x5147
movabsq $0x3fffffffc, %rax      # imm = 0x3FFFFFFFC
andq %rax, %rdx
addq $0x4, %rdx
movq %r14, %rdi
xorl %esi, %esi
movq %r11, %r14
callq 0x20b0
movq %r14, %r11
incq %rbx
addq $-0x4, %r11
addq $0xc, 0x18(%rsp)
addq $0x4, %r13
cmpq %rbp, %r12
jne 0x5011
movq 0x10(%rsp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq