#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 le16toh(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
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) {
      printf("%04x", le16toh(w[0]));
      ++w;
      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    11cc <dump_sectors+0x9c>
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    11b9 <dump_sectors+0x89>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1050 <le16toh@plt>
mov    %eax,%esi
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
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    1161 <dump_sectors+0x31>
jmp    11be <dump_sectors+0x8e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1146 <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     123c <dump_sectors+0x10c>
mov    %rdi,%rbx
lea    0xeb1(%rip),%r14
nop
mov    (%rbx),%edi
call   1050 <le16toh@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x4(%rbx),%edi
call   1050 <le16toh@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x8(%rbx),%edi
call   1050 <le16toh@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0xc(%rbx),%edi
call   1050 <le16toh@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x10(%rbx),%edi
call   1050 <le16toh@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x14(%rbx),%edi
call   1050 <le16toh@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x18(%rbx),%edi
call   1050 <le16toh@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x1c(%rbx),%edi
call   1050 <le16toh@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rbx
add    $0xffffffff,%ebp
jne    1150 <dump_sectors+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%04x\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 %51, label %6
6: ; preds = %2, %6
%7 = phi i32 [ %49, %6 ], [ 0, %2 ]
%8 = phi i32* [ %47, %6 ], [ %0, %2 ]
%9 = load i32, i32* %8
%10 = tail call i32 @le16toh(i32 %9)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds i32, i32* %8, i64 1
%13 = tail call i32 @putchar(i8 signext 32)
%14 = load i32, i32* %12
%15 = tail call i32 @le16toh(i32 %14)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds i32, i32* %8, i64 2
%18 = tail call i32 @putchar(i8 signext 32)
%19 = load i32, i32* %17
%20 = tail call i32 @le16toh(i32 %19)
%21 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds i32, i32* %8, i64 3
%23 = tail call i32 @putchar(i8 signext 32)
%24 = load i32, i32* %22
%25 = tail call i32 @le16toh(i32 %24)
%26 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds i32, i32* %8, i64 4
%28 = tail call i32 @putchar(i8 signext 32)
%29 = load i32, i32* %27
%30 = tail call i32 @le16toh(i32 %29)
%31 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds i32, i32* %8, i64 5
%33 = tail call i32 @putchar(i8 signext 32)
%34 = load i32, i32* %32
%35 = tail call i32 @le16toh(i32 %34)
%36 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %35)
%37 = getelementptr inbounds i32, i32* %8, i64 6
%38 = tail call i32 @putchar(i8 signext 32)
%39 = load i32, i32* %37
%40 = tail call i32 @le16toh(i32 %39)
%41 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %40)
%42 = getelementptr inbounds i32, i32* %8, i64 7
%43 = tail call i32 @putchar(i8 signext 32)
%44 = load i32, i32* %42
%45 = tail call i32 @le16toh(i32 %44)
%46 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %45)
%47 = getelementptr inbounds i32, i32* %8, i64 8
%48 = tail call i32 @putchar(i8 signext 10)
%49 = add nuw nsw i32 %7, 1
%50 = icmp eq i32 %49, %4
br i1 %50, label %51, label %6
51: ; preds = %6, %2
ret void
}