#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 */
unsigned int TEN_popc(unsigned int);
unsigned int _bitc4(unsigned int src1) {
  unsigned int res0 = TEN_popc(src1 & 0xFF);
  unsigned int res1 = TEN_popc((src1 & 0xFF00) >> 8);
  unsigned int res2 = TEN_popc((src1 & 0xFF0000) >> 16);
  unsigned int res3 = TEN_popc((src1 & 0xFF000000) >> 24);
  return (res3 << 24) | (res2 << 16) | (res1 << 8) | res0;
}


x86 assembly (clang, -O0):
<_bitc4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
and    $0xff,%edi
call   1030 <TEN_popc@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
and    $0xff00,%edi
shr    $0x8,%edi
call   1030 <TEN_popc@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
and    $0xff0000,%edi
shr    $0x10,%edi
call   1030 <TEN_popc@plt>
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
and    $0xff000000,%edi
shr    $0x18,%edi
call   1030 <TEN_popc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x18,%eax
mov    -0x10(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
or     -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_bitc4>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
movzbl %bl,%edi
call   1030 <TEN_popc@plt>
mov    %eax,%r14d
movzbl %bh,%edi
call   1030 <TEN_popc@plt>
mov    %eax,%ebp
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%edi
call   1030 <TEN_popc@plt>
mov    %eax,%r15d
shr    $0x18,%ebx
mov    %ebx,%edi
call   1030 <TEN_popc@plt>
shl    $0x18,%eax
shl    $0x10,%r15d
shl    $0x8,%ebp
or     %r14d,%ebp
or     %r15d,%ebp
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @_bitc4(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = and i32 %7, 255
%9 = call i32 @TEN_popc(i32 %8)
store i32 %9, i32* %3
%10 = load i32, i32* %2
%11 = and i32 %10, 65280
%12 = lshr i32 %11, 8
%13 = call i32 @TEN_popc(i32 %12)
store i32 %13, i32* %4
%14 = load i32, i32* %2
%15 = and i32 %14, 16711680
%16 = lshr i32 %15, 16
%17 = call i32 @TEN_popc(i32 %16)
store i32 %17, i32* %5
%18 = load i32, i32* %2
%19 = and i32 %18, -16777216
%20 = lshr i32 %19, 24
%21 = call i32 @TEN_popc(i32 %20)
store i32 %21, i32* %6
%22 = load i32, i32* %6
%23 = shl i32 %22, 24
%24 = load i32, i32* %5
%25 = shl i32 %24, 16
%26 = or i32 %23, %25
%27 = load i32, i32* %4
%28 = shl i32 %27, 8
%29 = or i32 %26, %28
%30 = load i32, i32* %3
%31 = or i32 %29, %30
ret i32 %31
}

LLVM IR (-O2):
define i32 @_bitc4(i32 %0) {
%2 = and i32 %0, 255
%3 = tail call i32 @TEN_popc(i32 %2)
%4 = lshr i32 %0, 8
%5 = and i32 %4, 255
%6 = tail call i32 @TEN_popc(i32 %5)
%7 = lshr i32 %0, 16
%8 = and i32 %7, 255
%9 = tail call i32 @TEN_popc(i32 %8)
%10 = lshr i32 %0, 24
%11 = tail call i32 @TEN_popc(i32 %10)
%12 = shl i32 %11, 24
%13 = shl i32 %9, 16
%14 = shl i32 %6, 8
%15 = or i32 %14, %3
%16 = or i32 %15, %13
%17 = or i32 %16, %12
ret i32 %17
}