// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/config.c
// Function: writesetup
int writesetup(const char *fn)
{
	BFILE *fp;
	int item;

	fp = Bfopen(fn,"wt");
	if (!fp) return -1;

	tmpbrightness = brightness;
#if USE_POLYMOST
	tmprenderer = getrendermode();
#endif
#ifdef RENDERTYPEWIN
	tmpmaxrefreshfreq = win_getmaxrefreshfreq();
#endif

	for (item = 0; configspec[item].name; item++) {
		if (configspec[item].doc) {
			if (item > 0) fputs("\n", fp);
			fputs(configspec[item].doc, fp);
		}
		fputs(configspec[item].name, fp);
		fputs(" = ", fp);
		switch (configspec[item].type) {
			case type_bool: {
				fprintf(fp, "%d\n", (*(int*)configspec[item].store != 0));
				break;
			}
			case type_int: {
				fprintf(fp, "%d\n", *(int*)configspec[item].store);
				break;
			}
			case type_hex: {
				fprintf(fp, "%X\n", *(int*)configspec[item].store);
				break;
			}
			case type_fixed16: {
				fprintf(fp, "%g\n", (double)(*(int*)configspec[item].store) / 65536.0);
				break;
			}
			case type_double: {
				fprintf(fp, "%g\n", *(double*)configspec[item].store);
				break;
			}
			default: {
				fputs("?\n", fp);
				break;
			}
		}
	}

	Bfclose(fp);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x82d09(%rip), %rsi     # 0xaf430
callq 0x6c10
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x2c743
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2c95c
leaq 0x13d932(%rip), %rax    # 0x16a07c
movswl (%rax), %eax
movl %eax, 0xb3c91(%rip)     # 0xe03e4
callq 0x5a7b0
movl %eax, 0xb3c82(%rip)     # 0xe03e0
movl $0x0, -0x1c(%rbp)
movslq -0x1c(%rbp), %rcx
leaq 0xb3850(%rip), %rax     # 0xdffc0
shlq $0x5, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x2c94c
movslq -0x1c(%rbp), %rcx
leaq 0xb3834(%rip), %rax     # 0xdffc0
shlq $0x5, %rcx
addq %rcx, %rax
cmpq $0x0, 0x18(%rax)
je 0x2c7cf
cmpl $0x0, -0x1c(%rbp)
jle 0x2c7b0
movq -0x18(%rbp), %rsi
leaq 0x86751(%rip), %rdi     # 0xb2efc
callq 0x62f0
movslq -0x1c(%rbp), %rcx
leaq 0xb3805(%rip), %rax     # 0xdffc0
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x62f0
movslq -0x1c(%rbp), %rax
shlq $0x5, %rax
leaq 0xb37e2(%rip), %rcx     # 0xdffc0
movq %rcx, -0x30(%rbp)
movq (%rax,%rcx), %rdi
movq -0x18(%rbp), %rsi
callq 0x62f0
movq -0x18(%rbp), %rsi
leaq 0x831bd(%rip), %rdi     # 0xaf9b7
callq 0x62f0
movq -0x30(%rbp), %rcx
movslq -0x1c(%rbp), %rax
shlq $0x5, %rax
movl 0x8(%rax,%rcx), %eax
movq %rax, -0x28(%rbp)
subq $0x4, %rax
ja 0x2c92c
movq -0x28(%rbp), %rax
leaq 0x84684(%rip), %rcx     # 0xb0eac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rcx
leaq 0xb3780(%rip), %rax     # 0xdffc0
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
cmpl $0x0, (%rax)
setne %al
andb $0x1, %al
movzbl %al, %edx
leaq 0x856dd(%rip), %rsi     # 0xb1f3a
movb $0x0, %al
callq 0x61e0
jmp 0x2c93c
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rcx
leaq 0xb3748(%rip), %rax     # 0xdffc0
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movl (%rax), %edx
leaq 0x856ae(%rip), %rsi     # 0xb1f3a
movb $0x0, %al
callq 0x61e0
jmp 0x2c93c
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rcx
leaq 0xb3719(%rip), %rax     # 0xdffc0
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movl (%rax), %edx
leaq 0x84643(%rip), %rsi     # 0xb0efe
movb $0x0, %al
callq 0x61e0
jmp 0x2c93c
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rcx
leaq 0xb36ed(%rip), %rax     # 0xdffc0
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
cvtsi2sdl (%rax), %xmm0
movsd 0x845a6(%rip), %xmm1    # 0xb0e90
divsd %xmm1, %xmm0
leaq 0x8460d(%rip), %rsi     # 0xb0f02
movb $0x1, %al
callq 0x61e0
jmp 0x2c93c
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rcx
leaq 0xb36b3(%rip), %rax     # 0xdffc0
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movsd (%rax), %xmm0
leaq 0x845df(%rip), %rsi     # 0xb0f02
movb $0x1, %al
callq 0x61e0
jmp 0x2c93c
movq -0x18(%rbp), %rsi
leaq 0x845cf(%rip), %rdi     # 0xb0f06
callq 0x62f0
jmp 0x2c93e
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x2c765
movq -0x18(%rbp), %rdi
callq 0x6420
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop