// File: /workspace/github_cpp_makefile_star2_O2/gulamf[P]NRF24LE1Flash/main.cpp
// Function: CheckUC()
bool CheckUC()
{
    string s = port;
    BLCommandReturnType blCommandReturnVal;


    if (resetpin == blenabled)
    {
        cout << "Reset and bootloader enable pins cannot be the same!\n";
        return false;
    }

    //begin start bootloader
    blCommandReturnVal = ExecuteCommandStartBootloader();

    if (blCommandReturnVal == BLCommandReturnType_SerialPortFailure)
    {
        cout << "Error: Could not open COM port!\n";
        return false;
    }
    else if (blCommandReturnVal != BLCommandReturnType_OK)
    {
        cout << "Error: Device not connected!\n";
        return false;
    }
    //end start	bootloader

    //begin device id check
    uint16_t devId = 0;

    blCommandReturnVal = ExecuteCommandGetDevID(&devId);

    if (blCommandReturnVal != BLCommandReturnType_OK)
    {
        cout << "Lost communications with device!\n";
        return false;
    }
    //end device id check

    //begin bootloader version check
    unsigned char blVersion = 0;

    blCommandReturnVal = ExecuteCommandGetBLVersion(&blVersion);

    if (blCommandReturnVal != BLCommandReturnType_OK)
    {
        cout << "Lost communications with device!\n";
        return false;
    }
    //end device id check

    //begin exit bootloader only
    blCommandReturnVal = ExecuteCommandExitBootloader();

    if (blCommandReturnVal != BLCommandReturnType_OK)
    {
        cout<< "Lost communications with device!\n";
        return false;
    }
    //end exit bootloader

    //If we have made it this far, then everything went to plan, so update the microcontroller type and bootloader version textboxes
    cout << ConvertBLDevIDToString(devId);
    cout << "Device found!\n";

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x48, %rsp
leaq 0x5b4f(%rip), %rsi      # 0x92f0
leaq -0x50(%rbp), %rdi
callq 0x22a0
movl 0x5a54(%rip), %eax      # 0x9204
cmpl 0x5b5a(%rip), %eax      # 0x9310
jne 0x37c1
leaq 0x2d04(%rip), %rsi      # 0x64c3
jmp 0x3805
callq 0x35a4
testl %eax, %eax
je 0x37d8
cmpl $0x3, %eax
jne 0x37fe
leaq 0x2d23(%rip), %rsi      # 0x64f9
jmp 0x3805
leaq -0xa(%rbp), %rdi
andw $0x0, (%rdi)
callq 0x35d0
testl %eax, %eax
je 0x3825
movq 0x57e8(%rip), %rdi      # 0x8fd8
leaq 0x2d41(%rip), %rsi      # 0x6538
callq 0x2200
jmp 0x3811
leaq 0x2d15(%rip), %rsi      # 0x651a
movq 0x57cc(%rip), %rdi      # 0x8fd8
callq 0x2200
xorl %ebx, %ebx
leaq -0x50(%rbp), %rdi
callq 0x23e8
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %rbp
retq
leaq -0xb(%rbp), %rdi
movb $0x0, (%rdi)
callq 0x363e
testl %eax, %eax
jne 0x383e
callq 0x367b
testl %eax, %eax
je 0x3853
movq 0x5793(%rip), %rdi      # 0x8fd8
leaq 0x2cec(%rip), %rsi      # 0x6538
callq 0x2200
jmp 0x3811
movzwl -0xa(%rbp), %esi
leaq -0x30(%rbp), %rdi
callq 0x3699
movq 0x5771(%rip), %rdi      # 0x8fd8
leaq -0x30(%rbp), %rsi
callq 0x21e0
leaq -0x30(%rbp), %rdi
callq 0x23e8
movb $0x1, %bl
movq 0x5756(%rip), %rdi      # 0x8fd8
leaq 0x2cd1(%rip), %rsi      # 0x655a
callq 0x2200
jmp 0x3813
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x23e8
jmp 0x38a7
jmp 0x38a4
jmp 0x38a4
jmp 0x38a4
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x23e8
movq %rbx, %rdi
callq 0x2370