// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
andq $0x0, 0xaddb(%rip)      # 0xe620
leaq 0x5910(%rip), %rsi      # 0x915c
callq 0x3330
testq %rax, %rax
je 0x3aec
movq %rax, %rbx
leaq 0xc(%rsp), %r14
andl $0x0, (%r14)
pushq $0x1
popq %rsi
pushq $0x4
popq %rdx
movq %r14, %rdi
movq %rax, %rcx
callq 0x3400
movl (%r14), %r12d
leal -0x64(%r12), %eax
cmpl $0x3, %eax
setb %bpl
jae 0x3aee
leaq 0x9bcd(%rip), %rdi      # 0xd460
pushq $0x1
popq %rsi
pushq $0x4
popq %rdx
movq %rbx, %rcx
callq 0x3400
movl $0x3f000000, 0x9a09(%rip) # imm = 0x3F000000
cmpl $0x66, %r12d
jne 0x38c6
leaq 0x99fc(%rip), %rdi      # 0xd2b4
pushq $0x1
popq %rsi
pushq $0x4
popq %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9b97(%rip), %rdi      # 0xd464
pushq $0x1
popq %r14
pushq $0x4
popq %r15
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9b7e(%rip), %rdi      # 0xd468
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9b6d(%rip), %rdi      # 0xd46c
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
cmpl $0x65, %r12d
jb 0x3928
leaq 0x9b56(%rip), %rdi      # 0xd470
pushq $0x1
popq %rsi
pushq $0x4
popq %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9b45(%rip), %rdi      # 0xd474
pushq $0x1
popq %r14
pushq $0x4
popq %r15
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9b2c(%rip), %rdi      # 0xd478
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9b1b(%rip), %rdi      # 0xd47c
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9b0a(%rip), %rdi      # 0xd480
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9af9(%rip), %rdi      # 0xd484
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9ae8(%rip), %rdi      # 0xd488
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9ad7(%rip), %rdi      # 0xd48c
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9ac6(%rip), %rdi      # 0xd490
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9ab5(%rip), %rdi      # 0xd494
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9aa4(%rip), %rdi      # 0xd498
movq %r14, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9a93(%rip), %rdi      # 0xd49c
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9a82(%rip), %rdi      # 0xd4a0
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9a71(%rip), %rdi      # 0xd4a4
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9a60(%rip), %rdi      # 0xd4a8
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9a4f(%rip), %rdi      # 0xd4ac
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9a3e(%rip), %rdi      # 0xd4b0
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9a2d(%rip), %rdi      # 0xd4b4
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x9a1c(%rip), %rdi      # 0xd4b8
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
cmpl $0x65, %r12d
jb 0x3ae2
leaq 0x9a05(%rip), %rdi      # 0xd4bc
pushq $0x1
popq %r14
pushq $0x4
popq %r15
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
leaq 0x99ec(%rip), %rdi      # 0xd4c0
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3400
movq %rbx, %rdi
callq 0x32b0
jmp 0x3aee
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq