#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 */
unsigned int get16(unsigned char *);
int /*<<< orphan*/ lprintf(int, char *, float, float);
int decode_rivergauge(unsigned char *element, int element_len) {
  unsigned int flow;
  unsigned int height;
  float flowm;
  float heightm;
  flow = get16(element);
  height = get16(element + 2);
  flowm = (float)flow / 64;
  heightm = (float)height / 100;
  lprintf(14, "River flow rate: %f Cu M/Sec  Height: %f M\r\n", flowm, heightm);
  return 0;
}


x86 assembly (clang, -O0):
<decode_rivergauge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <get16@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x2,%rdi
call   1030 <get16@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cvtsi2ss %rax,%xmm0
movss  0xea9(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cvtsi2ss %rax,%xmm0
movss  0xe8c(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
mov    $0xe,%edi
lea    0xe75(%rip),%rsi
call   1040 <lprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_rivergauge>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <get16@plt>
mov    %eax,%ebp
add    $0x2,%rbx
mov    %rbx,%rdi
call   1030 <get16@plt>
mov    %ebp,%ecx
cvtsi2ss %rcx,%xmm0
mov    %eax,%eax
cvtsi2ss %rax,%xmm1
mulss  0xeb1(%rip),%xmm0
divss  0xead(%rip),%xmm1
lea    0xeaa(%rip),%rsi
mov    $0xe,%edi
call   1040 <lprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [45 x i8] c"River flow rate: %f Cu M/Sec Height: %f M\0D\0A\00"
define i32 @decode_rivergauge(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca float
store i8* %0, i8** %3
store i32 %1, i32* %4
%9 = load i8*, i8** %3
%10 = call i32 @get16(i8* %9)
store i32 %10, i32* %5
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 2
%13 = call i32 @get16(i8* %12)
store i32 %13, i32* %6
%14 = load i32, i32* %5
%15 = uitofp i32 %14 to float
%16 = fdiv float %15, 6.400000e+01
store float %16, float* %7
%17 = load i32, i32* %6
%18 = uitofp i32 %17 to float
%19 = fdiv float %18, 1.000000e+02
store float %19, float* %8
%20 = load float, float* %7
%21 = load float, float* %8
%22 = call i32 @lprintf(i32 14, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), float %20, float %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"River flow rate: %f Cu M/Sec Height: %f M\0D\0A\00"
define i32 @decode_rivergauge(i8* %0, i32 %1) {
%3 = tail call i32 @get16(i8* %0)
%4 = getelementptr inbounds i8, i8* %0, i64 2
%5 = tail call i32 @get16(i8* %4)
%6 = uitofp i32 %3 to float
%7 = fmul float %6, 1.562500e-02
%8 = uitofp i32 %5 to float
%9 = fdiv float %8, 1.000000e+02
%10 = tail call i32 @lprintf(i32 14, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), float %7, float %9)
ret i32 0
}