#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*/ DEBUG(char *);
scalar_t__ isprint(char);
void strip_unprint(char *string, char *dest) {
  char *a, *b;
  DEBUG("strip_unprint");
  for (a = string, b = dest; *a; a++)
    if (isprint(*a)) {
      *b = *a;
      b++;
    }
  *b = 0;
}


x86 assembly (clang, -O0):
<strip_unprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec9(%rip),%rdi
call   1030 <DEBUG@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     119d <strip_unprint+0x7d>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isprint@plt>
cmp    $0x0,%rax
je     1187 <strip_unprint+0x67>
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    118c <strip_unprint+0x6c>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    114c <strip_unprint+0x2c>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strip_unprint>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rdi
call   1030 <DEBUG@plt>
mov    (%rbx),%al
test   %al,%al
je     1175 <strip_unprint+0x55>
add    $0x1,%rbx
jmp    115b <strip_unprint+0x3b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1175 <strip_unprint+0x55>
movsbl %al,%edi
call   1040 <isprint@plt>
test   %rax,%rax
je     1150 <strip_unprint+0x30>
movzbl -0x1(%rbx),%eax
mov    %al,(%r14)
add    $0x1,%r14
jmp    1150 <strip_unprint+0x30>
movb   $0x0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"strip_unprint\00"
define void @strip_unprint(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = tail call i32 @DEBUG(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %20, label %6
6: ; preds = %2, %15
%7 = phi i8 [ %18, %15 ], [ %4, %2 ]
%8 = phi i8* [ %16, %15 ], [ %1, %2 ]
%9 = phi i8* [ %17, %15 ], [ %0, %2 ]
%10 = tail call i64 @isprint(i8 signext %7)
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %6
%13 = load i8, i8* %9
store i8 %13, i8* %8
%14 = getelementptr inbounds i8, i8* %8, i64 1
br label %15
15: ; preds = %6, %12
%16 = phi i8* [ %14, %12 ], [ %8, %6 ]
%17 = getelementptr inbounds i8, i8* %9, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %6
20: ; preds = %15, %2
%21 = phi i8* [ %1, %2 ], [ %16, %15 ]
store i8 0, i8* %21
ret void
}