// File: 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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0xa348(%rip), %rsi      # 0xe13f
callq 0x3410
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x3e10
movb $0x0, -0x1(%rbp)
jmp 0x40dd
movl $0x66, -0x1c(%rbp)
movq -0x18(%rbp), %rcx
leaq -0x1c(%rbp), %rdi
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf6a7(%rip), %rdi      # 0x134e0
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf4e1(%rip), %rdi      # 0x13334
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf677(%rip), %rdi      # 0x134e4
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf661(%rip), %rdi      # 0x134e8
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf64b(%rip), %rdi      # 0x134ec
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf635(%rip), %rdi      # 0x134f0
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf61f(%rip), %rdi      # 0x134f4
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf609(%rip), %rdi      # 0x134f8
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf5f3(%rip), %rdi      # 0x134fc
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf5dd(%rip), %rdi      # 0x13500
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf5c7(%rip), %rdi      # 0x13504
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf5b1(%rip), %rdi      # 0x13508
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf59b(%rip), %rdi      # 0x1350c
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf585(%rip), %rdi      # 0x13510
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf56f(%rip), %rdi      # 0x13514
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf559(%rip), %rdi      # 0x13518
movl $0x1, %edx
movq %rdx, %rsi
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf545(%rip), %rdi      # 0x1351c
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf52f(%rip), %rdi      # 0x13520
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf519(%rip), %rdi      # 0x13524
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf503(%rip), %rdi      # 0x13528
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf4ed(%rip), %rdi      # 0x1352c
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf4d7(%rip), %rdi      # 0x13530
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf4c1(%rip), %rdi      # 0x13534
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf4ab(%rip), %rdi      # 0x13538
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf495(%rip), %rdi      # 0x1353c
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rcx
leaq 0xf47f(%rip), %rdi      # 0x13540
movl $0x1, %esi
movl $0x4, %edx
callq 0x3610
movq -0x18(%rbp), %rdi
callq 0x3340
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)