#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 */
struct stat {
  int st_size;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int fstat(int, struct stat *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
scalar_t__ malloc(int);
int open(char const *, int /*<<< orphan*/);
int read(int, char *, int);
scalar_t__ strchr(char *, char);
scalar_t__ strncmp(char *, char *, int);
char *strstr(char *, char *);
void purge_file(const char *file) {
  struct stat statbuf;
  int fd;
  char *buf, *pbuf;
  int in_tag = 0, in_quote = 0;
  FILE *fo;
  fd = open(file, O_RDONLY);
  if (fd == -1)
    return;
  if (fstat(fd, &statbuf) == -1)
    return;
  if (buf = (char *)malloc(statbuf.st_size + 1)) {
    if (read(fd, buf, statbuf.st_size) == -1) {
      free(buf);
      return;
    }
    buf[statbuf.st_size] = '\0';
  }
  close(fd);
  fo = fopen(file, "w");
  if (!fo)
    goto error;
  for (pbuf = buf; *pbuf; ++pbuf) {
    if (in_tag > 0) {
      if (in_quote) {
        if (*pbuf == '\"')
          in_quote = 0;
      } else {
        if (*pbuf == '\"')
          ++in_quote;
        if (!in_quote && strchr(" \t\n\r", *pbuf)) {
          do {
            ++pbuf;
          } while (strchr(" \t\n\r", *pbuf));
          if (*pbuf != '>')
            fputc(' ', fo);
          --pbuf;
          continue;
        }
      }
      if (*pbuf == '>')
        --in_tag;
      fputc(*pbuf, fo);
    } else {
      if (*pbuf == '<') {
        if (0 == strncmp(pbuf, "<!--", 4)) {
          pbuf = strstr(pbuf, "-->");
          if (!pbuf)
            goto error;
          pbuf += 2;
          continue;
        }
        ++in_tag;
        fputc('<', fo);
      } else {
        char *tmp = pbuf;
        while (*tmp && strchr(" \t\n\r", *tmp) && *tmp != '<')
          ++tmp;
        if (*tmp == '<')
          pbuf = tmp - 1;
        else {
          if (tmp == pbuf)
            fputc(*pbuf, fo);
          else {
            fwrite(pbuf, 1, tmp - pbuf, fo);
            pbuf = tmp - 1;
          }
        }
      }
    }
  }
  fclose(fo);
error:
  free(buf);
}


x86 assembly (clang, -O0):
<purge_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2df3(%rip),%rax
mov    (%rax),%esi
call   10b0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    120e <purge_file+0x3e>
jmp    1555 <purge_file+0x385>
mov    -0x14(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   10e0 <fstat@plt>
cmp    $0xffffffff,%eax
jne    1228 <purge_file+0x58>
jmp    1555 <purge_file+0x385>
mov    -0x10(%rbp),%edi
add    $0x1,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1273 <purge_file+0xa3>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%edx
call   1090 <read@plt>
cmp    $0xffffffff,%eax
jne    1267 <purge_file+0x97>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
jmp    1555 <purge_file+0x385>
mov    -0x20(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
mov    -0x8(%rbp),%rdi
lea    0xd7a(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    129f <purge_file+0xcf>
jmp    154c <purge_file+0x37c>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
je     1543 <purge_file+0x373>
cmpl   $0x0,-0x2c(%rbp)
jle    13b6 <purge_file+0x1e6>
cmpl   $0x0,-0x30(%rbp)
je     12e4 <purge_file+0x114>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    12df <purge_file+0x10f>
movl   $0x0,-0x30(%rbp)
jmp    1386 <purge_file+0x1b6>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    12fd <purge_file+0x12d>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jne    1381 <purge_file+0x1b1>
mov    -0x28(%rbp),%rax
lea    0xcf0(%rip),%rdi
movsbl (%rax),%esi
call   1060 <strchr@plt>
cmp    $0x0,%rax
je     1381 <purge_file+0x1b1>
jmp    1329 <purge_file+0x159>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
lea    0xcc2(%rip),%rdi
movsbl (%rax),%esi
call   1060 <strchr@plt>
cmp    $0x0,%rax
jne    1329 <purge_file+0x159>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3e,%eax
je     1370 <purge_file+0x1a0>
mov    -0x38(%rbp),%rsi
mov    $0x20,%edi
call   1080 <fputc@plt>
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
jmp    1532 <purge_file+0x362>
jmp    1386 <purge_file+0x1b6>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3e,%eax
jne    139f <purge_file+0x1cf>
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%al
mov    -0x38(%rbp),%rsi
movsbl %al,%edi
call   1080 <fputc@plt>
jmp    152d <purge_file+0x35d>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3c,%eax
jne    143a <purge_file+0x26a>
mov    -0x28(%rbp),%rdi
lea    0xc36(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    141e <purge_file+0x24e>
mov    -0x28(%rbp),%rdi
lea    0xc18(%rip),%rsi
call   10f0 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    140d <purge_file+0x23d>
jmp    154c <purge_file+0x37c>
mov    -0x28(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x28(%rbp)
jmp    1532 <purge_file+0x362>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x38(%rbp),%rsi
mov    $0x3c,%edi
call   1080 <fputc@plt>
jmp    1528 <purge_file+0x358>
mov    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x41(%rbp)
je     148c <purge_file+0x2bc>
mov    -0x40(%rbp),%rax
lea    0xba0(%rip),%rdi
movsbl (%rax),%esi
call   1060 <strchr@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x41(%rbp)
je     148c <purge_file+0x2bc>
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3c,%eax
setne  %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    149c <purge_file+0x2cc>
jmp    14ad <purge_file+0x2dd>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1442 <purge_file+0x272>
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3c,%eax
jne    14ce <purge_file+0x2fe>
mov    -0x40(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
jmp    1523 <purge_file+0x353>
mov    -0x40(%rbp),%rax
cmp    -0x28(%rbp),%rax
jne    14f3 <purge_file+0x323>
mov    -0x28(%rbp),%rax
mov    (%rax),%al
mov    -0x38(%rbp),%rsi
movsbl %al,%edi
call   1080 <fputc@plt>
jmp    151e <purge_file+0x34e>
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
mov    -0x38(%rbp),%rcx
mov    $0x1,%esi
call   10d0 <fwrite@plt>
mov    -0x40(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
jmp    1523 <purge_file+0x353>
jmp    1528 <purge_file+0x358>
jmp    152d <purge_file+0x35d>
jmp    1532 <purge_file+0x362>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    12a7 <purge_file+0xd7>
mov    -0x38(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<purge_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
mov    0x2e00(%rip),%rax
mov    (%rax),%esi
call   10b0 <open@plt>
cmp    $0xffffffff,%eax
je     1286 <purge_file+0xb6>
mov    %eax,%ebp
lea    0x10(%rsp),%rsi
mov    %eax,%edi
call   10e0 <fstat@plt>
cmp    $0xffffffff,%eax
je     1286 <purge_file+0xb6>
movslq 0x10(%rsp),%r15
lea    0x1(%r15),%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     123c <purge_file+0x6c>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15d,%edx
call   1090 <read@plt>
cmp    $0xffffffff,%eax
je     1447 <purge_file+0x277>
movb   $0x0,(%rbx,%r15,1)
mov    %rbx,0x8(%rsp)
mov    %ebp,%edi
call   1070 <close@plt>
lea    0xdb1(%rip),%rsi
mov    %r14,%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1440 <purge_file+0x270>
mov    %rax,%r13
mov    0x8(%rsp),%rax
mov    (%rax),%al
test   %al,%al
je     1438 <purge_file+0x268>
xor    %r12d,%r12d
lea    0xd86(%rip),%rbx
mov    0x8(%rsp),%r14
xor    %r15d,%r15d
jmp    12d0 <purge_file+0x100>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ebp,%edx
sub    %r14d,%edx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %r13,%rcx
call   10d0 <fwrite@plt>
add    $0xffffffffffffffff,%rbp
xor    %r15d,%r15d
mov    %rbp,%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x1(%r14),%al
add    $0x1,%r14
test   %al,%al
je     1438 <purge_file+0x268>
test   %r15d,%r15d
je     1300 <purge_file+0x130>
test   %r12d,%r12d
je     1380 <purge_file+0x1b0>
xor    %r12d,%r12d
cmp    $0x22,%al
setne  %r12b
xor    %r15d,%r15d
cmp    $0x3e,%al
setne  %r15b
movsbl %al,%edi
mov    %r13,%rsi
call   1080 <fputc@plt>
jmp    12c0 <purge_file+0xf0>
nopl   (%rax)
mov    %r14,%rbp
cmp    $0x3c,%al
jne    1340 <purge_file+0x170>
mov    %r14,%rdi
lea    0xcf6(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     13e4 <purge_file+0x214>
mov    $0x3c,%edi
mov    %r13,%rsi
call   1080 <fputc@plt>
mov    $0x1,%r15d
jmp    12c0 <purge_file+0xf0>
nopl   0x0(%rax)
movsbl %al,%esi
mov    %rbx,%rdi
call   1060 <strchr@plt>
movzbl 0x0(%rbp),%ecx
test   %rax,%rax
je     1407 <purge_file+0x237>
cmp    $0x3c,%cl
je     12aa <purge_file+0xda>
movzbl 0x1(%rbp),%eax
add    $0x1,%rbp
test   %al,%al
jne    1340 <purge_file+0x170>
jmp    1410 <purge_file+0x240>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x22,%al
jne    1391 <purge_file+0x1c1>
mov    $0x1,%r12d
mov    $0x22,%al
jmp    12e7 <purge_file+0x117>
movsbl %al,%esi
mov    %rbx,%rdi
call   1060 <strchr@plt>
test   %rax,%rax
je     142d <purge_file+0x25d>
add    $0xffffffffffffffff,%r14
nopl   0x0(%rax)
movsbl 0x2(%r14),%esi
mov    %rbx,%rdi
call   1060 <strchr@plt>
add    $0x1,%r14
test   %rax,%rax
jne    13b0 <purge_file+0x1e0>
xor    %r12d,%r12d
mov    $0x1,%r15d
cmpb   $0x3e,0x1(%r14)
je     12c0 <purge_file+0xf0>
mov    $0x20,%edi
jmp    12f3 <purge_file+0x123>
mov    %r14,%rdi
lea    0xc1e(%rip),%rsi
call   10f0 <strstr@plt>
test   %rax,%rax
je     1440 <purge_file+0x270>
mov    %rax,%r14
add    $0x2,%r14
xor    %r15d,%r15d
jmp    12c0 <purge_file+0xf0>
cmp    $0x3c,%cl
je     12aa <purge_file+0xda>
cmp    %r14,%rbp
jne    1295 <purge_file+0xc5>
movsbl (%r14),%edi
mov    %r13,%rsi
call   1080 <fputc@plt>
xor    %r15d,%r15d
jmp    12c0 <purge_file+0xf0>
mov    (%r14),%al
xor    %r12d,%r12d
jmp    12e7 <purge_file+0x117>
mov    %r13,%rdi
call   1050 <fclose@plt>
mov    0x8(%rsp),%rdi
jmp    144a <purge_file+0x27a>
mov    %rbx,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@O_RDONLY = global i32 0
@.str = [2 x i8] c"w\00"
@.str.1 = [5 x i8] c" \09\0A\0D\00"
@.str.2 = [5 x i8] c"<!--\00"
@.str.3 = [4 x i8] c"-->\00"
define void @purge_file(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %7
store i32 0, i32* %8
%11 = load i8*, i8** %2
%12 = load i32, i32* @O_RDONLY
%13 = call i32 @open(i8* %11, i32 %12)
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %17
16: ; preds = %1
br label %209
17: ; preds = %1
%18 = load i32, i32* %4
%19 = call i32 @fstat(i32 %18, %struct.stat* %3)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %22
21: ; preds = %17
br label %209
22: ; preds = %17
%23 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%24 = load i32, i32* %23
%25 = add nsw i32 %24, 1
%26 = call i64 @malloc(i32 %25)
%27 = inttoptr i64 %26 to i8*
store i8* %27, i8** %5
%28 = icmp ne i8* %27, null
br i1 %28, label %29, label %45
29: ; preds = %22
%30 = load i32, i32* %4
%31 = load i8*, i8** %5
%32 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%33 = load i32, i32* %32
%34 = call i32 @read(i32 %30, i8* %31, i32 %33)
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %39
36: ; preds = %29
%37 = load i8*, i8** %5
%38 = call i32 @free(i8* %37)
br label %209
39: ; preds = %29
%40 = load i8*, i8** %5
%41 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%42 = load i32, i32* %41
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %40, i64 %43
store i8 0, i8* %44
br label %45
45: ; preds = %39, %22
%46 = load i32, i32* %4
%47 = call i32 @close(i32 %46)
%48 = load i8*, i8** %2
%49 = call i32* @fopen(i8* %48, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %49, i32** %9
%50 = load i32*, i32** %9
%51 = icmp ne i32* %50, null
br i1 %51, label %53, label %52
52: ; preds = %45
br label %206
53: ; preds = %45
%54 = load i8*, i8** %5
store i8* %54, i8** %6
br label %55
55: ; preds = %200, %53
%56 = load i8*, i8** %6
%57 = load i8, i8* %56
%58 = icmp ne i8 %57, 0
br i1 %58, label %59, label %203
59: ; preds = %55
%60 = load i32, i32* %7
%61 = icmp sgt i32 %60, 0
br i1 %61, label %62, label %122
62: ; preds = %59
%63 = load i32, i32* %8
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %72
65: ; preds = %62
%66 = load i8*, i8** %6
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = icmp eq i32 %68, 34
br i1 %69, label %70, label %71
70: ; preds = %65
store i32 0, i32* %8
br label %71
71: ; preds = %70, %65
br label %109
72: ; preds = %62
%73 = load i8*, i8** %6
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = icmp eq i32 %75, 34
br i1 %76, label %77, label %80
77: ; preds = %72
%78 = load i32, i32* %8
%79 = add nsw i32 %78, 1
store i32 %79, i32* %8
br label %80
80: ; preds = %77, %72
%81 = load i32, i32* %8
%82 = icmp ne i32 %81, 0
br i1 %82, label %108, label %83
83: ; preds = %80
%84 = load i8*, i8** %6
%85 = load i8, i8* %84
%86 = call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 signext %85)
%87 = icmp ne i64 %86, 0
br i1 %87, label %88, label %108
88: ; preds = %83
br label %89
89: ; preds = %92, %88
%90 = load i8*, i8** %6
%91 = getelementptr inbounds i8, i8* %90, i32 1
store i8* %91, i8** %6
br label %92
92: ; preds = %89
%93 = load i8*, i8** %6
%94 = load i8, i8* %93
%95 = call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 signext %94)
%96 = icmp ne i64 %95, 0
br i1 %96, label %89, label %97
97: ; preds = %92
%98 = load i8*, i8** %6
%99 = load i8, i8* %98
%100 = sext i8 %99 to i32
%101 = icmp ne i32 %100, 62
br i1 %101, label %102, label %105
102: ; preds = %97
%103 = load i32*, i32** %9
%104 = call i32 @fputc(i8 signext 32, i32* %103)
br label %105
105: ; preds = %102, %97
%106 = load i8*, i8** %6
%107 = getelementptr inbounds i8, i8* %106, i32 -1
store i8* %107, i8** %6
br label %200
108: ; preds = %83, %80
br label %109
109: ; preds = %108, %71
%110 = load i8*, i8** %6
%111 = load i8, i8* %110
%112 = sext i8 %111 to i32
%113 = icmp eq i32 %112, 62
br i1 %113, label %114, label %117
114: ; preds = %109
%115 = load i32, i32* %7
%116 = add nsw i32 %115, -1
store i32 %116, i32* %7
br label %117
117: ; preds = %114, %109
%118 = load i8*, i8** %6
%119 = load i8, i8* %118
%120 = load i32*, i32** %9
%121 = call i32 @fputc(i8 signext %119, i32* %120)
br label %199
122: ; preds = %59
%123 = load i8*, i8** %6
%124 = load i8, i8* %123
%125 = sext i8 %124 to i32
%126 = icmp eq i32 %125, 60
br i1 %126, label %127, label %145
127: ; preds = %122
%128 = load i8*, i8** %6
%129 = call i64 @strncmp(i8* %128, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%130 = icmp eq i64 0, %129
br i1 %130, label %131, label %140
131: ; preds = %127
%132 = load i8*, i8** %6
%133 = call i8* @strstr(i8* %132, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
store i8* %133, i8** %6
%134 = load i8*, i8** %6
%135 = icmp ne i8* %134, null
br i1 %135, label %137, label %136
136: ; preds = %131
br label %206
137: ; preds = %131
%138 = load i8*, i8** %6
%139 = getelementptr inbounds i8, i8* %138, i64 2
store i8* %139, i8** %6
br label %200
140: ; preds = %127
%141 = load i32, i32* %7
%142 = add nsw i32 %141, 1
store i32 %142, i32* %7
%143 = load i32*, i32** %9
%144 = call i32 @fputc(i8 signext 60, i32* %143)
br label %198
145: ; preds = %122
%146 = load i8*, i8** %6
store i8* %146, i8** %10
br label %147
147: ; preds = %164, %145
%148 = load i8*, i8** %10
%149 = load i8, i8* %148
%150 = sext i8 %149 to i32
%151 = icmp ne i32 %150, 0
br i1 %151, label %152, label %162
152: ; preds = %147
%153 = load i8*, i8** %10
%154 = load i8, i8* %153
%155 = call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 signext %154)
%156 = icmp ne i64 %155, 0
br i1 %156, label %157, label %162
157: ; preds = %152
%158 = load i8*, i8** %10
%159 = load i8, i8* %158
%160 = sext i8 %159 to i32
%161 = icmp ne i32 %160, 60
br label %162
162: ; preds = %157, %152, %147
%163 = phi i1 [ false, %152 ], [ false, %147 ], [ %161, %157 ]
br i1 %163, label %164, label %167
164: ; preds = %162
%165 = load i8*, i8** %10
%166 = getelementptr inbounds i8, i8* %165, i32 1
store i8* %166, i8** %10
br label %147
167: ; preds = %162
%168 = load i8*, i8** %10
%169 = load i8, i8* %168
%170 = sext i8 %169 to i32
%171 = icmp eq i32 %170, 60
br i1 %171, label %172, label %175
172: ; preds = %167
%173 = load i8*, i8** %10
%174 = getelementptr inbounds i8, i8* %173, i64 -1
store i8* %174, i8** %6
br label %197
175: ; preds = %167
%176 = load i8*, i8** %10
%177 = load i8*, i8** %6
%178 = icmp eq i8* %176, %177
br i1 %178, label %179, label %184
179: ; preds = %175
%180 = load i8*, i8** %6
%181 = load i8, i8* %180
%182 = load i32*, i32** %9
%183 = call i32 @fputc(i8 signext %181, i32* %182)
br label %196
184: ; preds = %175
%185 = load i8*, i8** %6
%186 = load i8*, i8** %10
%187 = load i8*, i8** %6
%188 = ptrtoint i8* %186 to i64
%189 = ptrtoint i8* %187 to i64
%190 = sub i64 %188, %189
%191 = trunc i64 %190 to i32
%192 = load i32*, i32** %9
%193 = call i32 @fwrite(i8* %185, i32 1, i32 %191, i32* %192)
%194 = load i8*, i8** %10
%195 = getelementptr inbounds i8, i8* %194, i64 -1
store i8* %195, i8** %6
br label %196
196: ; preds = %184, %179
br label %197
197: ; preds = %196, %172
br label %198
198: ; preds = %197, %140
br label %199
199: ; preds = %198, %117
br label %200
200: ; preds = %199, %137, %105
%201 = load i8*, i8** %6
%202 = getelementptr inbounds i8, i8* %201, i32 1
store i8* %202, i8** %6
br label %55
203: ; preds = %55
%204 = load i32*, i32** %9
%205 = call i32 @fclose(i32* %204)
br label %206
206: ; preds = %203, %136, %52
%207 = load i8*, i8** %5
%208 = call i32 @free(i8* %207)
br label %209
209: ; preds = %206, %36, %21, %16
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@O_RDONLY = global i32 0
@.str = [2 x i8] c"w\00"
@.str.1 = [5 x i8] c" \09\0A\0D\00"
@.str.2 = [5 x i8] c"<!--\00"
@.str.3 = [4 x i8] c"-->\00"
define void @purge_file(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = load i32, i32* @O_RDONLY
%5 = tail call i32 @open(i8* %0, i32 %4)
%6 = icmp eq i32 %5, -1
br i1 %6, label %118, label %7
7: ; preds = %1
%8 = call i32 @fstat(i32 %5, %struct.stat* %2)
%9 = icmp eq i32 %8, -1
br i1 %9, label %118, label %10
10: ; preds = %7
%11 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 1
%14 = tail call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to i8*
%16 = icmp eq i64 %14, 0
br i1 %16, label %25, label %17
17: ; preds = %10
%18 = tail call i32 @read(i32 %5, i8* %15, i32 %12)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call i32 @free(i8* %15)
br label %118
22: ; preds = %17
%23 = sext i32 %12 to i64
%24 = getelementptr inbounds i8, i8* %15, i64 %23
store i8 0, i8* %24
br label %25
25: ; preds = %22, %10
%26 = tail call i32 @close(i32 %5)
%27 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%28 = icmp eq i32* %27, null
br i1 %28, label %116, label %29
29: ; preds = %25
%30 = load i8, i8* %15
%31 = icmp eq i8 %30, 0
br i1 %31, label %114, label %32
32: ; preds = %29, %107
%33 = phi i8 [ %112, %107 ], [ %30, %29 ]
%34 = phi i8* [ %111, %107 ], [ %15, %29 ]
%35 = phi i32 [ %109, %107 ], [ 0, %29 ]
%36 = phi i32 [ %108, %107 ], [ 0, %29 ]
%37 = icmp eq i32 %36, 0
br i1 %37, label %67, label %38
38: ; preds = %32
%39 = icmp eq i32 %35, 0
br i1 %39, label %43, label %40
40: ; preds = %38
%41 = icmp ne i8 %33, 34
%42 = zext i1 %41 to i32
br label %61
43: ; preds = %38
%44 = icmp eq i8 %33, 34
br i1 %44, label %61, label %45
45: ; preds = %43
%46 = tail call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 signext %33)
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = load i8, i8* %34
br label %61
50: ; preds = %45, %50
%51 = phi i8* [ %52, %50 ], [ %34, %45 ]
%52 = getelementptr inbounds i8, i8* %51, i64 1
%53 = load i8, i8* %52
%54 = tail call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 signext %53)
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %50
56: ; preds = %50
%57 = load i8, i8* %52
%58 = icmp eq i8 %57, 62
br i1 %58, label %107, label %59
59: ; preds = %56
%60 = tail call i32 @fputc(i8 signext 32, i32* %27)
br label %107
61: ; preds = %48, %40, %43
%62 = phi i8 [ 34, %43 ], [ %49, %48 ], [ %33, %40 ]
%63 = phi i32 [ 1, %43 ], [ 0, %48 ], [ %42, %40 ]
%64 = icmp ne i8 %62, 62
%65 = zext i1 %64 to i32
%66 = tail call i32 @fputc(i8 signext %62, i32* %27)
br label %107
67: ; preds = %32
%68 = icmp eq i8 %33, 60
br i1 %68, label %69, label %79
69: ; preds = %67
%70 = tail call i64 @strncmp(i8* %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%71 = icmp eq i64 %70, 0
br i1 %71, label %72, label %77
72: ; preds = %69
%73 = tail call i8* @strstr(i8* %34, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%74 = icmp eq i8* %73, null
br i1 %74, label %116, label %75
75: ; preds = %72
%76 = getelementptr inbounds i8, i8* %73, i64 2
br label %107
77: ; preds = %69
%78 = tail call i32 @fputc(i8 signext 60, i32* %27)
br label %107
79: ; preds = %67, %87
%80 = phi i8 [ %89, %87 ], [ %33, %67 ]
%81 = phi i8* [ %88, %87 ], [ %34, %67 ]
%82 = tail call i64 @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 signext %80)
%83 = icmp eq i64 %82, 0
%84 = load i8, i8* %81
%85 = icmp eq i8 %84, 60
br i1 %83, label %91, label %86
86: ; preds = %79
br i1 %85, label %92, label %87
87: ; preds = %86
%88 = getelementptr inbounds i8, i8* %81, i64 1
%89 = load i8, i8* %88
%90 = icmp eq i8 %89, 0
br i1 %90, label %94, label %79
91: ; preds = %79
br i1 %85, label %92, label %94
92: ; preds = %86, %91
%93 = getelementptr inbounds i8, i8* %81, i64 -1
br label %107
94: ; preds = %87, %91
%95 = phi i8* [ %81, %91 ], [ %88, %87 ]
%96 = icmp eq i8* %95, %34
br i1 %96, label %97, label %100
97: ; preds = %94
%98 = load i8, i8* %34
%99 = tail call i32 @fputc(i8 signext %98, i32* %27)
br label %107
100: ; preds = %94
%101 = ptrtoint i8* %95 to i64
%102 = ptrtoint i8* %34 to i64
%103 = sub i64 %101, %102
%104 = trunc i64 %103 to i32
%105 = tail call i32 @fwrite(i8* %34, i32 1, i32 %104, i32* %27)
%106 = getelementptr inbounds i8, i8* %95, i64 -1
br label %107
107: ; preds = %92, %100, %97, %56, %59, %61, %77, %75
%108 = phi i32 [ %65, %61 ], [ 0, %75 ], [ 1, %77 ], [ 1, %59 ], [ 1, %56 ], [ 0, %97 ], [ 0, %100 ], [ 0, %92 ]
%109 = phi i32 [ %63, %61 ], [ %35, %75 ], [ %35, %77 ], [ 0, %59 ], [ 0, %56 ], [ %35, %97 ], [ %35, %100 ], [ %35, %92 ]
%110 = phi i8* [ %34, %61 ], [ %76, %75 ], [ %34, %77 ], [ %51, %59 ], [ %51, %56 ], [ %34, %97 ], [ %106, %100 ], [ %93, %92 ]
%111 = getelementptr inbounds i8, i8* %110, i64 1
%112 = load i8, i8* %111
%113 = icmp eq i8 %112, 0
br i1 %113, label %114, label %32
114: ; preds = %107, %29
%115 = tail call i32 @fclose(i32* %27)
br label %116
116: ; preds = %72, %25, %114
%117 = tail call i32 @free(i8* %15)
br label %118
118: ; preds = %7, %1, %116, %20
ret void
}