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

/* Variables and functions */
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ LOG_NOTICE;
int O_CREAT;
int O_DIRECTORY;
int O_EXCL;
int O_RDONLY;
int O_WRONLY;
int PATH_MAX;
int S_IRGRP;
int S_IRUSR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ dump_get_file_name(char *, size_t, char *, int,
                                      int /*<<< orphan*/ *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ free(char *);
int fsync(int);
char *malloc(size_t);
int open(char const *, int, ...);
size_t read(int, char *, size_t);
int /*<<< orphan*/ remove_dump_files(char *);
int rename(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, ...);
int stat(char *, struct stat *);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ unlink(char *);
size_t write(int, char *, size_t);
int process_dump(const char *dump_dir_path, const char *output_dir) {
  int in_fd = -1;
  int out_fd = -1;
  int dir_fd = -1;
  char dump_path[PATH_MAX];
  char final_dump_path[PATH_MAX];
  char *buf;
  size_t bufsz;
  struct stat sbuf;
  int ret = -1;
  ssize_t sz = 0;
  ssize_t readsz = 0;
  char outfname[48];
  uint16_t prefix_size;
  int rc;
  snprintf(dump_path, sizeof(dump_path), "%s/dump", dump_dir_path);
  if (stat(dump_path, &sbuf) == -1)
    return -1;
  bufsz = sbuf.st_size;
  buf = malloc(bufsz);
  if (!buf) {
    syslog(LOG_ERR, "Failed to allocate memory for dump\n");
    return -1;
  }
  in_fd = open(dump_path, O_RDONLY);
  if (in_fd == -1) {
    syslog(LOG_ERR, "Failed to open platform dump: %s (%d:%s)\n", dump_path,
           errno, strerror(errno));
    goto err;
  }
  do {
    readsz = read(in_fd, buf + sz, bufsz - sz);
    if (readsz == -1) {
      syslog(LOG_ERR,
             "Failed to read platform dump: %s "
             "(%d:%s)\n",
             dump_path, errno, strerror(errno));
      goto err;
    }
    sz += readsz;
  } while (sz != bufsz);
  dump_get_file_name(buf, bufsz, outfname, 48, &prefix_size);
  snprintf(dump_path, sizeof(dump_path), "%s/%s.tmp", output_dir, outfname);
  snprintf(final_dump_path, sizeof(dump_path), "%s/%s", output_dir, outfname);
  remove_dump_files(outfname);
  out_fd = open(dump_path, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IRGRP);
  if (out_fd == -1) {
    syslog(LOG_ERR, "Failed to write platform dump: %s (%d:%s)\n", dump_path,
           errno, strerror(errno));
    goto err;
  }
  sz = write(out_fd, buf, bufsz);
  if (sz != bufsz) {
    syslog(LOG_ERR, "Failed to write platform dump: %s (%d:%s)\n", dump_path,
           errno, strerror(errno));
    unlink(dump_path);
    goto err;
  }
  rc = fsync(out_fd);
  if (rc == -1) {
    syslog(LOG_ERR, "Failed to sync platform dump: %s (%d:%s)\n", dump_path,
           errno, strerror(errno));
    goto err;
  }
  rc = rename(dump_path, final_dump_path);
  if (rc == -1) {
    syslog(LOG_ERR,
           "Failed to rename platform dump %s to %s"
           "(%d: %s)\n",
           dump_path, final_dump_path, errno, strerror(errno));
    goto err;
  }
  dir_fd = open(output_dir, O_RDONLY | O_DIRECTORY);
  if (dir_fd == -1) {
    syslog(LOG_ERR,
           "Failed to open platform dump directory: %s"
           " (%d:%s)\n",
           output_dir, errno, strerror(errno));
    goto err;
  }
  rc = fsync(dir_fd);
  if (rc == -1) {
    syslog(LOG_ERR,
           "Failed to sync platform dump directory: %s"
           " (%d:%s)\n",
           output_dir, errno, strerror(errno));
  }
  syslog(LOG_NOTICE, "New platform dump available. File: %s/%s\n", output_dir,
         outfname);
  ret = 0;
err:
  if (in_fd != -1)
    close(in_fd);
  if (out_fd != -1)
    close(out_fd);
  if (dir_fd != -1)
    close(dir_fd);
  free(buf);
  return ret;
}


x86 assembly (clang, -O0):
<process_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
movl   $0xffffffff,-0x20(%rbp)
movl   $0xffffffff,-0x24(%rbp)
mov    0x2dc9(%rip),%rcx
mov    (%rcx),%eax
mov    %rax,-0xc8(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x30(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rdi
sub    %rdx,%rdi
mov    %rdi,-0xb8(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x38(%rbp)
mov    (%rcx),%ecx
mov    %rcx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0xc0(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x40(%rbp)
movl   $0xffffffff,-0x5c(%rbp)
movq   $0x0,-0x68(%rbp)
movq   $0x0,-0x70(%rbp)
mov    %eax,%esi
mov    -0x10(%rbp),%rcx
lea    0xd6d(%rip),%rdx
mov    $0x0,%al
call   1060 <snprintf@plt>
mov    -0xb8(%rbp),%rdi
lea    -0x58(%rbp),%rsi
call   1090 <stat@plt>
cmp    $0xffffffff,%eax
jne    12c9 <process_dump+0xd9>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0xac(%rbp)
jmp    1833 <process_dump+0x643>
mov    -0x58(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    1316 <process_dump+0x126>
mov    0x2c98(%rip),%rax
mov    (%rax),%edi
lea    0xd0f(%rip),%rsi
mov    $0x0,%al
call   10c0 <syslog@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0xac(%rbp)
jmp    1833 <process_dump+0x643>
mov    -0xb8(%rbp),%rdi
mov    0x2cb4(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   10e0 <open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    138f <process_dump+0x19f>
mov    0x2c47(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xd0(%rbp)
mov    0x2c68(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xcc(%rbp)
mov    0x2c59(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    -0xd0(%rbp),%edi
mov    -0xb8(%rbp),%rdx
mov    -0xcc(%rbp),%ecx
mov    %eax,%r8d
lea    0xca9(%rip),%rsi
mov    $0x0,%al
call   10c0 <syslog@plt>
jmp    17e4 <process_dump+0x5f4>
jmp    1394 <process_dump+0x1a4>
mov    -0x1c(%rbp),%edi
mov    -0x48(%rbp),%rsi
add    -0x68(%rbp),%rsi
mov    -0x50(%rbp),%rdx
sub    -0x68(%rbp),%rdx
call   1080 <read@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0xffffffffffffffff,-0x70(%rbp)
jne    1410 <process_dump+0x220>
mov    0x2bc6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xd8(%rbp)
mov    0x2be7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xd4(%rbp)
mov    0x2bd8(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    -0xd8(%rbp),%edi
mov    -0xb8(%rbp),%rdx
mov    -0xd4(%rbp),%ecx
mov    %eax,%r8d
lea    0xc52(%rip),%rsi
mov    $0x0,%al
call   10c0 <syslog@plt>
jmp    17e4 <process_dump+0x5f4>
mov    -0x70(%rbp),%rax
add    -0x68(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
cmp    -0x50(%rbp),%rax
jne    1394 <process_dump+0x1a4>
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rsi
lea    -0xa0(%rbp),%rdx
mov    $0x30,%ecx
lea    -0xa4(%rbp),%r8
call   10a0 <dump_get_file_name@plt>
mov    -0xb8(%rbp),%rdi
mov    -0xc8(%rbp),%rax
mov    %eax,%esi
mov    -0x18(%rbp),%rcx
lea    -0xa0(%rbp),%r8
lea    0xc14(%rip),%rdx
mov    $0x0,%al
call   1060 <snprintf@plt>
mov    -0xc0(%rbp),%rdi
mov    -0xc8(%rbp),%rax
mov    %eax,%esi
mov    -0x18(%rbp),%rcx
lea    -0xa0(%rbp),%r8
lea    0xbf5(%rip),%rdx
mov    $0x0,%al
call   1060 <snprintf@plt>
lea    -0xa0(%rbp),%rdi
call   1100 <remove_dump_files@plt>
mov    -0xb8(%rbp),%rdi
mov    0x2ada(%rip),%rax
mov    (%rax),%esi
mov    0x2b39(%rip),%rax
or     (%rax),%esi
mov    0x2af8(%rip),%rax
or     (%rax),%esi
mov    0x2ad7(%rip),%rax
mov    (%rax),%edx
mov    0x2ad6(%rip),%rax
or     (%rax),%edx
mov    $0x0,%al
call   10e0 <open@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0xffffffff,-0x20(%rbp)
jne    1545 <process_dump+0x355>
mov    0x2a91(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xe0(%rbp)
mov    0x2ab2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xdc(%rbp)
mov    0x2aa3(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    -0xe0(%rbp),%edi
mov    -0xb8(%rbp),%rdx
mov    -0xdc(%rbp),%ecx
mov    %eax,%r8d
lea    0xb57(%rip),%rsi
mov    $0x0,%al
call   10c0 <syslog@plt>
jmp    17e4 <process_dump+0x5f4>
mov    -0x20(%rbp),%edi
mov    -0x48(%rbp),%rsi
mov    -0x50(%rbp),%rdx
call   1050 <write@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
cmp    -0x50(%rbp),%rax
je     15c8 <process_dump+0x3d8>
mov    0x2a1a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xe8(%rbp)
mov    0x2a3b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xe4(%rbp)
mov    0x2a2c(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    -0xe8(%rbp),%edi
mov    -0xe4(%rbp),%ecx
mov    -0xb8(%rbp),%rdx
mov    %eax,%r8d
lea    0xae0(%rip),%rsi
mov    $0x0,%al
call   10c0 <syslog@plt>
mov    -0xb8(%rbp),%rdi
call   1040 <unlink@plt>
jmp    17e4 <process_dump+0x5f4>
mov    -0x20(%rbp),%edi
call   10d0 <fsync@plt>
mov    %eax,-0xa8(%rbp)
cmpl   $0xffffffff,-0xa8(%rbp)
jne    1638 <process_dump+0x448>
mov    0x299e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xf0(%rbp)
mov    0x29bf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xec(%rbp)
mov    0x29b0(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    -0xf0(%rbp),%edi
mov    -0xb8(%rbp),%rdx
mov    -0xec(%rbp),%ecx
mov    %eax,%r8d
lea    0xa8f(%rip),%rsi
mov    $0x0,%al
call   10c0 <syslog@plt>
jmp    17e4 <process_dump+0x5f4>
mov    -0xc0(%rbp),%rsi
mov    -0xb8(%rbp),%rdi
call   10f0 <rename@plt>
mov    %eax,-0xa8(%rbp)
cmpl   $0xffffffff,-0xa8(%rbp)
jne    16bb <process_dump+0x4cb>
mov    0x2923(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xf8(%rbp)
mov    0x2944(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xf4(%rbp)
mov    0x2935(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    -0xf8(%rbp),%edi
mov    -0xb8(%rbp),%rdx
mov    -0xc0(%rbp),%rcx
mov    -0xf4(%rbp),%r8d
mov    %eax,%r9d
lea    0xa36(%rip),%rsi
mov    $0x0,%al
call   10c0 <syslog@plt>
jmp    17e4 <process_dump+0x5f4>
mov    -0x18(%rbp),%rdi
mov    0x2912(%rip),%rax
mov    (%rax),%esi
mov    0x28f9(%rip),%rax
or     (%rax),%esi
mov    $0x0,%al
call   10e0 <open@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    1745 <process_dump+0x555>
mov    0x289c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x108(%rbp)
mov    0x28b2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xfc(%rbp)
mov    0x28a3(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    -0x10c(%rbp),%edi
mov    -0x108(%rbp),%rdx
mov    -0xfc(%rbp),%ecx
mov    %eax,%r8d
lea    0x9dd(%rip),%rsi
mov    $0x0,%al
call   10c0 <syslog@plt>
jmp    17e4 <process_dump+0x5f4>
mov    -0x24(%rbp),%edi
call   10d0 <fsync@plt>
mov    %eax,-0xa8(%rbp)
cmpl   $0xffffffff,-0xa8(%rbp)
jne    17bb <process_dump+0x5cb>
mov    0x2821(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x11c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x118(%rbp)
mov    0x2837(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x110(%rbp)
mov    0x2828(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    -0x11c(%rbp),%edi
mov    -0x118(%rbp),%rdx
mov    -0x110(%rbp),%ecx
mov    %eax,%r8d
lea    0x996(%rip),%rsi
mov    $0x0,%al
call   10c0 <syslog@plt>
mov    0x27de(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    -0xa0(%rbp),%rcx
lea    0x9a8(%rip),%rsi
mov    $0x0,%al
call   10c0 <syslog@plt>
movl   $0x0,-0x5c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
je     17f6 <process_dump+0x606>
mov    -0x1c(%rbp),%edi
call   1070 <close@plt>
cmpl   $0xffffffff,-0x20(%rbp)
je     1808 <process_dump+0x618>
mov    -0x20(%rbp),%edi
call   1070 <close@plt>
cmpl   $0xffffffff,-0x24(%rbp)
je     181a <process_dump+0x62a>
mov    -0x24(%rbp),%edi
call   1070 <close@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x5c(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0xac(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_dump>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%r12
mov    %rdi,%rcx
mov    0x2dda(%rip),%rax
mov    (%rax),%r14d
mov    %rsp,%r13
mov    %r14,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xdcb(%rip),%rdx
mov    %r13,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <snprintf@plt>
lea    -0x50(%rbp),%rsi
mov    %r13,%rdi
call   1090 <stat@plt>
mov    $0xffffffff,%r15d
cmp    $0xffffffff,%eax
je     162c <process_dump+0x43c>
mov    %r12,-0x38(%rbp)
mov    %rbx,-0x48(%rbp)
mov    -0x50(%rbp),%r12
mov    %r12,%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x40(%rbp)
test   %rax,%rax
je     144d <process_dump+0x25d>
mov    0x2d53(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   10e0 <open@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0xffffffff,%eax
je     1469 <process_dump+0x279>
xor    %ebx,%ebx
mov    -0x40(%rbp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%r15,%rbx,1),%rsi
mov    %r12,%rdx
sub    %rbx,%rdx
mov    -0x2c(%rbp),%edi
call   1080 <read@plt>
cmp    $0xffffffffffffffff,%rax
je     14aa <process_dump+0x2ba>
add    %rax,%rbx
cmp    %r12,%rbx
jne    12b0 <process_dump+0xc0>
mov    %r15,%rdi
lea    -0x90(%rbp),%r15
lea    -0x54(%rbp),%r8
mov    %r12,%rsi
mov    %r15,%rdx
mov    $0x30,%ecx
call   10a0 <dump_get_file_name@plt>
lea    0xd87(%rip),%rdx
mov    %r13,%rdi
mov    %r14d,%esi
mov    -0x38(%rbp),%rbx
mov    %rbx,%rcx
mov    %r15,%r8
xor    %eax,%eax
call   1060 <snprintf@plt>
lea    0xd73(%rip),%rdx
mov    -0x48(%rbp),%rdi
mov    %r14d,%esi
mov    %rbx,%rcx
mov    %r15,%r8
xor    %eax,%eax
call   1060 <snprintf@plt>
mov    %r15,%rdi
call   1100 <remove_dump_files@plt>
mov    0x2c56(%rip),%rax
mov    0x2cb7(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2c74(%rip),%rax
or     (%rax),%esi
mov    0x2c53(%rip),%rax
mov    0x2c54(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    %r13,%rdi
xor    %eax,%eax
call   10e0 <open@plt>
cmp    $0xffffffff,%eax
je     14cf <process_dump+0x2df>
mov    %eax,%ebx
mov    %eax,%edi
mov    -0x40(%rbp),%rsi
mov    %r12,%rdx
call   1050 <write@plt>
cmp    %r12,%rax
jne    1518 <process_dump+0x328>
mov    %ebx,%edi
call   10d0 <fsync@plt>
cmp    $0xffffffff,%eax
je     155b <process_dump+0x36b>
mov    %r13,%rdi
mov    -0x48(%rbp),%r12
mov    %r12,%rsi
call   10f0 <rename@plt>
cmp    $0xffffffff,%eax
je     1589 <process_dump+0x399>
mov    0x2c0d(%rip),%rax
mov    (%rax),%esi
mov    0x2c14(%rip),%rax
or     (%rax),%esi
mov    -0x38(%rbp),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   10e0 <open@plt>
cmp    $0xffffffff,%eax
je     15c4 <process_dump+0x3d4>
mov    %eax,%r12d
mov    %eax,%edi
call   10d0 <fsync@plt>
cmp    $0xffffffff,%eax
jne    1423 <process_dump+0x233>
mov    0x2b95(%rip),%rax
mov    (%rax),%r14d
mov    0x2bbb(%rip),%rax
mov    (%rax),%r15d
mov    %r15d,%edi
call   1110 <strerror@plt>
lea    0xd3b(%rip),%rsi
mov    %r14d,%edi
mov    -0x38(%rbp),%rdx
mov    %r15d,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   10c0 <syslog@plt>
mov    0x2b76(%rip),%rax
mov    (%rax),%edi
lea    0xd4b(%rip),%rsi
xor    %r15d,%r15d
lea    -0x90(%rbp),%rcx
mov    -0x38(%rbp),%rdx
xor    %eax,%eax
call   10c0 <syslog@plt>
jmp    1606 <process_dump+0x416>
mov    0x2b34(%rip),%rax
mov    (%rax),%edi
lea    0xbab(%rip),%rsi
xor    %eax,%eax
call   10c0 <syslog@plt>
jmp    162c <process_dump+0x43c>
mov    0x2b18(%rip),%rax
mov    (%rax),%r14d
mov    0x2b3e(%rip),%rax
mov    (%rax),%r15d
mov    %r15d,%edi
call   1110 <strerror@plt>
lea    0xba0(%rip),%rsi
mov    %r14d,%edi
mov    %r13,%rdx
mov    %r15d,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   10c0 <syslog@plt>
mov    $0xffffffff,%r15d
jmp    1623 <process_dump+0x433>
mov    0x2ad7(%rip),%rax
mov    (%rax),%r14d
mov    0x2afd(%rip),%rax
mov    (%rax),%r15d
mov    %r15d,%edi
call   1110 <strerror@plt>
lea    0xb89(%rip),%rsi
jmp    14f2 <process_dump+0x302>
mov    0x2ab2(%rip),%rax
mov    (%rax),%r14d
mov    0x2ad8(%rip),%rax
mov    (%rax),%r15d
mov    %r15d,%edi
call   1110 <strerror@plt>
lea    0xb9e(%rip),%rsi
mov    %r14d,%edi
mov    %r13,%rdx
mov    %r15d,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   10c0 <syslog@plt>
mov    -0x2c(%rbp),%edi
call   1070 <close@plt>
mov    $0xffffffff,%r15d
jmp    1623 <process_dump+0x433>
mov    0x2a69(%rip),%rax
mov    (%rax),%r14d
mov    0x2a8f(%rip),%rax
mov    (%rax),%r15d
mov    %r15d,%edi
call   1110 <strerror@plt>
lea    0xb55(%rip),%rsi
mov    %r14d,%edi
mov    %r13,%rdx
mov    %r15d,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   10c0 <syslog@plt>
mov    %r13,%rdi
call   1040 <unlink@plt>
jmp    15fa <process_dump+0x40a>
mov    0x2a26(%rip),%rax
mov    (%rax),%r14d
mov    0x2a4c(%rip),%rax
mov    (%rax),%r15d
mov    %r15d,%edi
call   1110 <strerror@plt>
lea    0xb3d(%rip),%rsi
mov    %r14d,%edi
mov    %r13,%rdx
mov    %r15d,%ecx
jmp    15f0 <process_dump+0x400>
mov    0x29f8(%rip),%rax
mov    (%rax),%r14d
mov    0x2a1e(%rip),%rax
mov    (%rax),%r15d
mov    %r15d,%edi
call   1110 <strerror@plt>
lea    0xb39(%rip),%rsi
mov    %r14d,%edi
mov    %r13,%rdx
mov    %r12,%rcx
mov    %r15d,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   10c0 <syslog@plt>
jmp    15fa <process_dump+0x40a>
mov    0x29bd(%rip),%rax
mov    (%rax),%r14d
mov    0x29e3(%rip),%rax
mov    (%rax),%r12d
mov    %r12d,%edi
call   1110 <strerror@plt>
lea    0xb2f(%rip),%rsi
mov    %r14d,%edi
mov    %r15,%rdx
mov    %r12d,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   10c0 <syslog@plt>
mov    $0xffffffff,%r12d
mov    $0xffffffff,%r15d
mov    -0x2c(%rbp),%edi
call   1070 <close@plt>
mov    %ebx,%edi
call   1070 <close@plt>
cmp    $0xffffffff,%r12d
je     1623 <process_dump+0x433>
mov    %r12d,%edi
call   1070 <close@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    %r15d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.stat = type { i64 }
@PATH_MAX = global i32 0
@.str = [8 x i8] c"%s/dump\00"
@LOG_ERR = global i32 0
@.str.1 = [36 x i8] c"Failed to allocate memory for dump\0A\00"
@O_RDONLY = global i32 0
@.str.2 = [42 x i8] c"Failed to open platform dump: %s (%d:%s)\0A\00"
@errno = global i32 0
@.str.3 = [42 x i8] c"Failed to read platform dump: %s (%d:%s)\0A\00"
@.str.4 = [10 x i8] c"%s/%s.tmp\00"
@.str.5 = [6 x i8] c"%s/%s\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_EXCL = global i32 0
@S_IRUSR = global i32 0
@S_IRGRP = global i32 0
@.str.6 = [43 x i8] c"Failed to write platform dump: %s (%d:%s)\0A\00"
@.str.7 = [42 x i8] c"Failed to sync platform dump: %s (%d:%s)\0A\00"
@.str.8 = [49 x i8] c"Failed to rename platform dump %s to %s(%d: %s)\0A\00"
@O_DIRECTORY = global i32 0
@.str.9 = [52 x i8] c"Failed to open platform dump directory: %s (%d:%s)\0A\00"
@.str.10 = [52 x i8] c"Failed to sync platform dump directory: %s (%d:%s)\0A\00"
@LOG_NOTICE = global i32 0
@.str.11 = [42 x i8] c"New platform dump available. File: %s/%s\0A\00"
define i32 @process_dump(i8* %0, i8* %1) {
%3 = alloca %struct.stat
%4 = alloca [48 x i8]
%5 = alloca i32
%6 = load i32, i32* @PATH_MAX
%7 = zext i32 %6 to i64
%8 = alloca i8, i64 %7
%9 = alloca i8, i64 %7
%10 = bitcast %struct.stat* %3 to i8*
%11 = getelementptr inbounds [48 x i8], [48 x i8]* %4, i64 0, i64 0
%12 = bitcast i32* %5 to i8*
%13 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %8, i32 %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0)
%14 = call i32 @stat(i8* %8, %struct.stat* %3)
%15 = icmp eq i32 %14, -1
br i1 %15, label %127, label %16
16: ; preds = %2
%17 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%18 = load i64, i64* %17
%19 = call i8* @malloc(i64 %18)
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %24
21: ; preds = %16
%22 = load i32, i32* @LOG_ERR
%23 = call i32 (i32, i8*, ...) @syslog(i32 %22, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
br label %127
24: ; preds = %16
%25 = load i32, i32* @O_RDONLY
%26 = call i32 (i8*, i32, ...) @open(i8* %8, i32 %25)
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = load i32, i32* @LOG_ERR
%30 = load i32, i32* @errno
%31 = call i32 @strerror(i32 %30)
%32 = call i32 (i32, i8*, ...) @syslog(i32 %29, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* %8, i32 %30, i32 %31)
br label %124
33: ; preds = %24, %44
%34 = phi i64 [ %45, %44 ], [ 0, %24 ]
%35 = getelementptr inbounds i8, i8* %19, i64 %34
%36 = sub i64 %18, %34
%37 = call i64 @read(i32 %26, i8* %35, i64 %36)
%38 = icmp eq i64 %37, -1
br i1 %38, label %39, label %44
39: ; preds = %33
%40 = load i32, i32* @LOG_ERR
%41 = load i32, i32* @errno
%42 = call i32 @strerror(i32 %41)
%43 = call i32 (i32, i8*, ...) @syslog(i32 %40, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i8* %8, i32 %41, i32 %42)
br label %114
44: ; preds = %33
%45 = add i64 %37, %34
%46 = icmp eq i64 %45, %18
br i1 %46, label %47, label %33
47: ; preds = %44
%48 = call i32 @dump_get_file_name(i8* %19, i64 %18, i8* %11, i32 48, i32* %5)
%49 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %8, i32 %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %1, i8* %11)
%50 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %9, i32 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %1, i8* %11)
%51 = call i32 @remove_dump_files(i8* %11)
%52 = load i32, i32* @O_WRONLY
%53 = load i32, i32* @O_CREAT
%54 = or i32 %53, %52
%55 = load i32, i32* @O_EXCL
%56 = or i32 %54, %55
%57 = load i32, i32* @S_IRUSR
%58 = load i32, i32* @S_IRGRP
%59 = or i32 %58, %57
%60 = call i32 (i8*, i32, ...) @open(i8* %8, i32 %56, i32 %59)
%61 = icmp eq i32 %60, -1
br i1 %61, label %62, label %67
62: ; preds = %47
%63 = load i32, i32* @LOG_ERR
%64 = load i32, i32* @errno
%65 = call i32 @strerror(i32 %64)
%66 = call i32 (i32, i8*, ...) @syslog(i32 %63, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i8* %8, i32 %64, i32 %65)
br label %114
67: ; preds = %47
%68 = call i64 @write(i32 %60, i8* %19, i64 %18)
%69 = icmp eq i64 %68, %18
br i1 %69, label %76, label %70
70: ; preds = %67
%71 = load i32, i32* @LOG_ERR
%72 = load i32, i32* @errno
%73 = call i32 @strerror(i32 %72)
%74 = call i32 (i32, i8*, ...) @syslog(i32 %71, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i8* %8, i32 %72, i32 %73)
%75 = call i32 @unlink(i8* %8)
br label %116
76: ; preds = %67
%77 = call i32 @fsync(i32 %60)
%78 = icmp eq i32 %77, -1
br i1 %78, label %79, label %84
79: ; preds = %76
%80 = load i32, i32* @LOG_ERR
%81 = load i32, i32* @errno
%82 = call i32 @strerror(i32 %81)
%83 = call i32 (i32, i8*, ...) @syslog(i32 %80, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i8* %8, i32 %81, i32 %82)
br label %116
84: ; preds = %76
%85 = call i32 @rename(i8* %8, i8* %9)
%86 = icmp eq i32 %85, -1
br i1 %86, label %87, label %92
87: ; preds = %84
%88 = load i32, i32* @LOG_ERR
%89 = load i32, i32* @errno
%90 = call i32 @strerror(i32 %89)
%91 = call i32 (i32, i8*, ...) @syslog(i32 %88, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0), i8* %8, i8* %9, i32 %89, i32 %90)
br label %116
92: ; preds = %84
%93 = load i32, i32* @O_RDONLY
%94 = load i32, i32* @O_DIRECTORY
%95 = or i32 %94, %93
%96 = call i32 (i8*, i32, ...) @open(i8* %1, i32 %95)
%97 = icmp eq i32 %96, -1
br i1 %97, label %98, label %103
98: ; preds = %92
%99 = load i32, i32* @LOG_ERR
%100 = load i32, i32* @errno
%101 = call i32 @strerror(i32 %100)
%102 = call i32 (i32, i8*, ...) @syslog(i32 %99, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.9, i64 0, i64 0), i8* %1, i32 %100, i32 %101)
br label %116
103: ; preds = %92
%104 = call i32 @fsync(i32 %96)
%105 = icmp eq i32 %104, -1
br i1 %105, label %106, label %111
106: ; preds = %103
%107 = load i32, i32* @LOG_ERR
%108 = load i32, i32* @errno
%109 = call i32 @strerror(i32 %108)
%110 = call i32 (i32, i8*, ...) @syslog(i32 %107, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.10, i64 0, i64 0), i8* %1, i32 %108, i32 %109)
br label %111
111: ; preds = %106, %103
%112 = load i32, i32* @LOG_NOTICE
%113 = call i32 (i32, i8*, ...) @syslog(i32 %112, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.11, i64 0, i64 0), i8* %1, i8* %11)
br label %116
114: ; preds = %39, %62
%115 = call i32 @close(i32 %26)
br label %124
116: ; preds = %111, %98, %87, %79, %70
%117 = phi i32 [ %96, %111 ], [ -1, %98 ], [ -1, %87 ], [ -1, %79 ], [ -1, %70 ]
%118 = phi i32 [ 0, %111 ], [ -1, %98 ], [ -1, %87 ], [ -1, %79 ], [ -1, %70 ]
%119 = call i32 @close(i32 %26)
%120 = call i32 @close(i32 %60)
%121 = icmp eq i32 %117, -1
br i1 %121, label %124, label %122
122: ; preds = %116
%123 = call i32 @close(i32 %117)
br label %124
124: ; preds = %114, %28, %122, %116
%125 = phi i32 [ -1, %28 ], [ %118, %122 ], [ %118, %116 ], [ -1, %114 ]
%126 = call i32 @free(i8* %19)
br label %127
127: ; preds = %2, %124, %21
%128 = phi i32 [ %125, %124 ], [ -1, %21 ], [ -1, %2 ]
ret i32 %128
}