#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*/ normalizeFloat(int *, int *);
float packFloat(int, int);
int /*<<< orphan*/ unpackFloat(float, int *, int *);
float fProd(float a, float b) {
  int aExp, aMag;
  int bExp, bMag;
  unpackFloat(a, &aExp, &aMag);
  unpackFloat(b, &bExp, &bMag);
  long lcMag = (long)aMag * (long)bMag;
  lcMag >>= 23;
  int icMag = (int)lcMag;
  int cExp = aExp + bExp;
  normalizeFloat(&cExp, &icMag);
  return packFloat(cExp, icMag);
}


x86 assembly (clang, -O0):
<fProd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <unpackFloat@plt>
movss  -0x8(%rbp),%xmm0
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <unpackFloat@plt>
movslq -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
sar    $0x17,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
lea    -0x28(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   1040 <normalizeFloat@plt>
mov    -0x28(%rbp),%edi
mov    -0x24(%rbp),%esi
call   1030 <packFloat@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fProd>:
sub    $0x28,%rsp
movss  %xmm1,0x14(%rsp)
lea    0x24(%rsp),%rdi
lea    0x20(%rsp),%rsi
call   1050 <unpackFloat@plt>
lea    0x1c(%rsp),%rdi
lea    0x18(%rsp),%rsi
movss  0x14(%rsp),%xmm0
call   1050 <unpackFloat@plt>
movslq 0x20(%rsp),%rax
movslq 0x18(%rsp),%rcx
imul   %rax,%rcx
shr    $0x17,%rcx
mov    %ecx,0x10(%rsp)
mov    0x1c(%rsp),%eax
add    0x24(%rsp),%eax
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1040 <normalizeFloat@plt>
mov    0xc(%rsp),%edi
mov    0x10(%rsp),%esi
call   1030 <packFloat@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @fProd(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
store float %0, float* %3
store float %1, float* %4
%12 = load float, float* %3
%13 = call i32 @unpackFloat(float %12, i32* %5, i32* %6)
%14 = load float, float* %4
%15 = call i32 @unpackFloat(float %14, i32* %7, i32* %8)
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = mul nsw i64 %17, %19
store i64 %20, i64* %9
%21 = load i64, i64* %9
%22 = ashr i64 %21, 23
store i64 %22, i64* %9
%23 = load i64, i64* %9
%24 = trunc i64 %23 to i32
store i32 %24, i32* %10
%25 = load i32, i32* %5
%26 = load i32, i32* %7
%27 = add nsw i32 %25, %26
store i32 %27, i32* %11
%28 = call i32 @normalizeFloat(i32* %11, i32* %10)
%29 = load i32, i32* %11
%30 = load i32, i32* %10
%31 = call float @packFloat(i32 %29, i32 %30)
ret float %31
}

LLVM IR (-O2):
define float @fProd(float %0, float %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = call i32 @unpackFloat(float %0, i32* %3, i32* %4)
%14 = call i32 @unpackFloat(float %1, i32* %5, i32* %6)
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = mul nsw i64 %18, %16
%20 = lshr i64 %19, 23
%21 = bitcast i32* %7 to i8*
%22 = trunc i64 %20 to i32
store i32 %22, i32* %7
%23 = bitcast i32* %8 to i8*
%24 = load i32, i32* %3
%25 = load i32, i32* %5
%26 = add nsw i32 %25, %24
store i32 %26, i32* %8
%27 = call i32 @normalizeFloat(i32* %8, i32* %7)
%28 = load i32, i32* %8
%29 = load i32, i32* %7
%30 = call float @packFloat(i32 %28, i32 %29)
ret float %30
}