#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, unsigned char);
int /*<<< orphan*/ sscanf(char *, char *, unsigned int *);
float getBalance(unsigned char zonedata[16]) {
  char x100[2], x1[2], xp01[2];
  sprintf(x100, "%x", *(zonedata + 0x04));
  sprintf(x1, "%x", *(zonedata + 0x05));
  sprintf(xp01, "%x", *(zonedata + 0x06));
  unsigned int i100, i1, ip01;
  sscanf(x100, "%d", &i100);
  sscanf(x1, "%d", &i1);
  sscanf(xp01, "%d", &ip01);
  return i100 * 100 + i1 + ip01 * 0.01;
}


x86 assembly (clang, -O0):
<getBalance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x4(%rax),%edx
lea    0xecd(%rip),%rsi
mov    %rsi,-0x48(%rbp)
lea    -0xa(%rbp),%rdi
mov    %rdi,-0x40(%rbp)
call   1040 <sprintf@plt>
mov    -0x48(%rbp),%rsi
mov    -0x8(%rbp),%rax
movzbl 0x5(%rax),%edx
lea    -0xc(%rbp),%rdi
mov    %rdi,-0x38(%rbp)
call   1040 <sprintf@plt>
mov    -0x48(%rbp),%rsi
mov    -0x8(%rbp),%rax
movzbl 0x6(%rax),%edx
lea    -0xe(%rbp),%rdi
mov    %rdi,-0x30(%rbp)
call   1040 <sprintf@plt>
mov    -0x40(%rbp),%rdi
lea    0xe82(%rip),%rsi
mov    %rsi,-0x28(%rbp)
lea    -0x14(%rbp),%rdx
call   1030 <sscanf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <sscanf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1030 <sscanf@plt>
mov    -0x14(%rbp),%eax
imul   $0x64,%eax,%eax
mov    -0x18(%rbp),%ecx
add    %ecx,%eax
cvtsi2sd %rax,%xmm1
mov    -0x1c(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  0xe28(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getBalance>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
movzbl 0x4(%rdi),%edx
lea    0xecd(%rip),%r14
lea    0x1e(%rsp),%r15
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <sprintf@plt>
movzbl 0x5(%rbx),%edx
lea    0x1c(%rsp),%r12
mov    %r12,%rdi
mov    %r14,%rsi
call   1040 <sprintf@plt>
movzbl 0x6(%rbx),%edx
lea    0x1a(%rsp),%r13
mov    %r13,%rdi
mov    %r14,%rsi
call   1040 <sprintf@plt>
lea    0xe91(%rip),%rbx
lea    0x14(%rsp),%rdx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <sscanf@plt>
lea    0x10(%rsp),%rdx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <sscanf@plt>
lea    0xc(%rsp),%rdx
mov    %r13,%rdi
mov    %rbx,%rsi
call   1030 <sscanf@plt>
imul   $0x64,0x14(%rsp),%eax
add    0x10(%rsp),%eax
cvtsi2sd %rax,%xmm0
mov    0xc(%rsp),%eax
cvtsi2sd %rax,%xmm1
mulsd  0xe37(%rip),%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%x\00"
@.str.1 = [3 x i8] c"%d\00"
define float @getBalance(i8* %0) {
%2 = alloca i8*
%3 = alloca [2 x i8]
%4 = alloca [2 x i8]
%5 = alloca [2 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %2
%9 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 4
%12 = load i8, i8* %11
%13 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 zeroext %12)
%14 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 5
%17 = load i8, i8* %16
%18 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 zeroext %17)
%19 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i64 6
%22 = load i8, i8* %21
%23 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 zeroext %22)
%24 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%25 = call i32 @sscanf(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%26 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%27 = call i32 @sscanf(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%28 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%29 = call i32 @sscanf(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%30 = load i32, i32* %6
%31 = mul i32 %30, 100
%32 = load i32, i32* %7
%33 = add i32 %31, %32
%34 = uitofp i32 %33 to double
%35 = load i32, i32* %8
%36 = uitofp i32 %35 to double
%37 = call double @llvm.fmuladd.f64(double %36, double 1.000000e-02, double %34)
%38 = fptrunc double %37 to float
ret float %38
}

LLVM IR (-O2):
@.str = [3 x i8] c"%x\00"
@.str.1 = [3 x i8] c"%d\00"
define float @getBalance(i8* nocapture %0) {
%2 = alloca [2 x i8]
%3 = alloca [2 x i8]
%4 = alloca [2 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds i8, i8* %0, i64 4
%12 = load i8, i8* %11
%13 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 zeroext %12)
%14 = getelementptr inbounds i8, i8* %0, i64 5
%15 = load i8, i8* %14
%16 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 zeroext %15)
%17 = getelementptr inbounds i8, i8* %0, i64 6
%18 = load i8, i8* %17
%19 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 zeroext %18)
%20 = bitcast i32* %5 to i8*
%21 = bitcast i32* %6 to i8*
%22 = bitcast i32* %7 to i8*
%23 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%24 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%25 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%26 = load i32, i32* %5
%27 = mul i32 %26, 100
%28 = load i32, i32* %6
%29 = add i32 %27, %28
%30 = uitofp i32 %29 to double
%31 = load i32, i32* %7
%32 = uitofp i32 %31 to double
%33 = call double @llvm.fmuladd.f64(double %32, double 1.000000e-02, double %30)
%34 = fptrunc double %33 to float
ret float %34
}