#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 CHAR_BIT;
int /*<<< orphan*/ radix_offsets_ui(unsigned int *);
unsigned radix_zeros_ui(unsigned int bitorkey,
                        unsigned int (*restrict count)[(1 << 8)],
                        unsigned *restrict shift,
                        unsigned int **restrict offsets) {
  unsigned digits = 0, sh = 0;
  unsigned int *c = &count[0][0];
  do {
    if (bitorkey & ((unsigned int)((1 << 8) - 1)))
      *shift++ = sh, *offsets++ = c, ++digits, radix_offsets_ui(c);
  } while (bitorkey >>= 8, sh += 8, c += (1 << 8),
           sh != (8 * (((CHAR_BIT * sizeof(unsigned int)) + (8) - 1) / (8))));
  return digits;
}


x86 assembly (clang, -O0):
<radix_zeros_ui>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
cmp    $0x0,%eax
je     118a <radix_zeros_ui+0x7a>
mov    -0x28(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x18(%rbp)
mov    %ecx,(%rax)
mov    -0x30(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x20(%rbp)
mov    %rcx,(%rax)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <radix_offsets_ui@plt>
jmp    118f <radix_zeros_ui+0x7f>
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
mov    %eax,-0x4(%rbp)
mov    -0x28(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
add    $0x400,%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%eax
mov    0x2e27(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x2,%rcx
add    $0x8,%rcx
sub    $0x1,%rcx
shr    $0x3,%rcx
shl    $0x3,%rcx
cmp    %rcx,%rax
jne    113d <radix_zeros_ui+0x2d>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<radix_zeros_ui>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %edi,%r13d
xor    %r12d,%r12d
mov    $0x8,%ebp
jmp    116b <radix_zeros_ui+0x5b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
shr    $0x8,%r13d
add    $0x400,%rbx
mov    %ebp,%eax
mov    0x2e8c(%rip),%rcx
movslq (%rcx),%rcx
lea    0x7(,%rcx,4),%rcx
and    $0xfffffffffffffff8,%rcx
add    $0x8,%ebp
cmp    %rax,%rcx
je     118f <radix_zeros_ui+0x7f>
test   %r13b,%r13b
je     1140 <radix_zeros_ui+0x30>
lea    -0x8(%rbp),%eax
mov    %eax,(%r15)
add    $0x4,%r15
mov    %rbx,(%r14)
add    $0x8,%r14
add    $0x1,%r12d
mov    %rbx,%rdi
call   1030 <radix_offsets_ui@plt>
jmp    1140 <radix_zeros_ui+0x30>
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@CHAR_BIT = global i32 0
define i32 @radix_zeros_ui(i32 %0, [256 x i32]* noalias %1, i32* noalias %2, i32** noalias %3) {
%5 = alloca i32
%6 = alloca [256 x i32]*
%7 = alloca i32*
%8 = alloca i32**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
store i32 %0, i32* %5
store [256 x i32]* %1, [256 x i32]** %6
store i32* %2, i32** %7
store i32** %3, i32*** %8
store i32 0, i32* %9
store i32 0, i32* %10
%12 = load [256 x i32]*, [256 x i32]** %6
%13 = getelementptr inbounds [256 x i32], [256 x i32]* %12, i64 0
%14 = getelementptr inbounds [256 x i32], [256 x i32]* %13, i64 0, i64 0
store i32* %14, i32** %11
br label %15
15: ; preds = %31, %4
%16 = load i32, i32* %5
%17 = and i32 %16, 255
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %30
19: ; preds = %15
%20 = load i32, i32* %10
%21 = load i32*, i32** %7
%22 = getelementptr inbounds i32, i32* %21, i32 1
store i32* %22, i32** %7
store i32 %20, i32* %21
%23 = load i32*, i32** %11
%24 = load i32**, i32*** %8
%25 = getelementptr inbounds i32*, i32** %24, i32 1
store i32** %25, i32*** %8
store i32* %23, i32** %24
%26 = load i32, i32* %9
%27 = add i32 %26, 1
store i32 %27, i32* %9
%28 = load i32*, i32** %11
%29 = call i32 @radix_offsets_ui(i32* %28)
br label %30
30: ; preds = %19, %15
br label %31
31: ; preds = %30
%32 = load i32, i32* %5
%33 = lshr i32 %32, 8
store i32 %33, i32* %5
%34 = load i32, i32* %10
%35 = add i32 %34, 8
store i32 %35, i32* %10
%36 = load i32*, i32** %11
%37 = getelementptr inbounds i32, i32* %36, i64 256
store i32* %37, i32** %11
%38 = load i32, i32* %10
%39 = zext i32 %38 to i64
%40 = load i32, i32* @CHAR_BIT
%41 = sext i32 %40 to i64
%42 = mul i64 %41, 4
%43 = add i64 %42, 8
%44 = sub i64 %43, 1
%45 = udiv i64 %44, 8
%46 = mul i64 8, %45
%47 = icmp ne i64 %39, %46
br i1 %47, label %15, label %48
48: ; preds = %31
%49 = load i32, i32* %9
ret i32 %49
}

LLVM IR (-O2):
@CHAR_BIT = global i32 0
define i32 @radix_zeros_ui(i32 %0, [256 x i32]* noalias %1, i32* noalias nocapture writeonly %2, i32** noalias nocapture writeonly %3) {
%5 = getelementptr inbounds [256 x i32], [256 x i32]* %1, i64 0, i64 0
br label %6
6: ; preds = %20, %4
%7 = phi i32 [ %0, %4 ], [ %24, %20 ]
%8 = phi i32* [ %2, %4 ], [ %21, %20 ]
%9 = phi i32** [ %3, %4 ], [ %22, %20 ]
%10 = phi i32 [ 0, %4 ], [ %23, %20 ]
%11 = phi i32 [ 0, %4 ], [ %25, %20 ]
%12 = phi i32* [ %5, %4 ], [ %26, %20 ]
%13 = and i32 %7, 255
%14 = icmp eq i32 %13, 0
br i1 %14, label %20, label %15
15: ; preds = %6
%16 = getelementptr inbounds i32, i32* %8, i64 1
store i32 %11, i32* %8
%17 = getelementptr inbounds i32*, i32** %9, i64 1
store i32* %12, i32** %9
%18 = add i32 %10, 1
%19 = tail call i32 @radix_offsets_ui(i32* %12)
br label %20
20: ; preds = %6, %15
%21 = phi i32* [ %16, %15 ], [ %8, %6 ]
%22 = phi i32** [ %17, %15 ], [ %9, %6 ]
%23 = phi i32 [ %18, %15 ], [ %10, %6 ]
%24 = lshr i32 %7, 8
%25 = add i32 %11, 8
%26 = getelementptr inbounds i32, i32* %12, i64 256
%27 = zext i32 %25 to i64
%28 = load i32, i32* @CHAR_BIT
%29 = sext i32 %28 to i64
%30 = shl nsw i64 %29, 2
%31 = add nsw i64 %30, 7
%32 = and i64 %31, -8
%33 = icmp eq i64 %32, %27
br i1 %33, label %34, label %6
34: ; preds = %20
ret i32 %23
}