// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/gtkbits.c
// Function: wmgtk_filechooser
int wmgtk_filechooser(const char *initialdir, const char *initialfile, const char *type, int foropen, char **choice)
{
	GtkWidget *dialog;
	GtkFileChooserAction action;
	const char *title;
	gint r;

	GtkFileFilter *filter;
	char typepat[20];

	(void)initialdir;

	*choice = NULL;
	if (!gtkenabled) return -1;

	if (foropen) {
		action = GTK_FILE_CHOOSER_ACTION_OPEN;
		title = "_Open";
	} else {
		action = GTK_FILE_CHOOSER_ACTION_SAVE;
		title = "_Save";
	}
	dialog = gtk_file_chooser_dialog_new(title + 1, NULL, action,
		"_Cancel", GTK_RESPONSE_CANCEL,
		title, GTK_RESPONSE_ACCEPT,
		NULL);

	if (!foropen && initialfile) {
		gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), initialfile);
	}

	filter = gtk_file_filter_new();
	sprintf(typepat, "*.%s", type);
	gtk_file_filter_add_pattern(filter, typepat);
	gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);

	r = gtk_dialog_run(GTK_DIALOG(dialog));
	if (r == GTK_RESPONSE_ACCEPT) {
		GtkFileChooser *chooser = GTK_FILE_CHOOSER(dialog);
		char *fn = gtk_file_chooser_get_filename(chooser);
		if (fn) {
			*choice = strdup(fn);
			g_free(fn);
		}
	}
	gtk_widget_destroy(dialog);

	return r == GTK_RESPONSE_ACCEPT ? 1 : 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq $0x0, (%rax)
cmpl $0x0, 0x61ad88(%rip)    # 0x6c2018
jne 0xa729e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa7435
cmpl $0x0, -0x24(%rbp)
je 0xa72b8
movl $0x0, -0x3c(%rbp)
leaq 0x13767(%rip), %rax     # 0xbaa19
movq %rax, -0x48(%rbp)
jmp 0xa72ca
movl $0x1, -0x3c(%rbp)
leaq 0x13759(%rip), %rax     # 0xbaa1f
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
addq $0x1, %rdi
movl -0x3c(%rbp), %edx
movq -0x48(%rbp), %r9
xorl %eax, %eax
movl %eax, %esi
leaq 0x13741(%rip), %rcx     # 0xbaa25
movl $0xfffffffa, %r8d       # imm = 0xFFFFFFFA
movl $0xfffffffd, (%rsp)     # imm = 0xFFFFFFFD
movq $0x0, 0x8(%rsp)
movb $0x0, %al
callq 0x6ad0
movq %rax, -0x38(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0xa733d
cmpq $0x0, -0x18(%rbp)
je 0xa733d
movq -0x38(%rbp), %rax
movq %rax, -0x88(%rbp)
callq 0x6780
movq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x6130
movq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0x60e0
callq 0x64c0
movq %rax, -0x58(%rbp)
leaq -0x70(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x136d8(%rip), %rsi     # 0xbaa2d
movb $0x0, %al
callq 0x6a30
movq -0x58(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x6680
movq -0x38(%rbp), %rax
movq %rax, -0x98(%rbp)
callq 0x6780
movq -0x98(%rbp), %rdi
movq %rax, %rsi
callq 0x6130
movq %rax, %rdi
movq -0x58(%rbp), %rsi
callq 0x65e0
movq -0x38(%rbp), %rax
movq %rax, -0x90(%rbp)
callq 0x6650
movq -0x90(%rbp), %rdi
movq %rax, %rsi
callq 0x6130
movq %rax, %rdi
callq 0x6260
movl %eax, -0x4c(%rbp)
cmpl $-0x3, -0x4c(%rbp)
jne 0xa7419
movq -0x38(%rbp), %rax
movq %rax, -0xa0(%rbp)
callq 0x6780
movq -0xa0(%rbp), %rdi
movq %rax, %rsi
callq 0x6130
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdi
callq 0x67e0
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
je 0xa7417
movq -0x80(%rbp), %rdi
callq 0x6060
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x80(%rbp), %rdi
callq 0x6230
jmp 0xa7419
movq -0x38(%rbp), %rdi
callq 0x6170
movl -0x4c(%rbp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $-0x3, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)