// File: tjohnman[P]sfxr-sdl2/build/../src/main.cpp
// Function: LoadSettings(char*)
bool LoadSettings(char* filename)
{
	lastChanged = NULL;
	FILE* file=fopen(filename, "rb");
	if(!file)
		return false;
	
	size_t n;
	(void)n;
	int version=0;
	n = fread(&version, 1, sizeof(int), file);
	if(version!=100 && version!=101 && version!=102)
		return false;

	n = fread(&wave_type, 1, sizeof(int), file);

	sound_vol=0.5f;
	if(version==102)
		n = fread(&sound_vol, 1, sizeof(float), file);

	n = fread(&p_base_freq, 1, sizeof(float), file);
	n = fread(&p_freq_limit, 1, sizeof(float), file);
	n = fread(&p_freq_ramp, 1, sizeof(float), file);
	if(version>=101)
		n = fread(&p_freq_dramp, 1, sizeof(float), file);
	n = fread(&p_duty, 1, sizeof(float), file);
	n = fread(&p_duty_ramp, 1, sizeof(float), file);

	n = fread(&p_vib_strength, 1, sizeof(float), file);
	n = fread(&p_vib_speed, 1, sizeof(float), file);
	n = fread(&p_vib_delay, 1, sizeof(float), file);

	n = fread(&p_env_attack, 1, sizeof(float), file);
	n = fread(&p_env_sustain, 1, sizeof(float), file);
	n = fread(&p_env_decay, 1, sizeof(float), file);
	n = fread(&p_env_punch, 1, sizeof(float), file);

	n = fread(&filter_on, 1, sizeof(bool), file);
	n = fread(&p_lpf_resonance, 1, sizeof(float), file);
	n = fread(&p_lpf_freq, 1, sizeof(float), file);
	n = fread(&p_lpf_ramp, 1, sizeof(float), file);
	n = fread(&p_hpf_freq, 1, sizeof(float), file);
	n = fread(&p_hpf_ramp, 1, sizeof(float), file);
	
	n = fread(&p_pha_offset, 1, sizeof(float), file);
	n = fread(&p_pha_ramp, 1, sizeof(float), file);

	n = fread(&p_repeat_speed, 1, sizeof(float), file);

	if(version>=101)
	{
		n = fread(&p_arp_speed, 1, sizeof(float), file);
		n = fread(&p_arp_mod, 1, sizeof(float), file);
	}

	fclose(file);
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, 0x10c59(%rip) # 0x14690
movq -0x10(%rbp), %rdi
leaq 0xa6fa(%rip), %rsi      # 0xe13c
callq 0x3410
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x3a5b
movb $0x0, -0x1(%rbp)
jmp 0x3dd1
movl $0x0, -0x24(%rbp)
movq -0x18(%rbp), %rcx
leaq -0x24(%rbp), %rdi
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
cmpl $0x64, -0x24(%rbp)
je 0x3a98
cmpl $0x65, -0x24(%rbp)
je 0x3a98
cmpl $0x66, -0x24(%rbp)
je 0x3a98
movb $0x0, -0x1(%rbp)
jmp 0x3dd1
movq -0x18(%rbp), %rcx
leaq 0xfa3d(%rip), %rdi      # 0x134e0
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movss 0xa556(%rip), %xmm0     # 0xe014
movss %xmm0, 0xf86e(%rip)     # 0x13334
cmpl $0x66, -0x24(%rbp)
jne 0x3aea
movq -0x18(%rbp), %rcx
leaq 0xf85d(%rip), %rdi      # 0x13334
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf9ef(%rip), %rdi      # 0x134e4
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf9d5(%rip), %rdi      # 0x134e8
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf9bb(%rip), %rdi      # 0x134ec
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
cmpl $0x65, -0x24(%rbp)
jl 0x3b68
movq -0x18(%rbp), %rcx
leaq 0xf99b(%rip), %rdi      # 0x134f0
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf981(%rip), %rdi      # 0x134f4
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf967(%rip), %rdi      # 0x134f8
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf94d(%rip), %rdi      # 0x134fc
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf933(%rip), %rdi      # 0x13500
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf919(%rip), %rdi      # 0x13504
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf8ff(%rip), %rdi      # 0x13508
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf8e5(%rip), %rdi      # 0x1350c
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf8cb(%rip), %rdi      # 0x13510
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf8b1(%rip), %rdi      # 0x13514
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf897(%rip), %rdi      # 0x13518
movl $0x1, %edx
movq %rdx, %rsi
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf87f(%rip), %rdi      # 0x1351c
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf865(%rip), %rdi      # 0x13520
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf84b(%rip), %rdi      # 0x13524
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf831(%rip), %rdi      # 0x13528
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf817(%rip), %rdi      # 0x1352c
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf7fd(%rip), %rdi      # 0x13530
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf7e3(%rip), %rdi      # 0x13534
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf7c9(%rip), %rdi      # 0x13538
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
cmpl $0x65, -0x24(%rbp)
jl 0x3dc4
movq -0x18(%rbp), %rcx
leaq 0xf7a9(%rip), %rdi      # 0x1353c
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
leaq 0xf78f(%rip), %rdi      # 0x13540
movl $0x1, %esi
movl $0x4, %edx
callq 0x34f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3340
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)