unsigned int FLAC__clz_soft_uint32(unsigned int word) {
  static const unsigned char byte_to_unary_table[] = {
      8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3,
      3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
      2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
      1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  };
  return (word) > 0xffffff ? byte_to_unary_table[(word) >> 24]
         : !(word)         ? 32
         : (word) > 0xffff ? byte_to_unary_table[(word) >> 16] + 8
         : (word) > 0xff   ? byte_to_unary_table[(word) >> 8] + 16
                           : byte_to_unary_table[(word)] + 24;
}


x86 assembly (clang, -O0):
<FLAC__clz_soft_uint32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0xffffff,-0x4(%rbp)
jbe    1131 <FLAC__clz_soft_uint32+0x31>
mov    -0x4(%rbp),%eax
shr    $0x18,%eax
mov    %eax,%eax
mov    %eax,%ecx
lea    0xedb(%rip),%rax
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x8(%rbp)
jmp    11ca <FLAC__clz_soft_uint32+0xca>
cmpl   $0x0,-0x4(%rbp)
jne    1148 <FLAC__clz_soft_uint32+0x48>
mov    $0x20,%eax
mov    %eax,-0xc(%rbp)
jmp    11c4 <FLAC__clz_soft_uint32+0xc4>
cmpl   $0xffff,-0x4(%rbp)
jbe    1175 <FLAC__clz_soft_uint32+0x75>
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
mov    %eax,%eax
mov    %eax,%ecx
lea    0xe9a(%rip),%rax
movzbl (%rax,%rcx,1),%eax
add    $0x8,%eax
mov    %eax,-0x10(%rbp)
jmp    11be <FLAC__clz_soft_uint32+0xbe>
cmpl   $0xff,-0x4(%rbp)
jbe    11a2 <FLAC__clz_soft_uint32+0xa2>
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
mov    %eax,%eax
mov    %eax,%ecx
lea    0xe6d(%rip),%rax
movzbl (%rax,%rcx,1),%eax
add    $0x10,%eax
mov    %eax,-0x14(%rbp)
jmp    11b8 <FLAC__clz_soft_uint32+0xb8>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0xe52(%rip),%rax
movzbl (%rax,%rcx,1),%eax
add    $0x18,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FLAC__clz_soft_uint32>:
cmp    $0x1000000,%edi
jb     111a <FLAC__clz_soft_uint32+0x1a>
mov    %edi,%eax
shr    $0x18,%rax
lea    0xeeb(%rip),%rcx
movzbl (%rax,%rcx,1),%eax
ret
test   %edi,%edi
je     113b <FLAC__clz_soft_uint32+0x3b>
cmp    $0x10000,%edi
jb     1141 <FLAC__clz_soft_uint32+0x41>
mov    %edi,%eax
shr    $0x10,%rax
lea    0xecd(%rip),%rcx
movzbl (%rax,%rcx,1),%eax
add    $0x8,%eax
ret
mov    $0x20,%eax
ret
mov    %edi,%eax
cmp    $0x100,%edi
jb     115e <FLAC__clz_soft_uint32+0x5e>
shr    $0x8,%rax
lea    0xeaa(%rip),%rcx
movzbl (%rax,%rcx,1),%eax
add    $0x10,%eax
ret
lea    0xe9b(%rip),%rcx
movzbl (%rax,%rcx,1),%eax
add    $0x18,%eax
ret

LLVM IR (-O0):
@FLAC__clz_soft_uint32.byte_to_unary_table = internal constant <{ [128 x i8], [128 x i8] }> <{ [128 x i8] c"\08\07\06\06\05\05\05\05\04\04\04\04\04\04\04\04\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01", [128 x i8] zeroinitializer }>
define i32 @FLAC__clz_soft_uint32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ugt i32 %3, 16777215
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i32, i32* %2
%7 = lshr i32 %6, 24
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds [256 x i8], [256 x i8]* bitcast (<{ [128 x i8], [128 x i8] }>* @FLAC__clz_soft_uint32.byte_to_unary_table to [256 x i8]*), i64 0, i64 %8
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
br label %51
12: ; preds = %1
%13 = load i32, i32* %2
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %12
br label %49
16: ; preds = %12
%17 = load i32, i32* %2
%18 = icmp ugt i32 %17, 65535
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = load i32, i32* %2
%21 = lshr i32 %20, 16
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds [256 x i8], [256 x i8]* bitcast (<{ [128 x i8], [128 x i8] }>* @FLAC__clz_soft_uint32.byte_to_unary_table to [256 x i8]*), i64 0, i64 %22
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = add nsw i32 %25, 8
br label %47
27: ; preds = %16
%28 = load i32, i32* %2
%29 = icmp ugt i32 %28, 255
br i1 %29, label %30, label %38
30: ; preds = %27
%31 = load i32, i32* %2
%32 = lshr i32 %31, 8
%33 = zext i32 %32 to i64
%34 = getelementptr inbounds [256 x i8], [256 x i8]* bitcast (<{ [128 x i8], [128 x i8] }>* @FLAC__clz_soft_uint32.byte_to_unary_table to [256 x i8]*), i64 0, i64 %33
%35 = load i8, i8* %34
%36 = zext i8 %35 to i32
%37 = add nsw i32 %36, 16
br label %45
38: ; preds = %27
%39 = load i32, i32* %2
%40 = zext i32 %39 to i64
%41 = getelementptr inbounds [256 x i8], [256 x i8]* bitcast (<{ [128 x i8], [128 x i8] }>* @FLAC__clz_soft_uint32.byte_to_unary_table to [256 x i8]*), i64 0, i64 %40
%42 = load i8, i8* %41
%43 = zext i8 %42 to i32
%44 = add nsw i32 %43, 24
br label %45
45: ; preds = %38, %30
%46 = phi i32 [ %37, %30 ], [ %44, %38 ]
br label %47
47: ; preds = %45, %19
%48 = phi i32 [ %26, %19 ], [ %46, %45 ]
br label %49
49: ; preds = %47, %15
%50 = phi i32 [ 32, %15 ], [ %48, %47 ]
br label %51
51: ; preds = %49, %5
%52 = phi i32 [ %11, %5 ], [ %50, %49 ]
ret i32 %52
}

LLVM IR (-O2):
@FLAC__clz_soft_uint32.byte_to_unary_table = internal unnamed_addr constant <{ [128 x i8], [128 x i8] }> <{ [128 x i8] c"\08\07\06\06\05\05\05\05\04\04\04\04\04\04\04\04\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\02\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01\01", [128 x i8] zeroinitializer }>
define i32 @FLAC__clz_soft_uint32(i32 %0) {
%2 = icmp ugt i32 %0, 16777215
br i1 %2, label %3, label %9
3: ; preds = %1
%4 = lshr i32 %0, 24
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds [256 x i8], [256 x i8]* bitcast (<{ [128 x i8], [128 x i8] }>* @FLAC__clz_soft_uint32.byte_to_unary_table to [256 x i8]*), i64 0, i64 %5
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
br label %35
9: ; preds = %1
%10 = icmp eq i32 %0, 0
br i1 %10, label %35, label %11
11: ; preds = %9
%12 = icmp ugt i32 %0, 65535
br i1 %12, label %13, label %20
13: ; preds = %11
%14 = lshr i32 %0, 16
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds [256 x i8], [256 x i8]* bitcast (<{ [128 x i8], [128 x i8] }>* @FLAC__clz_soft_uint32.byte_to_unary_table to [256 x i8]*), i64 0, i64 %15
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = add nuw nsw i32 %18, 8
br label %35
20: ; preds = %11
%21 = icmp ugt i32 %0, 255
br i1 %21, label %22, label %29
22: ; preds = %20
%23 = lshr i32 %0, 8
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds [256 x i8], [256 x i8]* bitcast (<{ [128 x i8], [128 x i8] }>* @FLAC__clz_soft_uint32.byte_to_unary_table to [256 x i8]*), i64 0, i64 %24
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = add nuw nsw i32 %27, 16
br label %35
29: ; preds = %20
%30 = zext i32 %0 to i64
%31 = getelementptr inbounds [256 x i8], [256 x i8]* bitcast (<{ [128 x i8], [128 x i8] }>* @FLAC__clz_soft_uint32.byte_to_unary_table to [256 x i8]*), i64 0, i64 %30
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = add nuw nsw i32 %33, 24
br label %35
35: ; preds = %9, %22, %29, %13, %3
%36 = phi i32 [ %8, %3 ], [ 32, %9 ], [ %19, %13 ], [ %28, %22 ], [ %34, %29 ]
ret i32 %36
}