#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ timeout;
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};
struct timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct addrinfo {
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ addr;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ AF_UNSPEC;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_RCVTIMEO;
int accept(int, struct sockaddr *, int *);
int /*<<< orphan*/ atoi(char const *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
scalar_t__ difftime(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
scalar_t__ getaddrinfo(int /*<<< orphan*/ *, char const *, struct addrinfo *,
                       struct addrinfo **);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int listen(int, int);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ replace_esc(char const *, char const *);
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ sleep(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  const char *fileName = "/opt/gclc/gclc.log";
  const char *tmpFileName = "/opt/gclc/tmp.log";
  const char *host = "79.98.21.68";
  const char *port = "7777";
  struct addrinfo hints, *res;
  struct sockaddr_in addr;
  socklen_t addr_len;
  FILE *f;
  int sock, new_sock, ret, diff, bool_first = 1;
  char buf[1024];
  time_t begin, current;
  struct tm *timeinfo;
  addr.sin_family = AF_INET;
  addr.sin_port = htons(atoi(port));
  addr.sin_addr.s_addr = INADDR_ANY;
  memset(&hints, 0, sizeof hints);
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  if ((getaddrinfo(NULL, port, &hints, &res)) != 0) {
    perror("Server: Getaddrinfo error\n");
    return 1;
  }
  if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    perror("Server: Error when creating the socket");
    return 1;
  }
  if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) != 0) {
    perror("Server: Error while binding to socket");
    close(sock);
    return 1;
  }
  if (listen(sock, 5) == -1) {
    perror("Server: Error while listening");
    close(sock);
    return -1;
  }
  addr_len = sizeof(addr);
  if ((new_sock = accept(sock, (struct sockaddr *)&addr, &addr_len)) < 0) {
    perror("Server: Error on accept");
    close(sock);
    return 1;
  }
  while (1) {
    f = fopen(tmpFileName, "w");
    if (f == NULL) {
      perror("Server: Error opening the file");
      close(new_sock);
      close(sock);
      return 1;
    }
    if (bool_first) {
      if ((ret = recv(new_sock, buf, 1024 - 1, 0)) == -1) {
        perror("Server: Error recv");
        close(sock);
        close(new_sock);
        return 1;
      } else if (ret != 0) {
        buf[ret] = '\0';
        printf("%s", buf);
        printf("***TEAM40***\n");
        fprintf(f, "%s", buf);
      }
      struct timeval timeout;
      timeout.tv_sec = 20;
      timeout.tv_usec = 0;
      if (setsockopt(new_sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout,
                     sizeof(timeout)) < 0)
        error("setsockopt failed\n");
      bool_first = 0;
    }
    time(&begin);
    diff = 0;
    while (diff < 300) {
      if ((ret = recv(new_sock, buf, 1024 - 1, 0)) == -1) {
        printf("***timeout\n");
      } else if (ret != 0) {
        buf[ret] = '\0';
        printf("%s", buf);
        printf("***DELIMITER***\n");
        fprintf(f, "%s", buf);
      }
      time(&current);
      diff = (int)difftime(current, begin);
      printf("DIFF: %d\n", diff);
    }
    printf("***out of the while\n");
    fflush(f);
    printf("***after flush\n");
    fclose(f);
    replace_esc(tmpFileName, fileName);
    printf("***after replacement\n");
    time(&current);
    printf("GOING TO SLEEP\n");
    sleep(700 - (int)difftime(current, begin));
    printf("END OF SLEEPING\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x490,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xd87(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xd8f(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xd96(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xd97(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x1,-0x6c(%rbp)
mov    0x2d34(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    -0x28(%rbp),%rdi
call   1150 <atoi@plt>
mov    %eax,%edi
call   1060 <htons@plt>
mov    %eax,-0x44(%rbp)
mov    0x2d05(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1090 <memset@plt>
mov    0x2cf1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2cc5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
lea    -0x30(%rbp),%rdx
lea    -0x38(%rbp),%rcx
call   1160 <getaddrinfo@plt>
cmp    $0x0,%rax
je     132f <main+0xcf>
lea    0xd18(%rip),%rdi
call   1130 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    16e1 <main+0x481>
mov    0x2caa(%rip),%rax
mov    (%rax),%edi
mov    0x2c79(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1180 <socket@plt>
mov    %eax,-0x5c(%rbp)
cmp    $0x0,%eax
jge    136c <main+0x10c>
lea    0xcf6(%rip),%rdi
call   1130 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    16e1 <main+0x481>
mov    -0x5c(%rbp),%edi
lea    -0x48(%rbp),%rsi
mov    $0xc,%edx
call   1100 <bind@plt>
cmp    $0x0,%rax
je     13a7 <main+0x147>
lea    0xcea(%rip),%rdi
call   1130 <perror@plt>
mov    -0x5c(%rbp),%edi
call   10a0 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    16e1 <main+0x481>
mov    -0x5c(%rbp),%edi
mov    $0x5,%esi
call   10f0 <listen@plt>
cmp    $0xffffffff,%eax
jne    13dd <main+0x17d>
lea    0xcda(%rip),%rdi
call   1130 <perror@plt>
mov    -0x5c(%rbp),%edi
call   10a0 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    16e1 <main+0x481>
movl   $0xc,-0x4c(%rbp)
mov    -0x5c(%rbp),%edi
lea    -0x48(%rbp),%rsi
lea    -0x4c(%rbp),%rdx
call   1140 <accept@plt>
mov    %eax,-0x60(%rbp)
cmp    $0x0,%eax
jge    1420 <main+0x1c0>
lea    0xcb5(%rip),%rdi
call   1130 <perror@plt>
mov    -0x5c(%rbp),%edi
call   10a0 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    16e1 <main+0x481>
jmp    1425 <main+0x1c5>
mov    -0x18(%rbp),%rdi
lea    0xca4(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    146c <main+0x20c>
lea    0xc8b(%rip),%rdi
call   1130 <perror@plt>
mov    -0x60(%rbp),%edi
call   10a0 <close@plt>
mov    -0x5c(%rbp),%edi
call   10a0 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    16e1 <main+0x481>
cmpl   $0x0,-0x6c(%rbp)
je     156e <main+0x30e>
mov    -0x60(%rbp),%edi
lea    -0x470(%rbp),%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x64(%rbp)
cmp    $0xffffffff,%eax
jne    14c0 <main+0x260>
lea    0xc56(%rip),%rdi
call   1130 <perror@plt>
mov    -0x5c(%rbp),%edi
call   10a0 <close@plt>
mov    -0x60(%rbp),%edi
call   10a0 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    16e1 <main+0x481>
cmpl   $0x0,-0x64(%rbp)
je     1510 <main+0x2b0>
movslq -0x64(%rbp),%rax
movb   $0x0,-0x470(%rbp,%rax,1)
lea    -0x470(%rbp),%rsi
lea    0xc24(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xc19(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x58(%rbp),%rdi
lea    -0x470(%rbp),%rdx
lea    0xbfd(%rip),%rsi
call   10b0 <fprintf@plt>
jmp    1515 <main+0x2b5>
movl   $0x14,-0x490(%rbp)
movq   $0x0,-0x488(%rbp)
mov    -0x60(%rbp),%edi
mov    0x2ab4(%rip),%rax
mov    (%rax),%esi
mov    0x2a83(%rip),%rax
mov    (%rax),%edx
lea    -0x490(%rbp),%rcx
mov    $0x10,%r8d
call   1040 <setsockopt@plt>
cmp    $0x0,%rax
jge    1567 <main+0x307>
lea    0xbb7(%rip),%rdi
call   1110 <error@plt>
movl   $0x0,-0x6c(%rbp)
lea    -0x474(%rbp),%rdi
call   10d0 <time@plt>
movl   $0x0,-0x68(%rbp)
cmpl   $0x12c,-0x68(%rbp)
jge    164e <main+0x3ee>
mov    -0x60(%rbp),%edi
lea    -0x470(%rbp),%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x64(%rbp)
cmp    $0xffffffff,%eax
jne    15c3 <main+0x363>
lea    0xb75(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1618 <main+0x3b8>
cmpl   $0x0,-0x64(%rbp)
je     1613 <main+0x3b3>
movslq -0x64(%rbp),%rax
movb   $0x0,-0x470(%rbp,%rax,1)
lea    -0x470(%rbp),%rsi
lea    0xb21(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xb43(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x58(%rbp),%rdi
lea    -0x470(%rbp),%rdx
lea    0xafa(%rip),%rsi
call   10b0 <fprintf@plt>
jmp    1618 <main+0x3b8>
lea    -0x478(%rbp),%rdi
call   10d0 <time@plt>
mov    -0x478(%rbp),%edi
mov    -0x474(%rbp),%esi
call   1080 <difftime@plt>
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%esi
lea    0xb07(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1581 <main+0x321>
lea    0xafe(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x58(%rbp),%rdi
call   10e0 <fflush@plt>
lea    0xafc(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x58(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   10c0 <replace_esc@plt>
lea    0xae8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x478(%rbp),%rdi
call   10d0 <time@plt>
lea    0xae4(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x478(%rbp),%edi
mov    -0x474(%rbp),%esi
call   1080 <difftime@plt>
mov    $0x2bc,%edi
sub    %eax,%edi
call   1170 <sleep@plt>
lea    0xac9(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1425 <main+0x1c5>
mov    -0x4(%rbp),%eax
add    $0x490,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x448,%rsp
mov    0x2d68(%rip),%r14
mov    (%r14),%eax
mov    %eax,0x18(%rsp)
mov    $0x1e61,%edi
call   1070 <htons@plt>
mov    %eax,0x14(%rsp)
mov    0x2d3c(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   10b0 <memset@plt>
mov    0x2d23(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x24(%rsp)
mov    0x2cf6(%rip),%rbp
mov    0x0(%rbp),%eax
mov    %eax,0x20(%rsp)
lea    0xd55(%rip),%rsi
lea    0x38(%rsp),%rcx
xor    %edi,%edi
mov    %rbx,%rdx
call   1160 <getaddrinfo@plt>
test   %rax,%rax
jne    12fe <main+0x9e>
mov    (%r14),%edi
mov    0x0(%rbp),%esi
xor    %edx,%edx
call   1180 <socket@plt>
test   %eax,%eax
jns    130c <main+0xac>
lea    0xd49(%rip),%rdi
jmp    1305 <main+0xa5>
lea    0xd25(%rip),%rdi
call   1140 <perror@plt>
jmp    1388 <main+0x128>
mov    %eax,%ebx
lea    0x10(%rsp),%rsi
mov    %eax,%edi
mov    $0xc,%edx
call   1110 <bind@plt>
test   %rax,%rax
jne    134f <main+0xef>
mov    %ebx,%edi
mov    $0x5,%esi
call   1100 <listen@plt>
cmp    $0xffffffff,%eax
jne    1358 <main+0xf8>
lea    0xd56(%rip),%rdi
call   1140 <perror@plt>
mov    %ebx,%edi
call   10c0 <close@plt>
mov    $0xffffffff,%eax
jmp    138d <main+0x12d>
lea    0xd16(%rip),%rdi
jmp    137c <main+0x11c>
movl   $0xc,0xc(%rsp)
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %ebx,%edi
call   1150 <accept@plt>
test   %eax,%eax
jns    139f <main+0x13f>
lea    0xd34(%rip),%rdi
call   1140 <perror@plt>
mov    %ebx,%edi
call   10c0 <close@plt>
mov    $0x1,%eax
add    $0x448,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebp
mov    %ebx,(%rsp)
lea    0xc68(%rip),%rdi
lea    0xd16(%rip),%rsi
call   1130 <fopen@plt>
test   %rax,%rax
jne    13d4 <main+0x174>
lea    0xd07(%rip),%rdi
call   1140 <perror@plt>
mov    %ebp,%edi
call   10c0 <close@plt>
mov    (%rsp),%edi
jmp    1383 <main+0x123>
mov    %rax,%r15
lea    0x40(%rsp),%rbx
lea    0x4(%rsp),%r12
lea    0xd2a(%rip),%r13
xor    %eax,%eax
jmp    1490 <main+0x230>
nop
lea    0xd25(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   10f0 <fflush@plt>
lea    0xd25(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1060 <fclose@plt>
lea    0xbf4(%rip),%r14
mov    %r14,%rdi
lea    0xbd7(%rip),%rsi
call   10d0 <replace_esc@plt>
lea    0xd0a(%rip),%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
call   10e0 <time@plt>
lea    0xd0b(%rip),%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%edi
mov    0x8(%rsp),%esi
call   1090 <difftime@plt>
mov    $0x2bc,%edi
sub    %eax,%edi
call   1170 <sleep@plt>
lea    0xcf5(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
lea    0xc4b(%rip),%rsi
call   1130 <fopen@plt>
mov    %rax,%r15
mov    $0x1,%al
test   %r15,%r15
je     13bc <main+0x15c>
test   $0x1,%al
jne    1530 <main+0x2d0>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
je     14e5 <main+0x285>
cmp    $0xffffffff,%eax
je     15c9 <main+0x369>
cltq
movb   $0x0,0x40(%rsp,%rax,1)
lea    0xc38(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xcb9(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   10a0 <fputs@plt>
movl   $0x14,0x28(%rsp)
movq   $0x0,0x30(%rsp)
mov    0x2aeb(%rip),%rax
mov    (%rax),%esi
mov    0x2aba(%rip),%rax
mov    (%rax),%edx
mov    %ebp,%edi
lea    0x28(%rsp),%rcx
mov    $0x10,%r8d
call   1050 <setsockopt@plt>
test   %rax,%rax
jns    1530 <main+0x2d0>
lea    0xbd9(%rip),%rdi
call   1120 <error@plt>
nopl   0x0(%rax,%rax,1)
lea    0x8(%rsp),%rdi
call   10e0 <time@plt>
jmp    15a1 <main+0x341>
nopl   0x0(%rax)
cltq
movb   $0x0,0x40(%rsp,%rax,1)
lea    0xbae(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xc14(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   10a0 <fputs@plt>
mov    %r12,%rdi
call   10e0 <time@plt>
mov    0x4(%rsp),%edi
mov    0x8(%rsp),%esi
call   1090 <difftime@plt>
mov    %rax,%r14
mov    %r13,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1080 <printf@plt>
cmp    $0x12c,%r14d
jge    13f0 <main+0x190>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
je     156f <main+0x30f>
cmp    $0xffffffff,%eax
jne    1540 <main+0x2e0>
lea    0xbc1(%rip),%rdi
call   1040 <puts@plt>
jmp    156f <main+0x30f>
lea    0xb19(%rip),%rdi
call   1140 <perror@plt>
mov    (%rsp),%edi
call   10c0 <close@plt>
mov    %ebp,%edi
jmp    1383 <main+0x123>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32 }
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.tm = type { i32 }
%struct.timeval = type { i32, i64 }
%struct.sockaddr = type { i32 }
@.str = [19 x i8] c"/opt/gclc/gclc.log\00"
@.str.1 = [18 x i8] c"/opt/gclc/tmp.log\00"
@.str.2 = [12 x i8] c"79.98.21.68\00"
@.str.3 = [5 x i8] c"7777\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@.str.4 = [27 x i8] c"Server: Getaddrinfo error\0A\00"
@.str.5 = [39 x i8] c"Server: Error when creating the socket\00"
@.str.6 = [38 x i8] c"Server: Error while binding to socket\00"
@.str.7 = [30 x i8] c"Server: Error while listening\00"
@.str.8 = [24 x i8] c"Server: Error on accept\00"
@.str.9 = [2 x i8] c"w\00"
@.str.10 = [31 x i8] c"Server: Error opening the file\00"
@.str.11 = [19 x i8] c"Server: Error recv\00"
@.str.12 = [3 x i8] c"%s\00"
@.str.13 = [14 x i8] c"***TEAM40***\0A\00"
@SOL_SOCKET = global i32 0
@SO_RCVTIMEO = global i32 0
@.str.14 = [19 x i8] c"setsockopt failed\0A\00"
@.str.15 = [12 x i8] c"***timeout\0A\00"
@.str.16 = [17 x i8] c"***DELIMITER***\0A\00"
@.str.17 = [10 x i8] c"DIFF: %d\0A\00"
@.str.18 = [21 x i8] c"***out of the while\0A\00"
@.str.19 = [16 x i8] c"***after flush\0A\00"
@.str.20 = [22 x i8] c"***after replacement\0A\00"
@.str.21 = [16 x i8] c"GOING TO SLEEP\0A\00"
@.str.22 = [17 x i8] c"END OF SLEEPING\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca %struct.addrinfo
%7 = alloca %struct.addrinfo*
%8 = alloca %struct.sockaddr_in
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca [1024 x i8]
%17 = alloca i32
%18 = alloca i32
%19 = alloca %struct.tm*
%20 = alloca %struct.timeval
store i32 0, i32* %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8** %4
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8** %5
store i32 1, i32* %15
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i32 %21, i32* %22
%23 = load i8*, i8** %5
%24 = call i32 @atoi(i8* %23)
%25 = call i32 @htons(i32 %24)
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
store i32 %25, i32* %26
%27 = load i32, i32* @INADDR_ANY
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
%29 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %28, i32 0, i32 0
store i32 %27, i32* %29
%30 = call i32 @memset(%struct.addrinfo* %6, i32 0, i32 8)
%31 = load i32, i32* @AF_UNSPEC
%32 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 1
store i32 %31, i32* %32
%33 = load i32, i32* @SOCK_STREAM
%34 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 0
store i32 %33, i32* %34
%35 = load i8*, i8** %5
%36 = call i64 @getaddrinfo(i32* null, i8* %35, %struct.addrinfo* %6, %struct.addrinfo** %7)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %0
%39 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %1
br label %179
40: ; preds = %0
%41 = load i32, i32* @AF_INET
%42 = load i32, i32* @SOCK_STREAM
%43 = call i32 @socket(i32 %41, i32 %42, i32 0)
store i32 %43, i32* %11
%44 = icmp slt i32 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %40
%46 = call i32 @perror(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %1
br label %179
47: ; preds = %40
%48 = load i32, i32* %11
%49 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%50 = call i64 @bind(i32 %48, %struct.sockaddr* %49, i32 12)
%51 = icmp ne i64 %50, 0
br i1 %51, label %52, label %56
52: ; preds = %47
%53 = call i32 @perror(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0))
%54 = load i32, i32* %11
%55 = call i32 @close(i32 %54)
store i32 1, i32* %1
br label %179
56: ; preds = %47
%57 = load i32, i32* %11
%58 = call i32 @listen(i32 %57, i32 5)
%59 = icmp eq i32 %58, -1
br i1 %59, label %60, label %64
60: ; preds = %56
%61 = call i32 @perror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%62 = load i32, i32* %11
%63 = call i32 @close(i32 %62)
store i32 -1, i32* %1
br label %179
64: ; preds = %56
store i32 12, i32* %9
%65 = load i32, i32* %11
%66 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%67 = call i32 @accept(i32 %65, %struct.sockaddr* %66, i32* %9)
store i32 %67, i32* %12
%68 = icmp slt i32 %67, 0
br i1 %68, label %69, label %73
69: ; preds = %64
%70 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
%71 = load i32, i32* %11
%72 = call i32 @close(i32 %71)
store i32 1, i32* %1
br label %179
73: ; preds = %64
br label %74
74: ; preds = %73, %159
%75 = load i8*, i8** %3
%76 = call i32* @fopen(i8* %75, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32* %76, i32** %10
%77 = load i32*, i32** %10
%78 = icmp eq i32* %77, null
br i1 %78, label %79, label %85
79: ; preds = %74
%80 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0))
%81 = load i32, i32* %12
%82 = call i32 @close(i32 %81)
%83 = load i32, i32* %11
%84 = call i32 @close(i32 %83)
store i32 1, i32* %1
br label %179
85: ; preds = %74
%86 = load i32, i32* %15
%87 = icmp ne i32 %86, 0
br i1 %87, label %88, label %125
88: ; preds = %85
%89 = load i32, i32* %12
%90 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%91 = call i32 @recv(i32 %89, i8* %90, i32 1023, i32 0)
store i32 %91, i32* %13
%92 = icmp eq i32 %91, -1
br i1 %92, label %93, label %99
93: ; preds = %88
%94 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0))
%95 = load i32, i32* %11
%96 = call i32 @close(i32 %95)
%97 = load i32, i32* %12
%98 = call i32 @close(i32 %97)
store i32 1, i32* %1
br label %179
99: ; preds = %88
%100 = load i32, i32* %13
%101 = icmp ne i32 %100, 0
br i1 %101, label %102, label %112
102: ; preds = %99
%103 = load i32, i32* %13
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 %104
store i8 0, i8* %105
%106 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %106)
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0))
%109 = load i32*, i32** %10
%110 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%111 = call i32 @fprintf(i32* %109, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %110)
br label %112
112: ; preds = %102, %99
br label %113
113: ; preds = %112
%114 = getelementptr inbounds %struct.timeval, %struct.timeval* %20, i32 0, i32 0
store i32 20, i32* %114
%115 = getelementptr inbounds %struct.timeval, %struct.timeval* %20, i32 0, i32 1
store i64 0, i64* %115
%116 = load i32, i32* %12
%117 = load i32, i32* @SOL_SOCKET
%118 = load i32, i32* @SO_RCVTIMEO
%119 = bitcast %struct.timeval* %20 to i8*
%120 = call i64 @setsockopt(i32 %116, i32 %117, i32 %118, i8* %119, i32 16)
%121 = icmp slt i64 %120, 0
br i1 %121, label %122, label %124
122: ; preds = %113
%123 = call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.14, i64 0, i64 0))
br label %124
124: ; preds = %122, %113
store i32 0, i32* %15
br label %125
125: ; preds = %124, %85
%126 = call i32 @time(i32* %17)
store i32 0, i32* %14
br label %127
127: ; preds = %151, %125
%128 = load i32, i32* %14
%129 = icmp slt i32 %128, 300
br i1 %129, label %130, label %159
130: ; preds = %127
%131 = load i32, i32* %12
%132 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%133 = call i32 @recv(i32 %131, i8* %132, i32 1023, i32 0)
store i32 %133, i32* %13
%134 = icmp eq i32 %133, -1
br i1 %134, label %135, label %137
135: ; preds = %130
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0))
br label %151
137: ; preds = %130
%138 = load i32, i32* %13
%139 = icmp ne i32 %138, 0
br i1 %139, label %140, label %150
140: ; preds = %137
%141 = load i32, i32* %13
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 %142
store i8 0, i8* %143
%144 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %144)
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.16, i64 0, i64 0))
%147 = load i32*, i32** %10
%148 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%149 = call i32 @fprintf(i32* %147, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %148)
br label %150
150: ; preds = %140, %137
br label %151
151: ; preds = %150, %135
%152 = call i32 @time(i32* %18)
%153 = load i32, i32* %18
%154 = load i32, i32* %17
%155 = call i64 @difftime(i32 %153, i32 %154)
%156 = trunc i64 %155 to i32
store i32 %156, i32* %14
%157 = load i32, i32* %14
%158 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.17, i64 0, i64 0), i32 %157)
br label %127
159: ; preds = %127
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.18, i64 0, i64 0))
%161 = load i32*, i32** %10
%162 = call i32 @fflush(i32* %161)
%163 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i64 0, i64 0))
%164 = load i32*, i32** %10
%165 = call i32 @fclose(i32* %164)
%166 = load i8*, i8** %3
%167 = load i8*, i8** %2
%168 = call i32 @replace_esc(i8* %166, i8* %167)
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.20, i64 0, i64 0))
%170 = call i32 @time(i32* %18)
%171 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.21, i64 0, i64 0))
%172 = load i32, i32* %18
%173 = load i32, i32* %17
%174 = call i64 @difftime(i32 %172, i32 %173)
%175 = trunc i64 %174 to i32
%176 = sub nsw i32 700, %175
%177 = call i32 @sleep(i32 %176)
%178 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.22, i64 0, i64 0))
br label %74
179: ; preds = %93, %79, %69, %60, %52, %45, %38
%180 = load i32, i32* %1
ret i32 %180
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32 }
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.timeval = type { i32, i64 }
%struct.tm = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [19 x i8] c"/opt/gclc/gclc.log\00"
@.str.1 = [18 x i8] c"/opt/gclc/tmp.log\00"
@.str.3 = [5 x i8] c"7777\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@.str.4 = [27 x i8] c"Server: Getaddrinfo error\0A\00"
@.str.5 = [39 x i8] c"Server: Error when creating the socket\00"
@.str.6 = [38 x i8] c"Server: Error while binding to socket\00"
@.str.7 = [30 x i8] c"Server: Error while listening\00"
@.str.8 = [24 x i8] c"Server: Error on accept\00"
@.str.9 = [2 x i8] c"w\00"
@.str.10 = [31 x i8] c"Server: Error opening the file\00"
@.str.11 = [19 x i8] c"Server: Error recv\00"
@.str.12 = [3 x i8] c"%s\00"
@SOL_SOCKET = global i32 0
@SO_RCVTIMEO = global i32 0
@.str.14 = [19 x i8] c"setsockopt failed\0A\00"
@.str.17 = [10 x i8] c"DIFF: %d\0A\00"
@str = [20 x i8] c"***out of the while\00"
@str.23 = [15 x i8] c"***after flush\00"
@str.24 = [21 x i8] c"***after replacement\00"
@str.25 = [15 x i8] c"GOING TO SLEEP\00"
@str.26 = [16 x i8] c"END OF SLEEPING\00"
@str.27 = [16 x i8] c"***DELIMITER***\00"
@str.28 = [11 x i8] c"***timeout\00"
@str.29 = [13 x i8] c"***TEAM40***\00"
define i32 @main() {
%1 = alloca %struct.addrinfo
%2 = alloca %struct.addrinfo*
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
%5 = alloca [1024 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.timeval
%9 = bitcast %struct.addrinfo* %1 to i8*
%10 = bitcast %struct.addrinfo** %2 to i8*
%11 = bitcast %struct.sockaddr_in* %3 to i8*
%12 = bitcast i32* %4 to i8*
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%14 = bitcast i32* %6 to i8*
%15 = bitcast i32* %7 to i8*
%16 = load i32, i32* @AF_INET
%17 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %16, i32* %17
%18 = tail call i32 @htons(i32 7777)
%19 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %18, i32* %19
%20 = load i32, i32* @INADDR_ANY
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i32 %20, i32* %21
%22 = call i32 @memset(%struct.addrinfo* %1, i32 0, i32 8)
%23 = load i32, i32* @AF_UNSPEC
%24 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %1, i64 0, i32 1
store i32 %23, i32* %24
%25 = load i32, i32* @SOCK_STREAM
%26 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %1, i64 0, i32 0
store i32 %25, i32* %26
%27 = call i64 @getaddrinfo(i32* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %struct.addrinfo* %1, %struct.addrinfo** %2)
%28 = icmp eq i64 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %0
%30 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %129
31: ; preds = %0
%32 = load i32, i32* @AF_INET
%33 = load i32, i32* @SOCK_STREAM
%34 = call i32 @socket(i32 %32, i32 %33, i32 0)
%35 = icmp slt i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = call i32 @perror(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
br label %129
38: ; preds = %31
%39 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%40 = call i64 @bind(i32 %34, %struct.sockaddr* %39, i32 12)
%41 = icmp eq i64 %40, 0
br i1 %41, label %45, label %42
42: ; preds = %38
%43 = call i32 @perror(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0))
%44 = call i32 @close(i32 %34)
br label %129
45: ; preds = %38
%46 = call i32 @listen(i32 %34, i32 5)
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %51
48: ; preds = %45
%49 = call i32 @perror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%50 = call i32 @close(i32 %34)
br label %129
51: ; preds = %45
store i32 12, i32* %4
%52 = call i32 @accept(i32 %34, %struct.sockaddr* %39, i32* %4)
%53 = icmp slt i32 %52, 0
br i1 %53, label %61, label %54
54: ; preds = %51
%55 = call i32* @fopen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%56 = icmp eq i32* %55, null
br i1 %56, label %64, label %57
57: ; preds = %54
%58 = bitcast %struct.timeval* %8 to i8*
%59 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i64 0, i32 0
%60 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i64 0, i32 1
br label %68
61: ; preds = %51
%62 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
%63 = call i32 @close(i32 %34)
br label %129
64: ; preds = %111, %54
%65 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0))
%66 = call i32 @close(i32 %52)
%67 = call i32 @close(i32 %34)
br label %129
68: ; preds = %57, %111
%69 = phi i32* [ %55, %57 ], [ %127, %111 ]
%70 = phi i1 [ false, %57 ], [ true, %111 ]
br i1 %70, label %91, label %71
71: ; preds = %68
%72 = call i32 @recv(i32 %52, i8* %13, i32 1023, i32 0)
switch i32 %72, label %77 [
i32 -1, label %73
i32 0, label %83
]
73: ; preds = %71
%74 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0))
%75 = call i32 @close(i32 %34)
%76 = call i32 @close(i32 %52)
br label %129
77: ; preds = %71
%78 = sext i32 %72 to i64
%79 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %78
store i8 0, i8* %79
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %13)
%81 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.29, i64 0, i64 0))
%82 = call i32 @fputs(i8* %13, i32* %69)
br label %83
83: ; preds = %71, %77
store i32 20, i32* %59
store i64 0, i64* %60
%84 = load i32, i32* @SOL_SOCKET
%85 = load i32, i32* @SO_RCVTIMEO
%86 = call i64 @setsockopt(i32 %52, i32 %84, i32 %85, i8* %58, i32 16)
%87 = icmp slt i64 %86, 0
br i1 %87, label %88, label %90
88: ; preds = %83
%89 = call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.14, i64 0, i64 0))
br label %90
90: ; preds = %88, %83
br label %91
91: ; preds = %90, %68
%92 = call i32 @time(i32* %6)
br label %93
93: ; preds = %91, %103
%94 = call i32 @recv(i32 %52, i8* %13, i32 1023, i32 0)
switch i32 %94, label %97 [
i32 -1, label %95
i32 0, label %103
]
95: ; preds = %93
%96 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.28, i64 0, i64 0))
br label %103
97: ; preds = %93
%98 = sext i32 %94 to i64
%99 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %98
store i8 0, i8* %99
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %13)
%101 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.27, i64 0, i64 0))
%102 = call i32 @fputs(i8* %13, i32* %69)
br label %103
103: ; preds = %93, %97, %95
%104 = call i32 @time(i32* %7)
%105 = load i32, i32* %7
%106 = load i32, i32* %6
%107 = call i64 @difftime(i32 %105, i32 %106)
%108 = trunc i64 %107 to i32
%109 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.17, i64 0, i64 0), i32 %108)
%110 = icmp slt i32 %108, 300
br i1 %110, label %93, label %111
111: ; preds = %103
%112 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%113 = call i32 @fflush(i32* %69)
%114 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.23, i64 0, i64 0))
%115 = call i32 @fclose(i32* %69)
%116 = call i32 @replace_esc(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%117 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.24, i64 0, i64 0))
%118 = call i32 @time(i32* %7)
%119 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.25, i64 0, i64 0))
%120 = load i32, i32* %7
%121 = load i32, i32* %6
%122 = call i64 @difftime(i32 %120, i32 %121)
%123 = trunc i64 %122 to i32
%124 = sub nsw i32 700, %123
%125 = call i32 @sleep(i32 %124)
%126 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.26, i64 0, i64 0))
%127 = call i32* @fopen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%128 = icmp eq i32* %127, null
br i1 %128, label %64, label %68
129: ; preds = %73, %64, %61, %48, %42, %36, %29
%130 = phi i32 [ 1, %29 ], [ 1, %36 ], [ 1, %42 ], [ -1, %48 ], [ 1, %61 ], [ 1, %64 ], [ 1, %73 ]
ret i32 %130
}