// File: /workspace/github_c_makefile_star2_O1/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 0x4b77(%rip), %rdx      # 0x6327
callq 0x1140
shll $0x18, %eax
cmpl $0xff000000, %eax       # imm = 0xFF000000
je 0x1812
leaq 0x6bf2(%rip), %r13      # 0x83b8
movq 0x680b(%rip), %r12      # 0x7fd8
leaq 0x4b53(%rip), %r14      # 0x6327
sarl $0x18, %eax
movq %r13, %r15
cmpl $0x4d, %eax
je 0x17ef
cmpl $0x4e, %eax
jne 0x191a
leaq 0x6bcd(%rip), %r15      # 0x83bc
movq (%r12), %rdi
callq 0x1150
movl %eax, (%r15)
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1140
shll $0x18, %eax
cmpl $0xff000000, %eax       # imm = 0xFF000000
jne 0x17d4
movl 0x6ba0(%rip), %eax      # 0x83b8
testl %eax, %eax
je 0x192e
movl 0x6b96(%rip), %ecx      # 0x83bc
testl %ecx, %ecx
je 0x192e
cmpl $0x100, %eax            # imm = 0x100
jg 0x193c
cmpl $0x101, %ecx            # imm = 0x101
jge 0x193c
leaq -0x117(%rip), %rsi      # 0x1735
movl $0xb, %edi
callq 0x10e0
cmpq $-0x1, %rax
je 0x1961
leaq -0x100(%rip), %rsi      # 0x1767
movl $0xe, %edi
callq 0x10e0
cmpq $-0x1, %rax
je 0x1966
movl $0x78, %edi
callq 0x10a0
movl $0x5, %edi
movl $0x1, %esi
movl $0x5, %edx
callq 0x12ec
movl 0x6851(%rip), %esi      # 0x80f0
cmpl $-0x1, %esi
je 0x18dc
movzbl 0x6b09(%rip), %edx      # 0x83b4
movl 0x6843(%rip), %ecx      # 0x80f4
leaq 0x4aef(%rip), %rdi      # 0x63a7
xorl %eax, %eax
callq 0x1070
movzbl 0x6aee(%rip), %esi      # 0x83b4
movl 0x6828(%rip), %edx      # 0x80f4
leaq 0x4b1a(%rip), %rdi      # 0x63ed
xorl %eax, %eax
callq 0x1070
jmp 0x1909
leaq 0x4b8a(%rip), %rdi      # 0x646d
callq 0x1040
leaq 0x4a7b(%rip), %rdi      # 0x636a
leaq 0x470e(%rip), %rsi      # 0x6004
xorl %eax, %eax
callq 0x1070
leaq 0x4ba4(%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 0x194f
movq %rbx, %rdi
callq 0x16d0
xorl %edi, %edi
callq 0x1170
leaq 0x4b8b(%rip), %rdi      # 0x64c0
callq 0x1040
jmp 0x194f
leaq 0x49ea(%rip), %rdi      # 0x632d
movl $0x100, %esi            # imm = 0x100
xorl %eax, %eax
callq 0x1070
movq %rbx, %rdi
callq 0x16d0
movl $0x1, %edi
callq 0x1170
callq 0x11d5
callq 0x11b0
nop