#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*/ EmitTextBS(char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ putc(int, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
char *strchr(char *, char);
void EmitTextPRE(char *Pch, int InPRE) {
  char *Pch2;
  if (!InPRE) {
    EmitTextBS(Pch);
    return;
  }
  while ((Pch2 = strchr(Pch, '\n')) != ((char *)NULL)) {
    *Pch2 = ('\0');
    EmitTextBS(Pch);
    *Pch2 = '\n';
    (void)putc((int)('\n'), stdout);
    if (*(Pch = Pch2 + 1) == '\n') {
      (void)fputs((InPRE & 0x4) ? ".IP" : ".PP", stdout);
      if (InPRE & 0x2)
        (void)fputs("\n.ft B", stdout);
    }
  }
  EmitTextBS(Pch);
}


x86 assembly (clang, -O0):
<EmitTextPRE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1167 <EmitTextPRE+0x27>
mov    -0x8(%rbp),%rdi
call   1030 <EmitTextBS@plt>
jmp    122e <EmitTextPRE+0xee>
jmp    116c <EmitTextPRE+0x2c>
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1225 <EmitTextPRE+0xe5>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <EmitTextBS@plt>
mov    -0x18(%rbp),%rax
movb   $0xa,(%rax)
mov    0x2e3a(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1060 <putc@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl 0x1(%rax),%eax
cmp    $0xa,%eax
jne    1220 <EmitTextPRE+0xe0>
mov    -0xc(%rbp),%ecx
and    $0x4,%ecx
lea    0xe29(%rip),%rdi
lea    0xe1e(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
mov    0x2df0(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
mov    -0xc(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     121b <EmitTextPRE+0xdb>
mov    0x2dd3(%rip),%rax
mov    (%rax),%esi
lea    0xdf2(%rip),%rdi
call   1050 <fputs@plt>
jmp    1220 <EmitTextPRE+0xe0>
jmp    116c <EmitTextPRE+0x2c>
mov    -0x8(%rbp),%rdi
call   1030 <EmitTextBS@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EmitTextPRE>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
test   %esi,%esi
je     11fd <EmitTextPRE+0xbd>
mov    %esi,%r14d
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11fd <EmitTextPRE+0xbd>
mov    %rax,%rbp
test   $0x4,%r14b
lea    0xe87(%rip),%rax
lea    0xe7c(%rip),%r12
cmove  %rax,%r12
mov    0x2e51(%rip),%r13
lea    0xe72(%rip),%r15
jmp    11b5 <EmitTextPRE+0x75>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <strchr@plt>
mov    %rax,%rbp
test   %rax,%rax
je     11fd <EmitTextPRE+0xbd>
movb   $0x0,0x0(%rbp)
mov    %rbx,%rdi
call   1030 <EmitTextBS@plt>
movb   $0xa,0x0(%rbp)
mov    0x0(%r13),%esi
mov    $0xa,%edi
call   1060 <putc@plt>
lea    0x1(%rbp),%rbx
cmpb   $0xa,0x1(%rbp)
jne    11a0 <EmitTextPRE+0x60>
mov    0x0(%r13),%esi
mov    %r12,%rdi
call   1050 <fputs@plt>
test   $0x2,%r14b
je     11a0 <EmitTextPRE+0x60>
mov    0x0(%r13),%esi
mov    %r15,%rdi
call   1050 <fputs@plt>
jmp    11a0 <EmitTextPRE+0x60>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <EmitTextBS@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [4 x i8] c".IP\00"
@.str.1 = [4 x i8] c".PP\00"
@.str.2 = [7 x i8] c"\0A.ft B\00"
define void @EmitTextPRE(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = call i32 @EmitTextBS(i8* %9)
br label %47
11: ; preds = %2
br label %12
12: ; preds = %43, %11
%13 = load i8*, i8** %3
%14 = call i8* @strchr(i8* %13, i8 signext 10)
store i8* %14, i8** %5
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %44
16: ; preds = %12
%17 = load i8*, i8** %5
store i8 0, i8* %17
%18 = load i8*, i8** %3
%19 = call i32 @EmitTextBS(i8* %18)
%20 = load i8*, i8** %5
store i8 10, i8* %20
%21 = load i32, i32* @stdout
%22 = call i32 @putc(i32 10, i32 %21)
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i64 1
store i8* %24, i8** %3
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 10
br i1 %27, label %28, label %43
28: ; preds = %16
%29 = load i32, i32* %4
%30 = and i32 %29, 4
%31 = icmp ne i32 %30, 0
%32 = zext i1 %31 to i64
%33 = select i1 %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%34 = load i32, i32* @stdout
%35 = call i32 @fputs(i8* %33, i32 %34)
%36 = load i32, i32* %4
%37 = and i32 %36, 2
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %28
%40 = load i32, i32* @stdout
%41 = call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %39, %28
br label %43
43: ; preds = %42, %16
br label %12
44: ; preds = %12
%45 = load i8*, i8** %3
%46 = call i32 @EmitTextBS(i8* %45)
br label %47
47: ; preds = %44, %8
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [4 x i8] c".IP\00"
@.str.1 = [4 x i8] c".PP\00"
@.str.2 = [7 x i8] c"\0A.ft B\00"
define void @EmitTextPRE(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %31, label %4
4: ; preds = %2
%5 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 10)
%6 = icmp eq i8* %5, null
br i1 %6, label %31, label %7
7: ; preds = %4
%8 = and i32 %1, 4
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
%11 = and i32 %1, 2
%12 = icmp eq i32 %11, 0
br label %13
13: ; preds = %7, %28
%14 = phi i8* [ %5, %7 ], [ %29, %28 ]
%15 = phi i8* [ %0, %7 ], [ %19, %28 ]
store i8 0, i8* %14
%16 = tail call i32 @EmitTextBS(i8* %15)
store i8 10, i8* %14
%17 = load i32, i32* @stdout
%18 = tail call i32 @putc(i32 10, i32 %17)
%19 = getelementptr inbounds i8, i8* %14, i64 1
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 10
br i1 %21, label %22, label %28
22: ; preds = %13
%23 = load i32, i32* @stdout
%24 = tail call i32 @fputs(i8* %10, i32 %23)
br i1 %12, label %28, label %25
25: ; preds = %22
%26 = load i32, i32* @stdout
%27 = tail call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %22, %25, %13
%29 = tail call i8* @strchr(i8* dereferenceable(1) %19, i8 signext 10)
%30 = icmp eq i8* %29, null
br i1 %30, label %31, label %13
31: ; preds = %28, %4, %2
%32 = phi i8* [ %0, %2 ], [ %0, %4 ], [ %19, %28 ]
%33 = tail call i32 @EmitTextBS(i8* %32)
ret void
}