#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*/ get_bits(unsigned char const *, int *, unsigned int, int);
double pow(double, double);
double ibm2real(const unsigned char *buf, unsigned int off) {
  int s;
  int e;
  int b;
  get_bits(buf, &s, off + 0, 1);
  get_bits(buf, &e, off + 1, 7);
  get_bits(buf, &b, off + 8, 24);
  return pow(2.0, -24.0) * (double)(s ? -b : b) * pow(16.0, (double)e - 64);
}


x86 assembly (clang, -O0):
<ibm2real>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
add    $0x0,%edx
lea    -0x10(%rbp),%rsi
mov    $0x1,%ecx
call   1040 <get_bits@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
add    $0x1,%edx
lea    -0x14(%rbp),%rsi
mov    $0x7,%ecx
call   1040 <get_bits@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
add    $0x8,%edx
lea    -0x18(%rbp),%rsi
mov    $0x18,%ecx
call   1040 <get_bits@plt>
movsd  0xe81(%rip),%xmm0
movsd  0xe81(%rip),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x20(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11a8 <ibm2real+0x88>
xor    %eax,%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    11ae <ibm2real+0x8e>
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x24(%rbp),%eax
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xe48(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe34(%rip),%xmm0
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ibm2real>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebx
mov    %rdi,%r14
lea    0xc(%rsp),%rsi
mov    %ebx,%edx
mov    $0x1,%ecx
call   1040 <get_bits@plt>
lea    0x1(%rbx),%edx
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
mov    $0x7,%ecx
call   1040 <get_bits@plt>
add    $0x8,%ebx
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
mov    %ebx,%edx
mov    $0x18,%ecx
call   1040 <get_bits@plt>
mov    0x4(%rsp),%eax
mov    %eax,%ecx
neg    %ecx
cmpl   $0x0,0xc(%rsp)
cmove  %eax,%ecx
cvtsi2sd %ecx,%xmm0
mulsd  0xe7b(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdl 0x8(%rsp),%xmm0
addsd  0xe6c(%rip),%xmm0
mulsd  0xe6c(%rip),%xmm0
call   1030 <exp2@plt>
mulsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @ibm2real(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = add i32 %9, 0
%11 = call i32 @get_bits(i8* %8, i32* %5, i32 %10, i32 1)
%12 = load i8*, i8** %3
%13 = load i32, i32* %4
%14 = add i32 %13, 1
%15 = call i32 @get_bits(i8* %12, i32* %6, i32 %14, i32 7)
%16 = load i8*, i8** %3
%17 = load i32, i32* %4
%18 = add i32 %17, 8
%19 = call i32 @get_bits(i8* %16, i32* %7, i32 %18, i32 24)
%20 = call double @pow(double 2.000000e+00, double -2.400000e+01)
%21 = load i32, i32* %5
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %2
%24 = load i32, i32* %7
%25 = sub nsw i32 0, %24
br label %28
26: ; preds = %2
%27 = load i32, i32* %7
br label %28
28: ; preds = %26, %23
%29 = phi i32 [ %25, %23 ], [ %27, %26 ]
%30 = sitofp i32 %29 to double
%31 = fmul double %20, %30
%32 = load i32, i32* %6
%33 = sitofp i32 %32 to double
%34 = fsub double %33, 6.400000e+01
%35 = call double @pow(double 1.600000e+01, double %34)
%36 = fmul double %31, %35
ret double %36
}

LLVM IR (-O2):
define double @ibm2real(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = call i32 @get_bits(i8* %0, i32* %3, i32 %1, i32 1)
%10 = add i32 %1, 1
%11 = call i32 @get_bits(i8* %0, i32* %4, i32 %10, i32 7)
%12 = add i32 %1, 8
%13 = call i32 @get_bits(i8* %0, i32* %5, i32 %12, i32 24)
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 0
%16 = load i32, i32* %5
%17 = sub nsw i32 0, %16
%18 = select i1 %15, i32 %16, i32 %17
%19 = sitofp i32 %18 to double
%20 = fmul double %19, 0x3E70000000000000
%21 = load i32, i32* %4
%22 = sitofp i32 %21 to double
%23 = fadd double %22, -6.400000e+01
%24 = fmul double %23, 4.000000e+00
%25 = call double @exp2(double %24)
%26 = fmul double %25, %20
ret double %26
}