#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 */
struct bit_map_t {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int bit_map_get(struct bit_map_t *, unsigned int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
void bit_map_dump(struct bit_map_t *bit_map, unsigned int where,
                  unsigned int size, FILE *f) {
  unsigned int i;
  for (i = 0; i < size; i++)
    fprintf(f, "%d", bit_map_get(bit_map, where + i, 1));
}


x86 assembly (clang, -O0):
<bit_map_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    1185 <bit_map_dump+0x65>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    -0x1c(%rbp),%esi
mov    $0x1,%edx
call   1030 <bit_map_get@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%edx
lea    0xe8e(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113d <bit_map_dump+0x1d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_map_dump>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edx,%edx
je     1164 <bit_map_dump+0x44>
mov    %rcx,%r14
mov    %edx,%ebp
mov    %esi,%ebx
mov    %rdi,%r15
lea    0xec3(%rip),%r12
nopl   (%rax)
mov    %r15,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
call   1030 <bit_map_get@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %eax,%edx
call   1040 <fprintf@plt>
add    $0x1,%ebx
add    $0xffffffff,%ebp
jne    1140 <bit_map_dump+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.bit_map_t = type { i32 }
@.str = [3 x i8] c"%d\00"
define void @bit_map_dump(%struct.bit_map_t* %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca %struct.bit_map_t*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
store %struct.bit_map_t* %0, %struct.bit_map_t** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32* %3, i32** %8
store i32 0, i32* %9
br label %10
10: ; preds = %22, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %7
%13 = icmp ult i32 %11, %12
br i1 %13, label %14, label %25
14: ; preds = %10
%15 = load i32*, i32** %8
%16 = load %struct.bit_map_t*, %struct.bit_map_t** %5
%17 = load i32, i32* %6
%18 = load i32, i32* %9
%19 = add i32 %17, %18
%20 = call i32 @bit_map_get(%struct.bit_map_t* %16, i32 %19, i32 1)
%21 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %14
%23 = load i32, i32* %9
%24 = add i32 %23, 1
store i32 %24, i32* %9
br label %10
25: ; preds = %10
ret void
}

LLVM IR (-O2):
%struct.bit_map_t = type { i32 }
@.str = [3 x i8] c"%d\00"
define void @bit_map_dump(%struct.bit_map_t* %0, i32 %1, i32 %2, i32* nocapture %3) {
%5 = icmp eq i32 %2, 0
br i1 %5, label %13, label %6
6: ; preds = %4, %6
%7 = phi i32 [ %11, %6 ], [ 0, %4 ]
%8 = add i32 %7, %1
%9 = tail call i32 @bit_map_get(%struct.bit_map_t* %0, i32 %8, i32 1)
%10 = tail call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw i32 %7, 1
%12 = icmp eq i32 %11, %2
br i1 %12, label %13, label %6
13: ; preds = %6, %4
ret void
}