// File: /workspace/github_cpp_makefile_star2_O1/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 %r14
pushq %rbx
subq $0x50, %rsp
leaq -0x48(%rbp), %r14
movq %r14, -0x10(%r14)
movq 0x762a(%rip), %rsi      # 0xb2f0
movq 0x762b(%rip), %rdx      # 0xb2f8
addq %rsi, %rdx
leaq -0x58(%rbp), %rdi
callq 0x5dd2
movl 0x751d(%rip), %eax      # 0xb1fc
cmpl 0x762b(%rip), %eax      # 0xb310
jne 0x3cf5
movl $0x35, %edx
leaq 0x47e5(%rip), %rsi      # 0x84d8
jmp 0x3d49
callq 0x3941
testl %eax, %eax
je 0x3d11
cmpl $0x3, %eax
jne 0x3d3d
movl $0x20, %edx
leaq 0x47ff(%rip), %rsi      # 0x850e
jmp 0x3d49
leaq -0x12(%rbp), %rdi
movw $0x0, (%rdi)
callq 0x3996
testl %eax, %eax
je 0x3d77
movq 0x72ae(%rip), %rdi      # 0xafd8
leaq 0x481c(%rip), %rsi      # 0x854d
movl $0x21, %edx
callq 0x2270
jmp 0x3d55
movl $0x1d, %edx
leaq 0x47e6(%rip), %rsi      # 0x852f
movq 0x7288(%rip), %rdi      # 0xafd8
callq 0x2270
xorl %ebx, %ebx
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
je 0x3d6c
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x2220
movl %ebx, %eax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq -0x13(%rbp), %rdi
movb $0x0, (%rdi)
callq 0x3a17
testl %eax, %eax
jne 0x3d90
callq 0x3a6d
testl %eax, %eax
je 0x3daa
movq 0x7241(%rip), %rdi      # 0xafd8
leaq 0x47af(%rip), %rsi      # 0x854d
movl $0x21, %edx
callq 0x2270
jmp 0x3d55
movzwl -0x12(%rbp), %esi
leaq -0x38(%rbp), %rdi
callq 0x3aad
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq 0x7212(%rip), %rdi      # 0xafd8
callq 0x2270
leaq -0x28(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3de4
movq -0x28(%rbp), %rsi
incq %rsi
callq 0x2220
movb $0x1, %bl
movq 0x71eb(%rip), %rdi      # 0xafd8
leaq 0x477b(%rip), %rsi      # 0x856f
movl $0xe, %edx
callq 0x2270
jmp 0x3d57
movq %rax, %rbx
leaq -0x28(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3e2a
movq -0x28(%rbp), %rsi
incq %rsi
callq 0x2220
jmp 0x3e2a
jmp 0x3e27
jmp 0x3e27
jmp 0x3e27
movq %rax, %rbx
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
je 0x3e3f
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x2220
movq %rbx, %rdi
callq 0x2380