// File: /workspace/github_cpp_makefile_star2_O1/aronszanto[P]strassen/main.cpp
// Function: main
int main(int argc, char *argv[]){
    convThreshold = 32;
    threadThresh = 512;
    if (argc == 2){
        switch (stoi(argv[1])){
            case 1:
                testStrasMult();
                return 0;
            case 2:
                testConvMult();
                return 0;
            case 3:
                testfindOptDim();
                return 0;
            case 4:
                testInitPadding();
                return 0;
            case 5:
                testRandMatrix();
                return 0;
            case 6:
                testPowers2();
                return 0;
            case 7:
                findOptimalThreadThresh();
                return 0;
            case 8:
                findOptimalconvThreshold();
                return 0;
            default:
                return -1;
        }
        return 0;

    }
    else if (argc == 3 && stoi(argv[1]) == 9){
        cout << timeRandMult(stoi(argv[2]));
    }
    else if (argc != 4)
        std::cout<<"Incorrect numargs, proper: \'0 dimension inputfile\'";
    else if (stoi(argv[1]) == 0)
    {
        int dimension = atoi(argv[2]);
        char* inputfile = argv[3];

    

        Matrix* A = FileToMatrix(inputfile, dimension, 0);
        Matrix* B = FileToMatrix(inputfile, dimension, 0);

        Matrix* C = multiply(A,B);

        printDiagonal(C, dimension);
        return 0;
    }
    
    else return -1;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
movl $0x20, 0x7497(%rip)     # 0xe1a0
movl $0x200, 0x7489(%rip)    # imm = 0x200
cmpl $0x2, %edi
jne 0x6dbe
movq 0x8(%rbx), %rsi
leaq 0x38(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x20a0
movq 0x38(%rsp), %r15
callq 0x2040
movq %rax, %r14
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x18(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x21f0
cmpq %r15, (%r12)
je 0x708a
movq %rax, %rbx
movslq %ebx, %rax
cmpq %rbx, %rax
jne 0x7096
movl (%r14), %eax
cmpl $0x22, %eax
je 0x7096
testl %eax, %eax
jne 0x6d85
movl %ebp, (%r14)
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6d98
callq 0x2190
leal -0x1(%rbx), %eax
cmpl $0x7, %eax
ja 0x7082
leaq 0x2385(%rip), %rcx      # 0x9130
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x4399
jmp 0x706d
movl %edi, %ebp
movabsq $-0x100000000, %r12     # imm = 0xFFFFFFFF00000000
cmpl $0x3, %edi
jne 0x6e4d
movq 0x8(%rbx), %rsi
leaq 0x38(%rsp), %rdi
leaq 0xb(%rsp), %rdx
callq 0x20a0
movq 0x38(%rsp), %r15
callq 0x2040
movq %rax, %r14
movl (%rax), %r13d
movl $0x0, (%rax)
leaq 0x18(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x21f0
cmpq %r15, (%r12)
je 0x70a2
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %r12     # imm = 0xFFFFFFFF00000000
cmpq %r12, %rcx
jb 0x70ae
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x70ae
testl %ecx, %ecx
jne 0x6e44
movl %r13d, (%r14)
cmpl $0x9, %eax
sete %r14b
jmp 0x6e50
xorl %r14d, %r14d
cmpl $0x3, %ebp
jne 0x6e68
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6e68
callq 0x2190
testb %r14b, %r14b
je 0x6f09
movq 0x10(%rbx), %rsi
leaq 0x18(%rsp), %rdi
leaq 0xa(%rsp), %rdx
callq 0x20a0
movq 0x18(%rsp), %rbx
callq 0x2040
movq %rax, %r14
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x10(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x21f0
cmpq %rbx, (%r15)
je 0x70ba
leaq -0x80000000(%rax), %rcx
cmpq %r12, %rcx
jb 0x70c6
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x70c6
testl %ecx, %ecx
jne 0x6eda
movl %ebp, (%r14)
movl %eax, %edi
callq 0x3ca5
movq 0x70f0(%rip), %rdi      # 0xdfd8
callq 0x2240
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x706d
callq 0x2190
jmp 0x706d
cmpl $0x4, %ebp
jne 0x7024
movq %r12, %rbp
movq 0x8(%rbx), %rsi
leaq 0x18(%rsp), %rdi
leaq 0xa(%rsp), %rdx
callq 0x20a0
movq 0x18(%rsp), %r12
callq 0x2040
movq %rax, %r14
movl (%rax), %eax
movl %eax, 0xc(%rsp)
movl $0x0, (%r14)
leaq 0x10(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movl $0xa, %edx
callq 0x21f0
cmpq %r12, (%r13)
je 0x70d2
movq %rax, %r15
addq $-0x80000000, %rax      # imm = 0x80000000
cmpq %rbp, %rax
jb 0x70de
movl (%r14), %eax
cmpl $0x22, %eax
je 0x70de
testl %eax, %eax
jne 0x6f8a
movl 0xc(%rsp), %eax
movl %eax, (%r14)
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6f9d
callq 0x2190
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testl %r15d, %r15d
jne 0x7070
movq 0x10(%rbx), %rdi
callq 0x2230
movl %eax, %ebp
movq 0x18(%rbx), %rbx
xorl %r14d, %r14d
movq %rbx, %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x6a82
movq %rax, %r15
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x6a82
movq %r15, %rdi
movq %rax, %rsi
callq 0x38df
testl %ebp, %ebp
jle 0x7070
movq %rax, %rbx
movl %ebp, %r12d
xorl %r14d, %r14d
leaq 0x2b8f(%rip), %r15      # 0x9b8b
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0x8(%rbx), %rax
movq (%rax,%r13), %rax
movl (%rax,%rbp,4), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x2050
incq %rbp
addq $0x18, %r13
cmpq %rbp, %r12
jne 0x7001
jmp 0x7070
movq 0x6fad(%rip), %rdi      # 0xdfd8
leaq 0x2b5d(%rip), %rsi      # 0x9b8f
movl $0x32, %edx
callq 0x21c0
jmp 0x706d
callq 0x3e44
jmp 0x706d
callq 0x6576
jmp 0x706d
callq 0x65ba
jmp 0x706d
callq 0x3ae1
jmp 0x706d
callq 0x3ebf
jmp 0x706d
callq 0x68c3
jmp 0x706d
callq 0x3d90
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x7070
leaq 0x2b39(%rip), %rdi      # 0x9bca
callq 0x20f0
leaq 0x2b2d(%rip), %rdi      # 0x9bca
callq 0x2200
leaq 0x2b21(%rip), %rdi      # 0x9bca
callq 0x20f0
leaq 0x2b15(%rip), %rdi      # 0x9bca
callq 0x2200
leaq 0x2b09(%rip), %rdi      # 0x9bca
callq 0x20f0
leaq 0x2afd(%rip), %rdi      # 0x9bca
callq 0x2200
leaq 0x2af1(%rip), %rdi      # 0x9bca
callq 0x20f0
leaq 0x2ae5(%rip), %rdi      # 0x9bca
callq 0x2200
jmp 0x7128
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x7113
movl 0xc(%rsp), %eax
movl %eax, (%r14)
jmp 0x7113
jmp 0x7128
jmp 0x7128
movq %rax, %rbx
jmp 0x7113
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x7113
movl %ebp, (%r14)
leaq 0x28(%rsp), %rax
jmp 0x713e
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x7139
movl %r13d, (%r14)
jmp 0x7139
movq %rax, %rbx
jmp 0x714c
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x7139
movl %ebp, (%r14)
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x714c
callq 0x2190
movq %rbx, %rdi
callq 0x22b0