#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 count_zero_bits(int);
int one_zero_two_zero(unsigned int unset_count, unsigned int series_limit) {
  int sum = 0;
  for (int i = 1; i <= series_limit; i++) {
    if (count_zero_bits(i) == unset_count)
      sum++;
  }
  return sum;
}


x86 assembly (clang, -O0):
<one_zero_two_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
ja     1165 <one_zero_two_zero+0x55>
mov    -0x10(%rbp),%edi
call   1030 <count_zero_bits@plt>
cmp    -0x4(%rbp),%eax
jne    1152 <one_zero_two_zero+0x42>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1157 <one_zero_two_zero+0x47>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112c <one_zero_two_zero+0x1c>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<one_zero_two_zero>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
je     1156 <one_zero_two_zero+0x46>
mov    %esi,%r15d
mov    %edi,%r14d
neg    %r15d
xor    %ebp,%ebp
mov    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <count_zero_bits@plt>
xor    %ecx,%ecx
cmp    %r14d,%eax
sete   %cl
add    %ecx,%ebp
lea    (%r15,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1130 <one_zero_two_zero+0x20>
jmp    1158 <one_zero_two_zero+0x48>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @one_zero_two_zero(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i32 1, i32* %6
br label %7
7: ; preds = %20, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp ule i32 %8, %9
br i1 %10, label %11, label %23
11: ; preds = %7
%12 = load i32, i32* %6
%13 = call i32 @count_zero_bits(i32 %12)
%14 = load i32, i32* %3
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %5
br label %19
19: ; preds = %16, %11
br label %20
20: ; preds = %19
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %6
br label %7
23: ; preds = %7
%24 = load i32, i32* %5
ret i32 %24
}

LLVM IR (-O2):
define i32 @one_zero_two_zero(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %6, %2
%5 = phi i32 [ 0, %2 ], [ %12, %6 ]
ret i32 %5
6: ; preds = %2, %6
%7 = phi i32 [ %13, %6 ], [ 1, %2 ]
%8 = phi i32 [ %12, %6 ], [ 0, %2 ]
%9 = tail call i32 @count_zero_bits(i32 %7)
%10 = icmp eq i32 %9, %0
%11 = zext i1 %10 to i32
%12 = add nuw nsw i32 %8, %11
%13 = add nuw i32 %7, 1
%14 = icmp eq i32 %7, %1
br i1 %14, label %4, label %6
}