#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*/ ft_putchar(char);
int /*<<< orphan*/ ft_putnbr_16_base(char);
void ft_putstr_non_printable(char *str) {
  while (str[0]) {
    if (str[0] <= 31) {
      ft_putchar('\\');
      ft_putnbr_16_base(str[0]);
    } else
      ft_putchar(str[0]);
    str++;
  }
}


x86 assembly (clang, -O0):
<ft_putstr_non_printable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1181 <ft_putstr_non_printable+0x61>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x1f,%eax
jg     1164 <ft_putstr_non_printable+0x44>
mov    $0x5c,%edi
call   1040 <ft_putchar@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <ft_putnbr_16_base@plt>
jmp    1170 <ft_putstr_non_printable+0x50>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <ft_putchar@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    112c <ft_putstr_non_printable+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putstr_non_printable>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     115c <ft_putstr_non_printable+0x3c>
mov    %rdi,%rbx
add    $0x1,%rbx
jmp    1143 <ft_putstr_non_printable+0x23>
movsbl %al,%edi
call   1040 <ft_putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     115c <ft_putstr_non_printable+0x3c>
cmp    $0x1f,%al
jg     1130 <ft_putstr_non_printable+0x10>
mov    $0x5c,%edi
call   1040 <ft_putchar@plt>
movsbl -0x1(%rbx),%edi
call   1030 <ft_putnbr_16_base@plt>
jmp    1138 <ft_putstr_non_printable+0x18>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @ft_putstr_non_printable(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %18, label %4
4: ; preds = %1, %14
%5 = phi i8 [ %16, %14 ], [ %2, %1 ]
%6 = phi i8* [ %15, %14 ], [ %0, %1 ]
%7 = icmp slt i8 %5, 32
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = tail call i32 @ft_putchar(i8 signext 92)
%10 = load i8, i8* %6
%11 = tail call i32 @ft_putnbr_16_base(i8 signext %10)
br label %14
12: ; preds = %4
%13 = tail call i32 @ft_putchar(i8 signext %5)
br label %14
14: ; preds = %12, %8
%15 = getelementptr inbounds i8, i8* %6, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %4
18: ; preds = %14, %1
ret void
}