#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*/ upload_path;
typedef int ssize_t;
typedef int /*<<< orphan*/ rnboundaryrn;
typedef int /*<<< orphan*/ rnboundaryEOF;
typedef int /*<<< orphan*/ buffer;
typedef int /*<<< orphan*/ boundaryrn;
typedef int /*<<< orphan*/ boundaryEOF;

/* Variables and functions */
int EOF;
int PATH_MAX;
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWUSR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fchmod(int, int);
int fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(char *, char *, int);
int mkstemp(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcmp(char *, char *);
char *strdup(char *);
int strlen(char const *);
int write(int, char *, int);
char *_parse_multipart_value_into_disk(const char *boundary,
                                       const char *savedir,
                                       const char *filename, int *filelen,
                                       bool *finish) {
  char boundaryEOF[256], rnboundaryEOF[256];
  char boundaryrn[256], rnboundaryrn[256];
  int boundarylen, boundaryEOFlen;
  char buffer[(16 * 1024)];
  int bufc;
  int c;
  snprintf(boundaryEOF, sizeof(boundaryEOF), "%s--", boundary);
  snprintf(rnboundaryEOF, sizeof(rnboundaryEOF), "\r\n%s--", boundary);
  snprintf(boundaryrn, sizeof(boundaryrn), "%s\r\n", boundary);
  snprintf(rnboundaryrn, sizeof(rnboundaryrn), "\r\n%s\r\n", boundary);
  boundarylen = strlen(boundary);
  boundaryEOFlen = strlen(boundaryEOF);
  char upload_path[PATH_MAX];
  snprintf(upload_path, sizeof(upload_path), "%s/q_XXXXXX", savedir);
  int upload_fd = mkstemp(upload_path);
  if (upload_fd < 0) {
    ;
    *finish = true;
    return NULL;
  }
  fchmod(upload_fd, (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH));
  bool ioerror = false;
  int upload_length;
  for (upload_length = 0, bufc = 0; (c = fgetc(stdin)) != EOF;) {
    if (bufc == sizeof(buffer) - 1) {
      ssize_t leftsize = boundarylen + 8;
      ssize_t savesize = bufc - leftsize;
      ssize_t saved = write(upload_fd, buffer, savesize);
      if (saved <= 0) {
        ioerror = true;
        break;
      }
      leftsize = bufc - saved;
      memcpy(buffer, buffer + saved, leftsize);
      bufc = leftsize;
    }
    buffer[bufc++] = (char)c;
    upload_length++;
    if ((c == '\n') || (c == '-')) {
      buffer[bufc] = '\0';
      if ((bufc - (2 + boundarylen + 2)) >= 0) {
        if (!strcmp(buffer + (bufc - (2 + boundarylen + 2)), rnboundaryrn)) {
          bufc -= (2 + boundarylen + 2);
          upload_length -= (2 + boundarylen + 2);
          break;
        }
      }
      if ((bufc - (2 + boundaryEOFlen)) >= 0) {
        if (!strcmp(buffer + (bufc - (2 + boundaryEOFlen)), rnboundaryEOF)) {
          bufc -= (2 + boundaryEOFlen);
          upload_length -= (2 + boundaryEOFlen);
          *finish = true;
          break;
        }
      }
      if (upload_length == bufc) {
        if ((bufc - (boundarylen + 2)) == 0) {
          if (!strcmp(buffer, boundaryrn)) {
            bufc = 0;
            upload_length = 0;
            break;
          }
        }
        if ((bufc - boundaryEOFlen) == 0) {
          if (!strcmp(buffer, boundaryEOF)) {
            bufc = 0;
            upload_length = 0;
            *finish = true;
            break;
          }
        }
      }
    }
  }
  while (bufc > 0) {
    ssize_t saved = write(upload_fd, buffer, bufc);
    if (saved <= 0) {
      ioerror = true;
      break;
    }
    bufc -= saved;
  }
  close(upload_fd);
  if (c == EOF || ioerror == true) {
    ;
    *finish = true;
    return NULL;
  }
  *filelen = upload_length;
  return strdup(upload_path);
}


x86 assembly (clang, -O0):
<_parse_multipart_value_into_disk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4490,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rcx
lea    0xe38(%rip),%rdx
lea    -0x130(%rbp),%rdi
mov    %rdi,-0x4488(%rbp)
mov    $0x100,%esi
mov    %esi,-0x448c(%rbp)
call   1050 <snprintf@plt>
mov    -0x448c(%rbp),%esi
mov    -0x10(%rbp),%rcx
lea    0xe07(%rip),%rdx
lea    -0x230(%rbp),%rdi
call   1050 <snprintf@plt>
mov    -0x448c(%rbp),%esi
mov    -0x10(%rbp),%rcx
lea    0xdf3(%rip),%rdx
lea    -0x330(%rbp),%rdi
call   1050 <snprintf@plt>
mov    -0x448c(%rbp),%esi
mov    -0x10(%rbp),%rcx
lea    0xdd4(%rip),%rdx
lea    -0x430(%rbp),%rdi
call   1050 <snprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x4488(%rbp),%rdi
mov    %eax,-0x434(%rbp)
call   1040 <strlen@plt>
mov    %eax,-0x438(%rbp)
mov    0x2d89(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x4450(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x4480(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x4458(%rbp)
mov    %eax,%esi
mov    -0x18(%rbp),%rcx
lea    0xd6c(%rip),%rdx
call   1050 <snprintf@plt>
mov    -0x4480(%rbp),%rdi
call   10a0 <mkstemp@plt>
mov    %eax,-0x445c(%rbp)
cmpl   $0x0,-0x445c(%rbp)
jge    12e7 <_parse_multipart_value_into_disk+0x147>
mov    -0x30(%rbp),%rax
movl   $0x1,(%rax)
movq   $0x0,-0x8(%rbp)
movl   $0x1,-0x4460(%rbp)
jmp    1725 <_parse_multipart_value_into_disk+0x585>
mov    -0x445c(%rbp),%edi
mov    0x2cbc(%rip),%rax
mov    (%rax),%esi
mov    0x2cd3(%rip),%rax
or     (%rax),%esi
mov    0x2cba(%rip),%rax
or     (%rax),%esi
mov    0x2ca9(%rip),%rax
or     (%rax),%esi
call   10b0 <fchmod@plt>
movl   $0x0,-0x4464(%rbp)
movl   $0x0,-0x4468(%rbp)
movl   $0x0,-0x4444(%rbp)
mov    0x2ca5(%rip),%rax
mov    (%rax),%edi
call   1060 <fgetc@plt>
mov    %eax,-0x4448(%rbp)
mov    0x2c89(%rip),%rcx
cmp    (%rcx),%eax
je     164c <_parse_multipart_value_into_disk+0x4ac>
movslq -0x4444(%rbp),%rax
cmp    $0x3fff,%rax
jne    1406 <_parse_multipart_value_into_disk+0x266>
mov    -0x434(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x446c(%rbp)
mov    -0x4444(%rbp),%eax
sub    -0x446c(%rbp),%eax
mov    %eax,-0x4470(%rbp)
mov    -0x445c(%rbp),%edi
lea    -0x4440(%rbp),%rsi
mov    -0x4470(%rbp),%edx
call   1030 <write@plt>
mov    %eax,-0x4474(%rbp)
cmpl   $0x0,-0x4474(%rbp)
jg     13c5 <_parse_multipart_value_into_disk+0x225>
movl   $0x1,-0x4464(%rbp)
jmp    164c <_parse_multipart_value_into_disk+0x4ac>
mov    -0x4444(%rbp),%eax
sub    -0x4474(%rbp),%eax
mov    %eax,-0x446c(%rbp)
lea    -0x4440(%rbp),%rdi
lea    -0x4440(%rbp),%rsi
movslq -0x4474(%rbp),%rax
add    %rax,%rsi
mov    -0x446c(%rbp),%edx
call   1090 <memcpy@plt>
mov    -0x446c(%rbp),%eax
mov    %eax,-0x4444(%rbp)
mov    -0x4448(%rbp),%eax
mov    %al,%cl
mov    -0x4444(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x4444(%rbp)
cltq
mov    %cl,-0x4440(%rbp,%rax,1)
mov    -0x4468(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4468(%rbp)
cmpl   $0xa,-0x4448(%rbp)
je     1451 <_parse_multipart_value_into_disk+0x2b1>
cmpl   $0x2d,-0x4448(%rbp)
jne    1647 <_parse_multipart_value_into_disk+0x4a7>
movslq -0x4444(%rbp),%rax
movb   $0x0,-0x4440(%rbp,%rax,1)
mov    -0x4444(%rbp),%eax
mov    -0x434(%rbp),%ecx
add    $0x2,%ecx
add    $0x2,%ecx
sub    %ecx,%eax
cmp    $0x0,%eax
jl     14f0 <_parse_multipart_value_into_disk+0x350>
lea    -0x4440(%rbp),%rdi
mov    -0x4444(%rbp),%eax
mov    -0x434(%rbp),%ecx
add    $0x2,%ecx
add    $0x2,%ecx
sub    %ecx,%eax
cltq
add    %rax,%rdi
lea    -0x430(%rbp),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    14eb <_parse_multipart_value_into_disk+0x34b>
mov    -0x434(%rbp),%ecx
add    $0x2,%ecx
add    $0x2,%ecx
mov    -0x4444(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4444(%rbp)
mov    -0x434(%rbp),%ecx
add    $0x2,%ecx
add    $0x2,%ecx
mov    -0x4468(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4468(%rbp)
jmp    164c <_parse_multipart_value_into_disk+0x4ac>
jmp    14f0 <_parse_multipart_value_into_disk+0x350>
mov    -0x4444(%rbp),%eax
mov    -0x438(%rbp),%ecx
add    $0x2,%ecx
sub    %ecx,%eax
cmp    $0x0,%eax
jl     157e <_parse_multipart_value_into_disk+0x3de>
lea    -0x4440(%rbp),%rdi
mov    -0x4444(%rbp),%eax
mov    -0x438(%rbp),%ecx
add    $0x2,%ecx
sub    %ecx,%eax
cltq
add    %rax,%rdi
lea    -0x230(%rbp),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1579 <_parse_multipart_value_into_disk+0x3d9>
mov    -0x438(%rbp),%ecx
add    $0x2,%ecx
mov    -0x4444(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4444(%rbp)
mov    -0x438(%rbp),%ecx
add    $0x2,%ecx
mov    -0x4468(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4468(%rbp)
mov    -0x30(%rbp),%rax
movl   $0x1,(%rax)
jmp    164c <_parse_multipart_value_into_disk+0x4ac>
jmp    157e <_parse_multipart_value_into_disk+0x3de>
mov    -0x4468(%rbp),%eax
cmp    -0x4444(%rbp),%eax
jne    1642 <_parse_multipart_value_into_disk+0x4a2>
mov    -0x4444(%rbp),%eax
mov    -0x434(%rbp),%ecx
add    $0x2,%ecx
sub    %ecx,%eax
cmp    $0x0,%eax
jne    15e4 <_parse_multipart_value_into_disk+0x444>
lea    -0x4440(%rbp),%rdi
lea    -0x330(%rbp),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    15df <_parse_multipart_value_into_disk+0x43f>
movl   $0x0,-0x4444(%rbp)
movl   $0x0,-0x4468(%rbp)
jmp    164c <_parse_multipart_value_into_disk+0x4ac>
jmp    15e4 <_parse_multipart_value_into_disk+0x444>
mov    -0x4444(%rbp),%eax
sub    -0x438(%rbp),%eax
cmp    $0x0,%eax
jne    163d <_parse_multipart_value_into_disk+0x49d>
lea    -0x4440(%rbp),%rdi
lea    -0x130(%rbp),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1638 <_parse_multipart_value_into_disk+0x498>
movl   $0x0,-0x4444(%rbp)
movl   $0x0,-0x4468(%rbp)
mov    -0x30(%rbp),%rax
movl   $0x1,(%rax)
jmp    164c <_parse_multipart_value_into_disk+0x4ac>
jmp    163d <_parse_multipart_value_into_disk+0x49d>
jmp    1642 <_parse_multipart_value_into_disk+0x4a2>
jmp    1647 <_parse_multipart_value_into_disk+0x4a7>
jmp    1334 <_parse_multipart_value_into_disk+0x194>
jmp    1651 <_parse_multipart_value_into_disk+0x4b1>
cmpl   $0x0,-0x4444(%rbp)
jle    16b1 <_parse_multipart_value_into_disk+0x511>
mov    -0x445c(%rbp),%edi
lea    -0x4440(%rbp),%rsi
mov    -0x4444(%rbp),%edx
call   1030 <write@plt>
mov    %eax,-0x4478(%rbp)
cmpl   $0x0,-0x4478(%rbp)
jg     1698 <_parse_multipart_value_into_disk+0x4f8>
movl   $0x1,-0x4464(%rbp)
jmp    16b1 <_parse_multipart_value_into_disk+0x511>
mov    -0x4478(%rbp),%ecx
mov    -0x4444(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4444(%rbp)
jmp    1651 <_parse_multipart_value_into_disk+0x4b1>
mov    -0x445c(%rbp),%edi
call   1070 <close@plt>
mov    -0x4448(%rbp),%eax
mov    0x290f(%rip),%rcx
cmp    (%rcx),%eax
je     16de <_parse_multipart_value_into_disk+0x53e>
cmpl   $0x1,-0x4464(%rbp)
jne    16ff <_parse_multipart_value_into_disk+0x55f>
mov    -0x30(%rbp),%rax
movl   $0x1,(%rax)
movq   $0x0,-0x8(%rbp)
movl   $0x1,-0x4460(%rbp)
jmp    1725 <_parse_multipart_value_into_disk+0x585>
mov    -0x4480(%rbp),%rdi
mov    -0x4468(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
call   10c0 <strdup@plt>
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x4460(%rbp)
mov    -0x4450(%rbp),%rax
mov    %rax,%rsp
mov    -0x8(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_parse_multipart_value_into_disk>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4448,%rsp
mov    %r8,%r13
mov    %rcx,%r12
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xe3b(%rip),%rdx
lea    -0x470(%rbp),%r15
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbx,%rcx
call   1050 <snprintf@plt>
lea    0xe1b(%rip),%rdx
lea    -0x370(%rbp),%rdi
mov    $0x100,%esi
mov    %rbx,%rcx
call   1050 <snprintf@plt>
lea    0xe09(%rip),%rdx
lea    -0x270(%rbp),%rdi
mov    $0x100,%esi
mov    %rbx,%rcx
call   1050 <snprintf@plt>
lea    0xdec(%rip),%rdx
lea    -0x170(%rbp),%rdi
mov    $0x100,%esi
mov    %rbx,%rcx
call   1050 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rax,-0x60(%rbp)
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %rax,-0x40(%rbp)
mov    %rsp,%r15
mov    0x2d9f(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rbx
mov    %rsi,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xda0(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rcx
call   1050 <snprintf@plt>
mov    %rbx,%rdi
call   10a0 <mkstemp@plt>
test   %eax,%eax
js     12f3 <_parse_multipart_value_into_disk+0x153>
mov    %eax,%edi
mov    %rbx,-0x68(%rbp)
mov    %r12,-0x70(%rbp)
mov    0x2d1a(%rip),%rax
mov    0x2d33(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2d18(%rip),%rax
or     (%rax),%esi
mov    0x2d07(%rip),%rax
or     (%rax),%esi
mov    %edi,-0x30(%rbp)
call   10b0 <fchmod@plt>
mov    0x2d1e(%rip),%r14
mov    (%r14),%edi
call   1060 <fgetc@plt>
mov    %eax,%r12d
mov    0x2d04(%rip),%rax
cmp    (%rax),%r12d
mov    %r13,-0x38(%rbp)
mov    %r15,-0x58(%rbp)
jne    1300 <_parse_multipart_value_into_disk+0x160>
movl   $0x0,-0x2c(%rbp)
xor    %r13d,%r13d
xor    %r14d,%r14d
jmp    14c4 <_parse_multipart_value_into_disk+0x324>
movl   $0x1,0x0(%r13)
jmp    152f <_parse_multipart_value_into_disk+0x38f>
mov    -0x60(%rbp),%rcx
lea    0x4(%rcx),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x40(%rbp),%rax
add    $0x2,%eax
mov    %eax,-0x4c(%rbp)
lea    0x1(%rcx),%eax
mov    %eax,-0x44(%rbp)
mov    $0x3ff7,%eax
sub    %ecx,%eax
mov    %eax,-0x48(%rbp)
xor    %ebx,%ebx
xor    %r13d,%r13d
jmp    134f <_parse_multipart_value_into_disk+0x1af>
nopl   0x0(%rax,%rax,1)
mov    (%r14),%edi
call   1060 <fgetc@plt>
mov    %eax,%r12d
add    $0x1,%r13d
mov    0x2c92(%rip),%rax
cmp    (%rax),%r12d
je     147b <_parse_multipart_value_into_disk+0x2db>
mov    %ebx,%r15d
cmp    $0x3fff,%ebx
jne    139a <_parse_multipart_value_into_disk+0x1fa>
mov    -0x30(%rbp),%ebx
mov    %ebx,%edi
lea    -0x4470(%rbp),%r15
mov    %r15,%rsi
mov    -0x48(%rbp),%edx
call   1030 <write@plt>
test   %eax,%eax
jle    1487 <_parse_multipart_value_into_disk+0x2e7>
mov    %r15,%rdi
mov    $0x3fff,%r15d
sub    %eax,%r15d
mov    %eax,%eax
lea    (%rax,%rbp,1),%rsi
add    $0xffffffffffffbb90,%rsi
mov    %r15d,%edx
call   1090 <memcpy@plt>
movslq %r15d,%rbx
mov    %r12b,-0x4470(%rbp,%rbx,1)
ff
add    $0x1,%rbx
cmp    $0x2d,%r12d
je     13b9 <_parse_multipart_value_into_disk+0x219>
cmp    $0xa,%r12d
jne    1330 <_parse_multipart_value_into_disk+0x190>
movb   $0x0,-0x4470(%rbp,%rbx,1)
mov    %ebx,%r14d
sub    -0x2c(%rbp),%r14d
js     13ec <_parse_multipart_value_into_disk+0x24c>
mov    %r14d,%eax
lea    (%rax,%rbp,1),%rdi
add    $0xffffffffffffbb90,%rdi
lea    -0x170(%rbp),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1496 <_parse_multipart_value_into_disk+0x2f6>
mov    %ebx,%r14d
sub    -0x4c(%rbp),%r14d
js     1417 <_parse_multipart_value_into_disk+0x277>
mov    %r14d,%eax
lea    (%rax,%rbp,1),%rdi
add    $0xffffffffffffbb90,%rdi
lea    -0x370(%rbp),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     14a7 <_parse_multipart_value_into_disk+0x307>
cmp    %r15d,%r13d
mov    0x2bbf(%rip),%r14
jne    1330 <_parse_multipart_value_into_disk+0x190>
cmp    %r13d,-0x44(%rbp)
jne    1448 <_parse_multipart_value_into_disk+0x2a8>
lea    -0x4470(%rbp),%rdi
lea    -0x270(%rbp),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     12e1 <_parse_multipart_value_into_disk+0x141>
cmp    -0x40(%rbp),%ebx
jne    1330 <_parse_multipart_value_into_disk+0x190>
lea    -0x4470(%rbp),%rdi
lea    -0x470(%rbp),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
jne    1330 <_parse_multipart_value_into_disk+0x190>
mov    -0x38(%rbp),%rax
movl   $0x1,(%rax)
jmp    12e1 <_parse_multipart_value_into_disk+0x141>
movl   $0x0,-0x2c(%rbp)
mov    %ebx,%r14d
jmp    14c4 <_parse_multipart_value_into_disk+0x324>
mov    $0x3fff,%r14d
movl   $0x1,-0x2c(%rbp)
jmp    14c7 <_parse_multipart_value_into_disk+0x327>
sub    -0x60(%rbp),%r13d
add    $0xfffffffd,%r13d
movl   $0x0,-0x2c(%rbp)
jmp    14c4 <_parse_multipart_value_into_disk+0x324>
mov    -0x40(%rbp),%rcx
not    %ecx
add    %r13d,%ecx
mov    -0x38(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x0,-0x2c(%rbp)
mov    %ecx,%r13d
mov    -0x30(%rbp),%ebx
lea    -0x4470(%rbp),%r15
xchg   %ax,%ax
test   %r14d,%r14d
jle    14f4 <_parse_multipart_value_into_disk+0x354>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %r14d,%edx
call   1030 <write@plt>
sub    %eax,%r14d
test   %eax,%eax
jg     14d0 <_parse_multipart_value_into_disk+0x330>
mov    $0x1,%ebx
mov    -0x58(%rbp),%r15
jmp    14fb <_parse_multipart_value_into_disk+0x35b>
mov    -0x58(%rbp),%r15
mov    -0x2c(%rbp),%ebx
mov    -0x30(%rbp),%edi
call   1070 <close@plt>
test   %ebx,%ebx
jne    1525 <_parse_multipart_value_into_disk+0x385>
mov    0x2aca(%rip),%rax
cmp    (%rax),%r12d
je     1525 <_parse_multipart_value_into_disk+0x385>
mov    -0x70(%rbp),%rax
mov    %r13d,(%rax)
mov    -0x68(%rbp),%rdi
call   10c0 <strdup@plt>
jmp    1531 <_parse_multipart_value_into_disk+0x391>
mov    -0x38(%rbp),%rax
movl   $0x1,(%rax)
xor    %eax,%eax
mov    %r15,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s--\00"
@.str.1 = [7 x i8] c"\0D\0A%s--\00"
@.str.2 = [5 x i8] c"%s\0D\0A\00"
@.str.3 = [7 x i8] c"\0D\0A%s\0D\0A\00"
@PATH_MAX = global i32 0
@.str.4 = [12 x i8] c"%s/q_XXXXXX\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IROTH = global i32 0
@stdin = global i32 0
@EOF = global i32 0
define i8* @_parse_multipart_value_into_disk(i8* %0, i8* %1, i8* %2, i32* %3, i32* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca [256 x i8]
%13 = alloca [256 x i8]
%14 = alloca [256 x i8]
%15 = alloca [256 x i8]
%16 = alloca i32
%17 = alloca i32
%18 = alloca [16384 x i8]
%19 = alloca i32
%20 = alloca i32
%21 = alloca i8*
%22 = alloca i64
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i32* %3, i32** %10
store i32* %4, i32** %11
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%32 = load i8*, i8** %7
%33 = call i32 @snprintf(i8* %31, i32 256, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %32)
%34 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%35 = load i8*, i8** %7
%36 = call i32 @snprintf(i8* %34, i32 256, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %35)
%37 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%38 = load i8*, i8** %7
%39 = call i32 @snprintf(i8* %37, i32 256, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %38)
%40 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%41 = load i8*, i8** %7
%42 = call i32 @snprintf(i8* %40, i32 256, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %41)
%43 = load i8*, i8** %7
%44 = call i32 @strlen(i8* %43)
store i32 %44, i32* %16
%45 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%46 = call i32 @strlen(i8* %45)
store i32 %46, i32* %17
%47 = load i32, i32* @PATH_MAX
%48 = zext i32 %47 to i64
%49 = call i8* @llvm.stacksave()
store i8* %49, i8** %21
%50 = alloca i8, i64 %48
store i64 %48, i64* %22
%51 = trunc i64 %48 to i32
%52 = load i8*, i8** %8
%53 = call i32 @snprintf(i8* %50, i32 %51, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %52)
%54 = call i32 @mkstemp(i8* %50)
store i32 %54, i32* %23
%55 = load i32, i32* %23
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %5
%58 = load i32*, i32** %11
store i32 1, i32* %58
store i8* null, i8** %6
store i32 1, i32* %24
br label %243
59: ; preds = %5
%60 = load i32, i32* %23
%61 = load i32, i32* @S_IRUSR
%62 = load i32, i32* @S_IWUSR
%63 = or i32 %61, %62
%64 = load i32, i32* @S_IRGRP
%65 = or i32 %63, %64
%66 = load i32, i32* @S_IROTH
%67 = or i32 %65, %66
%68 = call i32 @fchmod(i32 %60, i32 %67)
store i32 0, i32* %25
store i32 0, i32* %26
store i32 0, i32* %19
br label %69
69: ; preds = %211, %59
%70 = load i32, i32* @stdin
%71 = call i32 @fgetc(i32 %70)
store i32 %71, i32* %20
%72 = load i32, i32* @EOF
%73 = icmp ne i32 %71, %72
br i1 %73, label %74, label %212
74: ; preds = %69
%75 = load i32, i32* %19
%76 = sext i32 %75 to i64
%77 = icmp eq i64 %76, 16383
br i1 %77, label %78, label %103
78: ; preds = %74
%79 = load i32, i32* %16
%80 = add nsw i32 %79, 8
store i32 %80, i32* %27
%81 = load i32, i32* %19
%82 = load i32, i32* %27
%83 = sub nsw i32 %81, %82
store i32 %83, i32* %28
%84 = load i32, i32* %23
%85 = getelementptr inbounds [16384 x i8], [16384 x i8]* %18, i64 0, i64 0
%86 = load i32, i32* %28
%87 = call i32 @write(i32 %84, i8* %85, i32 %86)
store i32 %87, i32* %29
%88 = load i32, i32* %29
%89 = icmp sle i32 %88, 0
br i1 %89, label %90, label %91
90: ; preds = %78
store i32 1, i32* %25
br label %212
91: ; preds = %78
%92 = load i32, i32* %19
%93 = load i32, i32* %29
%94 = sub nsw i32 %92, %93
store i32 %94, i32* %27
%95 = getelementptr inbounds [16384 x i8], [16384 x i8]* %18, i64 0, i64 0
%96 = getelementptr inbounds [16384 x i8], [16384 x i8]* %18, i64 0, i64 0
%97 = load i32, i32* %29
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i8, i8* %96, i64 %98
%100 = load i32, i32* %27
%101 = call i32 @memcpy(i8* %95, i8* %99, i32 %100)
%102 = load i32, i32* %27
store i32 %102, i32* %19
br label %103
103: ; preds = %91, %74
%104 = load i32, i32* %20
%105 = trunc i32 %104 to i8
%106 = load i32, i32* %19
%107 = add nsw i32 %106, 1
store i32 %107, i32* %19
%108 = sext i32 %106 to i64
%109 = getelementptr inbounds [16384 x i8], [16384 x i8]* %18, i64 0, i64 %108
store i8 %105, i8* %109
%110 = load i32, i32* %26
%111 = add nsw i32 %110, 1
store i32 %111, i32* %26
%112 = load i32, i32* %20
%113 = icmp eq i32 %112, 10
br i1 %113, label %117, label %114
114: ; preds = %103
%115 = load i32, i32* %20
%116 = icmp eq i32 %115, 45
br i1 %116, label %117, label %211
117: ; preds = %114, %103
%118 = load i32, i32* %19
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [16384 x i8], [16384 x i8]* %18, i64 0, i64 %119
store i8 0, i8* %120
%121 = load i32, i32* %19
%122 = load i32, i32* %16
%123 = add nsw i32 2, %122
%124 = add nsw i32 %123, 2
%125 = sub nsw i32 %121, %124
%126 = icmp sge i32 %125, 0
br i1 %126, label %127, label %151
127: ; preds = %117
%128 = getelementptr inbounds [16384 x i8], [16384 x i8]* %18, i64 0, i64 0
%129 = load i32, i32* %19
%130 = load i32, i32* %16
%131 = add nsw i32 2, %130
%132 = add nsw i32 %131, 2
%133 = sub nsw i32 %129, %132
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds i8, i8* %128, i64 %134
%136 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%137 = call i32 @strcmp(i8* %135, i8* %136)
%138 = icmp ne i32 %137, 0
br i1 %138, label %150, label %139
139: ; preds = %127
%140 = load i32, i32* %16
%141 = add nsw i32 2, %140
%142 = add nsw i32 %141, 2
%143 = load i32, i32* %19
%144 = sub nsw i32 %143, %142
store i32 %144, i32* %19
%145 = load i32, i32* %16
%146 = add nsw i32 2, %145
%147 = add nsw i32 %146, 2
%148 = load i32, i32* %26
%149 = sub nsw i32 %148, %147
store i32 %149, i32* %26
br label %212
150: ; preds = %127
br label %151
151: ; preds = %150, %117
%152 = load i32, i32* %19
%153 = load i32, i32* %17
%154 = add nsw i32 2, %153
%155 = sub nsw i32 %152, %154
%156 = icmp sge i32 %155, 0
br i1 %156, label %157, label %179
157: ; preds = %151
%158 = getelementptr inbounds [16384 x i8], [16384 x i8]* %18, i64 0, i64 0
%159 = load i32, i32* %19
%160 = load i32, i32* %17
%161 = add nsw i32 2, %160
%162 = sub nsw i32 %159, %161
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds i8, i8* %158, i64 %163
%165 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%166 = call i32 @strcmp(i8* %164, i8* %165)
%167 = icmp ne i32 %166, 0
br i1 %167, label %178, label %168
168: ; preds = %157
%169 = load i32, i32* %17
%170 = add nsw i32 2, %169
%171 = load i32, i32* %19
%172 = sub nsw i32 %171, %170
store i32 %172, i32* %19
%173 = load i32, i32* %17
%174 = add nsw i32 2, %173
%175 = load i32, i32* %26
%176 = sub nsw i32 %175, %174
store i32 %176, i32* %26
%177 = load i32*, i32** %11
store i32 1, i32* %177
br label %212
178: ; preds = %157
br label %179
179: ; preds = %178, %151
%180 = load i32, i32* %26
%181 = load i32, i32* %19
%182 = icmp eq i32 %180, %181
br i1 %182, label %183, label %210
183: ; preds = %179
%184 = load i32, i32* %19
%185 = load i32, i32* %16
%186 = add nsw i32 %185, 2
%187 = sub nsw i32 %184, %186
%188 = icmp eq i32 %187, 0
br i1 %188, label %189, label %196
189: ; preds = %183
%190 = getelementptr inbounds [16384 x i8], [16384 x i8]* %18, i64 0, i64 0
%191 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%192 = call i32 @strcmp(i8* %190, i8* %191)
%193 = icmp ne i32 %192, 0
br i1 %193, label %195, label %194
194: ; preds = %189
store i32 0, i32* %19
store i32 0, i32* %26
br label %212
195: ; preds = %189
br label %196
196: ; preds = %195, %183
%197 = load i32, i32* %19
%198 = load i32, i32* %17
%199 = sub nsw i32 %197, %198
%200 = icmp eq i32 %199, 0
br i1 %200, label %201, label %209
201: ; preds = %196
%202 = getelementptr inbounds [16384 x i8], [16384 x i8]* %18, i64 0, i64 0
%203 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%204 = call i32 @strcmp(i8* %202, i8* %203)
%205 = icmp ne i32 %204, 0
br i1 %205, label %208, label %206
206: ; preds = %201
store i32 0, i32* %19
store i32 0, i32* %26
%207 = load i32*, i32** %11
store i32 1, i32* %207
br label %212
208: ; preds = %201
br label %209
209: ; preds = %208, %196
br label %210
210: ; preds = %209, %179
br label %211
211: ; preds = %210, %114
br label %69
212: ; preds = %206, %194, %168, %139, %90, %69
br label %213
213: ; preds = %224, %212
%214 = load i32, i32* %19
%215 = icmp sgt i32 %214, 0
br i1 %215, label %216, label %228
216: ; preds = %213
%217 = load i32, i32* %23
%218 = getelementptr inbounds [16384 x i8], [16384 x i8]* %18, i64 0, i64 0
%219 = load i32, i32* %19
%220 = call i32 @write(i32 %217, i8* %218, i32 %219)
store i32 %220, i32* %30
%221 = load i32, i32* %30
%222 = icmp sle i32 %221, 0
br i1 %222, label %223, label %224
223: ; preds = %216
store i32 1, i32* %25
br label %228
224: ; preds = %216
%225 = load i32, i32* %30
%226 = load i32, i32* %19
%227 = sub nsw i32 %226, %225
store i32 %227, i32* %19
br label %213
228: ; preds = %223, %213
%229 = load i32, i32* %23
%230 = call i32 @close(i32 %229)
%231 = load i32, i32* %20
%232 = load i32, i32* @EOF
%233 = icmp eq i32 %231, %232
br i1 %233, label %237, label %234
234: ; preds = %228
%235 = load i32, i32* %25
%236 = icmp eq i32 %235, 1
br i1 %236, label %237, label %239
237: ; preds = %234, %228
%238 = load i32*, i32** %11
store i32 1, i32* %238
store i8* null, i8** %6
store i32 1, i32* %24
br label %243
239: ; preds = %234
%240 = load i32, i32* %26
%241 = load i32*, i32** %10
store i32 %240, i32* %241
%242 = call i8* @strdup(i8* %50)
store i8* %242, i8** %6
store i32 1, i32* %24
br label %243
243: ; preds = %239, %237, %57
%244 = load i8*, i8** %21
%245 = load i8*, i8** %6
ret i8* %245
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s--\00"
@.str.1 = [7 x i8] c"\0D\0A%s--\00"
@.str.2 = [5 x i8] c"%s\0D\0A\00"
@.str.3 = [7 x i8] c"\0D\0A%s\0D\0A\00"
@PATH_MAX = global i32 0
@.str.4 = [12 x i8] c"%s/q_XXXXXX\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IROTH = global i32 0
@stdin = global i32 0
@EOF = global i32 0
define noalias i8* @_parse_multipart_value_into_disk(i8* %0, i8* %1, i8* nocapture readnone %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4) {
%6 = alloca [256 x i8]
%7 = alloca [256 x i8]
%8 = alloca [256 x i8]
%9 = alloca [256 x i8]
%10 = alloca [16384 x i8]
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%15 = getelementptr inbounds [16384 x i8], [16384 x i8]* %10, i64 0, i64 0
%16 = call i32 @snprintf(i8* %11, i32 256, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%17 = call i32 @snprintf(i8* %12, i32 256, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%18 = call i32 @snprintf(i8* %13, i32 256, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%19 = call i32 @snprintf(i8* %14, i32 256, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%20 = call i32 @strlen(i8* %0)
%21 = call i32 @strlen(i8* %11)
%22 = load i32, i32* @PATH_MAX
%23 = zext i32 %22 to i64
%24 = call i8* @llvm.stacksave()
%25 = alloca i8, i64 %23
%26 = call i32 @snprintf(i8* %25, i32 %22, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %1)
%27 = call i32 @mkstemp(i8* %25)
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %5
store i32 1, i32* %4
br label %130
30: ; preds = %5
%31 = load i32, i32* @S_IRUSR
%32 = load i32, i32* @S_IWUSR
%33 = or i32 %32, %31
%34 = load i32, i32* @S_IRGRP
%35 = or i32 %33, %34
%36 = load i32, i32* @S_IROTH
%37 = or i32 %35, %36
%38 = call i32 @fchmod(i32 %27, i32 %37)
%39 = load i32, i32* @stdin
%40 = call i32 @fgetc(i32 %39)
%41 = load i32, i32* @EOF
%42 = icmp eq i32 %40, %41
br i1 %42, label %108, label %43
43: ; preds = %30
%44 = add nsw i32 %20, 4
%45 = add nsw i32 %21, 2
%46 = add nsw i32 %20, 1
%47 = sub i32 16375, %20
br label %48
48: ; preds = %43, %103
%49 = phi i32 [ %40, %43 ], [ %105, %103 ]
%50 = phi i32 [ 0, %43 ], [ %64, %103 ]
%51 = phi i32 [ 0, %43 ], [ %67, %103 ]
%52 = icmp eq i32 %50, 16383
br i1 %52, label %53, label %61
53: ; preds = %48
%54 = call i32 @write(i32 %27, i8* %15, i32 %47)
%55 = icmp slt i32 %54, 1
br i1 %55, label %108, label %56
56: ; preds = %53
%57 = sub nsw i32 16383, %54
%58 = zext i32 %54 to i64
%59 = getelementptr inbounds [16384 x i8], [16384 x i8]* %10, i64 0, i64 %58
%60 = call i32 @memcpy(i8* %15, i8* %59, i32 %57)
br label %61
61: ; preds = %56, %48
%62 = phi i32 [ %50, %48 ], [ %57, %56 ]
%63 = trunc i32 %49 to i8
%64 = add nsw i32 %62, 1
%65 = sext i32 %62 to i64
%66 = getelementptr inbounds [16384 x i8], [16384 x i8]* %10, i64 0, i64 %65
store i8 %63, i8* %66
%67 = add nuw nsw i32 %51, 1
switch i32 %49, label %103 [
i32 45, label %68
i32 10, label %68
]
68: ; preds = %61, %61
%69 = sext i32 %64 to i64
%70 = getelementptr inbounds [16384 x i8], [16384 x i8]* %10, i64 0, i64 %69
store i8 0, i8* %70
%71 = sub nsw i32 %64, %44
%72 = icmp sgt i32 %71, -1
br i1 %72, label %73, label %80
73: ; preds = %68
%74 = zext i32 %71 to i64
%75 = getelementptr inbounds [16384 x i8], [16384 x i8]* %10, i64 0, i64 %74
%76 = call i32 @strcmp(i8* %75, i8* %14)
%77 = icmp eq i32 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %73
%79 = sub nsw i32 %67, %44
br label %108
80: ; preds = %73, %68
%81 = sub nsw i32 %64, %45
%82 = icmp sgt i32 %81, -1
br i1 %82, label %83, label %90
83: ; preds = %80
%84 = zext i32 %81 to i64
%85 = getelementptr inbounds [16384 x i8], [16384 x i8]* %10, i64 0, i64 %84
%86 = call i32 @strcmp(i8* %85, i8* %12)
%87 = icmp eq i32 %86, 0
br i1 %87, label %88, label %90
88: ; preds = %83
%89 = sub nsw i32 %67, %45
store i32 1, i32* %4
br label %108
90: ; preds = %83, %80
%91 = icmp eq i32 %51, %62
br i1 %91, label %92, label %103
92: ; preds = %90
%93 = icmp eq i32 %51, %46
br i1 %93, label %94, label %97
94: ; preds = %92
%95 = call i32 @strcmp(i8* %15, i8* %13)
%96 = icmp eq i32 %95, 0
br i1 %96, label %108, label %97
97: ; preds = %94, %92
%98 = icmp eq i32 %64, %21
br i1 %98, label %99, label %103
99: ; preds = %97
%100 = call i32 @strcmp(i8* %15, i8* %11)
%101 = icmp eq i32 %100, 0
br i1 %101, label %102, label %103
102: ; preds = %99
store i32 1, i32* %4
br label %108
103: ; preds = %61, %90, %99, %97
%104 = load i32, i32* @stdin
%105 = call i32 @fgetc(i32 %104)
%106 = load i32, i32* @EOF
%107 = icmp eq i32 %105, %106
br i1 %107, label %108, label %48
108: ; preds = %103, %94, %53, %30, %102, %88, %78
%109 = phi i32 [ %49, %102 ], [ %49, %88 ], [ %49, %78 ], [ %40, %30 ], [ %105, %103 ], [ %49, %94 ], [ %49, %53 ]
%110 = phi i32 [ 0, %102 ], [ 0, %88 ], [ 0, %78 ], [ 0, %30 ], [ 0, %103 ], [ 0, %94 ], [ 1, %53 ]
%111 = phi i32 [ 0, %102 ], [ %89, %88 ], [ %79, %78 ], [ 0, %30 ], [ %67, %103 ], [ 0, %94 ], [ %51, %53 ]
%112 = phi i32 [ 0, %102 ], [ %81, %88 ], [ %71, %78 ], [ 0, %30 ], [ %64, %103 ], [ 0, %94 ], [ 16383, %53 ]
br label %113
113: ; preds = %116, %108
%114 = phi i32 [ %112, %108 ], [ %119, %116 ]
%115 = icmp sgt i32 %114, 0
br i1 %115, label %116, label %120
116: ; preds = %113
%117 = call i32 @write(i32 %27, i8* %15, i32 %114)
%118 = icmp slt i32 %117, 1
%119 = sub nsw i32 %114, %117
br i1 %118, label %120, label %113
120: ; preds = %116, %113
%121 = phi i32 [ 1, %116 ], [ %110, %113 ]
%122 = call i32 @close(i32 %27)
%123 = load i32, i32* @EOF
%124 = icmp eq i32 %109, %123
%125 = icmp eq i32 %121, 1
%126 = or i1 %125, %124
br i1 %126, label %127, label %128
127: ; preds = %120
store i32 1, i32* %4
br label %130
128: ; preds = %120
store i32 %111, i32* %3
%129 = call i8* @strdup(i8* %25)
br label %130
130: ; preds = %127, %128, %29
%131 = phi i8* [ null, %29 ], [ null, %127 ], [ %129, %128 ]
ret i8* %131
}