#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void output_person(FILE *fp, char *p) {
  int nseps = 0, nch;
  while (*p) {
    nch = 0;
    if (nseps)
      fprintf(fp, " ");
    while (*p && *p != '|') {
      fprintf(fp, "%c", *p++);
      nch++;
    }
    if (*p == '|')
      p++;
    if (nseps == 0)
      fprintf(fp, ",");
    else if (nch == 1)
      fprintf(fp, ".");
    nseps++;
  }
}


x86 assembly (clang, -O0):
<output_person>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     122f <output_person+0x11f>
movl   $0x0,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1157 <output_person+0x47>
mov    -0x8(%rbp),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    115c <output_person+0x4c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     1181 <output_person+0x71>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7c,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1191 <output_person+0x81>
jmp    11c3 <output_person+0xb3>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edx
lea    0xe54(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115c <output_person+0x4c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7c,%eax
jne    11df <output_person+0xcf>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1200 <output_person+0xf0>
mov    -0x8(%rbp),%rdi
lea    0xe11(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1221 <output_person+0x111>
cmpl   $0x1,-0x18(%rbp)
jne    121c <output_person+0x10c>
mov    -0x8(%rbp),%rdi
lea    0xdf2(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1221 <output_person+0x111>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <output_person+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_person>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmpb   $0x0,(%rsi)
je     119c <output_person+0x8c>
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %r15d,%r15d
jmp    1146 <output_person+0x36>
nopl   0x0(%rax,%rax,1)
mov    $0x2c,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
add    $0x1,%r15d
cmpb   $0x0,(%rbx)
je     119c <output_person+0x8c>
test   %r15d,%r15d
je     1158 <output_person+0x48>
mov    $0x20,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
mov    $0x1,%ebp
nopl   (%rax)
movsbl (%rbx),%edi
test   %edi,%edi
je     1180 <output_person+0x70>
cmp    $0x7c,%dil
je     1180 <output_person+0x70>
add    $0x1,%rbx
mov    %r14,%rsi
call   1030 <fputc@plt>
add    $0xffffffff,%ebp
jmp    1160 <output_person+0x50>
xchg   %ax,%ax
xor    %eax,%eax
cmp    $0x7c,%dil
sete   %al
add    %rax,%rbx
test   %r15d,%r15d
je     1130 <output_person+0x20>
test   %ebp,%ebp
jne    113d <output_person+0x2d>
mov    $0x2e,%edi
jmp    1135 <output_person+0x25>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [2 x i8] c",\00"
@.str.3 = [2 x i8] c".\00"
define void @output_person(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
store i32 0, i32* %5
br label %7
7: ; preds = %60, %2
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %63
11: ; preds = %7
store i32 0, i32* %6
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i32*, i32** %3
%16 = call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %14, %11
br label %18
18: ; preds = %30, %17
%19 = load i8*, i8** %4
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %18
%24 = load i8*, i8** %4
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 124
br label %28
28: ; preds = %23, %18
%29 = phi i1 [ false, %18 ], [ %27, %23 ]
br i1 %29, label %30, label %39
30: ; preds = %28
%31 = load i32*, i32** %3
%32 = load i8*, i8** %4
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %4
%34 = load i8, i8* %32
%35 = sext i8 %34 to i32
%36 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %18
39: ; preds = %28
%40 = load i8*, i8** %4
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 124
br i1 %43, label %44, label %47
44: ; preds = %39
%45 = load i8*, i8** %4
%46 = getelementptr inbounds i8, i8* %45, i32 1
store i8* %46, i8** %4
br label %47
47: ; preds = %44, %39
%48 = load i32, i32* %5
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %47
%51 = load i32*, i32** %3
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %60
53: ; preds = %47
%54 = load i32, i32* %6
%55 = icmp eq i32 %54, 1
br i1 %55, label %56, label %59
56: ; preds = %53
%57 = load i32*, i32** %3
%58 = call i32 (i32*, i8*, ...) @fprintf(i32* %57, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %59
59: ; preds = %56, %53
br label %60
60: ; preds = %59, %50
%61 = load i32, i32* %5
%62 = add nsw i32 %61, 1
store i32 %62, i32* %5
br label %7
63: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @output_person(i32* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %34, label %5
5: ; preds = %2, %30
%6 = phi i32 [ %31, %30 ], [ 0, %2 ]
%7 = phi i8* [ %24, %30 ], [ %1, %2 ]
%8 = icmp eq i32 %6, 0
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = tail call i32 @fputc(i32 32, i32* %0)
br label %11
11: ; preds = %9, %5
br label %12
12: ; preds = %11, %16
%13 = phi i8* [ %18, %16 ], [ %7, %11 ]
%14 = phi i32 [ %20, %16 ], [ 0, %11 ]
%15 = load i8, i8* %13
switch i8 %15, label %16 [
i8 0, label %21
i8 124, label %21
]
16: ; preds = %12
%17 = sext i8 %15 to i32
%18 = getelementptr inbounds i8, i8* %13, i64 1
%19 = tail call i32 @fputc(i32 %17, i32* %0)
%20 = add nuw nsw i32 %14, 1
br label %12
21: ; preds = %12, %12
%22 = icmp eq i8 %15, 124
%23 = zext i1 %22 to i64
%24 = getelementptr i8, i8* %13, i64 %23
br i1 %8, label %27, label %25
25: ; preds = %21
%26 = icmp eq i32 %14, 1
br i1 %26, label %27, label %30
27: ; preds = %25, %21
%28 = phi i32 [ 44, %21 ], [ 46, %25 ]
%29 = tail call i32 @fputc(i32 %28, i32* %0)
br label %30
30: ; preds = %27, %25
%31 = add nuw nsw i32 %6, 1
%32 = load i8, i8* %24
%33 = icmp eq i8 %32, 0
br i1 %33, label %34, label %5
34: ; preds = %30, %2
ret void
}