#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 OLE_object {
  int dummy;
};

/* Variables and functions */
scalar_t__ isalnum(char);
int /*<<< orphan*/ printf(char *, ...);
int OLE_print_sector(struct OLE_object *ole, char *sector, unsigned int bytes) {
  int current_byte;
  int ubytes = bytes;
  printf("\n");
  for (current_byte = 0; current_byte < ubytes; current_byte++) {
    printf("%02X ", *(sector + current_byte));
    if (((current_byte + 1) % 32) == 0) {
      int j;
      for (j = current_byte - 31; j <= current_byte; j++) {
        if (isalnum(*(sector + j)))
          printf("%c", *(sector + j));
        else
          printf(".");
      }
      printf("\n");
    }
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<OLE_print_sector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    121c <OLE_print_sector+0xfc>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1209 <OLE_print_sector+0xe9>
mov    -0x18(%rbp),%eax
sub    $0x1f,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11fb <OLE_print_sector+0xdb>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isalnum@plt>
cmp    $0x0,%rax
je     11da <OLE_print_sector+0xba>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e8 <OLE_print_sector+0xc8>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ed <OLE_print_sector+0xcd>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1194 <OLE_print_sector+0x74>
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120e <OLE_print_sector+0xee>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114e <OLE_print_sector+0x2e>
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OLE_print_sector>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%r15
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %ebp,%ebp
jle    11c5 <OLE_print_sector+0x95>
mov    %ebp,%r12d
lea    0xea8(%rip),%r14
mov    %r15,%rbx
xor    %r13d,%r13d
jmp    1173 <OLE_print_sector+0x43>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %r12,%r13
je     11c5 <OLE_print_sector+0x95>
movsbl (%r15,%r13,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r13
test   $0x1f,%r13b
jne    116a <OLE_print_sector+0x3a>
mov    $0xffffffffffffffe0,%rbp
jmp    11af <OLE_print_sector+0x7f>
cs nopw 0x0(%rax,%rax,1)
nop
movsbl 0x1(%rbx,%rbp,1),%edi
call   1030 <putchar@plt>
inc    %rbp
je     1160 <OLE_print_sector+0x30>
movsbl 0x1(%rbx,%rbp,1),%edi
call   1050 <isalnum@plt>
test   %rax,%rax
jne    11a0 <OLE_print_sector+0x70>
mov    $0x2e,%edi
jmp    11a5 <OLE_print_sector+0x75>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.OLE_object = type { i32 }
@.str = [2 x i8] c"\0A\00"
@.str.1 = [6 x i8] c"%02X \00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [2 x i8] c".\00"
define i32 @OLE_print_sector(%struct.OLE_object* %0, i8* %1, i32 %2) {
%4 = alloca %struct.OLE_object*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store %struct.OLE_object* %0, %struct.OLE_object** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%10 = load i32, i32* %6
store i32 %10, i32* %8
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %12
12: ; preds = %60, %3
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %63
16: ; preds = %12
%17 = load i8*, i8** %5
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
%26 = srem i32 %25, 32
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %59
28: ; preds = %16
%29 = load i32, i32* %7
%30 = sub nsw i32 %29, 31
store i32 %30, i32* %9
br label %31
31: ; preds = %54, %28
%32 = load i32, i32* %9
%33 = load i32, i32* %7
%34 = icmp sle i32 %32, %33
br i1 %34, label %35, label %57
35: ; preds = %31
%36 = load i8*, i8** %5
%37 = load i32, i32* %9
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
%40 = load i8, i8* %39
%41 = call i64 @isalnum(i8 signext %40)
%42 = icmp ne i64 %41, 0
br i1 %42, label %43, label %51
43: ; preds = %35
%44 = load i8*, i8** %5
%45 = load i32, i32* %9
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %49)
br label %53
51: ; preds = %35
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %53
53: ; preds = %51, %43
br label %54
54: ; preds = %53
%55 = load i32, i32* %9
%56 = add nsw i32 %55, 1
store i32 %56, i32* %9
br label %31
57: ; preds = %31
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %59
59: ; preds = %57, %16
br label %60
60: ; preds = %59
%61 = load i32, i32* %7
%62 = add nsw i32 %61, 1
store i32 %62, i32* %7
br label %12
63: ; preds = %12
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.OLE_object = type { i32 }
@.str.1 = [6 x i8] c"%02X \00"
define i32 @OLE_print_sector(%struct.OLE_object* nocapture readnone %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @putchar(i32 10)
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %39
6: ; preds = %3
%7 = zext i32 %2 to i64
br label %8
8: ; preds = %6, %35
%9 = phi i64 [ 0, %6 ], [ %16, %35 ]
%10 = phi i64 [ 1, %6 ], [ %37, %35 ]
%11 = phi i64 [ -31, %6 ], [ %36, %35 ]
%12 = getelementptr inbounds i8, i8* %1, i64 %9
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = add nuw nsw i64 %9, 1
%17 = and i64 %16, 31
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %35
19: ; preds = %8, %28
%20 = phi i64 [ %31, %28 ], [ %11, %8 ]
%21 = getelementptr inbounds i8, i8* %1, i64 %20
%22 = load i8, i8* %21
%23 = tail call i64 @isalnum(i8 signext %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %19
%26 = load i8, i8* %21
%27 = sext i8 %26 to i32
br label %28
28: ; preds = %19, %25
%29 = phi i32 [ %27, %25 ], [ 46, %19 ]
%30 = tail call i32 @putchar(i32 %29)
%31 = add nsw i64 %20, 1
%32 = icmp eq i64 %31, %10
br i1 %32, label %33, label %19
33: ; preds = %28
%34 = tail call i32 @putchar(i32 10)
br label %35
35: ; preds = %8, %33
%36 = add nsw i64 %11, 1
%37 = add nuw nsw i64 %10, 1
%38 = icmp eq i64 %16, %7
br i1 %38, label %39, label %8
39: ; preds = %35, %3
%40 = tail call i32 @putchar(i32 10)
ret i32 0
}