// File: /workspace/github_c_makefile_star2_O2/YanjieZe[P]CacheLab/test-trans.c
// Function: main
int main(int argc, char* argv[])
{
    char c;

    while ((c = getopt(argc,argv,"M:N:h")) != -1) {
        switch(c) {
        case 'M':
            M = atoi(optarg);
            break;
        case 'N':
            N = atoi(optarg);
            break;
        case 'h':
            usage(argv);
            exit(0);
        default:
            usage(argv);
            exit(1);
        }
    }
  
    if (M == 0 || N == 0) {
        printf("Error: Missing required argument\n");
        usage(argv);
        exit(1);
    }

    if (M > MAXN || N > MAXN) {
        printf("Error: M or N exceeds %d\n", MAXN);
        usage(argv);
        exit(1);
    }

    /* Install SIGSEGV and SIGALRM handlers */
    if (signal(SIGSEGV, sigsegv_handler) == SIG_ERR) {
        fprintf(stderr, "Unable to install SIGALRM handler\n");
        exit(1);
    }

    if (signal(SIGALRM, sigalrm_handler) == SIG_ERR) {
        fprintf(stderr, "Unable to install SIGALRM handler\n");
        exit(1);
    }

    /* Time out and give up after a while */
    alarm(120);

    /* Check the performance of the student's transpose function */
    eval_perf(5, 1, 5);
  
    /* Emit the results for this particular test */
    if (results.funcid == -1) {
        printf("\nError: We could not find your transpose_submit() function\n");
        printf("Error: Please ensure that description field is exactly \"%s\"\n", 
               SUBMIT_DESCRIPTION);
        printf("\nTEST_TRANS_RESULTS=0:0\n");
    }
    else {
        printf("\nSummary for official submission (func %d): correctness=%d misses=%d\n",
               results.funcid, results.correct, results.misses);
        printf("\nTEST_TRANS_RESULTS=%d:%d\n", results.correct, results.misses);
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x4bf9(%rip), %r14      # 0x6327
leaq 0x6c83(%rip), %r13      # 0x83b8
movq 0x689c(%rip), %r12      # 0x7fd8
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1140
shll $0x18, %eax
cmpl $0xff000000, %eax       # imm = 0xFF000000
je 0x177c
sarl $0x18, %eax
movq %r13, %r15
cmpl $0x4d, %eax
je 0x176e
cmpl $0x4e, %eax
jne 0x1877
leaq 0x6c4e(%rip), %r15      # 0x83bc
movq (%r12), %rdi
callq 0x1150
movl %eax, (%r15)
jmp 0x173c
movl 0x6c36(%rip), %eax      # 0x83b8
testl %eax, %eax
je 0x18a9
movl 0x6c2c(%rip), %ecx      # 0x83bc
testl %ecx, %ecx
je 0x18a9
cmpl $0x100, %eax            # imm = 0x100
jg 0x18b7
cmpl $0x101, %ecx            # imm = 0x101
jge 0x18b7
leaq -0xff(%rip), %rsi       # 0x16b7
pushq $0xb
popq %rdi
callq 0x10e0
cmpq $-0x1, %rax
je 0x188b
leaq -0xe8(%rip), %rsi       # 0x16e7
pushq $0xe
popq %rdi
callq 0x10e0
cmpq $-0x1, %rax
je 0x188b
pushq $0x78
popq %rdi
callq 0x10a0
pushq $0x1
popq %rsi
pushq $0x5
popq %rdi
movl %edi, %edx
callq 0x129c
movl 0x68f4(%rip), %esi      # 0x80f0
cmpl $-0x1, %esi
je 0x1839
movzbl 0x6bac(%rip), %edx      # 0x83b4
movl 0x68e6(%rip), %ecx      # 0x80f4
leaq 0x4b92(%rip), %rdi      # 0x63a7
xorl %eax, %eax
callq 0x1070
movzbl 0x6b91(%rip), %esi      # 0x83b4
movl 0x68cb(%rip), %edx      # 0x80f4
leaq 0x4bbd(%rip), %rdi      # 0x63ed
xorl %eax, %eax
callq 0x1070
jmp 0x1866
leaq 0x4c2d(%rip), %rdi      # 0x646d
callq 0x1040
leaq 0x4b1e(%rip), %rdi      # 0x636a
leaq 0x47b1(%rip), %rsi      # 0x6004
xorl %eax, %eax
callq 0x1070
leaq 0x4c47(%rip), %rdi      # 0x64a8
callq 0x1040
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x68, %eax
jne 0x18ca
movq %rbx, %rdi
callq 0x1652
xorl %edi, %edi
callq 0x1170
movq 0x6766(%rip), %rax      # 0x7ff8
movq (%rax), %rcx
leaq 0x4aab(%rip), %rdi      # 0x6347
pushq $0x22
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
jmp 0x18d2
leaq 0x4c10(%rip), %rdi      # 0x64c0
callq 0x1040
jmp 0x18ca
leaq 0x4a6f(%rip), %rdi      # 0x632d
movl $0x100, %esi            # imm = 0x100
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
callq 0x1652
pushq $0x1
popq %rdi
callq 0x1170
nop