#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*/ printf(char *, char *);
int /*<<< orphan*/ putchar(int);
void Show(char *Msg, char *buf) {
  int c;
  printf("%s", Msg);
  while (*buf) {
    if ((c = *buf++) == 0x1c)
      putchar('|');
    else
      putchar(c);
  }
}


x86 assembly (clang, -O0):
<Show>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1187 <Show+0x67>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x1c,%eax
jne    117a <Show+0x5a>
mov    $0x7c,%edi
call   1030 <putchar@plt>
jmp    1182 <Show+0x62>
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
jmp    1140 <Show+0x20>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Show>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0xed0(%rip),%rdi
call   1040 <printf@plt>
mov    (%rbx),%al
test   %al,%al
je     116b <Show+0x4b>
add    $0x1,%rbx
mov    $0x7c,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x1c,%al
movzbl %al,%eax
cmove  %ebp,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1150 <Show+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @Show(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %23, %2
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %24
12: ; preds = %8
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %4
%15 = load i8, i8* %13
%16 = sext i8 %15 to i32
store i32 %16, i32* %5
%17 = icmp eq i32 %16, 28
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i32 @putchar(i32 124)
br label %23
20: ; preds = %12
%21 = load i32, i32* %5
%22 = call i32 @putchar(i32 %21)
br label %23
23: ; preds = %20, %18
br label %8
24: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @Show(i8* %0, i8* nocapture %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %2, %6
%7 = phi i8 [ %14, %6 ], [ %4, %2 ]
%8 = phi i8* [ %9, %6 ], [ %1, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = icmp eq i8 %7, 28
%11 = select i1 %10, i8 124, i8 %7
%12 = sext i8 %11 to i32
%13 = tail call i32 @putchar(i32 %12)
%14 = load i8, i8* %9
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %6
16: ; preds = %6, %2
ret void
}