// File: Juve45[P]batstat/main.cpp
// Function: load_config()
void load_config() {

	string configfile = CONFIG;
	if(checkfile(LOCAL_CONFIG)) 
		configfile = LOCAL_CONFIG;

	cout << configfile << endl;
	ifstream jsonf(configfile);
	json config = json::parse(jsonf, nullptr, true, true);

	if(config["refresh_rate"].is_number() && 1 <= config["refresh_rate"] && config["refresh_rate"] <= 120) 
		refreshRate = config["refresh_rate"];

	if(config["log_rate"].is_number() && 1 <= config["log_rate"] && config["log_rate"] <= 120)
		LOG_P = config["log_rate"];

	if(config["power_supply_path"].is_string())
		PATH = config["power_supply_path"];

	timeElapsed = -refreshRate;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
leaq 0x374ee(%rip), %rsi     # 0x3c3a0
leaq -0x20(%rbp), %rdi
callq 0x41a0
leaq 0x374fe(%rip), %rdi     # 0x3c3c0
callq 0x6190
movb %al, -0x289(%rbp)
jmp 0x4ecf
movb -0x289(%rbp), %al
testb $0x1, %al
jne 0x4edb
jmp 0x4f00
leaq 0x374de(%rip), %rsi     # 0x3c3c0
leaq -0x20(%rbp), %rdi
callq 0x4040
jmp 0x4eed
jmp 0x4f00
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x5234
movq 0x370c9(%rip), %rdi     # 0x3bfd0
leaq -0x20(%rbp), %rsi
callq 0x4350
movq %rax, -0x298(%rbp)
jmp 0x4f19
movq -0x298(%rbp), %rdi
movq 0x37079(%rip), %rsi     # 0x3bfa0
callq 0x43f0
jmp 0x4f2e
leaq -0x238(%rbp), %rdi
leaq -0x20(%rbp), %rsi
movl $0x8, %edx
callq 0x4580
jmp 0x4f45
xorl %eax, %eax
movl %eax, %esi
leaq -0x268(%rbp), %rdi
movq %rdi, -0x2a0(%rbp)
callq 0x6430
movq -0x2a0(%rbp), %rdx
leaq -0x248(%rbp), %rdi
leaq -0x238(%rbp), %rsi
movl $0x1, %r8d
movl %r8d, %ecx
callq 0x6290
jmp 0x4f81
leaq -0x268(%rbp), %rdi
callq 0x6470
leaq 0x22c23(%rip), %rsi     # 0x27bb7
leaq -0x248(%rbp), %rdi
callq 0x6490
movq %rax, -0x2a8(%rbp)
jmp 0x4fa9
movq -0x2a8(%rbp), %rdi
callq 0x6540
testb $0x1, %al
jne 0x4fbe
jmp 0x509f
leaq 0x22bf2(%rip), %rsi     # 0x27bb7
leaq -0x248(%rbp), %rdi
callq 0x6490
movq %rax, -0x2b0(%rbp)
jmp 0x4fda
movq -0x2b0(%rbp), %rsi
movl $0x1, %edi
callq 0x6580
testb $0x1, %al
jne 0x4ff4
jmp 0x509f
leaq 0x22bbc(%rip), %rsi     # 0x27bb7
leaq -0x248(%rbp), %rdi
callq 0x6490
movq %rax, -0x2b8(%rbp)
jmp 0x5010
movq -0x2b8(%rbp), %rdi
movl $0x78, %esi
callq 0x65c0
testb $0x1, %al
jne 0x5027
jmp 0x509f
leaq 0x22b89(%rip), %rsi     # 0x27bb7
leaq -0x248(%rbp), %rdi
callq 0x6490
movq %rax, -0x2c0(%rbp)
jmp 0x5043
movq -0x2c0(%rbp), %rdi
callq 0x6610
movl %eax, -0x2c4(%rbp)
jmp 0x5057
movl -0x2c4(%rbp), %eax
movl %eax, 0x372fd(%rip)     # 0x3c360
jmp 0x509f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x6470
jmp 0x5228
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x6680
jmp 0x5228
leaq 0x22b1e(%rip), %rsi     # 0x27bc4
leaq -0x248(%rbp), %rdi
callq 0x6490
movq %rax, -0x2d0(%rbp)
jmp 0x50bb
movq -0x2d0(%rbp), %rdi
callq 0x6540
testb $0x1, %al
jne 0x50d0
jmp 0x5172
leaq 0x22aed(%rip), %rsi     # 0x27bc4
leaq -0x248(%rbp), %rdi
callq 0x6490
movq %rax, -0x2d8(%rbp)
jmp 0x50ec
movq -0x2d8(%rbp), %rsi
movl $0x1, %edi
callq 0x6580
testb $0x1, %al
jne 0x5103
jmp 0x5172
leaq 0x22aba(%rip), %rsi     # 0x27bc4
leaq -0x248(%rbp), %rdi
callq 0x6490
movq %rax, -0x2e0(%rbp)
jmp 0x511f
movq -0x2e0(%rbp), %rdi
movl $0x78, %esi
callq 0x65c0
testb $0x1, %al
jne 0x5136
jmp 0x5172
leaq 0x22a87(%rip), %rsi     # 0x27bc4
leaq -0x248(%rbp), %rdi
callq 0x6490
movq %rax, -0x2e8(%rbp)
jmp 0x5152
movq -0x2e8(%rbp), %rdi
callq 0x6610
movl %eax, -0x2ec(%rbp)
jmp 0x5166
movl -0x2ec(%rbp), %eax
movl %eax, 0x371f2(%rip)     # 0x3c364
leaq 0x22a54(%rip), %rsi     # 0x27bcd
leaq -0x248(%rbp), %rdi
callq 0x6490
movq %rax, -0x2f8(%rbp)
jmp 0x518e
movq -0x2f8(%rbp), %rdi
callq 0x6630
testb $0x1, %al
jne 0x51a0
jmp 0x51f0
leaq 0x22a26(%rip), %rsi     # 0x27bcd
leaq -0x248(%rbp), %rdi
callq 0x6490
movq %rax, -0x300(%rbp)
jmp 0x51bc
movq -0x300(%rbp), %rsi
leaq -0x288(%rbp), %rdi
callq 0x6650
jmp 0x51d1
leaq 0x371a8(%rip), %rdi     # 0x3c380
leaq -0x288(%rbp), %rsi
callq 0x4460
leaq -0x288(%rbp), %rdi
callq 0x46a8
xorl %eax, %eax
subl 0x37168(%rip), %eax     # 0x3c360
movl %eax, 0x371fe(%rip)     # 0x3c3fc
leaq -0x248(%rbp), %rdi
callq 0x6680
leaq -0x238(%rbp), %rdi
callq 0x40f0
leaq -0x20(%rbp), %rdi
callq 0x46a8
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
leaq -0x238(%rbp), %rdi
callq 0x40f0
leaq -0x20(%rbp), %rdi
callq 0x46a8
movq -0x28(%rbp), %rdi
callq 0x4630
nopw %cs:(%rax,%rax)