// File: /workspace/github_c_makefile_star2_O0/skeeto[P]goblin-com/src/main.c
// Function: popup_build_select
static uint16_t
popup_build_select(game_t *game, panel_t *terrain)
{
    int width = 56;
    int height = 20;
    panel_t build;
    panel_center_init(&build, width, height);
    display_push(&build);
    panel_border(&build, FONT(w, k));

    int input;
    uint16_t result = 0;
    panel_t *p = &build;
    char cost[128];
    char yield[128];

    int y = 1;
    yield_string(cost, COST_LUMBERYARD, false);
    yield_string(yield, YIELD_LUMBERYARD, true);
    panel_printf(p,   1, y++, "(Rk{w}) Yk{Lumberyard} [%s]", cost);
    panel_printf(p, 5, y++, "wk{Yield: %s}", yield);
    panel_printf(p, 5, y++, "wk{Target: forest (%s)}",
                 u8encode(BASE_FOREST));

    yield_string(cost, COST_FARM, false);
    yield_string(yield, YIELD_FARM, true);
    panel_printf(p, 1, y++, "(Rk{f}) Yk{Farm} [%s]", cost);
    panel_printf(p, 5, y++, "wk{Yield: %s}", yield);
    panel_printf(p, 5, y++, "wk{Target: grassland (%s), forest (%s)}",
                 u8encode(BASE_GRASSLAND), u8encode(BASE_FOREST));

    yield_string(cost, COST_STABLE, false);
    yield_string(yield, YIELD_STABLE, true);
    panel_printf(p, 1, y++, "(Rk{s}) Yk{Stable} [%s]", cost);
    panel_printf(p, 5, y++, "wk{Yield: %s}, gk{adds %d hero slots}",
                 yield, STABLE_INC);
    panel_printf(p, 5, y++, "wk{Target: grassland (%s)}",
                 u8encode(BASE_GRASSLAND));

    yield_string(cost, COST_MINE, false);
    yield_string(yield, YIELD_MINE, true);
    panel_printf(p, 1, y++, "(Rk{m}) Yk{Mine} [%s]", cost);
    panel_printf(p, 5, y++, "wk{Yield: %s}", yield);
    panel_printf(p, 5, y++, "wk{Target: hill (%s)}",
                 u8encode(BASE_HILL));

    yield_string(cost, COST_HAMLET, false);
    yield_string(yield, YIELD_HAMLET, true);
    panel_printf(p, 1, y++, "(Rk{h}) Yk{Hamlet} [%s]", cost);
    panel_printf(p, 5, y++, "wk{Yield: %s}, gk{adds %d pop.}", yield,
                 HAMLET_INC);
    panel_printf(p, 5, y++,
                 "wk{Target: grassland (%s), forest (%s), hill (%s)}",
                 u8encode(BASE_GRASSLAND),
                 u8encode(BASE_FOREST),
                 u8encode(BASE_HILL));

    yield_string(cost, COST_ROAD, false);
    yield_string(yield, YIELD_ROAD, true);
    panel_printf(p, 1, y++, "(Rk{r}) Yk{Road} [%s]", cost);
    panel_printf(p, 5, y++, "wk{Yield: %s}, "
                 "gk{removes movement penalties}", yield);
    panel_printf(p, 5, y++, "wk{Target: (any land)}");

    while (result == 0 && !is_exit_key(input = game_getch(game, terrain)))
        if (strchr("wfshmr", input))
            result = toupper(input);
    if (result == 'R')
        result = '+';
    display_pop_free();
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3f20, %rsp           # imm = 0x3F20
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x38, -0x14(%rbp)
movl $0x14, -0x18(%rbp)
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
leaq -0x3c30(%rbp), %rdi
callq 0x48e0
leaq -0x3c30(%rbp), %rdi
callq 0x47b0
movb $0x7, -0x3c34(%rbp)
movb $0x0, -0x3c33(%rbp)
movb $0x0, -0x3c32(%rbp)
movb $0x0, -0x3c31(%rbp)
movl -0x3c34(%rbp), %esi
leaq -0x3c30(%rbp), %rdi
callq 0x5150
movw $0x0, -0x3c3a(%rbp)
leaq -0x3c30(%rbp), %rax
movq %rax, -0x3c48(%rbp)
movl $0x1, -0x3d54(%rbp)
leaq -0x3cd0(%rbp), %rdi
movl $0x19, -0x3d60(%rbp)
movl $0x0, -0x3d5c(%rbp)
movl $0x0, -0x3d58(%rbp)
movq -0x3d60(%rbp), %rax
movq %rax, -0x3d70(%rbp)
movl -0x3d58(%rbp), %eax
movl %eax, -0x3d68(%rbp)
movq -0x3d70(%rbp), %rsi
movl -0x3d68(%rbp), %edx
xorl %ecx, %ecx
callq 0x6f70
leaq -0x3d50(%rbp), %rdi
movl $0x0, -0x3d7c(%rbp)
movl $0x0, -0x3d78(%rbp)
movl $0x5, -0x3d74(%rbp)
movq -0x3d7c(%rbp), %rax
movq %rax, -0x3d8c(%rbp)
movl -0x3d74(%rbp), %eax
movl %eax, -0x3d84(%rbp)
movq -0x3d8c(%rbp), %rsi
movl -0x3d84(%rbp), %edx
movl $0x1, %ecx
callq 0x6f70
movq -0x3c48(%rbp), %rdi
movl -0x3d54(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x3d54(%rbp)
leaq -0x3cd0(%rbp), %r8
movl $0x1, %esi
leaq 0x6419(%rip), %rcx      # 0x936b
movb $0x0, %al
callq 0x4c10
movq -0x3c48(%rbp), %rdi
movl -0x3d54(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x3d54(%rbp)
leaq -0x3d50(%rbp), %r8
movl $0x5, %esi
leaq 0x6403(%rip), %rcx      # 0x9387
movb $0x0, %al
callq 0x4c10
movq -0x3c48(%rbp), %rax
movq %rax, -0x3f10(%rbp)
movl -0x3d54(%rbp), %eax
movl %eax, -0x3f04(%rbp)
addl $0x1, %eax
movl %eax, -0x3d54(%rbp)
movl $0x2663, %edi           # imm = 0x2663
callq 0x3b90
movq -0x3f10(%rbp), %rdi
movl -0x3f04(%rbp), %edx
movq %rax, %r8
movl $0x5, %esi
leaq 0x63c1(%rip), %rcx      # 0x9395
movb $0x0, %al
callq 0x4c10
leaq -0x3cd0(%rbp), %rdi
movl $0x0, -0x3d98(%rbp)
movl $0x0, -0x3d94(%rbp)
movl $0x14, -0x3d90(%rbp)
movq -0x3d98(%rbp), %rax
movq %rax, -0x3da8(%rbp)
movl -0x3d90(%rbp), %eax
movl %eax, -0x3da0(%rbp)
movq -0x3da8(%rbp), %rsi
movl -0x3da0(%rbp), %edx
xorl %ecx, %ecx
callq 0x6f70
leaq -0x3d50(%rbp), %rdi
movl $0x0, -0x3db4(%rbp)
movl $0x4, -0x3db0(%rbp)
movl $0x0, -0x3dac(%rbp)
movq -0x3db4(%rbp), %rax
movq %rax, -0x3dc4(%rbp)
movl -0x3dac(%rbp), %eax
movl %eax, -0x3dbc(%rbp)
movq -0x3dc4(%rbp), %rsi
movl -0x3dbc(%rbp), %edx
movl $0x1, %ecx
callq 0x6f70
movq -0x3c48(%rbp), %rdi
movl -0x3d54(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x3d54(%rbp)
leaq -0x3cd0(%rbp), %r8
movl $0x1, %esi
leaq 0x62fe(%rip), %rcx      # 0x93ad
movb $0x0, %al
callq 0x4c10
movq -0x3c48(%rbp), %rdi
movl -0x3d54(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x3d54(%rbp)
leaq -0x3d50(%rbp), %r8
movl $0x5, %esi
leaq 0x62a6(%rip), %rcx      # 0x9387
movb $0x0, %al
callq 0x4c10
movq -0x3c48(%rbp), %rax
movq %rax, -0x3f00(%rbp)
movl -0x3d54(%rbp), %eax
movl %eax, -0x3ef4(%rbp)
addl $0x1, %eax
movl %eax, -0x3d54(%rbp)
movl $0x2e, %edi
callq 0x3b90
movq %rax, -0x3ef0(%rbp)
movl $0x2663, %edi           # imm = 0x2663
callq 0x3b90
movq -0x3f00(%rbp), %rdi
movl -0x3ef4(%rbp), %edx
movq -0x3ef0(%rbp), %r8
movq %rax, %r9
movl $0x5, %esi
leaq 0x627a(%rip), %rcx      # 0x93c3
movb $0x0, %al
callq 0x4c10
leaq -0x3cd0(%rbp), %rdi
movl $0x46, -0x3dd0(%rbp)
movl $0x0, -0x3dcc(%rbp)
movl $0x46, -0x3dc8(%rbp)
movq -0x3dd0(%rbp), %rax
movq %rax, -0x3de0(%rbp)
movl -0x3dc8(%rbp), %eax
movl %eax, -0x3dd8(%rbp)
movq -0x3de0(%rbp), %rsi
movl -0x3dd8(%rbp), %edx
xorl %ecx, %ecx
callq 0x6f70
leaq -0x3d50(%rbp), %rdi
movl $0x0, -0x3dec(%rbp)
movl $0xfffffffe, -0x3de8(%rbp) # imm = 0xFFFFFFFE
movl $0x0, -0x3de4(%rbp)
movq -0x3dec(%rbp), %rax
movq %rax, -0x3dfc(%rbp)
movl -0x3de4(%rbp), %eax
movl %eax, -0x3df4(%rbp)
movq -0x3dfc(%rbp), %rsi
movl -0x3df4(%rbp), %edx
movl $0x1, %ecx
callq 0x6f70
movq -0x3c48(%rbp), %rdi
movl -0x3d54(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x3d54(%rbp)
leaq -0x3cd0(%rbp), %r8
movl $0x1, %esi
leaq 0x61c7(%rip), %rcx      # 0x93eb
movb $0x0, %al
callq 0x4c10
movq -0x3c48(%rbp), %rdi
movl -0x3d54(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x3d54(%rbp)
leaq -0x3d50(%rbp), %r8
movl $0x5, %esi
leaq 0x61ad(%rip), %rcx      # 0x9403
movl $0x2, %r9d
movb $0x0, %al
callq 0x4c10
movq -0x3c48(%rbp), %rax
movq %rax, -0x3ee8(%rbp)
movl -0x3d54(%rbp), %eax
movl %eax, -0x3edc(%rbp)
addl $0x1, %eax
movl %eax, -0x3d54(%rbp)
movl $0x2e, %edi
callq 0x3b90
movq -0x3ee8(%rbp), %rdi
movl -0x3edc(%rbp), %edx
movq %rax, %r8
movl $0x5, %esi
leaq 0x617d(%rip), %rcx      # 0x9429
movb $0x0, %al
callq 0x4c10
leaq -0x3cd0(%rbp), %rdi
movl $0x0, -0x3e08(%rbp)
movl $0x0, -0x3e04(%rbp)
movl $0x64, -0x3e00(%rbp)
movq -0x3e08(%rbp), %rax
movq %rax, -0x3e18(%rbp)
movl -0x3e00(%rbp), %eax
movl %eax, -0x3e10(%rbp)
movq -0x3e18(%rbp), %rsi
movl -0x3e10(%rbp), %edx
xorl %ecx, %ecx
callq 0x6f70
leaq -0x3d50(%rbp), %rdi
movl $0x5, -0x3e24(%rbp)
movl $0x0, -0x3e20(%rbp)
movl $0xffffffff, -0x3e1c(%rbp) # imm = 0xFFFFFFFF
movq -0x3e24(%rbp), %rax
movq %rax, -0x3e34(%rbp)
movl -0x3e1c(%rbp), %eax
movl %eax, -0x3e2c(%rbp)
movq -0x3e34(%rbp), %rsi
movl -0x3e2c(%rbp), %edx
movl $0x1, %ecx
callq 0x6f70
movq -0x3c48(%rbp), %rdi
movl -0x3d54(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x3d54(%rbp)
leaq -0x3cd0(%rbp), %r8
movl $0x1, %esi
leaq 0x60bd(%rip), %rcx      # 0x9444
movb $0x0, %al
callq 0x4c10
movq -0x3c48(%rbp), %rdi
movl -0x3d54(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x3d54(%rbp)
leaq -0x3d50(%rbp), %r8
movl $0x5, %esi
leaq 0x5fce(%rip), %rcx      # 0x9387
movb $0x0, %al
callq 0x4c10
movq -0x3c48(%rbp), %rax
movq %rax, -0x3ed8(%rbp)
movl -0x3d54(%rbp), %eax
movl %eax, -0x3ecc(%rbp)
addl $0x1, %eax
movl %eax, -0x3d54(%rbp)
movl $0x2229, %edi           # imm = 0x2229
callq 0x3b90
movq -0x3ed8(%rbp), %rdi
movl -0x3ecc(%rbp), %edx
movq %rax, %r8
movl $0x5, %esi
leaq 0x6051(%rip), %rcx      # 0x945a
movb $0x0, %al
callq 0x4c10
leaq -0x3cd0(%rbp), %rdi
movl $0x0, -0x3e40(%rbp)
movl $0x0, -0x3e3c(%rbp)
movl $0x1e, -0x3e38(%rbp)
movq -0x3e40(%rbp), %rax
movq %rax, -0x3e50(%rbp)
movl -0x3e38(%rbp), %eax
movl %eax, -0x3e48(%rbp)
movq -0x3e50(%rbp), %rsi
movl -0x3e48(%rbp), %edx
xorl %ecx, %ecx
callq 0x6f70
leaq -0x3d50(%rbp), %rdi
movl $0x2, -0x3e5c(%rbp)
movl $0xfffffffe, -0x3e58(%rbp) # imm = 0xFFFFFFFE
movl $0x0, -0x3e54(%rbp)
movq -0x3e5c(%rbp), %rax
movq %rax, -0x3e6c(%rbp)
movl -0x3e54(%rbp), %eax
movl %eax, -0x3e64(%rbp)
movq -0x3e6c(%rbp), %rsi
movl -0x3e64(%rbp), %edx
movl $0x1, %ecx
callq 0x6f70
movq -0x3c48(%rbp), %rdi
movl -0x3d54(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x3d54(%rbp)
leaq -0x3cd0(%rbp), %r8
movl $0x1, %esi
leaq 0x5f8c(%rip), %rcx      # 0x9470
movb $0x0, %al
callq 0x4c10
movq -0x3c48(%rbp), %rdi
movl -0x3d54(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x3d54(%rbp)
leaq -0x3d50(%rbp), %r8
movl $0x5, %esi
leaq 0x5f72(%rip), %rcx      # 0x9488
movl $0xc8, %r9d
movb $0x0, %al
callq 0x4c10
movq -0x3c48(%rbp), %rax
movq %rax, -0x3ec8(%rbp)
movl -0x3d54(%rbp), %eax
movl %eax, -0x3ebc(%rbp)
addl $0x1, %eax
movl %eax, -0x3d54(%rbp)
movl $0x2e, %edi
callq 0x3b90
movq %rax, -0x3eb8(%rbp)
movl $0x2663, %edi           # imm = 0x2663
callq 0x3b90
movq %rax, -0x3eb0(%rbp)
movl $0x2229, %edi           # imm = 0x2229
callq 0x3b90
movq -0x3ec8(%rbp), %rdi
movl -0x3ebc(%rbp), %edx
movq -0x3eb8(%rbp), %r8
movq -0x3eb0(%rbp), %r9
movl $0x5, %esi
leaq 0x5f0f(%rip), %rcx      # 0x94a8
movq %rax, (%rsp)
movb $0x0, %al
callq 0x4c10
leaq -0x3cd0(%rbp), %rdi
movl $0x1, -0x3e78(%rbp)
movl $0x0, -0x3e74(%rbp)
movl $0x0, -0x3e70(%rbp)
movq -0x3e78(%rbp), %rax
movq %rax, -0x3e88(%rbp)
movl -0x3e70(%rbp), %eax
movl %eax, -0x3e80(%rbp)
movq -0x3e88(%rbp), %rsi
movl -0x3e80(%rbp), %edx
xorl %ecx, %ecx
callq 0x6f70
leaq -0x3d50(%rbp), %rdi
movl $0xffffffff, -0x3e94(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x3e90(%rbp)
movl $0x0, -0x3e8c(%rbp)
movq -0x3e94(%rbp), %rax
movq %rax, -0x3ea4(%rbp)
movl -0x3e8c(%rbp), %eax
movl %eax, -0x3e9c(%rbp)
movq -0x3ea4(%rbp), %rsi
movl -0x3e9c(%rbp), %edx
movl $0x1, %ecx
callq 0x6f70
movq -0x3c48(%rbp), %rdi
movl -0x3d54(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x3d54(%rbp)
leaq -0x3cd0(%rbp), %r8
movl $0x1, %esi
leaq 0x5e63(%rip), %rcx      # 0x94db
movb $0x0, %al
callq 0x4c10
movq -0x3c48(%rbp), %rdi
movl -0x3d54(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x3d54(%rbp)
leaq -0x3d50(%rbp), %r8
movl $0x5, %esi
leaq 0x5e47(%rip), %rcx      # 0x94f1
movb $0x0, %al
callq 0x4c10
movq -0x3c48(%rbp), %rdi
movl -0x3d54(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x3d54(%rbp)
movl $0x5, %esi
leaq 0x5e4a(%rip), %rcx      # 0x951f
movb $0x0, %al
callq 0x4c10
movzwl -0x3c3a(%rbp), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x3f11(%rbp)
jne 0x3712
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2d90
movl %eax, %edi
movl %edi, -0x3c38(%rbp)
callq 0x2d60
xorb $-0x1, %al
movb %al, -0x3f11(%rbp)
movb -0x3f11(%rbp), %al
testb $0x1, %al
jne 0x371e
jmp 0x374a
movl -0x3c38(%rbp), %esi
leaq 0x5e0b(%rip), %rdi      # 0x9536
callq 0x10d0
cmpq $0x0, %rax
je 0x3748
movl -0x3c38(%rbp), %edi
callq 0x1060
movw %ax, -0x3c3a(%rbp)
jmp 0x36dc
movzwl -0x3c3a(%rbp), %eax
cmpl $0x52, %eax
jne 0x375f
movw $0x2b, -0x3c3a(%rbp)
callq 0x4820
movw -0x3c3a(%rbp), %ax
addq $0x3f20, %rsp           # imm = 0x3F20
popq %rbp
retq
nopw %cs:(%rax,%rax)