#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 */
scalar_t__ isascii(char);
scalar_t__ isgraph(char);
int /*<<< orphan*/ printf(char *, unsigned char);
int /*<<< orphan*/ putchar(char);
void dumpblock(char *s, unsigned long long n) {
  unsigned long long i;
  for (i = 0; i < n; i++, s++) {
    if (i % 32 == 31)
      putchar('\n');
    if (isascii(*s) && (isgraph(*s) || *s == ' ')) {
      putchar(*s);
      putchar(' ');
    } else
      printf("%2.2x", (unsigned char)*s);
  }
  if (i % 32 != 0)
    putchar('\n');
}


x86 assembly (clang, -O0):
<dumpblock>:
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
jae    120e <dumpblock+0xce>
mov    -0x18(%rbp),%rax
and    $0x1f,%rax
cmp    $0x1f,%rax
jne    1182 <dumpblock+0x42>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isascii@plt>
cmp    $0x0,%rax
je     11d9 <dumpblock+0x99>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1060 <isgraph@plt>
cmp    $0x0,%rax
jne    11be <dumpblock+0x7e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    11d9 <dumpblock+0x99>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    11ec <dumpblock+0xac>
mov    -0x8(%rbp),%rax
lea    0xe1c(%rip),%rdi
movzbl (%rax),%esi
call   1040 <printf@plt>
jmp    11f1 <dumpblock+0xb1>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1158 <dumpblock+0x18>
mov    -0x18(%rbp),%rax
and    $0x1f,%rax
cmp    $0x0,%rax
je     122a <dumpblock+0xea>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumpblock>:
test   %rsi,%rsi
je     11f7 <dumpblock+0xb7>
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
xor    %ebx,%ebx
lea    0xea0(%rip),%r15
jmp    1184 <dumpblock+0x44>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl %cl,%esi
mov    %r15,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
je     11db <dumpblock+0x9b>
mov    %ebx,%eax
not    %eax
test   $0x1f,%al
jne    1196 <dumpblock+0x56>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsbl (%r12,%rbx,1),%edi
call   1050 <isascii@plt>
movzbl (%r12,%rbx,1),%ecx
test   %rax,%rax
je     1170 <dumpblock+0x30>
movsbl %cl,%edi
call   1060 <isgraph@plt>
movzbl (%r12,%rbx,1),%ecx
test   %rax,%rax
je     11c0 <dumpblock+0x80>
mov    %ecx,%eax
jmp    11c7 <dumpblock+0x87>
mov    $0x20,%al
cmp    $0x20,%cl
jne    1170 <dumpblock+0x30>
movsbl %al,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    117b <dumpblock+0x3b>
test   $0x1f,%r14b
lea    0x8(%rsp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
je     11f7 <dumpblock+0xb7>
mov    $0xa,%edi
jmp    1030 <putchar@plt>
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%2.2x\00"
define void @dumpblock(i8* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %38, label %4
4: ; preds = %2, %29
%5 = phi i64 [ %30, %29 ], [ 0, %2 ]
%6 = phi i8* [ %31, %29 ], [ %0, %2 ]
%7 = and i64 %5, 31
%8 = icmp eq i64 %7, 31
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 @putchar(i8 signext 10)
br label %11
11: ; preds = %9, %4
%12 = load i8, i8* %6
%13 = tail call i64 @isascii(i8 signext %12)
%14 = icmp eq i64 %13, 0
%15 = load i8, i8* %6
br i1 %14, label %26, label %16
16: ; preds = %11
%17 = tail call i64 @isgraph(i8 signext %15)
%18 = icmp eq i64 %17, 0
%19 = load i8, i8* %6
br i1 %18, label %20, label %22
20: ; preds = %16
%21 = icmp eq i8 %19, 32
br i1 %21, label %22, label %26
22: ; preds = %16, %20
%23 = phi i8 [ 32, %20 ], [ %19, %16 ]
%24 = tail call i32 @putchar(i8 signext %23)
%25 = tail call i32 @putchar(i8 signext 32)
br label %29
26: ; preds = %11, %20
%27 = phi i8 [ %19, %20 ], [ %15, %11 ]
%28 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 zeroext %27)
br label %29
29: ; preds = %22, %26
%30 = add nuw i64 %5, 1
%31 = getelementptr inbounds i8, i8* %6, i64 1
%32 = icmp eq i64 %30, %1
br i1 %32, label %33, label %4
33: ; preds = %29
%34 = and i64 %1, 31
%35 = icmp eq i64 %34, 0
br i1 %35, label %38, label %36
36: ; preds = %33
%37 = tail call i32 @putchar(i8 signext 10)
br label %38
38: ; preds = %2, %36, %33
ret void
}