#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*/);
int /*<<< orphan*/ isgraph(int);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stdout;
void pp_idtext(char *prefix, unsigned char *p, size_t len) {
  int i;
  fputs(prefix, stdout);
  for (i = 0; i < len; ++i, ++p) {
    if (*p == '\0')
      break;
    if (!isgraph((int)*p) && *p != ' ')
      break;
    putchar(*p);
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<pp_idtext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e91(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11d0 <pp_idtext+0xa0>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
jne    1180 <pp_idtext+0x50>
jmp    11d0 <pp_idtext+0xa0>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1050 <isgraph@plt>
cmp    $0x0,%eax
jne    11aa <pp_idtext+0x7a>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x20,%eax
je     11aa <pp_idtext+0x7a>
jmp    11d0 <pp_idtext+0xa0>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    115d <pp_idtext+0x2d>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pp_idtext>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%r14
mov    0x2e9c(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
test   %r15,%r15
je     118c <pp_idtext+0x5c>
xor    %ebx,%ebx
jmp    1172 <pp_idtext+0x42>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %bpl,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
je     118c <pp_idtext+0x5c>
movzbl (%r14,%rbx,1),%ebp
test   %ebp,%ebp
je     118c <pp_idtext+0x5c>
mov    %ebp,%edi
call   1050 <isgraph@plt>
test   %eax,%eax
jne    1160 <pp_idtext+0x30>
cmp    $0x20,%bpl
je     1160 <pp_idtext+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @pp_idtext(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* @stdout
%10 = call i32 @fputs(i8* %8, i32 %9)
store i32 0, i32* %7
br label %11
11: ; preds = %38, %3
%12 = load i32, i32* %7
%13 = sext i32 %12 to i64
%14 = load i64, i64* %6
%15 = icmp ult i64 %13, %14
br i1 %15, label %16, label %43
16: ; preds = %11
%17 = load i8*, i8** %5
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %16
br label %43
22: ; preds = %16
%23 = load i8*, i8** %5
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = call i32 @isgraph(i32 %25)
%27 = icmp ne i32 %26, 0
br i1 %27, label %34, label %28
28: ; preds = %22
%29 = load i8*, i8** %5
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = icmp ne i32 %31, 32
br i1 %32, label %33, label %34
33: ; preds = %28
br label %43
34: ; preds = %28, %22
%35 = load i8*, i8** %5
%36 = load i8, i8* %35
%37 = call i32 @putchar(i8 signext %36)
br label %38
38: ; preds = %34
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
%41 = load i8*, i8** %5
%42 = getelementptr inbounds i8, i8* %41, i32 1
store i8* %42, i8** %5
br label %11
43: ; preds = %33, %21, %11
%44 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @pp_idtext(i8* %0, i8* nocapture %1, i64 %2) {
%4 = load i32, i32* @stdout
%5 = tail call i32 @fputs(i8* %0, i32 %4)
%6 = icmp eq i64 %2, 0
br i1 %6, label %23, label %7
7: ; preds = %3, %18
%8 = phi i64 [ %20, %18 ], [ 0, %3 ]
%9 = phi i8* [ %21, %18 ], [ %1, %3 ]
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %23, label %12
12: ; preds = %7
%13 = zext i8 %10 to i32
%14 = tail call i32 @isgraph(i32 %13)
%15 = icmp ne i32 %14, 0
%16 = icmp eq i8 %10, 32
%17 = select i1 %15, i1 true, i1 %16
br i1 %17, label %18, label %23
18: ; preds = %12
%19 = tail call i32 @putchar(i8 signext %10)
%20 = add nuw i64 %8, 1
%21 = getelementptr inbounds i8, i8* %9, i64 1
%22 = icmp eq i64 %20, %2
br i1 %22, label %23, label %7
23: ; preds = %18, %7, %12, %3
%24 = tail call i32 @putchar(i8 signext 10)
ret void
}