#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(int);
int main(int argc, char **argv) {
  int ch = 0, pch = 0;
  int firstchar = 1;
  while ((ch = getchar()) != EOF) {
    if (ch != '\n' && ch < 32 && ch > 126)
      ch = ' ';
    if (pch == ' ' && ch == '\n') {
      pch = '\n';
      continue;
    }
    if ((pch == '\n' || pch == ' ') && ch == ' ')
      continue;
    if (firstchar)
      printf("<p>");
    if (pch == '\n' && ch == '\n') {
      printf("</p>\n\n<p>");
      do {
      } while ((ch = getchar()) == '\n');
    } else if (!firstchar)
      putchar(pch);
    firstchar = 0;
    pch = ch;
  }
  if (!firstchar) {
    putchar(ch);
    printf("</p>\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e7c(%rip),%rcx
cmp    (%rcx),%eax
je     1258 <main+0x128>
cmpl   $0xa,-0x14(%rbp)
je     1199 <main+0x69>
cmpl   $0x20,-0x14(%rbp)
jge    1199 <main+0x69>
cmpl   $0x7e,-0x14(%rbp)
jle    1199 <main+0x69>
movl   $0x20,-0x14(%rbp)
cmpl   $0x20,-0x18(%rbp)
jne    11b9 <main+0x89>
cmpl   $0xa,-0x14(%rbp)
jne    11b9 <main+0x89>
movl   $0xa,-0x18(%rbp)
jmp    115b <main+0x2b>
cmpl   $0xa,-0x18(%rbp)
je     11cd <main+0x9d>
cmpl   $0x20,-0x18(%rbp)
jne    11dc <main+0xac>
cmpl   $0x20,-0x14(%rbp)
jne    11dc <main+0xac>
jmp    115b <main+0x2b>
cmpl   $0x0,-0x1c(%rbp)
je     11f2 <main+0xc2>
lea    0xe19(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0xa,-0x18(%rbp)
jne    122f <main+0xff>
cmpl   $0xa,-0x14(%rbp)
jne    122f <main+0xff>
lea    0xdf3(%rip),%rdi
call   1040 <printf@plt>
jmp    1217 <main+0xe7>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xa,%eax
je     1212 <main+0xe2>
jmp    1246 <main+0x116>
cmpl   $0x0,-0x1c(%rbp)
jne    1241 <main+0x111>
mov    -0x18(%rbp),%edi
call   1030 <putchar@plt>
jmp    1246 <main+0x116>
movl   $0x0,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    115b <main+0x2b>
cmpl   $0x0,-0x1c(%rbp)
jne    1276 <main+0x146>
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
lea    0xd99(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e96(%rip),%r12
lea    0xead(%rip),%r15
xor    %ebp,%ebp
xor    %r13d,%r13d
mov    %ebp,%ebx
cmp    $0x20,%ebx
sete   %al
cmp    $0xa,%ebx
sete   %r14b
or     %al,%r14b
jmp    118b <main+0x4b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x20,%ebp
sete   %al
test   %al,%r14b
je     11b0 <main+0x70>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%ebp
cmp    (%r12),%eax
je     1216 <main+0xd6>
cmp    $0x20,%ebx
jne    1180 <main+0x40>
cmp    $0xa,%ebp
jne    1180 <main+0x40>
mov    $0xa,%ebx
jmp    1160 <main+0x20>
nopl   0x0(%rax,%rax,1)
test   $0x1,%r13b
je     11d0 <main+0x90>
cmp    $0xa,%ebx
jne    11c0 <main+0x80>
cmp    $0xa,%ebp
je     11ed <main+0xad>
mov    %ebx,%edi
call   1030 <putchar@plt>
mov    $0x1,%r13b
jmp    115e <main+0x1e>
nopl   0x0(%rax)
mov    %r15,%rdi
call   1050 <printf@plt>
mov    $0x1,%r13b
cmp    $0xa,%ebx
jne    115e <main+0x1e>
cmp    $0xa,%ebp
jne    115e <main+0x1e>
lea    0xe0c(%rip),%rdi
call   1050 <printf@plt>
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%eax
je     1200 <main+0xc0>
mov    %eax,%ebp
mov    $0x1,%r13b
jmp    115e <main+0x1e>
test   $0x1,%r13b
je     122f <main+0xef>
mov    %ebp,%edi
call   1030 <putchar@plt>
lea    0xde0(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [4 x i8] c"<p>\00"
@.str.1 = [10 x i8] c"</p>\0A\0A<p>\00"
@.str.2 = [6 x i8] c"</p>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 1, i32* %8
br label %9
9: ; preds = %65, %39, %29, %2
%10 = call i32 (...) @getchar()
store i32 %10, i32* %6
%11 = load i32, i32* @EOF
%12 = icmp ne i32 %10, %11
br i1 %12, label %13, label %67
13: ; preds = %9
%14 = load i32, i32* %6
%15 = icmp ne i32 %14, 10
br i1 %15, label %16, label %23
16: ; preds = %13
%17 = load i32, i32* %6
%18 = icmp slt i32 %17, 32
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i32, i32* %6
%21 = icmp sgt i32 %20, 126
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 32, i32* %6
br label %23
23: ; preds = %22, %19, %16, %13
%24 = load i32, i32* %7
%25 = icmp eq i32 %24, 32
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = load i32, i32* %6
%28 = icmp eq i32 %27, 10
br i1 %28, label %29, label %30
29: ; preds = %26
store i32 10, i32* %7
br label %9
30: ; preds = %26, %23
%31 = load i32, i32* %7
%32 = icmp eq i32 %31, 10
br i1 %32, label %36, label %33
33: ; preds = %30
%34 = load i32, i32* %7
%35 = icmp eq i32 %34, 32
br i1 %35, label %36, label %40
36: ; preds = %33, %30
%37 = load i32, i32* %6
%38 = icmp eq i32 %37, 32
br i1 %38, label %39, label %40
39: ; preds = %36
br label %9
40: ; preds = %36, %33
%41 = load i32, i32* %8
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %45
45: ; preds = %43, %40
%46 = load i32, i32* %7
%47 = icmp eq i32 %46, 10
br i1 %47, label %48, label %58
48: ; preds = %45
%49 = load i32, i32* %6
%50 = icmp eq i32 %49, 10
br i1 %50, label %51, label %58
51: ; preds = %48
%52 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %53
53: ; preds = %54, %51
br label %54
54: ; preds = %53
%55 = call i32 (...) @getchar()
store i32 %55, i32* %6
%56 = icmp eq i32 %55, 10
br i1 %56, label %53, label %57
57: ; preds = %54
br label %65
58: ; preds = %48, %45
%59 = load i32, i32* %8
%60 = icmp ne i32 %59, 0
br i1 %60, label %64, label %61
61: ; preds = %58
%62 = load i32, i32* %7
%63 = call i32 @putchar(i32 %62)
br label %64
64: ; preds = %61, %58
br label %65
65: ; preds = %64, %57
store i32 0, i32* %8
%66 = load i32, i32* %6
store i32 %66, i32* %7
br label %9
67: ; preds = %9
%68 = load i32, i32* %8
%69 = icmp ne i32 %68, 0
br i1 %69, label %74, label %70
70: ; preds = %67
%71 = load i32, i32* %6
%72 = call i32 @putchar(i32 %71)
%73 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %74
74: ; preds = %70, %67
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [4 x i8] c"<p>\00"
@.str.1 = [10 x i8] c"</p>\0A\0A<p>\00"
@str = [5 x i8] c"</p>\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %27, %2
%4 = phi i32 [ 0, %2 ], [ %28, %27 ]
%5 = phi i1 [ false, %2 ], [ true, %27 ]
br label %6
6: ; preds = %15, %3
%7 = phi i32 [ %4, %3 ], [ 10, %15 ]
%8 = icmp eq i32 %7, 32
%9 = icmp eq i32 %7, 10
%10 = or i1 %9, %8
br label %11
11: ; preds = %6, %18
%12 = tail call i32 (...) @getchar()
%13 = load i32, i32* @EOF
%14 = icmp eq i32 %12, %13
br i1 %14, label %36, label %15
15: ; preds = %11
%16 = icmp eq i32 %12, 10
%17 = and i1 %8, %16
br i1 %17, label %6, label %18
18: ; preds = %15
%19 = icmp eq i32 %12, 32
%20 = and i1 %10, %19
br i1 %20, label %11, label %21
21: ; preds = %18
br i1 %5, label %22, label %24
22: ; preds = %21
%23 = and i1 %9, %16
br i1 %23, label %29, label %34
24: ; preds = %21
%25 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%26 = and i1 %9, %16
br i1 %26, label %29, label %27
27: ; preds = %31, %24, %34
%28 = phi i32 [ %12, %34 ], [ %12, %24 ], [ %32, %31 ]
br label %3
29: ; preds = %24, %22
%30 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %31
31: ; preds = %31, %29
%32 = tail call i32 (...) @getchar()
%33 = icmp eq i32 %32, 10
br i1 %33, label %31, label %27
34: ; preds = %22
%35 = tail call i32 @putchar(i32 %7)
br label %27
36: ; preds = %11
br i1 %5, label %37, label %40
37: ; preds = %36
%38 = tail call i32 @putchar(i32 %12)
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %40
40: ; preds = %37, %36
ret i32 0
}