#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*/ dump(char *, int);
int /*<<< orphan*/ tag_enable(int);
scalar_t__ tag_readblock(int, char *);
void tag_dump_blocks(unsigned int block, unsigned int num) {
  tag_enable(1);
  char buf[16];
  int i;
  for (i = block; i < block + num; i++) {
    if (tag_readblock(i, buf)) {
      ;
      dump(buf, 16);
    }
  }
  tag_enable(0);
}


x86 assembly (clang, -O0):
<tag_dump_blocks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x1,%edi
call   1040 <tag_enable@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jae    1196 <tag_dump_blocks+0x66>
mov    -0x24(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   1030 <tag_readblock@plt>
cmp    $0x0,%rax
je     1183 <tag_dump_blocks+0x53>
lea    -0x20(%rbp),%rdi
mov    $0x10,%esi
call   1050 <dump@plt>
jmp    1188 <tag_dump_blocks+0x58>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114e <tag_dump_blocks+0x1e>
xor    %edi,%edi
call   1040 <tag_enable@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tag_dump_blocks>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r14d
mov    %edi,%ebx
mov    $0x1,%edi
call   1040 <tag_enable@plt>
lea    (%r14,%rbx,1),%eax
cmp    %ebx,%eax
jbe    1187 <tag_dump_blocks+0x57>
mov    %rsp,%r15
jmp    1169 <tag_dump_blocks+0x39>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebx
add    $0xffffffff,%r14d
je     1187 <tag_dump_blocks+0x57>
mov    %ebx,%edi
mov    %r15,%rsi
call   1030 <tag_readblock@plt>
test   %rax,%rax
je     1160 <tag_dump_blocks+0x30>
mov    %r15,%rdi
mov    $0x10,%esi
call   1050 <dump@plt>
jmp    1160 <tag_dump_blocks+0x30>
xor    %edi,%edi
call   1040 <tag_enable@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @tag_dump_blocks(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [16 x i8]
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = call i32 @tag_enable(i32 1)
%8 = load i32, i32* %3
store i32 %8, i32* %6
br label %9
9: ; preds = %24, %2
%10 = load i32, i32* %6
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = add i32 %11, %12
%14 = icmp ult i32 %10, %13
br i1 %14, label %15, label %27
15: ; preds = %9
%16 = load i32, i32* %6
%17 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%18 = call i64 @tag_readblock(i32 %16, i8* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%22 = call i32 @dump(i8* %21, i32 16)
br label %23
23: ; preds = %20, %15
br label %24
24: ; preds = %23
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %9
27: ; preds = %9
%28 = call i32 @tag_enable(i32 0)
ret void
}

LLVM IR (-O2):
define void @tag_dump_blocks(i32 %0, i32 %1) {
%3 = alloca [16 x i8]
%4 = tail call i32 @tag_enable(i32 1)
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%6 = add i32 %1, %0
%7 = icmp ugt i32 %6, %0
br i1 %7, label %8, label %17
8: ; preds = %2, %14
%9 = phi i32 [ %15, %14 ], [ %0, %2 ]
%10 = call i64 @tag_readblock(i32 %9, i8* %5)
%11 = icmp eq i64 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = call i32 @dump(i8* %5, i32 16)
br label %14
14: ; preds = %8, %12
%15 = add i32 %9, 1
%16 = icmp eq i32 %15, %6
br i1 %16, label %17, label %8
17: ; preds = %14, %2
%18 = call i32 @tag_enable(i32 0)
ret void
}