// File: /workspace/github_cpp_makefile_star2_O1/Juve45[P]batstat/main.cpp
// Function: getBatteryInfo()
BatteryStatus getBatteryInfo() {
	float currentPower, currentEnergy;
	if(checkfile(powerPath + "_now")) { // Unit is Watts
		ifstream powNow(powerPath + "_now");
		ifstream enNow(energyPath + "_now");
		powNow >> currentPower;
		enNow >> currentEnergy;
	} else { 
			ifstream currNow(currentPath + "_now");
			ifstream chgNow(chargePath + "_now");
			
			currNow >> currentPower;
			chgNow >> currentEnergy;
		/*if(checkfile(voltagePath + "_now")) { // Unit is Watts
			float voltage;
			ifstream volNow(voltagePath + "_now");
			volNow >> voltage;
			if(voltage == 0) voltage = 1;
			currentPower *= voltage / 1000000;
			currentEnergy *= voltage / 1000000;
		} else { // Unit is Amps, no voltage to be subtracted 
		}*/
		// TODO: fix voltage bug -> create class which handles energy and power readings 
		// in every scenario.
	} 
	return BatteryStatus(currentPower, currentEnergy);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x440, %rsp            # imm = 0x440
leaq -0x438(%rbp), %r14
movq %r14, -0x10(%r14)
movq 0x167d1(%rip), %rsi     # 0x1a3e8
movq 0x167d2(%rip), %rdx     # 0x1a3f0
addq %rsi, %rdx
leaq -0x448(%rbp), %rbx
movq %rbx, %rdi
callq 0x518a
leaq 0xd9fb(%rip), %rsi      # 0x11632
movq %rbx, %rdi
callq 0x3560
movq -0x448(%rbp), %rdi
leaq 0xe8a4(%rip), %rsi      # 0x124f1
callq 0x33b0
movq %rax, %rbx
testq %rax, %rax
je 0x3c62
movq %rbx, %rdi
callq 0x3310
movq -0x448(%rbp), %rdi
cmpq %r14, %rdi
je 0x3c73
callq 0x32f0
leaq -0x230(%rbp), %r14
testq %rbx, %rbx
je 0x3d59
movq %r14, -0x10(%r14)
movq 0x1675a(%rip), %rsi     # 0x1a3e8
movq 0x1675b(%rip), %rdx     # 0x1a3f0
addq %rsi, %rdx
leaq -0x240(%rbp), %rbx
movq %rbx, %rdi
callq 0x518a
leaq 0xd984(%rip), %rsi      # 0x11632
movq %rbx, %rdi
callq 0x3560
leaq -0x448(%rbp), %rdi
leaq -0x240(%rbp), %rsi
movl $0x8, %edx
callq 0x34a0
movq -0x240(%rbp), %rdi
cmpq %r14, %rdi
je 0x3cdf
callq 0x32f0
leaq -0x28(%rbp), %r14
movq %r14, -0x10(%r14)
movq 0x166da(%rip), %rsi     # 0x1a3c8
movq 0x166db(%rip), %rdx     # 0x1a3d0
addq %rsi, %rdx
leaq -0x38(%rbp), %rdi
callq 0x518a
leaq 0xd92a(%rip), %rsi      # 0x11632
leaq -0x38(%rbp), %rdi
callq 0x3560
leaq -0x240(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movl $0x8, %edx
callq 0x34a0
movq -0x38(%rbp), %rdi
cmpq %r14, %rdi
je 0x3d34
callq 0x32f0
leaq -0x448(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x3590
leaq -0x240(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x3590
jmp 0x3e2a
movq %r14, -0x10(%r14)
movq 0x166e4(%rip), %rsi     # 0x1a448
movq 0x166e5(%rip), %rdx     # 0x1a450
addq %rsi, %rdx
leaq -0x240(%rbp), %rbx
movq %rbx, %rdi
callq 0x518a
leaq 0xd8ae(%rip), %rsi      # 0x11632
movq %rbx, %rdi
callq 0x3560
leaq -0x448(%rbp), %rdi
leaq -0x240(%rbp), %rsi
movl $0x8, %edx
callq 0x34a0
movq -0x240(%rbp), %rdi
cmpq %r14, %rdi
je 0x3db5
callq 0x32f0
leaq -0x28(%rbp), %r14
movq %r14, -0x10(%r14)
movq 0x16644(%rip), %rsi     # 0x1a408
movq 0x16645(%rip), %rdx     # 0x1a410
addq %rsi, %rdx
leaq -0x38(%rbp), %rdi
callq 0x518a
leaq 0xd854(%rip), %rsi      # 0x11632
leaq -0x38(%rbp), %rdi
callq 0x3560
leaq -0x240(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movl $0x8, %edx
callq 0x34a0
movq -0x38(%rbp), %rdi
cmpq %r14, %rdi
je 0x3e0a
callq 0x32f0
leaq -0x448(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x3590
leaq -0x240(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x3590
leaq -0x240(%rbp), %rdi
callq 0x30c0
leaq -0x448(%rbp), %rdi
callq 0x30c0
movss -0x14(%rbp), %xmm1
movss -0x18(%rbp), %xmm0
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
addq $0x440, %rsp            # imm = 0x440
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x3e67
jmp 0x3e67
jmp 0x3e7a
jmp 0x3e81
jmp 0x3e81
jmp 0x3e67
movq %rax, %rbx
movq -0x38(%rbp), %rdi
cmpq %r14, %rdi
je 0x3eb4
callq 0x32f0
jmp 0x3eb4
movq %rax, %rbx
jmp 0x3eb4
jmp 0x3e81
movq %rax, %rbx
movq -0x240(%rbp), %rdi
jmp 0x3e99
jmp 0x3ea5
movq %rax, %rbx
movq -0x448(%rbp), %rdi
cmpq %r14, %rdi
je 0x3ec0
callq 0x32f0
jmp 0x3ec0
movq %rax, %rbx
leaq -0x240(%rbp), %rdi
callq 0x30c0
leaq -0x448(%rbp), %rdi
callq 0x30c0
movq %rbx, %rdi
callq 0x3530