#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 *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
scalar_t__ readLine(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ strstr(char *, char *);
void addEmbeddedHtml(FILE *in, FILE *out) {
  char line[512];
  fputs("<div>", out);
  while (readLine(line, 512, in) && (*line == ';') && !strstr(line, ":HTML")) {
    line[0] = ' ';
    fprintf(out, "%s\n", line);
  }
  fputs("</div>", out);
}


x86 assembly (clang, -O0):
<addEmbeddedHtml>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xea2(%rip),%rdi
call   1030 <fputs@plt>
lea    -0x210(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x200,%esi
call   1050 <readLine@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x211(%rbp)
je     11c6 <addEmbeddedHtml+0x86>
movsbl -0x210(%rbp),%ecx
xor    %eax,%eax
cmp    $0x3b,%ecx
mov    %al,-0x211(%rbp)
jne    11c6 <addEmbeddedHtml+0x86>
lea    -0x210(%rbp),%rdi
lea    0xe53(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x211(%rbp)
mov    -0x211(%rbp),%al
test   $0x1,%al
jne    11d9 <addEmbeddedHtml+0x99>
jmp    11fc <addEmbeddedHtml+0xbc>
movb   $0x20,-0x210(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x210(%rbp),%rdx
lea    0xe1a(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1163 <addEmbeddedHtml+0x23>
mov    -0x10(%rbp),%rsi
lea    0xe09(%rip),%rdi
call   1030 <fputs@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addEmbeddedHtml>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x200,%rsp
mov    %rsi,%r14
mov    %rdi,%r12
lea    0xea3(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
mov    %rsp,%rdi
mov    $0x200,%esi
mov    %r12,%rdx
call   1040 <readLine@plt>
test   %rax,%rax
je     11dc <addEmbeddedHtml+0x9c>
cmpb   $0x3b,(%rsp)
jne    11dc <addEmbeddedHtml+0x9c>
lea    0xe75(%rip),%r15
mov    %rsp,%rbx
lea    0xe71(%rip),%r13
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <strstr@plt>
test   %eax,%eax
jne    11dc <addEmbeddedHtml+0x9c>
movb   $0x20,(%rsp)
mov    %r14,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    %rbx,%rdi
mov    $0x200,%esi
mov    %r12,%rdx
call   1040 <readLine@plt>
test   %rax,%rax
je     11dc <addEmbeddedHtml+0x9c>
cmpb   $0x3b,(%rsp)
je     11a0 <addEmbeddedHtml+0x60>
lea    0xe2d(%rip),%rdi
mov    $0x6,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
add    $0x200,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"<div>\00"
@.str.1 = [6 x i8] c":HTML\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [7 x i8] c"</div>\00"
define void @addEmbeddedHtml(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [512 x i8]
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %4
%7 = call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %6)
br label %8
8: ; preds = %25, %2
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%10 = load i32*, i32** %3
%11 = call i64 @readLine(i8* %9, i32 512, i32* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %23
13: ; preds = %8
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 59
br i1 %17, label %18, label %23
18: ; preds = %13
%19 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%20 = call i32 @strstr(i8* %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
%22 = xor i1 %21, true
br label %23
23: ; preds = %18, %13, %8
%24 = phi i1 [ false, %13 ], [ false, %8 ], [ %22, %18 ]
br i1 %24, label %25, label %30
25: ; preds = %23
%26 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
store i8 32, i8* %26
%27 = load i32*, i32** %4
%28 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%29 = call i32 @fprintf(i32* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %28)
br label %8
30: ; preds = %23
%31 = load i32*, i32** %4
%32 = call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32* %31)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"<div>\00"
@.str.1 = [6 x i8] c":HTML\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [7 x i8] c"</div>\00"
define void @addEmbeddedHtml(i32* %0, i32* nocapture %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 5, i64 1, i32* %1)
%6 = call i64 @readLine(i8* %4, i32 512, i32* %0)
%7 = icmp ne i64 %6, 0
%8 = load i8, i8* %4
%9 = icmp eq i8 %8, 59
%10 = select i1 %7, i1 %9, i1 false
br i1 %10, label %11, label %21
11: ; preds = %2, %14
%12 = call i32 @strstr(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %11
store i8 32, i8* %4
%15 = call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%16 = call i64 @readLine(i8* %4, i32 512, i32* %0)
%17 = icmp ne i64 %16, 0
%18 = load i8, i8* %4
%19 = icmp eq i8 %18, 59
%20 = select i1 %17, i1 %19, i1 false
br i1 %20, label %11, label %21
21: ; preds = %11, %14, %2
%22 = call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i64 6, i64 1, i32* %1)
ret void
}