#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 /*<<< orphan*/ uint_fast8_t;
typedef scalar_t__ uint32_t;
typedef unsigned int size_words;

/* Variables and functions */
void softfloat_sub1XM(uint_fast8_t size_words, uint32_t *zPtr) {
  unsigned int index, lastIndex;
  uint32_t wordA;
  index = 0;
  lastIndex = ((size_words)-1);
  for (;;) {
    wordA = zPtr[index];
    zPtr[index] = wordA - 1;
    if (wordA || (index == lastIndex))
      break;
    index += 1;
  }
}


x86 assembly (clang, -O0):
<softfloat_sub1XM>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdx
sub    $0x1,%rdx
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %rdx,(%rax,%rcx,8)
cmpq   $0x0,-0x20(%rbp)
jne    1154 <softfloat_sub1XM+0x54>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    1159 <softfloat_sub1XM+0x59>
jmp    1167 <softfloat_sub1XM+0x67>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111b <softfloat_sub1XM+0x1b>
pop    %rbp
ret

x86 assembly (clang, -O2):
<softfloat_sub1XM>:
add    $0xffffffff,%edi
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nop
mov    %eax,%ecx
addq   $0xffffffffffffffff,(%rsi,%rcx,8)
jb     1122 <softfloat_sub1XM+0x22>
lea    0x1(%rax),%ecx
cmp    %eax,%edi
mov    %ecx,%eax
jne    1110 <softfloat_sub1XM+0x10>
ret

LLVM IR (-O0):
define void @softfloat_sub1XM(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
store i32 %0, i32* %3
store i64* %1, i64** %4
store i32 0, i32* %5
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, 1
store i32 %9, i32* %6
br label %10
10: ; preds = %29, %2
%11 = load i64*, i64** %4
%12 = load i32, i32* %5
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds i64, i64* %11, i64 %13
%15 = load i64, i64* %14
store i64 %15, i64* %7
%16 = load i64, i64* %7
%17 = sub nsw i64 %16, 1
%18 = load i64*, i64** %4
%19 = load i32, i32* %5
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds i64, i64* %18, i64 %20
store i64 %17, i64* %21
%22 = load i64, i64* %7
%23 = icmp ne i64 %22, 0
br i1 %23, label %28, label %24
24: ; preds = %10
%25 = load i32, i32* %5
%26 = load i32, i32* %6
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %29
28: ; preds = %24, %10
br label %32
29: ; preds = %24
%30 = load i32, i32* %5
%31 = add i32 %30, 1
store i32 %31, i32* %5
br label %10
32: ; preds = %28
ret void
}

LLVM IR (-O2):
define void @softfloat_sub1XM(i32 %0, i64* nocapture %1) {
%3 = add nsw i32 %0, -1
br label %4
4: ; preds = %4, %2
%5 = phi i32 [ 0, %2 ], [ %13, %4 ]
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds i64, i64* %1, i64 %6
%8 = load i64, i64* %7
%9 = add nsw i64 %8, -1
store i64 %9, i64* %7
%10 = icmp ne i64 %8, 0
%11 = icmp eq i32 %5, %3
%12 = select i1 %10, i1 true, i1 %11
%13 = add i32 %5, 1
br i1 %12, label %14, label %4
14: ; preds = %4
ret void
}