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

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ infob;
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ LOG_INFO;
int /*<<< orphan*/ LOG_LOCAL5;
int /*<<< orphan*/ LOG_NOTICE;
int /*<<< orphan*/ LOG_PID;
int close_and_clear(int *);
int /*<<< orphan*/ closelog();
int /*<<< orphan*/ daemonize(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ openlog(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ snprintf(char *, int, char *, int, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int strtol(char *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *);
int main(int argc, char *argv[]) {
  FILE *fd;
  char buf[20] = {0};
  int clear_rez[32];
  int miss_count = 0;
  int clearing_done = 0;
  int i;
  int err;
  if (argc == 1) {
  } else if ((argc == 2) && (!strcmp(argv[1], "--clear-and-exit"))) {
    return close_and_clear(clear_rez);
  } else {
    fprintf(stderr, "%s: just one option available - \"--clear-and-exit\"\n",
            argv[0]);
    return -1;
  }
  openlog("svc", LOG_PID, LOG_LOCAL5);
  syslog(LOG_INFO, "starting");
  daemonize(0);
  syslog(LOG_INFO, "waiting for svd..");
  sleep(10);
  syslog(LOG_INFO, "START polling SVD process");
  while (1) {
    fd = popen("ps ax | grep svd | wc -l", "r");
    fread(buf, sizeof(buf), 1, fd);
    pclose(fd);
    if (strtol(buf, NULL, 10) <= 3) {
      if (!clearing_done) {
        if ((++miss_count) == 3) {
          syslog(LOG_NOTICE, "close_and_clear ACTIVATED");
          err = close_and_clear(clear_rez);
          if (err) {
            syslog(LOG_NOTICE, "close_and_clear ERROR");
          } else {
            clearing_done = 1;
            for (i = 0; i < 32; i++) {
              if (clear_rez[i]) {
                char infob[50];
                snprintf(infob, sizeof(infob), ">> %d cleared in [%d]\n",
                         clear_rez[i], i);
                syslog(LOG_NOTICE, infob);
              }
            }
          }
          miss_count = 0;
        }
      }
    } else {
      clearing_done = 0;
      miss_count = 0;
    }
    sleep(3);
  }
  syslog(LOG_NOTICE, "terminated");
  closelog();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1070 <memset@plt>
movl   $0x0,-0xb4(%rbp)
movl   $0x0,-0xb8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    121c <main+0x4c>
jmp    127f <main+0xaf>
cmpl   $0x2,-0x8(%rbp)
jne    1257 <main+0x87>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdcb(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1257 <main+0x87>
lea    -0xb0(%rbp),%rdi
call   10e0 <close_and_clear@plt>
mov    %eax,-0x4(%rbp)
jmp    147f <main+0x2af>
mov    0x2d7a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xda3(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    147f <main+0x2af>
mov    0x2d5a(%rip),%rax
mov    (%rax),%esi
mov    0x2d41(%rip),%rax
mov    (%rax),%edx
lea    0xdad(%rip),%rdi
call   10d0 <openlog@plt>
mov    0x2d1c(%rip),%rax
mov    (%rax),%edi
lea    0xd9c(%rip),%rsi
call   10b0 <syslog@plt>
xor    %edi,%edi
call   1040 <daemonize@plt>
mov    0x2d00(%rip),%rax
mov    (%rax),%edi
lea    0xd89(%rip),%rsi
call   10b0 <syslog@plt>
mov    $0xa,%edi
call   10f0 <sleep@plt>
mov    0x2ce1(%rip),%rax
mov    (%rax),%edi
lea    0xd7c(%rip),%rsi
call   10b0 <syslog@plt>
lea    0xd8a(%rip),%rdi
lea    0xd9c(%rip),%rsi
call   10c0 <popen@plt>
mov    %rax,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x14,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
mov    -0x18(%rbp),%rdi
call   1050 <pclose@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10a0 <strtol@plt>
cmp    $0x3,%eax
jg     145c <main+0x28c>
cmpl   $0x0,-0xb8(%rbp)
jne    1457 <main+0x287>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
cmp    $0x3,%eax
jne    1452 <main+0x282>
mov    0x2c5d(%rip),%rax
mov    (%rax),%edi
lea    0xd25(%rip),%rsi
call   10b0 <syslog@plt>
lea    -0xb0(%rbp),%rdi
call   10e0 <close_and_clear@plt>
mov    %eax,-0xc0(%rbp)
cmpl   $0x0,-0xc0(%rbp)
je     13b2 <main+0x1e2>
mov    0x2c29(%rip),%rax
mov    (%rax),%edi
lea    0xd0b(%rip),%rsi
call   10b0 <syslog@plt>
jmp    1448 <main+0x278>
movl   $0x1,-0xb8(%rbp)
movl   $0x0,-0xbc(%rbp)
cmpl   $0x20,-0xbc(%rbp)
jge    1443 <main+0x273>
movslq -0xbc(%rbp),%rax
cmpl   $0x0,-0xb0(%rbp,%rax,4)
je     142a <main+0x25a>
lea    -0x100(%rbp),%rdi
movslq -0xbc(%rbp),%rax
mov    -0xb0(%rbp,%rax,4),%ecx
mov    -0xbc(%rbp),%r8d
mov    $0x32,%esi
lea    0xcb9(%rip),%rdx
call   1060 <snprintf@plt>
mov    0x2bac(%rip),%rax
mov    (%rax),%edi
lea    -0x100(%rbp),%rsi
call   10b0 <syslog@plt>
jmp    142f <main+0x25f>
mov    -0xbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
jmp    13c6 <main+0x1f6>
jmp    1448 <main+0x278>
movl   $0x0,-0xb4(%rbp)
jmp    1457 <main+0x287>
jmp    1470 <main+0x2a0>
movl   $0x0,-0xb8(%rbp)
movl   $0x0,-0xb4(%rbp)
mov    $0x3,%edi
call   10f0 <sleep@plt>
jmp    12ed <main+0x11d>
mov    -0x4(%rbp),%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
cmp    $0x1,%edi
je     1227 <main+0x67>
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    1205 <main+0x45>
mov    0x8(%rbx),%rdi
lea    0xe08(%rip),%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     13a9 <main+0x1e9>
mov    0x2dcc(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xdf9(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    13b3 <main+0x1f3>
mov    0x2db2(%rip),%rax
mov    (%rax),%esi
mov    0x2d99(%rip),%rax
mov    (%rax),%edx
lea    0xe05(%rip),%rdi
call   10c0 <openlog@plt>
mov    0x2d74(%rip),%rbx
mov    (%rbx),%edi
lea    0xdf4(%rip),%rsi
call   10a0 <syslog@plt>
xor    %r13d,%r13d
xor    %edi,%edi
call   1040 <daemonize@plt>
mov    (%rbx),%edi
lea    0xde5(%rip),%rsi
call   10a0 <syslog@plt>
mov    $0xa,%edi
call   10e0 <sleep@plt>
mov    (%rbx),%edi
lea    0xddf(%rip),%rsi
call   10a0 <syslog@plt>
mov    %rsp,%r14
lea    0xa0(%rsp),%r12
xor    %r15d,%r15d
jmp    12b8 <main+0xf8>
nopw   0x0(%rax,%rax,1)
mov    %r13d,%ebp
mov    $0x1,%ebx
mov    $0x3,%edi
call   10e0 <sleep@plt>
mov    %ebp,%r13d
mov    %ebx,%r15d
lea    0xdbf(%rip),%rdi
lea    0xdd1(%rip),%rsi
call   10b0 <popen@plt>
mov    %rax,%rbp
mov    %r14,%rdi
mov    $0x14,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1030 <fread@plt>
mov    %rbp,%rdi
call   1050 <pclose@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1090 <strtol@plt>
mov    $0x0,%ebp
mov    $0x0,%ebx
cmp    $0x3,%eax
jg     12a8 <main+0xe8>
test   %r15d,%r15d
jne    12a0 <main+0xe0>
add    $0x1,%r13d
mov    %r13d,%ebp
mov    $0x0,%ebx
cmp    $0x3,%r13d
jne    12a8 <main+0xe8>
mov    0x2ca1(%rip),%rbx
mov    (%rbx),%edi
lea    0xd69(%rip),%rsi
call   10a0 <syslog@plt>
lea    0x20(%rsp),%rdi
call   10d0 <close_and_clear@plt>
test   %eax,%eax
je     135a <main+0x19a>
mov    (%rbx),%edi
lea    0xd67(%rip),%rsi
call   10a0 <syslog@plt>
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    12a8 <main+0xe8>
xor    %r13d,%r13d
lea    0xd65(%rip),%rbp
jmp    137a <main+0x1ba>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r13
cmp    $0x20,%r13
je     13a2 <main+0x1e2>
mov    0x20(%rsp,%r13,4),%ecx
test   %ecx,%ecx
je     1370 <main+0x1b0>
mov    %r12,%rdi
mov    $0x32,%esi
mov    %rbp,%rdx
mov    %r13d,%r8d
call   1060 <snprintf@plt>
mov    (%rbx),%edi
mov    %r12,%rsi
call   10a0 <syslog@plt>
jmp    1370 <main+0x1b0>
xor    %ebp,%ebp
jmp    12a3 <main+0xe3>
lea    0x20(%rsp),%rdi
call   10d0 <close_and_clear@plt>
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"--clear-and-exit\00"
@stderr = global i32 0
@.str.1 = [52 x i8] c"%s: just one option available - \22--clear-and-exit\22\0A\00"
@.str.2 = [4 x i8] c"svc\00"
@LOG_PID = global i32 0
@LOG_LOCAL5 = global i32 0
@LOG_INFO = global i32 0
@.str.3 = [9 x i8] c"starting\00"
@.str.4 = [18 x i8] c"waiting for svd..\00"
@.str.5 = [26 x i8] c"START polling SVD process\00"
@.str.6 = [25 x i8] c"ps ax | grep svd | wc -l\00"
@.str.7 = [2 x i8] c"r\00"
@LOG_NOTICE = global i32 0
@.str.8 = [26 x i8] c"close_and_clear ACTIVATED\00"
@.str.9 = [22 x i8] c"close_and_clear ERROR\00"
@.str.10 = [23 x i8] c">> %d cleared in [%d]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [20 x i8]
%8 = alloca [32 x i32]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [50 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = bitcast [20 x i8]* %7 to i8*
store i32 0, i32* %9
store i32 0, i32* %10
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %18
17: ; preds = %2
br label %36
18: ; preds = %2
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 2
br i1 %20, label %21, label %30
21: ; preds = %18
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @strcmp(i8* %24, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%26 = icmp ne i32 %25, 0
br i1 %26, label %30, label %27
27: ; preds = %21
%28 = getelementptr inbounds [32 x i32], [32 x i32]* %8, i64 0, i64 0
%29 = call i32 @close_and_clear(i32* %28)
store i32 %29, i32* %3
br label %107
30: ; preds = %21, %18
%31 = load i32, i32* @stderr
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i8* %34)
store i32 -1, i32* %3
br label %107
36: ; preds = %17
%37 = load i32, i32* @LOG_PID
%38 = load i32, i32* @LOG_LOCAL5
%39 = call i32 @openlog(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %37, i32 %38)
%40 = load i32, i32* @LOG_INFO
%41 = call i32 @syslog(i32 %40, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%42 = call i32 @daemonize(i32 0)
%43 = load i32, i32* @LOG_INFO
%44 = call i32 @syslog(i32 %43, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%45 = call i32 @sleep(i32 10)
%46 = load i32, i32* @LOG_INFO
%47 = call i32 @syslog(i32 %46, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
br label %48
48: ; preds = %36, %105
%49 = call i32* @popen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %49, i32** %6
%50 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%51 = load i32*, i32** %6
%52 = call i32 @fread(i8* %50, i32 20, i32 1, i32* %51)
%53 = load i32*, i32** %6
%54 = call i32 @pclose(i32* %53)
%55 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%56 = call i32 @strtol(i8* %55, i32* null, i32 10)
%57 = icmp sle i32 %56, 3
br i1 %57, label %58, label %104
58: ; preds = %48
%59 = load i32, i32* %10
%60 = icmp ne i32 %59, 0
br i1 %60, label %103, label %61
61: ; preds = %58
%62 = load i32, i32* %9
%63 = add nsw i32 %62, 1
store i32 %63, i32* %9
%64 = icmp eq i32 %63, 3
br i1 %64, label %65, label %102
65: ; preds = %61
%66 = load i32, i32* @LOG_NOTICE
%67 = call i32 @syslog(i32 %66, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
%68 = getelementptr inbounds [32 x i32], [32 x i32]* %8, i64 0, i64 0
%69 = call i32 @close_and_clear(i32* %68)
store i32 %69, i32* %12
%70 = load i32, i32* %12
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %75
72: ; preds = %65
%73 = load i32, i32* @LOG_NOTICE
%74 = call i32 @syslog(i32 %73, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
br label %101
75: ; preds = %65
store i32 1, i32* %10
store i32 0, i32* %11
br label %76
76: ; preds = %97, %75
%77 = load i32, i32* %11
%78 = icmp slt i32 %77, 32
br i1 %78, label %79, label %100
79: ; preds = %76
%80 = load i32, i32* %11
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [32 x i32], [32 x i32]* %8, i64 0, i64 %81
%83 = load i32, i32* %82
%84 = icmp ne i32 %83, 0
br i1 %84, label %85, label %96
85: ; preds = %79
%86 = getelementptr inbounds [50 x i8], [50 x i8]* %13, i64 0, i64 0
%87 = load i32, i32* %11
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [32 x i32], [32 x i32]* %8, i64 0, i64 %88
%90 = load i32, i32* %89
%91 = load i32, i32* %11
%92 = call i32 @snprintf(i8* %86, i32 50, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0), i32 %90, i32 %91)
%93 = load i32, i32* @LOG_NOTICE
%94 = getelementptr inbounds [50 x i8], [50 x i8]* %13, i64 0, i64 0
%95 = call i32 @syslog(i32 %93, i8* %94)
br label %96
96: ; preds = %85, %79
br label %97
97: ; preds = %96
%98 = load i32, i32* %11
%99 = add nsw i32 %98, 1
store i32 %99, i32* %11
br label %76
100: ; preds = %76
br label %101
101: ; preds = %100, %72
store i32 0, i32* %9
br label %102
102: ; preds = %101, %61
br label %103
103: ; preds = %102, %58
br label %105
104: ; preds = %48
store i32 0, i32* %10
store i32 0, i32* %9
br label %105
105: ; preds = %104, %103
%106 = call i32 @sleep(i32 3)
br label %48
107: ; preds = %30, %27
%108 = load i32, i32* %3
ret i32 %108
}

LLVM IR (-O2):
@.str = [17 x i8] c"--clear-and-exit\00"
@stderr = global i32 0
@.str.1 = [52 x i8] c"%s: just one option available - \22--clear-and-exit\22\0A\00"
@.str.2 = [4 x i8] c"svc\00"
@LOG_PID = global i32 0
@LOG_LOCAL5 = global i32 0
@LOG_INFO = global i32 0
@.str.3 = [9 x i8] c"starting\00"
@.str.4 = [18 x i8] c"waiting for svd..\00"
@.str.5 = [26 x i8] c"START polling SVD process\00"
@.str.6 = [25 x i8] c"ps ax | grep svd | wc -l\00"
@.str.7 = [2 x i8] c"r\00"
@LOG_NOTICE = global i32 0
@.str.8 = [26 x i8] c"close_and_clear ACTIVATED\00"
@.str.9 = [22 x i8] c"close_and_clear ERROR\00"
@.str.10 = [23 x i8] c">> %d cleared in [%d]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [20 x i8]
%4 = alloca [32 x i32]
%5 = alloca [50 x i8]
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%7 = bitcast [32 x i32]* %4 to i8*
switch i32 %0, label %16 [
i32 1, label %20
i32 2, label %8
]
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @strcmp(i8* dereferenceable(1) %10, i8* dereferenceable(17) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 0
%15 = call i32 @close_and_clear(i32* %14)
br label %72
16: ; preds = %2, %8
%17 = load i32, i32* @stderr
%18 = load i8*, i8** %1
%19 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i8* %18)
br label %72
20: ; preds = %2
%21 = load i32, i32* @LOG_PID
%22 = load i32, i32* @LOG_LOCAL5
%23 = tail call i32 @openlog(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32 %22)
%24 = load i32, i32* @LOG_INFO
%25 = tail call i32 @syslog(i32 %24, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%26 = tail call i32 @daemonize(i32 0)
%27 = load i32, i32* @LOG_INFO
%28 = tail call i32 @syslog(i32 %27, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%29 = tail call i32 @sleep(i32 10)
%30 = load i32, i32* @LOG_INFO
%31 = tail call i32 @syslog(i32 %30, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%32 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 0
%33 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
br label %34
34: ; preds = %68, %20
%35 = phi i32 [ 0, %20 ], [ %69, %68 ]
%36 = phi i32 [ 0, %20 ], [ %70, %68 ]
%37 = call i32* @popen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%38 = call i32 @fread(i8* %6, i32 20, i32 1, i32* %37)
%39 = call i32 @pclose(i32* %37)
%40 = call i32 @strtol(i8* nocapture %6, i32* null, i32 10)
%41 = icmp slt i32 %40, 4
br i1 %41, label %42, label %68
42: ; preds = %34
%43 = icmp eq i32 %36, 0
br i1 %43, label %44, label %68
44: ; preds = %42
%45 = add nsw i32 %35, 1
%46 = icmp eq i32 %45, 3
br i1 %46, label %47, label %68
47: ; preds = %44
%48 = load i32, i32* @LOG_NOTICE
%49 = call i32 @syslog(i32 %48, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
%50 = call i32 @close_and_clear(i32* %32)
%51 = icmp eq i32 %50, 0
br i1 %51, label %55, label %52
52: ; preds = %47
%53 = load i32, i32* @LOG_NOTICE
%54 = call i32 @syslog(i32 %53, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
br label %68
55: ; preds = %47, %65
%56 = phi i64 [ %66, %65 ], [ 0, %47 ]
%57 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 %56
%58 = load i32, i32* %57
%59 = icmp eq i32 %58, 0
br i1 %59, label %65, label %60
60: ; preds = %55
%61 = trunc i64 %56 to i32
%62 = call i32 @snprintf(i8* %33, i32 50, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0), i32 %58, i32 %61)
%63 = load i32, i32* @LOG_NOTICE
%64 = call i32 @syslog(i32 %63, i8* %33)
br label %65
65: ; preds = %55, %60
%66 = add nuw nsw i64 %56, 1
%67 = icmp eq i64 %66, 32
br i1 %67, label %68, label %55
68: ; preds = %65, %34, %52, %42, %44
%69 = phi i32 [ %35, %42 ], [ %45, %44 ], [ 0, %52 ], [ 0, %34 ], [ 0, %65 ]
%70 = phi i32 [ 1, %42 ], [ 0, %44 ], [ 0, %52 ], [ 0, %34 ], [ 1, %65 ]
%71 = call i32 @sleep(i32 3)
br label %34
72: ; preds = %16, %13
%73 = phi i32 [ -1, %16 ], [ %15, %13 ]
ret i32 %73
}