#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct dirent {
  scalar_t__ d_type;
  char *d_name;
};
typedef int pid_t;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
scalar_t__ DT_REG;
int EXIT_SUCCESS;
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ LOG_NOTICE;
int /*<<< orphan*/ MS_RELATIME;
int /*<<< orphan*/ WEXITSTATUS(int);
scalar_t__ WIFEXITED(int);
scalar_t__ WIFSIGNALED(int);
scalar_t__ WIFSTOPPED(int);
int WSTOPSIG(int);
int WTERMSIG(int);
int /*<<< orphan*/ abort();
int /*<<< orphan*/ checkDirectory(char *);
int closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ closelog();
int /*<<< orphan*/ errno;
int /*<<< orphan*/ execvp(char *, char **);
int fork();
int /*<<< orphan*/ free(char *);
size_t getDCIMDirectories(char *, char ***);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(char *, char, int);
int mount(char *, char *, char *, int /*<<< orphan*/, char *);
int /*<<< orphan*/ *opendir(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ skeleton_daemon();
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ *strstr(char *, char *);
int /*<<< orphan*/ sync();
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, ...);
int umount(char *);
int /*<<< orphan*/ waitpid(int, int *, int /*<<< orphan*/);
int main(void) {
  skeleton_daemon();
  while (1) {
    char **DCIMDirectories;
    size_t numberOfDirectories;
    int i;
    numberOfDirectories = getDCIMDirectories("/mnt/sd/DCIM/", &DCIMDirectories);
    for (i = 0; i < numberOfDirectories; i++) {
      char imagePath[100];
      imagePath[0] = 0;
      strcat(imagePath, "/mnt/sd/DCIM/");
      strcat(imagePath, DCIMDirectories[i]);
      strcat(imagePath, "/");
      checkDirectory(imagePath);
      DIR *imageDir;
      imageDir = opendir(imagePath);
      struct dirent *imageDirContent;
      if (imageDir) {
        while ((imageDirContent = readdir(imageDir)) != NULL) {
          if (imageDirContent->d_type == DT_REG) {
            int pathLength =
                strlen(imageDirContent->d_name) + strlen(imagePath) + 1;
            char *newFilePath = (char *)malloc(pathLength);
            if (newFilePath == NULL) {
              syslog(LOG_ERR, "Error during initializing newFilePath buffer. "
                              "Continue without encrypting");
            } else {
              memset(newFilePath, '\0', pathLength);
              strncpy(newFilePath, imagePath, strlen(imagePath));
              strncat(newFilePath, imageDirContent->d_name,
                      strlen(imageDirContent->d_name));
              if (strstr(imageDirContent->d_name, ".out") == NULL) {
                syslog(LOG_NOTICE, "Beginning to handle %s",
                       imageDirContent->d_name);
                pid_t childPid = fork();
                if (childPid == -1) {
                  syslog(LOG_ERR,
                         "Error %d occured during start of cryptosd. "
                         "Continuing without encrypting %s",
                         errno, imageDirContent->d_name);
                } else if (childPid == 0) {
                  syslog(LOG_NOTICE, "Starting cryptosd for %s.",
                         imageDirContent->d_name);
                  char *argList[] = {"cryptosd",    "-e", "-p",
                                     "/mnt/sd/key", "-i", newFilePath,
                                     NULL};
                  execvp("/etc/cryptosd", argList);
                  syslog(LOG_ERR,
                         "Error (%d) during execvp of cryptosd for %s.", errno,
                         newFilePath);
                  abort();
                } else {
                  syslog(LOG_NOTICE, "Child (cryptosd) pid: %d", childPid);
                  int returnStatus;
                  waitpid(childPid, &returnStatus, 0);
                  syslog(LOG_NOTICE, "Return Status %d",
                         WEXITSTATUS(returnStatus));
                  if (WIFEXITED(returnStatus)) {
                    syslog(
                        LOG_NOTICE,
                        "Encryption done for %s. Beginning with the deletion.",
                        newFilePath);
                    pid_t childPid = fork();
                    if (childPid == -1) {
                      syslog(LOG_ERR,
                             "Error (%d) during start of rm. Continue without "
                             "deleting %s",
                             errno, imageDirContent->d_name);
                    } else if (childPid == 0) {
                      syslog(LOG_NOTICE, "Starting deletion of %s",
                             imageDirContent->d_name);
                      char *argList[] = {"rm", newFilePath, NULL};
                      execvp("rm", argList);
                      syslog(LOG_ERR, "Error during execvp of rm for %s",
                             imageDirContent->d_name);
                      abort();
                    } else {
                      syslog(LOG_NOTICE, "Child (rm) pid: %d", childPid);
                      returnStatus = 9;
                      waitpid(childPid, &returnStatus, 0);
                      if (returnStatus != 0) {
                        syslog(LOG_ERR, "Child (rm) returned with errorcode %d",
                               returnStatus);
                      } else {
                        syslog(LOG_NOTICE, "Deletion done for %s",
                               imageDirContent->d_name);
                      }
                    }
                  } else if (WIFSIGNALED(returnStatus)) {
                    int signum = WTERMSIG(returnStatus);
                    syslog(LOG_ERR, "Exited due to receiving signal %d\n",
                           WEXITSTATUS(returnStatus));
                  } else if (WIFSTOPPED(returnStatus)) {
                    int signum = WSTOPSIG(returnStatus);
                    syslog(LOG_ERR, "Stopped due to receiving signal %d\n",
                           WEXITSTATUS(returnStatus));
                  } else {
                    syslog(LOG_ERR,
                           "Child (cryptosd) returned with errorcode %d",
                           WEXITSTATUS(returnStatus));
                  }
                }
              }
            }
            free(newFilePath);
          }
        }
        if (closedir(imageDir) == -1) {
          syslog(LOG_ERR, "Error during closing the directory %s", imagePath);
        }
      }
    }
    int sleepTime = 1;
    syslog(LOG_NOTICE, "Sleep %d seconds", sleepTime);
    sleep(sleepTime);
    syslog(LOG_NOTICE, "before sync");
    sync();
    syslog(LOG_NOTICE, "after sync");
    syslog(LOG_NOTICE, "begin umount");
    if (umount("/mnt/sd/") == -1) {
      syslog(LOG_ERR, "Unmount failed with errorcode %d", errno);
    }
    syslog(LOG_NOTICE, "end umount");
    if (mount("/dev/mmcblk0p1", "/mnt/sd", "vfat", MS_RELATIME,
              "errors=continue") == -1) {
      syslog(LOG_ERR, "Remount failed with errorcode %d", errno);
    }
    syslog(LOG_NOTICE, "end remount");
  }
  syslog(LOG_NOTICE, "Cryptodaemon terminated.");
  closelog();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   10a0 <skeleton_daemon@plt>
lea    0xd10(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   10f0 <getDCIMDirectories@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1970 <main+0x6a0>
movb   $0x0,-0x80(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xcdf(%rip),%rsi
call   11a0 <strcat@plt>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   11a0 <strcat@plt>
lea    -0x80(%rbp),%rdi
lea    0xcc6(%rip),%rsi
call   11a0 <strcat@plt>
lea    -0x80(%rbp),%rdi
call   1160 <checkDirectory@plt>
lea    -0x80(%rbp),%rdi
call   1070 <opendir@plt>
mov    %rax,-0x88(%rbp)
cmpq   $0x0,-0x88(%rbp)
je     195d <main+0x68d>
jmp    1377 <main+0xa7>
mov    -0x88(%rbp),%rdi
call   1110 <readdir@plt>
mov    %rax,-0x90(%rbp)
cmp    $0x0,%rax
je     1928 <main+0x658>
mov    -0x90(%rbp),%rax
mov    (%rax),%rax
mov    0x2c3b(%rip),%rcx
cmp    (%rcx),%rax
jne    1923 <main+0x653>
mov    -0x90(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <strlen@plt>
mov    %eax,-0x110(%rbp)
lea    -0x80(%rbp),%rdi
call   1080 <strlen@plt>
mov    %eax,%ecx
mov    -0x110(%rbp),%eax
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
mov    -0x94(%rbp),%edi
call   1130 <malloc@plt>
mov    %rax,-0xa0(%rbp)
cmpq   $0x0,-0xa0(%rbp)
jne    141c <main+0x14c>
mov    0x2bb1(%rip),%rax
mov    (%rax),%edi
lea    0xbfe(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
jmp    1917 <main+0x647>
mov    -0xa0(%rbp),%rdi
mov    -0x94(%rbp),%edx
xor    %esi,%esi
call   10b0 <memset@plt>
mov    -0xa0(%rbp),%rax
mov    %rax,-0x130(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0x128(%rbp)
lea    -0x80(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0x130(%rbp),%rdi
mov    -0x128(%rbp),%rsi
mov    %eax,%edx
call   1050 <strncpy@plt>
mov    -0xa0(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    -0x90(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x118(%rbp)
mov    -0x90(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <strlen@plt>
mov    -0x120(%rbp),%rdi
mov    -0x118(%rbp),%rsi
mov    %eax,%edx
call   10c0 <strncat@plt>
mov    -0x90(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xb9a(%rip),%rsi
call   11f0 <strstr@plt>
cmp    $0x0,%rax
jne    1912 <main+0x642>
mov    0x2af4(%rip),%rax
mov    (%rax),%edi
mov    -0x90(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xb75(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
mov    $0x0,%al
call   11e0 <fork@plt>
mov    %eax,-0xa4(%rbp)
cmpl   $0xffffffff,-0xa4(%rbp)
jne    1539 <main+0x269>
mov    0x2aa8(%rip),%rax
mov    (%rax),%edi
mov    0x2ab7(%rip),%rax
mov    (%rax),%edx
mov    -0x90(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xb47(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
jmp    190d <main+0x63d>
cmpl   $0x0,-0xa4(%rbp)
jne    1608 <main+0x338>
mov    0x2a7b(%rip),%rax
mov    (%rax),%edi
mov    -0x90(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xb5f(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
lea    0xb85(%rip),%rax
mov    %rax,-0xe0(%rbp)
lea    0xb5d(%rip),%rax
mov    %rax,-0xd8(%rbp)
lea    0xb52(%rip),%rax
mov    %rax,-0xd0(%rbp)
lea    0xb47(%rip),%rax
mov    %rax,-0xc8(%rbp)
lea    0xb45(%rip),%rax
mov    %rax,-0xc0(%rbp)
mov    -0xa0(%rbp),%rax
mov    %rax,-0xb8(%rbp)
movq   $0x0,-0xb0(%rbp)
lea    -0xe0(%rbp),%rsi
lea    0xb1a(%rip),%rdi
call   1190 <execvp@plt>
mov    0x29d7(%rip),%rax
mov    (%rax),%edi
mov    0x29e6(%rip),%rax
mov    (%rax),%edx
mov    -0xa0(%rbp),%rcx
lea    0xb03(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
mov    $0x0,%al
call   1040 <abort@plt>
mov    0x29b9(%rip),%rax
mov    (%rax),%edi
mov    -0xa4(%rbp),%edx
lea    0xb0c(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
mov    -0xa4(%rbp),%edi
lea    -0xe4(%rbp),%rsi
xor    %edx,%edx
call   1180 <waitpid@plt>
mov    0x2988(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x134(%rbp)
mov    -0xe4(%rbp),%edi
call   1170 <WEXITSTATUS@plt>
mov    -0x134(%rbp),%edi
mov    %eax,%edx
lea    0xae1(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
mov    -0xe4(%rbp),%edi
call   11b0 <WIFEXITED@plt>
cmp    $0x0,%rax
je     1813 <main+0x543>
mov    0x2943(%rip),%rax
mov    (%rax),%edi
mov    -0xa0(%rbp),%rdx
lea    0xabf(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
mov    $0x0,%al
call   11e0 <fork@plt>
mov    %eax,-0xe8(%rbp)
cmpl   $0xffffffff,-0xe8(%rbp)
jne    16e6 <main+0x416>
mov    0x28fb(%rip),%rax
mov    (%rax),%edi
mov    0x290a(%rip),%rax
mov    (%rax),%edx
mov    -0x90(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xaaf(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
jmp    180e <main+0x53e>
cmpl   $0x0,-0xe8(%rbp)
jne    1778 <main+0x4a8>
mov    0x28ce(%rip),%rax
mov    (%rax),%edi
mov    -0x90(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xab7(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
lea    0xac1(%rip),%rax
mov    %rax,-0x100(%rbp)
mov    -0xa0(%rbp),%rax
mov    %rax,-0xf8(%rbp)
movq   $0x0,-0xf0(%rbp)
lea    -0x100(%rbp),%rsi
lea    0xa93(%rip),%rdi
call   1190 <execvp@plt>
mov    0x2862(%rip),%rax
mov    (%rax),%edi
mov    -0x90(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xa76(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
mov    $0x0,%al
call   1040 <abort@plt>
mov    0x2849(%rip),%rax
mov    (%rax),%edi
mov    -0xe8(%rbp),%edx
lea    0xa73(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
movl   $0x9,-0xe4(%rbp)
mov    -0xe8(%rbp),%edi
lea    -0xe4(%rbp),%rsi
xor    %edx,%edx
call   1180 <waitpid@plt>
cmpl   $0x0,-0xe4(%rbp)
je     17e2 <main+0x512>
mov    0x27f1(%rip),%rax
mov    (%rax),%edi
mov    -0xe4(%rbp),%edx
lea    0xa3e(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
jmp    1804 <main+0x534>
mov    0x27df(%rip),%rax
mov    (%rax),%edi
mov    -0x90(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xa3d(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
jmp    1809 <main+0x539>
jmp    180e <main+0x53e>
jmp    1903 <main+0x633>
mov    -0xe4(%rbp),%edi
call   10e0 <WIFSIGNALED@plt>
cmp    $0x0,%rax
je     186e <main+0x59e>
mov    -0xe4(%rbp),%edi
call   1140 <WTERMSIG@plt>
mov    %eax,-0x104(%rbp)
mov    0x2778(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x138(%rbp)
mov    -0xe4(%rbp),%edi
call   1170 <WEXITSTATUS@plt>
mov    -0x138(%rbp),%edi
mov    %eax,%edx
lea    0x9ed(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
jmp    18fe <main+0x62e>
mov    -0xe4(%rbp),%edi
call   1100 <WIFSTOPPED@plt>
cmp    $0x0,%rax
je     18c9 <main+0x5f9>
mov    -0xe4(%rbp),%edi
call   11d0 <WSTOPSIG@plt>
mov    %eax,-0x108(%rbp)
mov    0x271d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x13c(%rbp)
mov    -0xe4(%rbp),%edi
call   1170 <WEXITSTATUS@plt>
mov    -0x13c(%rbp),%edi
mov    %eax,%edx
lea    0x9b5(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
jmp    18f9 <main+0x629>
mov    0x26e8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x140(%rbp)
mov    -0xe4(%rbp),%edi
call   1170 <WEXITSTATUS@plt>
mov    -0x140(%rbp),%edi
mov    %eax,%edx
lea    0x9a4(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
jmp    18fe <main+0x62e>
jmp    1903 <main+0x633>
jmp    1908 <main+0x638>
jmp    190d <main+0x63d>
jmp    1912 <main+0x642>
jmp    1917 <main+0x647>
mov    -0xa0(%rbp),%rdi
call   1030 <free@plt>
jmp    1377 <main+0xa7>
mov    -0x88(%rbp),%rdi
call   10d0 <closedir@plt>
cmp    $0xffffffff,%eax
jne    1958 <main+0x688>
mov    0x2674(%rip),%rax
mov    (%rax),%edi
lea    -0x80(%rbp),%rdx
lea    0x971(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
jmp    195d <main+0x68d>
jmp    1962 <main+0x692>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1304 <main+0x34>
movl   $0x1,-0x10c(%rbp)
mov    0x2647(%rip),%rax
mov    (%rax),%edi
mov    -0x10c(%rbp),%edx
lea    0x958(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
mov    -0x10c(%rbp),%edi
call   11c0 <sleep@plt>
mov    0x261f(%rip),%rax
mov    (%rax),%edi
lea    0x947(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
mov    $0x0,%al
call   1120 <sync@plt>
mov    0x2601(%rip),%rax
mov    (%rax),%edi
lea    0x935(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
mov    0x25ea(%rip),%rax
mov    (%rax),%edi
lea    0x929(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
lea    0x928(%rip),%rdi
call   1060 <umount@plt>
cmp    $0xffffffff,%eax
jne    1a23 <main+0x753>
mov    0x25ae(%rip),%rax
mov    (%rax),%edi
mov    0x25bd(%rip),%rax
mov    (%rax),%edx
lea    0x90a(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
mov    0x259e(%rip),%rax
mov    (%rax),%edi
lea    0x914(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
mov    0x2597(%rip),%rax
mov    (%rax),%ecx
lea    0x908(%rip),%rdi
lea    0x910(%rip),%rsi
lea    0x911(%rip),%rdx
lea    0x90f(%rip),%r8
call   1090 <mount@plt>
cmp    $0xffffffff,%eax
jne    1a8d <main+0x7bd>
mov    0x2544(%rip),%rax
mov    (%rax),%edi
mov    0x2553(%rip),%rax
mov    (%rax),%edx
lea    0x8f8(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
mov    0x2534(%rip),%rax
mov    (%rax),%edi
lea    0x902(%rip),%rsi
mov    $0x0,%al
call   1150 <syslog@plt>
jmp    12e9 <main+0x19>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
xor    %eax,%eax
call   10a0 <skeleton_daemon@plt>
lea    0x60(%rsp),%r13
mov    0x2cec(%rip),%r12
jmp    1310 <main+0x40>
cs nopw 0x0(%rax,%rax,1)
mov    (%rbx),%edi
lea    0x1096(%rip),%rsi
xor    %eax,%eax
call   1150 <syslog@plt>
lea    0xce9(%rip),%rdi
lea    0x18(%rsp),%rsi
call   10f0 <getDCIMDirectories@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     16d0 <main+0x400>
xor    %ebx,%ebx
jmp    1365 <main+0x95>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
call   10d0 <closedir@plt>
cmp    $0xffffffff,%eax
mov    0x10(%rsp),%rbx
je     16b0 <main+0x3e0>
add    $0x1,%rbx
cmp    0x8(%rsp),%rbx
je     16d0 <main+0x400>
movb   $0x0,0x60(%rsp)
mov    %r13,%rdi
lea    0xc8c(%rip),%rsi
call   11a0 <strcat@plt>
mov    0x18(%rsp),%rax
mov    (%rax,%rbx,8),%rsi
mov    %r13,%rdi
call   11a0 <strcat@plt>
mov    %r13,%rdi
lea    0xc78(%rip),%rsi
call   11a0 <strcat@plt>
mov    %r13,%rdi
call   1160 <checkDirectory@plt>
mov    %r13,%rdi
call   1070 <opendir@plt>
test   %rax,%rax
je     1356 <main+0x86>
mov    %rax,%r15
mov    %rbx,0x10(%rsp)
mov    %rax,%rdi
call   1110 <readdir@plt>
test   %rax,%rax
je     1340 <main+0x70>
mov    %rax,%r14
jmp    13ff <main+0x12f>
mov    0x2be5(%rip),%rax
mov    (%rax),%edi
lea    0xc32(%rip),%rsi
xor    %eax,%eax
call   1150 <syslog@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1110 <readdir@plt>
mov    %rax,%r14
test   %rax,%rax
je     1340 <main+0x70>
mov    (%r14),%rax
cmp    (%r12),%rax
jne    13eb <main+0x11b>
mov    0x8(%r14),%rdi
call   1080 <strlen@plt>
mov    %eax,%ebx
mov    %r13,%rdi
call   1080 <strlen@plt>
add    %eax,%ebx
add    $0x1,%ebx
mov    %ebx,%edi
call   1130 <malloc@plt>
mov    %rax,%rbp
test   %rax,%rax
je     13cc <main+0xfc>
mov    %rbp,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   10b0 <memset@plt>
mov    %r13,%rdi
call   1080 <strlen@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %eax,%edx
call   1050 <strncpy@plt>
mov    0x8(%r14),%rbx
mov    %rbx,%rdi
call   1080 <strlen@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   10c0 <strncat@plt>
mov    0x8(%r14),%rbx
mov    %rbx,%rdi
lea    0xbe1(%rip),%rsi
call   11f0 <strstr@plt>
test   %rax,%rax
jne    13e3 <main+0x113>
mov    0x2b3c(%rip),%rax
mov    (%rax),%edi
lea    0xbc8(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1150 <syslog@plt>
xor    %eax,%eax
call   11e0 <fork@plt>
cmp    $0xffffffff,%eax
je     15a2 <main+0x2d2>
mov    %eax,%ebx
test   %eax,%eax
je     17c6 <main+0x4f6>
mov    0x2b08(%rip),%r13
mov    0x0(%r13),%edi
lea    0xc5f(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1150 <syslog@plt>
mov    %ebx,%edi
lea    0x4(%rsp),%rsi
xor    %edx,%edx
call   1180 <waitpid@plt>
mov    0x0(%r13),%ebx
mov    0x4(%rsp),%edi
call   1170 <WEXITSTATUS@plt>
mov    %ebx,%edi
lea    0xc4b(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1150 <syslog@plt>
mov    0x4(%rsp),%edi
call   11b0 <WIFEXITED@plt>
test   %rax,%rax
je     15cb <main+0x2fb>
mov    0x2a9e(%rip),%rbx
mov    0x0(%r13),%edi
lea    0xc2f(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1150 <syslog@plt>
xor    %eax,%eax
call   11e0 <fork@plt>
cmp    $0xffffffff,%eax
je     1607 <main+0x337>
mov    %eax,%r13d
mov    0x2a7f(%rip),%rax
test   %r13d,%r13d
je     1866 <main+0x596>
mov    (%rax),%edi
lea    0xca6(%rip),%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1150 <syslog@plt>
movl   $0x9,0x4(%rsp)
mov    %r13d,%edi
lea    0x4(%rsp),%rsi
xor    %edx,%edx
call   1180 <waitpid@plt>
mov    0x4(%rsp),%edx
test   %edx,%edx
je     165e <main+0x38e>
mov    (%rbx),%edi
lea    0xc83(%rip),%rsi
xor    %eax,%eax
call   1150 <syslog@plt>
lea    0x60(%rsp),%r13
jmp    13e3 <main+0x113>
mov    0x2a0f(%rip),%rax
mov    (%rax),%edi
mov    0x2a1e(%rip),%rax
mov    (%rax),%edx
mov    0x8(%r14),%rcx
lea    0xab5(%rip),%rsi
xor    %eax,%eax
call   1150 <syslog@plt>
jmp    13e3 <main+0x113>
mov    0x4(%rsp),%edi
call   10e0 <WIFSIGNALED@plt>
mov    0x4(%rsp),%edi
test   %rax,%rax
lea    0x60(%rsp),%r13
je     162e <main+0x35e>
call   1140 <WTERMSIG@plt>
mov    0x29ca(%rip),%rax
mov    (%rax),%ebx
mov    0x4(%rsp),%edi
call   1170 <WEXITSTATUS@plt>
mov    %ebx,%edi
lea    0xc4d(%rip),%rsi
jmp    169e <main+0x3ce>
mov    (%rbx),%edi
mov    0x29c0(%rip),%rax
mov    (%rax),%edx
mov    0x8(%r14),%rcx
lea    0xb6c(%rip),%rsi
xor    %eax,%eax
call   1150 <syslog@plt>
lea    0x60(%rsp),%r13
jmp    13e3 <main+0x113>
call   1100 <WIFSTOPPED@plt>
test   %rax,%rax
je     1683 <main+0x3b3>
mov    0x4(%rsp),%edi
call   11d0 <WSTOPSIG@plt>
mov    0x2970(%rip),%rax
mov    (%rax),%ebx
mov    0x4(%rsp),%edi
call   1170 <WEXITSTATUS@plt>
mov    %ebx,%edi
lea    0xc16(%rip),%rsi
jmp    169e <main+0x3ce>
mov    0x2963(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r14),%rdx
lea    0xbc8(%rip),%rsi
xor    %eax,%eax
call   1150 <syslog@plt>
lea    0x60(%rsp),%r13
jmp    13e3 <main+0x113>
mov    0x292e(%rip),%rax
mov    (%rax),%ebx
mov    0x4(%rsp),%edi
call   1170 <WEXITSTATUS@plt>
mov    %ebx,%edi
lea    0xbf8(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1150 <syslog@plt>
jmp    13e3 <main+0x113>
nopl   0x0(%rax)
mov    0x2901(%rip),%rax
mov    (%rax),%edi
lea    0xc02(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1150 <syslog@plt>
jmp    1356 <main+0x86>
nop
mov    0x28f1(%rip),%rbx
mov    (%rbx),%edi
lea    0xc08(%rip),%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1150 <syslog@plt>
mov    $0x1,%edi
call   11c0 <sleep@plt>
mov    (%rbx),%edi
lea    0xbfa(%rip),%rsi
xor    %eax,%eax
call   1150 <syslog@plt>
xor    %eax,%eax
call   1120 <sync@plt>
mov    (%rbx),%edi
lea    0xbef(%rip),%rsi
xor    %eax,%eax
call   1150 <syslog@plt>
mov    (%rbx),%edi
lea    0xbea(%rip),%rsi
xor    %eax,%eax
call   1150 <syslog@plt>
lea    0xbe9(%rip),%rdi
call   1060 <umount@plt>
cmp    $0xffffffff,%eax
jne    175e <main+0x48e>
mov    0x2873(%rip),%rax
mov    (%rax),%edi
mov    0x2882(%rip),%rax
mov    (%rax),%edx
lea    0xbcf(%rip),%rsi
xor    %eax,%eax
call   1150 <syslog@plt>
mov    (%rbx),%edi
lea    0xbe0(%rip),%rsi
xor    %eax,%eax
call   1150 <syslog@plt>
mov    0x2863(%rip),%rax
mov    (%rax),%ecx
lea    0xbd4(%rip),%rdi
lea    0xbdc(%rip),%rsi
lea    0xbdd(%rip),%rdx
lea    0xbdb(%rip),%r8
call   1090 <mount@plt>
cmp    $0xffffffff,%eax
jne    1300 <main+0x30>
mov    0x2810(%rip),%rax
mov    (%rax),%edi
mov    0x281f(%rip),%rax
mov    (%rax),%edx
lea    0xbc4(%rip),%rsi
xor    %eax,%eax
call   1150 <syslog@plt>
jmp    1300 <main+0x30>
mov    0x27fb(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r14),%rdx
lea    0x8e6(%rip),%rsi
xor    %eax,%eax
call   1150 <syslog@plt>
lea    0x90c(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0x8e6(%rip),%rax
mov    %rax,0x28(%rsp)
lea    0x8dd(%rip),%rax
mov    %rax,0x30(%rsp)
lea    0x8d4(%rip),%rax
mov    %rax,0x38(%rsp)
lea    0x8d4(%rip),%rax
mov    %rax,0x40(%rsp)
mov    %rbp,0x48(%rsp)
movq   $0x0,0x50(%rsp)
lea    0x8bd(%rip),%rdi
lea    0x20(%rsp),%rsi
call   1190 <execvp@plt>
mov    0x2775(%rip),%rax
mov    (%rax),%edi
mov    0x2784(%rip),%rax
mov    (%rax),%edx
lea    0x8a8(%rip),%rsi
mov    %rbp,%rcx
xor    %eax,%eax
call   1150 <syslog@plt>
xor    %eax,%eax
call   1040 <abort@plt>
mov    (%rax),%edi
mov    0x8(%r14),%rdx
lea    0x952(%rip),%rsi
xor    %eax,%eax
call   1150 <syslog@plt>
lea    0x95c(%rip),%rdi
mov    %rdi,0x20(%rsp)
mov    %rbp,0x28(%rsp)
movq   $0x0,0x30(%rsp)
lea    0x20(%rsp),%rsi
call   1190 <execvp@plt>
mov    (%rbx),%edi
mov    0x8(%r14),%rdx
lea    0x935(%rip),%rsi
xor    %eax,%eax
call   1150 <syslog@plt>
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
%struct.dirent = type { i64, i8* }
@.str = [14 x i8] c"/mnt/sd/DCIM/\00"
@.str.1 = [2 x i8] c"/\00"
@DT_REG = global i64 0
@LOG_ERR = global i32 0
@.str.2 = [74 x i8] c"Error during initializing newFilePath buffer. Continue without encrypting\00"
@.str.3 = [5 x i8] c".out\00"
@LOG_NOTICE = global i32 0
@.str.4 = [23 x i8] c"Beginning to handle %s\00"
@.str.5 = [76 x i8] c"Error %d occured during start of cryptosd. Continuing without encrypting %s\00"
@errno = global i32 0
@.str.6 = [26 x i8] c"Starting cryptosd for %s.\00"
@.str.7 = [9 x i8] c"cryptosd\00"
@.str.8 = [3 x i8] c"-e\00"
@.str.9 = [3 x i8] c"-p\00"
@.str.10 = [12 x i8] c"/mnt/sd/key\00"
@.str.11 = [3 x i8] c"-i\00"
@.str.12 = [14 x i8] c"/etc/cryptosd\00"
@.str.13 = [45 x i8] c"Error (%d) during execvp of cryptosd for %s.\00"
@.str.14 = [25 x i8] c"Child (cryptosd) pid: %d\00"
@.str.15 = [17 x i8] c"Return Status %d\00"
@.str.16 = [53 x i8] c"Encryption done for %s. Beginning with the deletion.\00"
@.str.17 = [60 x i8] c"Error (%d) during start of rm. Continue without deleting %s\00"
@.str.18 = [24 x i8] c"Starting deletion of %s\00"
@.str.19 = [3 x i8] c"rm\00"
@.str.20 = [33 x i8] c"Error during execvp of rm for %s\00"
@.str.21 = [19 x i8] c"Child (rm) pid: %d\00"
@.str.22 = [38 x i8] c"Child (rm) returned with errorcode %d\00"
@.str.23 = [21 x i8] c"Deletion done for %s\00"
@.str.24 = [35 x i8] c"Exited due to receiving signal %d\0A\00"
@.str.25 = [36 x i8] c"Stopped due to receiving signal %d\0A\00"
@.str.26 = [44 x i8] c"Child (cryptosd) returned with errorcode %d\00"
@.str.27 = [38 x i8] c"Error during closing the directory %s\00"
@.str.28 = [17 x i8] c"Sleep %d seconds\00"
@.str.29 = [12 x i8] c"before sync\00"
@.str.30 = [11 x i8] c"after sync\00"
@.str.31 = [13 x i8] c"begin umount\00"
@.str.32 = [9 x i8] c"/mnt/sd/\00"
@.str.33 = [33 x i8] c"Unmount failed with errorcode %d\00"
@.str.34 = [11 x i8] c"end umount\00"
@.str.35 = [15 x i8] c"/dev/mmcblk0p1\00"
@.str.36 = [8 x i8] c"/mnt/sd\00"
@.str.37 = [5 x i8] c"vfat\00"
@MS_RELATIME = global i32 0
@.str.38 = [16 x i8] c"errors=continue\00"
@.str.39 = [33 x i8] c"Remount failed with errorcode %d\00"
@.str.40 = [12 x i8] c"end remount\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8**
%3 = alloca i64
%4 = alloca i32
%5 = alloca [100 x i8]
%6 = alloca i32*
%7 = alloca %struct.dirent*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca [7 x i8*]
%12 = alloca i32
%13 = alloca i32
%14 = alloca [3 x i8*]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i32 0, i32* %1
%18 = call i32 (...) @skeleton_daemon()
br label %19
19: ; preds = %0, %284
%20 = call i64 @getDCIMDirectories(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8*** %2)
store i64 %20, i64* %3
store i32 0, i32* %4
br label %21
21: ; preds = %252, %19
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = load i64, i64* %3
%25 = icmp ult i64 %23, %24
br i1 %25, label %26, label %255
26: ; preds = %21
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
store i8 0, i8* %27
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%29 = call i32 @strcat(i8* %28, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%31 = load i8**, i8*** %2
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8*, i8** %31, i64 %33
%35 = load i8*, i8** %34
%36 = call i32 @strcat(i8* %30, i8* %35)
%37 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%38 = call i32 @strcat(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%39 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%40 = call i32 @checkDirectory(i8* %39)
%41 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%42 = call i32* @opendir(i8* %41)
store i32* %42, i32** %6
%43 = load i32*, i32** %6
%44 = icmp ne i32* %43, null
br i1 %44, label %45, label %251
45: ; preds = %26
br label %46
46: ; preds = %241, %45
%47 = load i32*, i32** %6
%48 = call %struct.dirent* @readdir(i32* %47)
store %struct.dirent* %48, %struct.dirent** %7
%49 = icmp ne %struct.dirent* %48, null
br i1 %49, label %50, label %242
50: ; preds = %46
%51 = load %struct.dirent*, %struct.dirent** %7
%52 = getelementptr inbounds %struct.dirent, %struct.dirent* %51, i32 0, i32 0
%53 = load i64, i64* %52
%54 = load i64, i64* @DT_REG
%55 = icmp eq i64 %53, %54
br i1 %55, label %56, label %241
56: ; preds = %50
%57 = load %struct.dirent*, %struct.dirent** %7
%58 = getelementptr inbounds %struct.dirent, %struct.dirent* %57, i32 0, i32 1
%59 = load i8*, i8** %58
%60 = call i32 @strlen(i8* %59)
%61 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%62 = call i32 @strlen(i8* %61)
%63 = add nsw i32 %60, %62
%64 = add nsw i32 %63, 1
store i32 %64, i32* %8
%65 = load i32, i32* %8
%66 = call i64 @malloc(i32 %65)
%67 = inttoptr i64 %66 to i8*
store i8* %67, i8** %9
%68 = load i8*, i8** %9
%69 = icmp eq i8* %68, null
br i1 %69, label %70, label %73
70: ; preds = %56
%71 = load i32, i32* @LOG_ERR
%72 = call i32 (i32, i8*, ...) @syslog(i32 %71, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.2, i64 0, i64 0))
br label %238
73: ; preds = %56
%74 = load i8*, i8** %9
%75 = load i32, i32* %8
%76 = call i32 @memset(i8* %74, i8 signext 0, i32 %75)
%77 = load i8*, i8** %9
%78 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%79 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%80 = call i32 @strlen(i8* %79)
%81 = call i32 @strncpy(i8* %77, i8* %78, i32 %80)
%82 = load i8*, i8** %9
%83 = load %struct.dirent*, %struct.dirent** %7
%84 = getelementptr inbounds %struct.dirent, %struct.dirent* %83, i32 0, i32 1
%85 = load i8*, i8** %84
%86 = load %struct.dirent*, %struct.dirent** %7
%87 = getelementptr inbounds %struct.dirent, %struct.dirent* %86, i32 0, i32 1
%88 = load i8*, i8** %87
%89 = call i32 @strlen(i8* %88)
%90 = call i32 @strncat(i8* %82, i8* %85, i32 %89)
%91 = load %struct.dirent*, %struct.dirent** %7
%92 = getelementptr inbounds %struct.dirent, %struct.dirent* %91, i32 0, i32 1
%93 = load i8*, i8** %92
%94 = call i32* @strstr(i8* %93, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%95 = icmp eq i32* %94, null
br i1 %95, label %96, label %237
96: ; preds = %73
%97 = load i32, i32* @LOG_NOTICE
%98 = load %struct.dirent*, %struct.dirent** %7
%99 = getelementptr inbounds %struct.dirent, %struct.dirent* %98, i32 0, i32 1
%100 = load i8*, i8** %99
%101 = call i32 (i32, i8*, ...) @syslog(i32 %97, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %100)
%102 = call i32 (...) @fork()
store i32 %102, i32* %10
%103 = load i32, i32* %10
%104 = icmp eq i32 %103, -1
br i1 %104, label %105, label %112
105: ; preds = %96
%106 = load i32, i32* @LOG_ERR
%107 = load i32, i32* @errno
%108 = load %struct.dirent*, %struct.dirent** %7
%109 = getelementptr inbounds %struct.dirent, %struct.dirent* %108, i32 0, i32 1
%110 = load i8*, i8** %109
%111 = call i32 (i32, i8*, ...) @syslog(i32 %106, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.5, i64 0, i64 0), i32 %107, i8* %110)
br label %236
112: ; preds = %96
%113 = load i32, i32* %10
%114 = icmp eq i32 %113, 0
br i1 %114, label %115, label %136
115: ; preds = %112
%116 = load i32, i32* @LOG_NOTICE
%117 = load %struct.dirent*, %struct.dirent** %7
%118 = getelementptr inbounds %struct.dirent, %struct.dirent* %117, i32 0, i32 1
%119 = load i8*, i8** %118
%120 = call i32 (i32, i8*, ...) @syslog(i32 %116, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %119)
%121 = getelementptr inbounds [7 x i8*], [7 x i8*]* %11, i64 0, i64 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8** %121
%122 = getelementptr inbounds i8*, i8** %121, i64 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8** %122
%123 = getelementptr inbounds i8*, i8** %122, i64 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8** %123
%124 = getelementptr inbounds i8*, i8** %123, i64 1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8** %124
%125 = getelementptr inbounds i8*, i8** %124, i64 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8** %125
%126 = getelementptr inbounds i8*, i8** %125, i64 1
%127 = load i8*, i8** %9
store i8* %127, i8** %126
%128 = getelementptr inbounds i8*, i8** %126, i64 1
store i8* null, i8** %128
%129 = getelementptr inbounds [7 x i8*], [7 x i8*]* %11, i64 0, i64 0
%130 = call i32 @execvp(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i8** %129)
%131 = load i32, i32* @LOG_ERR
%132 = load i32, i32* @errno
%133 = load i8*, i8** %9
%134 = call i32 (i32, i8*, ...) @syslog(i32 %131, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.13, i64 0, i64 0), i32 %132, i8* %133)
%135 = call i32 (...) @abort()
unreachable
136: ; preds = %112
%137 = load i32, i32* @LOG_NOTICE
%138 = load i32, i32* %10
%139 = call i32 (i32, i8*, ...) @syslog(i32 %137, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.14, i64 0, i64 0), i32 %138)
%140 = load i32, i32* %10
%141 = call i32 @waitpid(i32 %140, i32* %12, i32 0)
%142 = load i32, i32* @LOG_NOTICE
%143 = load i32, i32* %12
%144 = call i32 @WEXITSTATUS(i32 %143)
%145 = call i32 (i32, i8*, ...) @syslog(i32 %142, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0), i32 %144)
%146 = load i32, i32* %12
%147 = call i64 @WIFEXITED(i32 %146)
%148 = icmp ne i64 %147, 0
br i1 %148, label %149, label %205
149: ; preds = %136
%150 = load i32, i32* @LOG_NOTICE
%151 = load i8*, i8** %9
%152 = call i32 (i32, i8*, ...) @syslog(i32 %150, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.16, i64 0, i64 0), i8* %151)
%153 = call i32 (...) @fork()
store i32 %153, i32* %13
%154 = load i32, i32* %13
%155 = icmp eq i32 %154, -1
br i1 %155, label %156, label %163
156: ; preds = %149
%157 = load i32, i32* @LOG_ERR
%158 = load i32, i32* @errno
%159 = load %struct.dirent*, %struct.dirent** %7
%160 = getelementptr inbounds %struct.dirent, %struct.dirent* %159, i32 0, i32 1
%161 = load i8*, i8** %160
%162 = call i32 (i32, i8*, ...) @syslog(i32 %157, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.17, i64 0, i64 0), i32 %158, i8* %161)
br label %204
163: ; preds = %149
%164 = load i32, i32* %13
%165 = icmp eq i32 %164, 0
br i1 %165, label %166, label %184
166: ; preds = %163
%167 = load i32, i32* @LOG_NOTICE
%168 = load %struct.dirent*, %struct.dirent** %7
%169 = getelementptr inbounds %struct.dirent, %struct.dirent* %168, i32 0, i32 1
%170 = load i8*, i8** %169
%171 = call i32 (i32, i8*, ...) @syslog(i32 %167, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0), i8* %170)
%172 = getelementptr inbounds [3 x i8*], [3 x i8*]* %14, i64 0, i64 0
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i64 0, i64 0), i8** %172
%173 = getelementptr inbounds i8*, i8** %172, i64 1
%174 = load i8*, i8** %9
store i8* %174, i8** %173
%175 = getelementptr inbounds i8*, i8** %173, i64 1
store i8* null, i8** %175
%176 = getelementptr inbounds [3 x i8*], [3 x i8*]* %14, i64 0, i64 0
%177 = call i32 @execvp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i64 0, i64 0), i8** %176)
%178 = load i32, i32* @LOG_ERR
%179 = load %struct.dirent*, %struct.dirent** %7
%180 = getelementptr inbounds %struct.dirent, %struct.dirent* %179, i32 0, i32 1
%181 = load i8*, i8** %180
%182 = call i32 (i32, i8*, ...) @syslog(i32 %178, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.20, i64 0, i64 0), i8* %181)
%183 = call i32 (...) @abort()
unreachable
184: ; preds = %163
%185 = load i32, i32* @LOG_NOTICE
%186 = load i32, i32* %13
%187 = call i32 (i32, i8*, ...) @syslog(i32 %185, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.21, i64 0, i64 0), i32 %186)
store i32 9, i32* %12
%188 = load i32, i32* %13
%189 = call i32 @waitpid(i32 %188, i32* %12, i32 0)
%190 = load i32, i32* %12
%191 = icmp ne i32 %190, 0
br i1 %191, label %192, label %196
192: ; preds = %184
%193 = load i32, i32* @LOG_ERR
%194 = load i32, i32* %12
%195 = call i32 (i32, i8*, ...) @syslog(i32 %193, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.22, i64 0, i64 0), i32 %194)
br label %202
196: ; preds = %184
%197 = load i32, i32* @LOG_NOTICE
%198 = load %struct.dirent*, %struct.dirent** %7
%199 = getelementptr inbounds %struct.dirent, %struct.dirent* %198, i32 0, i32 1
%200 = load i8*, i8** %199
%201 = call i32 (i32, i8*, ...) @syslog(i32 %197, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.23, i64 0, i64 0), i8* %200)
br label %202
202: ; preds = %196, %192
br label %203
203: ; preds = %202
br label %204
204: ; preds = %203, %156
br label %234
205: ; preds = %136
%206 = load i32, i32* %12
%207 = call i64 @WIFSIGNALED(i32 %206)
%208 = icmp ne i64 %207, 0
br i1 %208, label %209, label %216
209: ; preds = %205
%210 = load i32, i32* %12
%211 = call i32 @WTERMSIG(i32 %210)
store i32 %211, i32* %15
%212 = load i32, i32* @LOG_ERR
%213 = load i32, i32* %12
%214 = call i32 @WEXITSTATUS(i32 %213)
%215 = call i32 (i32, i8*, ...) @syslog(i32 %212, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.24, i64 0, i64 0), i32 %214)
br label %233
216: ; preds = %205
%217 = load i32, i32* %12
%218 = call i64 @WIFSTOPPED(i32 %217)
%219 = icmp ne i64 %218, 0
br i1 %219, label %220, label %227
220: ; preds = %216
%221 = load i32, i32* %12
%222 = call i32 @WSTOPSIG(i32 %221)
store i32 %222, i32* %16
%223 = load i32, i32* @LOG_ERR
%224 = load i32, i32* %12
%225 = call i32 @WEXITSTATUS(i32 %224)
%226 = call i32 (i32, i8*, ...) @syslog(i32 %223, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.25, i64 0, i64 0), i32 %225)
br label %232
227: ; preds = %216
%228 = load i32, i32* @LOG_ERR
%229 = load i32, i32* %12
%230 = call i32 @WEXITSTATUS(i32 %229)
%231 = call i32 (i32, i8*, ...) @syslog(i32 %228, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.26, i64 0, i64 0), i32 %230)
br label %232
232: ; preds = %227, %220
br label %233
233: ; preds = %232, %209
br label %234
234: ; preds = %233, %204
br label %235
235: ; preds = %234
br label %236
236: ; preds = %235, %105
br label %237
237: ; preds = %236, %73
br label %238
238: ; preds = %237, %70
%239 = load i8*, i8** %9
%240 = call i32 @free(i8* %239)
br label %241
241: ; preds = %238, %50
br label %46
242: ; preds = %46
%243 = load i32*, i32** %6
%244 = call i32 @closedir(i32* %243)
%245 = icmp eq i32 %244, -1
br i1 %245, label %246, label %250
246: ; preds = %242
%247 = load i32, i32* @LOG_ERR
%248 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%249 = call i32 (i32, i8*, ...) @syslog(i32 %247, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.27, i64 0, i64 0), i8* %248)
br label %250
250: ; preds = %246, %242
br label %251
251: ; preds = %250, %26
br label %252
252: ; preds = %251
%253 = load i32, i32* %4
%254 = add nsw i32 %253, 1
store i32 %254, i32* %4
br label %21
255: ; preds = %21
store i32 1, i32* %17
%256 = load i32, i32* @LOG_NOTICE
%257 = load i32, i32* %17
%258 = call i32 (i32, i8*, ...) @syslog(i32 %256, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.28, i64 0, i64 0), i32 %257)
%259 = load i32, i32* %17
%260 = call i32 @sleep(i32 %259)
%261 = load i32, i32* @LOG_NOTICE
%262 = call i32 (i32, i8*, ...) @syslog(i32 %261, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.29, i64 0, i64 0))
%263 = call i32 (...) @sync()
%264 = load i32, i32* @LOG_NOTICE
%265 = call i32 (i32, i8*, ...) @syslog(i32 %264, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.30, i64 0, i64 0))
%266 = load i32, i32* @LOG_NOTICE
%267 = call i32 (i32, i8*, ...) @syslog(i32 %266, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.31, i64 0, i64 0))
%268 = call i32 @umount(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.32, i64 0, i64 0))
%269 = icmp eq i32 %268, -1
br i1 %269, label %270, label %274
270: ; preds = %255
%271 = load i32, i32* @LOG_ERR
%272 = load i32, i32* @errno
%273 = call i32 (i32, i8*, ...) @syslog(i32 %271, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.33, i64 0, i64 0), i32 %272)
br label %274
274: ; preds = %270, %255
%275 = load i32, i32* @LOG_NOTICE
%276 = call i32 (i32, i8*, ...) @syslog(i32 %275, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.34, i64 0, i64 0))
%277 = load i32, i32* @MS_RELATIME
%278 = call i32 @mount(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.35, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.36, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.37, i64 0, i64 0), i32 %277, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.38, i64 0, i64 0))
%279 = icmp eq i32 %278, -1
br i1 %279, label %280, label %284
280: ; preds = %274
%281 = load i32, i32* @LOG_ERR
%282 = load i32, i32* @errno
%283 = call i32 (i32, i8*, ...) @syslog(i32 %281, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.39, i64 0, i64 0), i32 %282)
br label %284
284: ; preds = %280, %274
%285 = load i32, i32* @LOG_NOTICE
%286 = call i32 (i32, i8*, ...) @syslog(i32 %285, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.40, i64 0, i64 0))
br label %19
}

LLVM IR (-O2):
%struct.dirent = type { i64, i8* }
@.str = [14 x i8] c"/mnt/sd/DCIM/\00"
@.str.1 = [2 x i8] c"/\00"
@DT_REG = global i64 0
@LOG_ERR = global i32 0
@.str.2 = [74 x i8] c"Error during initializing newFilePath buffer. Continue without encrypting\00"
@.str.3 = [5 x i8] c".out\00"
@LOG_NOTICE = global i32 0
@.str.4 = [23 x i8] c"Beginning to handle %s\00"
@.str.5 = [76 x i8] c"Error %d occured during start of cryptosd. Continuing without encrypting %s\00"
@errno = global i32 0
@.str.6 = [26 x i8] c"Starting cryptosd for %s.\00"
@.str.7 = [9 x i8] c"cryptosd\00"
@.str.8 = [3 x i8] c"-e\00"
@.str.9 = [3 x i8] c"-p\00"
@.str.10 = [12 x i8] c"/mnt/sd/key\00"
@.str.11 = [3 x i8] c"-i\00"
@.str.12 = [14 x i8] c"/etc/cryptosd\00"
@.str.13 = [45 x i8] c"Error (%d) during execvp of cryptosd for %s.\00"
@.str.14 = [25 x i8] c"Child (cryptosd) pid: %d\00"
@.str.15 = [17 x i8] c"Return Status %d\00"
@.str.16 = [53 x i8] c"Encryption done for %s. Beginning with the deletion.\00"
@.str.17 = [60 x i8] c"Error (%d) during start of rm. Continue without deleting %s\00"
@.str.18 = [24 x i8] c"Starting deletion of %s\00"
@.str.19 = [3 x i8] c"rm\00"
@.str.20 = [33 x i8] c"Error during execvp of rm for %s\00"
@.str.21 = [19 x i8] c"Child (rm) pid: %d\00"
@.str.22 = [38 x i8] c"Child (rm) returned with errorcode %d\00"
@.str.23 = [21 x i8] c"Deletion done for %s\00"
@.str.24 = [35 x i8] c"Exited due to receiving signal %d\0A\00"
@.str.25 = [36 x i8] c"Stopped due to receiving signal %d\0A\00"
@.str.26 = [44 x i8] c"Child (cryptosd) returned with errorcode %d\00"
@.str.27 = [38 x i8] c"Error during closing the directory %s\00"
@.str.28 = [17 x i8] c"Sleep %d seconds\00"
@.str.29 = [12 x i8] c"before sync\00"
@.str.30 = [11 x i8] c"after sync\00"
@.str.31 = [13 x i8] c"begin umount\00"
@.str.32 = [9 x i8] c"/mnt/sd/\00"
@.str.33 = [33 x i8] c"Unmount failed with errorcode %d\00"
@.str.34 = [11 x i8] c"end umount\00"
@.str.35 = [15 x i8] c"/dev/mmcblk0p1\00"
@.str.36 = [8 x i8] c"/mnt/sd\00"
@.str.37 = [5 x i8] c"vfat\00"
@MS_RELATIME = global i32 0
@.str.38 = [16 x i8] c"errors=continue\00"
@.str.39 = [33 x i8] c"Remount failed with errorcode %d\00"
@.str.40 = [12 x i8] c"end remount\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i8**
%2 = alloca [100 x i8]
%3 = alloca [7 x i8*]
%4 = alloca i32
%5 = alloca [3 x i8*]
%6 = tail call i32 (...) @skeleton_daemon()
%7 = bitcast i8*** %1 to i8*
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%9 = bitcast i32* %4 to i8*
br label %10
10: ; preds = %0, %198
%11 = call i64 @getDCIMDirectories(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8*** %1)
%12 = icmp eq i64 %11, 0
br i1 %12, label %171, label %13
13: ; preds = %10, %168
%14 = phi i64 [ %169, %168 ], [ 0, %10 ]
store i8 0, i8* %8
%15 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%16 = load i8**, i8*** %1
%17 = getelementptr inbounds i8*, i8** %16, i64 %14
%18 = load i8*, i8** %17
%19 = call i32 @strcat(i8* %8, i8* %18)
%20 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @checkDirectory(i8* %8)
%22 = call i32* @opendir(i8* %8)
%23 = icmp eq i32* %22, null
br i1 %23, label %168, label %24
24: ; preds = %13
%25 = call %struct.dirent* @readdir(i32* %22)
%26 = icmp eq %struct.dirent* %25, null
br i1 %26, label %162, label %27
27: ; preds = %24, %159
%28 = phi %struct.dirent* [ %160, %159 ], [ %25, %24 ]
%29 = getelementptr inbounds %struct.dirent, %struct.dirent* %28, i64 0, i32 0
%30 = load i64, i64* %29
%31 = load i64, i64* @DT_REG
%32 = icmp eq i64 %30, %31
br i1 %32, label %33, label %159
33: ; preds = %27
%34 = getelementptr inbounds %struct.dirent, %struct.dirent* %28, i64 0, i32 1
%35 = load i8*, i8** %34
%36 = call i32 @strlen(i8* %35)
%37 = call i32 @strlen(i8* %8)
%38 = add i32 %36, 1
%39 = add i32 %38, %37
%40 = call i64 @malloc(i32 %39)
%41 = inttoptr i64 %40 to i8*
%42 = icmp eq i64 %40, 0
br i1 %42, label %43, label %46
43: ; preds = %33
%44 = load i32, i32* @LOG_ERR
%45 = call i32 (i32, i8*, ...) @syslog(i32 %44, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.2, i64 0, i64 0))
br label %157
46: ; preds = %33
%47 = call i32 @memset(i8* %41, i8 signext 0, i32 %39)
%48 = call i32 @strlen(i8* %8)
%49 = call i32 @strncpy(i8* %41, i8* %8, i32 %48)
%50 = load i8*, i8** %34
%51 = call i32 @strlen(i8* %50)
%52 = call i32 @strncat(i8* %41, i8* %50, i32 %51)
%53 = load i8*, i8** %34
%54 = call i32* @strstr(i8* dereferenceable(1) %53, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%55 = icmp eq i32* %54, null
br i1 %55, label %56, label %157
56: ; preds = %46
%57 = load i32, i32* @LOG_NOTICE
%58 = call i32 (i32, i8*, ...) @syslog(i32 %57, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %53)
%59 = call i32 (...) @fork()
switch i32 %59, label %83 [
i32 -1, label %60
i32 0, label %65
]
60: ; preds = %56
%61 = load i32, i32* @LOG_ERR
%62 = load i32, i32* @errno
%63 = load i8*, i8** %34
%64 = call i32 (i32, i8*, ...) @syslog(i32 %61, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.5, i64 0, i64 0), i32 %62, i8* %63)
br label %157
65: ; preds = %56
%66 = inttoptr i64 %40 to i8*
%67 = load i32, i32* @LOG_NOTICE
%68 = load i8*, i8** %34
%69 = call i32 (i32, i8*, ...) @syslog(i32 %67, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %68)
%70 = bitcast [7 x i8*]* %3 to i8*
%71 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8** %71
%72 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8** %72
%73 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8** %73
%74 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 3
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8** %74
%75 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 4
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8** %75
%76 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 5
store i8* %66, i8** %76
%77 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 6
store i8* null, i8** %77
%78 = call i32 @execvp(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i8** %71)
%79 = load i32, i32* @LOG_ERR
%80 = load i32, i32* @errno
%81 = call i32 (i32, i8*, ...) @syslog(i32 %79, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.13, i64 0, i64 0), i32 %80, i8* %66)
%82 = call i32 (...) @abort()
unreachable
83: ; preds = %56
%84 = load i32, i32* @LOG_NOTICE
%85 = call i32 (i32, i8*, ...) @syslog(i32 %84, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.14, i64 0, i64 0), i32 %59)
%86 = call i32 @waitpid(i32 %59, i32* %4, i32 0)
%87 = load i32, i32* @LOG_NOTICE
%88 = load i32, i32* %4
%89 = call i32 @WEXITSTATUS(i32 %88)
%90 = call i32 (i32, i8*, ...) @syslog(i32 %87, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0), i32 %89)
%91 = load i32, i32* %4
%92 = call i64 @WIFEXITED(i32 %91)
%93 = icmp eq i64 %92, 0
br i1 %93, label %130, label %94
94: ; preds = %83
%95 = load i32, i32* @LOG_NOTICE
%96 = call i32 (i32, i8*, ...) @syslog(i32 %95, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.16, i64 0, i64 0), i8* %41)
%97 = call i32 (...) @fork()
switch i32 %97, label %117 [
i32 -1, label %98
i32 0, label %103
]
98: ; preds = %94
%99 = load i32, i32* @LOG_ERR
%100 = load i32, i32* @errno
%101 = load i8*, i8** %34
%102 = call i32 (i32, i8*, ...) @syslog(i32 %99, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.17, i64 0, i64 0), i32 %100, i8* %101)
br label %156
103: ; preds = %94
%104 = inttoptr i64 %40 to i8*
%105 = load i32, i32* @LOG_NOTICE
%106 = load i8*, i8** %34
%107 = call i32 (i32, i8*, ...) @syslog(i32 %105, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0), i8* %106)
%108 = bitcast [3 x i8*]* %5 to i8*
%109 = getelementptr inbounds [3 x i8*], [3 x i8*]* %5, i64 0, i64 0
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i64 0, i64 0), i8** %109
%110 = getelementptr inbounds [3 x i8*], [3 x i8*]* %5, i64 0, i64 1
store i8* %104, i8** %110
%111 = getelementptr inbounds [3 x i8*], [3 x i8*]* %5, i64 0, i64 2
store i8* null, i8** %111
%112 = call i32 @execvp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i64 0, i64 0), i8** %109)
%113 = load i32, i32* @LOG_ERR
%114 = load i8*, i8** %34
%115 = call i32 (i32, i8*, ...) @syslog(i32 %113, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.20, i64 0, i64 0), i8* %114)
%116 = call i32 (...) @abort()
unreachable
117: ; preds = %94
%118 = load i32, i32* @LOG_NOTICE
%119 = call i32 (i32, i8*, ...) @syslog(i32 %118, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.21, i64 0, i64 0), i32 %97)
store i32 9, i32* %4
%120 = call i32 @waitpid(i32 %97, i32* %4, i32 0)
%121 = load i32, i32* %4
%122 = icmp eq i32 %121, 0
br i1 %122, label %126, label %123
123: ; preds = %117
%124 = load i32, i32* @LOG_ERR
%125 = call i32 (i32, i8*, ...) @syslog(i32 %124, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.22, i64 0, i64 0), i32 %121)
br label %156
126: ; preds = %117
%127 = load i32, i32* @LOG_NOTICE
%128 = load i8*, i8** %34
%129 = call i32 (i32, i8*, ...) @syslog(i32 %127, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.23, i64 0, i64 0), i8* %128)
br label %156
130: ; preds = %83
%131 = load i32, i32* %4
%132 = call i64 @WIFSIGNALED(i32 %131)
%133 = icmp eq i64 %132, 0
%134 = load i32, i32* %4
br i1 %133, label %141, label %135
135: ; preds = %130
%136 = call i32 @WTERMSIG(i32 %134)
%137 = load i32, i32* @LOG_ERR
%138 = load i32, i32* %4
%139 = call i32 @WEXITSTATUS(i32 %138)
%140 = call i32 (i32, i8*, ...) @syslog(i32 %137, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.24, i64 0, i64 0), i32 %139)
br label %156
141: ; preds = %130
%142 = call i64 @WIFSTOPPED(i32 %134)
%143 = icmp eq i64 %142, 0
br i1 %143, label %151, label %144
144: ; preds = %141
%145 = load i32, i32* %4
%146 = call i32 @WSTOPSIG(i32 %145)
%147 = load i32, i32* @LOG_ERR
%148 = load i32, i32* %4
%149 = call i32 @WEXITSTATUS(i32 %148)
%150 = call i32 (i32, i8*, ...) @syslog(i32 %147, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.25, i64 0, i64 0), i32 %149)
br label %156
151: ; preds = %141
%152 = load i32, i32* @LOG_ERR
%153 = load i32, i32* %4
%154 = call i32 @WEXITSTATUS(i32 %153)
%155 = call i32 (i32, i8*, ...) @syslog(i32 %152, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.26, i64 0, i64 0), i32 %154)
br label %156
156: ; preds = %98, %123, %126, %135, %151, %144
br label %157
157: ; preds = %60, %156, %46, %43
%158 = call i32 @free(i8* %41)
br label %159
159: ; preds = %157, %27
%160 = call %struct.dirent* @readdir(i32* %22)
%161 = icmp eq %struct.dirent* %160, null
br i1 %161, label %162, label %27
162: ; preds = %159, %24
%163 = call i32 @closedir(i32* %22)
%164 = icmp eq i32 %163, -1
br i1 %164, label %165, label %168
165: ; preds = %162
%166 = load i32, i32* @LOG_ERR
%167 = call i32 (i32, i8*, ...) @syslog(i32 %166, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.27, i64 0, i64 0), i8* %8)
br label %168
168: ; preds = %162, %165, %13
%169 = add nuw i64 %14, 1
%170 = icmp eq i64 %169, %11
br i1 %170, label %171, label %13
171: ; preds = %168, %10
%172 = load i32, i32* @LOG_NOTICE
%173 = call i32 (i32, i8*, ...) @syslog(i32 %172, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.28, i64 0, i64 0), i32 1)
%174 = call i32 @sleep(i32 1)
%175 = load i32, i32* @LOG_NOTICE
%176 = call i32 (i32, i8*, ...) @syslog(i32 %175, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.29, i64 0, i64 0))
%177 = call i32 (...) @sync()
%178 = load i32, i32* @LOG_NOTICE
%179 = call i32 (i32, i8*, ...) @syslog(i32 %178, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.30, i64 0, i64 0))
%180 = load i32, i32* @LOG_NOTICE
%181 = call i32 (i32, i8*, ...) @syslog(i32 %180, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.31, i64 0, i64 0))
%182 = call i32 @umount(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.32, i64 0, i64 0))
%183 = icmp eq i32 %182, -1
br i1 %183, label %184, label %188
184: ; preds = %171
%185 = load i32, i32* @LOG_ERR
%186 = load i32, i32* @errno
%187 = call i32 (i32, i8*, ...) @syslog(i32 %185, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.33, i64 0, i64 0), i32 %186)
br label %188
188: ; preds = %184, %171
%189 = load i32, i32* @LOG_NOTICE
%190 = call i32 (i32, i8*, ...) @syslog(i32 %189, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.34, i64 0, i64 0))
%191 = load i32, i32* @MS_RELATIME
%192 = call i32 @mount(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.35, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.36, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.37, i64 0, i64 0), i32 %191, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.38, i64 0, i64 0))
%193 = icmp eq i32 %192, -1
br i1 %193, label %194, label %198
194: ; preds = %188
%195 = load i32, i32* @LOG_ERR
%196 = load i32, i32* @errno
%197 = call i32 (i32, i8*, ...) @syslog(i32 %195, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.39, i64 0, i64 0), i32 %196)
br label %198
198: ; preds = %194, %188
%199 = load i32, i32* @LOG_NOTICE
%200 = call i32 (i32, i8*, ...) @syslog(i32 %199, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.40, i64 0, i64 0))
br label %10
}