#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 */
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ *strstr(char *, char *);
int /*<<< orphan*/ trim_newline(char *);
void process_pre(char *s, char *buf) {
  if (strstr(s, "</pre>") != NULL) {
    fputs(s, stdout);
  } else {
    char line[1024];
    *buf = '\0';
    strcat(buf, s);
    while (fgets(line, sizeof line, stdin)) {
      if (strstr(line, "</pre>") != NULL) {
        trim_newline(buf);
        printf("%s</pre>\n\n", buf);
        break;
      }
      strcat(buf, line);
    }
  }
}


x86 assembly (clang, -O0):
<process_pre>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1080 <strstr@plt>
cmp    $0x0,%rax
je     11a4 <process_pre+0x44>
mov    -0x8(%rbp),%rdi
mov    0x2e40(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
jmp    1231 <process_pre+0xd1>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1070 <strcat@plt>
lea    -0x410(%rbp),%rdi
mov    0x2e22(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     122c <process_pre+0xcc>
lea    -0x410(%rbp),%rdi
lea    0xe16(%rip),%rsi
call   1080 <strstr@plt>
cmp    $0x0,%rax
je     1217 <process_pre+0xb7>
mov    -0x10(%rbp),%rdi
call   1060 <trim_newline@plt>
mov    -0x10(%rbp),%rsi
lea    0xdfa(%rip),%rdi
call   1030 <printf@plt>
jmp    122c <process_pre+0xcc>
mov    -0x10(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1070 <strcat@plt>
jmp    11b8 <process_pre+0x58>
jmp    1231 <process_pre+0xd1>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_pre>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xe85(%rip),%rsi
call   1080 <strstr@plt>
test   %rax,%rax
je     11a4 <process_pre+0x44>
mov    0x2e4c(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <fputs@plt>
movb   $0x0,(%r15)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <strcat@plt>
mov    0x2e2e(%rip),%r12
mov    (%r12),%edx
mov    %rsp,%rdi
mov    $0x400,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     1227 <process_pre+0xc7>
lea    0xe29(%rip),%r14
mov    %rsp,%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <strstr@plt>
mov    %r15,%rdi
test   %rax,%rax
jne    1213 <process_pre+0xb3>
mov    %rbx,%rsi
call   1070 <strcat@plt>
mov    (%r12),%edx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1050 <fgets@plt>
test   %rax,%rax
jne    11e0 <process_pre+0x80>
jmp    1227 <process_pre+0xc7>
call   1060 <trim_newline@plt>
lea    0xde8(%rip),%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"</pre>\00"
@stdout = global i32 0
@stdin = global i32 0
@.str.1 = [11 x i8] c"%s</pre>\0A\0A\00"
define void @process_pre(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [1024 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i32* @strstr(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = load i32, i32* @stdout
%12 = call i32 @fputs(i8* %10, i32 %11)
br label %37
13: ; preds = %2
%14 = load i8*, i8** %4
store i8 0, i8* %14
%15 = load i8*, i8** %4
%16 = load i8*, i8** %3
%17 = call i32 @strcat(i8* %15, i8* %16)
br label %18
18: ; preds = %32, %13
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%20 = load i32, i32* @stdin
%21 = call i64 @fgets(i8* %19, i32 1024, i32 %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %36
23: ; preds = %18
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%25 = call i32* @strstr(i8* %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%26 = icmp ne i32* %25, null
br i1 %26, label %27, label %32
27: ; preds = %23
%28 = load i8*, i8** %4
%29 = call i32 @trim_newline(i8* %28)
%30 = load i8*, i8** %4
%31 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %30)
br label %36
32: ; preds = %23
%33 = load i8*, i8** %4
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%35 = call i32 @strcat(i8* %33, i8* %34)
br label %18
36: ; preds = %27, %18
br label %37
37: ; preds = %36, %9
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"</pre>\00"
@stdout = global i32 0
@stdin = global i32 0
@.str.1 = [11 x i8] c"%s</pre>\0A\0A\00"
define void @process_pre(i8* %0, i8* %1) {
%3 = alloca [1024 x i8]
%4 = tail call i32* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i32, i32* @stdout
%8 = tail call i32 @fputs(i8* %0, i32 %7)
br label %27
9: ; preds = %2
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
store i8 0, i8* %1
%11 = tail call i32 @strcat(i8* %1, i8* %0)
%12 = load i32, i32* @stdin
%13 = call i64 @fgets(i8* %10, i32 1024, i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %26, label %15
15: ; preds = %9, %21
%16 = call i32* @strstr(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = call i32 @trim_newline(i8* %1)
%20 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %26
21: ; preds = %15
%22 = call i32 @strcat(i8* %1, i8* %10)
%23 = load i32, i32* @stdin
%24 = call i64 @fgets(i8* %10, i32 1024, i32 %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %15
26: ; preds = %21, %9, %18
br label %27
27: ; preds = %26, %6
ret void
}