#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*/ time_t;
struct tm {
  int tm_year;
  int tm_mon;
  int tm_mday;
};
typedef int /*<<< orphan*/ number_s;
typedef int /*<<< orphan*/ date_s;
typedef int /*<<< orphan*/ Variable;
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ Argument;

/* Variables and functions */
int atoi(char *);
char *calculateFileName(int /*<<< orphan*/ *, int, int, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
char *getFilename(char *);
char *getNextArgument(char *, char *, int, char *, int);
int /*<<< orphan*/ getSavedLogAt(int /*<<< orphan*/ *, char *, int);
int getTotalSavedLogs(int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ sendRequestToAgent(int, int);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ *strstr(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int Daily_Events(char *source, char *dest, int size, int at) {
  char *filename;
  int savedLogs = 0;
  char line[8192];
  char *psource = source, Variable[100] = "", Argument[100] = "", number_s[100],
       date_s[10] = "";
  int numberFrom = 0;
  int numberTo = 0;
  FILE *file = (FILE *)NULL;
  if (at) {
    while ((psource = getNextArgument(psource, Variable, sizeof(Variable),
                                      Argument, sizeof(Argument))) !=
           (char *)NULL) {
      if (strstr(Variable, "numberFrom") != NULL) {
        strncpy(number_s, Argument, sizeof(number_s));
        numberFrom = atoi(number_s) - 1;
      }
      if (strstr(Variable, "numberTo") != NULL) {
        strncpy(number_s, Argument, sizeof(number_s));
        numberTo = atoi(number_s) - 1;
      }
      if (strstr(Variable, "thedate") != NULL) {
        strncpy(date_s, Argument, sizeof(date_s));
      }
    }
    if (!((numberFrom == -1) && (numberTo == -1))) {
      if ((numberFrom == -1) && !(numberTo == -1))
        numberFrom = numberTo;
      else if (!(numberFrom == -1) && (numberTo == -1))
        numberTo = numberFrom;
    }
  }
  if (strlen(date_s) > 0) {
    filename = getFilename(date_s);
    if (filename) {
      file = fopen(filename, "r");
      savedLogs = getTotalSavedLogs(file);
      if (file) {
        fclose(file);
      }
    }
    sprintf(
        dest,
        "<HTML><BODY><form method=get action=/geteventlogat><H2><CENTER>Daily "
        "Events for %s</H2></CENTER><P><center><br/>\n"
        "<CENTER>TOTAL Events : %d</CENTER><P><center><br />\n"
        "<table border=1 cellspacing=0 cellpadding=2 width=\"99%%\" "
        "bgcolor=\"white\">\n"
        "<tr bgcolor=\"#F0F1F5\"><td align=Center>Event Log</td></tr>\n",
        date_s, savedLogs);
  } else {
    time_t startime;
    time(&startime);
    struct tm *t = localtime(&startime);
    filename =
        calculateFileName(NULL, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday);
    if (filename) {
      file = fopen(filename, "r");
      savedLogs = getTotalSavedLogs(file);
      if (file) {
        fclose(file);
      }
    }
    sprintf(
        dest,
        "<HTML><BODY><form method=get action=/geteventlogat><H2><CENTER>Daily "
        "Events for %04d%02d%02d</H2></CENTER><P><center><br />\n"
        "<CENTER>TOTAL Events : %d</CENTER><P><center><br />\n"
        "<table border=1 cellspacing=0 cellpadding=2 width=\"99%%\" "
        "bgcolor=\"white\">\n"
        "<tr bgcolor=\"#F0F1F5\"><td align=Center>Event Log</td></tr>\n",
        t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, savedLogs);
  }
  if (at) {
    if ((numberFrom >= 0) && (numberTo >= numberFrom) &&
        (numberTo < savedLogs)) {
      if (strlen(date_s) <= 0) {
        sendRequestToAgent(numberFrom + 1, numberTo + 1);
      }
      if (filename) {
        file = fopen(filename, "r");
        if (file) {
          getSavedLogAt(file, line, numberFrom);
          int i = 0;
          for (i = numberFrom; i <= numberTo; i++) {
            if (i - numberFrom <= 20) {
              if (i % 2)
                sprintf(dest, "%s<tr bgcolor=#FEFEFE><td>\n%s\n</td></tr>\n",
                        dest, line);
              else
                sprintf(dest, "%s<tr bgcolor=#EEEEEE><td>\n%s\n</td></tr>\n",
                        dest, line);
            }
            if (i <= numberTo)
              getSavedLogAt(file, line, 0);
          }
          fclose(file);
        }
      }
    }
  }
  free(filename);
  strcat(dest, "</table><br><br><table border=1 cellspacing=0 cellpadding=2 "
               "width=\"50%%\" bgcolor=\"white\">\n");
  strcat(dest,
         "<tr bgcolor=#F0F1F5><td>Insert the Date For Recovery Via "
         "HTTP</td><td><input type=text name=thedate size=12 value=\"\" "
         "onMouseover=\"ddrivetip(\'When entered the date the recovery of the "
         "event logs is only via Http with the max number of recovered event "
         "logs of 20. Otherwise the event logs are sent to the syslog server "
         "\')\" onMouseout=\"hideddrivetip()\"></td></tr>\n");
  strcat(
      dest,
      "<tr bgcolor=#F0F1F5><td>Insert the From Event Log Number "
      "</td><td><input type=text name=numberFrom size=12 "
      "value=\"\"></td></tr>\n"
      "<tr bgcolor=#F0F1F5><td>Insert the To Event Log Number </td><td><input "
      "type=text name=numberTo size=12 value=\"\"></td></tr>\n"
      "</table>\n");
  strcat(dest,
         "<input type=submit name=0 value=Send></CENTER></form></BODY></HTML>");
  return (0);
}


x86 assembly (clang, -O0):
<Daily_Events>:
push   %rbp
mov    %rsp,%rbp
sub    $0x21c0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x2038(%rbp)
lea    -0x20a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   10b0 <memset@plt>
lea    -0x2110(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   10b0 <memset@plt>
lea    -0x218a(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10b0 <memset@plt>
movl   $0x0,-0x2190(%rbp)
movl   $0x0,-0x2194(%rbp)
movq   $0x0,-0x21a0(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     142e <Daily_Events+0x20e>
jmp    12b2 <Daily_Events+0x92>
mov    -0x2038(%rbp),%rdi
lea    -0x20a0(%rbp),%rsi
lea    -0x2110(%rbp),%rcx
mov    $0x64,%r8d
mov    %r8d,%edx
call   1030 <getNextArgument@plt>
mov    %rax,-0x2038(%rbp)
cmp    $0x0,%rax
je     13b4 <Daily_Events+0x194>
lea    -0x20a0(%rbp),%rdi
lea    0xd0c(%rip),%rsi
call   1130 <strstr@plt>
cmp    $0x0,%rax
je     1330 <Daily_Events+0x110>
lea    -0x2180(%rbp),%rdi
lea    -0x2110(%rbp),%rsi
mov    $0x64,%edx
call   1070 <strncpy@plt>
lea    -0x2180(%rbp),%rdi
call   10f0 <atoi@plt>
sub    $0x1,%eax
mov    %eax,-0x2190(%rbp)
lea    -0x20a0(%rbp),%rdi
lea    0xccd(%rip),%rsi
call   1130 <strstr@plt>
cmp    $0x0,%rax
je     137a <Daily_Events+0x15a>
lea    -0x2180(%rbp),%rdi
lea    -0x2110(%rbp),%rsi
mov    $0x64,%edx
call   1070 <strncpy@plt>
lea    -0x2180(%rbp),%rdi
call   10f0 <atoi@plt>
sub    $0x1,%eax
mov    %eax,-0x2194(%rbp)
lea    -0x20a0(%rbp),%rdi
lea    0xc8c(%rip),%rsi
call   1130 <strstr@plt>
cmp    $0x0,%rax
je     13af <Daily_Events+0x18f>
lea    -0x218a(%rbp),%rdi
lea    -0x2110(%rbp),%rsi
mov    $0xa,%edx
call   1070 <strncpy@plt>
jmp    12b2 <Daily_Events+0x92>
cmpl   $0xffffffff,-0x2190(%rbp)
jne    13ce <Daily_Events+0x1ae>
cmpl   $0xffffffff,-0x2194(%rbp)
je     1429 <Daily_Events+0x209>
cmpl   $0xffffffff,-0x2190(%rbp)
jne    13f9 <Daily_Events+0x1d9>
cmpl   $0xffffffff,-0x2194(%rbp)
je     13f9 <Daily_Events+0x1d9>
mov    -0x2194(%rbp),%eax
mov    %eax,-0x2190(%rbp)
jmp    1424 <Daily_Events+0x204>
cmpl   $0xffffffff,-0x2190(%rbp)
je     141f <Daily_Events+0x1ff>
cmpl   $0xffffffff,-0x2194(%rbp)
jne    141f <Daily_Events+0x1ff>
mov    -0x2190(%rbp),%eax
mov    %eax,-0x2194(%rbp)
jmp    1424 <Daily_Events+0x204>
jmp    1429 <Daily_Events+0x209>
jmp    142e <Daily_Events+0x20e>
lea    -0x218a(%rbp),%rdi
call   10a0 <strlen@plt>
cmp    $0x0,%rax
jle    14c5 <Daily_Events+0x2a5>
lea    -0x218a(%rbp),%rdi
call   1140 <getFilename@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     14a4 <Daily_Events+0x284>
mov    -0x20(%rbp),%rdi
lea    0xbb2(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x21a0(%rbp)
mov    -0x21a0(%rbp),%rdi
call   1120 <getTotalSavedLogs@plt>
mov    %eax,-0x24(%rbp)
cmpq   $0x0,-0x21a0(%rbp)
je     149f <Daily_Events+0x27f>
mov    -0x21a0(%rbp),%rdi
call   1090 <fclose@plt>
jmp    14a4 <Daily_Events+0x284>
mov    -0x10(%rbp),%rdi
lea    -0x218a(%rbp),%rdx
mov    -0x24(%rbp),%ecx
lea    0xb65(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
jmp    15a4 <Daily_Events+0x384>
lea    -0x21a4(%rbp),%rdi
call   10c0 <time@plt>
lea    -0x21a4(%rbp),%rdi
call   1060 <localtime@plt>
mov    %rax,-0x21b0(%rbp)
mov    -0x21b0(%rbp),%rax
mov    (%rax),%esi
add    $0x76c,%esi
mov    -0x21b0(%rbp),%rax
mov    0x4(%rax),%edx
add    $0x1,%edx
mov    -0x21b0(%rbp),%rax
mov    0x8(%rax),%ecx
xor    %eax,%eax
mov    %eax,%edi
call   10d0 <calculateFileName@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1567 <Daily_Events+0x347>
mov    -0x20(%rbp),%rdi
lea    0xaef(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x21a0(%rbp)
mov    -0x21a0(%rbp),%rdi
call   1120 <getTotalSavedLogs@plt>
mov    %eax,-0x24(%rbp)
cmpq   $0x0,-0x21a0(%rbp)
je     1562 <Daily_Events+0x342>
mov    -0x21a0(%rbp),%rdi
call   1090 <fclose@plt>
jmp    1567 <Daily_Events+0x347>
mov    -0x10(%rbp),%rdi
mov    -0x21b0(%rbp),%rax
mov    (%rax),%edx
add    $0x76c,%edx
mov    -0x21b0(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    -0x21b0(%rbp),%rax
mov    0x8(%rax),%r8d
mov    -0x24(%rbp),%r9d
lea    0xbac(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
cmpl   $0x0,-0x18(%rbp)
je     1745 <Daily_Events+0x525>
cmpl   $0x0,-0x2190(%rbp)
jl     1740 <Daily_Events+0x520>
mov    -0x2194(%rbp),%eax
cmp    -0x2190(%rbp),%eax
jl     1740 <Daily_Events+0x520>
mov    -0x2194(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1740 <Daily_Events+0x520>
lea    -0x218a(%rbp),%rdi
call   10a0 <strlen@plt>
cmp    $0x0,%rax
jg     1609 <Daily_Events+0x3e9>
mov    -0x2190(%rbp),%edi
add    $0x1,%edi
mov    -0x2194(%rbp),%esi
add    $0x1,%esi
call   1040 <sendRequestToAgent@plt>
cmpq   $0x0,-0x20(%rbp)
je     173b <Daily_Events+0x51b>
mov    -0x20(%rbp),%rdi
lea    0x9fd(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x21a0(%rbp)
cmpq   $0x0,-0x21a0(%rbp)
je     1736 <Daily_Events+0x516>
mov    -0x21a0(%rbp),%rdi
lea    -0x2030(%rbp),%rsi
mov    -0x2190(%rbp),%edx
call   1080 <getSavedLogAt@plt>
movl   $0x0,-0x21b4(%rbp)
mov    -0x2190(%rbp),%eax
mov    %eax,-0x21b4(%rbp)
mov    -0x21b4(%rbp),%eax
cmp    -0x2194(%rbp),%eax
jg     172a <Daily_Events+0x50a>
mov    -0x21b4(%rbp),%eax
sub    -0x2190(%rbp),%eax
cmp    $0x14,%eax
jg     16ea <Daily_Events+0x4ca>
mov    -0x21b4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     16c8 <Daily_Events+0x4a8>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    -0x2030(%rbp),%rcx
lea    0xbc3(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
jmp    16e5 <Daily_Events+0x4c5>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    -0x2030(%rbp),%rcx
lea    0xbcb(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
jmp    16ea <Daily_Events+0x4ca>
mov    -0x21b4(%rbp),%eax
cmp    -0x2194(%rbp),%eax
jg     1711 <Daily_Events+0x4f1>
mov    -0x21a0(%rbp),%rdi
lea    -0x2030(%rbp),%rsi
xor    %edx,%edx
call   1080 <getSavedLogAt@plt>
jmp    1716 <Daily_Events+0x4f6>
mov    -0x21b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x21b4(%rbp)
jmp    1668 <Daily_Events+0x448>
mov    -0x21a0(%rbp),%rdi
call   1090 <fclose@plt>
jmp    173b <Daily_Events+0x51b>
jmp    1740 <Daily_Events+0x520>
jmp    1745 <Daily_Events+0x525>
mov    -0x20(%rbp),%rdi
call   1050 <free@plt>
mov    -0x10(%rbp),%rdi
lea    0xb7a(%rip),%rsi
call   1100 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xbc5(%rip),%rsi
call   1100 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xd1f(%rip),%rsi
call   1100 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xe13(%rip),%rsi
call   1100 <strcat@plt>
xor    %eax,%eax
add    $0x21c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Daily_Events>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2188,%rsp
mov    %ecx,%ebp
mov    %rsi,0x28(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movl   $0x0,0x100(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movl   $0x0,0x90(%rsp)
movw   $0x0,0x20(%rsp)
movq   $0x0,0x18(%rsp)
test   %ecx,%ecx
je     13fc <Daily_Events+0x1ec>
lea    0xa0(%rsp),%rsi
lea    0x30(%rsp),%rcx
mov    $0x64,%edx
mov    $0x64,%r8d
call   1030 <getNextArgument@plt>
test   %rax,%rax
je     1407 <Daily_Events+0x1f7>
mov    %rax,%rbx
mov    %ebp,0x10(%rsp)
xor    %r12d,%r12d
lea    0xa0(%rsp),%rbp
lea    0x30(%rsp),%r14
lea    0x110(%rsp),%r15
xor    %r13d,%r13d
jmp    1325 <Daily_Events+0x115>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x64,%edx
mov    %r14,%rcx
mov    $0x64,%r8d
call   1030 <getNextArgument@plt>
mov    %rax,%rbx
test   %rax,%rax
je     13ba <Daily_Events+0x1aa>
mov    %rbp,%rdi
lea    0xcd1(%rip),%rsi
call   1120 <strstr@plt>
test   %rax,%rax
je     1358 <Daily_Events+0x148>
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x64,%edx
call   1070 <strncpy@plt>
mov    %r15,%rdi
call   10e0 <atoi@plt>
mov    %eax,%r13d
add    $0xffffffff,%r13d
mov    %rbp,%rdi
lea    0xca9(%rip),%rsi
call   1120 <strstr@plt>
test   %rax,%rax
je     138b <Daily_Events+0x17b>
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x64,%edx
call   1070 <strncpy@plt>
mov    %r15,%rdi
call   10e0 <atoi@plt>
mov    %eax,%r12d
add    $0xffffffff,%r12d
mov    %rbp,%rdi
lea    0xc7f(%rip),%rsi
call   1120 <strstr@plt>
test   %rax,%rax
je     1300 <Daily_Events+0xf0>
lea    0x18(%rsp),%rdi
mov    %r14,%rsi
mov    $0xa,%edx
call   1070 <strncpy@plt>
jmp    1300 <Daily_Events+0xf0>
cmp    $0xffffffff,%r12d
sete   %al
cmp    $0xffffffff,%r13d
mov    0x10(%rsp),%ebp
jne    13e0 <Daily_Events+0x1d0>
mov    $0xffffffff,%ecx
mov    %rcx,0x8(%rsp)
mov    $0xffffffff,%ebx
cmp    $0xffffffff,%r12d
je     1428 <Daily_Events+0x218>
cmp    $0xffffffff,%r13d
setne  %cl
jne    1411 <Daily_Events+0x201>
mov    %r12d,%edx
mov    %rdx,0x8(%rsp)
mov    %r12d,%ebx
cmp    $0xffffffff,%r12d
jne    1428 <Daily_Events+0x218>
jmp    1411 <Daily_Events+0x201>
xor    %eax,%eax
mov    %rax,0x8(%rsp)
xor    %ebx,%ebx
jmp    1428 <Daily_Events+0x218>
xor    %r13d,%r13d
mov    $0x1,%cl
xor    %r12d,%r12d
xor    %eax,%eax
test   %al,%al
mov    %r12d,%ebx
cmovne %r13d,%ebx
test   %cl,%cl
cmove  %r12d,%ebx
mov    %r13d,%eax
mov    %rax,0x8(%rsp)
lea    0x18(%rsp),%rdi
call   10a0 <strlen@plt>
test   %rax,%rax
jle    1486 <Daily_Events+0x276>
lea    0x18(%rsp),%rdi
call   1130 <getFilename@plt>
mov    %rax,%r15
test   %rax,%rax
je     1521 <Daily_Events+0x311>
mov    %ebp,%r12d
mov    %ebx,%ebp
lea    0xbc3(%rip),%rsi
mov    %r15,%rdi
call   10d0 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1110 <getTotalSavedLogs@plt>
mov    %eax,%r14d
test   %rbx,%rbx
je     147c <Daily_Events+0x26c>
mov    %rbx,%rdi
call   1090 <fclose@plt>
mov    %ebp,%ebx
mov    %r12d,%ebp
jmp    1524 <Daily_Events+0x314>
mov    %ebx,0x10(%rsp)
lea    0x180(%rsp),%rbx
mov    %rbx,%rdi
call   10b0 <time@plt>
mov    %rbx,%rdi
call   1060 <localtime@plt>
mov    %rax,%rbx
mov    $0x76c,%r12d
mov    (%rax),%esi
add    %r12d,%esi
mov    0x4(%rax),%edx
mov    0x8(%rax),%ecx
add    $0x1,%edx
xor    %r14d,%r14d
xor    %edi,%edi
call   10c0 <calculateFileName@plt>
mov    %rax,%r15
test   %rax,%rax
je     14f5 <Daily_Events+0x2e5>
lea    0xb4a(%rip),%rsi
mov    %r15,%rdi
call   10d0 <fopen@plt>
mov    %rax,%r13
mov    %rax,%rdi
call   1110 <getTotalSavedLogs@plt>
mov    %eax,%r14d
test   %r13,%r13
je     14f5 <Daily_Events+0x2e5>
mov    %r13,%rdi
call   1090 <fclose@plt>
add    (%rbx),%r12d
mov    0x4(%rbx),%ecx
mov    0x8(%rbx),%r8d
add    $0x1,%ecx
lea    0xc40(%rip),%rsi
mov    0x28(%rsp),%rdi
mov    %r12d,%edx
mov    %r14d,%r9d
xor    %eax,%eax
call   1100 <sprintf@plt>
mov    0x10(%rsp),%ebx
jmp    153f <Daily_Events+0x32f>
xor    %r14d,%r14d
lea    0xaf3(%rip),%rsi
lea    0x18(%rsp),%rdx
mov    0x28(%rsp),%rdi
mov    %r14d,%ecx
xor    %eax,%eax
call   1100 <sprintf@plt>
test   %ebp,%ebp
je     162e <Daily_Events+0x41e>
cmpl   $0x0,0x8(%rsp)
js     162e <Daily_Events+0x41e>
mov    %ebx,%ebp
sub    0x8(%rsp),%ebp
jl     162e <Daily_Events+0x41e>
cmp    %r14d,%ebx
jge    162e <Daily_Events+0x41e>
lea    0x18(%rsp),%rdi
call   10a0 <strlen@plt>
test   %rax,%rax
jg     1588 <Daily_Events+0x378>
mov    0x8(%rsp),%rax
lea    0x1(%rax),%edi
add    $0x1,%ebx
mov    %ebx,%esi
call   1040 <sendRequestToAgent@plt>
test   %r15,%r15
je     162e <Daily_Events+0x41e>
lea    0xa84(%rip),%rsi
mov    %r15,%rdi
call   10d0 <fopen@plt>
test   %rax,%rax
je     162e <Daily_Events+0x41e>
mov    %rax,%rbx
mov    %r15,0x10(%rsp)
lea    0x180(%rsp),%r14
mov    %rax,%rdi
mov    %r14,%rsi
mov    0x8(%rsp),%rdx
call   1080 <getSavedLogAt@plt>
add    $0x1,%ebp
lea    0xcd6(%rip),%r12
lea    0xca5(%rip),%r13
xor    %r15d,%r15d
jmp    15f6 <Daily_Events+0x3e6>
nop
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1080 <getSavedLogAt@plt>
add    $0x1,%r15d
cmp    %r15d,%ebp
je     1621 <Daily_Events+0x411>
cmp    $0x14,%r15d
jg     15e0 <Daily_Events+0x3d0>
mov    0x8(%rsp),%rax
add    %r15d,%eax
test   $0x1,%al
mov    %r13,%rsi
cmove  %r12,%rsi
mov    0x28(%rsp),%rdi
mov    %rdi,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1100 <sprintf@plt>
jmp    15e0 <Daily_Events+0x3d0>
mov    %rbx,%rdi
call   1090 <fclose@plt>
mov    0x10(%rsp),%r15
mov    %r15,%rdi
call   1050 <free@plt>
lea    0xc96(%rip),%rsi
mov    0x28(%rsp),%rbx
mov    %rbx,%rdi
call   10f0 <strcat@plt>
lea    0xcdd(%rip),%rsi
mov    %rbx,%rdi
call   10f0 <strcat@plt>
lea    0xe38(%rip),%rsi
mov    %rbx,%rdi
call   10f0 <strcat@plt>
lea    0xf2d(%rip),%rsi
mov    %rbx,%rdi
call   10f0 <strcat@plt>
xor    %eax,%eax
add    $0x2188,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32 }
@.str = [11 x i8] c"numberFrom\00"
@.str.1 = [9 x i8] c"numberTo\00"
@.str.2 = [8 x i8] c"thedate\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [299 x i8] c"<HTML><BODY><form method=get action=/geteventlogat><H2><CENTER>Daily Events for %s</H2></CENTER><P><center><br/>\0A<CENTER>TOTAL Events : %d</CENTER><P><center><br />\0A<table border=1 cellspacing=0 cellpadding=2 width=\2299%%\22 bgcolor=\22white\22>\0A<tr bgcolor=\22#F0F1F5\22><td align=Center>Event Log</td></tr>\0A\00"
@.str.5 = [310 x i8] c"<HTML><BODY><form method=get action=/geteventlogat><H2><CENTER>Daily Events for %04d%02d%02d</H2></CENTER><P><center><br />\0A<CENTER>TOTAL Events : %d</CENTER><P><center><br />\0A<table border=1 cellspacing=0 cellpadding=2 width=\2299%%\22 bgcolor=\22white\22>\0A<tr bgcolor=\22#F0F1F5\22><td align=Center>Event Log</td></tr>\0A\00"
@.str.6 = [42 x i8] c"%s<tr bgcolor=#FEFEFE><td>\0A%s\0A</td></tr>\0A\00"
@.str.7 = [42 x i8] c"%s<tr bgcolor=#EEEEEE><td>\0A%s\0A</td></tr>\0A\00"
@.str.8 = [91 x i8] c"</table><br><br><table border=1 cellspacing=0 cellpadding=2 width=\2250%%\22 bgcolor=\22white\22>\0A\00"
@.str.9 = [362 x i8] c"<tr bgcolor=#F0F1F5><td>Insert the Date For Recovery Via HTTP</td><td><input type=text name=thedate size=12 value=\22\22 onMouseover=\22ddrivetip('When entered the date the recovery of the event logs is only via Http with the max number of recovered event logs of 20. Otherwise the event logs are sent to the syslog server ')\22 onMouseout=\22hideddrivetip()\22></td></tr>\0A\00"
@.str.10 = [260 x i8] c"<tr bgcolor=#F0F1F5><td>Insert the From Event Log Number </td><td><input type=text name=numberFrom size=12 value=\22\22></td></tr>\0A<tr bgcolor=#F0F1F5><td>Insert the To Event Log Number </td><td><input type=text name=numberTo size=12 value=\22\22></td></tr>\0A</table>\0A\00"
@.str.11 = [68 x i8] c"<input type=submit name=0 value=Send></CENTER></form></BODY></HTML>\00"
define i32 @Daily_Events(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca [8192 x i8]
%12 = alloca i8*
%13 = alloca [100 x i8]
%14 = alloca [100 x i8]
%15 = alloca [100 x i8]
%16 = alloca [10 x i8]
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32*
%20 = alloca i32
%21 = alloca %struct.tm*
%22 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %10
%23 = load i8*, i8** %5
store i8* %23, i8** %12
%24 = bitcast [100 x i8]* %13 to i8*
%25 = bitcast [100 x i8]* %14 to i8*
%26 = bitcast [10 x i8]* %16 to i8*
store i32 0, i32* %17
store i32 0, i32* %18
store i32* null, i32** %19
%27 = load i32, i32* %8
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %92
29: ; preds = %4
br label %30
30: ; preds = %66, %29
%31 = load i8*, i8** %12
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %14, i64 0, i64 0
%34 = call i8* @getNextArgument(i8* %31, i8* %32, i32 100, i8* %33, i32 100)
store i8* %34, i8** %12
%35 = icmp ne i8* %34, null
br i1 %35, label %36, label %67
36: ; preds = %30
%37 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%38 = call i32* @strstr(i8* %37, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%39 = icmp ne i32* %38, null
br i1 %39, label %40, label %47
40: ; preds = %36
%41 = getelementptr inbounds [100 x i8], [100 x i8]* %15, i64 0, i64 0
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %14, i64 0, i64 0
%43 = call i32 @strncpy(i8* %41, i8* %42, i32 100)
%44 = getelementptr inbounds [100 x i8], [100 x i8]* %15, i64 0, i64 0
%45 = call i32 @atoi(i8* %44)
%46 = sub nsw i32 %45, 1
store i32 %46, i32* %17
br label %47
47: ; preds = %40, %36
%48 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%49 = call i32* @strstr(i8* %48, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%50 = icmp ne i32* %49, null
br i1 %50, label %51, label %58
51: ; preds = %47
%52 = getelementptr inbounds [100 x i8], [100 x i8]* %15, i64 0, i64 0
%53 = getelementptr inbounds [100 x i8], [100 x i8]* %14, i64 0, i64 0
%54 = call i32 @strncpy(i8* %52, i8* %53, i32 100)
%55 = getelementptr inbounds [100 x i8], [100 x i8]* %15, i64 0, i64 0
%56 = call i32 @atoi(i8* %55)
%57 = sub nsw i32 %56, 1
store i32 %57, i32* %18
br label %58
58: ; preds = %51, %47
%59 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%60 = call i32* @strstr(i8* %59, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%61 = icmp ne i32* %60, null
br i1 %61, label %62, label %66
62: ; preds = %58
%63 = getelementptr inbounds [10 x i8], [10 x i8]* %16, i64 0, i64 0
%64 = getelementptr inbounds [100 x i8], [100 x i8]* %14, i64 0, i64 0
%65 = call i32 @strncpy(i8* %63, i8* %64, i32 10)
br label %66
66: ; preds = %62, %58
br label %30
67: ; preds = %30
%68 = load i32, i32* %17
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %73
70: ; preds = %67
%71 = load i32, i32* %18
%72 = icmp eq i32 %71, -1
br i1 %72, label %91, label %73
73: ; preds = %70, %67
%74 = load i32, i32* %17
%75 = icmp eq i32 %74, -1
br i1 %75, label %76, label %81
76: ; preds = %73
%77 = load i32, i32* %18
%78 = icmp eq i32 %77, -1
br i1 %78, label %81, label %79
79: ; preds = %76
%80 = load i32, i32* %18
store i32 %80, i32* %17
br label %90
81: ; preds = %76, %73
%82 = load i32, i32* %17
%83 = icmp eq i32 %82, -1
br i1 %83, label %89, label %84
84: ; preds = %81
%85 = load i32, i32* %18
%86 = icmp eq i32 %85, -1
br i1 %86, label %87, label %89
87: ; preds = %84
%88 = load i32, i32* %17
store i32 %88, i32* %18
br label %89
89: ; preds = %87, %84, %81
br label %90
90: ; preds = %89, %79
br label %91
91: ; preds = %90, %70
br label %92
92: ; preds = %91, %4
%93 = getelementptr inbounds [10 x i8], [10 x i8]* %16, i64 0, i64 0
%94 = call i64 @strlen(i8* %93)
%95 = icmp sgt i64 %94, 0
br i1 %95, label %96, label %117
96: ; preds = %92
%97 = getelementptr inbounds [10 x i8], [10 x i8]* %16, i64 0, i64 0
%98 = call i8* @getFilename(i8* %97)
store i8* %98, i8** %9
%99 = load i8*, i8** %9
%100 = icmp ne i8* %99, null
br i1 %100, label %101, label %112
101: ; preds = %96
%102 = load i8*, i8** %9
%103 = call i32* @fopen(i8* %102, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %103, i32** %19
%104 = load i32*, i32** %19
%105 = call i32 @getTotalSavedLogs(i32* %104)
store i32 %105, i32* %10
%106 = load i32*, i32** %19
%107 = icmp ne i32* %106, null
br i1 %107, label %108, label %111
108: ; preds = %101
%109 = load i32*, i32** %19
%110 = call i32 @fclose(i32* %109)
br label %111
111: ; preds = %108, %101
br label %112
112: ; preds = %111, %96
%113 = load i8*, i8** %6
%114 = getelementptr inbounds [10 x i8], [10 x i8]* %16, i64 0, i64 0
%115 = load i32, i32* %10
%116 = call i32 (i8*, i8*, ...) @sprintf(i8* %113, i8* getelementptr inbounds ([299 x i8], [299 x i8]* @.str.4, i64 0, i64 0), i8* %114, i32 %115)
br label %160
117: ; preds = %92
%118 = call i32 @time(i32* %20)
%119 = call %struct.tm* @localtime(i32* %20)
store %struct.tm* %119, %struct.tm** %21
%120 = load %struct.tm*, %struct.tm** %21
%121 = getelementptr inbounds %struct.tm, %struct.tm* %120, i32 0, i32 0
%122 = load i32, i32* %121
%123 = add nsw i32 %122, 1900
%124 = load %struct.tm*, %struct.tm** %21
%125 = getelementptr inbounds %struct.tm, %struct.tm* %124, i32 0, i32 1
%126 = load i32, i32* %125
%127 = add nsw i32 %126, 1
%128 = load %struct.tm*, %struct.tm** %21
%129 = getelementptr inbounds %struct.tm, %struct.tm* %128, i32 0, i32 2
%130 = load i32, i32* %129
%131 = call i8* @calculateFileName(i32* null, i32 %123, i32 %127, i32 %130)
store i8* %131, i8** %9
%132 = load i8*, i8** %9
%133 = icmp ne i8* %132, null
br i1 %133, label %134, label %145
134: ; preds = %117
%135 = load i8*, i8** %9
%136 = call i32* @fopen(i8* %135, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %136, i32** %19
%137 = load i32*, i32** %19
%138 = call i32 @getTotalSavedLogs(i32* %137)
store i32 %138, i32* %10
%139 = load i32*, i32** %19
%140 = icmp ne i32* %139, null
br i1 %140, label %141, label %144
141: ; preds = %134
%142 = load i32*, i32** %19
%143 = call i32 @fclose(i32* %142)
br label %144
144: ; preds = %141, %134
br label %145
145: ; preds = %144, %117
%146 = load i8*, i8** %6
%147 = load %struct.tm*, %struct.tm** %21
%148 = getelementptr inbounds %struct.tm, %struct.tm* %147, i32 0, i32 0
%149 = load i32, i32* %148
%150 = add nsw i32 %149, 1900
%151 = load %struct.tm*, %struct.tm** %21
%152 = getelementptr inbounds %struct.tm, %struct.tm* %151, i32 0, i32 1
%153 = load i32, i32* %152
%154 = add nsw i32 %153, 1
%155 = load %struct.tm*, %struct.tm** %21
%156 = getelementptr inbounds %struct.tm, %struct.tm* %155, i32 0, i32 2
%157 = load i32, i32* %156
%158 = load i32, i32* %10
%159 = call i32 (i8*, i8*, ...) @sprintf(i8* %146, i8* getelementptr inbounds ([310 x i8], [310 x i8]* @.str.5, i64 0, i64 0), i32 %150, i32 %154, i32 %157, i32 %158)
br label %160
160: ; preds = %145, %112
%161 = load i32, i32* %8
%162 = icmp ne i32 %161, 0
br i1 %162, label %163, label %240
163: ; preds = %160
%164 = load i32, i32* %17
%165 = icmp sge i32 %164, 0
br i1 %165, label %166, label %239
166: ; preds = %163
%167 = load i32, i32* %18
%168 = load i32, i32* %17
%169 = icmp sge i32 %167, %168
br i1 %169, label %170, label %239
170: ; preds = %166
%171 = load i32, i32* %18
%172 = load i32, i32* %10
%173 = icmp slt i32 %171, %172
br i1 %173, label %174, label %239
174: ; preds = %170
%175 = getelementptr inbounds [10 x i8], [10 x i8]* %16, i64 0, i64 0
%176 = call i64 @strlen(i8* %175)
%177 = icmp sle i64 %176, 0
br i1 %177, label %178, label %184
178: ; preds = %174
%179 = load i32, i32* %17
%180 = add nsw i32 %179, 1
%181 = load i32, i32* %18
%182 = add nsw i32 %181, 1
%183 = call i32 @sendRequestToAgent(i32 %180, i32 %182)
br label %184
184: ; preds = %178, %174
%185 = load i8*, i8** %9
%186 = icmp ne i8* %185, null
br i1 %186, label %187, label %238
187: ; preds = %184
%188 = load i8*, i8** %9
%189 = call i32* @fopen(i8* %188, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %189, i32** %19
%190 = load i32*, i32** %19
%191 = icmp ne i32* %190, null
br i1 %191, label %192, label %237
192: ; preds = %187
%193 = load i32*, i32** %19
%194 = getelementptr inbounds [8192 x i8], [8192 x i8]* %11, i64 0, i64 0
%195 = load i32, i32* %17
%196 = call i32 @getSavedLogAt(i32* %193, i8* %194, i32 %195)
store i32 0, i32* %22
%197 = load i32, i32* %17
store i32 %197, i32* %22
br label %198
198: ; preds = %231, %192
%199 = load i32, i32* %22
%200 = load i32, i32* %18
%201 = icmp sle i32 %199, %200
br i1 %201, label %202, label %234
202: ; preds = %198
%203 = load i32, i32* %22
%204 = load i32, i32* %17
%205 = sub nsw i32 %203, %204
%206 = icmp sle i32 %205, 20
br i1 %206, label %207, label %222
207: ; preds = %202
%208 = load i32, i32* %22
%209 = srem i32 %208, 2
%210 = icmp ne i32 %209, 0
br i1 %210, label %211, label %216
211: ; preds = %207
%212 = load i8*, i8** %6
%213 = load i8*, i8** %6
%214 = getelementptr inbounds [8192 x i8], [8192 x i8]* %11, i64 0, i64 0
%215 = call i32 (i8*, i8*, ...) @sprintf(i8* %212, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i8* %213, i8* %214)
br label %221
216: ; preds = %207
%217 = load i8*, i8** %6
%218 = load i8*, i8** %6
%219 = getelementptr inbounds [8192 x i8], [8192 x i8]* %11, i64 0, i64 0
%220 = call i32 (i8*, i8*, ...) @sprintf(i8* %217, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i8* %218, i8* %219)
br label %221
221: ; preds = %216, %211
br label %222
222: ; preds = %221, %202
%223 = load i32, i32* %22
%224 = load i32, i32* %18
%225 = icmp sle i32 %223, %224
br i1 %225, label %226, label %230
226: ; preds = %222
%227 = load i32*, i32** %19
%228 = getelementptr inbounds [8192 x i8], [8192 x i8]* %11, i64 0, i64 0
%229 = call i32 @getSavedLogAt(i32* %227, i8* %228, i32 0)
br label %230
230: ; preds = %226, %222
br label %231
231: ; preds = %230
%232 = load i32, i32* %22
%233 = add nsw i32 %232, 1
store i32 %233, i32* %22
br label %198
234: ; preds = %198
%235 = load i32*, i32** %19
%236 = call i32 @fclose(i32* %235)
br label %237
237: ; preds = %234, %187
br label %238
238: ; preds = %237, %184
br label %239
239: ; preds = %238, %170, %166, %163
br label %240
240: ; preds = %239, %160
%241 = load i8*, i8** %9
%242 = call i32 @free(i8* %241)
%243 = load i8*, i8** %6
%244 = call i32 @strcat(i8* %243, i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.8, i64 0, i64 0))
%245 = load i8*, i8** %6
%246 = call i32 @strcat(i8* %245, i8* getelementptr inbounds ([362 x i8], [362 x i8]* @.str.9, i64 0, i64 0))
%247 = load i8*, i8** %6
%248 = call i32 @strcat(i8* %247, i8* getelementptr inbounds ([260 x i8], [260 x i8]* @.str.10, i64 0, i64 0))
%249 = load i8*, i8** %6
%250 = call i32 @strcat(i8* %249, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.11, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32 }
@.str = [11 x i8] c"numberFrom\00"
@.str.1 = [9 x i8] c"numberTo\00"
@.str.2 = [8 x i8] c"thedate\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [299 x i8] c"<HTML><BODY><form method=get action=/geteventlogat><H2><CENTER>Daily Events for %s</H2></CENTER><P><center><br/>\0A<CENTER>TOTAL Events : %d</CENTER><P><center><br />\0A<table border=1 cellspacing=0 cellpadding=2 width=\2299%%\22 bgcolor=\22white\22>\0A<tr bgcolor=\22#F0F1F5\22><td align=Center>Event Log</td></tr>\0A\00"
@.str.5 = [310 x i8] c"<HTML><BODY><form method=get action=/geteventlogat><H2><CENTER>Daily Events for %04d%02d%02d</H2></CENTER><P><center><br />\0A<CENTER>TOTAL Events : %d</CENTER><P><center><br />\0A<table border=1 cellspacing=0 cellpadding=2 width=\2299%%\22 bgcolor=\22white\22>\0A<tr bgcolor=\22#F0F1F5\22><td align=Center>Event Log</td></tr>\0A\00"
@.str.6 = [42 x i8] c"%s<tr bgcolor=#FEFEFE><td>\0A%s\0A</td></tr>\0A\00"
@.str.7 = [42 x i8] c"%s<tr bgcolor=#EEEEEE><td>\0A%s\0A</td></tr>\0A\00"
@.str.8 = [91 x i8] c"</table><br><br><table border=1 cellspacing=0 cellpadding=2 width=\2250%%\22 bgcolor=\22white\22>\0A\00"
@.str.9 = [362 x i8] c"<tr bgcolor=#F0F1F5><td>Insert the Date For Recovery Via HTTP</td><td><input type=text name=thedate size=12 value=\22\22 onMouseover=\22ddrivetip('When entered the date the recovery of the event logs is only via Http with the max number of recovered event logs of 20. Otherwise the event logs are sent to the syslog server ')\22 onMouseout=\22hideddrivetip()\22></td></tr>\0A\00"
@.str.10 = [260 x i8] c"<tr bgcolor=#F0F1F5><td>Insert the From Event Log Number </td><td><input type=text name=numberFrom size=12 value=\22\22></td></tr>\0A<tr bgcolor=#F0F1F5><td>Insert the To Event Log Number </td><td><input type=text name=numberTo size=12 value=\22\22></td></tr>\0A</table>\0A\00"
@.str.11 = [68 x i8] c"<input type=submit name=0 value=Send></CENTER></form></BODY></HTML>\00"
define i32 @Daily_Events(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca [8192 x i8]
%6 = alloca [100 x i8]
%7 = alloca [100 x i8]
%8 = alloca [100 x i8]
%9 = alloca [10 x i8]
%10 = alloca i32
%11 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%16 = icmp eq i32 %3, 0
br i1 %16, label %61, label %17
17: ; preds = %4
%18 = call i8* @getNextArgument(i8* %0, i8* %12, i32 100, i8* %13, i32 100)
%19 = icmp eq i8* %18, null
br i1 %19, label %54, label %20
20: ; preds = %17, %44
%21 = phi i8* [ %45, %44 ], [ %18, %17 ]
%22 = phi i32 [ %39, %44 ], [ 0, %17 ]
%23 = phi i32 [ %31, %44 ], [ 0, %17 ]
%24 = call i32* @strstr(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %30, label %26
26: ; preds = %20
%27 = call i32 @strncpy(i8* %14, i8* %13, i32 100)
%28 = call i32 @atoi(i8* %14)
%29 = add nsw i32 %28, -1
br label %30
30: ; preds = %26, %20
%31 = phi i32 [ %29, %26 ], [ %23, %20 ]
%32 = call i32* @strstr(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%33 = icmp eq i32* %32, null
br i1 %33, label %38, label %34
34: ; preds = %30
%35 = call i32 @strncpy(i8* %14, i8* %13, i32 100)
%36 = call i32 @atoi(i8* %14)
%37 = add nsw i32 %36, -1
br label %38
38: ; preds = %34, %30
%39 = phi i32 [ %37, %34 ], [ %22, %30 ]
%40 = call i32* @strstr(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%41 = icmp eq i32* %40, null
br i1 %41, label %44, label %42
42: ; preds = %38
%43 = call i32 @strncpy(i8* %15, i8* %13, i32 10)
br label %44
44: ; preds = %42, %38
%45 = call i8* @getNextArgument(i8* %21, i8* %12, i32 100, i8* %13, i32 100)
%46 = icmp eq i8* %45, null
br i1 %46, label %47, label %20
47: ; preds = %44
%48 = icmp eq i32 %31, -1
%49 = icmp eq i32 %39, -1
%50 = select i1 %48, i1 %49, i1 false
br i1 %50, label %61, label %51
51: ; preds = %47
%52 = icmp ne i32 %31, -1
%53 = select i1 %52, i1 true, i1 %49
br i1 %53, label %54, label %61
54: ; preds = %17, %51
%55 = phi i1 [ %52, %51 ], [ true, %17 ]
%56 = phi i32 [ %31, %51 ], [ 0, %17 ]
%57 = phi i32 [ %39, %51 ], [ 0, %17 ]
%58 = phi i1 [ %49, %51 ], [ false, %17 ]
%59 = select i1 %55, i1 %58, i1 false
%60 = select i1 %59, i32 %56, i32 %57
br label %61
61: ; preds = %54, %51, %47, %4
%62 = phi i32 [ -1, %47 ], [ 0, %4 ], [ %39, %51 ], [ %56, %54 ]
%63 = phi i32 [ -1, %47 ], [ 0, %4 ], [ %39, %51 ], [ %60, %54 ]
%64 = call i64 @strlen(i8* %15)
%65 = icmp sgt i64 %64, 0
br i1 %65, label %66, label %78
66: ; preds = %61
%67 = call i8* @getFilename(i8* %15)
%68 = icmp eq i8* %67, null
br i1 %68, label %75, label %69
69: ; preds = %66
%70 = call i32* @fopen(i8* %67, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%71 = call i32 @getTotalSavedLogs(i32* %70)
%72 = icmp eq i32* %70, null
br i1 %72, label %75, label %73
73: ; preds = %69
%74 = call i32 @fclose(i32* %70)
br label %75
75: ; preds = %69, %73, %66
%76 = phi i32 [ %71, %73 ], [ %71, %69 ], [ 0, %66 ]
%77 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([299 x i8], [299 x i8]* @.str.4, i64 0, i64 0), i8* %15, i32 %76)
br label %106
78: ; preds = %61
%79 = bitcast i32* %10 to i8*
%80 = call i32 @time(i32* %10)
%81 = call %struct.tm* @localtime(i32* %10)
%82 = getelementptr inbounds %struct.tm, %struct.tm* %81, i64 0, i32 0
%83 = load i32, i32* %82
%84 = add nsw i32 %83, 1900
%85 = getelementptr inbounds %struct.tm, %struct.tm* %81, i64 0, i32 1
%86 = load i32, i32* %85
%87 = add nsw i32 %86, 1
%88 = getelementptr inbounds %struct.tm, %struct.tm* %81, i64 0, i32 2
%89 = load i32, i32* %88
%90 = call i8* @calculateFileName(i32* null, i32 %84, i32 %87, i32 %89)
%91 = icmp eq i8* %90, null
br i1 %91, label %98, label %92
92: ; preds = %78
%93 = call i32* @fopen(i8* %90, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%94 = call i32 @getTotalSavedLogs(i32* %93)
%95 = icmp eq i32* %93, null
br i1 %95, label %98, label %96
96: ; preds = %92
%97 = call i32 @fclose(i32* %93)
br label %98
98: ; preds = %92, %96, %78
%99 = phi i32 [ %94, %96 ], [ %94, %92 ], [ 0, %78 ]
%100 = load i32, i32* %82
%101 = add nsw i32 %100, 1900
%102 = load i32, i32* %85
%103 = add nsw i32 %102, 1
%104 = load i32, i32* %88
%105 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([310 x i8], [310 x i8]* @.str.5, i64 0, i64 0), i32 %101, i32 %103, i32 %104, i32 %99)
br label %106
106: ; preds = %98, %75
%107 = phi i32 [ %76, %75 ], [ %99, %98 ]
%108 = phi i8* [ %67, %75 ], [ %90, %98 ]
%109 = icmp sgt i32 %62, -1
%110 = xor i1 %16, true
%111 = select i1 %110, i1 %109, i1 false
%112 = icmp sge i32 %63, %62
%113 = select i1 %111, i1 %112, i1 false
%114 = icmp slt i32 %63, %107
%115 = select i1 %113, i1 %114, i1 false
br i1 %115, label %116, label %145
116: ; preds = %106
%117 = call i64 @strlen(i8* %15)
%118 = icmp slt i64 %117, 1
br i1 %118, label %119, label %123
119: ; preds = %116
%120 = add nuw nsw i32 %62, 1
%121 = add nsw i32 %63, 1
%122 = call i32 @sendRequestToAgent(i32 %120, i32 %121)
br label %123
123: ; preds = %119, %116
%124 = icmp eq i8* %108, null
br i1 %124, label %145, label %125
125: ; preds = %123
%126 = call i32* @fopen(i8* %108, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%127 = icmp eq i32* %126, null
br i1 %127, label %145, label %128
128: ; preds = %125
%129 = call i32 @getSavedLogAt(i32* %126, i8* %11, i32 %62)
br label %130
130: ; preds = %128, %139
%131 = phi i32 [ %141, %139 ], [ %62, %128 ]
%132 = sub nsw i32 %131, %62
%133 = icmp slt i32 %132, 21
br i1 %133, label %134, label %139
134: ; preds = %130
%135 = and i32 %131, 1
%136 = icmp eq i32 %135, 0
%137 = select i1 %136, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0)
%138 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) %137, i8* %1, i8* %11)
br label %139
139: ; preds = %134, %130
%140 = call i32 @getSavedLogAt(i32* %126, i8* %11, i32 0)
%141 = add i32 %131, 1
%142 = icmp eq i32 %131, %63
br i1 %142, label %143, label %130
143: ; preds = %139
%144 = call i32 @fclose(i32* %126)
br label %145
145: ; preds = %125, %143, %123, %106
%146 = call i32 @free(i8* %108)
%147 = call i32 @strcat(i8* %1, i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.8, i64 0, i64 0))
%148 = call i32 @strcat(i8* %1, i8* getelementptr inbounds ([362 x i8], [362 x i8]* @.str.9, i64 0, i64 0))
%149 = call i32 @strcat(i8* %1, i8* getelementptr inbounds ([260 x i8], [260 x i8]* @.str.10, i64 0, i64 0))
%150 = call i32 @strcat(i8* %1, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.11, i64 0, i64 0))
ret i32 0
}