LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/unixlab[P]cloudflare-udp-ping/net.c
// Function: optstring_from_long_options
const char *optstring_from_long_options(const struct option *opt)
{
	static char optstring[256] = {0};
	char *osp = optstring;

	for (; opt->name != NULL; opt++) {
		if (opt->flag == 0 && opt->val > 0 && opt->val < 256) {
			*osp++ = opt->val;
			switch (opt->has_arg) {
			case optional_argument:
				*osp++ = ':';
				*osp++ = ':';
				break;
			case required_argument:
				*osp++ = ':';
				break;
			}
		}
	}
	*osp++ = '\0';

	if (osp - optstring >= (int)sizeof(optstring)) {
		abort();
	}

	return optstring;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
leaq 0xe6fdd(%rip), %rax     # 0x4ea970
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, (%rax)
je 0x403a4a
movq -0x8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x403a37
movq -0x8(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jle 0x403a37
movq -0x8(%rbp), %rax
cmpl $0x100, 0x18(%rax)      # imm = 0x100
jge 0x403a37
movq -0x8(%rbp), %rax
movb 0x18(%rax), %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
incq %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x14(%rbp)
subl $0x1, %eax
je 0x403a23
jmp 0x4039f3
movl -0x14(%rbp), %eax
subl $0x2, %eax
jne 0x403a35
jmp 0x4039fd
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb $0x3a, (%rax)
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb $0x3a, (%rax)
jmp 0x403a35
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb $0x3a, (%rax)
jmp 0x403a37
jmp 0x403a39
movq -0x8(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x8(%rbp)
jmp 0x403997
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb $0x0, (%rax)
movq -0x10(%rbp), %rax
leaq 0xe6f09(%rip), %rcx     # 0x4ea970
subq %rcx, %rax
cmpq $0x100, %rax            # imm = 0x100
jl 0x403a77
callq 0x401114
leaq 0xe6ef2(%rip), %rax     # 0x4ea970
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O0/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_5/exercise_5_10/expr.c
// Function: pop
float pop(void)
{
  if (stack_pointer > 0)
  {
    return stack[stack_pointer--];
  }

  printf("Error: the stack is empty.\n");
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movzbl 0x2c51(%rip), %eax      # 0x4060
cmpl $0x0, %eax
jle 0x143d
movb 0x2c46(%rip), %al       # 0x4060
movb %al, %cl
addb $-0x1, %cl
movb %cl, 0x2c3b(%rip)       # 0x4060
movzbl %al, %eax
movl %eax, %ecx
leaq 0x2c3f(%rip), %rax      # 0x4070
movss (%rax,%rcx,4), %xmm0
movss %xmm0, -0x4(%rbp)
jmp 0x1453
leaq 0xd08(%rip), %rdi       # 0x214c
movb $0x0, %al
callq 0x1050
xorps %xmm0, %xmm0
movss %xmm0, -0x4(%rbp)
movss -0x4(%rbp), %xmm0
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/npl/linux/src/os_eventq.cc
// Function: ble_npl_eventq_is_empty
bool
ble_npl_eventq_is_empty(struct ble_npl_eventq *evq)
{
    wqueue_t *q = static_cast<wqueue_t *>(evq->q);

    if (q->size()) {
        return 1;
    } else {
        return 0;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x27d0
cmpl $0x0, %eax
je 0x252b
movb $0x1, -0x1(%rbp)
jmp 0x252f
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/npl/linux/src/os_eventq.cc
// Function: ble_npl_eventq_put
void
ble_npl_eventq_put(struct ble_npl_eventq *evq, struct ble_npl_event *ev)
{
    wqueue_t *q = static_cast<wqueue_t *>(evq->q);

    if (ev->ev_queued) {
        return;
    }

    ev->ev_queued = 1;
    q->put(ev);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
je 0x2586
jmp 0x259a
movq -0x10(%rbp), %rax
movb $0x1, (%rax)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2810
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/npl/linux/src/os_eventq.cc
// Function: ble_npl_eventq_get
struct ble_npl_event *ble_npl_eventq_get(struct ble_npl_eventq *evq,
                                         ble_npl_time_t tmo)
{
    struct ble_npl_event *ev;
    wqueue_t *q = static_cast<wqueue_t *>(evq->q);

    ev = q->get(tmo);

    if (ev) {
        ev->ev_queued = 0;
    }

    return ev;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x2860
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x25d8
movq -0x18(%rbp), %rax
movb $0x0, (%rax)
movq -0x18(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/npl/linux/src/os_eventq.cc
// Function: ble_npl_eventq_remove
void
ble_npl_eventq_remove(struct ble_npl_eventq *evq, struct ble_npl_event *ev)
{
    wqueue_t *q = static_cast<wqueue_t *>(evq->q);

    if (!ev->ev_queued) {
        return;
    }

    ev->ev_queued = 0;
    q->remove(ev);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x2746
jmp 0x275a
movq -0x10(%rbp), %rax
movb $0x0, (%rax)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2900
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/npl/linux/src/wqueue.h
// Function: wqueue<ble_npl_event*>::wqueue()
wqueue()
    {
        pthread_mutexattr_init(&m_mutex_attr);
        pthread_mutexattr_settype(&m_mutex_attr, PTHREAD_MUTEX_RECURSIVE);
        pthread_mutex_init(&m_mutex, &m_mutex_attr);
        pthread_cond_init(&m_condv, NULL);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x10(%rbp)
callq 0x2950
movq -0x10(%rbp), %rdi
addq $0x40, %rdi
callq 0x2060
movq -0x10(%rbp), %rdi
addq $0x40, %rdi
movl $0x1, %esi
callq 0x2260
movq -0x10(%rbp), %rsi
movq %rsi, %rdi
addq $0x18, %rdi
addq $0x40, %rsi
callq 0x2270
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21e0
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/npl/linux/src/wqueue.h
// Function: wqueue<ble_npl_event*>::size()
int size() {
        pthread_mutex_lock(&m_mutex);
        int size = m_queue.size();
        pthread_mutex_unlock(&m_mutex);
        return size;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
addq $0x18, %rdi
callq 0x2250
movq -0x18(%rbp), %rdi
callq 0x2a30
movq -0x18(%rbp), %rdi
movl %eax, -0xc(%rbp)
addq $0x18, %rdi
callq 0x2160
movl -0xc(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/npl/linux/src/wqueue.h
// Function: wqueue<ble_npl_event*>::put(ble_npl_event*)
void put(T item) {
        pthread_mutex_lock(&m_mutex);
        m_queue.push_back(item);
        pthread_cond_signal(&m_condv);
        pthread_mutex_unlock(&m_mutex);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
addq $0x18, %rdi
callq 0x2250
movq -0x18(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x2ab0
movq -0x18(%rbp), %rdi
addq $0x48, %rdi
callq 0x2030
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
callq 0x2160
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/npl/linux/src/wqueue.h
// Function: wqueue<ble_npl_event*>::get(unsigned int)
T get(uint32_t tmo) {
        pthread_mutex_lock(&m_mutex);
        if (tmo) {
            while (m_queue.size() == 0) {
                pthread_cond_wait(&m_condv, &m_mutex);
            }
        }

        T item = NULL;

        if (m_queue.size() != 0) {
            item = m_queue.front();
            m_queue.pop_front();
        }

        pthread_mutex_unlock(&m_mutex);
        return item;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
addq $0x18, %rdi
callq 0x2250
cmpl $0x0, -0xc(%rbp)
je 0x28af
jmp 0x2888
movq -0x20(%rbp), %rdi
callq 0x2a30
cmpq $0x0, %rax
jne 0x28ad
movq -0x20(%rbp), %rsi
movq %rsi, %rdi
addq $0x48, %rdi
addq $0x18, %rsi
callq 0x2290
jmp 0x2888
jmp 0x28af
movq -0x20(%rbp), %rdi
movq $0x0, -0x18(%rbp)
callq 0x2a30
cmpq $0x0, %rax
je 0x28df
movq -0x20(%rbp), %rdi
callq 0x2ee0
movq -0x20(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x18(%rbp)
callq 0x2f10
movq -0x20(%rbp), %rdi
addq $0x18, %rdi
callq 0x2160
movq -0x18(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x20, %rsp
movb %cl, %al
movw %dx, %cx
movw %si, %dx
movq %rdi, -0x8(%rbp)
movw %dx, -0xa(%rbp)
movw %cx, -0xc(%rbp)
movb %al, -0xd(%rbp)
leaq 0x56c0(%rip), %rdi      # 0x9086
movb $0x0, %al
callq 0x2050
leaq 0xa32c(%rip), %rax      # 0xdd00
callq *0x58(%rax)
movzwl -0xa(%rbp), %eax
cmpq $0x40, %rax
jbe 0x39e7
movw $0x40, -0xa(%rbp)
movzwl -0xa(%rbp), %eax
movl %eax, 0xa81f(%rip)      # 0xe210
movq -0x8(%rbp), %rsi
movzwl -0xa(%rbp), %eax
movl %eax, %edx
leaq 0xa81e(%rip), %rdi      # 0xe220
callq 0x2180
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl 0xa7f9(%rip), %eax      # 0xe210
jge 0x3a41
movslq -0x14(%rbp), %rcx
leaq 0xa7fc(%rip), %rax      # 0xe220
movzbl (%rax,%rcx), %esi
leaq 0x5663(%rip), %rdi      # 0x9092
movb $0x0, %al
callq 0x2050
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3a0e
leaq 0x5647(%rip), %rdi      # 0x908f
movb $0x0, %al
callq 0x2050
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/src/main.c
// Function: on_tx_timeout
static void on_tx_timeout(void) {
    printf("Tx timeout\r\n");

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

    //  Log the timeout
    loraping_stats.tx_timeout++;

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x562d(%rip), %rdi      # 0x9098
movb $0x0, %al
callq 0x2050
leaq 0xa287(%rip), %rax      # 0xdd00
callq *0x58(%rax)
movl 0xa762(%rip), %eax      # 0xe1e4
addl $0x1, %eax
movl %eax, 0xa759(%rip)      # 0xe1e4
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/src/main.c
// Function: on_rx_timeout
static void on_rx_timeout(void) {
    printf("Rx timeout\r\n");

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

    //  Log the timeout
    loraping_stats.rx_timeout++;
    //  TODO: loraping_rxinfo_timeout();

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x560a(%rip), %rdi      # 0x90a5
movb $0x0, %al
callq 0x2050
leaq 0xa257(%rip), %rax      # 0xdd00
callq *0x58(%rax)
movl 0xa71e(%rip), %eax      # 0xe1d0
addl $0x1, %eax
movl %eax, 0xa715(%rip)      # 0xe1d0
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/src/main.c
// Function: on_rx_error
static void on_rx_error(void) {
    printf("Rx error\r\n");

    //  Log the error
    loraping_stats.rx_error++;

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

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x55e7(%rip), %rdi      # 0x90b2
movb $0x0, %al
callq 0x2050
movl 0xa708(%rip), %eax      # 0xe1e0
addl $0x1, %eax
movl %eax, 0xa6ff(%rip)      # 0xe1e0
leaq 0xa218(%rip), %rax      # 0xdd00
callq *0x58(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x3b35
jmp 0x3b54
leaq 0x56b0(%rip), %rdi      # 0x91ec
leaq 0x56b8(%rip), %rsi      # 0x91fb
movl $0x20f, %edx            # imm = 0x20F
leaq 0x56b8(%rip), %rcx      # 0x9207
callq 0x2130
movq -0x8(%rbp), %rsi
leaq 0xa711(%rip), %rdi      # 0xe270
movl $0x48, %edx
callq 0x2180
leaq 0x1460(%rip), %rdi      # 0x4fd0
callq 0x54b0
xorl %edi, %edi
callq 0x5500
movl $0x1, %edi
callq 0x5c40
xorl %esi, %esi
movl %esi, %edi
callq 0x6570
movl $0x16, %edi
movl $0x7, %esi
callq 0x60d0
movl $0xffff, %esi           # imm = 0xFFFF
xorl %ecx, %ecx
movl %esi, %edi
movl %ecx, %edx
callq 0x5e40
movl $0x8ac, %edi            # imm = 0x8AC
callq 0x5000
movl $0x889, %edi            # imm = 0x889
callq 0x5000
leaq 0xa6ef(%rip), %rdi      # 0xe2b8
leaq 0x1520(%rip), %rsi      # 0x50f0
callq 0x7490
leaq 0xa714(%rip), %rdi      # 0xe2f0
leaq 0x153d(%rip), %rsi      # 0x5120
callq 0x7490
movb $0x0, 0xa67a(%rip)      # 0xe269
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/src/radio.c
// Function: RadioGetStatus
RadioState_t RadioGetStatus( void )
{
    switch( SX126xGetOperatingMode( ) )
    {
        case MODE_TX:
            return RF_TX_RUNNING;
        case MODE_RX:
            return RF_RX_RUNNING;
        case MODE_CAD:
            return RF_CAD;
        default:
            return RF_IDLE;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
callq 0x6b20
movl %eax, %ecx
movl %ecx, -0x8(%rbp)
subl $0x4, %eax
je 0x3c2d
jmp 0x3c19
movl -0x8(%rbp), %eax
subl $0x5, %eax
je 0x3c36
jmp 0x3c23
movl -0x8(%rbp), %eax
subl $0x7, %eax
je 0x3c3f
jmp 0x3c48
movl $0x2, -0x4(%rbp)
jmp 0x3c4f
movl $0x1, -0x4(%rbp)
jmp 0x3c4f
movl $0x3, -0x4(%rbp)
jmp 0x3c4f
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
leaq 0x55b5(%rip), %rdi      # 0x9227
xorl %eax, %eax
callq 0x2050
movl -0x4(%rbp), %eax
movl %eax, -0x8(%rbp)
testl %eax, %eax
je 0x3c91
jmp 0x3c85
movl -0x8(%rbp), %eax
subl $0x1, %eax
je 0x3ca1
jmp 0x3c8f
jmp 0x3c91
xorl %edi, %edi
callq 0x60a0
movb $0x0, 0xa68a(%rip)      # 0xe329
jmp 0x3ce6
movl $0x1, %edi
callq 0x60a0
movb 0xa678(%rip), %al       # 0xe329
andb $0x1, %al
movzbl %al, %eax
movb 0xa66c(%rip), %cl       # 0xe328
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
je 0x3ce4
movb 0xa65c(%rip), %al       # 0xe328
andb $0x1, %al
movb %al, 0xa655(%rip)       # 0xe329
movb 0xa64f(%rip), %al       # 0xe329
andb $0x1, %al
movzbl %al, %edi
callq 0x4b60
jmp 0x3ce6
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x60, %rsp
movw %dx, %ax
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movw %ax, -0xa(%rbp)
movl %ecx, -0x10(%rbp)
movl -0x4(%rbp), %esi
movl -0x8(%rbp), %edx
leaq 0x550d(%rip), %rdi      # 0x9252
movb $0x0, %al
callq 0x2050
movb $0x1, -0x11(%rbp)
movw $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
xorl %edi, %edi
callq 0x3c60
movl -0x4(%rbp), %edi
callq 0x3cf0
movl -0x8(%rbp), %esi
movl -0x8(%rbp), %r8d
xorl %ecx, %ecx
movl $0x258, %edx            # imm = 0x258
movl $0x3, %r9d
movl %ecx, %edi
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x0, 0x18(%rsp)
movl $0x0, 0x20(%rsp)
movl $0x0, 0x28(%rsp)
movl $0x0, 0x30(%rsp)
movl $0x1, 0x38(%rsp)
callq 0x3e90
xorl %edi, %edi
callq 0x4920
movl $0x1, %edi
callq 0x7620
callq 0x7660
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x18(%rbp), %edi
callq 0x7690
movl -0x1c(%rbp), %esi
movl %eax, %edx
movl -0x10(%rbp), %ecx
leaq 0x5484(%rip), %rdi      # 0x9280
movb $0x0, %al
callq 0x2050
movl -0x18(%rbp), %edi
callq 0x7690
cmpl -0x10(%rbp), %eax
jae 0x3e2f
xorl %edi, %edi
callq 0x4a00
movw %ax, -0x14(%rbp)
movswl -0x14(%rbp), %eax
movswl -0xa(%rbp), %ecx
cmpl %ecx, %eax
jle 0x3e2d
movb $0x0, -0x11(%rbp)
jmp 0x3e2f
jmp 0x3e03
callq 0x48b0
leaq 0x5493(%rip), %rdi      # 0x92ce
movb $0x0, %al
callq 0x2050
movb -0x11(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/src/radio.c
// Function: RadioRandom
uint32_t RadioRandom( void )
{
    uint32_t rnd = 0;

    /*
     * Radio setup for random number generation
     */
    // Set LoRa modem ON
    RadioSetModem( MODEM_LORA );

    // Disable LoRa modem interrupts
    SX126xSetDioIrqParams( IRQ_RADIO_NONE, IRQ_RADIO_NONE, IRQ_RADIO_NONE, IRQ_RADIO_NONE );

    rnd = SX126xGetRandom( );

    return rnd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x4(%rbp)
movl $0x1, %edi
callq 0x3c60
xorl %ecx, %ecx
movl %ecx, %edi
movl %ecx, %esi
movl %ecx, %edx
callq 0x5e40
callq 0x5850
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/src/radio.c
// Function: RadioTimeOnAir
uint32_t RadioTimeOnAir( RadioModems_t modem, uint32_t bandwidth,
                              uint32_t datarate, uint8_t coderate,
                              uint16_t preambleLen, bool fixLen, uint8_t payloadLen,
                              bool crcOn )
{
    uint32_t numerator = 0;
    uint32_t denominator = 1;

    switch( modem )
    {
    case MODEM_FSK:
        {
            numerator   = 1000U * RadioGetGfskTimeOnAirNumerator( datarate, coderate,
                                                                  preambleLen, fixLen,
                                                                  payloadLen, crcOn );
            denominator = datarate;
        }
        break;
    case MODEM_LORA:
        {
            numerator   = 1000U * RadioGetLoRaTimeOnAirNumerator( bandwidth, datarate,
                                                                  coderate, preambleLen,
                                                                  fixLen, payloadLen, crcOn );
            denominator = RadioGetLoRaBandwidthInHz( Bandwidths[bandwidth] );
        }
        break;
    }
    // Perform integral ceil()
    return ( numerator + denominator - 1 ) / denominator;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %r9d, -0x2c(%rbp)
movl %r8d, -0x28(%rbp)
movl %ecx, %eax
movl -0x2c(%rbp), %ecx
movl %edx, %r8d
movl -0x28(%rbp), %edx
movl %r8d, -0x24(%rbp)
movl %esi, %r8d
movl %edi, %r9d
movl -0x24(%rbp), %edi
movb %al, %sil
movb 0x18(%rbp), %al
movb 0x10(%rbp), %r10b
movl %r9d, -0x4(%rbp)
movl %r8d, -0x8(%rbp)
movl %edi, -0xc(%rbp)
movb %sil, -0xd(%rbp)
movw %dx, -0x10(%rbp)
andb $0x1, %cl
movb %cl, -0x11(%rbp)
andb $0x1, %al
movb %al, -0x12(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x1, -0x1c(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x20(%rbp)
testl %eax, %eax
je 0x46f7
jmp 0x46ea
movl -0x20(%rbp), %eax
subl $0x1, %eax
je 0x4739
jmp 0x4790
movl -0xc(%rbp), %edi
movb -0xd(%rbp), %sil
movw -0x10(%rbp), %dx
movb -0x11(%rbp), %cl
movb 0x10(%rbp), %r8b
movb -0x12(%rbp), %al
andb $0x1, %cl
andb $0x1, %al
movzbl %sil, %esi
movzwl %dx, %edx
movzbl %cl, %ecx
movzbl %r8b, %r8d
movzbl %al, %r9d
callq 0x5210
imull $0x3e8, %eax, %eax      # imm = 0x3E8
movl %eax, -0x18(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x4790
movl -0x8(%rbp), %edi
movl -0xc(%rbp), %esi
movb -0xd(%rbp), %dl
movw -0x10(%rbp), %cx
movb -0x11(%rbp), %r8b
movb 0x10(%rbp), %r9b
movb -0x12(%rbp), %al
andb $0x1, %r8b
andb $0x1, %al
movzbl %dl, %edx
movzwl %cx, %ecx
movzbl %r8b, %r8d
movzbl %r9b, %r9d
movzbl %al, %eax
movl %eax, (%rsp)
callq 0x52b0
imull $0x3e8, %eax, %eax      # imm = 0x3E8
movl %eax, -0x18(%rbp)
movl -0x8(%rbp), %eax
movl %eax, %ecx
leaq 0x4a5b(%rip), %rax      # 0x91e0
movl (%rax,%rcx,4), %edi
callq 0x5420
movl %eax, -0x1c(%rbp)
movl -0x18(%rbp), %eax
addl -0x1c(%rbp), %eax
subl $0x1, %eax
xorl %edx, %edx
divl -0x1c(%rbp)
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x10, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movzbl -0x9(%rbp), %esi
leaq 0x4ca3(%rip), %rdi      # 0x9470
movb $0x0, %al
callq 0x2050
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movzbl -0x9(%rbp), %ecx
cmpl %ecx, %eax
jge 0x480b
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movzbl (%rax,%rcx), %esi
leaq 0x4899(%rip), %rdi      # 0x9092
movb $0x0, %al
callq 0x2050
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x47db
leaq 0x487d(%rip), %rdi      # 0x908f
movb $0x0, %al
callq 0x2050
movl $0x201, %esi            # imm = 0x201
xorl %ecx, %ecx
movl %esi, %edi
movl %ecx, %edx
callq 0x5e40
callq 0x5780
cmpl $0x1, %eax
jne 0x483e
movb -0x9(%rbp), %al
movb %al, 0x9b24(%rip)       # 0xe360
jmp 0x4847
movb -0x9(%rbp), %al
movb %al, 0x9b05(%rip)       # 0xe34c
movzwl 0x9b0a(%rip), %esi      # 0xe358
movl 0x9b08(%rip), %edx      # 0xe35c
movzbl 0x9b05(%rip), %ecx      # 0xe360
movl 0x9b02(%rip), %r8d      # 0xe364
movl 0x9aff(%rip), %r9d      # 0xe368
leaq 0x4c15(%rip), %rdi      # 0x9485
movb $0x0, %al
callq 0x2050
leaq 0x9aae(%rip), %rdi      # 0xe32c
addq $0x8, %rdi
callq 0x6350
movq -0x8(%rbp), %rdi
xorl %edx, %edx
movzbl -0x9(%rbp), %esi
callq 0x5670
movl 0x99c4(%rip), %esi      # 0xe260
leaq 0x9a15(%rip), %rdi      # 0xe2b8
callq 0x7580
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/src/radio.c
// Function: RadioSleep
void RadioSleep( void )
{
    printf("RadioSleep\r\n");
    SleepParams_t params = { 0 };

    params.Fields.WarmStart = 1;
    SX126xSetSleep( params );

    DelayMs( 2 );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x4c1f(%rip), %rdi      # 0x94de
movb $0x0, %al
callq 0x2050
leaq -0x1(%rbp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x2100
movb -0x1(%rbp), %al
andb $-0x5, %al
orb $0x4, %al
movb %al, -0x1(%rbp)
movzbl -0x1(%rbp), %edi
callq 0x5970
movl $0x2, %edi
callq 0x7620
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
leaq 0x4bc8(%rip), %rdi      # 0x94fa
movb $0x0, %al
callq 0x2050
movl $0xffff, %esi           # imm = 0xFFFF
xorl %ecx, %ecx
movl %esi, %edi
movl %ecx, %edx
callq 0x5e40
cmpl $0x0, -0x4(%rbp)
je 0x495e
movl -0x4(%rbp), %esi
leaq 0x9997(%rip), %rdi      # 0xe2f0
callq 0x7580
movb 0x9904(%rip), %al       # 0xe268
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x497a
movl $0xffffff, %edi         # imm = 0xFFFFFF
callq 0x5900
jmp 0x4988
movl 0x98e4(%rip), %edi      # 0xe264
shll $0x6, %edi
callq 0x5900
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x10, %rsp
movw %dx, %ax
movb %sil, %cl
movl %edi, -0x4(%rbp)
movb %cl, -0x5(%rbp)
movw %ax, -0x8(%rbp)
movzwl -0x8(%rbp), %eax
imull $0x3e8, %eax, %eax      # imm = 0x3E8
movl %eax, -0xc(%rbp)
movl -0x4(%rbp), %edi
callq 0x5fb0
movsbl -0x5(%rbp), %edi
callq 0x73f0
callq 0x5b20
movl -0xc(%rbp), %esi
leaq 0x98c3(%rip), %rdi      # 0xe2b8
callq 0x7580
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/src/radio.c
// Function: RadioSetMaxPayloadLength
void RadioSetMaxPayloadLength( RadioModems_t modem, uint8_t max )
{
    if( modem == MODEM_LORA )
    {
        SX126x.PacketParams.Params.LoRa.PayloadLength = MaxPayloadLength = max;
        SX126xSetPacketParams( &SX126x.PacketParams );
    }
    else
    {
        if( SX126x.PacketParams.Params.Gfsk.HeaderType == RADIO_PACKET_VARIABLE_LENGTH )
        {
            SX126x.PacketParams.Params.Gfsk.PayloadLength = MaxPayloadLength = max;
            SX126xSetPacketParams( &SX126x.PacketParams );
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movb %sil, %al
movl %edi, -0x4(%rbp)
movb %al, -0x5(%rbp)
cmpl $0x1, -0x4(%rbp)
jne 0x4b28
movb -0x5(%rbp), %al
movb %al, 0x96a0(%rip)       # 0xe1b0
movb %al, 0x984a(%rip)       # 0xe360
leaq 0x980f(%rip), %rdi      # 0xe32c
addq $0x8, %rdi
callq 0x6350
jmp 0x4b52
cmpl $0x1, 0x9819(%rip)      # 0xe348
jne 0x4b50
movb -0x5(%rbp), %al
movb %al, 0x9676(%rip)       # 0xe1b0
movb %al, 0x980c(%rip)       # 0xe34c
leaq 0x97e5(%rip), %rdi      # 0xe32c
addq $0x8, %rdi
callq 0x6350
jmp 0x4b52
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x10, %rsp
movb %dil, %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
movb %al, %cl
andb $0x1, %cl
movb %cl, 0x97aa(%rip)       # 0xe328
andb $0x1, %al
movb %al, 0x97a3(%rip)       # 0xe329
movl $0x1, %edi
callq 0x3c60
movb -0x1(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x4bd0
leaq 0x4960(%rip), %rdi      # 0x9504
movl $0x3444, %esi           # imm = 0x3444
movb $0x0, %al
callq 0x2050
movl $0x740, %edi            # imm = 0x740
movl $0x34, %esi
callq 0x70f0
movl $0x741, %edi            # imm = 0x741
movl $0x44, %esi
callq 0x70f0
jmp 0x4c01
leaq 0x4959(%rip), %rdi      # 0x9530
movl $0x1424, %esi           # imm = 0x1424
movb $0x0, %al
callq 0x2050
movl $0x740, %edi            # imm = 0x740
movl $0x14, %esi
callq 0x70f0
movl $0x741, %edi            # imm = 0x741
movl $0x24, %esi
callq 0x70f0
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
movl $0xffff, %esi           # imm = 0xFFFF
xorl %ecx, %ecx
movl %esi, %edi
movl %ecx, %edx
callq 0x5e40
cmpl $0x0, -0x4(%rbp)
je 0x4f80
movl -0x4(%rbp), %esi
leaq 0x9375(%rip), %rdi      # 0xe2f0
callq 0x7580
movb 0x92e2(%rip), %al       # 0xe268
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x4f9c
movl $0xffffff, %edi         # imm = 0xFFFFFF
callq 0x5a10
jmp 0x4faa
movl 0x92c2(%rip), %edi      # 0xe264
shll $0x6, %edi
callq 0x5a10
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x20, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
leaq -0xb(%rbp), %rsi
movl $0x29f, %edi            # imm = 0x29F
movl $0x9, %edx
callq 0x7120
movb -0xb(%rbp), %al
movb %al, -0xc(%rbp)
leaq -0xb(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
movzbl -0x19(%rbp), %eax
movzbl -0xc(%rbp), %ecx
cmpl %ecx, %eax
jge 0x5087
movzwl -0x2(%rbp), %eax
movq -0x18(%rbp), %rcx
movzbl -0x19(%rbp), %edx
shll %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
movzwl %cx, %ecx
shll $0x8, %ecx
movq -0x18(%rbp), %rdx
movzbl -0x19(%rbp), %esi
shll %esi
addl $0x1, %esi
movslq %esi, %rsi
movzbl (%rdx,%rsi), %edx
addl %edx, %ecx
cmpl %ecx, %eax
jne 0x507b
jmp 0x50e2
jmp 0x507d
movb -0x19(%rbp), %al
addb $0x1, %al
movb %al, -0x19(%rbp)
jmp 0x5038
movzbl -0xc(%rbp), %eax
cmpl $0x4, %eax
jge 0x50e2
movzbl -0xb(%rbp), %eax
addl $0x1, %eax
movb %al, -0xb(%rbp)
movzwl -0x2(%rbp), %eax
sarl $0x8, %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movzbl -0xc(%rbp), %ecx
shll %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movzwl -0x2(%rbp), %eax
sarl $0x0, %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movzbl -0xc(%rbp), %ecx
shll %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
leaq -0xb(%rbp), %rsi
movl $0x29f, %edi            # imm = 0x29F
movl $0x9, %edx
callq 0x7010
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
jne 0x516a
movb $0x1f, -0x1(%rbp)
jmp 0x51fc
movb $0x0, -0x9(%rbp)
movzbl -0x9(%rbp), %eax
cmpq $0x15, %rax
jae 0x51cc
movl -0x8(%rbp), %eax
movzbl -0x9(%rbp), %ecx
movl %ecx, %edx
leaq 0x3fa8(%rip), %rcx      # 0x9130
cmpl (%rcx,%rdx,8), %eax
jb 0x51c0
movl -0x8(%rbp), %eax
movzbl -0x9(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
leaq 0x3f8f(%rip), %rcx      # 0x9130
cmpl (%rcx,%rdx,8), %eax
jae 0x51c0
movzbl -0x9(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0x3f79(%rip), %rax      # 0x9130
movb 0x4(%rax,%rcx,8), %al
movb %al, -0x1(%rbp)
jmp 0x51fc
jmp 0x51c2
movb -0x9(%rbp), %al
addb $0x1, %al
movb %al, -0x9(%rbp)
jmp 0x516e
movl -0x8(%rbp), %esi
leaq 0x4467(%rip), %rdi      # 0x963d
movb $0x0, %al
callq 0x2050
leaq 0x4491(%rip), %rdi      # 0x9675
leaq 0x4010(%rip), %rsi      # 0x91fb
movl $0x207, %edx            # imm = 0x207
leaq 0x4484(%rip), %rcx      # 0x967b
callq 0x2130
movb -0x1(%rbp), %al
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/src/radio.c
// Function: RadioGetGfskTimeOnAirNumerator
static uint32_t RadioGetGfskTimeOnAirNumerator( uint32_t datarate, uint8_t coderate,
                              uint16_t preambleLen, bool fixLen, uint8_t payloadLen,
                              bool crcOn )
{
    const RadioAddressComp_t addrComp = RADIO_ADDRESSCOMP_FILT_OFF;
    const uint8_t syncWordLength = 3;

    return ( preambleLen << 3 ) +
           ( ( fixLen == false ) ? 8 : 0 ) +
             ( syncWordLength << 3 ) +
             ( ( payloadLen +
               ( addrComp == RADIO_ADDRESSCOMP_FILT_OFF ? 0 : 1 ) +
               ( ( crcOn == true ) ? 2 : 0 ) 
               ) << 3 
             );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %r8d, -0x24(%rbp)
movl %ecx, %eax
movl -0x24(%rbp), %ecx
movl %eax, -0x20(%rbp)
movl %edx, %eax
movl -0x20(%rbp), %edx
movl %eax, -0x1c(%rbp)
movl %esi, %eax
movl -0x1c(%rbp), %esi
movl %eax, -0x18(%rbp)
movl %edi, %r8d
movl -0x18(%rbp), %edi
movb %r9b, %al
movl %r8d, -0x4(%rbp)
movb %dil, -0x5(%rbp)
movw %si, -0x8(%rbp)
andb $0x1, %dl
movb %dl, -0x9(%rbp)
movb %cl, -0xa(%rbp)
andb $0x1, %al
movb %al, -0xb(%rbp)
movl $0x0, -0x10(%rbp)
movb $0x3, -0x11(%rbp)
movzwl -0x8(%rbp), %eax
shll $0x3, %eax
movb -0x9(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %esi
xorl %ecx, %ecx
movl $0x8, %edx
cmpl $0x0, %esi
cmovel %edx, %ecx
addl %ecx, %eax
addl $0x18, %eax
movzbl -0xa(%rbp), %ecx
addl $0x0, %ecx
movb -0xb(%rbp), %dl
andb $0x1, %dl
movzbl %dl, %edi
xorl %edx, %edx
movl $0x2, %esi
cmpl $0x1, %edi
cmovel %esi, %edx
addl %edx, %ecx
shll $0x3, %ecx
addl %ecx, %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
callq 0x6b50
movq -0x8(%rbp), %rdi
callq 0x6a90
callq 0x6b90
xorl %edi, %edi
callq 0x5500
callq 0x6af0
callq 0x6b10
movb $0x0, 0x8fe1(%rip)      # 0xe4c8
movl $0x1, %edi
callq 0x6b30
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xSetStandby
void SX126xSetStandby( RadioStandbyModes_t standbyConfig )
{
    SX126xWriteCommand( RADIO_SET_STANDBY, ( uint8_t* )&standbyConfig, 1 );
    if( standbyConfig == STDBY_RC )
    {
        SX126xSetOperatingMode( MODE_STDBY_RC );
    }
    else
    {
        SX126xSetOperatingMode( MODE_STDBY_XOSC );
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
movl $0x80, %edi
leaq -0x4(%rbp), %rsi
movl $0x1, %edx
callq 0x6d60
cmpl $0x0, -0x4(%rbp)
jne 0x5530
movl $0x1, %edi
callq 0x6b30
jmp 0x553a
movl $0x2, %edi
callq 0x6b30
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/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 0x6b20
cmpl $0x0, %eax
je 0x5558
callq 0x6b20
cmpl $0x6, %eax
jne 0x5562
callq 0x6b90
callq 0x7440
callq 0x6b70
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x20, %rsp
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movb %al, -0x19(%rbp)
movb $0x0, -0x1a(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x1a(%rbp), %rsi
callq 0x5600
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
movzbl -0x19(%rbp), %ecx
cmpl %ecx, %eax
jle 0x55db
movb $0x1, -0x1(%rbp)
jmp 0x55f5
movb -0x1a(%rbp), %cl
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
movzbl %cl, %edi
movzbl (%rax), %edx
callq 0x7310
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x12(%rbp), %rsi
movl $0x13, %edi
movl $0x2, %edx
callq 0x6de0
callq 0x5780
cmpl $0x1, %eax
jne 0x564c
movl 0x8e9d(%rip), %eax      # 0xe4d0
cmpl $0x1, %eax
jne 0x564c
movl $0x702, %edi            # imm = 0x702
callq 0x7210
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, (%rax)
jmp 0x5655
movb -0x12(%rbp), %cl
movq -0x8(%rbp), %rax
movb %cl, (%rax)
movb -0x11(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, (%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
movl $0x4, %edi
callq 0x6b30
movl -0x4(%rbp), %eax
shrl $0x10, %eax
andl $0xff, %eax
movb %al, -0x7(%rbp)
movl -0x4(%rbp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movb %al, -0x6(%rbp)
movl -0x4(%rbp), %eax
andl $0xff, %eax
movb %al, -0x5(%rbp)
leaq -0x7(%rbp), %rsi
movl $0x83, %edi
movl $0x3, %edx
callq 0x6d60
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xSetCrcSeed
void SX126xSetCrcSeed( uint16_t seed )
{
    uint8_t buf[2];

    buf[0] = ( uint8_t )( ( seed >> 8 ) & 0xFF );
    buf[1] = ( uint8_t )( seed & 0xFF );

    switch( SX126xGetPacketType( ) )
    {
        case PACKET_TYPE_GFSK:
            SX126xWriteRegisters( REG_LR_CRCSEEDBASEADDR, buf, 2 );
            break;

        default:
            break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
movb -0x1(%rbp), %al
movb %al, -0x4(%rbp)
movb -0x2(%rbp), %al
movb %al, -0x3(%rbp)
callq 0x5780
testl %eax, %eax
jne 0x576b
jmp 0x5756
leaq -0x4(%rbp), %rsi
movl $0x6bc, %edi            # imm = 0x6BC
movl $0x2, %edx
callq 0x7010
jmp 0x576d
jmp 0x576d
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xSetCrcPolynomial
void SX126xSetCrcPolynomial( uint16_t polynomial )
{
    uint8_t buf[2];

    buf[0] = ( uint8_t )( ( polynomial >> 8 ) & 0xFF );
    buf[1] = ( uint8_t )( polynomial & 0xFF );

    switch( SX126xGetPacketType( ) )
    {
        case PACKET_TYPE_GFSK:
            SX126xWriteRegisters( REG_LR_CRCPOLYBASEADDR, buf, 2 );
            break;

        default:
            break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
movb -0x1(%rbp), %al
movb %al, -0x4(%rbp)
movb -0x2(%rbp), %al
movb %al, -0x3(%rbp)
callq 0x5780
testl %eax, %eax
jne 0x57cb
jmp 0x57b6
leaq -0x4(%rbp), %rsi
movl $0x6be, %edi            # imm = 0x6BE
movl $0x2, %edx
callq 0x7010
jmp 0x57cd
jmp 0x57cd
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)