// File: martinferianc[P]CPUSimulator-EIE2/src/shared/mips_test_framework.cpp
// Function: mips_test_begin_test
int mips_test_begin_test(const char *instruction)
{
    if(!sg_started){
        fprintf(stderr, "Error:mips_test_begin_test - Test suite has not been started with mips_test_begin_suite.\n");
        exit(1);
    }
    
    if(sg_tests.size()>0){
        if(sg_tests.back().status == -1){
            fprintf(stderr, "Error:mips_test_begin_test - Attempt to start new test of '%s', but previous test with id %u has not been completed.\n", instruction, sg_tests.back().testId);
            exit(1);
        }
    }
    
    int testId=sg_tests.size();
    
    test_info_t info;
    info.testId=testId;
    
    info.instruction=instruction; // We want the string in upper case (shouting!)
    std::transform(info.instruction.begin(), info.instruction.end(), info.instruction.begin(), ::toupper);
    
    if(sg_knownInstructions.find(info.instruction)==sg_knownInstructions.end()){
        fprintf(stderr, "Warning:mips_test_begin_test - Unknown instruction '%s', might want to check the spelling.\n", instruction);
    }
    
    info.status=-1;
    sg_tests.push_back(info);
    
    return testId;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
testb $0x1, 0x15a4a(%rip)     # 0x192b0
jne 0x388a
movq 0x15761(%rip), %rax     # 0x18fd0
movq (%rax), %rdi
leaq 0xe7da(%rip), %rsi      # 0x12053
movb $0x0, %al
callq 0x33c0
movl $0x1, %edi
callq 0x3320
leaq 0x159d7(%rip), %rdi     # 0x19268
callq 0x4300
cmpq $0x0, %rax
jbe 0x3900
leaq 0x159c5(%rip), %rdi     # 0x19268
callq 0x4330
cmpl $-0x1, 0x28(%rax)
jne 0x38fe
movq 0x1571b(%rip), %rax     # 0x18fd0
movq (%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq 0x15997(%rip), %rdi     # 0x19268
callq 0x4330
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rdx
movl (%rax), %ecx
leaq 0xe7c0(%rip), %rsi      # 0x120ad
movb $0x0, %al
callq 0x33c0
movl $0x1, %edi
callq 0x3320
jmp 0x3900
leaq 0x15961(%rip), %rdi     # 0x19268
callq 0x4300
movl %eax, -0xc(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x4370
movl -0xc(%rbp), %eax
movl %eax, -0x60(%rbp)
movq -0x8(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x33a0
jmp 0x392d
leaq -0x58(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x3220
movq -0xc0(%rbp), %rdi
movq %rax, -0x78(%rbp)
callq 0x3150
movq -0xc0(%rbp), %rdi
movq %rax, -0x80(%rbp)
callq 0x3220
movq %rax, -0x88(%rbp)
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq -0x88(%rbp), %rdx
movq 0x15666(%rip), %rcx     # 0x18fe0
callq 0x43a0
movq %rax, -0xb8(%rbp)
jmp 0x3988
movq -0xb8(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x58(%rbp), %rsi
leaq 0x158df(%rip), %rdi     # 0x19280
callq 0x4450
movq %rax, -0xc8(%rbp)
jmp 0x39af
movq -0xc8(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq 0x158bc(%rip), %rdi     # 0x19280
callq 0x4490
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x4420
testb $0x1, %al
jne 0x39e9
jmp 0x3a1e
movq 0x155e0(%rip), %rax     # 0x18fd0
movq (%rax), %rdi
movq -0x8(%rbp), %rdx
leaq 0xe725(%rip), %rsi      # 0x12123
movb $0x0, %al
callq 0x33c0
jmp 0x3a1e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x4530
jmp 0x3a58
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
leaq 0x1583c(%rip), %rdi     # 0x19268
leaq -0x60(%rbp), %rsi
callq 0x44c0
jmp 0x3a37
movl -0xc(%rbp), %eax
movl %eax, -0xcc(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x4530
movl -0xcc(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x3440
nopw %cs:(%rax,%rax)