LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/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 0x1d59(%rip), %rdi      # 0x69ce
movl %ecx, %edx
xorl %eax, %eax
callq 0x2050
movl %r15d, %ebx
addw %r13w, %bx
je 0x4d21
movq %r12, -0x30(%rbp)
movq %r14, -0x38(%rbp)
movzwl %bx, %r14d
cmpl $0x401, %r14d           # imm = 0x401
jae 0x4d40
leaq 0x5815(%rip), %rdi      # 0xa4c0
xorl %esi, %esi
movq %r14, %rdx
callq 0x20d0
leaq 0x5c04(%rip), %r12      # 0xa8c0
movq %r12, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x20d0
movzwl %r13w, %r13d
leaq 0x57ec(%rip), %rdi      # 0xa4c0
movq -0x40(%rbp), %rsi
movq %r13, %rdx
callq 0x2130
movl %r14d, %edi
callq 0x5132
addq %r13, %r12
movzwl %r15w, %edx
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x2130
movq -0x38(%rbp), %rcx
testq %rcx, %rcx
je 0x4d12
cmpw $0x1, %bx
je 0x4d5f
movb 0x5bb1(%rip), %al       # 0xa8c1
movb %al, (%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1bb5(%rip), %rdi      # 0x68dd
leaq 0x19f3(%rip), %rsi      # 0x6722
leaq 0x1ccc(%rip), %rcx      # 0x6a02
movl $0x250, %edx            # imm = 0x250
callq 0x20f0
leaq 0x1c03(%rip), %rdi      # 0x694a
leaq 0x19d4(%rip), %rsi      # 0x6722
leaq 0x1cad(%rip), %rcx      # 0x6a02
movl $0x251, %edx            # imm = 0x251
callq 0x20f0
leaq 0x1d05(%rip), %rdi      # 0x6a6b
leaq 0x19b5(%rip), %rsi      # 0x6722
leaq 0x1c8e(%rip), %rcx      # 0x6a02
movl $0x263, %edx            # imm = 0x263
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O3/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 0x3bb2
leaq -0x1b(%rbp), %rdi
movb $0xd, (%rdi)
movb %bh, -0x1a(%rbp)
movb %bl, 0x2(%rdi)
movzbl %r15b, %ecx
movl $0x3, %esi
movq %r14, %rdx
callq 0x4a7d
leaq 0x1d2a(%rip), %rdi      # 0x6ae4
callq 0x2260
movl $0x2710, %edi           # imm = 0x2710
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x21f0
// File: /workspace/github_c_makefile_star2_O3/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 0x3bb2
leaq -0x1c(%rbp), %rdi
movl $0x1d, (%rdi)
movb %bh, -0x1b(%rbp)
movb %bl, 0x2(%rdi)
movzbl %r15b, %ecx
movl $0x4, %esi
movq %r14, %rdx
xorl %r8d, %r8d
callq 0x4c4d
leaq 0x1cad(%rip), %rdi      # 0x6ae4
callq 0x2260
movl $0x2710, %edi           # imm = 0x2710
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x21f0
// File: /workspace/github_c_makefile_star2_O3/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 0x3bb2
leaq -0x1a(%rbp), %rdi
movw $0xe, (%rdi)
movb %r15b, 0x1(%rdi)
movl $0x2, %esi
movq %r14, %rdx
movl %ebx, %ecx
callq 0x4a7d
leaq 0x1c3a(%rip), %rdi      # 0x6ae4
callq 0x2260
movl $0x2710, %edi           # imm = 0x2710
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x21f0
// File: /workspace/github_c_makefile_star2_O3/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 0x3bb2
leaq -0x1b(%rbp), %rdi
movb $0x1e, (%rdi)
movb %r15b, 0x1(%rdi)
movb $0x0, 0x2(%rdi)
movl $0x3, %esi
movq %r14, %rdx
movl %ebx, %ecx
xorl %r8d, %r8d
callq 0x4c4d
leaq 0x1be2(%rip), %rdi      # 0x6ae4
callq 0x2260
movl $0x2710, %edi           # imm = 0x2710
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x21f0
// File: /workspace/github_c_makefile_star2_O3/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 0x17fc(%rip), %rdi      # 0x678d
callq 0x2260
testq %r14, %r14
je 0x4fb8
testq %rbx, %rbx
je 0x4fd7
leaq 0x5219(%rip), %rsi      # 0xa1c0
movq %r14, %rdi
movq %rbx, %rdx
xorl %ecx, %ecx
popq %rbx
popq %r14
popq %rbp
jmp 0x52d0
leaq 0x17d8(%rip), %rdi      # 0x6797
leaq 0x175c(%rip), %rsi      # 0x6722
leaq 0x17d8(%rip), %rcx      # 0x67a5
movl $0x16f, %edx            # imm = 0x16F
callq 0x20f0
leaq 0x1804(%rip), %rdi      # 0x67e2
leaq 0x173d(%rip), %rsi      # 0x6722
leaq 0x17b9(%rip), %rcx      # 0x67a5
movl $0x170, %edx            # imm = 0x170
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O3/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 0x17e6(%rip), %rdi      # 0x67ec
callq 0x2260
testq %rbx, %rbx
je 0x5031
movq %rbx, %rdi
callq 0x5364
testb %al, %al
je 0x502a
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x541b
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x175f(%rip), %rdi      # 0x6797
leaq 0x16e3(%rip), %rsi      # 0x6722
leaq 0x17b0(%rip), %rcx      # 0x67f6
movl $0x183, %edx            # imm = 0x183
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O3/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 0x17bb(%rip), %rdi      # 0x681f
callq 0x2260
testq %rbx, %rbx
je 0x5097
movq %rbx, %rdi
callq 0x4ff6
movl %r14d, %edi
callq 0x5739
cmpl $0x1, %eax
adcl $0x0, %eax
movq %rbx, %rdi
movl %eax, %esi
callq 0x537d
testl %eax, %eax
jne 0x50b6
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x16f9(%rip), %rdi      # 0x6797
leaq 0x167d(%rip), %rsi      # 0x6722
leaq 0x177e(%rip), %rcx      # 0x682a
movl $0x192, %edx            # imm = 0x192
callq 0x20f0
leaq 0x165d(%rip), %rdi      # 0x671a
leaq 0x165e(%rip), %rsi      # 0x6722
leaq 0x175f(%rip), %rcx      # 0x682a
movl $0x1a4, %edx            # imm = 0x1A4
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O3/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, 0x5b76(%rip)      # 0xacc0
jle 0x5235
testw %di, %di
je 0x5254
cmpw $0x20, %di
jae 0x5273
movzwl %di, %r14d
xorps %xmm0, %xmm0
movups %xmm0, -0x38(%rbp)
leaq 0x534b(%rip), %r12      # 0xa4c0
movq %r12, -0x48(%rbp)
leaq 0x5740(%rip), %r15      # 0xa8c0
movq %r15, -0x40(%rbp)
movb $0x1, -0x2d(%rbp)
movl %r14d, -0x38(%rbp)
leaq 0x1817(%rip), %rdi      # 0x69aa
xorl %eax, %eax
callq 0x2050
leaq 0xedb(%rip), %rbx       # 0x607c
xorl %r13d, %r13d
movzbl (%r13,%r12), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
incq %r13
cmpq %r13, %r14
jne 0x51a4
movl $0xa, %edi
callq 0x21c0
movl 0x5af4(%rip), %edi      # 0xacc0
leaq -0x48(%rbp), %rdx
movl $0x40206b00, %esi       # imm = 0x40206B00
xorl %eax, %eax
callq 0x21e0
testl %eax, %eax
js 0x5292
cmpl %r14d, %eax
jne 0x52b1
leaq 0x17d1(%rip), %rdi      # 0x69c5
xorl %eax, %eax
callq 0x2050
leaq 0xe7a(%rip), %rbx       # 0x607c
xorl %r12d, %r12d
movzbl (%r12,%r15), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
incq %r12
cmpq %r12, %r14
jne 0x5205
movl $0xa, %edi
callq 0x21c0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1725(%rip), %rdi      # 0x6961
leaq 0x14df(%rip), %rsi      # 0x6722
leaq 0x171f(%rip), %rcx      # 0x6969
movl $0x29f, %edx            # imm = 0x29F
callq 0x20f0
leaq 0x1682(%rip), %rdi      # 0x68dd
leaq 0x14c0(%rip), %rsi      # 0x6722
leaq 0x1700(%rip), %rcx      # 0x6969
movl $0x2a0, %edx            # imm = 0x2A0
callq 0x20f0
leaq 0x1726(%rip), %rdi      # 0x69a0
leaq 0x14a1(%rip), %rsi      # 0x6722
leaq 0x16e1(%rip), %rcx      # 0x6969
movl $0x2a1, %edx            # imm = 0x2A1
callq 0x20f0
leaq 0x171a(%rip), %rdi      # 0x69b3
leaq 0x1482(%rip), %rsi      # 0x6722
leaq 0x16c2(%rip), %rcx      # 0x6969
movl $0x2ae, %edx            # imm = 0x2AE
callq 0x20f0
leaq 0x1703(%rip), %rdi      # 0x69bb
leaq 0x1463(%rip), %rsi      # 0x6722
leaq 0x16a3(%rip), %rcx      # 0x6969
movl $0x2af, %edx            # imm = 0x2AF
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O3/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)
xorl %eax, %eax
movq %rax, 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 0x19(%rip), %rcx        # 0x5326
movq %rcx, 0x10(%rsi)
movq %rax, 0x18(%rsi)
leaq 0x28(%rdi), %rdx
xorl %edi, %edi
callq 0x2080
addq $0x40, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x5341
movq %rdi, %rsi
movq 0x18(%rdi), %rdi
testq %rdi, %rdi
jne 0x247b
movq %rsi, %rdi
jmpq *0x8(%rsi)
pushq %rbp
movq %rsp, %rbp
leaq 0x184d(%rip), %rdi      # 0x6b99
leaq 0x17e6(%rip), %rsi      # 0x6b39
leaq 0x17fa(%rip), %rcx      # 0x6b54
movl $0x22, %edx
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O3/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, %ebx
movq %rdi, %r14
cmpl $0x1, %esi
adcl $0x0, %ebx
callq 0x56dc
addl %ebx, %eax
movl %eax, 0x20(%r14)
xorps %xmm0, %xmm0
leaq -0x30(%rbp), %rdx
movaps %xmm0, (%rdx)
imulq $0x10624dd3, %rbx, %rax # imm = 0x10624DD3
shrq $0x26, %rax
movq %rax, 0x10(%rdx)
imull $0x3e8, %eax, %eax      # imm = 0x3E8
subl %eax, %ebx
imull $0xf4240, %ebx, %eax    # imm = 0xF4240
movq %rax, 0x18(%rdx)
movb $0x1, 0x30(%r14)
movq 0x28(%r14), %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x2270
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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:
testq %rdi, %rdi
je 0x5519
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %r14d
movq %rdi, %rbx
cmpl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
jne 0x551f
movq %rbx, %rdi
callq 0x20e0
movl %eax, %ecx
testl %eax, %eax
movl $0xc, %eax
cmovel %ecx, %eax
jmp 0x5535
movl $0x3, %eax
retq
leaq -0x20(%rbp), %rsi
xorl %edi, %edi
callq 0x2160
movl %eax, %ecx
movl $0xc, %eax
testl %ecx, %ecx
je 0x553e
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl %r14d, %eax
imulq $0x10624dd3, %rax, %rax # imm = 0x10624DD3
shrq $0x26, %rax
leaq -0x20(%rbp), %rsi
addq %rax, (%rsi)
imull $0x3e8, %eax, %eax      # imm = 0x3E8
subl %eax, %r14d
imull $0xf4240, %r14d, %eax   # imm = 0xF4240
addq %rax, 0x8(%rsi)
movq %rbx, %rdi
callq 0x2290
movl %eax, %ecx
movl $0x0, %eax
testl %ecx, %ecx
je 0x5535
callq 0x2040
cmpl $0x6e, (%rax)
movl $0x6, %ecx
jmp 0x550f
// File: /workspace/github_c_makefile_star2_O3/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 0x55aa
leaq -0xc(%rbp), %rbx
movq %rbx, %rsi
callq 0x2240
movzwl (%rbx), %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x15cf(%rip), %rdi      # 0x6b80
leaq 0x15cc(%rip), %rsi      # 0x6b84
leaq 0x15dc(%rip), %rcx      # 0x6b9b
movl $0x58, %edx
callq 0x20f0
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/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
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jne 0x564d
movl %r8d, %r13d
movq %rsi, %r12
movq %rdi, %r15
movq %rcx, -0x38(%rbp)
leaq 0x8(%rdi), %rbx
movq %rbx, %rdi
callq 0x21a0
testl %eax, %eax
jne 0x564d
leaq 0x40(%r15), %rsi
movq %rbx, %rdi
movq %rsi, -0x30(%rbp)
callq 0x22d0
testl %eax, %eax
jne 0x564d
movq %rbx, %rdi
movl $0x2, %esi
callq 0x21b0
testl %eax, %eax
jne 0x564d
movzbl %r13b, %eax
movq -0x30(%rbp), %rsi
movl %eax, (%rsi)
movq %rbx, %rdi
callq 0x20c0
testl %eax, %eax
je 0x565c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, 0x48(%r15)
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq -0x38(%rbp), %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x22b0
// File: /workspace/github_c_makefile_star2_O3/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 0x57c2
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x28(%rdi), %r14
movq %r14, %rdi
callq 0x2060
movq %r14, %rdi
movl $0x1, %esi
callq 0x2220
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2230
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl $0x3, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x581b
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
cmpl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
jne 0x5821
movq %rbx, %rdi
callq 0x2210
movl %eax, %ecx
testl %ecx, %ecx
movl $0xc, %eax
cmovel %ecx, %eax
jmp 0x5877
movl $0x3, %eax
retq
leaq 0x30(%rbx), %r15
xorl %edi, %edi
movq %r15, %rsi
callq 0x2160
movl %eax, %ecx
movl $0xc, %eax
testl %ecx, %ecx
jne 0x5877
movl %r14d, %eax
imulq $0x10624dd3, %rax, %rax # imm = 0x10624DD3
shrq $0x26, %rax
addq %rax, 0x30(%rbx)
imull $0x3e8, %eax, %eax      # imm = 0x3E8
subl %eax, %r14d
imull $0xf4240, %r14d, %eax   # imm = 0xF4240
addq %rax, 0x38(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x22c0
movl %eax, %ecx
movl $0x6, %eax
cmpl $0x6e, %ecx
jne 0x580f
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x4a04(%rip), %rax      # 0x7580
leaq 0x4a21(%rip), %rbx      # 0x75a4
testl %edi, %edi
cmovneq %rax, %rbx
movl $0x1d, %eax
movl $0x27, %esi
cmovnel %eax, %esi
movq %rsp, %r14
movq %r14, %rdi
movl $0x3, %edx
callq 0x341b
movq %r14, %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x36ec
movq %r14, %rdi
callq 0x33a4
callq 0x31f8
callq 0x6557
movl %eax, %ebx
callq 0x33db
callq 0x31f8
andl $-0x21, %ebx
cmpl $0x59, %ebx
sete %al
addq $0x3c18, %rsp           # imm = 0x3C18
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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
movabsq $-0x456d8a7abe346c9, %r15 # imm = 0xFBA92758541CB937
movq 0x38(%r14), %rdi
movq %rbx, %rsi
callq 0x4a37
callq 0x31f8
callq 0x6694
movq %rax, %rdi
mulq %r15
shrq $0x10, %rdx
imulq $0x1046a, %rdx, %rax    # imm = 0x1046A
subq %rax, %rdi
callq 0x6615
testb %al, %al
je 0x2e84
popq %rbx
popq %r14
popq %r15
jmp 0x6557
// File: /workspace/github_c_makefile_star2_O3/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 0x2f26
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
movq %rbx, %rdi
movl %r15d, %esi
movl $0x3, %edx
callq 0x341b
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
movl $0x10003, %ecx          # imm = 0x10003
movq %r12, %r8
callq 0x34e1
movq %rbx, %rdi
callq 0x33a4
callq 0x340f
movl %eax, %ecx
andl $-0x21, %ecx
cmpl $0x51, %ecx
sete %cl
cmpl $0x1b, %eax
sete %dl
orb %cl, %dl
jne 0x2fec
cmpl $0x20, %eax
je 0x2fec
cmpl $0xd, %eax
jne 0x2fc8
callq 0x33db
callq 0x31f8
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_O3/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
movl $0x3c, %esi
xorl %edx, %edx
movl $0x14, %ecx
movl $0x18, %r8d
callq 0x3122
movq %r14, %rdi
callq 0x33a4
movq %r14, %rdi
movl $0x10000, %esi          # imm = 0x10000
movl $0x2591, %edx           # imm = 0x2591
callq 0x345c
movq %r14, %rdi
movl $0x10000, %esi          # imm = 0x10000
callq 0x418c
movl 0x8(%r14), %eax
movl %eax, %ebp
shrl $0x1f, %ebp
addl %eax, %ebp
sarl %ebp
movq %rbx, %rdi
callq 0x439f
shrq %rax
notl %eax
addl %eax, %ebp
movq %r14, %rdi
movl %ebp, %esi
movl $0xb, %edx
movq %rbx, %rcx
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x36ec
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/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 %rax
callq 0x633c
movaps 0x459b(%rip), %xmm0     # 0x7630
movups %xmm0, 0xc52c(%rip)     # 0xf5c8
leaq 0xc537(%rip), %rax      # 0xf5da
xorl %ecx, %ecx
xorl %edx, %edx
movb $0x1, (%rax,%rdx)
addq $0xc0, %rdx
cmpq $0x3c00, %rdx           # imm = 0x3C00
jne 0x30a7
incq %rcx
addq $0x8, %rax
cmpq $0x18, %rcx
jne 0x30a5
movq $0x0, 0x10105(%rip) # 0x131d8
leaq 0xc501(%rip), %rax      # 0xf5db
xorl %ecx, %ecx
xorl %edx, %edx
movb $0x0, -0x1(%rax,%rdx)
movw $0x20, -0x3(%rax,%rdx)
movl $0x10007, (%rax,%rdx)   # imm = 0x10007
addq $0xc0, %rdx
cmpq $0x3c00, %rdx           # imm = 0x3C00
jne 0x30de
incq %rcx
addq $0x8, %rax
cmpq $0x18, %rcx
jne 0x30dc
leaq 0xc4b3(%rip), %rax      # 0xf5c8
movq %rax, 0x100c4(%rip)     # 0x131e0
popq %rax
jmp 0x31f8
// File: /workspace/github_c_makefile_star2_O3/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 0x3172
cmpl $0x18, %r8d
jg 0x3191
xorl %eax, %eax
movq %rdi, %rcx
movl $0x12, %edx
movb $0x1, (%rcx,%rdx)
addq $0xc0, %rdx
cmpq $0x3c12, %rdx           # imm = 0x3C12
jne 0x3144
incq %rax
addq $0x8, %rcx
cmpq $0x18, %rax
jne 0x313f
movq $0x0, 0x3c10(%rdi)
popq %rax
retq
leaq 0x45a9(%rip), %rdi      # 0x7722
leaq 0x4580(%rip), %rsi      # 0x7700
leaq 0x45ae(%rip), %rcx      # 0x7735
movl $0x71, %edx
callq 0x10e0
leaq 0x45cc(%rip), %rdi      # 0x7764
leaq 0x4561(%rip), %rsi      # 0x7700
leaq 0x458f(%rip), %rcx      # 0x7735
movl $0x72, %edx
callq 0x10e0
// File: /workspace/github_c_makefile_star2_O3/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 0x63ee
xorl %r12d, %r12d
movl $0x0, 0xc(%rsp)
leaq (%rbx,%rbx,2), %rax
movq %rax, 0x10(%rsp)
xorl %r14d, %r14d
leaq (%r14,%r14,2), %rax
shlq $0x6, %rax
leaq 0xffa9(%rip), %rcx      # 0x131e0
movq (%rcx), %rcx
leaq (%rcx,%rax), %rdx
addq $0x3c10, %rcx           # imm = 0x3C10
cmpb $0x0, 0x12(%rdx,%rbx,8)
jne 0x3237
leaq (%rdx,%rbx,8), %rax
addq $0x10, %rax
leaq (%r14,%r14,8), %rcx
shlq $0x4, %rcx
leaq 0x9665(%rip), %rdx      # 0xc8c8
addq %rdx, %rcx
movq 0x10(%rsp), %rdx
leaq (%rcx,%rdx,2), %r13
movzwl (%rax), %r15d
movl 0x3(%rax), %ebp
cmpw %r15w, (%r13)
jne 0x328a
movl 0x2(%r13), %ecx
movl %ecx, %eax
xorl %ebp, %eax
testw %ax, %ax
je 0x32d5
movl %r12d, %eax
cmpq %rax, %r14
jne 0x329b
movl 0xc(%rsp), %eax
cmpq %rax, %rbx
je 0x32ac
movl %r14d, %edi
movl %ebx, %esi
callq 0x63ee
movl %ebx, 0xc(%rsp)
movl %r14d, %r12d
movzwl %r15w, %r15d
movl %ebp, %edi
movl %r15d, %esi
callq 0x6432
movl %ebp, 0x2(%r13)
movw %r15w, (%r13)
incl %r12d
incq %r14
cmpq $0x50, %r14
jne 0x3228
jmp 0x32ed
btl $0x18, %ecx
jae 0x328a
andl $0x10000, %eax          # imm = 0x10000
jne 0x328a
movl %ebp, %eax
andl $0x1000000, %eax        # imm = 0x1000000
jne 0x32c6
jmp 0x328a
incq %rbx
cmpq $0x18, %rbx
jne 0x321c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6548
// File: /workspace/github_c_makefile_star2_O3/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 %rax
xorl %edi, %edi
movl $0x18, %esi
callq 0x63ee
cmpq $0x0, 0xfeb6(%rip)      # 0x131d8
jne 0x333b
callq 0x63d0
leaq 0xc298(%rip), %rax      # 0xf5c8
cmpq %rax, 0xfea9(%rip)      # 0x131e0
jne 0x335a
popq %rax
retq
leaq 0x4436(%rip), %rdi      # 0x7778
leaq 0x43b7(%rip), %rsi      # 0x7700
leaq 0x4438(%rip), %rcx      # 0x7788
movl $0x86, %edx
callq 0x10e0
leaq 0x437f(%rip), %rdi      # 0x76e0
leaq 0x4398(%rip), %rsi      # 0x7700
leaq 0x439f(%rip), %rcx      # 0x770e
movl $0x25, %edx
callq 0x10e0
// File: /workspace/github_c_makefile_star2_O3/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
movl %esi, %eax
shrl $0x1f, %eax
addl %esi, %eax
sarl %eax
movl $0x28, %esi
subl %eax, %esi
movl %edx, %eax
shrl $0x1f, %eax
addl %edx, %eax
sarl %eax
movl $0xc, %edx
subl %eax, %edx
callq 0x3122
movq %rbx, %rdi
movl $0x10007, %esi          # imm = 0x10007
movl $0x20, %edx
popq %rbx
jmp 0x345c
// File: /workspace/github_c_makefile_star2_O3/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 %rbx
pushq %rax
movb (%r8), %r9b
testb %r9b, %r9b
je 0x36c2
leaq 0x10(%rdi), %rax
movzbl %r9b, %r10d
movl %r10d, %r11d
testb %r10b, %r10b
jns 0x360d
movl %r10d, %r11d
andl $-0x20, %r11d
movl $0x2, %r14d
cmpl $0xc0, %r11d
je 0x3541
movl %r10d, %r11d
andl $-0x10, %r11d
movl $0x3, %r14d
cmpl $0xe0, %r11d
jne 0x3589
movb 0x2(%r8), %r11b
andb $-0x40, %r11b
negb %r11b
jno 0x3581
movzbl 0x1(%r8), %ebx
movl %ebx, %r11d
andb $-0x40, %r11b
negb %r11b
jno 0x3581
andl $0x3f, %ebx
cmpl $0x4, %r14d
je 0x35c1
cmpl $0x3, %r14d
jne 0x35fb
movzbl %r9b, %r11d
shll $0xc, %r11d
shll $0x6, %ebx
orl %r11d, %ebx
movzbl 0x2(%r8), %r11d
andl $0x3f, %r11d
jmp 0x360a
xorl %r11d, %r11d
jmp 0x360d
movl %r10d, %r11d
andl $-0x8, %r11d
cmpl $0xf0, %r11d
setne %bl
cmpb $-0xb, %r10b
setae %bpl
xorl %r11d, %r11d
orb %bl, %bpl
jne 0x360d
movb 0x3(%r8), %bl
andb $-0x40, %bl
movl $0x4, %r14d
negb %bl
jo 0x3534
jmp 0x360d
movl %r9d, %r11d
andb $0x7, %r11b
movzbl %r11b, %r11d
shll $0x12, %r11d
shll $0xc, %ebx
orl %r11d, %ebx
cmpl $0x10000, %ebx          # imm = 0x10000
jae 0x36cd
movzbl 0x2(%r8), %ebp
andl $0x3f, %ebp
shll $0x6, %ebp
movzbl 0x3(%r8), %r11d
andl $0x3f, %r11d
orl %ebp, %r11d
jmp 0x360a
movl %r9d, %r11d
andb $0x1f, %r11b
movzbl %r11b, %r11d
shll $0x6, %r11d
orl %ebx, %r11d
movl (%rdi), %ebx
addl %esi, %ebx
js 0x365b
movl 0x4(%rdi), %ebp
addl %edx, %ebp
cmpl %esi, 0x8(%rdi)
setg %r14b
testl %ebp, %ebp
setns %r15b
andb %r14b, %r15b
cmpb $0x1, %r15b
jne 0x365b
cmpl %edx, 0xc(%rdi)
jle 0x365b
movl %ebx, %r9d
movl %ebp, %r10d
leaq (%r9,%r9,2), %r9
shlq $0x6, %r9
addq %rax, %r9
movb $0x0, 0x2(%r9,%r10,8)
movw %r11w, (%r9,%r10,8)
movl %ecx, 0x3(%r9,%r10,8)
movb (%r8), %r9b
movzbl %r9b, %r10d
movl $0x1, %r11d
testb %r9b, %r9b
jns 0x36b0
movl %r10d, %ebx
andl $-0x20, %ebx
movl $0x2, %r11d
cmpl $0xc0, %ebx
je 0x36b0
movl %r10d, %ebx
andl $-0x10, %ebx
movl $0x3, %r11d
cmpl $0xe0, %ebx
je 0x36b0
andl $-0x8, %r10d
cmpl $0xf0, %r10d
sete %r10b
cmpb $-0xb, %r9b
setb %r9b
andb %r10b, %r9b
movzbl %r9b, %r11d
shll $0x2, %r11d
movb (%r8,%r11), %r9b
addq %r11, %r8
incl %esi
testb %r9b, %r9b
jne 0x34f8
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x40cf(%rip), %rdi      # 0x77a3
leaq 0x4025(%rip), %rsi      # 0x7700
leaq 0x40d1(%rip), %rcx      # 0x77b3
movl $0x9a, %edx
callq 0x10e0
// File: /workspace/github_c_makefile_star2_O3/skeeto[P]goblin-com/src/display.c
// Function: panel_strlen
size_t
panel_strlen(const char *s)
{
    size_t count = 0;
    for (const char *p = s; *p; p += utf8_charlen((uint8_t) *p)) {
        if (is_color_directive(p))
            p += 3;
        else if (*p != '}')
            count++;
    }
    return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movb (%rdi), %bpl
testb %bpl, %bpl
je 0x446b
movq %rdi, %r14
xorl %ebx, %ebx
leaq 0x346a(%rip), %r15      # 0x7828
movsbl %bpl, %esi
movl $0x11, %edx
movq %r15, %rdi
callq 0x1140
testq %rax, %rax
je 0x4400
movsbl 0x1(%r14), %esi
testl %esi, %esi
je 0x4400
movl $0x11, %edx
movq %r15, %rdi
callq 0x1140
testq %rax, %rax
je 0x4400
cmpb $0x7b, 0x2(%r14)
jne 0x4400
movb 0x3(%r14), %bpl
addq $0x3, %r14
jmp 0x440c
xorl %eax, %eax
cmpb $0x7d, %bpl
setne %al
addq %rax, %rbx
movl $0x1, %eax
testb %bpl, %bpl
jns 0x4459
movzbl %bpl, %ecx
movl %ecx, %edx
andl $-0x20, %edx
movl $0x2, %eax
cmpl $0xc0, %edx
je 0x4459
movl %ecx, %edx
andl $-0x10, %edx
movl $0x3, %eax
cmpl $0xe0, %edx
je 0x4459
andl $-0x8, %ecx
cmpl $0xf0, %ecx
sete %al
cmpb $-0xb, %bpl
setb %cl
andb %al, %cl
movzbl %cl, %eax
shll $0x2, %eax
movb (%r14,%rax), %bpl
addq %rax, %r14
testb %bpl, %bpl
jne 0x43be
jmp 0x446d
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/skeeto[P]goblin-com/src/map.c
// Function: map_draw_terrain
void
map_draw_terrain(map_t *map, panel_t *p)
{
    for (size_t y = 0; y < MAP_HEIGHT; y++) {
        for (size_t x = 0; x < MAP_WIDTH; x++) {
            uint16_t c = map->high[x][y].base;
            font_t font = base_font(c, x, y);
            panel_putc(p, x, y, font, c);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
xorl %r15d, %r15d
xorps %xmm0, %xmm0
cvtsi2ss %r15d, %xmm0
divss 0x2e09(%rip), %xmm0     # 0x7864
addss 0x2df1(%rip), %xmm0     # 0x7854
mulss %xmm0, %xmm0
movss %xmm0, 0x8(%rsp)
movq %rdi, 0x10(%rsp)
movq %rdi, %r13
xorl %r12d, %r12d
movzwl (%r13), %ebp
xorl %r14d, %r14d
cmpl $0x2228, %ebp           # imm = 0x2228
jle 0x4b63
cmpl $0x25b1, %ebp           # imm = 0x25B1
jg 0x4b98
cmpl $0x2229, %ebp           # imm = 0x2229
je 0x4bca
cmpl $0x2248, %ebp           # imm = 0x2248
jne 0x4be4
xorps %xmm0, %xmm0
cvtsi2ss %r12d, %xmm0
divss 0x2da8(%rip), %xmm0     # 0x7868
addss 0x2d8c(%rip), %xmm0     # 0x7854
cvtss2sd %xmm0, %xmm0
mulsd 0x2dd4(%rip), %xmm0     # 0x78a8
cvtsd2ss %xmm0, %xmm0
mulss %xmm0, %xmm0
addss 0x8(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
sqrtsd %xmm0, %xmm0
mulsd 0x2dbe(%rip), %xmm0     # 0x78b0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xc(%rsp)
callq 0x6694
movq %rax, %xmm1
punpckldq 0x2dc2(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2dca(%rip), %xmm1     # 0x78e0
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd 0x2d8e(%rip), %xmm0     # 0x78b8
movsd 0x2d8e(%rip), %xmm1     # 0x78c0
callq 0x1130
cvtsd2ss %xmm0, %xmm0
addss 0xc(%rsp), %xmm0
callq 0x1100
xorl %eax, %eax
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
seta %al
shll $0x10, %eax
movl $0x400, %edx            # imm = 0x400
movl $0x7, %ecx
jmp 0x4bea
cmpl $0x20, %ebp
je 0x4bb9
cmpl $0x2e, %ebp
je 0x4ba8
movl $0x0, %ecx
movl $0x0, %edx
movl $0x0, %eax
cmpl $0x3a, %ebp
jne 0x4bea
movl $0x1000000, %r14d       # imm = 0x1000000
movl $0x10000, %eax          # imm = 0x10000
movl $0x300, %edx            # imm = 0x300
movl $0x3, %ecx
jmp 0x4bea
cmpl $0x25b2, %ebp           # imm = 0x25B2
je 0x4bd8
cmpl $0x2663, %ebp           # imm = 0x2663
jne 0x4be4
movl $0x10000, %eax          # imm = 0x10000
movl $0x200, %edx            # imm = 0x200
movl $0x2, %ecx
jmp 0x4bea
movl $0x10000, %eax          # imm = 0x10000
movl $0x400, %edx            # imm = 0x400
movl $0x4, %ecx
jmp 0x4bea
movl $0x10000, %eax          # imm = 0x10000
movl $0x200, %edx            # imm = 0x200
xorl %ecx, %ecx
jmp 0x4bea
movl $0x200, %edx            # imm = 0x200
movl $0x7, %ecx
jmp 0x4be8
xorl %ecx, %ecx
xorl %edx, %edx
xorl %eax, %eax
orl %r14d, %eax
orl %edx, %ecx
orl %eax, %ecx
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
movl %ebp, %r8d
callq 0x31b0
incq %r12
addq $0x180, %r13            # imm = 0x180
cmpq $0x3c, %r12
jne 0x4a78
incq %r15
movq 0x10(%rsp), %rdi
addq $0x10, %rdi
cmpq $0x18, %r15
jne 0x4a4b
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/skeeto[P]goblin-com/src/map.c
// Function: map_draw_buildings
void
map_draw_buildings(map_t *map, panel_t *p)
{
    for (size_t y = 0; y < MAP_HEIGHT; y++) {
        for (size_t x = 0; x < MAP_WIDTH; x++) {
            enum building building = map->high[x][y].building;
            if (building != C_NONE) {
                uint16_t c = building;
                font_t font = FONT(Y, k);
                if (map->high[x][y].building_age < 0) {
                    font.fore = COLOR_CYAN;
                    c = tolower(c);
                }
                panel_putc(p, x, y, font, c);
            }
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
addq $0x8, %r14
xorl %r15d, %r15d
movq %r14, %r13
xorl %r12d, %r12d
movzwl -0x6(%r13), %eax
testl %eax, %eax
je 0x4c8c
cmpq $0x0, (%r13)
js 0x4c6e
movl $0x10003, %ecx          # imm = 0x10003
jmp 0x4c7a
movl %eax, %edi
callq 0x11b0
movl $0x10006, %ecx          # imm = 0x10006
movzwl %ax, %r8d
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x31b0
incq %r12
addq $0x180, %r13            # imm = 0x180
cmpq $0x3c, %r12
jne 0x4c57
incq %r15
addq $0x10, %r14
cmpq $0x18, %r15
jne 0x4c51
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/skeeto[P]goblin-com/src/game.c
// Function: game_hero_generate
hero_t
game_hero_generate(void)
{
    hero_t hero;
    memset(&hero, 0, sizeof(hero));
    hero.active = true;
    rand_name(hero.name, sizeof(hero.name));
    hero.hp = hero.hp_max = rand_range(10, 20);
    hero.ap = hero.ap_max = rand_range(20, 40);
    hero.str = rand_range(10, 18);
    hero.dex = rand_range(10, 18);
    hero.mind = rand_range(10, 18);
    hero.squad = -1;
    return hero;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movl $0x0, 0x30(%rdi)
movb $0x1, (%rdi)
incq %rdi
movl $0x10, %esi
callq 0x6172
movl $0xa, %edi
movl $0x14, %esi
callq 0x612a
movl %eax, 0x18(%rbx)
movl %eax, 0x14(%rbx)
movl $0x14, %edi
movl $0x28, %esi
callq 0x612a
movl %eax, 0x20(%rbx)
movl %eax, 0x1c(%rbx)
movl $0xa, %edi
movl $0x12, %esi
callq 0x612a
movl %eax, 0x24(%rbx)
movl $0xa, %edi
movl $0x12, %esi
callq 0x612a
movl %eax, 0x28(%rbx)
movl $0xa, %edi
movl $0x12, %esi
callq 0x612a
movl %eax, 0x2c(%rbx)
movl $0xffffffff, 0x30(%rbx) # imm = 0xFFFFFFFF
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/skeeto[P]goblin-com/src/game.c
// Function: game_create
game_t *
game_create(uint64_t map_seed)
{
    game_t *game = calloc(sizeof(*game), 1);
    game->map_seed = map_seed;
    game->time = 0;
    game->speed = 1;
    game->gold = INIT_GOLD;
    game->wood = INIT_WOOD;
    game->food = INIT_FOOD;
    game->population = INIT_POPULATION;
    game->spawn_rate = INVADER_SPAWN_RATE;
    game->map = map_generate(map_seed);
    game->map->high[CASTLE_X][CASTLE_Y].building = C_CASTLE;
    game->max_hero = MAX_HERO_INIT;
    for (int i = 0; i < (int)countof(game->squads); i++) {
        game->squads[i].x = CASTLE_X;
        game->squads[i].y = CASTLE_Y;
        game->squads[i].target = -1;
    }
    for (int i = 0; i < HERO_INIT; i++) {
        game->heroes[i] = game_hero_generate();
        game->heroes[i].squad = 0;
    }
    game->squads[0].member_count = HERO_INIT;
    return game;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %r14
movl $0x1df0, %edi           # imm = 0x1DF0
movl $0x1, %esi
callq 0x1160
movq %rax, %rbx
movq %r14, (%rax)
movl $0x1, 0x10(%rax)
movaps 0x2b3d(%rip), %xmm0     # 0x7910
movups %xmm0, 0x18(%rax)
movaps 0x2b42(%rip), %xmm0     # 0x7920
movups %xmm0, 0x28(%rax)
movl $0x3f800000, 0x40(%rax) # imm = 0x3F800000
movq %r14, %rdi
callq 0x447c
movq %rax, 0x38(%rbx)
movw $0x43, 0x2dc2(%rax)
movl $0x4, 0x3c8(%rbx)
movl $0x2d0, %eax            # imm = 0x2D0
movsd 0x2b1b(%rip), %xmm0     # 0x7930
movsd %xmm0, -0x8(%rbx,%rax)
movl $0xffffffff, (%rbx,%rax) # imm = 0xFFFFFFFF
addq $0x10, %rax
cmpq $0x3d0, %rax            # imm = 0x3D0
jne 0x4e15
leaq 0xc(%rsp), %r14
movq %r14, %rdi
callq 0x4d10
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups %xmm2, 0x3ec(%rbx)
movups %xmm1, 0x3dc(%rbx)
movups %xmm0, 0x3cc(%rbx)
xorl %ebp, %ebp
movl %ebp, 0x3fc(%rbx)
movq %r14, %rdi
callq 0x4d10
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups %xmm2, 0x420(%rbx)
movups %xmm1, 0x410(%rbx)
movups %xmm0, 0x400(%rbx)
movl %ebp, 0x430(%rbx)
movl $0x2, 0x2d4(%rbx)
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/skeeto[P]goblin-com/src/game.c
// Function: game_load
game_t *
game_load(FILE *out)
{
    game_t *game = malloc(sizeof(*game));
    if (fread(game, sizeof(*game), 1, out) == 1) {
        game->map = map_generate(game->map_seed);
        if (fread(game->map->high, sizeof(game->map->high), 1, out) == 1)
            return game;
    }
    return NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x1df0, %edi           # imm = 0x1DF0
callq 0x11c0
movq %rax, %rbx
movl $0x1df0, %esi           # imm = 0x1DF0
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rcx
callq 0x1080
cmpq $0x1, %rax
jne 0x4f4e
movq (%rbx), %rdi
callq 0x447c
movq %rax, 0x38(%rbx)
movl $0x5a00, %esi           # imm = 0x5A00
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rcx
callq 0x1080
cmpq $0x1, %rax
je 0x4f50
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/skeeto[P]goblin-com/src/game.c
// Function: add_population
static void
add_population(game_t *game, long amount)
{
    long start_population = game->population;
    game->population += amount;
    if (start_population < GAME_WIN_POP / 4 &&
        game->population >= GAME_WIN_POP / 4) {
        game_event_push(game, EVENT_PROGRESS_1);
    }
    if (game->population <= 0)
        game_event_push(game, EVENT_LOSE);
}

// Assembly:
movsd 0x30(%rdi), %xmm1
cvttsd2si %xmm1, %rax
cvtsi2sd %rsi, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rdi)
cmpq $0x3e7, %rax            # imm = 0x3E7
jg 0x51d3
ucomisd 0x27e1(%rip), %xmm0     # 0x7990
jb 0x51d3
xorl %eax, %eax
cmpl $0x0, 0x1dcc(%rdi,%rax,4)
je 0x51c8
incq %rax
cmpq $0x8, %rax
jne 0x51b3
jmp 0x51d3
movl $0x3, 0x1dcc(%rdi,%rax,4)
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jb 0x51f2
xorl %eax, %eax
cmpl $0x0, 0x1dcc(%rdi,%rax,4)
je 0x51f3
incq %rax
cmpq $0x8, %rax
jne 0x51df
retq
movl $0x1, 0x1dcc(%rdi,%rax,4)
retq