#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 */
scalar_t__ strchr(char *, char);
char *showall(char *s) {
  static char t[512];
  char *pt;
  pt = t;
  if (strchr(s, '\\') == 0)
    return s;
  while (*s) {
    if (*s == '\\') {
      *pt++ = *s;
    }
    *pt++ = *s++;
  }
  return pt;
}


x86 assembly (clang, -O0):
<showall>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    0x2f1d(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x5c,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
jne    114c <showall+0x3c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11b4 <showall+0xa4>
jmp    1151 <showall+0x41>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11ac <showall+0x9c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    1185 <showall+0x75>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    1151 <showall+0x41>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showall>:
push   %rbx
mov    %rdi,%rbx
mov    $0x5c,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1152 <showall+0x42>
lea    0x2f16(%rip),%rax
jmp    1144 <showall+0x34>
nopl   0x0(%rax)
movb   $0x5c,(%rax)
add    $0x1,%rax
movzbl (%rbx),%ecx
add    $0x1,%rbx
mov    %cl,(%rax)
add    $0x1,%rax
movzbl (%rbx),%ecx
cmp    $0x5c,%cl
je     1130 <showall+0x20>
test   %cl,%cl
jne    113a <showall+0x2a>
pop    %rbx
ret
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@showall.t = internal global [512 x i8] zeroinitializer
define i8* @showall(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* getelementptr inbounds ([512 x i8], [512 x i8]* @showall.t, i64 0, i64 0), i8** %4
%5 = load i8*, i8** %3
%6 = call i64 @strchr(i8* %5, i8 signext 92)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i8*, i8** %3
store i8* %9, i8** %2
br label %33
10: ; preds = %1
br label %11
11: ; preds = %25, %10
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, 0
br i1 %14, label %15, label %31
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 92
br i1 %19, label %20, label %25
20: ; preds = %15
%21 = load i8*, i8** %3
%22 = load i8, i8* %21
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %4
store i8 %22, i8* %23
br label %25
25: ; preds = %20, %15
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %3
%28 = load i8, i8* %26
%29 = load i8*, i8** %4
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %4
store i8 %28, i8* %29
br label %11
31: ; preds = %11
%32 = load i8*, i8** %4
store i8* %32, i8** %2
br label %33
33: ; preds = %31, %8
%34 = load i8*, i8** %2
ret i8* %34
}

LLVM IR (-O2):
@showall.t = internal global [512 x i8] zeroinitializer
define i8* @showall(i8* %0) {
%2 = tail call i64 @strchr(i8* %0, i8 signext 92)
%3 = icmp eq i64 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %11
%5 = phi i8* [ %14, %11 ], [ %0, %1 ]
%6 = phi i8* [ %15, %11 ], [ getelementptr inbounds ([512 x i8], [512 x i8]* @showall.t, i64 0, i64 0), %1 ]
%7 = load i8, i8* %5
switch i8 %7, label %11 [
i8 0, label %16
i8 92, label %8
]
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %6, i64 1
store i8 92, i8* %6
%10 = load i8, i8* %5
br label %11
11: ; preds = %4, %8
%12 = phi i8 [ %10, %8 ], [ %7, %4 ]
%13 = phi i8* [ %9, %8 ], [ %6, %4 ]
%14 = getelementptr inbounds i8, i8* %5, i64 1
%15 = getelementptr inbounds i8, i8* %13, i64 1
store i8 %12, i8* %13
br label %4
16: ; preds = %4, %1
%17 = phi i8* [ %0, %1 ], [ %6, %4 ]
ret i8* %17
}