#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 present(char);
int /*<<< orphan*/ putchar(int);
void printname(char *name) {
  int c, q = present('q');
  while ((c = (unsigned char)*name++) != 0) {
    if (q && (c <= ' ' || c == 0177))
      c = '?';
    putchar(c);
  }
}


x86 assembly (clang, -O0):
<printname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x71,%edi
call   1040 <present@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%eax
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
je     1189 <printname+0x69>
cmpl   $0x0,-0x10(%rbp)
je     117c <printname+0x5c>
cmpl   $0x20,-0xc(%rbp)
jle    1175 <printname+0x55>
cmpl   $0x7f,-0xc(%rbp)
jne    117c <printname+0x5c>
movl   $0x3f,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <putchar@plt>
jmp    1139 <printname+0x19>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printname>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    $0x71,%edi
call   1040 <present@plt>
mov    %eax,%r14d
mov    (%rbx),%al
test   %al,%al
je     1175 <printname+0x55>
add    $0x1,%rbx
mov    $0x3f,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl %al,%eax
cmp    $0x7f,%al
mov    %eax,%edi
cmove  %ebp,%edi
cmp    $0x21,%al
cmovb  %ebp,%edi
test   %r14d,%r14d
cmove  %eax,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1150 <printname+0x30>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @printname(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i32 @present(i8 signext 113)
store i32 %5, i32* %4
br label %6
6: ; preds = %22, %1
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i32 1
store i8* %8, i8** %2
%9 = load i8, i8* %7
%10 = zext i8 %9 to i32
store i32 %10, i32* %3
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %25
12: ; preds = %6
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load i32, i32* %3
%17 = icmp sle i32 %16, 32
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, 127
br i1 %20, label %21, label %22
21: ; preds = %18, %15
store i32 63, i32* %3
br label %22
22: ; preds = %21, %18, %12
%23 = load i32, i32* %3
%24 = call i32 @putchar(i32 %23)
br label %6
25: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @printname(i8* nocapture %0) {
%2 = tail call i32 @present(i8 signext 113)
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %20, label %5
5: ; preds = %1
%6 = icmp eq i32 %2, 0
br label %7
7: ; preds = %5, %7
%8 = phi i8 [ %3, %5 ], [ %18, %7 ]
%9 = phi i8* [ %0, %5 ], [ %11, %7 ]
%10 = zext i8 %8 to i32
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = icmp ult i8 %8, 33
%13 = icmp eq i8 %8, 127
%14 = or i1 %12, %13
%15 = select i1 %14, i32 63, i32 %10
%16 = select i1 %6, i32 %10, i32 %15
%17 = tail call i32 @putchar(i32 %16)
%18 = load i8, i8* %11
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %7
20: ; preds = %7, %1
ret void
}