#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*/ my_put_nbrbase(char, char *);
int /*<<< orphan*/ my_putchar(char);
void my_put_nistr(char *str) {
  int i;
  i = 0;
  while (str[i] != '\0') {
    if (str[i] < 32 || str[i] >= 127) {
      my_putchar('\\');
      my_put_nbrbase(str[i], "01234567");
    } else
      my_putchar(str[i]);
    i++;
  }
}


x86 assembly (clang, -O0):
<my_put_nistr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11b8 <my_put_nistr+0x98>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jl     1172 <my_put_nistr+0x52>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7f,%eax
jl     1199 <my_put_nistr+0x79>
mov    $0x5c,%edi
call   1040 <my_putchar@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
lea    0xe75(%rip),%rsi
movsbl (%rax,%rcx,1),%edi
call   1030 <my_put_nbrbase@plt>
jmp    11aa <my_put_nistr+0x8a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <my_putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <my_put_nistr+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_put_nistr>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     1173 <my_put_nistr+0x53>
mov    %rdi,%rbx
add    $0x1,%rbx
lea    0xec8(%rip),%r14
jmp    1153 <my_put_nistr+0x33>
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1040 <my_putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1173 <my_put_nistr+0x53>
lea    -0x7f(%rax),%ecx
cmp    $0xa0,%cl
ja     1140 <my_put_nistr+0x20>
mov    $0x5c,%edi
call   1040 <my_putchar@plt>
movsbl -0x1(%rbx),%edi
mov    %r14,%rsi
call   1030 <my_put_nbrbase@plt>
jmp    1148 <my_put_nistr+0x28>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"01234567\00"
define void @my_put_nistr(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %43, %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %46
12: ; preds = %4
%13 = load i8*, i8** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp slt i32 %18, 32
br i1 %19, label %28, label %20
20: ; preds = %12
%21 = load i8*, i8** %2
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp sge i32 %26, 127
br i1 %27, label %28, label %36
28: ; preds = %20, %12
%29 = call i32 @my_putchar(i8 signext 92)
%30 = load i8*, i8** %2
%31 = load i32, i32* %3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = call i32 @my_put_nbrbase(i8 signext %34, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %43
36: ; preds = %20
%37 = load i8*, i8** %2
%38 = load i32, i32* %3
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
%41 = load i8, i8* %40
%42 = call i32 @my_putchar(i8 signext %41)
br label %43
43: ; preds = %36, %28
%44 = load i32, i32* %3
%45 = add nsw i32 %44, 1
store i32 %45, i32* %3
br label %4
46: ; preds = %4
ret void
}

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