#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*/ fix(char *, char *);
scalar_t__ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
main() {
  char buf[1024];
  char fixed[1024];
  int inpara = 0;
  while (gets(buf)) {
    int x;
    int isblank = 1;
    fix(fixed, buf);
    for (x = 0; buf[x]; ++x)
      if (buf[x] != ' ' && buf[x] != '\t')
        isblank = 0;
    if (!inpara) {
      if (isblank) {
        printf("\n");
      } else {
        inpara = 1;
        printf("<p>%s\n", fixed);
      }
    } else {
      if (isblank) {
        printf("</p>\n");
        inpara = 0;
      } else {
        printf("%s\n", fixed);
      }
    }
  }
  if (inpara)
    printf("</p>\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x814(%rbp)
lea    -0x410(%rbp),%rdi
call   1040 <gets@plt>
cmp    $0x0,%rax
je     128b <main+0x15b>
movl   $0x1,-0x81c(%rbp)
lea    -0x810(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1050 <fix@plt>
movl   $0x0,-0x818(%rbp)
movslq -0x818(%rbp),%rax
cmpb   $0x0,-0x410(%rbp,%rax,1)
je     11f1 <main+0xc1>
movslq -0x818(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
je     11d8 <main+0xa8>
movslq -0x818(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x9,%eax
je     11d8 <main+0xa8>
movl   $0x0,-0x81c(%rbp)
jmp    11dd <main+0xad>
mov    -0x818(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x818(%rbp)
jmp    1189 <main+0x59>
cmpl   $0x0,-0x814(%rbp)
jne    1242 <main+0x112>
cmpl   $0x0,-0x81c(%rbp)
je     121e <main+0xee>
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123d <main+0x10d>
movl   $0x1,-0x814(%rbp)
lea    -0x810(%rbp),%rsi
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1286 <main+0x156>
cmpl   $0x0,-0x81c(%rbp)
je     126c <main+0x13c>
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x814(%rbp)
jmp    1281 <main+0x151>
lea    -0x810(%rbp),%rsi
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1286 <main+0x156>
jmp    114c <main+0x1c>
cmpl   $0x0,-0x814(%rbp)
je     12a6 <main+0x176>
lea    0xd68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x808,%rsp
lea    0x400(%rsp),%r13
mov    %r13,%rdi
call   1060 <gets@plt>
test   %rax,%rax
je     124c <main+0xfc>
xor    %ebp,%ebp
mov    %rsp,%r14
lea    0xe7a(%rip),%r15
lea    0xe7a(%rip),%r12
jmp    11ad <main+0x5d>
nop
mov    %r12,%rdi
call   1040 <puts@plt>
xor    %ebp,%ebp
mov    $0x1,%bl
mov    %r13,%rdi
call   1060 <gets@plt>
test   %rax,%rax
je     123c <main+0xec>
mov    %r14,%rdi
mov    %r13,%rsi
call   1070 <fix@plt>
mov    $0x1,%eax
mov    %r13,%rcx
jmp    11d4 <main+0x84>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rcx
movzbl (%rcx),%edx
cmp    $0x9,%dl
je     11d0 <main+0x80>
cmp    $0x20,%dl
je     11d0 <main+0x80>
test   %dl,%dl
je     11f0 <main+0xa0>
xor    %eax,%eax
jmp    11d0 <main+0x80>
nopl   0x0(%rax)
test   %ebp,%ebp
je     1210 <main+0xc0>
test   %eax,%eax
jne    1190 <main+0x40>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    $0x1,%ebp
xor    %ebx,%ebx
jmp    119c <main+0x4c>
nopl   0x0(%rax)
test   %eax,%eax
je     1223 <main+0xd3>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1198 <main+0x48>
xor    %ebx,%ebx
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%ebp
jmp    119c <main+0x4c>
test   %bl,%bl
jne    124c <main+0xfc>
lea    0xdc0(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x808,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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