// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/startgtk_editor.c
// Function: populate_video_modes
static void populate_video_modes(gboolean firsttime)
{
    int i, mode2d = -1, mode3d = -1;
    int xdim = 0, ydim = 0, bpp = 0, fullscreen = 0;
    int xdim2d = 0, ydim2d = 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;

        xdim2d = settings->xdim2d;
        ydim2d = settings->ydim2d;
    } 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;
        }
        if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(controls.vmode2dcombo), &iter)) {
            gtk_tree_model_get(GTK_TREE_MODEL(controls.vmode2dlist), &iter, 1 /*index*/, &mode2d, -1);
        }
        if (mode2d >= 0) {
            xdim2d = validmode[mode2d].xdim;
            ydim2d = validmode[mode2d].ydim;
        }
    }

    // Find an ideal match.
    mode3d = checkvideomode(&xdim, &ydim, bpp, fullscreen, 1);
    mode2d = checkvideomode(&xdim2d, &ydim2d, 8, fullscreen, 1);
    if (mode2d < 0) {
        mode2d = 0;
    }
    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);
    gtk_list_store_clear(controls.vmode2dlist);
    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);
        }

        if (validmode[i].bpp == 8 && validmode[i].xdim >= 640 && validmode[i].ydim >= 480) {
            sprintf(modestr, "%d \xc3\x97 %d",
                validmode[i].xdim, validmode[i].ydim);
            gtk_list_store_insert_with_values(controls.vmode2dlist,
                &iter, -1,
                0, modestr, 1, i, -1);
            if (i == mode2d) {
                gtk_combo_box_set_active_iter(GTK_COMBO_BOX(controls.vmode2dcombo), &iter);
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movl %edi, -0x4(%rbp)
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x10(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movq 0x844a3(%rip), %rax     # 0xb1b20
movq %rax, -0x90(%rbp)
movq 0x8449d(%rip), %rax     # 0xb1b28
movq %rax, -0x88(%rbp)
movq 0x84497(%rip), %rax     # 0xb1b30
movq %rax, -0x80(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0x2d6fa
callq 0xa5720
movq 0x18d531(%rip), %rax    # 0x1babe0
movl 0xc(%rax), %eax
movl %eax, -0x14(%rbp)
movq 0x18d524(%rip), %rax    # 0x1babe0
movl 0x10(%rax), %eax
movl %eax, -0x18(%rbp)
movq 0x18d517(%rip), %rax    # 0x1babe0
movl 0x14(%rax), %eax
movl %eax, -0x1c(%rbp)
movq 0x18d50a(%rip), %rax    # 0x1babe0
movl (%rax), %eax
movl %eax, -0x20(%rbp)
movq 0x18d4fe(%rip), %rax    # 0x1babe0
movl 0x4(%rax), %eax
movl %eax, -0x24(%rbp)
movq 0x18d4f1(%rip), %rax    # 0x1babe0
movl 0x8(%rax), %eax
movl %eax, -0x28(%rbp)
jmp 0x2d89c
movq 0x18d4cf(%rip), %rax    # 0x1babd0
movq %rax, -0xc0(%rbp)
callq 0x6b40
movq -0xc0(%rbp), %rdi
movq %rax, %rsi
callq 0x6130
movq %rax, %rdi
callq 0x62c0
movl %eax, -0x20(%rbp)
movq 0x18d492(%rip), %rax    # 0x1babc0
movq %rax, -0xb8(%rbp)
callq 0x65d0
movq -0xb8(%rbp), %rdi
movq %rax, %rsi
callq 0x6130
movq %rax, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x6bf0
cmpl $0x0, %eax
je 0x2d79f
movq 0x18d464(%rip), %rax    # 0x1babc8
movq %rax, -0xc8(%rbp)
callq 0x63f0
movq -0xc8(%rbp), %rdi
movq %rax, %rsi
callq 0x6130
movq %rax, %rdi
leaq -0xb0(%rbp), %rsi
movl $0x1, %edx
leaq -0x10(%rbp), %rcx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movb $0x0, %al
callq 0x6640
cmpl $0x0, -0x10(%rbp)
jl 0x2d7ed
movslq -0x10(%rbp), %rcx
leaq 0x448000(%rip), %rax    # 0x4757b0
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x14(%rbp)
movslq -0x10(%rbp), %rcx
leaq 0x447fe9(%rip), %rax    # 0x4757b0
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x18(%rbp)
movslq -0x10(%rbp), %rcx
leaq 0x447fd1(%rip), %rax    # 0x4757b0
shlq $0x4, %rcx
addq %rcx, %rax
movzbl 0x8(%rax), %eax
movl %eax, -0x1c(%rbp)
movq 0x18d3bc(%rip), %rax    # 0x1babb0
movq %rax, -0xd0(%rbp)
callq 0x65d0
movq -0xd0(%rbp), %rdi
movq %rax, %rsi
callq 0x6130
movq %rax, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x6bf0
cmpl $0x0, %eax
je 0x2d865
movq 0x18d38e(%rip), %rax    # 0x1babb8
movq %rax, -0xd8(%rbp)
callq 0x63f0
movq -0xd8(%rbp), %rdi
movq %rax, %rsi
callq 0x6130
movq %rax, %rdi
leaq -0xb0(%rbp), %rsi
movl $0x1, %edx
leaq -0xc(%rbp), %rcx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movb $0x0, %al
callq 0x6640
cmpl $0x0, -0xc(%rbp)
jl 0x2d89a
movslq -0xc(%rbp), %rcx
leaq 0x447f3a(%rip), %rax    # 0x4757b0
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x24(%rbp)
movslq -0xc(%rbp), %rcx
leaq 0x447f23(%rip), %rax    # 0x4757b0
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x28(%rbp)
jmp 0x2d89c
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
leaq -0x14(%rbp), %rdi
leaq -0x18(%rbp), %rsi
movl $0x1, %r8d
callq 0x2dbd0
movl %eax, -0x10(%rbp)
movl -0x20(%rbp), %ecx
leaq -0x24(%rbp), %rdi
leaq -0x28(%rbp), %rsi
movl $0x8, %edx
movl $0x1, %r8d
callq 0x2dbd0
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jge 0x2d8e3
movl $0x0, -0xc(%rbp)
cmpl $0x0, -0x10(%rbp)
jge 0x2d968
movl $0x0, -0x8(%rbp)
movslq -0x8(%rbp), %rax
cmpl $0x0, -0x90(%rbp,%rax,4)
je 0x2d91d
movslq -0x8(%rbp), %rax
movl -0x90(%rbp,%rax,4), %eax
cmpl -0x1c(%rbp), %eax
jl 0x2d919
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x2d91b
jmp 0x2d91d
jmp 0x2d8f0
jmp 0x2d91f
movslq -0x8(%rbp), %rax
cmpl $0x0, -0x90(%rbp,%rax,4)
je 0x2d966
movslq -0x8(%rbp), %rax
movl -0x90(%rbp,%rax,4), %edx
movl -0x20(%rbp), %ecx
leaq -0x14(%rbp), %rdi
leaq -0x18(%rbp), %rsi
movl $0x1, %r8d
callq 0x2dbd0
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jge 0x2d959
jmp 0x2d95b
jmp 0x2d966
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x2d91f
jmp 0x2d968
movq 0x18d259(%rip), %rdi    # 0x1babc8
callq 0x6340
movq 0x18d23d(%rip), %rdi    # 0x1babb8
callq 0x6340
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
leaq 0x36ca7f(%rip), %rcx    # 0x39a410
cmpl (%rcx), %eax
jge 0x2db8e
movslq -0x8(%rbp), %rcx
leaq 0x447e0c(%rip), %rax    # 0x4757b0
shlq $0x4, %rcx
addq %rcx, %rax
movzbl 0x9(%rax), %eax
cmpl -0x20(%rbp), %eax
je 0x2d9b9
jmp 0x2db80
leaq -0x70(%rbp), %rdi
movslq -0x8(%rbp), %rcx
leaq 0x447de8(%rip), %rax    # 0x4757b0
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %edx
movslq -0x8(%rbp), %rcx
leaq 0x447dd4(%rip), %rax    # 0x4757b0
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movslq -0x8(%rbp), %rsi
leaq 0x447dbf(%rip), %rax    # 0x4757b0
shlq $0x4, %rsi
addq %rsi, %rax
movzbl 0x8(%rax), %r8d
leaq 0x840f5(%rip), %rsi     # 0xb1af9
movb $0x0, %al
callq 0x6a30
movq 0x18d1b6(%rip), %rdi    # 0x1babc8
leaq -0x70(%rbp), %r8
movl -0x8(%rbp), %eax
leaq -0xb0(%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 0x66e0
movl -0x8(%rbp), %eax
cmpl -0x10(%rbp), %eax
jne 0x2da78
movq 0x18d172(%rip), %rax    # 0x1babc0
movq %rax, -0xe0(%rbp)
callq 0x65d0
movq -0xe0(%rbp), %rdi
movq %rax, %rsi
callq 0x6130
movq %rax, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x64b0
movslq -0x8(%rbp), %rcx
leaq 0x447d2d(%rip), %rax    # 0x4757b0
shlq $0x4, %rcx
addq %rcx, %rax
movzbl 0x8(%rax), %eax
cmpl $0x8, %eax
jne 0x2db7e
movslq -0x8(%rbp), %rcx
leaq 0x447d0e(%rip), %rax    # 0x4757b0
shlq $0x4, %rcx
addq %rcx, %rax
cmpl $0x280, (%rax)          # imm = 0x280
jl 0x2db7e
movslq -0x8(%rbp), %rcx
leaq 0x447cf0(%rip), %rax    # 0x4757b0
shlq $0x4, %rcx
addq %rcx, %rax
cmpl $0x1e0, 0x4(%rax)       # imm = 0x1E0
jl 0x2db7e
leaq -0x70(%rbp), %rdi
movslq -0x8(%rbp), %rcx
leaq 0x447ccd(%rip), %rax    # 0x4757b0
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %edx
movslq -0x8(%rbp), %rcx
leaq 0x447cb9(%rip), %rax    # 0x4757b0
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
leaq 0x84001(%rip), %rsi     # 0xb1b09
movb $0x0, %al
callq 0x6a30
movq 0x18d0a2(%rip), %rdi    # 0x1babb8
leaq -0x70(%rbp), %r8
movl -0x8(%rbp), %eax
leaq -0xb0(%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 0x66e0
movl -0x8(%rbp), %eax
cmpl -0xc(%rbp), %eax
jne 0x2db7c
movq 0x18d05e(%rip), %rax    # 0x1babb0
movq %rax, -0xe8(%rbp)
callq 0x65d0
movq -0xe8(%rbp), %rdi
movq %rax, %rsi
callq 0x6130
movq %rax, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x64b0
jmp 0x2db7e
jmp 0x2db80
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x2d987
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw (%rax,%rax)