#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 */
char EOF;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
void show_pipe(char *data) {
  int i;
  int ret;
  for (i = 0; i < 1024; i++) {
    if (EOF == data[i])
      break;
    else if ('\n' == data[i]) {
      if (EOF != data[i])
        printf("  ");
    } else
      putchar(data[i]);
  }
}


x86 assembly (clang, -O0):
<show_pipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x400,-0xc(%rbp)
jge    11d4 <show_pipe+0xb4>
mov    0x2ea1(%rip),%rax
movsbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    1163 <show_pipe+0x43>
jmp    11d4 <show_pipe+0xb4>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0xa,%eax
cmp    %ecx,%eax
jne    11ab <show_pipe+0x8b>
mov    0x2e65(%rip),%rax
movsbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     11a6 <show_pipe+0x86>
lea    0xe5f(%rip),%rdi
call   1040 <printf@plt>
jmp    11bc <show_pipe+0x9c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
jmp    11c1 <show_pipe+0xa1>
jmp    11c6 <show_pipe+0xa6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <show_pipe+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_pipe>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
xor    %ebx,%ebx
mov    0x2eb4(%rip),%r12
lea    0xec5(%rip),%r14
jmp    1155 <show_pipe+0x35>
nopl   (%rax)
movsbl %cl,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x400,%rbx
je     1176 <show_pipe+0x56>
movzbl (%r12),%eax
movzbl (%r15,%rbx,1),%ecx
cmp    %cl,%al
je     1176 <show_pipe+0x56>
cmp    $0xa,%cl
jne    1140 <show_pipe+0x20>
cmp    $0xa,%al
je     1148 <show_pipe+0x28>
mov    %r14,%rdi
call   1040 <printf@plt>
jmp    1148 <show_pipe+0x28>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i8 0
@.str = [3 x i8] c" \00"
define void @show_pipe(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %5
5: ; preds = %49, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 1024
br i1 %7, label %8, label %52
8: ; preds = %5
%9 = load i8, i8* @EOF
%10 = sext i8 %9 to i32
%11 = load i8*, i8** %2
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %10, %16
br i1 %17, label %18, label %19
18: ; preds = %8
br label %52
19: ; preds = %8
%20 = load i8*, i8** %2
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 10, %25
br i1 %26, label %27, label %40
27: ; preds = %19
%28 = load i8, i8* @EOF
%29 = sext i8 %28 to i32
%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 = sext i8 %34 to i32
%36 = icmp ne i32 %29, %35
br i1 %36, label %37, label %39
37: ; preds = %27
%38 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %39
39: ; preds = %37, %27
br label %47
40: ; preds = %19
%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 @putchar(i8 signext %45)
br label %47
47: ; preds = %40, %39
br label %48
48: ; preds = %47
br label %49
49: ; preds = %48
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 1
store i32 %51, i32* %3
br label %5
52: ; preds = %18, %5
ret void
}

LLVM IR (-O2):
@EOF = global i8 0
@.str = [3 x i8] c" \00"
define void @show_pipe(i8* nocapture %0) {
br label %2
2: ; preds = %1, %16
%3 = phi i64 [ 0, %1 ], [ %17, %16 ]
%4 = load i8, i8* @EOF
%5 = getelementptr inbounds i8, i8* %0, i64 %3
%6 = load i8, i8* %5
%7 = icmp eq i8 %4, %6
br i1 %7, label %19, label %8
8: ; preds = %2
%9 = icmp eq i8 %6, 10
br i1 %9, label %10, label %14
10: ; preds = %8
%11 = icmp eq i8 %4, 10
br i1 %11, label %16, label %12
12: ; preds = %10
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %16
14: ; preds = %8
%15 = tail call i32 @putchar(i8 signext %6)
br label %16
16: ; preds = %10, %12, %14
%17 = add nuw nsw i64 %3, 1
%18 = icmp eq i64 %17, 1024
br i1 %18, label %19, label %2
19: ; preds = %2, %16
ret void
}