#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[((4) - 1)];
  exp = ((int32_t)((wordSig) >> 16) & 0x7FFF);
  if (exp) {
    softfloat_shortShiftLeftM(4, wPtr, shiftDist, sigPtr);
    leadingBit = 0x00010000 << shiftDist;
    sigPtr[((4) - 1)] = (sigPtr[((4) - 1)] & (leadingBit - 1)) | leadingBit;
  } else {
    exp = 16;
    wordSig &= 0x7FFFFFFF;
    if (!wordSig) {
      exp = -16;
      wordSig = wPtr[(2)];
      if (!wordSig) {
        exp = -48;
        wordSig = wPtr[(1)];
        if (!wordSig) {
          wordSig = wPtr[(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    0xc(%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     11a5 <softfloat_shiftNormSigF128M+0x75>
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    0xc(%rax),%ecx
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
and    %eax,%ecx
or     -0x2c(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,0xc(%rax)
jmp    1259 <softfloat_shiftNormSigF128M+0x129>
movl   $0x10,-0x28(%rbp)
mov    -0x24(%rbp),%eax
and    $0x7fffffff,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1227 <softfloat_shiftNormSigF128M+0xf7>
movl   $0xfffffff0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1222 <softfloat_shiftNormSigF128M+0xf2>
movl   $0xffffffd0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    121d <softfloat_shiftNormSigF128M+0xed>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1216 <softfloat_shiftNormSigF128M+0xe6>
movl   $0xffffff80,-0x4(%rbp)
jmp    125f <softfloat_shiftNormSigF128M+0x12f>
movl   $0xffffffb0,-0x28(%rbp)
jmp    1222 <softfloat_shiftNormSigF128M+0xf2>
jmp    1227 <softfloat_shiftNormSigF128M+0xf7>
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    0xc(%rdi),%edi
mov    %edi,%ebx
shr    $0x10,%ebx
and    $0x7fff,%ebx
je     1179 <softfloat_shiftNormSigF128M+0x49>
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    0xc(%r14),%ecx
or     %eax,%ecx
mov    %ecx,0xc(%r14)
jmp    11d0 <softfloat_shiftNormSigF128M+0xa0>
mov    $0x10,%ebx
and    $0x7fffffff,%edi
jne    11b2 <softfloat_shiftNormSigF128M+0x82>
mov    0x8(%r15),%edi
mov    $0xfffffffffffffff0,%rbx
test   %edi,%edi
jne    11b2 <softfloat_shiftNormSigF128M+0x82>
mov    0x4(%r15),%edi
mov    $0xffffffffffffffd0,%rbx
test   %edi,%edi
jne    11b2 <softfloat_shiftNormSigF128M+0x82>
mov    (%r15),%edi
mov    $0xffffffffffffffb0,%rbx
test   %edi,%edi
je     11dd <softfloat_shiftNormSigF128M+0xad>
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    11d0 <softfloat_shiftNormSigF128M+0xa0>

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