#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 /*<<< orphan*/ printf(char *, ...);
void bitmap_free_bits_table(unsigned max) {
  unsigned i, bits;
  printf("const s_type bitmap_free_bits_tab[][%u] = {\n", max);
  for (bits = 0; bits < 1 << max; bits++) {
    printf("\t[ 0x%03x ] = { ", bits);
    for (i = 1; i < max; i++)
      if (!(bits & (1 << i)))
        printf("%u, ", i);
    printf("},\n");
  }
  printf("};\n");
}


x86 assembly (clang, -O0):
<bitmap_free_bits_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x4(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
jae    11c8 <bitmap_free_bits_table+0xb8>
mov    -0xc(%rbp),%esi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    11ac <bitmap_free_bits_table+0x9c>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
jne    1199 <bitmap_free_bits_table+0x89>
mov    -0x8(%rbp),%esi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119e <bitmap_free_bits_table+0x8e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1162 <bitmap_free_bits_table+0x52>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <bitmap_free_bits_table+0x23>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitmap_free_bits_table>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r13d
lea    0xecb(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee7(%rip),%r14
lea    0xef1(%rip),%r15
lea    0xef2(%rip),%r12
xor    %ebp,%ebp
jmp    1176 <bitmap_free_bits_table+0x56>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
mov    %ebp,%eax
mov    %r13d,%ecx
shr    %cl,%eax
test   %eax,%eax
jne    11ab <bitmap_free_bits_table+0x8b>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x2,%r13d
jb     1160 <bitmap_free_bits_table+0x40>
mov    $0x1,%ebx
jmp    1198 <bitmap_free_bits_table+0x78>
nop
add    $0x1,%ebx
cmp    %ebx,%r13d
je     1160 <bitmap_free_bits_table+0x40>
bt     %ebx,%ebp
jb     1190 <bitmap_free_bits_table+0x70>
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1190 <bitmap_free_bits_table+0x70>
lea    0xe91(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"const s_type bitmap_free_bits_tab[][%u] = {\0A\00"
@.str.1 = [17 x i8] c"\09[ 0x%03x ] = { \00"
@.str.2 = [5 x i8] c"%u, \00"
@.str.3 = [4 x i8] c"},\0A\00"
@.str.4 = [4 x i8] c"};\0A\00"
define void @bitmap_free_bits_table(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %5)
store i32 0, i32* %4
br label %7
7: ; preds = %34, %1
%8 = load i32, i32* %4
%9 = load i32, i32* %2
%10 = shl i32 1, %9
%11 = icmp ult i32 %8, %10
br i1 %11, label %12, label %37
12: ; preds = %7
%13 = load i32, i32* %4
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %13)
store i32 1, i32* %3
br label %15
15: ; preds = %29, %12
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = icmp ult i32 %16, %17
br i1 %18, label %19, label %32
19: ; preds = %15
%20 = load i32, i32* %4
%21 = load i32, i32* %3
%22 = shl i32 1, %21
%23 = and i32 %20, %22
%24 = icmp ne i32 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %19
%26 = load i32, i32* %3
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %25, %19
br label %29
29: ; preds = %28
%30 = load i32, i32* %3
%31 = add i32 %30, 1
store i32 %31, i32* %3
br label %15
32: ; preds = %15
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %34
34: ; preds = %32
%35 = load i32, i32* %4
%36 = add i32 %35, 1
store i32 %36, i32* %4
br label %7
37: ; preds = %7
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c"const s_type bitmap_free_bits_tab[][%u] = {\0A\00"
@.str.1 = [17 x i8] c"\09[ 0x%03x ] = { \00"
@.str.2 = [5 x i8] c"%u, \00"
@str = [3 x i8] c"};\00"
@str.5 = [3 x i8] c"},\00"
define void @bitmap_free_bits_table(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = icmp ugt i32 %0, 1
br label %4
4: ; preds = %1, %17
%5 = phi i32 [ 0, %1 ], [ %19, %17 ]
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %5)
br i1 %3, label %7, label %17
7: ; preds = %4, %14
%8 = phi i32 [ %15, %14 ], [ 1, %4 ]
%9 = shl nuw i32 1, %8
%10 = and i32 %9, %5
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %8)
br label %14
14: ; preds = %7, %12
%15 = add nuw i32 %8, 1
%16 = icmp eq i32 %15, %0
br i1 %16, label %17, label %7
17: ; preds = %14, %4
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.5, i64 0, i64 0))
%19 = add i32 %5, 1
%20 = lshr i32 %19, %0
%21 = icmp eq i32 %20, 0
br i1 %21, label %4, label %22
22: ; preds = %17
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
}