#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_printb16(char);
int /*<<< orphan*/ my_putchar(char);
int my_showstr(char *str) {
  int lp;
  lp = 0;
  while (str[lp] != '\0') {
    if (str[lp] < 32) {
      my_putchar('\\');
      if (str[lp] < 16)
        my_putchar('0');
      if (str[lp] % 16 > 9)
        my_printb16(str[lp]);
      else
        my_putchar((str[lp] % 16) + 48);
    } else
      my_putchar(str[lp]);
    ++lp;
  }
  my_putchar('\n');
  return (0);
}


x86 assembly (clang, -O0):
<my_showstr>:
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     11fe <my_showstr+0xde>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jge    11df <my_showstr+0xbf>
mov    $0x5c,%edi
call   1040 <my_putchar@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x10,%eax
jge    1186 <my_showstr+0x66>
mov    $0x30,%edi
call   1040 <my_putchar@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0x9,%edx
jle    11b9 <my_showstr+0x99>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <my_printb16@plt>
jmp    11da <my_showstr+0xba>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
movsbl %al,%edi
call   1040 <my_putchar@plt>
jmp    11f0 <my_showstr+0xd0>
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_showstr+0x13>
mov    $0xa,%edi
call   1040 <my_putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_showstr>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1198 <my_showstr+0x78>
mov    %rdi,%rbx
jmp    1144 <my_showstr+0x24>
nopl   0x0(%rax)
movsbl %al,%edi
call   1040 <my_putchar@plt>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1198 <my_showstr+0x78>
cmp    $0x1f,%al
jg     1130 <my_showstr+0x10>
mov    $0x5c,%edi
call   1040 <my_putchar@plt>
movzbl (%rbx),%eax
cmp    $0xf,%al
jg     1166 <my_showstr+0x46>
mov    $0x30,%edi
call   1040 <my_putchar@plt>
movzbl (%rbx),%eax
mov    %eax,%edx
sar    $0x7,%dl
shr    $0x4,%dl
add    %al,%dl
and    $0xf0,%dl
mov    %eax,%ecx
sub    %dl,%cl
cmp    $0xa,%cl
jl     1190 <my_showstr+0x70>
movsbl %al,%edi
call   1030 <my_printb16@plt>
jmp    1138 <my_showstr+0x18>
cs nopw 0x0(%rax,%rax,1)
add    $0x30,%cl
movsbl %cl,%edi
jmp    1133 <my_showstr+0x13>
mov    $0xa,%edi
call   1040 <my_putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @my_showstr(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %66, %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 %69
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 %20, label %59
20: ; preds = %12
%21 = call i32 @my_putchar(i8 signext 92)
%22 = load i8*, i8** %2
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp slt i32 %27, 16
br i1 %28, label %29, label %31
29: ; preds = %20
%30 = call i32 @my_putchar(i8 signext 48)
br label %31
31: ; preds = %29, %20
%32 = load i8*, i8** %2
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = srem i32 %37, 16
%39 = icmp sgt i32 %38, 9
br i1 %39, label %40, label %47
40: ; preds = %31
%41 = load i8*, i8** %2
%42 = load i32, i32* %3
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %41, i64 %43
%45 = load i8, i8* %44
%46 = call i32 @my_printb16(i8 signext %45)
br label %58
47: ; preds = %31
%48 = load i8*, i8** %2
%49 = load i32, i32* %3
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %48, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = srem i32 %53, 16
%55 = add nsw i32 %54, 48
%56 = trunc i32 %55 to i8
%57 = call i32 @my_putchar(i8 signext %56)
br label %58
58: ; preds = %47, %40
br label %66
59: ; preds = %12
%60 = load i8*, i8** %2
%61 = load i32, i32* %3
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8, i8* %60, i64 %62
%64 = load i8, i8* %63
%65 = call i32 @my_putchar(i8 signext %64)
br label %66
66: ; preds = %59, %58
%67 = load i32, i32* %3
%68 = add nsw i32 %67, 1
store i32 %68, i32* %3
br label %4
69: ; preds = %4
%70 = call i32 @my_putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
define i32 @my_showstr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %32, label %4
4: ; preds = %1, %27
%5 = phi i64 [ %28, %27 ], [ 0, %1 ]
%6 = phi i8 [ %30, %27 ], [ %2, %1 ]
%7 = phi i8* [ %29, %27 ], [ %0, %1 ]
%8 = icmp slt i8 %6, 32
br i1 %8, label %9, label %25
9: ; preds = %4
%10 = tail call i32 @my_putchar(i8 signext 92)
%11 = load i8, i8* %7
%12 = icmp slt i8 %11, 16
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = tail call i32 @my_putchar(i8 signext 48)
%15 = load i8, i8* %7
br label %16
16: ; preds = %13, %9
%17 = phi i8 [ %15, %13 ], [ %11, %9 ]
%18 = srem i8 %17, 16
%19 = icmp sgt i8 %18, 9
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = tail call i32 @my_printb16(i8 signext %17)
br label %27
22: ; preds = %16
%23 = add nsw i8 %18, 48
%24 = tail call i32 @my_putchar(i8 signext %23)
br label %27
25: ; preds = %4
%26 = tail call i32 @my_putchar(i8 signext %6)
br label %27
27: ; preds = %20, %22, %25
%28 = add nuw i64 %5, 1
%29 = getelementptr inbounds i8, i8* %0, i64 %28
%30 = load i8, i8* %29
%31 = icmp eq i8 %30, 0
br i1 %31, label %32, label %4
32: ; preds = %27, %1
%33 = tail call i32 @my_putchar(i8 signext 10)
ret i32 0
}