#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 */
typedef int uint_fast8_t;
typedef int uint32_t;
typedef int int32_t;

/* Variables and functions */
scalar_t__ softfloat_countLeadingZeros32(int);
int /*<<< orphan*/ softfloat_shiftLeftM(int, int const *, int, int *);
int /*<<< orphan*/ softfloat_shortShiftLeftM(int, int const *, int, int *);
int softfloat_shiftNormSigF128M(const uint32_t *wPtr, uint_fast8_t shiftDist,
                                uint32_t *sigPtr) {
  uint32_t wordSig;
  int32_t exp;
  uint32_t leadingBit;
  wordSig = wPtr[0];
  exp = ((int32_t)((wordSig) >> 16) & 0x7FFF);
  if (exp) {
    softfloat_shortShiftLeftM(4, wPtr, shiftDist, sigPtr);
    leadingBit = 0x00010000 << shiftDist;
    sigPtr[0] = (sigPtr[0] & (leadingBit - 1)) | leadingBit;
  } else {
    exp = 16;
    wordSig &= 0x7FFFFFFF;
    if (!wordSig) {
      exp = -16;
      wordSig = wPtr[((4) - 1 - (2))];
      if (!wordSig) {
        exp = -48;
        wordSig = wPtr[((4) - 1 - (1))];
        if (!wordSig) {
          wordSig = wPtr[((4) - 1 - (0))];
          if (!wordSig)
            return -128;
          exp = -80;
        }
      }
    }
    exp -= softfloat_countLeadingZeros32(wordSig);
    softfloat_shiftLeftM(4, wPtr, 1 - exp + shiftDist, sigPtr);
  }
  return exp;
}


x86 assembly (clang, -O0):
<softfloat_shiftNormSigF128M>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
sar    $0x10,%eax
and    $0x7fff,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     11a2 <softfloat_shiftNormSigF128M+0x72>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    $0x4,%edi
call   1040 <softfloat_shortShiftLeftM@plt>
mov    -0x14(%rbp),%ecx
mov    $0x10000,%eax
shl    %cl,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
and    %eax,%ecx
or     -0x2c(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    1257 <softfloat_shiftNormSigF128M+0x127>
movl   $0x10,-0x28(%rbp)
mov    -0x24(%rbp),%eax
and    $0x7fffffff,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1225 <softfloat_shiftNormSigF128M+0xf5>
movl   $0xfffffff0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1220 <softfloat_shiftNormSigF128M+0xf0>
movl   $0xffffffd0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    121b <softfloat_shiftNormSigF128M+0xeb>
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1214 <softfloat_shiftNormSigF128M+0xe4>
movl   $0xffffff80,-0x4(%rbp)
jmp    125d <softfloat_shiftNormSigF128M+0x12d>
movl   $0xffffffb0,-0x28(%rbp)
jmp    1220 <softfloat_shiftNormSigF128M+0xf0>
jmp    1225 <softfloat_shiftNormSigF128M+0xf5>
mov    -0x24(%rbp),%edi
call   1050 <softfloat_countLeadingZeros32@plt>
mov    %rax,%rcx
movslq -0x28(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
sub    -0x28(%rbp),%edx
add    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    $0x4,%edi
call   1030 <softfloat_shiftLeftM@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<softfloat_shiftNormSigF128M>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%r15
mov    (%rdi),%edi
mov    %edi,%ebx
shr    $0x10,%ebx
and    $0x7fff,%ebx
je     1176 <softfloat_shiftNormSigF128M+0x46>
mov    $0x4,%edi
mov    %r15,%rsi
mov    %ebp,%edx
mov    %r14,%rcx
call   1040 <softfloat_shortShiftLeftM@plt>
mov    $0x10000,%eax
mov    %ebp,%ecx
shl    %cl,%eax
lea    -0x1(%rax),%ecx
and    (%r14),%ecx
or     %eax,%ecx
mov    %ecx,(%r14)
jmp    11ce <softfloat_shiftNormSigF128M+0x9e>
mov    $0x10,%ebx
and    $0x7fffffff,%edi
jne    11b0 <softfloat_shiftNormSigF128M+0x80>
mov    0x4(%r15),%edi
mov    $0xfffffffffffffff0,%rbx
test   %edi,%edi
jne    11b0 <softfloat_shiftNormSigF128M+0x80>
mov    0x8(%r15),%edi
mov    $0xffffffffffffffd0,%rbx
test   %edi,%edi
jne    11b0 <softfloat_shiftNormSigF128M+0x80>
mov    0xc(%r15),%edi
mov    $0xffffffffffffffb0,%rbx
test   %edi,%edi
je     11db <softfloat_shiftNormSigF128M+0xab>
call   1050 <softfloat_countLeadingZeros32@plt>
sub    %eax,%ebx
sub    %ebx,%ebp
add    $0x1,%ebp
mov    $0x4,%edi
mov    %r15,%rsi
mov    %ebp,%edx
mov    %r14,%rcx
call   1030 <softfloat_shiftLeftM@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xffffff80,%ebx
jmp    11ce <softfloat_shiftNormSigF128M+0x9e>

LLVM IR (-O0):
define i32 @softfloat_shiftNormSigF128M(i32* %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
%11 = load i32*, i32** %5
%12 = getelementptr inbounds i32, i32* %11, i64 0
%13 = load i32, i32* %12
store i32 %13, i32* %8
%14 = load i32, i32* %8
%15 = ashr i32 %14, 16
%16 = and i32 %15, 32767
store i32 %16, i32* %9
%17 = load i32, i32* %9
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %36
19: ; preds = %3
%20 = load i32*, i32** %5
%21 = load i32, i32* %6
%22 = load i32*, i32** %7
%23 = call i32 @softfloat_shortShiftLeftM(i32 4, i32* %20, i32 %21, i32* %22)
%24 = load i32, i32* %6
%25 = shl i32 65536, %24
store i32 %25, i32* %10
%26 = load i32*, i32** %7
%27 = getelementptr inbounds i32, i32* %26, i64 0
%28 = load i32, i32* %27
%29 = load i32, i32* %10
%30 = sub nsw i32 %29, 1
%31 = and i32 %28, %30
%32 = load i32, i32* %10
%33 = or i32 %31, %32
%34 = load i32*, i32** %7
%35 = getelementptr inbounds i32, i32* %34, i64 0
store i32 %33, i32* %35
br label %77
36: ; preds = %3
store i32 16, i32* %9
%37 = load i32, i32* %8
%38 = and i32 %37, 2147483647
store i32 %38, i32* %8
%39 = load i32, i32* %8
%40 = icmp ne i32 %39, 0
br i1 %40, label %63, label %41
41: ; preds = %36
store i32 -16, i32* %9
%42 = load i32*, i32** %5
%43 = getelementptr inbounds i32, i32* %42, i64 1
%44 = load i32, i32* %43
store i32 %44, i32* %8
%45 = load i32, i32* %8
%46 = icmp ne i32 %45, 0
br i1 %46, label %62, label %47
47: ; preds = %41
store i32 -48, i32* %9
%48 = load i32*, i32** %5
%49 = getelementptr inbounds i32, i32* %48, i64 2
%50 = load i32, i32* %49
store i32 %50, i32* %8
%51 = load i32, i32* %8
%52 = icmp ne i32 %51, 0
br i1 %52, label %61, label %53
53: ; preds = %47
%54 = load i32*, i32** %5
%55 = getelementptr inbounds i32, i32* %54, i64 3
%56 = load i32, i32* %55
store i32 %56, i32* %8
%57 = load i32, i32* %8
%58 = icmp ne i32 %57, 0
br i1 %58, label %60, label %59
59: ; preds = %53
store i32 -128, i32* %4
br label %79
60: ; preds = %53
store i32 -80, i32* %9
br label %61
61: ; preds = %60, %47
br label %62
62: ; preds = %61, %41
br label %63
63: ; preds = %62, %36
%64 = load i32, i32* %8
%65 = call i64 @softfloat_countLeadingZeros32(i32 %64)
%66 = load i32, i32* %9
%67 = sext i32 %66 to i64
%68 = sub nsw i64 %67, %65
%69 = trunc i64 %68 to i32
store i32 %69, i32* %9
%70 = load i32*, i32** %5
%71 = load i32, i32* %9
%72 = sub nsw i32 1, %71
%73 = load i32, i32* %6
%74 = add nsw i32 %72, %73
%75 = load i32*, i32** %7
%76 = call i32 @softfloat_shiftLeftM(i32 4, i32* %70, i32 %74, i32* %75)
br label %77
77: ; preds = %63, %19
%78 = load i32, i32* %9
store i32 %78, i32* %4
br label %79
79: ; preds = %77, %59
%80 = load i32, i32* %4
ret i32 %80
}

LLVM IR (-O2):
define i32 @softfloat_shiftNormSigF128M(i32* %0, i32 %1, i32* %2) {
%4 = load i32, i32* %0
%5 = lshr i32 %4, 16
%6 = and i32 %5, 32767
%7 = icmp eq i32 %6, 0
br i1 %7, label %15, label %8
8: ; preds = %3
%9 = tail call i32 @softfloat_shortShiftLeftM(i32 4, i32* %0, i32 %1, i32* %2)
%10 = shl i32 65536, %1
%11 = load i32, i32* %2
%12 = add nsw i32 %10, -1
%13 = and i32 %11, %12
%14 = or i32 %13, %10
store i32 %14, i32* %2
br label %39
15: ; preds = %3
%16 = and i32 %4, 2147483647
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %30
18: ; preds = %15
%19 = getelementptr inbounds i32, i32* %0, i64 1
%20 = load i32, i32* %19
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %18
%23 = getelementptr inbounds i32, i32* %0, i64 2
%24 = load i32, i32* %23
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %22
%27 = getelementptr inbounds i32, i32* %0, i64 3
%28 = load i32, i32* %27
%29 = icmp eq i32 %28, 0
br i1 %29, label %39, label %30
30: ; preds = %26, %18, %22, %15
%31 = phi i32 [ %16, %15 ], [ %20, %18 ], [ %24, %22 ], [ %28, %26 ]
%32 = phi i64 [ 16, %15 ], [ -16, %18 ], [ -48, %22 ], [ -80, %26 ]
%33 = tail call i64 @softfloat_countLeadingZeros32(i32 %31)
%34 = sub nsw i64 %32, %33
%35 = trunc i64 %34 to i32
%36 = add i32 %1, 1
%37 = sub i32 %36, %35
%38 = tail call i32 @softfloat_shiftLeftM(i32 4, i32* %0, i32 %37, i32* %2)
br label %39
39: ; preds = %8, %30, %26
%40 = phi i32 [ -128, %26 ], [ %6, %8 ], [ %35, %30 ]
ret i32 %40
}