// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x4b6c(%rip), %rdx      # 0x6390
callq 0x1130
movb %al, -0x11(%rbp)
movsbl %al, %eax
cmpl $-0x1, %eax
je 0x18ac
movsbl -0x11(%rbp), %eax
movl %eax, -0x18(%rbp)
subl $0x4d, %eax
je 0x1856
jmp 0x1842
movl -0x18(%rbp), %eax
subl $0x4e, %eax
je 0x186d
jmp 0x184c
movl -0x18(%rbp), %eax
subl $0x68, %eax
je 0x1884
jmp 0x1894
movq 0x677b(%rip), %rax      # 0x7fd8
movq (%rax), %rdi
callq 0x1140
movl %eax, 0x6b29(%rip)      # 0x8394
jmp 0x18a7
movq 0x6764(%rip), %rax      # 0x7fd8
movq (%rax), %rdi
callq 0x1140
movl %eax, 0x6b16(%rip)      # 0x8398
jmp 0x18a7
movq -0x10(%rbp), %rdi
callq 0x1700
xorl %edi, %edi
callq 0x1160
movq -0x10(%rbp), %rdi
callq 0x1700
movl $0x1, %edi
callq 0x1160
jmp 0x1816
cmpl $0x0, 0x6ae1(%rip)      # 0x8394
je 0x18be
cmpl $0x0, 0x6adc(%rip)      # 0x8398
jne 0x18df
leaq 0x4ad1(%rip), %rdi      # 0x6396
movb $0x0, %al
callq 0x1060
movq -0x10(%rbp), %rdi
callq 0x1700
movl $0x1, %edi
callq 0x1160
cmpl $0x100, 0x6aab(%rip)    # imm = 0x100
jg 0x18f7
cmpl $0x100, 0x6aa3(%rip)    # imm = 0x100
jle 0x191d
leaq 0x4aba(%rip), %rdi      # 0x63b8
movl $0x100, %esi            # imm = 0x100
movb $0x0, %al
callq 0x1060
movq -0x10(%rbp), %rdi
callq 0x1700
movl $0x1, %edi
callq 0x1160
movl $0xb, %edi
leaq -0x1a9(%rip), %rsi      # 0x1780
callq 0x10d0
movq $-0x1, %rcx
cmpq %rcx, %rax
jne 0x195c
movq 0x66b7(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
leaq 0x4a87(%rip), %rsi      # 0x63d2
movb $0x0, %al
callq 0x10e0
movl $0x1, %edi
callq 0x1160
movl $0xe, %edi
leaq -0x1a8(%rip), %rsi      # 0x17c0
callq 0x10d0
movq $-0x1, %rcx
cmpq %rcx, %rax
jne 0x199b
movq 0x6678(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
leaq 0x4a48(%rip), %rsi      # 0x63d2
movb $0x0, %al
callq 0x10e0
movl $0x1, %edi
callq 0x1160
movl $0x78, %edi
callq 0x1090
movl $0x5, %edx
movl $0x1, %esi
movl %edx, %edi
callq 0x1280
cmpl $-0x1, 0x6713(%rip)     # 0x80d0
jne 0x19f2
leaq 0x4a2f(%rip), %rdi      # 0x63f5
movb $0x0, %al
callq 0x1060
leaq 0x4a5d(%rip), %rdi      # 0x6431
leaq 0x4629(%rip), %rsi      # 0x6004
movb $0x0, %al
callq 0x1060
leaq 0x4a85(%rip), %rdi      # 0x646e
movb $0x0, %al
callq 0x1060
jmp 0x1a2c
movl 0x66d8(%rip), %esi      # 0x80d0
movl 0x66d6(%rip), %edx      # 0x80d4
movl 0x66d4(%rip), %ecx      # 0x80d8
leaq 0x4a7c(%rip), %rdi      # 0x6487
movb $0x0, %al
callq 0x1060
movl 0x66bc(%rip), %esi      # 0x80d4
movl 0x66ba(%rip), %edx      # 0x80d8
leaq 0x4aa8(%rip), %rdi      # 0x64cd
movb $0x0, %al
callq 0x1060
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop