#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 */
typedef int /*<<< orphan*/ __u16;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned char, unsigned char);
int /*<<< orphan*/ putchar(char);
void dump_sectors(__u16 *w, unsigned int count) {
  unsigned int i;
  for (i = 0; i < (count * 256 / 8); ++i) {
    int word;
    for (word = 0; word < 8; ++word) {
      unsigned char *b = (unsigned char *)w++;
      printf("%02x%02x", b[0], b[1]);
      putchar(word == 7 ? '\n' : ' ');
    }
  }
}


x86 assembly (clang, -O0):
<dump_sectors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x8,%ecx
shr    $0x3,%ecx
cmp    %ecx,%eax
jae    11c7 <dump_sectors+0xa7>
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    11b4 <dump_sectors+0x94>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
lea    0xe81(%rip),%rdi
movzbl %cl,%esi
movzbl 0x1(%rax),%edx
call   1040 <printf@plt>
mov    -0x14(%rbp),%edx
mov    $0x20,%eax
mov    $0xa,%ecx
cmp    $0x7,%edx
cmove  %ecx,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1151 <dump_sectors+0x31>
jmp    11b9 <dump_sectors+0x99>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <dump_sectors+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_sectors>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
shl    $0x5,%ebp
and    $0x1fffffe0,%ebp
je     121c <dump_sectors+0xfc>
mov    %rdi,%rbx
lea    0xec1(%rip),%r14
nop
movzbl (%rbx),%esi
movzbl 0x1(%rbx),%edx
mov    %r14,%rdi
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
movzbl 0x4(%rbx),%esi
movzbl 0x5(%rbx),%edx
mov    %r14,%rdi
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
movzbl 0x8(%rbx),%esi
movzbl 0x9(%rbx),%edx
mov    %r14,%rdi
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
movzbl 0xc(%rbx),%esi
movzbl 0xd(%rbx),%edx
mov    %r14,%rdi
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
movzbl 0x10(%rbx),%esi
movzbl 0x11(%rbx),%edx
mov    %r14,%rdi
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
movzbl 0x14(%rbx),%esi
movzbl 0x15(%rbx),%edx
mov    %r14,%rdi
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
movzbl 0x18(%rbx),%esi
movzbl 0x19(%rbx),%edx
mov    %r14,%rdi
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
movzbl 0x1c(%rbx),%esi
movzbl 0x1d(%rbx),%edx
mov    %r14,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rbx
add    $0xffffffff,%ebp
jne    1140 <dump_sectors+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%02x%02x\00"
define void @dump_sectors(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %8
8: ; preds = %39, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = mul i32 %10, 256
%12 = udiv i32 %11, 8
%13 = icmp ult i32 %9, %12
br i1 %13, label %14, label %42
14: ; preds = %8
store i32 0, i32* %6
br label %15
15: ; preds = %35, %14
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 8
br i1 %17, label %18, label %38
18: ; preds = %15
%19 = load i32*, i32** %3
%20 = getelementptr inbounds i32, i32* %19, i32 1
store i32* %20, i32** %3
%21 = bitcast i32* %19 to i8*
store i8* %21, i8** %7
%22 = load i8*, i8** %7
%23 = getelementptr inbounds i8, i8* %22, i64 0
%24 = load i8, i8* %23
%25 = load i8*, i8** %7
%26 = getelementptr inbounds i8, i8* %25, i64 1
%27 = load i8, i8* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 zeroext %24, i8 zeroext %27)
%29 = load i32, i32* %6
%30 = icmp eq i32 %29, 7
%31 = zext i1 %30 to i64
%32 = select i1 %30, i32 10, i32 32
%33 = trunc i32 %32 to i8
%34 = call i32 @putchar(i8 signext %33)
br label %35
35: ; preds = %18
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %15
38: ; preds = %15
br label %39
39: ; preds = %38
%40 = load i32, i32* %5
%41 = add i32 %40, 1
store i32 %41, i32* %5
br label %8
42: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%02x%02x\00"
define void @dump_sectors(i32* nocapture %0, i32 %1) {
%3 = shl i32 %1, 5
%4 = and i32 %3, 536870880
%5 = icmp eq i32 %4, 0
br i1 %5, label %67, label %6
6: ; preds = %2, %6
%7 = phi i32* [ %58, %6 ], [ %0, %2 ]
%8 = phi i32 [ %65, %6 ], [ 0, %2 ]
%9 = getelementptr inbounds i32, i32* %7, i64 1
%10 = bitcast i32* %7 to i8*
%11 = load i8, i8* %10
%12 = getelementptr inbounds i8, i8* %10, i64 1
%13 = load i8, i8* %12
%14 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 zeroext %11, i8 zeroext %13)
%15 = tail call i32 @putchar(i8 signext 32)
%16 = getelementptr inbounds i32, i32* %7, i64 2
%17 = bitcast i32* %9 to i8*
%18 = load i8, i8* %17
%19 = getelementptr inbounds i8, i8* %17, i64 1
%20 = load i8, i8* %19
%21 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 zeroext %18, i8 zeroext %20)
%22 = tail call i32 @putchar(i8 signext 32)
%23 = getelementptr inbounds i32, i32* %7, i64 3
%24 = bitcast i32* %16 to i8*
%25 = load i8, i8* %24
%26 = getelementptr inbounds i8, i8* %24, i64 1
%27 = load i8, i8* %26
%28 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 zeroext %25, i8 zeroext %27)
%29 = tail call i32 @putchar(i8 signext 32)
%30 = getelementptr inbounds i32, i32* %7, i64 4
%31 = bitcast i32* %23 to i8*
%32 = load i8, i8* %31
%33 = getelementptr inbounds i8, i8* %31, i64 1
%34 = load i8, i8* %33
%35 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 zeroext %32, i8 zeroext %34)
%36 = tail call i32 @putchar(i8 signext 32)
%37 = getelementptr inbounds i32, i32* %7, i64 5
%38 = bitcast i32* %30 to i8*
%39 = load i8, i8* %38
%40 = getelementptr inbounds i8, i8* %38, i64 1
%41 = load i8, i8* %40
%42 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 zeroext %39, i8 zeroext %41)
%43 = tail call i32 @putchar(i8 signext 32)
%44 = getelementptr inbounds i32, i32* %7, i64 6
%45 = bitcast i32* %37 to i8*
%46 = load i8, i8* %45
%47 = getelementptr inbounds i8, i8* %45, i64 1
%48 = load i8, i8* %47
%49 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 zeroext %46, i8 zeroext %48)
%50 = tail call i32 @putchar(i8 signext 32)
%51 = getelementptr inbounds i32, i32* %7, i64 7
%52 = bitcast i32* %44 to i8*
%53 = load i8, i8* %52
%54 = getelementptr inbounds i8, i8* %52, i64 1
%55 = load i8, i8* %54
%56 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 zeroext %53, i8 zeroext %55)
%57 = tail call i32 @putchar(i8 signext 32)
%58 = getelementptr inbounds i32, i32* %7, i64 8
%59 = bitcast i32* %51 to i8*
%60 = load i8, i8* %59
%61 = getelementptr inbounds i8, i8* %59, i64 1
%62 = load i8, i8* %61
%63 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 zeroext %60, i8 zeroext %62)
%64 = tail call i32 @putchar(i8 signext 10)
%65 = add nuw nsw i32 %8, 1
%66 = icmp eq i32 %65, %4
br i1 %66, label %67, label %6
67: ; preds = %6, %2
ret void
}