// File: /workspace/github_cpp_makefile_star2_O2/tjohnman[P]sfxr-sdl2/build/../src/main.cpp
// Function: SaveSettings(char*)
bool SaveSettings(char* filename)
{
	FILE* file=fopen(filename, "wb");
	if(!file)
		return false;

	int version=102;
	fwrite(&version, 1, sizeof(int), file);

	fwrite(&wave_type, 1, sizeof(int), file);

	fwrite(&sound_vol, 1, sizeof(float), file);

	fwrite(&p_base_freq, 1, sizeof(float), file);
	fwrite(&p_freq_limit, 1, sizeof(float), file);
	fwrite(&p_freq_ramp, 1, sizeof(float), file);
	fwrite(&p_freq_dramp, 1, sizeof(float), file);
	fwrite(&p_duty, 1, sizeof(float), file);
	fwrite(&p_duty_ramp, 1, sizeof(float), file);

	fwrite(&p_vib_strength, 1, sizeof(float), file);
	fwrite(&p_vib_speed, 1, sizeof(float), file);
	fwrite(&p_vib_delay, 1, sizeof(float), file);

	fwrite(&p_env_attack, 1, sizeof(float), file);
	fwrite(&p_env_sustain, 1, sizeof(float), file);
	fwrite(&p_env_decay, 1, sizeof(float), file);
	fwrite(&p_env_punch, 1, sizeof(float), file);

	fwrite(&filter_on, 1, sizeof(bool), file);
	fwrite(&p_lpf_resonance, 1, sizeof(float), file);
	fwrite(&p_lpf_freq, 1, sizeof(float), file);
	fwrite(&p_lpf_ramp, 1, sizeof(float), file);
	fwrite(&p_hpf_freq, 1, sizeof(float), file);
	fwrite(&p_hpf_ramp, 1, sizeof(float), file);
	
	fwrite(&p_pha_offset, 1, sizeof(float), file);
	fwrite(&p_pha_ramp, 1, sizeof(float), file);

	fwrite(&p_repeat_speed, 1, sizeof(float), file);

	fwrite(&p_arp_speed, 1, sizeof(float), file);
	fwrite(&p_arp_mod, 1, sizeof(float), file);

	fclose(file);
	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0x5652(%rip), %rsi      # 0x915f
callq 0x3330
movq %rax, %rbx
testq %rax, %rax
je 0x3d63
leaq 0xc(%rsp), %rdi
movl $0x66, (%rdi)
pushq $0x1
popq %r14
pushq $0x4
popq %r15
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x991a(%rip), %rdi      # 0xd460
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x9759(%rip), %rdi      # 0xd2b4
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x98f4(%rip), %rdi      # 0xd464
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x98e3(%rip), %rdi      # 0xd468
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x98d2(%rip), %rdi      # 0xd46c
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x98c1(%rip), %rdi      # 0xd470
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x98b0(%rip), %rdi      # 0xd474
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x989f(%rip), %rdi      # 0xd478
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x988e(%rip), %rdi      # 0xd47c
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x987d(%rip), %rdi      # 0xd480
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x986c(%rip), %rdi      # 0xd484
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x985b(%rip), %rdi      # 0xd488
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x984a(%rip), %rdi      # 0xd48c
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x9839(%rip), %rdi      # 0xd490
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x9828(%rip), %rdi      # 0xd494
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
movsbl 0x9817(%rip), %edi      # 0xd498
movq %rbx, %rsi
callq 0x3360
leaq 0x980c(%rip), %rdi      # 0xd49c
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x97fb(%rip), %rdi      # 0xd4a0
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x97ea(%rip), %rdi      # 0xd4a4
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x97d9(%rip), %rdi      # 0xd4a8
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x97c8(%rip), %rdi      # 0xd4ac
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x97b7(%rip), %rdi      # 0xd4b0
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x97a6(%rip), %rdi      # 0xd4b4
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x9795(%rip), %rdi      # 0xd4b8
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x9784(%rip), %rdi      # 0xd4bc
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
leaq 0x9773(%rip), %rdi      # 0xd4c0
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3510
movq %rbx, %rdi
callq 0x32b0
testq %rbx, %rbx
setne %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq