#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*/ printf(char *, ...);
void dumpOB(unsigned char *c, long vm) {
  long index = 0;
  while (index < vm) {
    printf("%02x ", *(c++));
    if ((++index) % 8 == 0)
      printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<dumpOB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1189 <dumpOB+0x79>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%esi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    $0x8,%ecx
cqto
idiv   %rcx
cmp    $0x0,%rdx
jne    1184 <dumpOB+0x74>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1128 <dumpOB+0x18>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumpOB>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
jle    1183 <dumpOB+0x63>
mov    %rsi,%r12
mov    %rdi,%r14
neg    %r12
mov    $0x1,%ebx
lea    0xebe(%rip),%r15
jmp    1162 <dumpOB+0x42>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%r12,%rbx,1),%rax
add    $0x1,%rax
add    $0x1,%rbx
cmp    $0x1,%rax
je     1183 <dumpOB+0x63>
movzbl -0x1(%r14,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   $0x7,%bl
jne    1150 <dumpOB+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1150 <dumpOB+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

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