// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/src/main.c
// Function: init_driver
static void init_driver(void) {
    puts("init_driver");

    //  Set the LoRa Callback Functions
    RadioEvents_t radio_events;
    memset(&radio_events, 0, sizeof(radio_events));  //  Must init radio_events to null, because radio_events lives on stack!
    radio_events.TxDone    = on_tx_done;
    radio_events.RxDone    = on_rx_done;
    radio_events.TxTimeout = on_tx_timeout;
    radio_events.RxTimeout = on_rx_timeout;
    radio_events.RxError   = on_rx_error;

    //  Init the SPI Port and the LoRa Transceiver
    Radio.Init(&radio_events);

    //  Set the LoRa Frequency
    Radio.SetChannel(RF_FREQUENCY);

    //  Configure the LoRa Transceiver for transmitting messages
    Radio.SetTxConfig(
        MODEM_LORA,
        LORAPING_TX_OUTPUT_POWER,
        0,        //  Frequency deviation: Unused with LoRa
        LORAPING_BANDWIDTH,
        LORAPING_SPREADING_FACTOR,
        LORAPING_CODINGRATE,
        LORAPING_PREAMBLE_LENGTH,
        LORAPING_FIX_LENGTH_PAYLOAD_ON,
        true,     //  CRC enabled
        0,        //  Frequency hopping disabled
        0,        //  Hop period: N/A
        LORAPING_IQ_INVERSION_ON,
        LORAPING_TX_TIMEOUT_MS
    );

    //  Configure the LoRa Transceiver for receiving messages
    Radio.SetRxConfig(
        MODEM_LORA,
        LORAPING_BANDWIDTH,
        LORAPING_SPREADING_FACTOR,
        LORAPING_CODINGRATE,
        0,        //  AFC bandwidth: Unused with LoRa
        LORAPING_PREAMBLE_LENGTH,
        LORAPING_SYMBOL_TIMEOUT,
        LORAPING_FIX_LENGTH_PAYLOAD_ON,
        0,        //  Fixed payload length: N/A
        true,     //  CRC enabled
        0,        //  Frequency hopping disabled
        0,        //  Hop period: N/A
        LORAPING_IQ_INVERSION_ON,
        true      //  Continuous receive mode
    );    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
leaq 0x585e(%rip), %rdi      # 0x9070
callq 0x22a0
leaq -0x48(%rbp), %rdi
xorl %esi, %esi
movl $0x48, %edx
callq 0x2100
leaq 0x142(%rip), %rax       # 0x3970
movq %rax, -0x48(%rbp)
leaq 0x167(%rip), %rax       # 0x39a0
movq %rax, -0x38(%rbp)
leaq 0x21c(%rip), %rax       # 0x3a60
movq %rax, -0x40(%rbp)
leaq 0x241(%rip), %rax       # 0x3a90
movq %rax, -0x30(%rbp)
leaq 0x266(%rip), %rax       # 0x3ac0
movq %rax, -0x28(%rbp)
leaq -0x48(%rbp), %rdi
leaq 0xa497(%rip), %rax      # 0xdd00
callq *(%rax)
movl $0x3703dcc0, %edi       # imm = 0x3703DCC0
leaq 0xa489(%rip), %rax      # 0xdd00
callq *0x18(%rax)
movl $0x1, %r9d
movl $0xe, %esi
xorl %ecx, %ecx
movl $0x7, %r8d
leaq 0xa46c(%rip), %rax      # 0xdd00
movl %r9d, %edi
movl %ecx, %edx
movl $0x8, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x1, 0x10(%rsp)
movl $0x0, 0x18(%rsp)
movl $0x0, 0x20(%rsp)
movl $0x0, 0x28(%rsp)
movl $0xbb8, 0x30(%rsp)      # imm = 0xBB8
callq *0x38(%rax)
movl $0x1, %ecx
xorl %r8d, %r8d
movl $0x7, %edx
movl $0x8, %r9d
leaq 0xa413(%rip), %rax      # 0xdd00
movl %ecx, %edi
movl %r8d, %esi
movl $0x5, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x1, 0x18(%rsp)
movl $0x0, 0x20(%rsp)
movl $0x0, 0x28(%rsp)
movl $0x0, 0x30(%rsp)
movl $0x1, 0x38(%rsp)
callq *0x30(%rax)
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)