#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*/ isprint(int);
scalar_t__ isspace(int);
void auth_sanitize(char *s) {
  while (*s) {
    if (isspace((int)(*s)) || !isprint((int)(*s))) {
      *s = '_';
    }
    s++;
  }
}


x86 assembly (clang, -O0):
<auth_sanitize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     117c <auth_sanitize+0x5c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
jne    1164 <auth_sanitize+0x44>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isprint@plt>
cmp    $0x0,%eax
jne    116b <auth_sanitize+0x4b>
mov    -0x8(%rbp),%rax
movb   $0x5f,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    112c <auth_sanitize+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<auth_sanitize>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     115a <auth_sanitize+0x3a>
mov    %rdi,%rbx
jmp    113f <auth_sanitize+0x1f>
nopl   0x0(%rax)
movb   $0x5f,(%rbx)
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     115a <auth_sanitize+0x3a>
movsbl %al,%edi
call   1030 <isspace@plt>
test   %rax,%rax
jne    1130 <auth_sanitize+0x10>
movsbl (%rbx),%edi
call   1040 <isprint@plt>
test   %eax,%eax
jne    1133 <auth_sanitize+0x13>
jmp    1130 <auth_sanitize+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @auth_sanitize(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %21, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %24
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = call i64 @isspace(i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %19, label %13
13: ; preds = %7
%14 = load i8*, i8** %2
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = call i32 @isprint(i32 %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %13, %7
%20 = load i8*, i8** %2
store i8 95, i8* %20
br label %21
21: ; preds = %19, %13
%22 = load i8*, i8** %2
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %2
br label %3
24: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @auth_sanitize(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %20, label %4
4: ; preds = %1, %16
%5 = phi i8 [ %18, %16 ], [ %2, %1 ]
%6 = phi i8* [ %17, %16 ], [ %0, %1 ]
%7 = sext i8 %5 to i32
%8 = tail call i64 @isspace(i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %4
%11 = load i8, i8* %6
%12 = sext i8 %11 to i32
%13 = tail call i32 @isprint(i32 %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %10, %4
store i8 95, i8* %6
br label %16
16: ; preds = %15, %10
%17 = getelementptr inbounds i8, i8* %6, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %4
20: ; preds = %16, %1
ret void
}