#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*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ msg(int, char *, ...);
void mfm_dump_bytes(uint8_t bytes[], int len, int cyl, int head,
                    int sector_index, int msg_level) {
  int i;
  msg(msg_level, "%4d %2d %2d:", cyl, head, sector_index);
  for (i = 0; i < len; i++) {
    msg(msg_level, "0x%02x,", bytes[i]);
    if (i % 16 == 15) {
      msg(msg_level, "\n");
    }
  }
  msg(msg_level, "\n");
}


x86 assembly (clang, -O0):
<mfm_dump_bytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    0xebf(%rip),%rsi
mov    $0x0,%al
call   1030 <msg@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11af <mfm_dump_bytes+0x9f>
mov    -0x1c(%rbp),%edi
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe9d(%rip),%rsi
mov    $0x0,%al
call   1030 <msg@plt>
mov    -0x20(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0xf,%edx
jne    119c <mfm_dump_bytes+0x8c>
mov    -0x1c(%rbp),%edi
lea    0xe80(%rip),%rsi
mov    $0x0,%al
call   1030 <msg@plt>
jmp    11a1 <mfm_dump_bytes+0x91>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114f <mfm_dump_bytes+0x3f>
mov    -0x1c(%rbp),%edi
lea    0xe5c(%rip),%rsi
mov    $0x0,%al
call   1030 <msg@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mfm_dump_bytes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
lea    0xed6(%rip),%rsi
mov    %r9d,%edi
xor    %eax,%eax
call   1030 <msg@plt>
test   %ebp,%ebp
jle    117f <mfm_dump_bytes+0x6f>
mov    %ebp,%r13d
lea    0xecb(%rip),%r15
lea    0xecc(%rip),%r12
xor    %ebp,%ebp
jmp    1159 <mfm_dump_bytes+0x49>
nopl   (%rax)
add    $0x1,%rbp
cmp    %rbp,%r13
je     117f <mfm_dump_bytes+0x6f>
mov    (%r14,%rbp,4),%edx
mov    %ebx,%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <msg@plt>
mov    %ebp,%eax
not    %eax
test   $0xf,%al
jne    1150 <mfm_dump_bytes+0x40>
mov    %ebx,%edi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <msg@plt>
jmp    1150 <mfm_dump_bytes+0x40>
lea    0xe8f(%rip),%rsi
mov    %ebx,%edi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <msg@plt>

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

LLVM IR (-O2):
@.str = [13 x i8] c"%4d %2d %2d:\00"
@.str.1 = [8 x i8] c"0x%02x,\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @mfm_dump_bytes(i32* nocapture %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 (i32, i8*, ...) @msg(i32 %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3, i32 %4)
%8 = icmp sgt i32 %1, 0
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = zext i32 %1 to i64
br label %11
11: ; preds = %9, %20
%12 = phi i64 [ 0, %9 ], [ %21, %20 ]
%13 = getelementptr inbounds i32, i32* %0, i64 %12
%14 = load i32, i32* %13
%15 = tail call i32 (i32, i8*, ...) @msg(i32 %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = and i64 %12, 15
%17 = icmp eq i64 %16, 15
br i1 %17, label %18, label %20
18: ; preds = %11
%19 = tail call i32 (i32, i8*, ...) @msg(i32 %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %11, %18
%21 = add nuw nsw i64 %12, 1
%22 = icmp eq i64 %21, %10
br i1 %22, label %23, label %11
23: ; preds = %20, %6
%24 = tail call i32 (i32, i8*, ...) @msg(i32 %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}