// File: /workspace/github_cpp_makefile_star2_O3/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 $0x38, %rsp
movq %rsi, %rbx
movl $0x20, 0x7614(%rip)     # 0xe1a0
movl $0x200, 0x7606(%rip)    # imm = 0x200
cmpl $0x4, %edi
je 0x6d98
cmpl $0x3, %edi
je 0x6c53
cmpl $0x2, %edi
jne 0x6d6b
movq 0x8(%rbx), %rsi
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x20a0
movq 0x10(%rsp), %r15
callq 0x2040
movq %rax, %r14
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x30(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x21f0
cmpq %r15, (%r12)
je 0x6efb
movq %rax, %rbx
movslq %ebx, %rax
cmpq %rbx, %rax
jne 0x6f1f
movl (%r14), %eax
cmpl $0x22, %eax
je 0x6f1f
testl %eax, %eax
jne 0x6c1a
movl %ebp, (%r14)
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6c2d
callq 0x2190
leal -0x1(%rbx), %eax
cmpl $0x7, %eax
ja 0x6ee4
leaq 0x24f0(%rip), %rcx      # 0x9130
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x4333
jmp 0x6d83
movq 0x8(%rbx), %rsi
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x20a0
movq 0x10(%rsp), %r15
callq 0x2040
movq %rax, %r14
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x30(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x21f0
cmpq %r15, (%r12)
je 0x6eef
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x6f13
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x6f13
testl %ecx, %ecx
jne 0x6cb9
movl %ebp, (%r14)
movl %eax, %r15d
leaq 0x20(%rsp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x6cd0
callq 0x2190
cmpl $0x9, %r15d
jne 0x6d6b
movq 0x10(%rbx), %rsi
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x20a0
movq 0x10(%rsp), %rbx
movl (%r14), %ebp
movl $0x0, (%r14)
leaq 0x30(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x21f0
cmpq %rbx, (%r15)
je 0x6f37
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
leaq -0x80000000(%rax), %rdx
cmpq %rcx, %rdx
jb 0x6f43
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x6f43
testl %ecx, %ecx
jne 0x6d47
movl %ebp, (%r14)
movl %eax, %edi
callq 0x3c8b
movq 0x7283(%rip), %rdi      # 0xdfd8
callq 0x2240
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x6d83
callq 0x2190
jmp 0x6d83
movq 0x7266(%rip), %rdi      # 0xdfd8
leaq 0x2e16(%rip), %rsi      # 0x9b8f
movl $0x32, %edx
callq 0x21c0
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbx), %rsi
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x20a0
movq 0x10(%rsp), %r12
callq 0x2040
movq %rax, %r14
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x30(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movl $0xa, %edx
callq 0x21f0
cmpq %r12, (%r13)
je 0x6f07
movq %rax, %r15
movslq %r15d, %rax
cmpq %r15, %rax
jne 0x6f2b
movl (%r14), %eax
cmpl $0x22, %eax
je 0x6f2b
testl %eax, %eax
jne 0x6e01
movl %ebp, (%r14)
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6e14
callq 0x2190
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testl %r15d, %r15d
jne 0x6d86
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 0x6905
movq %rax, %r15
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x6905
movq %r15, %rdi
movq %rax, %rsi
callq 0x38bf
testl %ebp, %ebp
jle 0x6d86
movq %rax, %rbx
movl %ebp, %r12d
xorl %r14d, %r14d
leaq 0x2d18(%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 0x6e78
jmp 0x6d86
callq 0x3e2a
jmp 0x6d83
callq 0x6442
jmp 0x6d83
callq 0x6486
jmp 0x6d83
callq 0x3ac5
jmp 0x6d83
callq 0x3ea5
jmp 0x6d83
callq 0x6749
jmp 0x6d83
callq 0x3d76
jmp 0x6d83
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x6d86
leaq 0x2cd4(%rip), %rdi      # 0x9bca
callq 0x20f0
leaq 0x2cc8(%rip), %rdi      # 0x9bca
callq 0x20f0
leaq 0x2cbc(%rip), %rdi      # 0x9bca
callq 0x20f0
leaq 0x2cb0(%rip), %rdi      # 0x9bca
callq 0x2200
leaq 0x2ca4(%rip), %rdi      # 0x9bca
callq 0x2200
leaq 0x2c98(%rip), %rdi      # 0x9bca
callq 0x2200
leaq 0x2c8c(%rip), %rdi      # 0x9bca
callq 0x20f0
leaq 0x2c80(%rip), %rdi      # 0x9bca
callq 0x2200
jmp 0x6f72
movq %rax, %rbx
jmp 0x6f62
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x6f62
movl %ebp, (%r14)
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
jne 0x6f95
jmp 0x6f9a
jmp 0x6f72
jmp 0x6f72
movq %rax, %rbx
jmp 0x6f9a
jmp 0x6f7b
jmp 0x6f7b
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x6f87
movl %ebp, (%r14)
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6f9a
callq 0x2190
movq %rbx, %rdi
callq 0x22b0