#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 atoi(char *);
int fread(char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/);
char *getenv(char *);
scalar_t__ malloc(int);
int memcmp(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strstr(char *, char *);
int main(void) {
  char *buf = NULL;
  char *content_type = NULL;
  char *p1 = NULL;
  char *p2 = NULL;
  char boundary[256] = {0};
  char *content_length = NULL;
  int len = 0;
  char pattern[256] = {0};
  int read_len = 0;
  char *p3 = NULL;
  char *p4 = NULL;
  char *p5 = NULL;
  int ret = 0;
  int i = 0;
  int rest = 0;
  char file_content_type[256] = {0};
  char *file_buf = NULL;
  content_type = getenv("CONTENT_TYPE");
  p1 = strstr(content_type, "multipart/form-data");
  if (p1 != NULL) {
    p2 = strstr(p1, "boundary=");
    if (p2 != NULL) {
      strcpy(boundary, p2 + strlen("boundary="));
      content_length = getenv("CONTENT_LENGTH");
      len = atoi(content_length);
      buf = (char *)malloc(sizeof(char) * (len + 1));
      memset(buf, 0, len + 1);
      read_len = fread(buf, sizeof(char), len, stdin);
      if (len == read_len) {
        strcat(pattern, "--");
        strcat(pattern, boundary);
        p3 = strstr(buf, pattern);
        if (p3 != NULL) {
          p4 = strstr(p3, "Content-Type: ");
          if (p4 != NULL) {
            p5 = strstr(p4, "\r\n\r\n");
            if (p5 != NULL) {
              strncpy(file_content_type, p4 + strlen("Content-Type: "),
                      p5 - (p4 + strlen("Content-Type: ")));
              rest = len - ((p5 + 4) - buf);
              for (i = 0; i < rest; i++) {
                ret = memcmp(p5 + 4 + i, pattern, strlen(pattern));
                if (ret == 0) {
                  file_buf = (char *)malloc(sizeof(char) * (i - 1));
                  memset(file_buf, 0, i - 1);
                  memcpy(file_buf, p5 + 4, i - 2);
                  printf("Content-type: %s\n", file_content_type);
                  printf("Content-length: %d\n", i - 2);
                  printf("\n");
                  fwrite(file_buf, sizeof(char), i - 2, stdout);
                  free(file_buf);
                  break;
                }
              }
            }
          }
        }
      }
      free(buf);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3c0,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
lea    -0x130(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   10a0 <memset@plt>
movq   $0x0,-0x138(%rbp)
movl   $0x0,-0x13c(%rbp)
lea    -0x240(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   10a0 <memset@plt>
movl   $0x0,-0x244(%rbp)
movq   $0x0,-0x250(%rbp)
movq   $0x0,-0x258(%rbp)
movq   $0x0,-0x260(%rbp)
movl   $0x0,-0x264(%rbp)
movl   $0x0,-0x268(%rbp)
movl   $0x0,-0x26c(%rbp)
lea    -0x370(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   10a0 <memset@plt>
movq   $0x0,-0x378(%rbp)
lea    0xd35(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xd2e(%rip),%rsi
call   1110 <strstr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     169f <main+0x4af>
mov    -0x20(%rbp),%rdi
lea    0xd23(%rip),%rsi
call   1110 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     169a <main+0x4aa>
lea    -0x130(%rbp),%rax
mov    %rax,-0x380(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x388(%rbp)
lea    0xcef(%rip),%rdi
call   1080 <strlen@plt>
mov    -0x388(%rbp),%rsi
mov    -0x380(%rbp),%rdi
cltq
add    %rax,%rsi
call   1060 <strcpy@plt>
lea    0xcd5(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x138(%rbp)
mov    -0x138(%rbp),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x13c(%rbp)
mov    -0x13c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x13c(%rbp),%edx
add    $0x1,%edx
xor    %esi,%esi
call   10a0 <memset@plt>
mov    -0x10(%rbp),%rdi
mov    -0x13c(%rbp),%edx
mov    0x2c35(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
call   1070 <fread@plt>
mov    %eax,-0x244(%rbp)
mov    -0x13c(%rbp),%eax
cmp    -0x244(%rbp),%eax
jne    1691 <main+0x4a1>
lea    -0x240(%rbp),%rdi
lea    0xc55(%rip),%rsi
call   10f0 <strcat@plt>
lea    -0x240(%rbp),%rdi
lea    -0x130(%rbp),%rsi
call   10f0 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    -0x240(%rbp),%rsi
call   1110 <strstr@plt>
mov    %rax,-0x250(%rbp)
cmpq   $0x0,-0x250(%rbp)
je     168c <main+0x49c>
mov    -0x250(%rbp),%rdi
lea    0xc0d(%rip),%rsi
call   1110 <strstr@plt>
mov    %rax,-0x258(%rbp)
cmpq   $0x0,-0x258(%rbp)
je     1687 <main+0x497>
mov    -0x258(%rbp),%rdi
lea    0xbf4(%rip),%rsi
call   1110 <strstr@plt>
mov    %rax,-0x260(%rbp)
cmpq   $0x0,-0x260(%rbp)
je     1682 <main+0x492>
lea    -0x370(%rbp),%rax
mov    %rax,-0x3a0(%rbp)
mov    -0x258(%rbp),%rax
mov    %rax,-0x3b0(%rbp)
lea    0xba8(%rip),%rdi
call   1080 <strlen@plt>
mov    %eax,%ecx
mov    -0x3b0(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x398(%rbp)
mov    -0x260(%rbp),%rax
mov    %rax,-0x390(%rbp)
mov    -0x258(%rbp),%rax
mov    %rax,-0x3a8(%rbp)
lea    0xb6a(%rip),%rdi
call   1080 <strlen@plt>
mov    -0x3a8(%rbp),%rcx
mov    -0x3a0(%rbp),%rdi
mov    -0x398(%rbp),%rsi
mov    %eax,%edx
mov    -0x390(%rbp),%rax
movslq %edx,%rdx
add    %rdx,%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1050 <strncpy@plt>
movslq -0x13c(%rbp),%rax
mov    -0x260(%rbp),%rcx
add    $0x4,%rcx
mov    -0x10(%rbp),%rdx
sub    %rdx,%rcx
sub    %rcx,%rax
mov    %eax,-0x26c(%rbp)
movl   $0x0,-0x268(%rbp)
mov    -0x268(%rbp),%eax
cmp    -0x26c(%rbp),%eax
jge    167d <main+0x48d>
mov    -0x260(%rbp),%rax
add    $0x4,%rax
movslq -0x268(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x3c0(%rbp)
lea    -0x240(%rbp),%rax
mov    %rax,-0x3b8(%rbp)
lea    -0x240(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0x3c0(%rbp),%rdi
mov    -0x3b8(%rbp),%rsi
mov    %eax,%edx
call   10b0 <memcmp@plt>
mov    %eax,-0x264(%rbp)
cmpl   $0x0,-0x264(%rbp)
jne    1664 <main+0x474>
mov    -0x268(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x378(%rbp)
mov    -0x378(%rbp),%rdi
mov    -0x268(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   10a0 <memset@plt>
mov    -0x378(%rbp),%rdi
mov    -0x260(%rbp),%rsi
add    $0x4,%rsi
mov    -0x268(%rbp),%edx
sub    $0x2,%edx
call   10c0 <memcpy@plt>
lea    -0x370(%rbp),%rsi
lea    0xa4d(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x268(%rbp),%esi
sub    $0x2,%esi
lea    0xa48(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xa26(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x378(%rbp),%rdi
mov    -0x268(%rbp),%edx
sub    $0x2,%edx
mov    0x2991(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
call   1100 <fwrite@plt>
mov    -0x378(%rbp),%rdi
call   1040 <free@plt>
jmp    167d <main+0x48d>
jmp    1669 <main+0x479>
mov    -0x268(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x268(%rbp)
jmp    1532 <main+0x342>
jmp    1682 <main+0x492>
jmp    1687 <main+0x497>
jmp    168c <main+0x49c>
jmp    1691 <main+0x4a1>
mov    -0x10(%rbp),%rdi
call   1040 <free@plt>
jmp    169f <main+0x4af>
xor    %eax,%eax
add    $0x3c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x308,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x2f0(%rsp)
movaps %xmm0,0x2e0(%rsp)
movaps %xmm0,0x2d0(%rsp)
movaps %xmm0,0x2c0(%rsp)
movaps %xmm0,0x2b0(%rsp)
movaps %xmm0,0x2a0(%rsp)
movaps %xmm0,0x290(%rsp)
movaps %xmm0,0x280(%rsp)
movaps %xmm0,0x270(%rsp)
movaps %xmm0,0x260(%rsp)
movaps %xmm0,0x250(%rsp)
movaps %xmm0,0x240(%rsp)
movaps %xmm0,0x230(%rsp)
movaps %xmm0,0x220(%rsp)
movaps %xmm0,0x210(%rsp)
movaps %xmm0,0x200(%rsp)
movaps %xmm0,0x1f0(%rsp)
movaps %xmm0,0x1e0(%rsp)
movaps %xmm0,0x1d0(%rsp)
movaps %xmm0,0x1c0(%rsp)
movaps %xmm0,0x1b0(%rsp)
movaps %xmm0,0x1a0(%rsp)
movaps %xmm0,0x190(%rsp)
movaps %xmm0,0x180(%rsp)
movaps %xmm0,0x170(%rsp)
movaps %xmm0,0x160(%rsp)
movaps %xmm0,0x150(%rsp)
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0xc7e(%rip),%rdi
call   1030 <getenv@plt>
lea    0xc7f(%rip),%rsi
mov    %rax,%rdi
call   1120 <strstr@plt>
test   %rax,%rax
je     15a9 <main+0x3a9>
lea    0xc7b(%rip),%rsi
mov    %rax,%rdi
call   1120 <strstr@plt>
test   %rax,%rax
je     15a9 <main+0x3a9>
mov    %rax,%rbx
lea    0xc60(%rip),%rdi
call   1090 <strlen@plt>
cltq
add    %rax,%rbx
lea    0x200(%rsp),%rdi
mov    %rbx,%rsi
call   1070 <strcpy@plt>
lea    0xc49(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   10f0 <atoi@plt>
mov    %eax,%ebx
lea    0x1(%rbx),%ebp
mov    %ebp,%edi
call   10e0 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   10b0 <memset@plt>
mov    0x2bd7(%rip),%rax
mov    (%rax),%ecx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ebx,%edx
call   1080 <fread@plt>
cmp    %eax,%ebx
jne    15a1 <main+0x3a1>
lea    0xc09(%rip),%rsi
lea    0x100(%rsp),%rbp
mov    %rbp,%rdi
call   1100 <strcat@plt>
lea    0x200(%rsp),%rsi
mov    %rbp,%rdi
call   1100 <strcat@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1120 <strstr@plt>
test   %rax,%rax
je     15a1 <main+0x3a1>
lea    0xbd1(%rip),%rsi
mov    %rax,%rdi
call   1120 <strstr@plt>
test   %rax,%rax
je     15a1 <main+0x3a1>
mov    %rax,%rbp
lea    0xbc5(%rip),%rsi
mov    %rax,%rdi
call   1120 <strstr@plt>
test   %rax,%rax
je     15a1 <main+0x3a1>
mov    %rax,%r15
lea    0xb9b(%rip),%r12
mov    %r12,%rdi
call   1090 <strlen@plt>
cltq
mov    %rbp,%r13
add    %rax,%r13
mov    %r12,%rdi
call   1090 <strlen@plt>
add    %ebp,%eax
mov    %r15d,%edx
sub    %eax,%edx
mov    %rsp,%rdi
mov    %r13,%rsi
call   1060 <strncpy@plt>
add    $0x4,%r15
mov    %r14d,%eax
sub    %r15d,%eax
add    %eax,%ebx
test   %ebx,%ebx
jle    15a1 <main+0x3a1>
mov    %ebx,%r13d
neg    %r13
xor    %ebx,%ebx
lea    0x100(%rsp),%r12
mov    %r15,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rdi
call   1090 <strlen@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %eax,%edx
call   10c0 <memcmp@plt>
test   %eax,%eax
je     1528 <main+0x328>
add    $0xffffffffffffffff,%rbx
add    $0x1,%rbp
cmp    %rbx,%r13
jne    1500 <main+0x300>
jmp    15a1 <main+0x3a1>
mov    %ebx,%ebp
not    %ebp
mov    %ebp,%edi
call   10e0 <malloc@plt>
mov    %rax,%r12
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   10b0 <memset@plt>
mov    $0xfffffffe,%ebp
sub    %ebx,%ebp
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
call   10d0 <memcpy@plt>
lea    0xaf4(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
lea    0xaf5(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    $0xa,%edi
call   1050 <putchar@plt>
mov    0x2a50(%rip),%rax
mov    (%rax),%ecx
mov    %r12,%rdi
mov    $0x1,%esi
mov    %ebp,%edx
call   1110 <fwrite@plt>
mov    %r12,%rdi
call   1040 <free@plt>
mov    %r14,%rdi
call   1040 <free@plt>
xor    %eax,%eax
add    $0x308,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"CONTENT_TYPE\00"
@.str.1 = [20 x i8] c"multipart/form-data\00"
@.str.2 = [10 x i8] c"boundary=\00"
@.str.3 = [15 x i8] c"CONTENT_LENGTH\00"
@stdin = global i32 0
@.str.4 = [3 x i8] c"--\00"
@.str.5 = [15 x i8] c"Content-Type: \00"
@.str.6 = [5 x i8] c"\0D\0A\0D\0A\00"
@.str.7 = [18 x i8] c"Content-type: %s\0A\00"
@.str.8 = [20 x i8] c"Content-length: %d\0A\00"
@.str.9 = [2 x i8] c"\0A\00"
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [256 x i8]
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [256 x i8]
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [256 x i8]
%18 = alloca i8*
store i32 0, i32* %1
store i8* null, i8** %2
store i8* null, i8** %3
store i8* null, i8** %4
store i8* null, i8** %5
%19 = bitcast [256 x i8]* %6 to i8*
store i8* null, i8** %7
store i32 0, i32* %8
%20 = bitcast [256 x i8]* %9 to i8*
store i32 0, i32* %10
store i8* null, i8** %11
store i8* null, i8** %12
store i8* null, i8** %13
store i32 0, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
%21 = bitcast [256 x i8]* %17 to i8*
store i8* null, i8** %18
%22 = call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i8* %22, i8** %3
%23 = load i8*, i8** %3
%24 = call i8* @strstr(i8* %23, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
store i8* %24, i8** %4
%25 = load i8*, i8** %4
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %166
27: ; preds = %0
%28 = load i8*, i8** %4
%29 = call i8* @strstr(i8* %28, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
store i8* %29, i8** %5
%30 = load i8*, i8** %5
%31 = icmp ne i8* %30, null
br i1 %31, label %32, label %165
32: ; preds = %27
%33 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%34 = load i8*, i8** %5
%35 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %34, i64 %36
%38 = call i32 @strcpy(i8* %33, i8* %37)
%39 = call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
store i8* %39, i8** %7
%40 = load i8*, i8** %7
%41 = call i32 @atoi(i8* %40)
store i32 %41, i32* %8
%42 = load i32, i32* %8
%43 = add nsw i32 %42, 1
%44 = sext i32 %43 to i64
%45 = mul i64 1, %44
%46 = trunc i64 %45 to i32
%47 = call i64 @malloc(i32 %46)
%48 = inttoptr i64 %47 to i8*
store i8* %48, i8** %2
%49 = load i8*, i8** %2
%50 = load i32, i32* %8
%51 = add nsw i32 %50, 1
%52 = call i32 @memset(i8* %49, i32 0, i32 %51)
%53 = load i8*, i8** %2
%54 = load i32, i32* %8
%55 = load i32, i32* @stdin
%56 = call i32 @fread(i8* %53, i32 1, i32 %54, i32 %55)
store i32 %56, i32* %10
%57 = load i32, i32* %8
%58 = load i32, i32* %10
%59 = icmp eq i32 %57, %58
br i1 %59, label %60, label %162
60: ; preds = %32
%61 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%62 = call i32 @strcat(i8* %61, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%63 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%64 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%65 = call i32 @strcat(i8* %63, i8* %64)
%66 = load i8*, i8** %2
%67 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%68 = call i8* @strstr(i8* %66, i8* %67)
store i8* %68, i8** %11
%69 = load i8*, i8** %11
%70 = icmp ne i8* %69, null
br i1 %70, label %71, label %161
71: ; preds = %60
%72 = load i8*, i8** %11
%73 = call i8* @strstr(i8* %72, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
store i8* %73, i8** %12
%74 = load i8*, i8** %12
%75 = icmp ne i8* %74, null
br i1 %75, label %76, label %160
76: ; preds = %71
%77 = load i8*, i8** %12
%78 = call i8* @strstr(i8* %77, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
store i8* %78, i8** %13
%79 = load i8*, i8** %13
%80 = icmp ne i8* %79, null
br i1 %80, label %81, label %159
81: ; preds = %76
%82 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%83 = load i8*, i8** %12
%84 = call i32 @strlen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8, i8* %83, i64 %85
%87 = load i8*, i8** %13
%88 = load i8*, i8** %12
%89 = call i32 @strlen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i8, i8* %88, i64 %90
%92 = ptrtoint i8* %87 to i64
%93 = ptrtoint i8* %91 to i64
%94 = sub i64 %92, %93
%95 = trunc i64 %94 to i32
%96 = call i32 @strncpy(i8* %82, i8* %86, i32 %95)
%97 = load i32, i32* %8
%98 = sext i32 %97 to i64
%99 = load i8*, i8** %13
%100 = getelementptr inbounds i8, i8* %99, i64 4
%101 = load i8*, i8** %2
%102 = ptrtoint i8* %100 to i64
%103 = ptrtoint i8* %101 to i64
%104 = sub i64 %102, %103
%105 = sub nsw i64 %98, %104
%106 = trunc i64 %105 to i32
store i32 %106, i32* %16
store i32 0, i32* %15
br label %107
107: ; preds = %155, %81
%108 = load i32, i32* %15
%109 = load i32, i32* %16
%110 = icmp slt i32 %108, %109
br i1 %110, label %111, label %158
111: ; preds = %107
%112 = load i8*, i8** %13
%113 = getelementptr inbounds i8, i8* %112, i64 4
%114 = load i32, i32* %15
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds i8, i8* %113, i64 %115
%117 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%118 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%119 = call i32 @strlen(i8* %118)
%120 = call i32 @memcmp(i8* %116, i8* %117, i32 %119)
store i32 %120, i32* %14
%121 = load i32, i32* %14
%122 = icmp eq i32 %121, 0
br i1 %122, label %123, label %154
123: ; preds = %111
%124 = load i32, i32* %15
%125 = sub nsw i32 %124, 1
%126 = sext i32 %125 to i64
%127 = mul i64 1, %126
%128 = trunc i64 %127 to i32
%129 = call i64 @malloc(i32 %128)
%130 = inttoptr i64 %129 to i8*
store i8* %130, i8** %18
%131 = load i8*, i8** %18
%132 = load i32, i32* %15
%133 = sub nsw i32 %132, 1
%134 = call i32 @memset(i8* %131, i32 0, i32 %133)
%135 = load i8*, i8** %18
%136 = load i8*, i8** %13
%137 = getelementptr inbounds i8, i8* %136, i64 4
%138 = load i32, i32* %15
%139 = sub nsw i32 %138, 2
%140 = call i32 @memcpy(i8* %135, i8* %137, i32 %139)
%141 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8* %141)
%143 = load i32, i32* %15
%144 = sub nsw i32 %143, 2
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i32 %144)
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%147 = load i8*, i8** %18
%148 = load i32, i32* %15
%149 = sub nsw i32 %148, 2
%150 = load i32, i32* @stdout
%151 = call i32 @fwrite(i8* %147, i32 1, i32 %149, i32 %150)
%152 = load i8*, i8** %18
%153 = call i32 @free(i8* %152)
br label %158
154: ; preds = %111
br label %155
155: ; preds = %154
%156 = load i32, i32* %15
%157 = add nsw i32 %156, 1
store i32 %157, i32* %15
br label %107
158: ; preds = %123, %107
br label %159
159: ; preds = %158, %76
br label %160
160: ; preds = %159, %71
br label %161
161: ; preds = %160, %60
br label %162
162: ; preds = %161, %32
%163 = load i8*, i8** %2
%164 = call i32 @free(i8* %163)
br label %165
165: ; preds = %162, %27
br label %166
166: ; preds = %165, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"CONTENT_TYPE\00"
@.str.1 = [20 x i8] c"multipart/form-data\00"
@.str.2 = [10 x i8] c"boundary=\00"
@.str.3 = [15 x i8] c"CONTENT_LENGTH\00"
@stdin = global i32 0
@.str.4 = [3 x i8] c"--\00"
@.str.5 = [15 x i8] c"Content-Type: \00"
@.str.6 = [5 x i8] c"\0D\0A\0D\0A\00"
@.str.7 = [18 x i8] c"Content-type: %s\0A\00"
@.str.8 = [20 x i8] c"Content-length: %d\0A\00"
@stdout = global i32 0
define i32 @main() {
%1 = alloca [256 x i8]
%2 = alloca [256 x i8]
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = tail call i8* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%8 = tail call i8* @strstr(i8* dereferenceable(1) %7, i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i8* %8, null
br i1 %9, label %83, label %10
10: ; preds = %0
%11 = tail call i8* @strstr(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i8* %11, null
br i1 %12, label %83, label %13
13: ; preds = %10
%14 = tail call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %11, i64 %15
%17 = call i32 @strcpy(i8* %4, i8* %16)
%18 = call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @atoi(i8* %18)
%20 = add nsw i32 %19, 1
%21 = call i64 @malloc(i32 %20)
%22 = inttoptr i64 %21 to i8*
%23 = call i32 @memset(i8* %22, i32 0, i32 %20)
%24 = load i32, i32* @stdin
%25 = call i32 @fread(i8* %22, i32 1, i32 %19, i32 %24)
%26 = icmp eq i32 %19, %25
br i1 %26, label %27, label %81
27: ; preds = %13
%28 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%29 = call i32 @strcat(i8* %5, i8* %4)
%30 = call i8* @strstr(i8* dereferenceable(1) %22, i8* %5)
%31 = icmp eq i8* %30, null
br i1 %31, label %81, label %32
32: ; preds = %27
%33 = call i8* @strstr(i8* %30, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%34 = icmp eq i8* %33, null
br i1 %34, label %81, label %35
35: ; preds = %32
%36 = call i8* @strstr(i8* %33, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%37 = icmp eq i8* %36, null
br i1 %37, label %81, label %38
38: ; preds = %35
%39 = call i32 @strlen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %33, i64 %40
%42 = call i32 @strlen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %33, i64 %43
%45 = ptrtoint i8* %36 to i64
%46 = ptrtoint i8* %44 to i64
%47 = sub i64 %45, %46
%48 = trunc i64 %47 to i32
%49 = call i32 @strncpy(i8* %6, i8* %41, i32 %48)
%50 = getelementptr inbounds i8, i8* %36, i64 4
%51 = ptrtoint i8* %50 to i64
%52 = sub i64 %21, %51
%53 = trunc i64 %52 to i32
%54 = add i32 %19, %53
%55 = icmp sgt i32 %54, 0
br i1 %55, label %56, label %81
56: ; preds = %38
%57 = zext i32 %54 to i64
br label %58
58: ; preds = %56, %78
%59 = phi i64 [ 0, %56 ], [ %79, %78 ]
%60 = getelementptr inbounds i8, i8* %50, i64 %59
%61 = call i32 @strlen(i8* %5)
%62 = call i32 @memcmp(i8* %60, i8* %5, i32 %61)
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %78
64: ; preds = %58
%65 = trunc i64 %59 to i32
%66 = add nsw i32 %65, -1
%67 = call i64 @malloc(i32 %66)
%68 = inttoptr i64 %67 to i8*
%69 = call i32 @memset(i8* %68, i32 0, i32 %66)
%70 = add nsw i32 %65, -2
%71 = call i32 @memcpy(i8* %68, i8* %50, i32 %70)
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8* %6)
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i32 %70)
%74 = call i32 @putchar(i32 10)
%75 = load i32, i32* @stdout
%76 = call i32 @fwrite(i8* %68, i32 1, i32 %70, i32 %75)
%77 = call i32 @free(i8* %68)
br label %81
78: ; preds = %58
%79 = add nuw nsw i64 %59, 1
%80 = icmp eq i64 %79, %57
br i1 %80, label %81, label %58
81: ; preds = %78, %38, %27, %35, %64, %32, %13
%82 = call i32 @free(i8* %22)
br label %83
83: ; preds = %10, %81, %0
ret i32 0
}