#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 */
void *SCE_Encode_Read(unsigned char const **, int *, unsigned char);
float SCE_Encode_SetFloatData(unsigned int, int, float);
float SCE_Decode_Float(const unsigned char **field, int se, unsigned char ne,
                       unsigned char nm, int *offset) {
  unsigned int s;
  int e;
  unsigned long m;
  float fm;
  s = SCE_Encode_Read(field, offset, 1);
  e = SCE_Encode_Read(field, offset, ne);
  m = SCE_Encode_Read(field, offset, nm);
  fm = (float)m / (float)(1 << (nm - 1));
  if (se)
    e -= (1 << (ne - 1)) / 2;
  return SCE_Encode_SetFloatData(s, e, fm);
}


x86 assembly (clang, -O0):
<SCE_Decode_Float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %cl,-0xd(%rbp)
mov    %al,-0xe(%rbp)
mov    %r8,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x1,%edx
call   1030 <SCE_Encode_Read@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movzbl -0xd(%rbp),%edx
call   1030 <SCE_Encode_Read@plt>
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movzbl -0xe(%rbp),%edx
call   1030 <SCE_Encode_Read@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x34(%rbp)
test   %rax,%rax
movss  %xmm0,-0x30(%rbp)
js     11b8 <SCE_Decode_Float+0x98>
movss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x30(%rbp),%xmm0
movzbl -0xe(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1202 <SCE_Decode_Float+0xe2>
movzbl -0xd(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
movss  -0x2c(%rbp),%xmm0
call   1040 <SCE_Encode_SetFloatData@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SCE_Decode_Float>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,%rbx
mov    %ecx,%r12d
mov    %edx,%ebp
mov    %esi,0xc(%rsp)
mov    %rdi,%r14
mov    $0x1,%r15d
mov    %r8,%rsi
mov    $0x1,%edx
call   1030 <SCE_Encode_Read@plt>
mov    %rax,0x10(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <SCE_Encode_Read@plt>
mov    %rax,%r13
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r12d,%edx
call   1030 <SCE_Encode_Read@plt>
cmpl   $0x0,0xc(%rsp)
je     1191 <SCE_Decode_Float+0x71>
add    $0xff,%bpl
mov    %ebp,%ecx
shl    %cl,%r15d
mov    %r15d,%ecx
shr    $0x1f,%ecx
add    %r15d,%ecx
sar    %ecx
sub    %ecx,%r13d
test   %rax,%rax
js     119d <SCE_Decode_Float+0x7d>
cvtsi2ss %rax,%xmm0
jmp    11b2 <SCE_Decode_Float+0x92>
mov    %rax,%rcx
shr    %rcx
and    $0x1,%eax
or     %rcx,%rax
cvtsi2ss %rax,%xmm0
addss  %xmm0,%xmm0
add    $0xff,%r12b
mov    $0x1,%eax
mov    %r12d,%ecx
shl    %cl,%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
mov    0x10(%rsp),%rdi
mov    %r13d,%esi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <SCE_Encode_SetFloatData@plt>

LLVM IR (-O0):
define float @SCE_Decode_Float(i8** %0, i32 %1, i8 zeroext %2, i8 zeroext %3, i32* %4) {
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i64
%14 = alloca float
store i8** %0, i8*** %6
store i32 %1, i32* %7
store i8 %2, i8* %8
store i8 %3, i8* %9
store i32* %4, i32** %10
%15 = load i8**, i8*** %6
%16 = load i32*, i32** %10
%17 = call i8* @SCE_Encode_Read(i8** %15, i32* %16, i8 zeroext 1)
%18 = ptrtoint i8* %17 to i32
store i32 %18, i32* %11
%19 = load i8**, i8*** %6
%20 = load i32*, i32** %10
%21 = load i8, i8* %8
%22 = call i8* @SCE_Encode_Read(i8** %19, i32* %20, i8 zeroext %21)
%23 = ptrtoint i8* %22 to i32
store i32 %23, i32* %12
%24 = load i8**, i8*** %6
%25 = load i32*, i32** %10
%26 = load i8, i8* %9
%27 = call i8* @SCE_Encode_Read(i8** %24, i32* %25, i8 zeroext %26)
%28 = ptrtoint i8* %27 to i64
store i64 %28, i64* %13
%29 = load i64, i64* %13
%30 = uitofp i64 %29 to float
%31 = load i8, i8* %9
%32 = zext i8 %31 to i32
%33 = sub nsw i32 %32, 1
%34 = shl i32 1, %33
%35 = sitofp i32 %34 to float
%36 = fdiv float %30, %35
store float %36, float* %14
%37 = load i32, i32* %7
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %47
39: ; preds = %5
%40 = load i8, i8* %8
%41 = zext i8 %40 to i32
%42 = sub nsw i32 %41, 1
%43 = shl i32 1, %42
%44 = sdiv i32 %43, 2
%45 = load i32, i32* %12
%46 = sub nsw i32 %45, %44
store i32 %46, i32* %12
br label %47
47: ; preds = %39, %5
%48 = load i32, i32* %11
%49 = load i32, i32* %12
%50 = load float, float* %14
%51 = call float @SCE_Encode_SetFloatData(i32 %48, i32 %49, float %50)
ret float %51
}

LLVM IR (-O2):
define float @SCE_Decode_Float(i8** %0, i32 %1, i8 zeroext %2, i8 zeroext %3, i32* %4) {
%6 = tail call i8* @SCE_Encode_Read(i8** %0, i32* %4, i8 zeroext 1)
%7 = tail call i8* @SCE_Encode_Read(i8** %0, i32* %4, i8 zeroext %2)
%8 = ptrtoint i8* %7 to i64
%9 = trunc i64 %8 to i32
%10 = tail call i8* @SCE_Encode_Read(i8** %0, i32* %4, i8 zeroext %3)
%11 = icmp eq i32 %1, 0
br i1 %11, label %18, label %12
12: ; preds = %5
%13 = zext i8 %2 to i32
%14 = add nsw i32 %13, -1
%15 = shl nuw i32 1, %14
%16 = sdiv i32 %15, -2
%17 = add i32 %16, %9
br label %18
18: ; preds = %12, %5
%19 = phi i32 [ %17, %12 ], [ %9, %5 ]
%20 = ptrtoint i8* %10 to i64
%21 = uitofp i64 %20 to float
%22 = zext i8 %3 to i32
%23 = add nsw i32 %22, -1
%24 = shl nuw i32 1, %23
%25 = sitofp i32 %24 to float
%26 = fdiv float %21, %25
%27 = ptrtoint i8* %6 to i64
%28 = trunc i64 %27 to i32
%29 = tail call float @SCE_Encode_SetFloatData(i32 %28, i32 %19, float %26)
ret float %29
}