#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 option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ *member_2;
  int /*<<< orphan*/ member_1;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ LOG_INFO;
int LOG_LOCAL0;
int LOG_LOCAL1;
int LOG_LOCAL2;
int LOG_LOCAL3;
int LOG_LOCAL4;
int LOG_LOCAL5;
int LOG_LOCAL6;
int LOG_LOCAL7;
int /*<<< orphan*/ LOG_PID;
int atoi(int /*<<< orphan*/);
int daemon(int, int);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char *getenv(char *);
int getopt_long(int, char **, char *, struct option const *,
                int /*<<< orphan*/ *);
int /*<<< orphan*/ no_argument;
int /*<<< orphan*/ openlog(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ required_argument;
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(int /*<<< orphan*/, char *);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *);
int main(int argc, char **argv) {
  int opt;
  int flag = 0;
  int nochdir = 1;
  int noclose = 0;
  int interval = 1;
  int facility = LOG_LOCAL6;
  int i;
  char buf[512];
  char command[512];
  char *envptr;
  FILE *fp;
  struct {
    char name[12];
    int code;
  } facility_list[8] = {{"LOG_LOCAL0", LOG_LOCAL0}, {"LOG_LOCAL1", LOG_LOCAL1},
                        {"LOG_LOCAL2", LOG_LOCAL2}, {"LOG_LOCAL3", LOG_LOCAL3},
                        {"LOG_LOCAL4", LOG_LOCAL4}, {"LOG_LOCAL5", LOG_LOCAL5},
                        {"LOG_LOCAL6", LOG_LOCAL6}, {"LOG_LOCAL7", LOG_LOCAL7}};
  const struct option longopt[] = {{"help", no_argument, NULL, '?'},
                                   {"daemonize", no_argument, NULL, 'd'},
                                   {"kill", no_argument, NULL, 'k'},
                                   {"interval", required_argument, NULL, 'i'},
                                   {NULL, 0, NULL, 0}};
  flag = 1;
  while ((opt = getopt_long(argc, argv, "dki:f:", longopt, NULL)) != -1) {
    switch (opt) {
    case 'i':
      interval = atoi(optarg);
      if (interval <= 0)
        interval = 1;
      break;
    case 'd':
      flag = 1;
      break;
    case 'k':
      flag = 2;
      break;
    case 'f':
      for (i = 0; i < 8; i++) {
        if (strcmp(optarg, facility_list[i].name) == 0) {
          facility = facility_list[i].code;
          goto found;
        }
      }
      fprintf(stderr, "Facility not found\n");
      return -1;
    found:;
      break;
    default:
      break;
    }
  }
  openlog("mcklogd", LOG_PID, facility);
  if (flag == 2) {
    syslog(LOG_ERR, "mcklogd not support -k option.\n");
    return 0;
  }
  if (flag == 1) {
    if (daemon(nochdir, noclose) == -1) {
      syslog(LOG_ERR, "failed to launch mcklogd.\n");
      return -1;
    }
  }
  envptr = getenv("SBINDIR");
  sprintf(command, "%s/ihkosctl 0 kmsg", envptr);
  while (1) {
    fp = popen(command, "r");
    if (fp) {
      while (fgets(buf, 1024, fp)) {
        ;
        if (buf[0] != '\n') {
          syslog(LOG_INFO, buf);
        }
      }
      pclose(fp);
    }
    sleep(interval);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x570,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
mov    0x2dc4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0xdf8(%rip),%rax
mov    %rax,-0x4c0(%rbp)
mov    0xdf3(%rip),%eax
mov    %eax,-0x4b8(%rbp)
mov    0x2d86(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4b4(%rbp)
mov    0xddb(%rip),%rax
mov    %rax,-0x4b0(%rbp)
mov    0xdd6(%rip),%eax
mov    %eax,-0x4a8(%rbp)
mov    0x2d15(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4a4(%rbp)
mov    0xdbe(%rip),%rax
mov    %rax,-0x4a0(%rbp)
mov    0xdb9(%rip),%eax
mov    %eax,-0x498(%rbp)
mov    0x2d44(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x494(%rbp)
mov    0xda1(%rip),%rax
mov    %rax,-0x490(%rbp)
mov    0xd9c(%rip),%eax
mov    %eax,-0x488(%rbp)
mov    0x2cdb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x484(%rbp)
mov    0xd84(%rip),%rax
mov    %rax,-0x480(%rbp)
mov    0xd7f(%rip),%eax
mov    %eax,-0x478(%rbp)
mov    0x2cea(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x474(%rbp)
mov    0xd67(%rip),%rax
mov    %rax,-0x470(%rbp)
mov    0xd62(%rip),%eax
mov    %eax,-0x468(%rbp)
mov    0x2c81(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x464(%rbp)
mov    0xd4a(%rip),%rax
mov    %rax,-0x460(%rbp)
mov    0xd45(%rip),%eax
mov    %eax,-0x458(%rbp)
mov    0x2ca8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x454(%rbp)
mov    0xd2d(%rip),%rax
mov    %rax,-0x450(%rbp)
mov    0xd28(%rip),%eax
mov    %eax,-0x448(%rbp)
mov    0x2c3f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x444(%rbp)
lea    -0x560(%rbp),%rdi
lea    0xd09(%rip),%rax
mov    %rax,-0x560(%rbp)
mov    0x2c03(%rip),%rax
mov    (%rax),%eax
mov    %al,-0x558(%rbp)
movq   $0x0,-0x550(%rbp)
movl   $0x3f,-0x548(%rbp)
add    $0x20,%rdi
lea    0xcd8(%rip),%rax
mov    %rax,-0x540(%rbp)
mov    0x2bcd(%rip),%rax
mov    (%rax),%eax
mov    %al,-0x538(%rbp)
movq   $0x0,-0x530(%rbp)
movl   $0x64,-0x528(%rbp)
add    $0x20,%rdi
lea    0xcac(%rip),%rax
mov    %rax,-0x520(%rbp)
mov    0x2b97(%rip),%rax
mov    (%rax),%eax
mov    %al,-0x518(%rbp)
movq   $0x0,-0x510(%rbp)
movl   $0x6b,-0x508(%rbp)
add    $0x20,%rdi
lea    0xc7b(%rip),%rax
mov    %rax,-0x500(%rbp)
mov    0x2b99(%rip),%rax
mov    (%rax),%eax
mov    %al,-0x4f8(%rbp)
movq   $0x0,-0x4f0(%rbp)
movl   $0x69,-0x4e8(%rbp)
add    $0x20,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1060 <memset@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x560(%rbp),%rcx
lea    0xc2d(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1040 <getopt_long@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     158e <main+0x3ae>
mov    -0x14(%rbp),%eax
add    $0xffffff9c,%eax
mov    %eax,%ecx
mov    %rcx,-0x568(%rbp)
sub    $0x7,%eax
ja     1584 <main+0x3a4>
mov    -0x568(%rbp),%rax
lea    0xb54(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2b3c(%rip),%rax
mov    (%rax),%edi
call   10d0 <atoi@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jg     14d7 <main+0x2f7>
movl   $0x1,-0x24(%rbp)
jmp    1589 <main+0x3a9>
movl   $0x1,-0x18(%rbp)
jmp    1589 <main+0x3a9>
movl   $0x2,-0x18(%rbp)
jmp    1589 <main+0x3a9>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x8,-0x2c(%rbp)
jge    155e <main+0x37e>
mov    0x2aec(%rip),%rax
mov    (%rax),%edi
movslq -0x2c(%rbp),%rax
lea    -0x4c0(%rbp),%rsi
shl    $0x4,%rax
add    %rax,%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    154b <main+0x36b>
movslq -0x2c(%rbp),%rcx
lea    -0x4c0(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0xc(%rax),%eax
mov    %eax,-0x28(%rbp)
jmp    157f <main+0x39f>
jmp    1550 <main+0x370>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    14fb <main+0x31b>
mov    0x2a43(%rip),%rax
mov    (%rax),%edi
lea    0xb36(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    16d4 <main+0x4f4>
jmp    1589 <main+0x3a9>
jmp    1589 <main+0x3a9>
jmp    145b <main+0x27b>
mov    0x2a1b(%rip),%rax
mov    (%rax),%esi
mov    -0x28(%rbp),%edx
lea    0xb17(%rip),%rdi
call   10e0 <openlog@plt>
cmpl   $0x2,-0x18(%rbp)
jne    15d1 <main+0x3f1>
mov    0x29b1(%rip),%rax
mov    (%rax),%edi
lea    0xb00(%rip),%rsi
call   10a0 <syslog@plt>
movl   $0x0,-0x4(%rbp)
jmp    16d4 <main+0x4f4>
cmpl   $0x1,-0x18(%rbp)
jne    1615 <main+0x435>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
call   10b0 <daemon@plt>
cmp    $0xffffffff,%eax
jne    1610 <main+0x430>
mov    0x2972(%rip),%rax
mov    (%rax),%edi
lea    0xae1(%rip),%rsi
call   10a0 <syslog@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    16d4 <main+0x4f4>
jmp    1615 <main+0x435>
lea    0xadf(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x438(%rbp)
lea    -0x430(%rbp),%rdi
mov    -0x438(%rbp),%rdx
lea    0xac6(%rip),%rsi
call   10f0 <sprintf@plt>
lea    -0x430(%rbp),%rdi
lea    0xac6(%rip),%rsi
call   10c0 <popen@plt>
mov    %rax,-0x440(%rbp)
cmpq   $0x0,-0x440(%rbp)
je     16c7 <main+0x4e7>
jmp    166f <main+0x48f>
lea    -0x230(%rbp),%rdi
mov    -0x440(%rbp),%rdx
mov    $0x400,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     16bb <main+0x4db>
movsbl -0x230(%rbp),%eax
cmp    $0xa,%eax
je     16b6 <main+0x4d6>
mov    0x28d0(%rip),%rax
mov    (%rax),%edi
lea    -0x230(%rbp),%rsi
call   10a0 <syslog@plt>
jmp    166f <main+0x48f>
mov    -0x440(%rbp),%rdi
call   1050 <pclose@plt>
mov    -0x24(%rbp),%edi
call   1100 <sleep@plt>
jmp    1642 <main+0x462>
mov    -0x4(%rbp),%eax
add    $0x570,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x538,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
mov    0x2df3(%rip),%rax
mov    (%rax),%edx
movabs $0x41434f4c5f474f4c,%rax
4f 43 41
mov    %rax,0x10(%rsp)
movl   $0x304c,0x18(%rsp)
mov    0x2dbb(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x1c(%rsp)
mov    %rax,0x20(%rsp)
movl   $0x314c,0x28(%rsp)
mov    0x2d59(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x2c(%rsp)
mov    %rax,0x30(%rsp)
movl   $0x324c,0x38(%rsp)
mov    0x2d97(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x3c(%rsp)
mov    %rax,0x40(%rsp)
movl   $0x334c,0x48(%rsp)
mov    0x2d3d(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x4c(%rsp)
mov    %rax,0x50(%rsp)
movl   $0x344c,0x58(%rsp)
mov    0x2d5b(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x5c(%rsp)
mov    %rax,0x60(%rsp)
movl   $0x354c,0x68(%rsp)
mov    0x2d01(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x6c(%rsp)
mov    %rax,0x70(%rsp)
movl   $0x364c,0x78(%rsp)
mov    %edx,0xc(%rsp)
mov    %edx,0x7c(%rsp)
mov    %rax,0x80(%rsp)
movl   $0x374c,0x88(%rsp)
mov    0x2cdc(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8c(%rsp)
lea    0xdac(%rip),%rax
mov    %rax,0x90(%rsp)
mov    0x2ca5(%rip),%rax
mov    (%rax),%al
mov    %al,0x98(%rsp)
movq   $0x0,0xa0(%rsp)
movl   $0x3f,0xa8(%rsp)
lea    0xd7b(%rip),%rcx
mov    %rcx,0xb0(%rsp)
mov    %al,0xb8(%rsp)
movq   $0x0,0xc0(%rsp)
movl   $0x64,0xc8(%rsp)
lea    0xd58(%rip),%rcx
mov    %rcx,0xd0(%rsp)
mov    %al,0xd8(%rsp)
movq   $0x0,0xe0(%rsp)
movl   $0x6b,0xe8(%rsp)
lea    0xd30(%rip),%rax
mov    %rax,0xf0(%rsp)
mov    0x2c4d(%rip),%rax
mov    (%rax),%al
mov    %al,0xf8(%rsp)
movq   $0x0,0x100(%rsp)
movl   $0x69,0x108(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x120(%rsp)
lea    0xcf0(%rip),%r13
lea    0x90(%rsp),%r12
lea    0xc44(%rip),%rbx
mov    $0x1,%r15d
movl   $0x1,0x8(%rsp)
jmp    13d9 <main+0x209>
nopl   0x0(%rax)
cmp    $0xffffffff,%eax
je     1545 <main+0x375>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
xor    %r8d,%r8d
call   1040 <getopt_long@plt>
lea    -0x64(%rax),%ecx
cmp    $0x7,%ecx
ja     13d0 <main+0x200>
movslq (%rbx,%rcx,4),%rax
add    %rbx,%rax
jmp    *%rax
mov    0x2bf4(%rip),%rax
mov    (%rax),%edi
lea    0x10(%rsp),%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     1508 <main+0x338>
mov    0x2bd9(%rip),%rax
mov    (%rax),%edi
lea    0x20(%rsp),%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     150c <main+0x33c>
mov    0x2bbe(%rip),%rax
mov    (%rax),%edi
lea    0x30(%rsp),%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     1513 <main+0x343>
mov    0x2ba3(%rip),%rax
mov    (%rax),%edi
lea    0x40(%rsp),%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     151a <main+0x34a>
mov    0x2b88(%rip),%rax
mov    (%rax),%edi
lea    0x50(%rsp),%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     1521 <main+0x351>
mov    0x2b6d(%rip),%rax
mov    (%rax),%edi
lea    0x60(%rsp),%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     1528 <main+0x358>
mov    0x2b52(%rip),%rax
mov    (%rax),%edi
lea    0x70(%rsp),%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     152f <main+0x35f>
mov    0x2b3b(%rip),%rax
mov    (%rax),%edi
lea    0x80(%rsp),%rsi
call   1070 <strcmp@plt>
mov    $0x7,%ecx
test   %eax,%eax
je     1534 <main+0x364>
jmp    1669 <main+0x499>
mov    0x2b17(%rip),%rax
mov    (%rax),%edi
call   10c0 <atoi@plt>
mov    %eax,%r15d
test   %eax,%eax
mov    $0x1,%eax
cmovle %eax,%r15d
jmp    13d9 <main+0x209>
movl   $0x2,0x8(%rsp)
jmp    13d9 <main+0x209>
xor    %ecx,%ecx
jmp    1534 <main+0x364>
mov    $0x1,%ecx
jmp    1534 <main+0x364>
mov    $0x2,%ecx
jmp    1534 <main+0x364>
mov    $0x3,%ecx
jmp    1534 <main+0x364>
mov    $0x4,%ecx
jmp    1534 <main+0x364>
mov    $0x5,%ecx
jmp    1534 <main+0x364>
mov    $0x6,%ecx
shl    $0x4,%rcx
mov    0x1c(%rsp,%rcx,1),%eax
mov    %eax,0xc(%rsp)
jmp    13d9 <main+0x209>
mov    0x2a64(%rip),%rax
mov    (%rax),%esi
lea    0xb63(%rip),%rdi
mov    0xc(%rsp),%edx
call   10d0 <openlog@plt>
cmpl   $0x2,0x8(%rsp)
jne    1581 <main+0x3b1>
mov    0x29fc(%rip),%rax
mov    (%rax),%edi
lea    0xb4b(%rip),%rsi
call   1090 <syslog@plt>
xor    %eax,%eax
jmp    1657 <main+0x487>
mov    $0x1,%edi
xor    %esi,%esi
call   10a0 <daemon@plt>
cmp    $0xffffffff,%eax
je     163d <main+0x46d>
lea    0xb5e(%rip),%rdi
call   1030 <getenv@plt>
lea    0xb5a(%rip),%rsi
lea    0x330(%rsp),%r14
mov    %r14,%rdi
mov    %rax,%rdx
call   10e0 <sprintf@plt>
lea    0xb53(%rip),%r12
lea    0x130(%rsp),%rbp
mov    0x29a6(%rip),%r13
jmp    15f0 <main+0x420>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1050 <pclose@plt>
mov    %r15d,%edi
call   10f0 <sleep@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   10b0 <popen@plt>
test   %rax,%rax
je     15e8 <main+0x418>
mov    %rax,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbp,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     15e0 <main+0x410>
cmpb   $0xa,0x130(%rsp)
0a
je     1610 <main+0x440>
mov    0x0(%r13),%edi
mov    %rbp,%rsi
call   1090 <syslog@plt>
jmp    1610 <main+0x440>
mov    0x2924(%rip),%rax
mov    (%rax),%edi
lea    0xa93(%rip),%rsi
call   1090 <syslog@plt>
mov    $0xffffffff,%eax
add    $0x538,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2938(%rip),%rax
mov    (%rax),%edi
lea    0xa2b(%rip),%rsi
call   1080 <fprintf@plt>
jmp    1652 <main+0x482>

LLVM IR (-O0):
%struct.anon = type { [12 x i8], i32 }
%struct.option = type { i8*, i8, i32*, i32 }
@LOG_LOCAL6 = global i32 0
@.str = [12 x i8] c"LOG_LOCAL0\00\00"
@LOG_LOCAL0 = global i32 0
@.str.1 = [12 x i8] c"LOG_LOCAL1\00\00"
@LOG_LOCAL1 = global i32 0
@.str.2 = [12 x i8] c"LOG_LOCAL2\00\00"
@LOG_LOCAL2 = global i32 0
@.str.3 = [12 x i8] c"LOG_LOCAL3\00\00"
@LOG_LOCAL3 = global i32 0
@.str.4 = [12 x i8] c"LOG_LOCAL4\00\00"
@LOG_LOCAL4 = global i32 0
@.str.5 = [12 x i8] c"LOG_LOCAL5\00\00"
@LOG_LOCAL5 = global i32 0
@.str.6 = [12 x i8] c"LOG_LOCAL6\00\00"
@.str.7 = [12 x i8] c"LOG_LOCAL7\00\00"
@LOG_LOCAL7 = global i32 0
@.str.8 = [5 x i8] c"help\00"
@no_argument = global i32 0
@.str.9 = [10 x i8] c"daemonize\00"
@.str.10 = [5 x i8] c"kill\00"
@.str.11 = [9 x i8] c"interval\00"
@required_argument = global i32 0
@.str.12 = [7 x i8] c"dki:f:\00"
@optarg = global i32 0
@stderr = global i32 0
@.str.13 = [20 x i8] c"Facility not found\0A\00"
@.str.14 = [8 x i8] c"mcklogd\00"
@LOG_PID = global i32 0
@LOG_ERR = global i32 0
@.str.15 = [32 x i8] c"mcklogd not support -k option.\0A\00"
@.str.16 = [27 x i8] c"failed to launch mcklogd.\0A\00"
@.str.17 = [8 x i8] c"SBINDIR\00"
@.str.18 = [19 x i8] c"%s/ihkosctl 0 kmsg\00"
@.str.19 = [2 x i8] c"r\00"
@LOG_INFO = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [512 x i8]
%14 = alloca [512 x i8]
%15 = alloca i8*
%16 = alloca i32*
%17 = alloca [8 x %struct.anon]
%18 = alloca [5 x %struct.option]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 1, i32* %8
store i32 0, i32* %9
store i32 1, i32* %10
%19 = load i32, i32* @LOG_LOCAL6
store i32 %19, i32* %11
%20 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %17, i64 0, i64 0
%21 = getelementptr inbounds %struct.anon, %struct.anon* %20, i32 0, i32 0
%22 = bitcast [12 x i8]* %21 to i8*
%23 = getelementptr inbounds %struct.anon, %struct.anon* %20, i32 0, i32 1
%24 = load i32, i32* @LOG_LOCAL0
store i32 %24, i32* %23
%25 = getelementptr inbounds %struct.anon, %struct.anon* %20, i64 1
%26 = getelementptr inbounds %struct.anon, %struct.anon* %25, i32 0, i32 0
%27 = bitcast [12 x i8]* %26 to i8*
%28 = getelementptr inbounds %struct.anon, %struct.anon* %25, i32 0, i32 1
%29 = load i32, i32* @LOG_LOCAL1
store i32 %29, i32* %28
%30 = getelementptr inbounds %struct.anon, %struct.anon* %25, i64 1
%31 = getelementptr inbounds %struct.anon, %struct.anon* %30, i32 0, i32 0
%32 = bitcast [12 x i8]* %31 to i8*
%33 = getelementptr inbounds %struct.anon, %struct.anon* %30, i32 0, i32 1
%34 = load i32, i32* @LOG_LOCAL2
store i32 %34, i32* %33
%35 = getelementptr inbounds %struct.anon, %struct.anon* %30, i64 1
%36 = getelementptr inbounds %struct.anon, %struct.anon* %35, i32 0, i32 0
%37 = bitcast [12 x i8]* %36 to i8*
%38 = getelementptr inbounds %struct.anon, %struct.anon* %35, i32 0, i32 1
%39 = load i32, i32* @LOG_LOCAL3
store i32 %39, i32* %38
%40 = getelementptr inbounds %struct.anon, %struct.anon* %35, i64 1
%41 = getelementptr inbounds %struct.anon, %struct.anon* %40, i32 0, i32 0
%42 = bitcast [12 x i8]* %41 to i8*
%43 = getelementptr inbounds %struct.anon, %struct.anon* %40, i32 0, i32 1
%44 = load i32, i32* @LOG_LOCAL4
store i32 %44, i32* %43
%45 = getelementptr inbounds %struct.anon, %struct.anon* %40, i64 1
%46 = getelementptr inbounds %struct.anon, %struct.anon* %45, i32 0, i32 0
%47 = bitcast [12 x i8]* %46 to i8*
%48 = getelementptr inbounds %struct.anon, %struct.anon* %45, i32 0, i32 1
%49 = load i32, i32* @LOG_LOCAL5
store i32 %49, i32* %48
%50 = getelementptr inbounds %struct.anon, %struct.anon* %45, i64 1
%51 = getelementptr inbounds %struct.anon, %struct.anon* %50, i32 0, i32 0
%52 = bitcast [12 x i8]* %51 to i8*
%53 = getelementptr inbounds %struct.anon, %struct.anon* %50, i32 0, i32 1
%54 = load i32, i32* @LOG_LOCAL6
store i32 %54, i32* %53
%55 = getelementptr inbounds %struct.anon, %struct.anon* %50, i64 1
%56 = getelementptr inbounds %struct.anon, %struct.anon* %55, i32 0, i32 0
%57 = bitcast [12 x i8]* %56 to i8*
%58 = getelementptr inbounds %struct.anon, %struct.anon* %55, i32 0, i32 1
%59 = load i32, i32* @LOG_LOCAL7
store i32 %59, i32* %58
%60 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %18, i64 0, i64 0
%61 = getelementptr inbounds %struct.option, %struct.option* %60, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8** %61
%62 = getelementptr inbounds %struct.option, %struct.option* %60, i32 0, i32 1
%63 = load i32, i32* @no_argument
%64 = trunc i32 %63 to i8
store i8 %64, i8* %62
%65 = getelementptr inbounds %struct.option, %struct.option* %60, i32 0, i32 2
store i32* null, i32** %65
%66 = getelementptr inbounds %struct.option, %struct.option* %60, i32 0, i32 3
store i32 63, i32* %66
%67 = getelementptr inbounds %struct.option, %struct.option* %60, i64 1
%68 = getelementptr inbounds %struct.option, %struct.option* %67, i32 0, i32 0
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8** %68
%69 = getelementptr inbounds %struct.option, %struct.option* %67, i32 0, i32 1
%70 = load i32, i32* @no_argument
%71 = trunc i32 %70 to i8
store i8 %71, i8* %69
%72 = getelementptr inbounds %struct.option, %struct.option* %67, i32 0, i32 2
store i32* null, i32** %72
%73 = getelementptr inbounds %struct.option, %struct.option* %67, i32 0, i32 3
store i32 100, i32* %73
%74 = getelementptr inbounds %struct.option, %struct.option* %67, i64 1
%75 = getelementptr inbounds %struct.option, %struct.option* %74, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i8** %75
%76 = getelementptr inbounds %struct.option, %struct.option* %74, i32 0, i32 1
%77 = load i32, i32* @no_argument
%78 = trunc i32 %77 to i8
store i8 %78, i8* %76
%79 = getelementptr inbounds %struct.option, %struct.option* %74, i32 0, i32 2
store i32* null, i32** %79
%80 = getelementptr inbounds %struct.option, %struct.option* %74, i32 0, i32 3
store i32 107, i32* %80
%81 = getelementptr inbounds %struct.option, %struct.option* %74, i64 1
%82 = getelementptr inbounds %struct.option, %struct.option* %81, i32 0, i32 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i8** %82
%83 = getelementptr inbounds %struct.option, %struct.option* %81, i32 0, i32 1
%84 = load i32, i32* @required_argument
%85 = trunc i32 %84 to i8
store i8 %85, i8* %83
%86 = getelementptr inbounds %struct.option, %struct.option* %81, i32 0, i32 2
store i32* null, i32** %86
%87 = getelementptr inbounds %struct.option, %struct.option* %81, i32 0, i32 3
store i32 105, i32* %87
%88 = getelementptr inbounds %struct.option, %struct.option* %81, i64 1
%89 = bitcast %struct.option* %88 to i8*
store i32 1, i32* %7
br label %90
90: ; preds = %135, %2
%91 = load i32, i32* %4
%92 = load i8**, i8*** %5
%93 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %18, i64 0, i64 0
%94 = call i32 @getopt_long(i32 %91, i8** %92, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), %struct.option* %93, i32* null)
store i32 %94, i32* %6
%95 = icmp ne i32 %94, -1
br i1 %95, label %96, label %136
96: ; preds = %90
%97 = load i32, i32* %6
switch i32 %97, label %134 [
i32 105, label %98
i32 100, label %105
i32 107, label %106
i32 102, label %107
]
98: ; preds = %96
%99 = load i32, i32* @optarg
%100 = call i32 @atoi(i32 %99)
store i32 %100, i32* %10
%101 = load i32, i32* %10
%102 = icmp sle i32 %101, 0
br i1 %102, label %103, label %104
103: ; preds = %98
store i32 1, i32* %10
br label %104
104: ; preds = %103, %98
br label %135
105: ; preds = %96
store i32 1, i32* %7
br label %135
106: ; preds = %96
store i32 2, i32* %7
br label %135
107: ; preds = %96
store i32 0, i32* %12
br label %108
108: ; preds = %127, %107
%109 = load i32, i32* %12
%110 = icmp slt i32 %109, 8
br i1 %110, label %111, label %130
111: ; preds = %108
%112 = load i32, i32* @optarg
%113 = load i32, i32* %12
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %17, i64 0, i64 %114
%116 = getelementptr inbounds %struct.anon, %struct.anon* %115, i32 0, i32 0
%117 = getelementptr inbounds [12 x i8], [12 x i8]* %116, i64 0, i64 0
%118 = call i32 @strcmp(i32 %112, i8* %117)
%119 = icmp eq i32 %118, 0
br i1 %119, label %120, label %126
120: ; preds = %111
%121 = load i32, i32* %12
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %17, i64 0, i64 %122
%124 = getelementptr inbounds %struct.anon, %struct.anon* %123, i32 0, i32 1
%125 = load i32, i32* %124
store i32 %125, i32* %11
br label %133
126: ; preds = %111
br label %127
127: ; preds = %126
%128 = load i32, i32* %12
%129 = add nsw i32 %128, 1
store i32 %129, i32* %12
br label %108
130: ; preds = %108
%131 = load i32, i32* @stderr
%132 = call i32 @fprintf(i32 %131, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0))
store i32 -1, i32* %3
br label %189
133: ; preds = %120
br label %135
134: ; preds = %96
br label %135
135: ; preds = %134, %133, %106, %105, %104
br label %90
136: ; preds = %90
%137 = load i32, i32* @LOG_PID
%138 = load i32, i32* %11
%139 = call i32 @openlog(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i32 %137, i32 %138)
%140 = load i32, i32* %7
%141 = icmp eq i32 %140, 2
br i1 %141, label %142, label %145
142: ; preds = %136
%143 = load i32, i32* @LOG_ERR
%144 = call i32 @syslog(i32 %143, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.15, i64 0, i64 0))
store i32 0, i32* %3
br label %189
145: ; preds = %136
%146 = load i32, i32* %7
%147 = icmp eq i32 %146, 1
br i1 %147, label %148, label %157
148: ; preds = %145
%149 = load i32, i32* %8
%150 = load i32, i32* %9
%151 = call i32 @daemon(i32 %149, i32 %150)
%152 = icmp eq i32 %151, -1
br i1 %152, label %153, label %156
153: ; preds = %148
%154 = load i32, i32* @LOG_ERR
%155 = call i32 @syslog(i32 %154, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.16, i64 0, i64 0))
store i32 -1, i32* %3
br label %189
156: ; preds = %148
br label %157
157: ; preds = %156, %145
%158 = call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0))
store i8* %158, i8** %15
%159 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 0
%160 = load i8*, i8** %15
%161 = call i32 @sprintf(i8* %159, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0), i8* %160)
br label %162
162: ; preds = %157, %186
%163 = getelementptr inbounds [512 x i8], [512 x i8]* %14, i64 0, i64 0
%164 = call i32* @popen(i8* %163, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.19, i64 0, i64 0))
store i32* %164, i32** %16
%165 = load i32*, i32** %16
%166 = icmp ne i32* %165, null
br i1 %166, label %167, label %186
167: ; preds = %162
br label %168
168: ; preds = %182, %167
%169 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%170 = load i32*, i32** %16
%171 = call i64 @fgets(i8* %169, i32 1024, i32* %170)
%172 = icmp ne i64 %171, 0
br i1 %172, label %173, label %183
173: ; preds = %168
%174 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%175 = load i8, i8* %174
%176 = sext i8 %175 to i32
%177 = icmp ne i32 %176, 10
br i1 %177, label %178, label %182
178: ; preds = %173
%179 = load i32, i32* @LOG_INFO
%180 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%181 = call i32 @syslog(i32 %179, i8* %180)
br label %182
182: ; preds = %178, %173
br label %168
183: ; preds = %168
%184 = load i32*, i32** %16
%185 = call i32 @pclose(i32* %184)
br label %186
186: ; preds = %183, %162
%187 = load i32, i32* %10
%188 = call i32 @sleep(i32 %187)
br label %162
189: ; preds = %153, %142, %130
%190 = load i32, i32* %3
ret i32 %190
}

LLVM IR (-O2):
%struct.anon = type { [12 x i8], i32 }
%struct.option = type { i8*, i8, i32*, i32 }
@LOG_LOCAL6 = global i32 0
@.str = [12 x i8] c"LOG_LOCAL0\00\00"
@LOG_LOCAL0 = global i32 0
@.str.1 = [12 x i8] c"LOG_LOCAL1\00\00"
@LOG_LOCAL1 = global i32 0
@.str.2 = [12 x i8] c"LOG_LOCAL2\00\00"
@LOG_LOCAL2 = global i32 0
@.str.3 = [12 x i8] c"LOG_LOCAL3\00\00"
@LOG_LOCAL3 = global i32 0
@.str.4 = [12 x i8] c"LOG_LOCAL4\00\00"
@LOG_LOCAL4 = global i32 0
@.str.5 = [12 x i8] c"LOG_LOCAL5\00\00"
@LOG_LOCAL5 = global i32 0
@.str.6 = [12 x i8] c"LOG_LOCAL6\00\00"
@.str.7 = [12 x i8] c"LOG_LOCAL7\00\00"
@LOG_LOCAL7 = global i32 0
@.str.8 = [5 x i8] c"help\00"
@no_argument = global i32 0
@.str.9 = [10 x i8] c"daemonize\00"
@.str.10 = [5 x i8] c"kill\00"
@.str.11 = [9 x i8] c"interval\00"
@required_argument = global i32 0
@.str.12 = [7 x i8] c"dki:f:\00"
@optarg = global i32 0
@stderr = global i32 0
@.str.13 = [20 x i8] c"Facility not found\0A\00"
@.str.14 = [8 x i8] c"mcklogd\00"
@LOG_PID = global i32 0
@LOG_ERR = global i32 0
@.str.15 = [32 x i8] c"mcklogd not support -k option.\0A\00"
@.str.16 = [27 x i8] c"failed to launch mcklogd.\0A\00"
@.str.17 = [8 x i8] c"SBINDIR\00"
@.str.18 = [19 x i8] c"%s/ihkosctl 0 kmsg\00"
@.str.19 = [2 x i8] c"r\00"
@LOG_INFO = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [512 x i8]
%4 = alloca [512 x i8]
%5 = alloca [8 x %struct.anon]
%6 = alloca [5 x %struct.option]
%7 = load i32, i32* @LOG_LOCAL6
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %5, i64 0, i64 0, i32 0, i64 0
%11 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %5, i64 0, i64 0, i32 1
%12 = load i32, i32* @LOG_LOCAL0
store i32 %12, i32* %11
%13 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %5, i64 0, i64 1, i32 0, i64 0
%14 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %5, i64 0, i64 1, i32 1
%15 = load i32, i32* @LOG_LOCAL1
store i32 %15, i32* %14
%16 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %5, i64 0, i64 2, i32 0, i64 0
%17 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %5, i64 0, i64 2, i32 1
%18 = load i32, i32* @LOG_LOCAL2
store i32 %18, i32* %17
%19 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %5, i64 0, i64 3, i32 0, i64 0
%20 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %5, i64 0, i64 3, i32 1
%21 = load i32, i32* @LOG_LOCAL3
store i32 %21, i32* %20
%22 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %5, i64 0, i64 4, i32 0, i64 0
%23 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %5, i64 0, i64 4, i32 1
%24 = load i32, i32* @LOG_LOCAL4
store i32 %24, i32* %23
%25 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %5, i64 0, i64 5, i32 0, i64 0
%26 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %5, i64 0, i64 5, i32 1
%27 = load i32, i32* @LOG_LOCAL5
store i32 %27, i32* %26
%28 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %5, i64 0, i64 6, i32 0, i64 0
%29 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %5, i64 0, i64 6, i32 1
store i32 %7, i32* %29
%30 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %5, i64 0, i64 7, i32 0, i64 0
%31 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %5, i64 0, i64 7, i32 1
%32 = load i32, i32* @LOG_LOCAL7
store i32 %32, i32* %31
%33 = bitcast [5 x %struct.option]* %6 to i8*
%34 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %6, i64 0, i64 0
%35 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %6, i64 0, i64 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8** %35
%36 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %6, i64 0, i64 0, i32 1
%37 = load i32, i32* @no_argument
%38 = trunc i32 %37 to i8
store i8 %38, i8* %36
%39 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %6, i64 0, i64 0, i32 2
store i32* null, i32** %39
%40 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %6, i64 0, i64 0, i32 3
store i32 63, i32* %40
%41 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %6, i64 0, i64 1, i32 0
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8** %41
%42 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %6, i64 0, i64 1, i32 1
store i8 %38, i8* %42
%43 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %6, i64 0, i64 1, i32 2
store i32* null, i32** %43
%44 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %6, i64 0, i64 1, i32 3
store i32 100, i32* %44
%45 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %6, i64 0, i64 2, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i8** %45
%46 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %6, i64 0, i64 2, i32 1
store i8 %38, i8* %46
%47 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %6, i64 0, i64 2, i32 2
store i32* null, i32** %47
%48 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %6, i64 0, i64 2, i32 3
store i32 107, i32* %48
%49 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %6, i64 0, i64 3, i32 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i8** %49
%50 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %6, i64 0, i64 3, i32 1
%51 = load i32, i32* @required_argument
%52 = trunc i32 %51 to i8
store i8 %52, i8* %50
%53 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %6, i64 0, i64 3, i32 2
store i32* null, i32** %53
%54 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %6, i64 0, i64 3, i32 3
store i32 105, i32* %54
%55 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %6, i64 0, i64 4
%56 = bitcast %struct.option* %55 to i8*
br label %57
57: ; preds = %72, %2
%58 = phi i32 [ %76, %72 ], [ 1, %2 ]
%59 = phi i32 [ %62, %72 ], [ %7, %2 ]
%60 = phi i32 [ %65, %72 ], [ 1, %2 ]
br label %61
61: ; preds = %57, %80
%62 = phi i32 [ %59, %57 ], [ %83, %80 ]
%63 = phi i32 [ %60, %57 ], [ %65, %80 ]
br label %64
64: ; preds = %78, %61
%65 = phi i32 [ %63, %61 ], [ %79, %78 ]
br label %66
66: ; preds = %64, %66
%67 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), %struct.option* %34, i32* null)
switch i32 %67, label %66 [
i32 -1, label %115
i32 105, label %72
i32 100, label %78
i32 107, label %77
i32 102, label %68
]
68: ; preds = %66
%69 = load i32, i32* @optarg
%70 = call i32 @strcmp(i32 %69, i8* %10)
%71 = icmp eq i32 %70, 0
br i1 %71, label %80, label %84
72: ; preds = %66
%73 = load i32, i32* @optarg
%74 = call i32 @atoi(i32 %73)
%75 = icmp sgt i32 %74, 1
%76 = select i1 %75, i32 %74, i32 1
br label %57
77: ; preds = %66
br label %78
78: ; preds = %66, %77
%79 = phi i32 [ 2, %77 ], [ 1, %66 ]
br label %64
80: ; preds = %108, %104, %100, %96, %92, %88, %84, %68
%81 = phi i64 [ 0, %68 ], [ 1, %84 ], [ 2, %88 ], [ 3, %92 ], [ 4, %96 ], [ 5, %100 ], [ 6, %104 ], [ 7, %108 ]
%82 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* %5, i64 0, i64 %81, i32 1
%83 = load i32, i32* %82
br label %61
84: ; preds = %68
%85 = load i32, i32* @optarg
%86 = call i32 @strcmp(i32 %85, i8* %13)
%87 = icmp eq i32 %86, 0
br i1 %87, label %80, label %88
88: ; preds = %84
%89 = load i32, i32* @optarg
%90 = call i32 @strcmp(i32 %89, i8* %16)
%91 = icmp eq i32 %90, 0
br i1 %91, label %80, label %92
92: ; preds = %88
%93 = load i32, i32* @optarg
%94 = call i32 @strcmp(i32 %93, i8* %19)
%95 = icmp eq i32 %94, 0
br i1 %95, label %80, label %96
96: ; preds = %92
%97 = load i32, i32* @optarg
%98 = call i32 @strcmp(i32 %97, i8* %22)
%99 = icmp eq i32 %98, 0
br i1 %99, label %80, label %100
100: ; preds = %96
%101 = load i32, i32* @optarg
%102 = call i32 @strcmp(i32 %101, i8* %25)
%103 = icmp eq i32 %102, 0
br i1 %103, label %80, label %104
104: ; preds = %100
%105 = load i32, i32* @optarg
%106 = call i32 @strcmp(i32 %105, i8* %28)
%107 = icmp eq i32 %106, 0
br i1 %107, label %80, label %108
108: ; preds = %104
%109 = load i32, i32* @optarg
%110 = call i32 @strcmp(i32 %109, i8* %30)
%111 = icmp eq i32 %110, 0
br i1 %111, label %80, label %112
112: ; preds = %108
%113 = load i32, i32* @stderr
%114 = call i32 @fprintf(i32 %113, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0))
br label %150
115: ; preds = %66
%116 = load i32, i32* @LOG_PID
%117 = call i32 @openlog(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i32 %116, i32 %62)
%118 = icmp eq i32 %65, 2
br i1 %118, label %119, label %122
119: ; preds = %115
%120 = load i32, i32* @LOG_ERR
%121 = call i32 @syslog(i32 %120, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.15, i64 0, i64 0))
br label %150
122: ; preds = %115
%123 = call i32 @daemon(i32 1, i32 0)
%124 = icmp eq i32 %123, -1
br i1 %124, label %125, label %128
125: ; preds = %122
%126 = load i32, i32* @LOG_ERR
%127 = call i32 @syslog(i32 %126, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.16, i64 0, i64 0))
br label %150
128: ; preds = %122
%129 = call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0))
%130 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0), i8* %129)
br label %131
131: ; preds = %148, %128
%132 = call i32* @popen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.19, i64 0, i64 0))
%133 = icmp eq i32* %132, null
br i1 %133, label %148, label %134
134: ; preds = %131
%135 = call i64 @fgets(i8* %8, i32 1024, i32* %132)
%136 = icmp eq i64 %135, 0
br i1 %136, label %146, label %137
137: ; preds = %134, %143
%138 = load i8, i8* %8
%139 = icmp eq i8 %138, 10
br i1 %139, label %143, label %140
140: ; preds = %137
%141 = load i32, i32* @LOG_INFO
%142 = call i32 @syslog(i32 %141, i8* %8)
br label %143
143: ; preds = %140, %137
%144 = call i64 @fgets(i8* %8, i32 1024, i32* %132)
%145 = icmp eq i64 %144, 0
br i1 %145, label %146, label %137
146: ; preds = %143, %134
%147 = call i32 @pclose(i32* %132)
br label %148
148: ; preds = %146, %131
%149 = call i32 @sleep(i32 %58)
br label %131
150: ; preds = %125, %119, %112
%151 = phi i32 [ -1, %112 ], [ 0, %119 ], [ -1, %125 ]
ret i32 %151
}