#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 uint32_t;
typedef int int_fast16_t;
typedef int int32_t;

/* Variables and functions */
int softfloat_countLeadingZeros32(int);
int /*<<< orphan*/ softfloat_roundPackMToF128M(int, int, int *, int *);
int /*<<< orphan*/ softfloat_shiftLeftM(int, int *, int, int *);
void softfloat_normRoundPackMToF128M(bool sign, int32_t exp,
                                     uint32_t *extSigPtr, uint32_t *zWPtr) {
  const uint32_t *ptr;
  int_fast16_t shiftCount;
  uint32_t wordSig;
  ptr = extSigPtr + 0;
  shiftCount = 0;
  for (;;) {
    wordSig = *ptr;
    if (wordSig)
      break;
    shiftCount += 32;
    if (160 <= shiftCount) {
      zWPtr[0] = (((uint32_t)(sign) << 31) + ((uint32_t)(0) << 16) + (0));
      zWPtr[((4) - 1 - (2))] = 0;
      zWPtr[((4) - 1 - (1))] = 0;
      zWPtr[((4) - 1 - (0))] = 0;
      return;
    }
    ptr -= -1;
  }
  shiftCount += softfloat_countLeadingZeros32(wordSig) - 15;
  if (shiftCount) {
    exp -= shiftCount;
    softfloat_shiftLeftM(5, extSigPtr, shiftCount, extSigPtr);
  }
  softfloat_roundPackMToF128M(sign, exp, extSigPtr, zWPtr);
}


x86 assembly (clang, -O0):
<softfloat_normRoundPackMToF128M>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     116d <softfloat_normRoundPackMToF128M+0x3d>
jmp    11cd <softfloat_normRoundPackMToF128M+0x9d>
mov    -0x24(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x24(%rbp)
mov    $0xa0,%eax
cmp    -0x24(%rbp),%eax
jg     11bc <softfloat_normRoundPackMToF128M+0x8c>
mov    -0x4(%rbp),%ecx
shl    $0x1f,%ecx
add    $0x0,%ecx
add    $0x0,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,0x4(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,0x8(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,0xc(%rax)
jmp    121b <softfloat_normRoundPackMToF128M+0xeb>
mov    -0x20(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
jmp    1155 <softfloat_normRoundPackMToF128M+0x25>
mov    -0x28(%rbp),%edi
call   1050 <softfloat_countLeadingZeros32@plt>
sub    $0xf,%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1208 <softfloat_normRoundPackMToF128M+0xd8>
mov    -0x24(%rbp),%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    $0x5,%edi
call   1030 <softfloat_shiftLeftM@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1040 <softfloat_roundPackMToF128M@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<softfloat_normRoundPackMToF128M>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %esi,%r12d
mov    %edi,%r15d
mov    (%rdx),%edi
mov    $0xfffffff1,%ebp
test   %edi,%edi
jne    117f <softfloat_normRoundPackMToF128M+0x4f>
mov    0x4(%rbx),%edi
mov    $0x11,%ebp
test   %edi,%edi
jne    117f <softfloat_normRoundPackMToF128M+0x4f>
mov    0x8(%rbx),%edi
mov    $0x31,%ebp
test   %edi,%edi
jne    117f <softfloat_normRoundPackMToF128M+0x4f>
mov    0xc(%rbx),%edi
mov    $0x51,%ebp
test   %edi,%edi
jne    117f <softfloat_normRoundPackMToF128M+0x4f>
mov    0x10(%rbx),%edi
mov    $0x71,%ebp
test   %edi,%edi
je     11b6 <softfloat_normRoundPackMToF128M+0x86>
call   1050 <softfloat_countLeadingZeros32@plt>
add    %ebp,%eax
je     119d <softfloat_normRoundPackMToF128M+0x6d>
sub    %eax,%r12d
mov    $0x5,%edi
mov    %rbx,%rsi
mov    %eax,%edx
mov    %rbx,%rcx
call   1030 <softfloat_shiftLeftM@plt>
mov    %r15d,%edi
mov    %r12d,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <softfloat_roundPackMToF128M@plt>
shl    $0x1f,%r15d
mov    %r15d,(%r14)
movq   $0x0,0x4(%r14)
movl   $0x0,0xc(%r14)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @softfloat_normRoundPackMToF128M(i32 %0, i32 %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%12 = load i32*, i32** %7
%13 = getelementptr inbounds i32, i32* %12, i64 0
store i32* %13, i32** %9
store i32 0, i32* %10
br label %14
14: ; preds = %38, %4
%15 = load i32*, i32** %9
%16 = load i32, i32* %15
store i32 %16, i32* %11
%17 = load i32, i32* %11
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %14
br label %41
20: ; preds = %14
%21 = load i32, i32* %10
%22 = add nsw i32 %21, 32
store i32 %22, i32* %10
%23 = load i32, i32* %10
%24 = icmp sle i32 160, %23
br i1 %24, label %25, label %38
25: ; preds = %20
%26 = load i32, i32* %5
%27 = shl i32 %26, 31
%28 = add nsw i32 %27, 0
%29 = add nsw i32 %28, 0
%30 = load i32*, i32** %8
%31 = getelementptr inbounds i32, i32* %30, i64 0
store i32 %29, i32* %31
%32 = load i32*, i32** %8
%33 = getelementptr inbounds i32, i32* %32, i64 1
store i32 0, i32* %33
%34 = load i32*, i32** %8
%35 = getelementptr inbounds i32, i32* %34, i64 2
store i32 0, i32* %35
%36 = load i32*, i32** %8
%37 = getelementptr inbounds i32, i32* %36, i64 3
store i32 0, i32* %37
br label %63
38: ; preds = %20
%39 = load i32*, i32** %9
%40 = getelementptr inbounds i32, i32* %39, i64 1
store i32* %40, i32** %9
br label %14
41: ; preds = %19
%42 = load i32, i32* %11
%43 = call i32 @softfloat_countLeadingZeros32(i32 %42)
%44 = sub nsw i32 %43, 15
%45 = load i32, i32* %10
%46 = add nsw i32 %45, %44
store i32 %46, i32* %10
%47 = load i32, i32* %10
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %57
49: ; preds = %41
%50 = load i32, i32* %10
%51 = load i32, i32* %6
%52 = sub nsw i32 %51, %50
store i32 %52, i32* %6
%53 = load i32*, i32** %7
%54 = load i32, i32* %10
%55 = load i32*, i32** %7
%56 = call i32 @softfloat_shiftLeftM(i32 5, i32* %53, i32 %54, i32* %55)
br label %57
57: ; preds = %49, %41
%58 = load i32, i32* %5
%59 = load i32, i32* %6
%60 = load i32*, i32** %7
%61 = load i32*, i32** %8
%62 = call i32 @softfloat_roundPackMToF128M(i32 %58, i32 %59, i32* %60, i32* %61)
br label %63
63: ; preds = %57, %25
ret void
}

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