#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*/ fputs(char *, int /*<<< orphan*/);
scalar_t__ isprint(char);
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stdout;
void showblock(char *p) {
  int i;
  putchar('"');
  for (i = 0; i < 16; i++, p++)
    if (isprint(*p))
      putchar(*p);
    else
      printf("\\x%02hhx", *p);
  fputs("\";\n", stdout);
}


x86 assembly (clang, -O0):
<showblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x22,%edi
call   1030 <putchar@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    11c0 <showblock+0x80>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1060 <isprint@plt>
cmp    $0x0,%rax
je     118e <showblock+0x4e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
jmp    11a1 <showblock+0x61>
mov    -0x8(%rbp),%rax
lea    0xe67(%rip),%rdi
movsbl (%rax),%esi
call   1040 <printf@plt>
jmp    11a6 <showblock+0x66>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    115d <showblock+0x1d>
mov    0x2e19(%rip),%rax
mov    (%rax),%esi
lea    0xe39(%rip),%rdi
call   1050 <fputs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showblock>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    $0x22,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
lea    0xea5(%rip),%r14
jmp    1174 <showblock+0x34>
nopl   (%rax)
movsbl %cl,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x10,%ebx
je     1192 <showblock+0x52>
movsbl (%r15,%rbx,1),%edi
call   1060 <isprint@plt>
movzbl (%r15,%rbx,1),%ecx
test   %rax,%rax
je     1160 <showblock+0x20>
movsbl %cl,%edi
call   1030 <putchar@plt>
jmp    116b <showblock+0x2b>
mov    0x2e47(%rip),%rax
mov    (%rax),%esi
lea    0xe67(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <fputs@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"\\x%02hhx\00"
@.str.1 = [4 x i8] c"\22;\0A\00"
@stdout = global i32 0
define void @showblock(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i32 @putchar(i8 signext 34)
store i32 0, i32* %3
br label %5
5: ; preds = %22, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 16
br i1 %7, label %8, label %27
8: ; preds = %5
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = call i64 @isprint(i8 signext %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %8
%14 = load i8*, i8** %2
%15 = load i8, i8* %14
%16 = call i32 @putchar(i8 signext %15)
br label %21
17: ; preds = %8
%18 = load i8*, i8** %2
%19 = load i8, i8* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 signext %19)
br label %21
21: ; preds = %17, %13
br label %22
22: ; preds = %21
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
%25 = load i8*, i8** %2
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %2
br label %5
27: ; preds = %5
%28 = load i32, i32* @stdout
%29 = call i32 @fputs(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
ret void
}

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