#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 ns_serve_http_opts {
  int dummy;
};
struct ns_connection {
  int dummy;
};
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int BUFSIZ;
int EOF;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ do_ssi_exec(struct ns_connection *, char *);
int /*<<< orphan*/ do_ssi_include(struct ns_connection *, char const *, char *,
                                  int, struct ns_serve_http_opts const *);
int fgetc(int /*<<< orphan*/ *);
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ ns_printf(struct ns_connection *, char *, char const *);
int /*<<< orphan*/ ns_send(struct ns_connection *, char *, size_t);
void send_ssi_file(struct ns_connection *nc, const char *path, FILE *fp,
                   int include_level, const struct ns_serve_http_opts *opts) {
  char buf[BUFSIZ];
  int ch, offset, len, in_ssi_tag;
  if (include_level > 10) {
    ns_printf(nc, "SSI #include level is too deep (%s)", path);
    return;
  }
  in_ssi_tag = len = offset = 0;
  while ((ch = fgetc(fp)) != EOF) {
    if (in_ssi_tag && ch == '>') {
      in_ssi_tag = 0;
      buf[len++] = (char)ch;
      buf[len] = '\0';
      assert(len <= (int)sizeof(buf));
      if (len < 6 || memcmp(buf, "<!--#", 5) != 0) {
        (void)ns_send(nc, buf, (size_t)len);
      } else {
        if (!memcmp(buf + 5, "include", 7)) {
          do_ssi_include(nc, path, buf + 12, include_level, opts);
        } else if (!memcmp(buf + 5, "exec", 4)) {
          do_ssi_exec(nc, buf + 9);
        } else {
        }
      }
      len = 0;
    } else if (in_ssi_tag) {
      if (len == 5 && memcmp(buf, "<!--#", 5) != 0) {
        in_ssi_tag = 0;
      } else if (len == (int)sizeof(buf) - 2) {
        ns_printf(nc, "%s: SSI tag is too large", path);
        len = 0;
      }
      buf[len++] = ch & 0xff;
    } else if (ch == '<') {
      in_ssi_tag = 1;
      if (len > 0) {
        ns_send(nc, buf, (size_t)len);
      }
      len = 0;
      buf[len++] = ch & 0xff;
    } else {
      buf[len++] = ch & 0xff;
      if (len == (int)sizeof(buf)) {
        ns_send(nc, buf, (size_t)len);
        len = 0;
      }
    }
  }
  if (len > 0) {
    ns_send(nc, buf, (size_t)len);
  }
}


x86 assembly (clang, -O0):
<send_ssi_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    0x2e46(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x60(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jle    11e5 <send_ssi_file+0x75>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe2c(%rip),%rsi
call   1090 <ns_printf@plt>
movl   $0x1,-0x4c(%rbp)
jmp    14ae <send_ssi_file+0x33e>
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x3c(%rbp)
mov    0x2ddb(%rip),%rcx
cmp    (%rcx),%eax
je     148c <send_ssi_file+0x31c>
cmpl   $0x0,-0x48(%rbp)
je     1341 <send_ssi_file+0x1d1>
cmpl   $0x3e,-0x3c(%rbp)
jne    1341 <send_ssi_file+0x1d1>
mov    -0x60(%rbp),%rcx
mov    -0x58(%rbp),%rax
movl   $0x0,-0x48(%rbp)
mov    -0x3c(%rbp),%edx
mov    %dl,%sil
mov    -0x44(%rbp),%edx
mov    %edx,%edi
add    $0x1,%edi
mov    %edi,-0x44(%rbp)
movslq %edx,%rdx
mov    %sil,(%rax,%rdx,1)
movslq -0x44(%rbp),%rdx
movb   $0x0,(%rax,%rdx,1)
mov    -0x44(%rbp),%eax
cmp    %ecx,%eax
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
cmpl   $0x6,-0x44(%rbp)
jl     1293 <send_ssi_file+0x123>
mov    -0x58(%rbp),%rdi
lea    0xda5(%rip),%rsi
mov    $0x5,%edx
call   1060 <memcmp@plt>
cmp    $0x0,%rax
je     12a9 <send_ssi_file+0x139>
mov    -0x58(%rbp),%rsi
mov    -0x8(%rbp),%rdi
movslq -0x44(%rbp),%rdx
call   1050 <ns_send@plt>
jmp    1335 <send_ssi_file+0x1c5>
mov    -0x58(%rbp),%rdi
add    $0x5,%rdi
lea    0xd72(%rip),%rsi
mov    $0x7,%edx
call   1060 <memcmp@plt>
cmp    $0x0,%rax
jne    12ed <send_ssi_file+0x17d>
mov    -0x58(%rbp),%rdx
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0xc,%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x28(%rbp),%r8
call   1030 <do_ssi_include@plt>
jmp    1330 <send_ssi_file+0x1c0>
mov    -0x58(%rbp),%rdi
add    $0x5,%rdi
lea    0xd36(%rip),%rsi
mov    $0x4,%edx
call   1060 <memcmp@plt>
cmp    $0x0,%rax
jne    1326 <send_ssi_file+0x1b6>
mov    -0x58(%rbp),%rsi
mov    -0x8(%rbp),%rdi
add    $0x9,%rsi
call   1080 <do_ssi_exec@plt>
jmp    132b <send_ssi_file+0x1bb>
jmp    132b <send_ssi_file+0x1bb>
jmp    1330 <send_ssi_file+0x1c0>
jmp    1335 <send_ssi_file+0x1c5>
movl   $0x0,-0x44(%rbp)
jmp    1487 <send_ssi_file+0x317>
cmpl   $0x0,-0x48(%rbp)
je     13d7 <send_ssi_file+0x267>
cmpl   $0x5,-0x44(%rbp)
jne    1380 <send_ssi_file+0x210>
mov    -0x58(%rbp),%rdi
lea    0xcc4(%rip),%rsi
mov    $0x5,%edx
call   1060 <memcmp@plt>
cmp    $0x0,%rax
je     1380 <send_ssi_file+0x210>
movl   $0x0,-0x48(%rbp)
jmp    13b2 <send_ssi_file+0x242>
mov    -0x60(%rbp),%rcx
mov    -0x44(%rbp),%eax
sub    $0x2,%ecx
cmp    %ecx,%eax
jne    13ad <send_ssi_file+0x23d>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xc96(%rip),%rsi
call   1090 <ns_printf@plt>
movl   $0x0,-0x44(%rbp)
jmp    13b2 <send_ssi_file+0x242>
mov    -0x58(%rbp),%rax
mov    -0x3c(%rbp),%ecx
and    $0xff,%ecx
mov    %cl,%dl
mov    -0x44(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x44(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1482 <send_ssi_file+0x312>
cmpl   $0x3c,-0x3c(%rbp)
jne    142f <send_ssi_file+0x2bf>
movl   $0x1,-0x48(%rbp)
cmpl   $0x0,-0x44(%rbp)
jle    1403 <send_ssi_file+0x293>
mov    -0x58(%rbp),%rsi
mov    -0x8(%rbp),%rdi
movslq -0x44(%rbp),%rdx
call   1050 <ns_send@plt>
mov    -0x58(%rbp),%rax
movl   $0x0,-0x44(%rbp)
mov    -0x3c(%rbp),%ecx
and    $0xff,%ecx
mov    %cl,%dl
mov    -0x44(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x44(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    147d <send_ssi_file+0x30d>
mov    -0x60(%rbp),%rcx
mov    -0x58(%rbp),%rax
mov    -0x3c(%rbp),%edx
and    $0xff,%edx
mov    %dl,%sil
mov    -0x44(%rbp),%edx
mov    %edx,%edi
add    $0x1,%edi
mov    %edi,-0x44(%rbp)
movslq %edx,%rdx
mov    %sil,(%rax,%rdx,1)
mov    -0x44(%rbp),%eax
cmp    %ecx,%eax
jne    1478 <send_ssi_file+0x308>
mov    -0x58(%rbp),%rsi
mov    -0x8(%rbp),%rdi
movslq -0x44(%rbp),%rdx
call   1050 <ns_send@plt>
movl   $0x0,-0x44(%rbp)
jmp    147d <send_ssi_file+0x30d>
jmp    1482 <send_ssi_file+0x312>
jmp    1487 <send_ssi_file+0x317>
jmp    11fa <send_ssi_file+0x8a>
cmpl   $0x0,-0x44(%rbp)
jle    14a7 <send_ssi_file+0x337>
mov    -0x58(%rbp),%rsi
mov    -0x8(%rbp),%rdi
movslq -0x44(%rbp),%rdx
call   1050 <ns_send@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_ssi_file>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r13
mov    0x2e47(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
lea    0xf(%rsi),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rdx
mov    %rdx,%rsp
cmp    $0xa,%ecx
jle    11c9 <send_ssi_file+0x59>
lea    0xe50(%rip),%rsi
mov    %r13,%rdi
mov    %rbx,%rdx
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <ns_printf@plt>
mov    %r8,%r14
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %ecx,-0x3c(%rbp)
mov    %r15,%rdi
call   1040 <fgetc@plt>
mov    %eax,%r12d
mov    0x2dff(%rip),%rax
cmp    (%rax),%r12d
je     13ff <send_ssi_file+0x28f>
mov    %r14,-0x60(%rbp)
mov    %rbx,-0x48(%rbp)
movslq -0x38(%rbp),%rax
mov    %rax,-0x68(%rbp)
add    $0xfffffffe,%eax
mov    %eax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
lea    0x5(%rax),%rcx
mov    %rcx,-0x70(%rbp)
lea    0x9(%rax),%rcx
mov    %rcx,-0x50(%rbp)
add    $0xc,%rax
mov    %rax,-0x58(%rbp)
xor    %ebx,%ebx
xor    %r14d,%r14d
mov    %r15,-0x78(%rbp)
jmp    1279 <send_ssi_file+0x109>
mov    %r15,%rdi
lea    0xdfe(%rip),%rsi
mov    -0x48(%rbp),%rdx
call   1090 <ns_printf@plt>
xor    %r13d,%r13d
movslq %r13d,%rax
add    $0x1,%r13d
mov    -0x30(%rbp),%rcx
mov    %r12b,(%rcx,%rax,1)
mov    %r13d,%r14d
mov    %r15,%r13
mov    -0x78(%rbp),%r15
mov    %r15,%rdi
call   1040 <fgetc@plt>
mov    %eax,%r12d
mov    0x2d78(%rip),%rax
cmp    (%rax),%r12d
je     13eb <send_ssi_file+0x27b>
test   %ebx,%ebx
je     12e0 <send_ssi_file+0x170>
cmp    $0x3e,%r12d
jne    12e0 <send_ssi_file+0x170>
movslq %r14d,%rbx
mov    -0x30(%rbp),%r12
movw   $0x3e,(%r12,%rbx,1)
xor    %edi,%edi
cmp    -0x38(%rbp),%r14d
setl   %dil
call   1070 <assert@plt>
cmp    $0x5,%r14d
jl     12c3 <send_ssi_file+0x153>
mov    %r12,%rdi
lea    0xd74(%rip),%rsi
mov    $0x5,%edx
call   1060 <memcmp@plt>
test   %rax,%rax
je     135a <send_ssi_file+0x1ea>
add    $0x1,%rbx
mov    %r13,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <ns_send@plt>
xor    %r14d,%r14d
xor    %ebx,%ebx
jmp    125e <send_ssi_file+0xee>
nopl   0x0(%rax)
test   %ebx,%ebx
je     132a <send_ssi_file+0x1ba>
mov    %r13,%r15
cmp    $0x5,%r14d
jne    1313 <send_ssi_file+0x1a3>
mov    $0x5,%r13d
mov    -0x30(%rbp),%rdi
lea    0xd26(%rip),%rsi
mov    $0x5,%edx
call   1060 <memcmp@plt>
xor    %ebx,%ebx
test   %rax,%rax
jne    1245 <send_ssi_file+0xd5>
mov    $0x1,%ebx
cmp    -0x40(%rbp),%r14d
je     122f <send_ssi_file+0xbf>
mov    %r14d,%r13d
jmp    1245 <send_ssi_file+0xd5>
cmp    $0x3c,%r12d
jne    13a8 <send_ssi_file+0x238>
test   %r14d,%r14d
mov    -0x30(%rbp),%rbx
jle    1347 <send_ssi_file+0x1d7>
mov    %r14d,%edx
mov    %r13,%rdi
mov    %rbx,%rsi
call   1050 <ns_send@plt>
movb   $0x3c,(%rbx)
mov    $0x1,%r14d
mov    $0x1,%ebx
jmp    125e <send_ssi_file+0xee>
mov    -0x70(%rbp),%rbx
mov    %rbx,%rdi
lea    0xcc2(%rip),%rsi
mov    $0x7,%edx
call   1060 <memcmp@plt>
test   %rax,%rax
je     13cf <send_ssi_file+0x25f>
mov    %rbx,%rdi
lea    0xcb1(%rip),%rsi
mov    $0x4,%edx
call   1060 <memcmp@plt>
xor    %r14d,%r14d
test   %rax,%rax
jne    12d8 <send_ssi_file+0x168>
mov    %r13,%rdi
mov    -0x50(%rbp),%rsi
call   1080 <do_ssi_exec@plt>
jmp    12d8 <send_ssi_file+0x168>
movslq %r14d,%rax
add    $0x1,%r14d
mov    -0x30(%rbp),%rsi
mov    %r12b,(%rsi,%rax,1)
xor    %ebx,%ebx
cmp    -0x38(%rbp),%r14d
jne    125e <send_ssi_file+0xee>
mov    %r13,%rdi
mov    -0x68(%rbp),%rdx
jmp    12d0 <send_ssi_file+0x160>
mov    %r13,%rdi
mov    -0x48(%rbp),%rsi
mov    -0x58(%rbp),%rdx
mov    -0x3c(%rbp),%ecx
mov    -0x60(%rbp),%r8
call   1030 <do_ssi_include@plt>
jmp    12d5 <send_ssi_file+0x165>
test   %r14d,%r14d
jle    13ff <send_ssi_file+0x28f>
mov    %r14d,%edx
mov    %r13,%rdi
mov    -0x30(%rbp),%rsi
call   1050 <ns_send@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ns_connection = type { i32 }
%struct.ns_serve_http_opts = type { i32 }
@BUFSIZ = global i32 0
@.str = [36 x i8] c"SSI #include level is too deep (%s)\00"
@EOF = global i32 0
@.str.1 = [6 x i8] c"<!--#\00"
@.str.2 = [8 x i8] c"include\00"
@.str.3 = [5 x i8] c"exec\00"
@.str.4 = [25 x i8] c"%s: SSI tag is too large\00"
define void @send_ssi_file(%struct.ns_connection* %0, i8* %1, i32* %2, i32 %3, %struct.ns_serve_http_opts* %4) {
%6 = alloca %struct.ns_connection*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca %struct.ns_serve_http_opts*
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store %struct.ns_connection* %0, %struct.ns_connection** %6
store i8* %1, i8** %7
store i32* %2, i32** %8
store i32 %3, i32* %9
store %struct.ns_serve_http_opts* %4, %struct.ns_serve_http_opts** %10
%18 = load i32, i32* @BUFSIZ
%19 = zext i32 %18 to i64
%20 = call i8* @llvm.stacksave()
store i8* %20, i8** %11
%21 = alloca i8, i64 %19
store i64 %19, i64* %12
%22 = load i32, i32* %9
%23 = icmp sgt i32 %22, 10
br i1 %23, label %24, label %28
24: ; preds = %5
%25 = load %struct.ns_connection*, %struct.ns_connection** %6
%26 = load i8*, i8** %7
%27 = call i32 @ns_printf(%struct.ns_connection* %25, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %26)
store i32 1, i32* %17
br label %164
28: ; preds = %5
store i32 0, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
br label %29
29: ; preds = %154, %28
%30 = load i32*, i32** %8
%31 = call i32 @fgetc(i32* %30)
store i32 %31, i32* %13
%32 = load i32, i32* @EOF
%33 = icmp ne i32 %31, %32
br i1 %33, label %34, label %155
34: ; preds = %29
%35 = load i32, i32* %16
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %88
37: ; preds = %34
%38 = load i32, i32* %13
%39 = icmp eq i32 %38, 62
br i1 %39, label %40, label %88
40: ; preds = %37
store i32 0, i32* %16
%41 = load i32, i32* %13
%42 = trunc i32 %41 to i8
%43 = load i32, i32* %15
%44 = add nsw i32 %43, 1
store i32 %44, i32* %15
%45 = sext i32 %43 to i64
%46 = getelementptr inbounds i8, i8* %21, i64 %45
store i8 %42, i8* %46
%47 = load i32, i32* %15
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %21, i64 %48
store i8 0, i8* %49
%50 = load i32, i32* %15
%51 = trunc i64 %19 to i32
%52 = icmp sle i32 %50, %51
%53 = zext i1 %52 to i32
%54 = call i32 @assert(i32 %53)
%55 = load i32, i32* %15
%56 = icmp slt i32 %55, 6
br i1 %56, label %60, label %57
57: ; preds = %40
%58 = call i64 @memcmp(i8* %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%59 = icmp ne i64 %58, 0
br i1 %59, label %60, label %65
60: ; preds = %57, %40
%61 = load %struct.ns_connection*, %struct.ns_connection** %6
%62 = load i32, i32* %15
%63 = sext i32 %62 to i64
%64 = call i32 @ns_send(%struct.ns_connection* %61, i8* %21, i64 %63)
br label %87
65: ; preds = %57
%66 = getelementptr inbounds i8, i8* %21, i64 5
%67 = call i64 @memcmp(i8* %66, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 7)
%68 = icmp ne i64 %67, 0
br i1 %68, label %76, label %69
69: ; preds = %65
%70 = load %struct.ns_connection*, %struct.ns_connection** %6
%71 = load i8*, i8** %7
%72 = getelementptr inbounds i8, i8* %21, i64 12
%73 = load i32, i32* %9
%74 = load %struct.ns_serve_http_opts*, %struct.ns_serve_http_opts** %10
%75 = call i32 @do_ssi_include(%struct.ns_connection* %70, i8* %71, i8* %72, i32 %73, %struct.ns_serve_http_opts* %74)
br label %86
76: ; preds = %65
%77 = getelementptr inbounds i8, i8* %21, i64 5
%78 = call i64 @memcmp(i8* %77, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 4)
%79 = icmp ne i64 %78, 0
br i1 %79, label %84, label %80
80: ; preds = %76
%81 = load %struct.ns_connection*, %struct.ns_connection** %6
%82 = getelementptr inbounds i8, i8* %21, i64 9
%83 = call i32 @do_ssi_exec(%struct.ns_connection* %81, i8* %82)
br label %85
84: ; preds = %76
br label %85
85: ; preds = %84, %80
br label %86
86: ; preds = %85, %69
br label %87
87: ; preds = %86, %60
store i32 0, i32* %15
br label %154
88: ; preds = %37, %34
%89 = load i32, i32* %16
%90 = icmp ne i32 %89, 0
br i1 %90, label %91, label %116
91: ; preds = %88
%92 = load i32, i32* %15
%93 = icmp eq i32 %92, 5
br i1 %93, label %94, label %98
94: ; preds = %91
%95 = call i64 @memcmp(i8* %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%96 = icmp ne i64 %95, 0
br i1 %96, label %97, label %98
97: ; preds = %94
store i32 0, i32* %16
br label %108
98: ; preds = %94, %91
%99 = load i32, i32* %15
%100 = trunc i64 %19 to i32
%101 = sub nsw i32 %100, 2
%102 = icmp eq i32 %99, %101
br i1 %102, label %103, label %107
103: ; preds = %98
%104 = load %struct.ns_connection*, %struct.ns_connection** %6
%105 = load i8*, i8** %7
%106 = call i32 @ns_printf(%struct.ns_connection* %104, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* %105)
store i32 0, i32* %15
br label %107
107: ; preds = %103, %98
br label %108
108: ; preds = %107, %97
%109 = load i32, i32* %13
%110 = and i32 %109, 255
%111 = trunc i32 %110 to i8
%112 = load i32, i32* %15
%113 = add nsw i32 %112, 1
store i32 %113, i32* %15
%114 = sext i32 %112 to i64
%115 = getelementptr inbounds i8, i8* %21, i64 %114
store i8 %111, i8* %115
br label %153
116: ; preds = %88
%117 = load i32, i32* %13
%118 = icmp eq i32 %117, 60
br i1 %118, label %119, label %135
119: ; preds = %116
store i32 1, i32* %16
%120 = load i32, i32* %15
%121 = icmp sgt i32 %120, 0
br i1 %121, label %122, label %127
122: ; preds = %119
%123 = load %struct.ns_connection*, %struct.ns_connection** %6
%124 = load i32, i32* %15
%125 = sext i32 %124 to i64
%126 = call i32 @ns_send(%struct.ns_connection* %123, i8* %21, i64 %125)
br label %127
127: ; preds = %122, %119
store i32 0, i32* %15
%128 = load i32, i32* %13
%129 = and i32 %128, 255
%130 = trunc i32 %129 to i8
%131 = load i32, i32* %15
%132 = add nsw i32 %131, 1
store i32 %132, i32* %15
%133 = sext i32 %131 to i64
%134 = getelementptr inbounds i8, i8* %21, i64 %133
store i8 %130, i8* %134
br label %152
135: ; preds = %116
%136 = load i32, i32* %13
%137 = and i32 %136, 255
%138 = trunc i32 %137 to i8
%139 = load i32, i32* %15
%140 = add nsw i32 %139, 1
store i32 %140, i32* %15
%141 = sext i32 %139 to i64
%142 = getelementptr inbounds i8, i8* %21, i64 %141
store i8 %138, i8* %142
%143 = load i32, i32* %15
%144 = trunc i64 %19 to i32
%145 = icmp eq i32 %143, %144
br i1 %145, label %146, label %151
146: ; preds = %135
%147 = load %struct.ns_connection*, %struct.ns_connection** %6
%148 = load i32, i32* %15
%149 = sext i32 %148 to i64
%150 = call i32 @ns_send(%struct.ns_connection* %147, i8* %21, i64 %149)
store i32 0, i32* %15
br label %151
151: ; preds = %146, %135
br label %152
152: ; preds = %151, %127
br label %153
153: ; preds = %152, %108
br label %154
154: ; preds = %153, %87
br label %29
155: ; preds = %29
%156 = load i32, i32* %15
%157 = icmp sgt i32 %156, 0
br i1 %157, label %158, label %163
158: ; preds = %155
%159 = load %struct.ns_connection*, %struct.ns_connection** %6
%160 = load i32, i32* %15
%161 = sext i32 %160 to i64
%162 = call i32 @ns_send(%struct.ns_connection* %159, i8* %21, i64 %161)
br label %163
163: ; preds = %158, %155
store i32 0, i32* %17
br label %164
164: ; preds = %163, %24
%165 = load i8*, i8** %11
%166 = load i32, i32* %17
switch i32 %166, label %168 [
i32 0, label %167
i32 1, label %167
]
167: ; preds = %164, %164
ret void
168: ; preds = %164
unreachable
}

LLVM IR (-O2):
%struct.ns_connection = type { i32 }
%struct.ns_serve_http_opts = type { i32 }
@BUFSIZ = global i32 0
@.str = [36 x i8] c"SSI #include level is too deep (%s)\00"
@EOF = global i32 0
@.str.1 = [6 x i8] c"<!--#\00"
@.str.2 = [8 x i8] c"include\00"
@.str.3 = [5 x i8] c"exec\00"
@.str.4 = [25 x i8] c"%s: SSI tag is too large\00"
define void @send_ssi_file(%struct.ns_connection* %0, i8* %1, i32* nocapture %2, i32 %3, %struct.ns_serve_http_opts* %4) {
%6 = load i32, i32* @BUFSIZ
%7 = zext i32 %6 to i64
%8 = alloca i8, i64 %7
%9 = icmp sgt i32 %3, 10
br i1 %9, label %20, label %10
10: ; preds = %5
%11 = call i32 @fgetc(i32* %2)
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %98, label %14
14: ; preds = %10
%15 = add nsw i32 %6, -2
%16 = getelementptr inbounds i8, i8* %8, i64 5
%17 = getelementptr inbounds i8, i8* %8, i64 9
%18 = getelementptr inbounds i8, i8* %8, i64 12
%19 = sext i32 %6 to i64
br label %22
20: ; preds = %5
%21 = tail call i32 @ns_printf(%struct.ns_connection* %0, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %98
22: ; preds = %14, %87
%23 = phi i32 [ %11, %14 ], [ %90, %87 ]
%24 = phi i32 [ 0, %14 ], [ %89, %87 ]
%25 = phi i32 [ 0, %14 ], [ %88, %87 ]
%26 = icmp ne i32 %24, 0
%27 = icmp eq i32 %23, 62
%28 = and i1 %26, %27
br i1 %28, label %29, label %54
29: ; preds = %22
%30 = add nsw i32 %25, 1
%31 = sext i32 %25 to i64
%32 = getelementptr inbounds i8, i8* %8, i64 %31
store i8 62, i8* %32
%33 = sext i32 %30 to i64
%34 = getelementptr inbounds i8, i8* %8, i64 %33
store i8 0, i8* %34
%35 = icmp slt i32 %25, %6
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
%38 = icmp slt i32 %25, 5
br i1 %38, label %42, label %39
39: ; preds = %29
%40 = call i64 @memcmp(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%41 = icmp eq i64 %40, 0
br i1 %41, label %44, label %42
42: ; preds = %39, %29
%43 = call i32 @ns_send(%struct.ns_connection* %0, i8* %8, i64 %33)
br label %87
44: ; preds = %39
%45 = call i64 @memcmp(i8* %16, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 7)
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %44
%48 = call i32 @do_ssi_include(%struct.ns_connection* %0, i8* %1, i8* %18, i32 %3, %struct.ns_serve_http_opts* %4)
br label %87
49: ; preds = %44
%50 = call i64 @memcmp(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 4)
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %87
52: ; preds = %49
%53 = call i32 @do_ssi_exec(%struct.ns_connection* %0, i8* %17)
br label %87
54: ; preds = %22
br i1 %26, label %55, label %71
55: ; preds = %54
%56 = icmp eq i32 %25, 5
br i1 %56, label %57, label %60
57: ; preds = %55
%58 = call i64 @memcmp(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %64
60: ; preds = %57, %55
%61 = icmp eq i32 %25, %15
br i1 %61, label %62, label %64
62: ; preds = %60
%63 = call i32 @ns_printf(%struct.ns_connection* %0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* %1)
br label %64
64: ; preds = %57, %60, %62
%65 = phi i32 [ 0, %62 ], [ %25, %60 ], [ 5, %57 ]
%66 = phi i32 [ 1, %62 ], [ 1, %60 ], [ 0, %57 ]
%67 = trunc i32 %23 to i8
%68 = add nsw i32 %65, 1
%69 = sext i32 %65 to i64
%70 = getelementptr inbounds i8, i8* %8, i64 %69
store i8 %67, i8* %70
br label %87
71: ; preds = %54
%72 = icmp eq i32 %23, 60
br i1 %72, label %73, label %79
73: ; preds = %71
%74 = icmp sgt i32 %25, 0
br i1 %74, label %75, label %78
75: ; preds = %73
%76 = zext i32 %25 to i64
%77 = call i32 @ns_send(%struct.ns_connection* %0, i8* %8, i64 %76)
br label %78
78: ; preds = %75, %73
store i8 60, i8* %8
br label %87
79: ; preds = %71
%80 = trunc i32 %23 to i8
%81 = add nsw i32 %25, 1
%82 = sext i32 %25 to i64
%83 = getelementptr inbounds i8, i8* %8, i64 %82
store i8 %80, i8* %83
%84 = icmp eq i32 %81, %6
br i1 %84, label %85, label %87
85: ; preds = %79
%86 = call i32 @ns_send(%struct.ns_connection* %0, i8* %8, i64 %19)
br label %87
87: ; preds = %42, %52, %49, %47, %64, %79, %85, %78
%88 = phi i32 [ %68, %64 ], [ 1, %78 ], [ 0, %85 ], [ %81, %79 ], [ 0, %47 ], [ 0, %49 ], [ 0, %52 ], [ 0, %42 ]
%89 = phi i32 [ %66, %64 ], [ 1, %78 ], [ 0, %85 ], [ 0, %79 ], [ 0, %47 ], [ 0, %49 ], [ 0, %52 ], [ 0, %42 ]
%90 = call i32 @fgetc(i32* %2)
%91 = load i32, i32* @EOF
%92 = icmp eq i32 %90, %91
br i1 %92, label %93, label %22
93: ; preds = %87
%94 = icmp sgt i32 %88, 0
br i1 %94, label %95, label %98
95: ; preds = %93
%96 = zext i32 %88 to i64
%97 = call i32 @ns_send(%struct.ns_connection* %0, i8* %8, i64 %96)
br label %98
98: ; preds = %10, %93, %95, %20
ret void
}