LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/main.c
// Function: main
int main(void) {

//  Uncomment to read SX1262 registers
//  #define READ_REGISTERS
#ifdef READ_REGISTERS
    //  Read SX1262 registers 0x00 to 0x0F
    read_registers();
#endif  //  READ_REGISTERS

    //  TODO: Create a Background Thread to handle LoRa Events
    create_task();

    //  Init SX1262 driver
    init_driver();

    //  TODO: Do we need to wait?
    sleep(1);

//  Uncomment to send a LoRa message
//  #define SEND_MESSAGE
#ifdef SEND_MESSAGE
    //  Send a LoRa message
    send_message();
#endif  //  SEND_MESSAGE

//  Uncomment to receive a LoRa message
#define RECEIVE_MESSAGE
#ifdef RECEIVE_MESSAGE
    //  Handle LoRa events for the next 10 seconds
    for (int i = 0; i < 10; i++) {
        //  Prepare to receive a LoRa message
        receive_message();

        //  Process the received LoRa message, if any
        RadioOnDioIrq(NULL);
        
        //  Sleep for 1 second
        usleep(1000 * 1000);
    }
#endif  //  RECEIVE_MESSAGE

    //  TODO: Close the SPI Bus
    //  close(spi);
    puts("Done!");
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
leaq 0x37da(%rip), %rdi      # 0x6092
callq 0x2280
leaq 0x790c(%rip), %rdi      # 0xa1d0
callq 0x2434
leaq 0x7908(%rip), %rdi      # 0xa1d8
leaq 0x230(%rip), %rsi       # 0x2b07
xorl %edx, %edx
callq 0x24ed
leaq 0x378b(%rip), %rdi      # 0x6070
callq 0x2280
xorps %xmm0, %xmm0
leaq -0x60(%rbp), %rdi
movups %xmm0, 0x38(%rdi)
movups %xmm0, 0x28(%rdi)
leaq 0xf2(%rip), %rax        # 0x29f2
movq %rax, (%rdi)
leaq 0x109(%rip), %rax       # 0x2a13
movq %rax, 0x10(%rdi)
leaq 0x18d(%rip), %rax       # 0x2aa2
movq %rax, 0x8(%rdi)
leaq 0x1a4(%rip), %rax       # 0x2ac4
movq %rax, 0x18(%rdi)
leaq 0x1bb(%rip), %rax       # 0x2ae6
movq %rax, 0x20(%rdi)
leaq 0x73da(%rip), %r15      # 0x9d10
callq *(%r15)
movl $0x3703dcc0, %edi       # imm = 0x3703DCC0
callq *0x18(%r15)
subq $0x8, %rsp
pushq $0x1
popq %rbx
pushq $0xe
popq %rsi
pushq $0x7
popq %r14
movl %ebx, %edi
xorl %edx, %edx
xorl %ecx, %ecx
movl %r14d, %r8d
movl %ebx, %r9d
pushq $0xbb8                  # imm = 0xBB8
pushq $0x0
pushq $0x0
pushq $0x0
pushq %rbx
pushq $0x0
pushq $0x8
callq *0x38(%r15)
addq $0x40, %rsp
pushq $0x8
popq %r9
movl %ebx, %edi
xorl %esi, %esi
movl %r14d, %edx
movl %ebx, %ecx
xorl %r8d, %r8d
pushq %rbx
pushq $0x0
pushq $0x0
pushq $0x0
pushq %rbx
pushq $0x0
pushq $0x0
pushq $0x5
callq *0x30(%r15)
addq $0x40, %rsp
movl %ebx, %edi
callq 0x2120
movq 0x68(%r15), %r14
pushq $0xa
popq %r15
leaq 0x36d2(%rip), %rbx      # 0x6082
subl $0x1, %r15d
jb 0x29d9
movq %rbx, %rdi
callq 0x2280
movl $0x2710, %edi           # imm = 0x2710
callq *%r14
xorl %edi, %edi
callq 0x3a54
movl $0xf4240, %edi          # imm = 0xF4240
callq 0x2210
jmp 0x29b0
leaq 0x368a(%rip), %rdi      # 0x606a
callq 0x2280
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/main.c
// Function: on_rx_done
static void on_rx_done(
    uint8_t *payload,  //  Buffer containing received LoRa message
    uint16_t size,     //  Size of the LoRa message
    int16_t rssi,      //  Signal strength
    int8_t snr)        //  Signal To Noise ratio
{
    printf("Rx done: \r\n");

    //  Switch the LoRa Transceiver to low power, sleep mode
    Radio.Sleep();

    //  Copy the received packet
    if (size > sizeof loraping_buffer) {
        size = sizeof loraping_buffer;
    }
    loraping_rx_size = size;
    memcpy(loraping_buffer, payload, size);

    //  Log the signal strength, signal to noise ratio
    //  TODO: loraping_rxinfo_rxed(rssi, snr);

    //  Dump the contents of the received packet
    for (int i = 0; i < loraping_rx_size; i++) {
        printf("%02x ", loraping_buffer[i]);
    }
    printf("\r\n");

    //  TODO: Send a "PING" or "PONG" LoRa message
    //  os_eventq_put(os_eventq_dflt_get(), &loraping_ev_tx);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
leaq 0x368a(%rip), %rdi      # 0x60b4
callq 0x2280
leaq 0x72da(%rip), %rax      # 0x9d10
callq *0x58(%rax)
cmpw $0x40, %bx
pushq $0x40
popq %r15
cmovbl %ebx, %r15d
movl %r15d, 0x77a4(%rip)     # 0xa1f0
leaq 0x77ad(%rip), %rbx      # 0xa200
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2150
leaq 0x3614(%rip), %r14      # 0x607c
xorl %r12d, %r12d
movslq %r15d, %rax
cmpq %rax, %r12
jge 0x2a8e
movzbl (%r12,%rbx), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x2050
incq %r12
movl 0x7764(%rip), %r15d     # 0xa1f0
jmp 0x2a6b
leaq 0x3628(%rip), %rdi      # 0x60bd
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2280
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/radio.c
// Function: RadioInit
void RadioInit( RadioEvents_t *events )
{
    ////  We copy the Event Callbacks from "events", because
    ////  "events" may be stored on the stack
    assert(events != NULL);
    memcpy(&RadioEvents, events, sizeof(RadioEvents));

    ////  Previously: RadioEvents = events;

    SX126xInit( RadioOnDioIrq );
    SX126xSetStandby( STDBY_RC );

    ////  TODO: Declare the power regulation used to power the device
    ////  This command allows the user to specify if DC-DC or LDO is used for power regulation.
    ////  Using only LDO implies that the Rx or Tx current is doubled

    //// #warning SX126x is set to LDO power regulator mode (instead of DC-DC)
    //// SX126xSetRegulatorMode( USE_LDO );   ////  Default: Use LDO

    //// #warning SX126x is set to DC-DC power regulator mode (instead of LDO)
    SX126xSetRegulatorMode( USE_DCDC );  ////  Use DC-DC

    SX126xSetBufferBaseAddress( 0x00, 0x00 );
    ////TODO: SX126xSetTxParams( 0, RADIO_RAMP_200_US );
    SX126xSetTxParams( 22, RADIO_RAMP_3400_US ); //// TODO
    SX126xSetDioIrqParams( IRQ_RADIO_ALL, IRQ_RADIO_ALL, IRQ_RADIO_NONE, IRQ_RADIO_NONE );

    // Add registers to the retention list (4 is the maximum possible number)
    RadioAddRegisterToRetentionList( REG_RX_GAIN );
    RadioAddRegisterToRetentionList( REG_TX_MODULATION );

    // Initialize driver timeout timers
    TimerInit( &TxTimeoutTimer, RadioOnTxTimeoutIrq );
    TimerInit( &RxTimeoutTimer, RadioOnRxTimeoutIrq );

    IrqFired = false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testq %rdi, %rdi
je 0x2bc6
movq %rdi, %rsi
leaq 0x7715(%rip), %rdi      # 0xa250
pushq $0x9
popq %rcx
rep  movsq (%rsi), %es:(%rdi)
leaq 0xf0c(%rip), %rdi       # 0x3a54
callq 0x3b84
xorl %edi, %edi
callq 0x3bc5
pushq $0x1
popq %rdi
callq 0x4090
xorl %edi, %edi
xorl %esi, %esi
callq 0x45ed
pushq $0x16
popq %rdi
pushq $0x7
popq %rsi
callq 0x4313
movl $0xffff, %edi           # imm = 0xFFFF
movl $0xffff, %esi           # imm = 0xFFFF
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x41c9
movl $0x8ac, %edi            # imm = 0x8AC
callq 0x3a71
movl $0x889, %edi            # imm = 0x889
callq 0x3a71
leaq 0x76fa(%rip), %rdi      # 0xa298
leaq 0xf3d(%rip), %rsi       # 0x3ae2
callq 0x4d99
leaq 0x771f(%rip), %rdi      # 0xa2d0
leaq 0xf4b(%rip), %rsi       # 0x3b03
callq 0x4d99
movb $0x0, 0x7685(%rip)      # 0xa249
popq %rbp
retq
leaq 0x361f(%rip), %rdi      # 0x61ec
leaq 0x3627(%rip), %rsi      # 0x61fb
leaq 0x362c(%rip), %rcx      # 0x6207
movl $0x20f, %edx            # imm = 0x20F
callq 0x2100
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/radio.c
// Function: RadioSetModem
void RadioSetModem( RadioModems_t modem )
{
    printf("RadioSetModem\r\n");
    switch( modem )
    {
    default:
    case MODEM_FSK:
        SX126xSetPacketType( PACKET_TYPE_GFSK );
        // When switching to GFSK mode the LoRa SyncWord register value is reset
        // Thus, we also reset the RadioPublicNetwork variable
        RadioPublicNetwork.Current = false;
        break;
    case MODEM_LORA:
        SX126xSetPacketType( PACKET_TYPE_LORA );
        // Public/Private network register is reset when switching modems
        if( RadioPublicNetwork.Current != RadioPublicNetwork.Previous )
        {
            RadioPublicNetwork.Current = RadioPublicNetwork.Previous;
            RadioSetPublicNetwork( RadioPublicNetwork.Current );
        }
        break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
leaq 0x3938(%rip), %rdi      # 0x654f
callq 0x2280
cmpl $0x1, %ebx
jne 0x2c4b
pushq $0x1
popq %rdi
callq 0x42ec
movb 0x76d9(%rip), %al       # 0xa308
cmpb %al, 0x76d4(%rip)       # 0xa309
je 0x2c59
movb %al, 0x76cc(%rip)       # 0xa309
movzbl %al, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x3730
xorl %edi, %edi
callq 0x42ec
movb $0x0, 0x76b0(%rip)      # 0xa309
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/radio.c
// Function: RadioIsChannelFree
bool RadioIsChannelFree( uint32_t freq, uint32_t rxBandwidth, int16_t rssiThresh, uint32_t maxCarrierSenseTime )
{
    printf("RadioIsChannelFree: freq=%d, rxBandwidth=%d\r\n", (int) freq, (int) rxBandwidth);
    bool     status           = true;
    int16_t  rssi             = 0;
    uint32_t carrierSenseTime = 0;

    RadioSetModem( MODEM_FSK );

    RadioSetChannel( freq );

    // Set Rx bandwidth. Other parameters are not used.
    RadioSetRxConfig( MODEM_FSK, rxBandwidth, 600, 0, rxBandwidth, 3, 0, false,
                      0, false, 0, 0, false, true );
    RadioRx( 0 );

    DelayMs( 1 );

    carrierSenseTime = TimerGetCurrentTime( );
    printf("RadioIsChannelFree: carrierSenseTime=%d, elapsed=%d, maxCarrierSenseTime=%d\r\n", (int) carrierSenseTime, (int) TimerGetElapsedTime( carrierSenseTime ), (int) maxCarrierSenseTime);

    // Perform carrier sense for maxCarrierSenseTime
    while( TimerGetElapsedTime( carrierSenseTime ) < maxCarrierSenseTime )
    {
        rssi = RadioRssi( MODEM_FSK );

        if( rssi > rssiThresh )
        {
            status = false;
            break;
        }
    }
    RadioSleep( );
    printf("RadioIsChannelFree done\r\n");
    return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebx
movl %edx, %r14d
movl %esi, %r15d
movl %edi, %r12d
leaq 0x35a0(%rip), %rdi      # 0x6242
movl %r12d, %esi
movl %r15d, %edx
xorl %eax, %eax
callq 0x2050
xorl %edi, %edi
callq 0x2c08
movl %r12d, %edi
callq 0x2c60
pushq $0x3
popq %r9
xorl %edi, %edi
movl %r15d, %esi
movl $0x258, %edx            # imm = 0x258
xorl %ecx, %ecx
pushq $0x1
pushq $0x0
pushq $0x0
pushq $0x0
pushq $0x0
pushq $0x0
pushq $0x0
pushq $0x0
callq 0x2d78
addq $0x40, %rsp
xorl %edi, %edi
callq 0x3606
pushq $0x1
popq %rdi
callq 0x4ef1
callq 0x4f08
movl %eax, %r15d
movl %eax, %edi
callq 0x4f2b
leaq 0x3564(%rip), %rdi      # 0x6270
movl %r15d, %esi
movl %eax, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x2050
movl %r15d, %edi
callq 0x4f2b
movl %eax, %r12d
cmpl %ebx, %eax
jae 0x2d37
callq 0x462c
movsbl %al, %eax
cmpw %r14w, %ax
jle 0x2d1a
cmpl %ebx, %r12d
setae %bl
callq 0x35cd
leaq 0x3815(%rip), %rdi      # 0x655e
callq 0x2280
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/radio.c
// Function: RadioSend
void RadioSend( uint8_t *buffer, uint8_t size )
{
    printf("RadioSend: size=%d\r\n", (int) size);
    for (int i = 0; i < size; i++) {
        printf("%02x ", buffer[i]);
    }
    printf("\r\n");

    SX126xSetDioIrqParams( IRQ_TX_DONE | IRQ_RX_TX_TIMEOUT,
                           IRQ_TX_DONE | IRQ_RX_TX_TIMEOUT,
                           IRQ_RADIO_NONE,
                           IRQ_RADIO_NONE );

    if( SX126xGetPacketType( ) == PACKET_TYPE_LORA )
    {
        SX126x.PacketParams.Params.LoRa.PayloadLength = size;
    }
    else
    {
        SX126x.PacketParams.Params.Gfsk.PayloadLength = size;
    }

    //// TODO
    printf("RadioSend: PreambleLength=%d, HeaderType=%d, PayloadLength=%d, CrcMode=%d, InvertIQ=%d\r\n", (int) SX126x.PacketParams.Params.LoRa.PreambleLength, (int) SX126x.PacketParams.Params.LoRa.HeaderType, (int) SX126x.PacketParams.Params.LoRa.PayloadLength, (int) SX126x.PacketParams.Params.LoRa.CrcMode, (int) SX126x.PacketParams.Params.LoRa.InvertIQ); //// TODO

    SX126xSetPacketParams( &SX126x.PacketParams );

    SX126xSendPayload( buffer, size, 0 );
    TimerStart( &TxTimeoutTimer, TxTimeout );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
movl %esi, -0x2c(%rbp)
leaq 0x2f21(%rip), %rdi      # 0x641b
xorl %eax, %eax
callq 0x2050
movl %r14d, %r13d
leaq 0x2b71(%rip), %r12      # 0x607c
xorl %r15d, %r15d
cmpq %r15, %r13
je 0x3527
movzbl (%rbx,%r15), %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x2050
incq %r15
jmp 0x350e
leaq 0x2b8f(%rip), %rdi      # 0x60bd
callq 0x2280
movl $0x201, %edi            # imm = 0x201
movl $0x201, %esi            # imm = 0x201
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x41c9
callq 0x3d61
cmpl $0x1, %eax
jne 0x355c
movb %r14b, 0x6de9(%rip)     # 0xa340
movl -0x2c(%rbp), %ecx
jmp 0x356a
movb %r14b, 0x6dc9(%rip)     # 0xa32c
movzbl 0x6dd6(%rip), %ecx      # 0xa340
movzwl 0x6dc7(%rip), %esi      # 0xa338
movl 0x6dc5(%rip), %edx      # 0xa33c
movl 0x6dc6(%rip), %r8d      # 0xa344
movl 0x6dc3(%rip), %r9d      # 0xa348
leaq 0x2ea4(%rip), %rdi      # 0x6430
xorl %eax, %eax
callq 0x2050
leaq 0x6d7a(%rip), %rdi      # 0xa314
callq 0x449d
movzbl %r14b, %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3cca
movl 0x6c8d(%rip), %esi      # 0xa240
leaq 0x6cde(%rip), %rdi      # 0xa298
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4e6c
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/radio.c
// Function: RadioRx
void RadioRx( uint32_t timeout )
{
    printf("RadioRx\r\n");
    SX126xSetDioIrqParams( IRQ_RADIO_ALL, //IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT,
                           IRQ_RADIO_ALL, //IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT,
                           IRQ_RADIO_NONE,
                           IRQ_RADIO_NONE );

    if( timeout != 0 )
    {
        TimerStart( &RxTimeoutTimer, timeout );
    }

    if( RxContinuous == true )
    {
        SX126xSetRx( 0xFFFFFF ); // Rx Continuous
    }
    else
    {
        SX126xSetRx( RxTimeout << 6 );
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
leaq 0x2fa5(%rip), %rdi      # 0x65ba
callq 0x2280
movl $0xffff, %edi           # imm = 0xFFFF
movl $0xffff, %esi           # imm = 0xFFFF
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x41c9
testl %ebx, %ebx
je 0x363f
leaq 0x6c98(%rip), %rdi      # 0xa2d0
movl %ebx, %esi
callq 0x4e6c
movl 0x6bff(%rip), %eax      # 0xa244
shll $0x6, %eax
cmpb $0x0, 0x6bf9(%rip)      # 0xa248
movl $0xffffff, %edi         # imm = 0xFFFFFF
cmovel %eax, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x3e78
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/radio.c
// Function: RadioSetTxContinuousWave
void RadioSetTxContinuousWave( uint32_t freq, int8_t power, uint16_t time )
{
    uint32_t timeout = ( uint32_t )time * 1000;

    SX126xSetRfFrequency( freq );
    SX126xSetRfTxPower( power );
    SX126xSetTxContinuousWave( );

    TimerStart( &TxTimeoutTimer, timeout );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
imull $0x3e8, %edx, %r14d     # imm = 0x3E8
callq 0x427e
movl %ebx, %edi
callq 0x4d39
callq 0x3fbb
leaq 0x6bf1(%rip), %rdi      # 0xa298
movl %r14d, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x4e6c
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/radio.c
// Function: RadioSetPublicNetwork
void RadioSetPublicNetwork( bool enable )
{
    RadioPublicNetwork.Current = RadioPublicNetwork.Previous = enable;

    RadioSetModem( MODEM_LORA );
    if( enable == true )
    {
        printf("RadioSetPublicNetwork: public syncword=%x\r\n", LORA_MAC_PUBLIC_SYNCWORD); //// TODO
        // Change LoRa modem SyncWord
        SX126xWriteRegister( REG_LR_SYNCWORD, ( LORA_MAC_PUBLIC_SYNCWORD >> 8 ) & 0xFF );
        SX126xWriteRegister( REG_LR_SYNCWORD + 1, LORA_MAC_PUBLIC_SYNCWORD & 0xFF );
    }
    else
    {
        printf("RadioSetPublicNetwork: private syncword=%x\r\n", LORA_MAC_PRIVATE_SYNCWORD); //// TODO
        // Change LoRa modem SyncWord
        SX126xWriteRegister( REG_LR_SYNCWORD, ( LORA_MAC_PRIVATE_SYNCWORD >> 8 ) & 0xFF );
        SX126xWriteRegister( REG_LR_SYNCWORD + 1, LORA_MAC_PRIVATE_SYNCWORD & 0xFF );
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
movb %bl, 0x6bca(%rip)       # 0xa308
movb %bl, 0x6bc5(%rip)       # 0xa309
pushq $0x1
popq %rdi
callq 0x2c08
testl %ebx, %ebx
je 0x3769
leaq 0x2d32(%rip), %rdi      # 0x6489
movl $0x3444, %esi           # imm = 0x3444
xorl %eax, %eax
callq 0x2050
movb $0x44, %bl
movb $0x34, %al
jmp 0x3780
leaq 0x2d45(%rip), %rdi      # 0x64b5
movl $0x1424, %esi           # imm = 0x1424
xorl %eax, %eax
callq 0x2050
movb $0x24, %bl
movb $0x14, %al
movzbl %al, %esi
movl $0x740, %edi            # imm = 0x740
callq 0x4c2e
movzbl %bl, %esi
movl $0x741, %edi            # imm = 0x741
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x4c2e
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/radio.c
// Function: RadioRxBoosted
void RadioRxBoosted( uint32_t timeout )
{
    SX126xSetDioIrqParams( IRQ_RADIO_ALL, //IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT,
                           IRQ_RADIO_ALL, //IRQ_RX_DONE | IRQ_RX_TX_TIMEOUT,
                           IRQ_RADIO_NONE,
                           IRQ_RADIO_NONE );

    if( timeout != 0 )
    {
        TimerStart( &RxTimeoutTimer, timeout );
    }

    if( RxContinuous == true )
    {
        SX126xSetRxBoosted( 0xFFFFFF ); // Rx Continuous
    }
    else
    {
        SX126xSetRxBoosted( RxTimeout << 6 );
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
movl $0xffff, %edi           # imm = 0xFFFF
movl $0xffff, %esi           # imm = 0xFFFF
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x41c9
testl %ebx, %ebx
je 0x3a27
leaq 0x68b0(%rip), %rdi      # 0xa2d0
movl %ebx, %esi
callq 0x4e6c
movl 0x6817(%rip), %eax      # 0xa244
shll $0x6, %eax
cmpb $0x0, 0x6811(%rip)      # 0xa248
movl $0xffffff, %edi         # imm = 0xFFFFFF
cmovel %eax, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x3f16
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/radio.c
// Function: RadioAddRegisterToRetentionList
void RadioAddRegisterToRetentionList( uint16_t registerAddress )
{
    uint8_t buffer[9];

    // Read the address and registers already added to the list
    SX126xReadRegisters( REG_RETENTION_LIST_BASE_ADDRESS, buffer, 9 );

    const uint8_t nbOfRegisters = buffer[0];
    uint8_t* registerList   = &buffer[1];

    // Check if the register given as parameter is already added to the list
    for( uint8_t i = 0; i < nbOfRegisters; i++ )
    {
        if( registerAddress == ( ( uint16_t ) registerList[2 * i] << 8 ) + registerList[2 * i + 1] )
        {
            return;
        }
    }

    if( nbOfRegisters < MAX_NB_REG_IN_RETENTION )
    {
        buffer[0] += 1;
        registerList[2 * nbOfRegisters]     = ( uint8_t )( registerAddress >> 8 );
        registerList[2 * nbOfRegisters + 1] = ( uint8_t )( registerAddress >> 0 );

        // Update radio with modified list
        SX126xWriteRegisters( REG_RETENTION_LIST_BASE_ADDRESS, buffer, 9 );
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
leaq -0x19(%rbp), %r14
pushq $0x9
popq %rdx
movl $0x29f, %edi            # imm = 0x29F
movq %r14, %rsi
callq 0x4c4e
movzbl (%r14), %eax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x3ab2
movzwl -0x18(%rbp,%rcx,2), %edx
rolw $0x8, %dx
movzwl %dx, %edx
incq %rcx
cmpl %ebx, %edx
jne 0x3a98
jmp 0x3ad9
cmpb $0x3, %al
ja 0x3ad9
leal 0x1(%rax), %ecx
leaq -0x19(%rbp), %rsi
movb %cl, (%rsi)
addl %eax, %eax
movb %bh, -0x18(%rbp,%rax)
movzbl %al, %eax
movb %bl, -0x17(%rbp,%rax)
pushq $0x9
popq %rdx
movl $0x29f, %edi            # imm = 0x29F
callq 0x4bec
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/radio.c
// Function: RadioGetFskBandwidthRegValue
static uint8_t RadioGetFskBandwidthRegValue( uint32_t bandwidth )
{
    uint8_t i;

    if( bandwidth == 0 )
    {
        return( 0x1F );
    }

    for( i = 0; i < ( sizeof( FskBandwidths ) / sizeof( FskBandwidth_t ) ) - 1; i++ )
    {
        if( ( bandwidth >= FskBandwidths[i].bandwidth ) && ( bandwidth < FskBandwidths[i + 1].bandwidth ) )
        {
            return FskBandwidths[i+1].RegValue;
        }
    }
    // ERROR: Value not found
    printf("RadioGetFskBandwidthRegValue: not found, bandwidth=%d\r\n", (int) bandwidth);
    assert(false);
    while( 1 );
}

// Assembly:
testl %edi, %edi
je 0x3b4e
movl %edi, %esi
xorl %eax, %eax
leaq 0x25fd(%rip), %rcx      # 0x6130
cmpq $0x15, %rax
je 0x3b51
cmpl %esi, (%rcx,%rax,8)
ja 0x3b44
cmpl %esi, 0x8(%rcx,%rax,8)
ja 0x3b49
incq %rax
jmp 0x3b33
movb 0xc(%rcx,%rax,8), %al
retq
movb $0x1f, %al
retq
pushq %rbp
movq %rsp, %rbp
leaq 0x2986(%rip), %rdi      # 0x64e2
xorl %eax, %eax
callq 0x2050
leaq 0x29b0(%rip), %rdi      # 0x651a
leaq 0x268a(%rip), %rsi      # 0x61fb
leaq 0x29a8(%rip), %rcx      # 0x6520
movl $0x207, %edx            # imm = 0x207
callq 0x2100
nop
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xInit
void SX126xInit( DioIrqHandler dioIrq )
{
    SX126xReset( );

    SX126xIoIrqInit( dioIrq );

    SX126xWakeup( );
    SX126xSetStandby( STDBY_RC );

    // Initialize TCXO control
    SX126xIoTcxoInit( );

    // Initialize RF switch control
    SX126xIoRfSwitchInit( );

    // Force image calibration
    ImageCalibrated = false;

    SX126xSetOperatingMode( MODE_STDBY_RC );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x48a9
movq %rbx, %rdi
callq 0x4844
callq 0x48d5
xorl %edi, %edi
callq 0x3bc5
callq 0x4871
callq 0x4882
movb $0x0, 0x68f1(%rip)      # 0xa4a8
pushq $0x1
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x489d
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xCheckDeviceReady
void SX126xCheckDeviceReady( void )
{
    if( ( SX126xGetOperatingMode( ) == MODE_SLEEP ) || ( SX126xGetOperatingMode( ) == MODE_RX_DC ) )
    {
        SX126xWakeup( );
        // Switch is turned off when device is in sleep mode and turned on is all other modes
        SX126xAntSwOn( );
    }
    SX126xWaitOnBusy( );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
callq 0x4891
testl %eax, %eax
je 0x3c0d
callq 0x4891
cmpl $0x6, %eax
jne 0x3c17
callq 0x48d5
callq 0x4d71
popq %rbp
jmp 0x48ba
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xGetPayload
uint8_t SX126xGetPayload( uint8_t *buffer, uint8_t *size,  uint8_t maxSize )
{
    uint8_t offset = 0;

    SX126xGetRxBufferStatus( size, &offset );
    if( *size > maxSize )
    {
        return 1;
    }
    SX126xReadBuffer( offset, buffer, *size );
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
leaq -0x19(%rbp), %rsi
movb $0x0, (%rsi)
movq %r15, %rdi
callq 0x3c76
movb (%r15), %cl
movb $0x1, %al
cmpb %r14b, %cl
ja 0x3c6b
movzbl -0x19(%rbp), %edi
movzbl %cl, %edx
movq %rbx, %rsi
callq 0x4cf4
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xGetRxBufferStatus
void SX126xGetRxBufferStatus( uint8_t *payloadLength, uint8_t *rxStartBufferPointer )
{
    uint8_t status[2];

    SX126xReadCommand( RADIO_GET_RXBUFFERSTATUS, status, 2 );

    // In case of LORA fixed header, the payloadLength is obtained by reading
    // the register REG_LR_PAYLOADLENGTH
    if( ( SX126xGetPacketType( ) == PACKET_TYPE_LORA ) && ( LoRaHeaderType == LORA_PACKET_FIXED_LENGTH ) )
    {
        *payloadLength = SX126xReadRegister( REG_LR_PAYLOADLENGTH );
    }
    else
    {
        *payloadLength = status[0];
    }
    *rxStartBufferPointer = status[1];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x13
popq %rdi
leaq -0x12(%rbp), %rsi
pushq $0x2
popq %rdx
callq 0x4a43
cmpl $0x1, 0x680f(%rip)      # 0xa4ac
jne 0x3cb6
movl 0x680b(%rip), %eax      # 0xa4b0
cmpl $0x1, %eax
jne 0x3cb6
movl $0x702, %edi            # imm = 0x702
callq 0x4c96
jmp 0x3cb9
movb -0x12(%rbp), %al
movb %al, (%r14)
movb -0x11(%rbp), %al
movb %al, (%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xSetTx
void SX126xSetTx( uint32_t timeout )
{
    uint8_t buf[3];

    SX126xSetOperatingMode( MODE_TX );

    buf[0] = ( uint8_t )( ( timeout >> 16 ) & 0xFF );
    buf[1] = ( uint8_t )( ( timeout >> 8 ) & 0xFF );
    buf[2] = ( uint8_t )( timeout & 0xFF );
    SX126xWriteCommand( RADIO_SET_TX, buf, 3 );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
pushq $0x4
popq %rdi
callq 0x489d
movl %ebx, %eax
shrl $0x10, %eax
leaq -0xb(%rbp), %rsi
movb %al, (%rsi)
movb %bh, -0xa(%rbp)
movb %bl, 0x2(%rsi)
pushq $0x3
popq %rdx
movl $0x83, %edi
callq 0x49f9
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xSetWhiteningSeed
void SX126xSetWhiteningSeed( uint16_t seed )
{
    uint8_t regValue = 0;
    
    switch( SX126xGetPacketType( ) )
    {
        case PACKET_TYPE_GFSK:
            regValue = SX126xReadRegister( REG_LR_WHITSEEDBASEADDR_MSB ) & 0xFE;
            regValue = ( ( seed >> 8 ) & 0x01 ) | regValue;
            SX126xWriteRegister( REG_LR_WHITSEEDBASEADDR_MSB, regValue ); // only 1 bit.
            SX126xWriteRegister( REG_LR_WHITSEEDBASEADDR_LSB, ( uint8_t )seed );
            break;

        default:
            break;
    }
}

// Assembly:
cmpl $0x0, 0x6708(%rip)      # 0xa4ac
je 0x3da7
retq
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
movl $0x6b8, %edi            # imm = 0x6B8
callq 0x4c96
andb $-0x2, %al
movl %ebx, %ecx
shrl $0x8, %ecx
andb $0x1, %cl
orb %al, %cl
movzbl %cl, %esi
movl $0x6b8, %edi            # imm = 0x6B8
callq 0x4c2e
movzbl %bl, %esi
movl $0x6b9, %edi            # imm = 0x6B9
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x4c2e
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xGetRandom
uint32_t SX126xGetRandom( void )
{
    uint32_t number = 0;
    uint8_t regAnaLna = 0;
    uint8_t regAnaMixer = 0;

    regAnaLna = SX126xReadRegister( REG_ANA_LNA );
    SX126xWriteRegister( REG_ANA_LNA, regAnaLna & ~( 1 << 0 ) );

    regAnaMixer = SX126xReadRegister( REG_ANA_MIXER );
    SX126xWriteRegister( REG_ANA_MIXER, regAnaMixer & ~( 1 << 7 ) );

    // Set radio in continuous reception
    SX126xSetRx( 0xFFFFFF ); // Rx Continuous

    SX126xReadRegisters( RANDOM_NUMBER_GENERATORBASEADDR, ( uint8_t* )&number, 4 );

    SX126xSetStandby( STDBY_RC );

    SX126xWriteRegister( REG_ANA_LNA, regAnaLna );
    SX126xWriteRegister( REG_ANA_MIXER, regAnaMixer );

    return number;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq -0x1c(%rbp), %rbx
andl $0x0, (%rbx)
movl $0x8e2, %edi            # imm = 0x8E2
callq 0x4c96
movl %eax, %r14d
andb $-0x2, %al
movzbl %al, %esi
movl $0x8e2, %edi            # imm = 0x8E2
callq 0x4c2e
movl $0x8e5, %edi            # imm = 0x8E5
callq 0x4c96
movl %eax, %r15d
andb $0x7f, %al
movzbl %al, %esi
movl $0x8e5, %edi            # imm = 0x8E5
callq 0x4c2e
movl $0xffffff, %edi         # imm = 0xFFFFFF
callq 0x3e78
pushq $0x4
popq %rdx
movl $0x819, %edi            # imm = 0x819
movq %rbx, %rsi
callq 0x4c4e
xorl %edi, %edi
callq 0x3bc5
movzbl %r14b, %esi
movl $0x8e2, %edi            # imm = 0x8E2
callq 0x4c2e
movzbl %r15b, %esi
movl $0x8e5, %edi            # imm = 0x8E5
callq 0x4c2e
movl (%rbx), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xSetRx
void SX126xSetRx( uint32_t timeout )
{
    uint8_t buf[3];

    SX126xSetOperatingMode( MODE_RX );

    SX126xWriteRegister( REG_RX_GAIN, 0x94 ); // default gain

    buf[0] = ( uint8_t )( ( timeout >> 16 ) & 0xFF );
    buf[1] = ( uint8_t )( ( timeout >> 8 ) & 0xFF );
    buf[2] = ( uint8_t )( timeout & 0xFF );
    SX126xWriteCommand( RADIO_SET_RX, buf, 3 );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
pushq $0x5
popq %rdi
callq 0x489d
movl $0x8ac, %edi            # imm = 0x8AC
movl $0x94, %esi
callq 0x4c2e
movl %ebx, %eax
shrl $0x10, %eax
leaq -0xb(%rbp), %rsi
movb %al, (%rsi)
movb %bh, -0xa(%rbp)
movb %bl, 0x2(%rsi)
pushq $0x3
popq %rdx
movl $0x82, %edi
callq 0x49f9
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xSetSleep
void SX126xSetSleep( SleepParams_t sleepConfig )
{
    SX126xAntSwOff( );

    uint8_t value = ( ( ( uint8_t )sleepConfig.Fields.WarmStart << 2 ) |
                      ( ( uint8_t )sleepConfig.Fields.Reset << 1 ) |
                      ( ( uint8_t )sleepConfig.Fields.WakeUpRTC ) );

    if( sleepConfig.Fields.WarmStart == 0 )
    {
        // Force image calibration
        ImageCalibrated = false;
    }
    SX126xWriteCommand( RADIO_SET_SLEEP, &value, 1 );
    SX126xSetOperatingMode( MODE_SLEEP );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
callq 0x4d77
movl %ebx, %eax
andb $0x7, %al
movb %al, -0x9(%rbp)
testb $0x4, %bl
jne 0x3edc
movb $0x0, 0x65cc(%rip)      # 0xa4a8
leaq -0x9(%rbp), %rsi
pushq $0x1
popq %rdx
movl $0x84, %edi
callq 0x49f9
xorl %edi, %edi
callq 0x489d
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xSetRxDutyCycle
void SX126xSetRxDutyCycle( uint32_t rxTime, uint32_t sleepTime )
{
    uint8_t buf[6];

    buf[0] = ( uint8_t )( ( rxTime >> 16 ) & 0xFF );
    buf[1] = ( uint8_t )( ( rxTime >> 8 ) & 0xFF );
    buf[2] = ( uint8_t )( rxTime & 0xFF );
    buf[3] = ( uint8_t )( ( sleepTime >> 16 ) & 0xFF );
    buf[4] = ( uint8_t )( ( sleepTime >> 8 ) & 0xFF );
    buf[5] = ( uint8_t )( sleepTime & 0xFF );
    SX126xWriteCommand( RADIO_SET_RXDUTYCYCLE, buf, 6 );
    SX126xSetOperatingMode( MODE_RX_DC );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %esi, %eax
movl %edi, %ecx
movl %edi, %edx
shrl $0x10, %edx
leaq -0xe(%rbp), %rsi
movb %dl, (%rsi)
movb %ch, -0xd(%rbp)
movb %cl, 0x2(%rsi)
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, 0x3(%rsi)
movb %ah, -0xa(%rbp)
movb %al, 0x5(%rsi)
pushq $0x6
popq %rbx
movl $0x94, %edi
movl %ebx, %edx
callq 0x49f9
movl %ebx, %edi
callq 0x489d
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xSetLoRaSymbNumTimeout
void SX126xSetLoRaSymbNumTimeout( uint8_t symbNum )
{
    uint8_t mant = ( ( ( symbNum > SX126X_MAX_LORA_SYMB_NUM_TIMEOUT ) ?
                       SX126X_MAX_LORA_SYMB_NUM_TIMEOUT : 
                       symbNum ) + 1 ) >> 1;
    uint8_t exp  = 0;
    uint8_t reg  = 0;

    while( mant > 31 )
    {
        mant = ( mant + 3 ) >> 2;
        exp++;
    }

    reg = mant << ( 2 * exp + 1 );
    SX126xWriteCommand( RADIO_SET_LORASYMBTIMEOUT, &reg, 1 );

    if( symbNum != 0 )
    {
        reg = exp + ( mant << 3 );
        SX126xWriteRegister( REG_LR_SYNCH_TIMEOUT, reg );
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
cmpb $-0x8, %bl
movl $0xf8, %eax
cmovbl %edi, %eax
incb %al
shrb %al
movzbl %al, %r14d
xorl %r15d, %r15d
cmpl $0x20, %r14d
jb 0x4048
addl $0x3, %r14d
shrl $0x2, %r14d
incb %r15b
jmp 0x4035
movzbl %r15b, %ecx
addl %ecx, %ecx
incb %cl
movl %r14d, %eax
shll %cl, %eax
leaq -0x19(%rbp), %rsi
movb %al, (%rsi)
pushq $0x1
popq %rdx
movl $0xa0, %edi
callq 0x49f9
testb %bl, %bl
je 0x4085
shlb $0x3, %r14b
addb %r15b, %r14b
movb %r14b, -0x19(%rbp)
movzbl %r14b, %esi
movl $0x706, %edi            # imm = 0x706
callq 0x4c2e
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xCalibrateImage
void SX126xCalibrateImage( uint32_t freq )
{
    uint8_t calFreq[2];

    if( freq > 900000000 )
    {
        calFreq[0] = 0xE1;
        calFreq[1] = 0xE9;
    }
    else if( freq > 850000000 )
    {
        calFreq[0] = 0xD7;
        calFreq[1] = 0xDB;
    }
    else if( freq > 770000000 )
    {
        calFreq[0] = 0xC1;
        calFreq[1] = 0xC5;
    }
    else if( freq > 460000000 )
    {
        calFreq[0] = 0x75;
        calFreq[1] = 0x81;
    }
    else if( freq > 425000000 )
    {
        calFreq[0] = 0x6B;
        calFreq[1] = 0x6F;
    }
    SX126xWriteCommand( RADIO_CALIBRATEIMAGE, calFreq, 2 );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
cmpl $0x35a4e901, %edi       # imm = 0x35A4E901
jb 0x40ef
movb $-0x1f, -0x2(%rbp)
movb $-0x17, %al
jmp 0x412d
cmpl $0x32a9f881, %edi       # imm = 0x32A9F881
jb 0x40ff
movb $-0x29, -0x2(%rbp)
movb $-0x25, %al
jmp 0x412d
cmpl $0x2de54481, %edi       # imm = 0x2DE54481
jb 0x410f
movb $-0x3f, -0x2(%rbp)
movb $-0x3b, %al
jmp 0x412d
cmpl $0x1b6b0b01, %edi       # imm = 0x1B6B0B01
jb 0x411f
movb $0x75, -0x2(%rbp)
movb $-0x7f, %al
jmp 0x412d
cmpl $0x1954fc41, %edi       # imm = 0x1954FC41
jb 0x4130
movb $0x6b, -0x2(%rbp)
movb $0x6f, %al
movb %al, -0x1(%rbp)
leaq -0x2(%rbp), %rsi
pushq $0x2
popq %rdx
movl $0x98, %edi
callq 0x49f9
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xSetPaConfig
void SX126xSetPaConfig( uint8_t paDutyCycle, uint8_t hpMax, uint8_t deviceSel, uint8_t paLut )
{
	printf("SX126xSetPaConfig: paDutyCycle=%d, hpMax=%d, deviceSel=%d, paLut=%d \r\n", (int) paDutyCycle, (int) hpMax, (int) deviceSel, (int) paLut);
    uint8_t buf[4];

    buf[0] = paDutyCycle;
    buf[1] = hpMax;
    buf[2] = deviceSel;
    buf[3] = paLut;
    SX126xWriteCommand( RADIO_SET_PACONFIG, buf, 4 );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %ecx, %ebx
movl %edx, %r14d
movl %esi, %r15d
movl %edi, %r12d
leaq 0x2540(%rip), %rdi      # 0x66a8
movl %r12d, %esi
movl %r15d, %edx
movl %r14d, %ecx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x2050
leaq -0x24(%rbp), %rsi
movb %r12b, (%rsi)
movb %r15b, 0x1(%rsi)
movb %r14b, 0x2(%rsi)
movb %bl, 0x3(%rsi)
pushq $0x4
popq %rdx
movl $0x95, %edi
callq 0x49f9
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xSetDioIrqParams
void SX126xSetDioIrqParams( uint16_t irqMask, uint16_t dio1Mask, uint16_t dio2Mask, uint16_t dio3Mask )
{
    uint8_t buf[8];

    buf[0] = ( uint8_t )( ( irqMask >> 8 ) & 0x00FF );
    buf[1] = ( uint8_t )( irqMask & 0x00FF );
    buf[2] = ( uint8_t )( ( dio1Mask >> 8 ) & 0x00FF );
    buf[3] = ( uint8_t )( dio1Mask & 0x00FF );
    buf[4] = ( uint8_t )( ( dio2Mask >> 8 ) & 0x00FF );
    buf[5] = ( uint8_t )( dio2Mask & 0x00FF );
    buf[6] = ( uint8_t )( ( dio3Mask >> 8 ) & 0x00FF );
    buf[7] = ( uint8_t )( dio3Mask & 0x00FF );
    SX126xWriteCommand( RADIO_CFG_DIOIRQ, buf, 8 );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %esi, %eax
movl %edi, %ebx
movb %bh, -0x10(%rbp)
leaq -0x10(%rbp), %rsi
movb %bl, 0x1(%rsi)
movb %ah, -0xe(%rbp)
movb %al, 0x3(%rsi)
movb %dh, -0xc(%rbp)
movb %dl, 0x5(%rsi)
movb %ch, -0xa(%rbp)
movb %cl, 0x7(%rsi)
pushq $0x8
popq %rdi
movl %edi, %edx
callq 0x49f9
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xSetDio3AsTcxoCtrl
void SX126xSetDio3AsTcxoCtrl( RadioTcxoCtrlVoltage_t tcxoVoltage, uint32_t timeout )
{
    uint8_t buf[4];

    buf[0] = tcxoVoltage & 0x07;
    buf[1] = ( uint8_t )( ( timeout >> 16 ) & 0xFF );
    buf[2] = ( uint8_t )( ( timeout >> 8 ) & 0xFF );
    buf[3] = ( uint8_t )( timeout & 0xFF );

    SX126xWriteCommand( RADIO_SET_TCXOMODE, buf, 4 );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %esi, %eax
andb $0x7, %dil
leaq -0x4(%rbp), %rsi
movb %dil, (%rsi)
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, 0x1(%rsi)
movb %ah, -0x2(%rbp)
movb %al, 0x3(%rsi)
pushq $0x4
popq %rdx
movl $0x97, %edi
callq 0x49f9
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xSetRfFrequency
void SX126xSetRfFrequency( uint32_t frequency )
{
    uint8_t buf[4];

    if( ImageCalibrated == false )
    {
        SX126xCalibrateImage( frequency );
        ImageCalibrated = true;
    }

    uint32_t freqInPllSteps = SX126xConvertFreqInHzToPllStep( frequency );

    buf[0] = ( uint8_t )( ( freqInPllSteps >> 24 ) & 0xFF );
    buf[1] = ( uint8_t )( ( freqInPllSteps >> 16 ) & 0xFF );
    buf[2] = ( uint8_t )( ( freqInPllSteps >> 8 ) & 0xFF );
    buf[3] = ( uint8_t )( freqInPllSteps & 0xFF );
    SX126xWriteCommand( RADIO_SET_RFFREQUENCY, buf, 4 );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
cmpb $0x0, 0x621b(%rip)      # 0xa4a8
jne 0x429d
movl %ebx, %edi
callq 0x40d7
movb $0x1, 0x620b(%rip)      # 0xa4a8
movl %ebx, %edi
callq 0x42c0
bswapl %eax
leaq -0xc(%rbp), %rsi
movl %eax, (%rsi)
pushq $0x4
popq %rdx
movl $0x86, %edi
callq 0x49f9
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xConvertFreqInHzToPllStep
static uint32_t SX126xConvertFreqInHzToPllStep( uint32_t freqInHz )
{
    uint32_t stepsInt;
    uint32_t stepsFrac;

    // pllSteps = freqInHz / (SX126X_XTAL_FREQ / 2^19 )
    // Get integer and fractional parts of the frequency computed with a PLL step scaled value
    stepsInt = freqInHz / SX126X_PLL_STEP_SCALED;
    stepsFrac = freqInHz - ( stepsInt * SX126X_PLL_STEP_SCALED );
    
    // Apply the scaling factor to retrieve a frequency in Hz (+ ceiling)
    return ( stepsInt << SX126X_PLL_STEP_SHIFT_AMOUNT ) + 
           ( ( ( stepsFrac << SX126X_PLL_STEP_SHIFT_AMOUNT ) + ( SX126X_PLL_STEP_SCALED >> 1 ) ) /
             SX126X_PLL_STEP_SCALED );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0x3d09, %esi           # imm = 0x3D09
movl %edi, %eax
xorl %edx, %edx
divl %esi
movl %eax, %ecx
imull $0x3c2f7, %eax, %eax    # imm = 0x3C2F7
addl %edi, %eax
shll $0xe, %ecx
shll $0xe, %eax
orl $0x1e84, %eax           # imm = 0x1E84
xorl %edx, %edx
divl %esi
addl %ecx, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xSetTxParams
void SX126xSetTxParams( int8_t power, RadioRampTimes_t rampTime )
{
    printf("SX126xSetTxParams: power=%d, rampTime=%d\r\n", (int) power, (int) rampTime);
    uint8_t buf[2];

    if( SX126xGetDeviceId( ) == SX1261 )
    {
        if( power == 15 )
        {
            SX126xSetPaConfig( 0x06, 0x00, 0x01, 0x01 );
        }
        else
        {
            SX126xSetPaConfig( 0x04, 0x00, 0x01, 0x01 );
        }
        if( power >= 14 )
        {
            power = 14;
        }
        else if( power < -17 )
        {
            power = -17;
        }
        ////  TODO: Set the current max value in the over current protection. From SX126x-Arduino/src/radio/sx126x/sx126x.cpp
		SX126xWriteRegister(REG_OCP, 0x18); // current max is 80 mA for the whole device
    }
    else // sx1262
    {
        // WORKAROUND - Better Resistance of the SX1262 Tx to Antenna Mismatch, see DS_SX1261-2_V1.2 datasheet chapter 15.2
        SX126xWriteRegister( REG_TX_CLAMP_CFG, SX126xReadRegister( REG_TX_CLAMP_CFG ) | ( 0x0F << 1 ) );
        // WORKAROUND END

        SX126xSetPaConfig( 0x04, 0x07, 0x00, 0x01 );
        if( power > 22 )
        {
            power = 22;
        }
        else if( power < -9 )
        {
            power = -9;
        }

        ////  TODO: Set the current max value in the over current protection. From SX126x-Arduino/src/radio/sx126x/sx126x.cpp
        SX126xWriteRegister(REG_OCP, 0x38); // current max 160mA for the whole device
    }
    buf[0] = power;
    buf[1] = ( uint8_t )rampTime;
    SX126xWriteCommand( RADIO_SET_TXPARAMS, buf, 2 );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebx
movl %edi, %r14d
leaq 0x23c5(%rip), %rdi      # 0x66ef
movl %r14d, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x2050
callq 0x4d5d
cmpb $0x1, %al
jne 0x437a
xorl %eax, %eax
cmpb $0xf, %r14b
sete %al
leal 0x4(,%rax,2), %edi
pushq $0x1
popq %rcx
xorl %esi, %esi
movl %ecx, %edx
callq 0x4147
movzbl %r14b, %eax
cmpb $-0x10, %r14b
movl $0xef, %ecx
cmovgel %eax, %ecx
cmpb $0xe, %cl
pushq $0xe
popq %r14
cmovll %ecx, %r14d
movb $0x18, %al
jmp 0x43be
movl $0x8d8, %edi            # imm = 0x8D8
callq 0x4c96
orb $0x1e, %al
movzbl %al, %esi
movl $0x8d8, %edi            # imm = 0x8D8
callq 0x4c2e
pushq $0x4
popq %rdi
pushq $0x7
popq %rsi
pushq $0x1
popq %rcx
xorl %edx, %edx
callq 0x4147
movzbl %r14b, %eax
cmpb $-0x8, %al
movl $0xf7, %ecx
cmovgel %eax, %ecx
cmpb $0x16, %cl
pushq $0x16
popq %r14
cmovll %ecx, %r14d
movb $0x38, %al
movzbl %al, %esi
movl $0x8e7, %edi            # imm = 0x8E7
callq 0x4c2e
leaq -0x12(%rbp), %rsi
movb %r14b, (%rsi)
movb %bl, 0x1(%rsi)
pushq $0x2
popq %rdx
movl $0x8e, %edi
callq 0x49f9
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xSetModulationParams
void SX126xSetModulationParams( ModulationParams_t *modulationParams )
{
    uint8_t n;
    uint32_t tempVal = 0;
    uint8_t buf[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

    // Check if required configuration corresponds to the stored packet type
    // If not, silently update radio packet type
    if( PacketType != modulationParams->PacketType )
    {
        SX126xSetPacketType( modulationParams->PacketType );
    }

    switch( modulationParams->PacketType )
    {
    case PACKET_TYPE_GFSK:
        n = 8;
        tempVal = ( uint32_t )( 32 * SX126X_XTAL_FREQ / modulationParams->Params.Gfsk.BitRate );
        buf[0] = ( tempVal >> 16 ) & 0xFF;
        buf[1] = ( tempVal >> 8 ) & 0xFF;
        buf[2] = tempVal & 0xFF;
        buf[3] = modulationParams->Params.Gfsk.ModulationShaping;
        buf[4] = modulationParams->Params.Gfsk.Bandwidth;
        tempVal = SX126xConvertFreqInHzToPllStep( modulationParams->Params.Gfsk.Fdev );
        buf[5] = ( tempVal >> 16 ) & 0xFF;
        buf[6] = ( tempVal >> 8 ) & 0xFF;
        buf[7] = ( tempVal& 0xFF );
        SX126xWriteCommand( RADIO_SET_MODULATIONPARAMS, buf, n );
        break;
    case PACKET_TYPE_LORA:
        n = 4;
        buf[0] = modulationParams->Params.LoRa.SpreadingFactor;
        buf[1] = modulationParams->Params.LoRa.Bandwidth;
        buf[2] = modulationParams->Params.LoRa.CodingRate;
        buf[3] = modulationParams->Params.LoRa.LowDatarateOptimize;

        SX126xWriteCommand( RADIO_SET_MODULATIONPARAMS, buf, n );

        break;
    default:
    case PACKET_TYPE_NONE:
        return;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
andq $0x0, -0x18(%rbp)
movq %rdi, %rbx
movl 0x60a8(%rip), %eax      # 0xa4ac
movl (%rdi), %edi
cmpl %edi, %eax
je 0x4411
callq 0x42ec
movl (%rbx), %eax
cmpl $0x1, %eax
je 0x4460
testl %eax, %eax
jne 0x4494
movl $0x3d090000, %eax       # imm = 0x3D090000
xorl %edx, %edx
divl 0x4(%rbx)
leaq -0x11(%rbp), %r14
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, -0x7(%r14)
movb %ah, -0x17(%rbp)
movb %al, -0x5(%r14)
movb 0xc(%rbx), %al
movb %al, -0x4(%r14)
movb 0x10(%rbx), %al
movb %al, -0x3(%r14)
movl 0x8(%rbx), %edi
callq 0x42c0
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, -0x2(%r14)
movb %ah, -0x12(%rbp)
movw $0x8, %cx
jmp 0x4480
leaq -0x15(%rbp), %r14
movb 0x14(%rbx), %al
movb %al, -0x3(%r14)
movb 0x18(%rbx), %al
movb %al, -0x2(%r14)
movb 0x1c(%rbx), %al
movb %al, -0x1(%r14)
movb 0x20(%rbx), %al
movw $0x4, %cx
movb %al, (%r14)
movzwl %cx, %edx
leaq -0x18(%rbp), %rsi
movl $0x8b, %edi
callq 0x49f9
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xSetCadParams
void SX126xSetCadParams( RadioLoRaCadSymbols_t cadSymbolNum, uint8_t cadDetPeak, uint8_t cadDetMin, RadioCadExitModes_t cadExitMode, uint32_t cadTimeout )
{
    uint8_t buf[7];

    buf[0] = ( uint8_t )cadSymbolNum;
    buf[1] = cadDetPeak;
    buf[2] = cadDetMin;
    buf[3] = ( uint8_t )cadExitMode;
    buf[4] = ( uint8_t )( ( cadTimeout >> 16 ) & 0xFF );
    buf[5] = ( uint8_t )( ( cadTimeout >> 8 ) & 0xFF );
    buf[6] = ( uint8_t )( cadTimeout & 0xFF );
    SX126xWriteCommand( RADIO_SET_CADPARAMS, buf, 7 );
    SX126xSetOperatingMode( MODE_CAD );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %r8d, %ebx
leaq -0xf(%rbp), %rax
movb %dil, (%rax)
movb %sil, 0x1(%rax)
movb %dl, 0x2(%rax)
movb %cl, 0x3(%rax)
movl %r8d, %ecx
shrl $0x10, %ecx
movb %cl, 0x4(%rax)
movb %bh, -0xa(%rbp)
movb %bl, 0x6(%rax)
pushq $0x7
popq %rbx
movl $0x88, %edi
movq %rax, %rsi
movl %ebx, %edx
callq 0x49f9
movl %ebx, %edi
callq 0x489d
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xGetPacketStatus
void SX126xGetPacketStatus( PacketStatus_t *pktStatus )
{
    uint8_t status[3];

    SX126xReadCommand( RADIO_GET_PACKETSTATUS, status, 3 );

    pktStatus->packetType = SX126xGetPacketType( );
    switch( pktStatus->packetType )
    {
        case PACKET_TYPE_GFSK:
            pktStatus->Params.Gfsk.RxStatus = status[0];
            pktStatus->Params.Gfsk.RssiSync = -status[1] >> 1;
            pktStatus->Params.Gfsk.RssiAvg = -status[2] >> 1;
            pktStatus->Params.Gfsk.FreqError = 0;
            break;

        case PACKET_TYPE_LORA:
            pktStatus->Params.LoRa.RssiPkt = -status[0] >> 1;
            // Returns SNR value [dB] rounded to the nearest integer value
            pktStatus->Params.LoRa.SnrPkt = ( ( ( int8_t )status[1] ) + 2 ) >> 2;
            pktStatus->Params.LoRa.SignalRssiPkt = -status[2] >> 1;
            pktStatus->Params.LoRa.FreqError = FrequencyError;
            break;

        default:
        case PACKET_TYPE_NONE:
            // In that specific case, we set everything in the pktStatus to zeros
            // and reset the packet type accordingly
            memset( pktStatus, 0, sizeof( PacketStatus_t ) );
            pktStatus->packetType = PACKET_TYPE_NONE;
            break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x14
popq %rdi
leaq -0xb(%rbp), %rsi
pushq $0x3
popq %rdx
callq 0x4a43
movl 0x5e3c(%rip), %eax      # 0xa4ac
movl %eax, (%rbx)
cmpl $0x1, %eax
je 0x469d
testl %eax, %eax
jne 0x46cb
movb -0xb(%rbp), %al
movb %al, 0x4(%rbx)
movzbl -0xa(%rbp), %eax
negl %eax
shrl %eax
movb %al, 0x6(%rbx)
movzbl -0x9(%rbp), %eax
negl %eax
shrl %eax
movb %al, 0x5(%rbx)
andl $0x0, 0x8(%rbx)
jmp 0x46d8
movzbl -0xb(%rbp), %eax
negl %eax
shrl %eax
movb %al, 0xc(%rbx)
movsbl -0xa(%rbp), %eax
addl $0x2, %eax
shrl $0x2, %eax
movb %al, 0xd(%rbx)
movzbl -0x9(%rbp), %eax
negl %eax
shrl %eax
movb %al, 0xe(%rbx)
movl 0x5dde(%rip), %eax      # 0xa4a4
movl %eax, 0x10(%rbx)
jmp 0x46d8
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%rbx)
movl $0xf, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq