LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x.c
// Function: SX126xGetDeviceErrors
RadioError_t SX126xGetDeviceErrors( void )
{
    uint8_t err[] = { 0, 0 };
    RadioError_t error = { .Value = 0 };

    SX126xReadCommand( RADIO_GET_ERROR, ( uint8_t* )err, 2 );
    error.Fields.PaRamp     = ( err[0] & ( 1 << 0 ) ) >> 0;
    error.Fields.PllLock    = ( err[1] & ( 1 << 6 ) ) >> 6;
    error.Fields.XoscStart  = ( err[1] & ( 1 << 5 ) ) >> 5;
    error.Fields.ImgCalib   = ( err[1] & ( 1 << 4 ) ) >> 4;
    error.Fields.AdcCalib   = ( err[1] & ( 1 << 3 ) ) >> 3;
    error.Fields.PllCalib   = ( err[1] & ( 1 << 2 ) ) >> 2;
    error.Fields.Rc13mCalib = ( err[1] & ( 1 << 1 ) ) >> 1;
    error.Fields.Rc64kCalib = ( err[1] & ( 1 << 0 ) ) >> 0;
    return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq -0xa(%rbp), %rbx
andw $0x0, (%rbx)
pushq $0x17
popq %rdi
pushq $0x2
popq %rdx
movq %rbx, %rsi
callq 0x4a43
movzbl (%rbx), %ecx
andl $0x1, %ecx
shll $0x8, %ecx
movzbl 0x1(%rbx), %eax
movl %eax, %edx
andl $0x40, %edx
orl %ecx, %edx
movl %eax, %ecx
andl $0x20, %ecx
orl %edx, %ecx
movl %eax, %edx
andl $0x10, %edx
orl %ecx, %edx
movl %eax, %ecx
andl $0x8, %ecx
orl %edx, %ecx
movl %eax, %edx
andl $0x4, %edx
orl %ecx, %edx
andl $0x3, %eax
orl %edx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x-linux.c
// Function: SX126xIoInit
void SX126xIoInit( void )
{
    printf("SX126xIoInit\r\n");

    //  Init SPI Bus
    int rc = init_spi();
    assert(rc == 0);

    //  TODO: Init GPIO Pins
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x230b(%rip), %rdi      # 0x6a96
callq 0x2280
leaq 0x22dd(%rip), %rdi      # 0x6a74
pushq $0x2
popq %rsi
xorl %eax, %eax
callq 0x2110
movl %eax, 0x6529(%rip)      # 0xacd0
testl %eax, %eax
jle 0x47e7
leaq -0x2(%rbp), %rdx
movb $0x0, (%rdx)
movl $0x40016b01, %esi       # imm = 0x40016B01
movl %eax, %edi
xorl %eax, %eax
callq 0x2200
testl %eax, %eax
jne 0x4806
leaq -0x1(%rbp), %rdx
movb $0x0, (%rdx)
movl 0x64ff(%rip), %edi      # 0xacd0
movl $0x40016b02, %esi       # imm = 0x40016B02
xorl %eax, %eax
callq 0x2200
testl %eax, %eax
jne 0x4825
addq $0x10, %rsp
popq %rbp
retq
leaq 0x2173(%rip), %rdi      # 0x6961
leaq 0x1f2d(%rip), %rsi      # 0x6722
leaq 0x2287(%rip), %rcx      # 0x6a83
movl $0x28f, %edx            # imm = 0x28F
callq 0x2100
leaq 0x1f0d(%rip), %rdi      # 0x671a
leaq 0x1f0e(%rip), %rsi      # 0x6722
leaq 0x2268(%rip), %rcx      # 0x6a83
movl $0x294, %edx            # imm = 0x294
callq 0x2100
leaq 0x1eee(%rip), %rdi      # 0x671a
leaq 0x1eef(%rip), %rsi      # 0x6722
leaq 0x2249(%rip), %rcx      # 0x6a83
movl $0x299, %edx            # imm = 0x299
callq 0x2100
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x-linux.c
// Function: SX126xWakeup
void SX126xWakeup( void )
{
    printf("SX126xWakeup\r\n");
    CRITICAL_SECTION_BEGIN( );

    // Write RADIO_GET_STATUS command followed by 0
    uint8_t commands[1] = { RADIO_GET_STATUS };
    uint8_t buffer[1]   = { 0 };
    int rc = sx126x_hal_write(NULL, commands, sizeof(commands), buffer, sizeof(buffer));
    assert(rc == 0);

    // Wait for chip to be ready.
    SX126xWaitOnBusy( );

    // Update operating mode context variable
    SX126xSetOperatingMode( MODE_STDBY_RC );

    CRITICAL_SECTION_END( );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x2218(%rip), %rdi      # 0x6afc
callq 0x2280
leaq -0x2(%rbp), %rdi
movb $-0x40, (%rdi)
leaq -0x1(%rbp), %rdx
movb $0x0, (%rdx)
pushq $0x1
popq %rcx
movl %ecx, %esi
callq 0x4916
callq 0x48ba
movl $0x1, 0x5bb0(%rip)      # 0xa4c0
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x-linux.c
// Function: sx126x_hal_write
static int sx126x_hal_write( 
    const void* context, const uint8_t* command, const uint16_t command_length,
    const uint8_t* data, const uint16_t data_length ) {
    printf("sx126x_hal_write: command_length=%d, data_length=%d\n", command_length, data_length);

    //  Total length is command + data length
    uint16_t len = command_length + data_length;
    assert(len > 0);
    assert(len <= SPI_BUFFER_SIZE);

    //  Clear the SPI Transmit and Receive buffers
    memset(&spi_tx_buf, 0, len);
    memset(&spi_rx_buf, 0, len);

    //  Copy command bytes to SPI Transmit Buffer
    memcpy(&spi_tx_buf, command, command_length);

    //  Copy data bytes to SPI Transmit Buffer
    memcpy(&spi_tx_buf[command_length], data, data_length);

    //  Transmit and receive the SPI buffers
    int rc = transfer_spi(spi_tx_buf, spi_rx_buf, len);
    assert(rc == 0);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r14d
movq %rdx, %r15
movl %esi, %r12d
movq %rdi, %rbx
leaq 0x1f71(%rip), %rdi      # 0x68a8
movl %ecx, %edx
xorl %eax, %eax
callq 0x2050
movl %r14d, %eax
addw %r12w, %ax
je 0x49bb
movq %rbx, -0x30(%rbp)
cmpw $0x401, %ax             # imm = 0x401
jae 0x49da
movzwl %ax, %r13d
leaq 0x5b6e(%rip), %rbx      # 0xa4d0
movq %rbx, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x20e0
leaq 0x5f5a(%rip), %rdi      # 0xa8d0
xorl %esi, %esi
movq %r13, %rdx
callq 0x20e0
movzwl %r12w, %r12d
movq %rbx, %rdi
movq -0x30(%rbp), %rsi
movq %r12, %rdx
callq 0x2150
addq %r12, %rbx
movzwl %r14w, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2150
movl %r13d, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4f4e
leaq 0x1f1b(%rip), %rdi      # 0x68dd
leaq 0x1d59(%rip), %rsi      # 0x6722
leaq 0x1f15(%rip), %rcx      # 0x68e5
movl $0x228, %edx            # imm = 0x228
callq 0x2100
leaq 0x1f69(%rip), %rdi      # 0x694a
leaq 0x1d3a(%rip), %rsi      # 0x6722
leaq 0x1ef6(%rip), %rcx      # 0x68e5
movl $0x229, %edx            # imm = 0x229
callq 0x2100
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x-linux.c
// Function: SX126xWriteCommand
void SX126xWriteCommand( RadioCommands_t command, uint8_t *buffer, uint16_t size )
{
    SX126xCheckDeviceReady( );

    //  Write the command followed by buffer
    uint8_t commands[1] = { (uint8_t) command };
    int rc = sx126x_hal_write(NULL, commands, sizeof(commands), buffer, size);
    assert(rc == 0);

    if( command != RADIO_SET_SLEEP )
    {
        SX126xWaitOnBusy( );
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movl %edi, %r15d
callq 0x3bf6
leaq -0x19(%rbp), %rdi
movb %r15b, (%rdi)
pushq $0x1
popq %rsi
movq %r14, %rdx
movl %ebx, %ecx
callq 0x4916
addq $0x8, %rsp
cmpl $0x84, %r15d
jne 0x4a38
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x48ba
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x-linux.c
// Function: SX126xReadCommand
uint8_t SX126xReadCommand( RadioCommands_t command, uint8_t *buffer, uint16_t size )
{
    printf("SX126xReadCommand: command=0x%02x, size=%d\r\n", command, size);
    uint8_t status = 0;

    SX126xCheckDeviceReady( );

    //  Write the command, read the status and read the buffer
    uint8_t commandStatus[2] = { 
        (uint8_t) command,  //  Command
        0                   //  Status
    };
    int rc = sx126x_hal_read(NULL, commandStatus, sizeof(commandStatus), buffer, size, &status);
    assert(rc == 0);
    printf("status=0x%02x\n", status);

#ifdef NOTUSED  //  Previously...
    bl_gpio_output_set( SX126X_SPI_CS_PIN, 0 );
    if (SX126X_DEBUG_CS_PIN >= 0) { bl_gpio_output_set( SX126X_DEBUG_CS_PIN, 0 ); }

    SpiInOut( SX126X_SPI_IDX, ( uint8_t )command );
    status = SpiInOut( SX126X_SPI_IDX, 0x00 );
    for( uint16_t i = 0; i < size; i++ )
    {
        buffer[i] = SpiInOut( SX126X_SPI_IDX, 0 );
    }

    bl_gpio_output_set( SX126X_SPI_CS_PIN, 1 );
    if (SX126X_DEBUG_CS_PIN >= 0) { bl_gpio_output_set( SX126X_DEBUG_CS_PIN, 1 ); }
#endif  //  NOTUSED

    SX126xWaitOnBusy( );

    return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r14d
movq %rsi, %r15
movl %edi, %r12d
leaq 0x1cd4(%rip), %rdi      # 0x6735
xorl %r13d, %r13d
movl %r12d, %esi
xorl %eax, %eax
callq 0x2050
leaq -0x29(%rbp), %rbx
movb %r13b, (%rbx)
callq 0x3bf6
leaq -0x2b(%rbp), %rdi
movb %r12b, (%rdi)
movb %r13b, 0x1(%rdi)
pushq $0x2
popq %rsi
movq %r15, %rdx
movl %r14d, %ecx
movq %rbx, %r8
callq 0x4abd
movzbl (%rbx), %esi
leaq 0x1cc2(%rip), %rdi      # 0x6762
xorl %eax, %eax
callq 0x2050
callq 0x48ba
movb (%rbx), %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x-linux.c
// Function: sx126x_hal_read
static int sx126x_hal_read( 
    const void* context, const uint8_t* command, const uint16_t command_length,
    uint8_t* data, const uint16_t data_length, uint8_t *status ) {
    printf("sx126x_hal_read: command_length=%d, data_length=%d\n", command_length, data_length);

    //  Total length is command + data length
    uint16_t len = command_length + data_length;
    assert(len > 0);
    assert(len <= SPI_BUFFER_SIZE);

    //  Clear the SPI Transmit and Receive buffers
    memset(&spi_tx_buf, 0, len);
    memset(&spi_rx_buf, 0, len);

    //  Copy command bytes to SPI Transmit Buffer
    memcpy(&spi_tx_buf, command, command_length);

    //  Transmit and receive the SPI buffers
    int rc = transfer_spi(spi_tx_buf, spi_rx_buf, len);
    assert(rc == 0);

    //  Copy SPI Receive buffer to data buffer
    memcpy(data, &spi_rx_buf[command_length], data_length);

    //  Return the second SPI byte received as status
    if (status != NULL) {
        assert(len >= 2);
        *status = spi_rx_buf[1];
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r14
movl %ecx, %r15d
movq %rdx, %r12
movl %esi, %r13d
movq %rdi, -0x40(%rbp)
leaq 0x1ee9(%rip), %rdi      # 0x69ce
movl %ecx, %edx
xorl %eax, %eax
callq 0x2050
movl %r15d, %ebx
addw %r13w, %bx
je 0x4b8f
movq %r12, -0x30(%rbp)
movq %r14, -0x38(%rbp)
cmpw $0x401, %bx             # imm = 0x401
jae 0x4bae
movzwl %bx, %r14d
leaq 0x59b7(%rip), %rdi      # 0xa4d0
xorl %esi, %esi
movq %r14, %rdx
callq 0x20e0
leaq 0x5da6(%rip), %r12      # 0xa8d0
movq %r12, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x20e0
movzwl %r13w, %r13d
leaq 0x598e(%rip), %rdi      # 0xa4d0
movq -0x40(%rbp), %rsi
movq %r13, %rdx
callq 0x2150
movl %r14d, %edi
callq 0x4f4e
addq %r13, %r12
movzwl %r15w, %edx
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x2150
movq -0x38(%rbp), %rcx
testq %rcx, %rcx
je 0x4b80
cmpw $0x1, %bx
je 0x4bcd
movb 0x5d53(%rip), %al       # 0xa8d1
movb %al, (%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1d47(%rip), %rdi      # 0x68dd
leaq 0x1b85(%rip), %rsi      # 0x6722
leaq 0x1e5e(%rip), %rcx      # 0x6a02
movl $0x250, %edx            # imm = 0x250
callq 0x2100
leaq 0x1d95(%rip), %rdi      # 0x694a
leaq 0x1b66(%rip), %rsi      # 0x6722
leaq 0x1e3f(%rip), %rcx      # 0x6a02
movl $0x251, %edx            # imm = 0x251
callq 0x2100
leaq 0x1e97(%rip), %rdi      # 0x6a6b
leaq 0x1b47(%rip), %rsi      # 0x6722
leaq 0x1e20(%rip), %rcx      # 0x6a02
movl $0x263, %edx            # imm = 0x263
callq 0x2100
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x-linux.c
// Function: SX126xWriteRegisters
void SX126xWriteRegisters( uint16_t address, uint8_t *buffer, uint16_t size )
{
    SX126xCheckDeviceReady( );
    int rc = sx126x_write_register(NULL, address, buffer, size);
    assert(rc == 0);
    SX126xWaitOnBusy( );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %r14
movl %edi, %ebx
callq 0x3bf6
leaq -0x1b(%rbp), %rdi
movb $0xd, (%rdi)
movb %bh, -0x1a(%rbp)
movb %bl, 0x2(%rdi)
movzbl %r15b, %ecx
pushq $0x3
popq %rsi
movq %r14, %rdx
callq 0x4916
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x48ba
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x-linux.c
// Function: SX126xReadRegisters
void SX126xReadRegisters( uint16_t address, uint8_t *buffer, uint16_t size )
{
    SX126xCheckDeviceReady( );
    int rc = sx126x_read_register(NULL, address, buffer, size);
    assert(rc == 0);
    SX126xWaitOnBusy( );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %r14
movl %edi, %ebx
callq 0x3bf6
leaq -0x1c(%rbp), %rdi
movl $0x1d, (%rdi)
movb %bh, -0x1b(%rbp)
movb %bl, 0x2(%rdi)
movzbl %r15b, %ecx
pushq $0x4
popq %rsi
movq %r14, %rdx
xorl %r8d, %r8d
callq 0x4abd
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x48ba
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x-linux.c
// Function: SX126xWriteBuffer
void SX126xWriteBuffer( uint8_t offset, uint8_t *buffer, uint8_t size )
{
    SX126xCheckDeviceReady( );
    int rc = sx126x_write_buffer(NULL, offset, buffer, size);
    assert(rc == 0);
    SX126xWaitOnBusy( );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movl %edi, %r15d
callq 0x3bf6
leaq -0x1a(%rbp), %rdi
movw $0xe, (%rdi)
movb %r15b, 0x1(%rdi)
pushq $0x2
popq %rsi
movq %r14, %rdx
movl %ebx, %ecx
callq 0x4916
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x48ba
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x-linux.c
// Function: SX126xReadBuffer
void SX126xReadBuffer( uint8_t offset, uint8_t *buffer, uint8_t size )
{
    SX126xCheckDeviceReady( );
    int rc = sx126x_read_buffer(NULL, offset, buffer, size);
    assert(rc == 0);
    SX126xWaitOnBusy( );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movl %edi, %r15d
callq 0x3bf6
leaq -0x1b(%rbp), %rdi
movb $0x1e, (%rdi)
movb %r15b, 0x1(%rdi)
movb $0x0, 0x2(%rdi)
pushq $0x3
popq %rsi
movq %r14, %rdx
movl %ebx, %ecx
xorl %r8d, %r8d
callq 0x4abd
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x48ba
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x-linux.c
// Function: TimerInit
void TimerInit(
    struct ble_npl_callout *timer,  //  The timer to initialize. Cannot be NULL.
    ble_npl_event_fn *f)            //  The timer callback function. Cannot be NULL.
{
    puts("TimerInit");
    assert(timer != NULL);
    assert(f != NULL);

    //  Event Queue containing Events to be processed, defined in demo.c.  TODO: Move to header file.
    extern struct ble_npl_eventq event_queue;

    //  Init the Callout Timer with the Callback Function
    ble_npl_callout_init(
        timer,         //  Callout Timer
        &event_queue,  //  Event Queue that will handle the Callout upon timeout
        f,             //  Callback Function
        NULL           //  Argument to be passed to Callback Function
    );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x19e0(%rip), %rdi      # 0x678d
callq 0x2280
testq %r14, %r14
je 0x4dd4
testq %rbx, %rbx
je 0x4df3
leaq 0x540d(%rip), %rsi      # 0xa1d0
movq %r14, %rdi
movq %rbx, %rdx
xorl %ecx, %ecx
popq %rbx
popq %r14
popq %rbp
jmp 0x50ec
leaq 0x19bc(%rip), %rdi      # 0x6797
leaq 0x1940(%rip), %rsi      # 0x6722
leaq 0x19bc(%rip), %rcx      # 0x67a5
movl $0x16f, %edx            # imm = 0x16F
callq 0x2100
leaq 0x19e8(%rip), %rdi      # 0x67e2
leaq 0x1921(%rip), %rsi      # 0x6722
leaq 0x199d(%rip), %rcx      # 0x67a5
movl $0x170, %edx            # imm = 0x170
callq 0x2100
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x-linux.c
// Function: TimerStop
void TimerStop(
    struct ble_npl_callout *timer)  //  Pointer to timer to stop. Cannot be NULL.
{
    puts("TimerStop");
    assert(timer != NULL);

    //  If Callout Timer is still running...
    if (ble_npl_callout_is_active(timer)) {
        //  Stop the Callout Timer
        ble_npl_callout_stop(timer);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x19ca(%rip), %rdi      # 0x67ec
callq 0x2280
testq %rbx, %rbx
je 0x4e4d
movq %rbx, %rdi
callq 0x517e
testb %al, %al
je 0x4e46
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5232
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x1943(%rip), %rdi      # 0x6797
leaq 0x18c7(%rip), %rsi      # 0x6722
leaq 0x1994(%rip), %rcx      # 0x67f6
movl $0x183, %edx            # imm = 0x183
callq 0x2100
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x-linux.c
// Function: TimerStart
void TimerStart(
    struct ble_npl_callout *timer,  //  Pointer to timer. Cannot be NULL.
    uint32_t millisecs)             //  The number of milliseconds from now at which the timer will expire.
{
    puts("TimerStart");
    assert(timer != NULL);

    //  Stop the timer if running
    TimerStop(timer);

    //  Convert milliseconds to ticks
    ble_npl_time_t ticks = ble_npl_time_ms_to_ticks32(
        millisecs  //  Duration in milliseconds
    );

    //  Wait at least 1 tick
    if (ticks == 0) { ticks = 1; }

    //  Trigger the Callout Timer after the elapsed ticks
    ble_npl_error_t rc = ble_npl_callout_reset(
        timer,  //  Callout Timer
        ticks   //  Number of ticks
    );
    assert(rc == 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
leaq 0x199f(%rip), %rdi      # 0x681f
callq 0x2280
testq %rbx, %rbx
je 0x4eb3
movq %rbx, %rdi
callq 0x4e12
movl %r14d, %edi
callq 0x552b
cmpl $0x1, %eax
adcl $0x0, %eax
movq %rbx, %rdi
movl %eax, %esi
callq 0x5197
testl %eax, %eax
jne 0x4ed2
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x18dd(%rip), %rdi      # 0x6797
leaq 0x1861(%rip), %rsi      # 0x6722
leaq 0x1962(%rip), %rcx      # 0x682a
movl $0x192, %edx            # imm = 0x192
callq 0x2100
leaq 0x1841(%rip), %rdi      # 0x671a
leaq 0x1842(%rip), %rsi      # 0x6722
leaq 0x1943(%rip), %rcx      # 0x682a
movl $0x1a4, %edx            # imm = 0x1A4
callq 0x2100
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/src/sx126x-linux.c
// Function: transfer_spi
static int transfer_spi(const uint8_t *tx_buf, uint8_t *rx_buf, uint16_t len) {
    assert(spi > 0);
    assert(len > 0);
    assert(len <= 31);  //  CAUTION: CH341 SPI doesn't seem to support 32-byte SPI transfers 

    //  Prepare SPI Transfer
    struct spi_ioc_transfer spi_trans;
    memset(&spi_trans, 0, sizeof(spi_trans));
    spi_trans.tx_buf = (unsigned long) tx_buf;  //  Transmit Buffer
    spi_trans.rx_buf = (unsigned long) rx_buf;  //  Receive Buffer
    spi_trans.cs_change = true;   //  Set SPI Chip Select to Low
    spi_trans.len       = len;    //  How many bytes
    printf("spi tx: "); for (int i = 0; i < len; i++) { printf("%02x ", tx_buf[i]); } printf("\n");

    //  Transfer and receive the SPI buffers
    int rc = ioctl(spi, SPI_IOC_MESSAGE(1), &spi_trans);
    assert(rc >= 0);
    assert(rc == len);

    printf("spi rx: "); for (int i = 0; i < len; i++) { printf("%02x ", rx_buf[i]); } printf("\n");
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
cmpl $0x0, 0x5d6a(%rip)      # 0xacd0
jle 0x5051
testw %di, %di
je 0x5070
cmpw $0x20, %di
jae 0x508f
movzwl %di, %r14d
xorps %xmm0, %xmm0
movups %xmm0, -0x38(%rbp)
leaq 0x553f(%rip), %r12      # 0xa4d0
movq %r12, -0x48(%rbp)
leaq 0x5934(%rip), %r15      # 0xa8d0
movq %r15, -0x40(%rbp)
movb $0x1, -0x2d(%rbp)
movl %r14d, -0x38(%rbp)
leaq 0x19fb(%rip), %rdi      # 0x69aa
xorl %eax, %eax
callq 0x2050
leaq 0x10bf(%rip), %rbx      # 0x607c
xorl %r13d, %r13d
cmpq %r13, %r14
je 0x4fda
movzbl (%r13,%r12), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
incq %r13
jmp 0x4fc0
pushq $0xa
popq %rdi
callq 0x21e0
movl 0x5ce8(%rip), %edi      # 0xacd0
leaq -0x48(%rbp), %rdx
movl $0x40206b00, %esi       # imm = 0x40206B00
xorl %eax, %eax
callq 0x2200
testl %eax, %eax
js 0x50ae
cmpl %r14d, %eax
jne 0x50cd
leaq 0x19b5(%rip), %rdi      # 0x69c5
xorl %eax, %eax
callq 0x2050
leaq 0x105e(%rip), %rbx      # 0x607c
xorl %r12d, %r12d
cmpq %r12, %r14
je 0x503a
movzbl (%r12,%r15), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
incq %r12
jmp 0x5021
pushq $0xa
popq %rdi
callq 0x21e0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1909(%rip), %rdi      # 0x6961
leaq 0x16c3(%rip), %rsi      # 0x6722
leaq 0x1903(%rip), %rcx      # 0x6969
movl $0x29f, %edx            # imm = 0x29F
callq 0x2100
leaq 0x1866(%rip), %rdi      # 0x68dd
leaq 0x16a4(%rip), %rsi      # 0x6722
leaq 0x18e4(%rip), %rcx      # 0x6969
movl $0x2a0, %edx            # imm = 0x2A0
callq 0x2100
leaq 0x190a(%rip), %rdi      # 0x69a0
leaq 0x1685(%rip), %rsi      # 0x6722
leaq 0x18c5(%rip), %rcx      # 0x6969
movl $0x2a1, %edx            # imm = 0x2A1
callq 0x2100
leaq 0x18fe(%rip), %rdi      # 0x69b3
leaq 0x1666(%rip), %rsi      # 0x6722
leaq 0x18a6(%rip), %rcx      # 0x6969
movl $0x2ae, %edx            # imm = 0x2AE
callq 0x2100
leaq 0x18e7(%rip), %rdi      # 0x69bb
leaq 0x1647(%rip), %rsi      # 0x6722
leaq 0x1887(%rip), %rcx      # 0x6969
movl $0x2af, %edx            # imm = 0x2AF
callq 0x2100
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/npl/linux/src/os_callout.c
// Function: ble_npl_callout_init
void ble_npl_callout_init(struct ble_npl_callout *c, 
                          struct ble_npl_eventq *evq,
                          ble_npl_event_fn *ev_cb, 
                          void *ev_arg)
{
    struct sigevent         event;

    /* Initialize the callout. */
    memset(c, 0, sizeof(*c));
    c->c_ev.ev_cb = ev_cb;
    c->c_ev.ev_arg = ev_arg;
    c->c_evq = evq;
    c->c_active = false;

    event.sigev_notify = SIGEV_THREAD;
    event.sigev_value.sival_ptr = c;     // put callout obj in signal args
    event.sigev_notify_function = ble_npl_callout_timer_cb;
    event.sigev_notify_attributes = NULL;

    timer_create(CLOCK_REALTIME, &event, &c->c_timer);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, 0x20(%rdi)
andq $0x0, 0x30(%rdi)
movq %rdx, 0x8(%rdi)
movq %rcx, 0x10(%rdi)
movq %rsi, 0x18(%rdi)
leaq -0x40(%rbp), %rsi
movl $0x2, 0xc(%rsi)
movq %rdi, (%rsi)
leaq 0x1a(%rip), %rax        # 0x5142
movq %rax, 0x10(%rsi)
andq $0x0, 0x18(%rsi)
leaq 0x28(%rdi), %rdx
xorl %edi, %edi
callq 0x2080
addq $0x40, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/npl/linux/src/os_callout.c
// Function: ble_npl_callout_timer_cb
static void
ble_npl_callout_timer_cb(union sigval sv)
{
    struct ble_npl_callout *c = (struct ble_npl_callout *)sv.sival_ptr;
    assert(c);

    if (c->c_evq) {
        ble_npl_eventq_put(c->c_evq, &c->c_ev);
    } else {
        c->c_ev.ev_cb(&c->c_ev);
    }
}

// Assembly:
testq %rdi, %rdi
je 0x515d
movq %rdi, %rsi
movq 0x18(%rdi), %rdi
testq %rdi, %rdi
jne 0x247b
movq %rsi, %rdi
jmpq *0x8(%rsi)
pushq %rbp
movq %rsp, %rbp
leaq 0x1a31(%rip), %rdi      # 0x6b99
leaq 0x19ca(%rip), %rsi      # 0x6b39
leaq 0x19de(%rip), %rcx      # 0x6b54
pushq $0x22
popq %rdx
callq 0x2100
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/npl/linux/src/os_callout.c
// Function: ble_npl_callout_reset
ble_npl_error_t ble_npl_callout_reset(struct ble_npl_callout *c,
				      ble_npl_time_t ticks)
{
    struct itimerspec       its;

    if (ticks < 0) {
        return BLE_NPL_EINVAL;
    }

    if (ticks == 0) {
        ticks = 1;
    }

    c->c_ticks = ble_npl_time_get() + ticks;

    its.it_interval.tv_sec = 0;
    its.it_interval.tv_nsec = 0;                     // one shot
    its.it_value.tv_sec = (ticks / 1000);
    its.it_value.tv_nsec = (ticks % 1000) * 1000000; // expiration
    its.it_value.tv_nsec %= 1000000000;
    c->c_active = true;
    timer_settime(c->c_timer, 0, &its, NULL);

    return BLE_NPL_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %esi, %r14d
movq %rdi, %rbx
cmpl $0x1, %esi
adcl $0x0, %r14d
callq 0x54d0
addl %r14d, %eax
movl %eax, 0x20(%rbx)
movl $0x3e8, %ecx            # imm = 0x3E8
movl %r14d, %eax
xorl %edx, %edx
divl %ecx
xorps %xmm0, %xmm0
leaq -0x30(%rbp), %rcx
movaps %xmm0, (%rcx)
movq %rax, 0x10(%rcx)
imull $0xf4240, %edx, %eax    # imm = 0xF4240
movq %rax, 0x18(%rcx)
movb $0x1, 0x30(%rbx)
movq 0x28(%rbx), %rdi
xorl %esi, %esi
movq %rcx, %rdx
xorl %ecx, %ecx
callq 0x2290
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/npl/linux/src/os_callout.c
// Function: ble_npl_callout_stop
void ble_npl_callout_stop(struct ble_npl_callout *c)
{
    if (!ble_npl_callout_inited(c)) {
        return;
    }

    struct itimerspec its;
    its.it_interval.tv_sec = 0;
    its.it_interval.tv_nsec = 0;
    its.it_value.tv_sec = 0;
    its.it_value.tv_nsec = 0;
    timer_settime(c->c_timer, 0, &its, NULL);
    c->c_active = false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x28(%rdi), %rdi
testq %rdi, %rdi
je 0x5262
xorps %xmm0, %xmm0
leaq -0x30(%rbp), %rdx
movaps %xmm0, 0x10(%rdx)
movaps %xmm0, (%rdx)
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x2290
movb $0x0, 0x30(%rbx)
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/npl/linux/src/os_callout.c
// Function: ble_npl_callout_remaining_ticks
uint32_t
ble_npl_callout_remaining_ticks(struct ble_npl_callout *co,
                                ble_npl_time_t now)
{
    ble_npl_time_t rt;
    uint32_t exp;

    struct itimerspec its;
    timer_gettime(co->c_timer, &its);

    exp = its.it_value.tv_sec * 1000;

    if (exp > now) {
        rt = exp - now;
    } else {
        rt = 0;
    }

    return rt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %esi, %ebx
movq 0x28(%rdi), %rdi
leaq -0x30(%rbp), %r14
movq %r14, %rsi
callq 0x20c0
imull $0x3e8, 0x10(%r14), %eax # imm = 0x3E8
xorl %ecx, %ecx
subl %ebx, %eax
cmovbl %ecx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/npl/linux/src/os_sem.c
// Function: ble_npl_sem_pend
ble_npl_error_t
ble_npl_sem_pend(struct ble_npl_sem *sem, uint32_t timeout)
{
    int err = 0;
    struct timespec wait;

    if (!sem) {
        return BLE_NPL_INVALID_PARAM;
    }

    if (timeout == BLE_NPL_TIME_FOREVER) {
        err = sem_wait(&sem->lock);
    } else {
        err = clock_gettime(CLOCK_REALTIME, &wait);
        if (err) {
            return BLE_NPL_ERROR;
        }

        wait.tv_sec  += timeout / 1000;
        wait.tv_nsec += (timeout % 1000) * 1000000;

        err = sem_timedwait(&sem->lock, &wait);
        if (err && errno == ETIMEDOUT) {
            return BLE_NPL_TIMEOUT;
        }
    }

    return (err) ? BLE_NPL_ERROR : BLE_NPL_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
testq %rdi, %rdi
je 0x5329
movl %esi, %r15d
movq %rdi, %r14
cmpl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
jne 0x532d
movq %r14, %rdi
callq 0x20f0
testl %eax, %eax
pushq $0xc
popq %rbx
cmovel %eax, %ebx
jmp 0x5341
pushq $0x3
jmp 0x5340
xorl %ebx, %ebx
leaq -0x28(%rbp), %rsi
xorl %edi, %edi
callq 0x2180
testl %eax, %eax
je 0x534e
pushq $0xc
popq %rbx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x3e8, %ecx            # imm = 0x3E8
movl %r15d, %eax
xorl %edx, %edx
divl %ecx
leaq -0x28(%rbp), %rsi
addq %rax, (%rsi)
imull $0xf4240, %edx, %eax    # imm = 0xF4240
addq %rax, 0x8(%rsi)
movq %r14, %rdi
callq 0x22b0
testl %eax, %eax
je 0x5341
callq 0x2040
cmpl $0x6e, (%rax)
pushq $0x6
popq %rax
jmp 0x5321
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/npl/linux/src/os_sem.c
// Function: ble_npl_sem_get_count
uint16_t
ble_npl_sem_get_count(struct ble_npl_sem *sem)
{
    int count;

    assert(sem);
    assert(&sem->lock);
    sem_getvalue(&sem->lock, &count);

    return count;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x53a5
leaq -0xc(%rbp), %rbx
movq %rbx, %rsi
callq 0x2260
movzwl (%rbx), %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x17d4(%rip), %rdi      # 0x6b80
leaq 0x17d1(%rip), %rsi      # 0x6b84
leaq 0x17e1(%rip), %rcx      # 0x6b9b
pushq $0x58
popq %rdx
callq 0x2100
nop
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/npl/linux/src/os_task.c
// Function: ble_npl_task_init
int
ble_npl_task_init(struct ble_npl_task *t, const char *name, ble_npl_task_func_t func,
        void *arg, uint8_t prio, ble_npl_time_t sanity_itvl,
        ble_npl_stack_t *stack_bottom, uint16_t stack_size)
{
    int err;
    if ((t == NULL) || (func == NULL)) {
        return OS_INVALID_PARM;
    }

    err = pthread_attr_init(&t->attr);
    if (err) return err;
    err = pthread_attr_getschedparam (&t->attr, &t->param);
    if (err) return err;
    err = pthread_attr_setschedpolicy(&t->attr, SCHED_RR);
    if (err) return err;
    t->param.sched_priority = prio;
    err = pthread_attr_setschedparam (&t->attr, &t->param);
    if (err) return err;

    t->name = name;
    err = pthread_create(&t->handle, &t->attr, func, arg);

    return err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
testq %rdi, %rdi
sete %al
testq %rdx, %rdx
sete %dl
orb %al, %dl
je 0x53ed
pushq $-0x1
popq %rax
jmp 0x5442
movl %r8d, %ebx
movq %rsi, %r12
movq %rdi, %r15
movq %rcx, -0x38(%rbp)
leaq 0x8(%rdi), %r13
movq %r13, %rdi
callq 0x21c0
testl %eax, %eax
jne 0x5442
leaq 0x40(%r15), %rsi
movq %r13, %rdi
movq %rsi, -0x30(%rbp)
callq 0x22f0
testl %eax, %eax
jne 0x5442
pushq $0x2
popq %rsi
movq %r13, %rdi
callq 0x21d0
testl %eax, %eax
jne 0x5442
movzbl %bl, %eax
movq -0x30(%rbp), %rsi
movl %eax, (%rsi)
movq %r13, %rdi
callq 0x20d0
testl %eax, %eax
je 0x5451
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, 0x48(%r15)
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq -0x38(%rbp), %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x22d0
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/npl/linux/src/os_time.c
// Function: ble_npl_time_delay
void
ble_npl_time_delay(ble_npl_time_t ticks)
{
    struct timespec sleep_time;
    long ms = ble_npl_time_ticks_to_ms32(ticks);
    uint32_t s = ms / 1000;

    ms -= s * 1000;
    sleep_time.tv_sec = s;
    sleep_time.tv_nsec = ms * 1000000;

    nanosleep(&sleep_time, NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, %eax
movl %edi, %ecx
movl $0x3e8, %esi            # imm = 0x3E8
xorl %edx, %edx
divl %esi
imull $0x3e8, %eax, %edx      # imm = 0x3E8
subq %rdx, %rcx
leaq -0x10(%rbp), %rdi
movq %rax, (%rdi)
imulq $0xf4240, %rcx, %rax    # imm = 0xF4240
movq %rax, 0x8(%rdi)
xorl %esi, %esi
callq 0x2090
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/npl/linux/src/os_mutex.c
// Function: ble_npl_mutex_init
ble_npl_error_t
ble_npl_mutex_init(struct ble_npl_mutex *mu)
{
    if (!mu) {
        return BLE_NPL_INVALID_PARAM;
    }

    pthread_mutexattr_init(&mu->attr);
    pthread_mutexattr_settype(&mu->attr, PTHREAD_MUTEX_RECURSIVE_NP);
    pthread_mutex_init(&mu->lock, &mu->attr);

    return BLE_NPL_OK;
}

// Assembly:
testq %rdi, %rdi
je 0x55b0
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x28(%rdi), %r14
movq %r14, %rdi
callq 0x2060
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x2240
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2250
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x3
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/lupyuen[P]lora-sx1262/npl/linux/src/os_mutex.c
// Function: ble_npl_mutex_pend
ble_npl_error_t
ble_npl_mutex_pend(struct ble_npl_mutex *mu, uint32_t timeout)
{
    int err;

    if (!mu) {
        return BLE_NPL_INVALID_PARAM;
    }

    if (timeout == BLE_NPL_TIME_FOREVER) {
        err = pthread_mutex_lock(&mu->lock);
    } else {
        err = clock_gettime(CLOCK_REALTIME, &mu->wait);
        if (err) {
            return BLE_NPL_ERROR;
        }

        mu->wait.tv_sec  += timeout / 1000;
        mu->wait.tv_nsec += (timeout % 1000) * 1000000;

        err = pthread_mutex_timedlock(&mu->lock, &mu->wait);
        if (err == ETIMEDOUT) {
            return BLE_NPL_TIMEOUT;
        }
    }

    return (err) ? BLE_NPL_ERROR : BLE_NPL_OK;
}

// Assembly:
testq %rdi, %rdi
je 0x5603
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r15d
movq %rdi, %rbx
cmpl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
jne 0x5607
movq %rbx, %rdi
callq 0x2230
movl %eax, %ecx
testl %ecx, %ecx
pushq $0xc
popq %rax
cmovel %ecx, %eax
jmp 0x564c
pushq $0x3
popq %rax
retq
leaq 0x30(%rbx), %r14
xorl %edi, %edi
movq %r14, %rsi
callq 0x2180
testl %eax, %eax
je 0x561d
pushq $0xc
jmp 0x564b
movl $0x3e8, %ecx            # imm = 0x3E8
movl %r15d, %eax
xorl %edx, %edx
divl %ecx
addq %rax, 0x30(%rbx)
imull $0xf4240, %edx, %eax    # imm = 0xF4240
addq %rax, 0x38(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22e0
movl %eax, %ecx
cmpl $0x6e, %eax
jne 0x55f9
pushq $0x6
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/skeeto[P]goblin-com/src/main.c
// Function: popup_quit
static bool
popup_quit(bool saving)
{
    panel_t popup;
    char *message;
    if (saving)
        message = "Really save and quit? (Rk{y}/Rk{n})";
    else
        message = "Really quit Yk{without saving}? (Rk{y}/Rk{n})";
    size_t length = strlen(message) - 8;
    panel_center_init(&popup, length + 2, 3);
    panel_printf(&popup, 1, 1, message);
    display_push(&popup);
    display_refresh();
    int input = device_getch();
    display_pop_free();
    display_refresh();
    if (input == 'y' || input == 'Y')
        return true;
    return false;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x3c18, %rsp           # imm = 0x3C18
leaq 0x3ce9(%rip), %rax      # 0x6580
leaq 0x3d06(%rip), %rbx      # 0x65a4
testl %edi, %edi
cmovneq %rax, %rbx
pushq $0x1d
popq %rax
pushq $0x27
popq %rsi
cmovnel %eax, %esi
movq %rsp, %r14
pushq $0x3
popq %rdx
movq %r14, %rdi
callq 0x30ec
pushq $0x1
popq %rdx
movq %r14, %rdi
movl %edx, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x32c4
movq %r14, %rdi
callq 0x3077
callq 0x2eea
callq 0x5522
movl %eax, %ebx
callq 0x30ab
callq 0x2eea
andl $-0x21, %ebx
cmpl $0x59, %ebx
sete %al
addq $0x3c18, %rsp           # imm = 0x3C18
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/skeeto[P]goblin-com/src/main.c
// Function: game_getch
static int
game_getch(game_t *game, panel_t *terrain)
{
    for (;;) {
        map_draw_terrain(game->map, terrain);
        display_refresh();
        uint64_t wait = device_uepoch() % PERIOD;
        if (device_kbhit(wait))
            return device_getch();
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl $0x1046a, %r15d         # imm = 0x1046A
movq 0x38(%r14), %rdi
movq %rbx, %rsi
callq 0x3d13
callq 0x2eea
callq 0x55de
xorl %edx, %edx
divq %r15
movq %rdx, %rdi
callq 0x5587
testb %al, %al
je 0x2b33
popq %rbx
popq %r14
popq %r15
jmp 0x5522
// File: /workspace/github_c_makefile_star2_O2/skeeto[P]goblin-com/src/main.c
// Function: popup_message
static void
popup_message(font_t font, char *format, ...)
{
    va_list ap;
    va_start(ap, format);
    int length = vsnprintf(NULL, 0, format, ap);
    va_end(ap);
    va_start(ap, format);
    char buffer[length + 1];
    vsprintf(buffer, format, ap);
    va_end(ap);
    int width = length + 2;
    int height = 3;
    panel_t popup;
    panel_center_init(&popup, width, height);
    panel_puts(&popup, 1, 1, font, buffer);
    display_push(&popup);
    for (;;) {
        int key = display_getch();
        if (is_exit_key(key) || key == 13 || key == ' ')
            break;
    }
    display_pop_free();
    display_refresh();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3cf8, %rsp           # imm = 0x3CF8
movq %rsi, %rbx
leaq -0x100(%rbp), %r12
movq %rdx, 0x10(%r12)
movq %rcx, 0x18(%r12)
movq %r8, 0x20(%r12)
movq %r9, 0x28(%r12)
testb %al, %al
je 0x2bc9
movaps %xmm0, -0xd0(%rbp)
movaps %xmm1, -0xc0(%rbp)
movaps %xmm2, -0xb0(%rbp)
movaps %xmm3, -0xa0(%rbp)
movaps %xmm4, -0x90(%rbp)
movaps %xmm5, -0x80(%rbp)
movaps %xmm6, -0x70(%rbp)
movaps %xmm7, -0x60(%rbp)
leaq -0x50(%rbp), %r14
movq %r12, 0x10(%r14)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%r14)
movabsq $0x3000000010, %r13     # imm = 0x3000000010
movq %r13, (%r14)
xorl %edi, %edi
xorl %esi, %esi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x1090
movl %eax, %r15d
movq %rsp, -0x30(%rbp)
movq %r13, (%r14)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%r14)
movq %r12, 0x10(%r14)
leal 0x1(%r15), %eax
addq $0xf, %rax
andq $-0x10, %rax
movq %rsp, %r12
subq %rax, %r12
movq %r12, %rsp
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x11e0
addl $0x2, %r15d
leaq -0x3d18(%rbp), %rbx
pushq $0x3
popq %rdx
movq %rbx, %rdi
movl %r15d, %esi
callq 0x30ec
pushq $0x1
popq %rdx
movq %rbx, %rdi
movl %edx, %esi
movl $0x10003, %ecx          # imm = 0x10003
movq %r12, %r8
callq 0x3168
movq %rbx, %rdi
callq 0x3077
callq 0x30e0
movl %eax, %ecx
andl $-0x21, %ecx
cmpl $0x51, %ecx
sete %cl
cmpl $0x1b, %eax
sete %dl
orb %cl, %dl
jne 0x2c88
cmpl $0x20, %eax
je 0x2c88
cmpl $0xd, %eax
jne 0x2c64
callq 0x30ab
callq 0x2eea
movq -0x30(%rbp), %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/skeeto[P]goblin-com/src/main.c
// Function: u8encode
static inline char *
u8encode(uint16_t c)
{
    static int i = 0;
    static char buf[8][7];
    buf[i][utf32_to_8(c, (uint8_t *)buf[i % 8])] = '\0';
    return buf[i++ % 8];
}

// Assembly:
movslq 0x9bdc(%rip), %rcx      # 0xc888
pushq $0x8
popq %rsi
movl %ecx, %eax
cltd
idivl %esi
movslq %edx, %rax
imulq $0x7, %rax, %rax
leaq 0x9bce(%rip), %rdx      # 0xc890
addq %rdx, %rax
cmpw $0x7f, %di
ja 0x2cd2
movb %dil, (%rax)
pushq $0x1
jmp 0x2d23
cmpw $0x7ff, %di             # imm = 0x7FF
ja 0x2cf5
movl %edi, %esi
shrl $0x6, %esi
orb $-0x40, %sil
movb %sil, (%rax)
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x1(%rax)
pushq $0x2
jmp 0x2d23
movzwl %di, %esi
movl %esi, %r8d
shrl $0xc, %r8d
orb $-0x20, %r8b
movb %r8b, (%rax)
shrl $0x6, %esi
andb $0x3f, %sil
orb $-0x80, %sil
movb %sil, 0x1(%rax)
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x2(%rax)
pushq $0x3
popq %rsi
imulq $0x7, %rcx, %rdi
addq %rdi, %rdx
movb $0x0, (%rsi,%rdx)
incl %ecx
movl %ecx, 0x9b51(%rip)      # 0xc888
retq
// File: /workspace/github_c_makefile_star2_O2/skeeto[P]goblin-com/src/main.c
// Function: sideinfo
static int
sideinfo(panel_t *p, char *message)
{
    panel_init(p, DISPLAY_WIDTH - SIDEMENU_WIDTH, 0,
               SIDEMENU_WIDTH, DISPLAY_HEIGHT);
    display_push(p);
    panel_fill(p, FONT(K, k), 0x2591);
    panel_border(p, FONT(K, k));
    int y = DISPLAY_HEIGHT / 2 - 1;
    int x = p->w / 2 - panel_strlen(message) / 2 - 1;
    panel_printf(p, x, y, message);
    return y;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x3c
popq %rsi
pushq $0x14
popq %rcx
pushq $0x18
popq %r8
xorl %edx, %edx
callq 0x2e1a
movq %r14, %rdi
callq 0x3077
movq %r14, %rdi
movl $0x10000, %esi          # imm = 0x10000
movl $0x2591, %edx           # imm = 0x2591
callq 0x3122
movq %r14, %rdi
movl $0x10000, %esi          # imm = 0x10000
callq 0x3629
movl 0x8(%r14), %eax
pushq $0x2
popq %rcx
cltd
idivl %ecx
movl %eax, %ebp
movq %rbx, %rdi
callq 0x370b
shrq %rax
notl %eax
addl %eax, %ebp
pushq $0xb
popq %rdx
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rcx
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x32c4
nop
// File: /workspace/github_c_makefile_star2_O2/skeeto[P]goblin-com/src/display.c
// Function: display_init
void
display_init(void)
{
    device_init();
    panel_init(&display.base, 0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT);
    for (int y = 0; y < DISPLAY_HEIGHT; y++)
        for (int x = 0; x < DISPLAY_WIDTH; x++)
            panel_putc(&display.base, x, y, FONT_DEFAULT, ' ');
    display.panels = &display.base;
    display_refresh();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
callq 0x5308
leaq 0xc809(%rip), %rbx      # 0xf5c8
xorl %ebp, %ebp
pushq $0x50
popq %rcx
pushq $0x18
popq %r8
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2e1a
pushq $0x20
popq %r14
cmpl $0x18, %ebp
je 0x2e04
xorl %r15d, %r15d
cmpl $0x50, %r15d
je 0x2e00
movq %rbx, %rdi
movl %r15d, %esi
movl %ebp, %edx
movl $0x10007, %ecx          # imm = 0x10007
movl %r14d, %r8d
callq 0x2ea2
incl %r15d
jmp 0x2de0
incl %ebp
jmp 0x2dd8
movq %rbx, 0x103d5(%rip)     # 0x131e0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2eea
// File: /workspace/github_c_makefile_star2_O2/skeeto[P]goblin-com/src/display.c
// Function: panel_init
void
panel_init(panel_t *p, int x, int y, int w, int h)
{
    p->x = x;
    p->y = y;
    p->w = w;
    p->h = h;
    assert(w <= DISPLAY_WIDTH);
    assert(h <= DISPLAY_HEIGHT);
    for (int y = 0; y < DISPLAY_HEIGHT; y++)
        for (int x = 0; x < DISPLAY_WIDTH; x++)
            p->tiles[x][y].transparent = true;
    p->next = NULL;
}

// Assembly:
pushq %rax
movl %esi, (%rdi)
movl %edx, 0x4(%rdi)
movl %ecx, 0x8(%rdi)
movl %r8d, 0xc(%rdi)
cmpl $0x51, %ecx
jge 0x2e6c
cmpl $0x18, %r8d
jg 0x2e85
xorl %eax, %eax
pushq $0x12
popq %rcx
movq %rdi, %rdx
cmpq $0x18, %rax
je 0x2e62
movq %rcx, %rsi
cmpq $0x3c12, %rsi           # imm = 0x3C12
je 0x2e59
movb $0x1, (%rdx,%rsi)
addq $0xc0, %rsi
jmp 0x2e43
incq %rax
addq $0x8, %rdx
jmp 0x2e3a
andq $0x0, 0x3c10(%rdi)
popq %rax
retq
leaq 0x3813(%rip), %rdi      # 0x6686
leaq 0x37ea(%rip), %rsi      # 0x6664
leaq 0x3818(%rip), %rcx      # 0x6699
pushq $0x71
jmp 0x2e9c
leaq 0x383c(%rip), %rdi      # 0x66c8
leaq 0x37d1(%rip), %rsi      # 0x6664
leaq 0x37ff(%rip), %rcx      # 0x6699
pushq $0x72
popq %rdx
callq 0x10e0
// File: /workspace/github_c_makefile_star2_O2/skeeto[P]goblin-com/src/display.c
// Function: panel_putc
void
panel_putc(panel_t *p, int x, int y, font_t font, uint16_t c)
{
    x += p->x;
    y += p->y;
    if (x >= 0 && x < p->x + p->w && y >= 0 && y < p->y + p->h) {
        p->tiles[x][y].transparent = false;
        p->tiles[x][y].c = c;
        p->tiles[x][y].font = font;
    }
}

// Assembly:
movl (%rdi), %eax
addl %esi, %eax
js 0x2ee9
movl 0x4(%rdi), %r9d
addl %edx, %r9d
cmpl %esi, 0x8(%rdi)
setg %sil
testl %r9d, %r9d
setns %r10b
andb %sil, %r10b
cmpb $0x1, %r10b
jne 0x2ee9
cmpl %edx, 0xc(%rdi)
jle 0x2ee9
movl %eax, %eax
imulq $0xc0, %rax, %rax
addq %rax, %rdi
movl %r9d, %eax
movb $0x0, 0x12(%rdi,%rax,8)
movw %r8w, 0x10(%rdi,%rax,8)
movl %ecx, 0x13(%rdi,%rax,8)
retq
// File: /workspace/github_c_makefile_star2_O2/skeeto[P]goblin-com/src/display.c
// Function: display_refresh
void
display_refresh(void)
{
    int cx = 0;
    int cy = 0;
    device_move(cx, cy);
    for (int y = 0; y < DISPLAY_HEIGHT; y++) {
        for (int x = 0; x < DISPLAY_WIDTH; x++) {
            panel_t *p = display.panels;
            while (p->tiles[x][y].transparent)
                p = p->next;
            uint16_t oldc = display.current[x][y].c;
            uint16_t newc = p->tiles[x][y].c;
            font_t oldf = display.current[x][y].font;
            font_t newf = p->tiles[x][y].font;
            if (oldc != newc || !font_equal(oldf, newf)) {
                if (cx != x || cy != y)
                    device_move(cx = x, cy = y);
                device_putc(newf, newc);
                display.current[x][y].font = newf;
                display.current[x][y].c = newc;
                cx++;
            }
        }
    }
    device_flush();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
xorl %ebx, %ebx
xorl %edi, %edi
xorl %esi, %esi
callq 0x53ba
movl $0x0, 0xc(%rsp)
xorl %r12d, %r12d
cmpq $0x18, %rbx
je 0x2ff2
imulq $0x6, %rbx, %rax
movq %rax, 0x10(%rsp)
xorl %r14d, %r14d
cmpq $0x50, %r14
je 0x2fea
imulq $0xc0, %r14, %rax
leaq 0x102a4(%rip), %rcx     # 0x131e0
movq (%rcx), %rcx
leaq (%rcx,%rax), %rdx
addq $0x3c10, %rcx           # imm = 0x3C10
cmpb $0x0, 0x12(%rdx,%rbx,8)
jne 0x2f3c
leaq (%rdx,%rbx,8), %rax
addq $0x10, %rax
imulq $0x90, %r14, %rcx
leaq 0x9961(%rip), %rdx      # 0xc8c8
addq %rdx, %rcx
movq 0x10(%rsp), %rdx
leaq (%rcx,%rdx), %r13
movzwl (%rax), %r15d
movl 0x3(%rax), %ebp
cmpw %r15w, (%rdx,%rcx)
jne 0x2f8e
movl 0x2(%r13), %ecx
movl %ecx, %eax
xorl %ebp, %eax
testw %ax, %ax
je 0x2fd2
movl %r12d, %eax
cmpq %rax, %r14
jne 0x2f9f
movl 0xc(%rsp), %eax
cmpq %rax, %rbx
je 0x2fb0
movl %r14d, %edi
movl %ebx, %esi
callq 0x53ba
movl %ebx, 0xc(%rsp)
movl %r14d, %r12d
movzwl %r15w, %r15d
movl %ebp, %edi
movl %r15d, %esi
callq 0x53fe
movl %ebp, 0x2(%r13)
movw %r15w, (%r13)
incl %r12d
incq %r14
jmp 0x2f24
btl $0x18, %ecx
jae 0x2f8e
andl $0x10000, %eax          # imm = 0x10000
jne 0x2f8e
movl %ebp, %eax
andl $0x1000000, %eax        # imm = 0x1000000
jne 0x2fca
jmp 0x2f8e
incq %rbx
jmp 0x2f0e
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5513
// File: /workspace/github_c_makefile_star2_O2/skeeto[P]goblin-com/src/display.c
// Function: display_free
void
display_free()
{
    device_move(0, DISPLAY_HEIGHT);
    panel_free(&display.base);
    device_free();
    assert(display.panels == &display.base);
}

// Assembly:
pushq %rbx
pushq $0x18
popq %rsi
xorl %edi, %edi
callq 0x53ba
leaq 0xc5b1(%rip), %rbx      # 0xf5c8
movq %rbx, %rdi
callq 0x304c
callq 0x539c
cmpq %rbx, 0x101b5(%rip)     # 0x131e0
jne 0x302f
popq %rbx
retq
leaq 0x360e(%rip), %rdi      # 0x6644
leaq 0x3627(%rip), %rsi      # 0x6664
leaq 0x362e(%rip), %rcx      # 0x6672
pushq $0x25
popq %rdx
callq 0x10e0
// File: /workspace/github_c_makefile_star2_O2/skeeto[P]goblin-com/src/display.c
// Function: panel_center_init
void
panel_center_init(panel_t *p, int w, int h)
{
    int x = DISPLAY_WIDTH / 2 - w / 2;
    int y = DISPLAY_HEIGHT / 2 - h / 2;
    panel_init(p, x, y, w, h);
    panel_fill(p, FONT_DEFAULT, ' ');
}

// Assembly:
pushq %rbx
movl %edx, %r8d
movl %esi, %ecx
movq %rdi, %rbx
pushq $-0x2
popq %rdi
movl %esi, %eax
cltd
idivl %edi
leal 0x28(%rax), %esi
movl %r8d, %eax
cltd
idivl %edi
leal 0xc(%rax), %edx
movq %rbx, %rdi
callq 0x2e1a
pushq $0x20
popq %rdx
movq %rbx, %rdi
movl $0x10007, %esi          # imm = 0x10007
popq %rbx
jmp 0x3122
// File: /workspace/github_c_makefile_star2_O2/skeeto[P]goblin-com/src/display.c
// Function: panel_puts
void
panel_puts(panel_t *p, int x, int y, font_t font, const char *s)
{
    for (uint8_t *s8 = (uint8_t *)s; *s8; s8 += utf8_charlen(*s8), x++) {
        uint32_t c = utf8_to_32(s8);
        assert(c <= UINT16_MAX);
        panel_putc(p, x, y, font, c);
    }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r8, %rbx
movl %ecx, %ebp
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %r12
cmpb $0x0, (%rbx)
je 0x31b6
movq %rbx, %rdi
callq 0x31de
cmpl $0x10000, %eax          # imm = 0x10000
jae 0x31bf
movzwl %ax, %r8d
movq %r12, %rdi
movl %r15d, %esi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x2ea2
movzbl (%rbx), %edi
callq 0x327e
addq %rax, %rbx
incl %r15d
jmp 0x317e
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3541(%rip), %rdi      # 0x6707
leaq 0x3497(%rip), %rsi      # 0x6664
leaq 0x3543(%rip), %rcx      # 0x6717
movl $0x9a, %edx
callq 0x10e0