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) > 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    11ad <FLAC__clz_soft_uint32+0xad>
cmpl   $0xffff,-0x4(%rbp)
jbe    115e <FLAC__clz_soft_uint32+0x5e>
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
mov    %eax,%eax
mov    %eax,%ecx
lea    0xeb1(%rip),%rax
movzbl (%rax,%rcx,1),%eax
add    $0x8,%eax
mov    %eax,-0xc(%rbp)
jmp    11a7 <FLAC__clz_soft_uint32+0xa7>
cmpl   $0xff,-0x4(%rbp)
jbe    118b <FLAC__clz_soft_uint32+0x8b>
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
mov    %eax,%eax
mov    %eax,%ecx
lea    0xe84(%rip),%rax
movzbl (%rax,%rcx,1),%eax
add    $0x10,%eax
mov    %eax,-0x10(%rbp)
jmp    11a1 <FLAC__clz_soft_uint32+0xa1>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0xe69(%rip),%rax
movzbl (%rax,%rcx,1),%eax
add    $0x18,%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
cmp    $0x10000,%edi
jb     1137 <FLAC__clz_soft_uint32+0x37>
mov    %edi,%eax
shr    $0x10,%rax
lea    0xed1(%rip),%rcx
movzbl (%rax,%rcx,1),%eax
add    $0x8,%eax
ret
mov    %edi,%eax
cmp    $0x100,%edi
jb     1154 <FLAC__clz_soft_uint32+0x54>
shr    $0x8,%rax
lea    0xeb4(%rip),%rcx
movzbl (%rax,%rcx,1),%eax
add    $0x10,%eax
ret
lea    0xea5(%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 %45
12: ; preds = %1
%13 = load i32, i32* %2
%14 = icmp ugt i32 %13, 65535
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = load i32, i32* %2
%17 = lshr i32 %16, 16
%18 = zext i32 %17 to i64
%19 = 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 %18
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = add nsw i32 %21, 8
br label %43
23: ; preds = %12
%24 = load i32, i32* %2
%25 = icmp ugt i32 %24, 255
br i1 %25, label %26, label %34
26: ; preds = %23
%27 = load i32, i32* %2
%28 = lshr i32 %27, 8
%29 = zext i32 %28 to i64
%30 = 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 %29
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = add nsw i32 %32, 16
br label %41
34: ; preds = %23
%35 = load i32, i32* %2
%36 = zext i32 %35 to i64
%37 = 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 %36
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = add nsw i32 %39, 24
br label %41
41: ; preds = %34, %26
%42 = phi i32 [ %33, %26 ], [ %40, %34 ]
br label %43
43: ; preds = %41, %15
%44 = phi i32 [ %22, %15 ], [ %42, %41 ]
br label %45
45: ; preds = %43, %5
%46 = phi i32 [ %11, %5 ], [ %44, %43 ]
ret i32 %46
}

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 %33
9: ; preds = %1
%10 = icmp ugt i32 %0, 65535
br i1 %10, label %11, label %18
11: ; preds = %9
%12 = lshr i32 %0, 16
%13 = zext i32 %12 to i64
%14 = 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 %13
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = add nuw nsw i32 %16, 8
br label %33
18: ; preds = %9
%19 = icmp ugt i32 %0, 255
br i1 %19, label %20, label %27
20: ; preds = %18
%21 = lshr i32 %0, 8
%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 nuw nsw i32 %25, 16
br label %33
27: ; preds = %18
%28 = zext i32 %0 to i64
%29 = 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 %28
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = add nuw nsw i32 %31, 24
br label %33
33: ; preds = %11, %27, %20, %3
%34 = phi i32 [ %8, %3 ], [ %17, %11 ], [ %26, %20 ], [ %32, %27 ]
ret i32 %34
}