// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/src/startgtk_game.c
// Function: populate_video_modes
static void populate_video_modes(gboolean firsttime)
{
    int i, mode3d = -1;
    int xdim = 0, ydim = 0, bpp = 0, fullscreen = 0;
    char modestr[64];
    int cd[] = { 32, 24, 16, 15, 8, 0 };
    GtkTreeIter iter;

    if (firsttime) {
        getvalidmodes();
        xdim = settings->xdim3d;
        ydim = settings->ydim3d;
        bpp  = settings->bpp3d;
        fullscreen = settings->fullscreen;
    } else {
        // Read back the current resolution information selected in the combobox.
        fullscreen = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(controls.fullscreencheck));
        if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(controls.vmode3dcombo), &iter)) {
            gtk_tree_model_get(GTK_TREE_MODEL(controls.vmode3dlist), &iter, 1 /*index*/, &mode3d, -1);
        }
        if (mode3d >= 0) {
            xdim = validmode[mode3d].xdim;
            ydim = validmode[mode3d].ydim;
            bpp = validmode[mode3d].bpp;
        }
    }

    // Find an ideal match.
    mode3d = checkvideomode(&xdim, &ydim, bpp, fullscreen, 1);
    if (mode3d < 0) {
        for (i=0; cd[i]; ) { if (cd[i] >= bpp) i++; else break; }
        for ( ; cd[i]; i++) {
            mode3d = checkvideomode(&xdim, &ydim, cd[i], fullscreen, 1);
            if (mode3d < 0) continue;
            break;
        }
    }

    // Repopulate the list.
    gtk_list_store_clear(controls.vmode3dlist);
    for (i = 0; i < validmodecnt; i++) {
        if (validmode[i].fs != fullscreen) continue;

        sprintf(modestr, "%d \xc3\x97 %d %d-bpp",
            validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
        gtk_list_store_insert_with_values(controls.vmode3dlist,
            &iter, -1,
            0, modestr, 1, i, -1);
        if (i == mode3d) {
            gtk_combo_box_set_active_iter(GTK_COMBO_BOX(controls.vmode3dcombo), &iter);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movl %edi, -0x4(%rbp)
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq 0xa4d18(%rip), %rax     # 0xef760
movq %rax, -0x80(%rbp)
movq 0xa4d15(%rip), %rax     # 0xef768
movq %rax, -0x78(%rbp)
movq 0xa4d12(%rip), %rax     # 0xef770
movq %rax, -0x70(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0x4aaa5
callq 0xc2a00
movq 0x32d44c(%rip), %rax    # 0x377ec0
movl 0x4(%rax), %eax
movl %eax, -0x10(%rbp)
movq 0x32d43f(%rip), %rax    # 0x377ec0
movl 0x8(%rax), %eax
movl %eax, -0x14(%rbp)
movq 0x32d432(%rip), %rax    # 0x377ec0
movl 0xc(%rax), %eax
movl %eax, -0x18(%rbp)
movq 0x32d425(%rip), %rax    # 0x377ec0
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
jmp 0x4ab9a
movq 0x32d3c4(%rip), %rax    # 0x377e70
movq %rax, -0xb0(%rbp)
callq 0x9020
movq -0xb0(%rbp), %rdi
movq %rax, %rsi
callq 0x8150
movq %rax, %rdi
callq 0x83e0
movl %eax, -0x1c(%rbp)
movq 0x32d387(%rip), %rax    # 0x377e60
movq %rax, -0xa8(%rbp)
callq 0x8850
movq -0xa8(%rbp), %rdi
movq %rax, %rsi
callq 0x8150
movq %rax, %rdi
leaq -0xa0(%rbp), %rsi
callq 0x90e0
cmpl $0x0, %eax
je 0x4ab4a
movq 0x32d359(%rip), %rax    # 0x377e68
movq %rax, -0xb8(%rbp)
callq 0x8560
movq -0xb8(%rbp), %rdi
movq %rax, %rsi
callq 0x8150
movq %rax, %rdi
leaq -0xa0(%rbp), %rsi
movl $0x1, %edx
leaq -0xc(%rbp), %rcx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movb $0x0, %al
callq 0x88f0
cmpl $0x0, -0xc(%rbp)
jl 0x4ab98
movslq -0xc(%rbp), %rcx
leaq 0x5e7f25(%rip), %rax    # 0x632a80
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x10(%rbp)
movslq -0xc(%rbp), %rcx
leaq 0x5e7f0e(%rip), %rax    # 0x632a80
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x14(%rbp)
movslq -0xc(%rbp), %rcx
leaq 0x5e7ef6(%rip), %rax    # 0x632a80
shlq $0x4, %rcx
addq %rcx, %rax
movzbl 0x8(%rax), %eax
movl %eax, -0x18(%rbp)
jmp 0x4ab9a
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
leaq -0x10(%rbp), %rdi
leaq -0x14(%rbp), %rsi
movl $0x1, %r8d
callq 0x4b160
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jge 0x4ac2f
movl $0x0, -0x8(%rbp)
movslq -0x8(%rbp), %rax
cmpl $0x0, -0x80(%rbp,%rax,4)
je 0x4abea
movslq -0x8(%rbp), %rax
movl -0x80(%rbp,%rax,4), %eax
cmpl -0x18(%rbp), %eax
jl 0x4abe6
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x4abe8
jmp 0x4abea
jmp 0x4abc3
jmp 0x4abec
movslq -0x8(%rbp), %rax
cmpl $0x0, -0x80(%rbp,%rax,4)
je 0x4ac2d
movslq -0x8(%rbp), %rax
movl -0x80(%rbp,%rax,4), %edx
movl -0x1c(%rbp), %ecx
leaq -0x10(%rbp), %rdi
leaq -0x14(%rbp), %rsi
movl $0x1, %r8d
callq 0x4b160
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jge 0x4ac20
jmp 0x4ac22
jmp 0x4ac2d
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x4abec
jmp 0x4ac2f
movq 0x32d232(%rip), %rdi    # 0x377e68
callq 0x84a0
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
leaq 0x50ca94(%rip), %rcx    # 0x5576e0
cmpl (%rcx), %eax
jge 0x4ad43
movslq -0x8(%rbp), %rcx
leaq 0x5e7e21(%rip), %rax    # 0x632a80
shlq $0x4, %rcx
addq %rcx, %rax
movzbl 0x9(%rax), %eax
cmpl -0x1c(%rbp), %eax
je 0x4ac74
jmp 0x4ad35
leaq -0x60(%rbp), %rdi
movslq -0x8(%rbp), %rcx
leaq 0x5e7dfd(%rip), %rax    # 0x632a80
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %edx
movslq -0x8(%rbp), %rcx
leaq 0x5e7de9(%rip), %rax    # 0x632a80
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movslq -0x8(%rbp), %rsi
leaq 0x5e7dd4(%rip), %rax    # 0x632a80
shlq $0x4, %rsi
addq %rsi, %rax
movzbl 0x8(%rax), %r8d
leaq 0xa493f(%rip), %rsi     # 0xef5fe
movb $0x0, %al
callq 0x8e50
movq 0x32d19b(%rip), %rdi    # 0x377e68
leaq -0x60(%rbp), %r8
movl -0x8(%rbp), %eax
leaq -0xa0(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
movl $0x1, %r9d
movl %eax, (%rsp)
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
movb $0x0, %al
callq 0x8a00
movl -0x8(%rbp), %eax
cmpl -0xc(%rbp), %eax
jne 0x4ad33
movq 0x32d157(%rip), %rax    # 0x377e60
movq %rax, -0xc0(%rbp)
callq 0x8850
movq -0xc0(%rbp), %rdi
movq %rax, %rsi
callq 0x8150
movq %rax, %rdi
leaq -0xa0(%rbp), %rsi
callq 0x86c0
jmp 0x4ad35
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x4ac42
addq $0xd0, %rsp
popq %rbp
retq
nopl (%rax)