// File: /workspace/github_cpp_makefile_star2_O1/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 %rbx
subq $0x10, %rsp
leaq 0x75c5(%rip), %rsi      # 0xa15f
callq 0x2310
movq %rax, %rbx
testq %rax, %rax
je 0x2e50
leaq 0xc(%rsp), %rdi
movl $0x66, (%rdi)
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa871(%rip), %rdi      # 0xd440
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa6a4(%rip), %rdi      # 0xd28c
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa843(%rip), %rdi      # 0xd444
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa82e(%rip), %rdi      # 0xd448
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa819(%rip), %rdi      # 0xd44c
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa804(%rip), %rdi      # 0xd450
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa7ef(%rip), %rdi      # 0xd454
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa7da(%rip), %rdi      # 0xd458
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa7c5(%rip), %rdi      # 0xd45c
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa7b0(%rip), %rdi      # 0xd460
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa79b(%rip), %rdi      # 0xd464
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa786(%rip), %rdi      # 0xd468
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa771(%rip), %rdi      # 0xd46c
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa75c(%rip), %rdi      # 0xd470
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa747(%rip), %rdi      # 0xd474
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
movsbl 0xa732(%rip), %edi      # 0xd478
movq %rbx, %rsi
callq 0x2340
leaq 0xa727(%rip), %rdi      # 0xd47c
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa712(%rip), %rdi      # 0xd480
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa6fd(%rip), %rdi      # 0xd484
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa6e8(%rip), %rdi      # 0xd488
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa6d3(%rip), %rdi      # 0xd48c
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa6be(%rip), %rdi      # 0xd490
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa6a9(%rip), %rdi      # 0xd494
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa694(%rip), %rdi      # 0xd498
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa67f(%rip), %rdi      # 0xd49c
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
leaq 0xa66a(%rip), %rdi      # 0xd4a0
movl $0x1, %esi
movl $0x4, %edx
movq %rbx, %rcx
callq 0x24e0
movq %rbx, %rdi
callq 0x2280
testq %rbx, %rbx
setne %al
addq $0x10, %rsp
popq %rbx
retq