#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 */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  int /*<<< orphan*/ h_length;
  scalar_t__ h_addr;
};
typedef int /*<<< orphan*/ serv_addr;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
scalar_t__ EOF;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ bcopy(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ bzero(char *, int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *);
char *getcwd(int /*<<< orphan*/ *, int /*<<< orphan*/);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htons(int);
int *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ printf(char *, char *, ...);
int read(int, char *, int);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char *);
int write(int, char *, int /*<<< orphan*/);
int startFunction(int portno, char *filename, char *sleepingTime) {
  int ii = 0;
  int *sockfd, n;
  FILE *fd;
  char buffer[256];
  char nameIP[25];
  int countIP = 0;
  char *workingDir = getcwd(NULL, 0);
  printf("Open File:%s %s\n", filename, workingDir);
  printf("VALUE:%s", sleepingTime);
  if ((fd = fopen(filename, "r")) == NULL) {
    error("ERROR opening file");
    return -1;
  }
  while (fscanf(fd, "%s", nameIP) != EOF) {
    if (nameIP[0] != '#') {
      countIP++;
    }
  }
  rewind(fd);
  char **IP = (char **)malloc(countIP * sizeof(char *));
  while (fscanf(fd, "%s", nameIP) != EOF) {
    if (nameIP[0] != '#') {
      IP[ii] = (char *)malloc(15 * sizeof(char));
      memcpy(IP[ii], nameIP, 15);
      ii++;
    } else {
      printf("NAME PC:%s\n", nameIP);
    }
  }
  fclose(fd);
  sockfd = malloc(sizeof(int) * countIP);
  for (ii = 0; ii < countIP; ii++) {
    struct sockaddr_in serv_addr;
    struct hostent *server;
    printf("IP:%s\n", IP[ii]);
    sockfd[ii] = socket(AF_INET, SOCK_STREAM, 0);
    if (sockfd[ii] < 0)
      error("ERROR opening socket");
    server = gethostbyname(IP[ii]);
    if (server == NULL) {
      fprintf(stderr, "ERROR, no such host\n");
      exit(0);
    }
    bzero((char *)&serv_addr, sizeof(serv_addr));
    serv_addr.sin_family = AF_INET;
    bcopy((char *)server->h_addr, (char *)&serv_addr.sin_addr.s_addr,
          server->h_length);
    serv_addr.sin_port = htons(portno);
    if (connect(sockfd[ii], (struct sockaddr *)&serv_addr, sizeof(serv_addr)) <
        0)
      error("ERROR connecting");
    n = write(sockfd[ii], sleepingTime, strlen(sleepingTime));
    if (n < 0)
      error("ERROR writing to socket");
    bzero(buffer, 256);
    n = read(sockfd[ii], buffer, 255);
    if (n < 0)
      error("ERROR reading from socket");
    printf("IP:%s TIME:%s \n", IP[ii], buffer);
  }
  return 0;
}


x86 assembly (clang, -O0):
<startFunction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x164(%rbp)
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
call   10a0 <getcwd@plt>
mov    %rax,-0x170(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x170(%rbp),%rdx
lea    0xd75(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xd74(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xd6b(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    12da <startFunction+0x9a>
lea    0xd53(%rip),%rdi
call   1110 <error@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1617 <startFunction+0x3d7>
jmp    12df <startFunction+0x9f>
mov    -0x38(%rbp),%rdi
lea    -0x160(%rbp),%rdx
lea    0xd26(%rip),%rsi
call   1090 <fscanf@plt>
mov    0x2ce3(%rip),%rcx
cmp    (%rcx),%rax
je     132a <startFunction+0xea>
movsbl -0x160(%rbp),%eax
cmp    $0x23,%eax
je     1325 <startFunction+0xe5>
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
jmp    12df <startFunction+0x9f>
mov    -0x38(%rbp),%rdi
call   1080 <rewind@plt>
movslq -0x164(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   10f0 <malloc@plt>
mov    %rax,-0x178(%rbp)
mov    -0x38(%rbp),%rdi
lea    -0x160(%rbp),%rdx
lea    0xcb9(%rip),%rsi
call   1090 <fscanf@plt>
mov    0x2c76(%rip),%rcx
cmp    (%rcx),%rax
je     13e7 <startFunction+0x1a7>
movsbl -0x160(%rbp),%eax
cmp    $0x23,%eax
je     13cd <startFunction+0x18d>
mov    $0xf,%edi
call   10f0 <malloc@plt>
mov    %rax,%rdx
mov    -0x178(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x178(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x160(%rbp),%rsi
mov    $0xf,%edx
call   10e0 <memcpy@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    13e2 <startFunction+0x1a2>
lea    -0x160(%rbp),%rsi
lea    0xc54(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    134c <startFunction+0x10c>
mov    -0x38(%rbp),%rdi
call   1040 <fclose@plt>
movslq -0x164(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10f0 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x164(%rbp),%eax
jge    1610 <startFunction+0x3d0>
mov    -0x178(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xc09(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2ba8(%rip),%rax
mov    (%rax),%edi
mov    0x2b7f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1160 <socket@plt>
mov    %eax,%edx
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jge    147d <startFunction+0x23d>
lea    0xbca(%rip),%rdi
call   1110 <error@plt>
mov    -0x178(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10c0 <gethostbyname@plt>
mov    %rax,-0x190(%rbp)
cmpq   $0x0,-0x190(%rbp)
jne    14c2 <startFunction+0x282>
mov    0x2b23(%rip),%rax
mov    (%rax),%edi
lea    0xba1(%rip),%rsi
call   10d0 <fprintf@plt>
xor    %edi,%edi
call   1140 <exit@plt>
lea    -0x188(%rbp),%rdi
mov    $0xc,%esi
call   1130 <bzero@plt>
mov    0x2b0e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x180(%rbp)
mov    -0x190(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x188(%rbp),%rsi
add    $0x4,%rsi
mov    -0x190(%rbp),%rax
mov    (%rax),%edx
call   1100 <bcopy@plt>
mov    -0x8(%rbp),%edi
call   1060 <htons@plt>
mov    %eax,-0x188(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
lea    -0x188(%rbp),%rsi
mov    $0xc,%edx
call   1150 <connect@plt>
cmp    $0x0,%rax
jge    1546 <startFunction+0x306>
lea    0xb2b(%rip),%rdi
call   1110 <error@plt>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x19c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x198(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x19c(%rbp),%edi
mov    -0x198(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    1598 <startFunction+0x358>
lea    0xaea(%rip),%rdi
call   1110 <error@plt>
lea    -0x140(%rbp),%rdi
mov    $0x100,%esi
call   1130 <bzero@plt>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
lea    -0x140(%rbp),%rsi
mov    $0xff,%edx
call   10b0 <read@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    15de <startFunction+0x39e>
lea    0xabc(%rip),%rdi
call   1110 <error@plt>
mov    -0x178(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    -0x140(%rbp),%rdx
lea    0xab4(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    140d <startFunction+0x1cd>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<startFunction>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x168,%rsp
mov    %rdx,%r14
mov    %rsi,%rbp
mov    %edi,0xc(%rsp)
xor    %ebx,%ebx
xor    %edi,%edi
xor    %esi,%esi
call   10a0 <getcwd@plt>
lea    0xd93(%rip),%rdi
mov    %rbp,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd90(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd88(%rip),%rsi
mov    %rbp,%rdi
call   1120 <fopen@plt>
test   %rax,%rax
je     14b7 <startFunction+0x277>
mov    %rax,%rbp
mov    %r14,0x30(%rsp)
lea    0xd65(%rip),%rsi
lea    0x40(%rsp),%rdx
mov    %rax,%rdi
call   1090 <fscanf@plt>
mov    0x2d1a(%rip),%r12
cmp    (%r12),%rax
je     1300 <startFunction+0xc0>
xor    %ebx,%ebx
lea    0xd42(%rip),%r14
lea    0x40(%rsp),%r15
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
cmpb   $0x23,0x40(%rsp)
setne  %al
add    %eax,%ebx
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1090 <fscanf@plt>
cmp    (%r12),%rax
jne    12e0 <startFunction+0xa0>
mov    %rbp,%rdi
call   1080 <rewind@plt>
lea    0x0(,%rbx,8),%edi
call   10f0 <malloc@plt>
mov    %rax,0x10(%rsp)
lea    0xcf7(%rip),%rsi
lea    0x40(%rsp),%rdx
mov    %rbp,%rdi
call   1090 <fscanf@plt>
cmp    (%r12),%rax
jne    14ca <startFunction+0x28a>
mov    %rbp,%rdi
call   1040 <fclose@plt>
lea    0x0(,%rbx,4),%edi
call   10f0 <malloc@plt>
mov    %rax,0x38(%rsp)
test   %ebx,%ebx
je     153c <startFunction+0x2fc>
mov    %ebx,%eax
mov    %rax,0x28(%rsp)
lea    0x60(%rsp),%r12
xor    %ebx,%ebx
jmp    1395 <startFunction+0x155>
nopl   0x0(%rax,%rax,1)
xor    %ebp,%ebp
lea    0xd36(%rip),%rdi
mov    %r14,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,0x28(%rsp)
je     153e <startFunction+0x2fe>
mov    0x10(%rsp),%rax
mov    (%rax,%rbx,8),%r14
lea    0xc96(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2c32(%rip),%rax
mov    (%rax),%edi
mov    0x2c09(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1160 <socket@plt>
mov    %eax,%r15d
mov    0x38(%rsp),%rax
mov    %r15d,(%rax,%rbx,4)
test   %r15d,%r15d
jns    13e5 <startFunction+0x1a5>
lea    0xc62(%rip),%rdi
call   1110 <error@plt>
mov    %r14,%rdi
call   10c0 <gethostbyname@plt>
test   %rax,%rax
je     1552 <startFunction+0x312>
mov    %rax,%rbp
lea    0x18(%rsp),%r13
mov    %r13,%rdi
mov    $0xc,%esi
call   1130 <bzero@plt>
mov    0x2bd6(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
mov    0x8(%rbp),%rsi
mov    0x0(%rbp),%edx
lea    0x1c(%rsp),%rdi
call   1100 <memmove@plt>
mov    0xc(%rsp),%edi
call   1060 <htons@plt>
mov    %eax,0x18(%rsp)
mov    %r15d,%edi
mov    %r13,%rsi
mov    $0xc,%edx
call   1150 <connect@plt>
test   %rax,%rax
jns    1457 <startFunction+0x217>
lea    0xc1a(%rip),%rdi
call   1110 <error@plt>
mov    0x30(%rsp),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %r15d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
call   1030 <write@plt>
test   %eax,%eax
jns    1481 <startFunction+0x241>
lea    0xc01(%rip),%rdi
call   1110 <error@plt>
mov    %r12,%rdi
mov    $0x100,%esi
call   1130 <bzero@plt>
mov    %r15d,%edi
mov    %r12,%rsi
mov    $0xff,%edx
call   10b0 <read@plt>
test   %eax,%eax
jns    1370 <startFunction+0x130>
lea    0xbe8(%rip),%rdi
call   1110 <error@plt>
jmp    1370 <startFunction+0x130>
lea    0xb5e(%rip),%rdi
call   1110 <error@plt>
mov    $0xffffffff,%ebp
jmp    153e <startFunction+0x2fe>
lea    0x40(%rsp),%r13
lea    0xb41(%rip),%r15
xor    %r14d,%r14d
jmp    1509 <startFunction+0x2c9>
nopl   0x0(%rax,%rax,1)
lea    0xb48(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   1090 <fscanf@plt>
cmp    (%r12),%rax
je     1337 <startFunction+0xf7>
cmpb   $0x23,0x40(%rsp)
je     14e0 <startFunction+0x2a0>
mov    $0xf,%edi
call   10f0 <malloc@plt>
movslq %r14d,%r14
mov    0x10(%rsp),%rcx
mov    %rax,(%rcx,%r14,8)
mov    %rax,%rdi
mov    %r13,%rsi
mov    $0xf,%edx
call   10e0 <memcpy@plt>
add    $0x1,%r14d
jmp    14f1 <startFunction+0x2b1>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x168,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a77(%rip),%rax
mov    (%rax),%edi
lea    0xaf5(%rip),%rsi
call   10d0 <fprintf@plt>
xor    %edi,%edi
call   1140 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i64 }
%struct.sockaddr = type { i32 }
@.str = [17 x i8] c"Open File:%s %s\0A\00"
@.str.1 = [9 x i8] c"VALUE:%s\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [19 x i8] c"ERROR opening file\00"
@.str.4 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.5 = [12 x i8] c"NAME PC:%s\0A\00"
@.str.6 = [7 x i8] c"IP:%s\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.7 = [21 x i8] c"ERROR opening socket\00"
@stderr = global i32 0
@.str.8 = [21 x i8] c"ERROR, no such host\0A\00"
@.str.9 = [17 x i8] c"ERROR connecting\00"
@.str.10 = [24 x i8] c"ERROR writing to socket\00"
@.str.11 = [26 x i8] c"ERROR reading from socket\00"
@.str.12 = [16 x i8] c"IP:%s TIME:%s \0A\00"
define i32 @startFunction(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32*
%12 = alloca [256 x i8]
%13 = alloca [25 x i8]
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i8**
%17 = alloca %struct.sockaddr_in
%18 = alloca %struct.hostent*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 0, i32* %8
store i32 0, i32* %14
%19 = call i8* @getcwd(i32* null, i32 0)
store i8* %19, i8** %15
%20 = load i8*, i8** %6
%21 = load i8*, i8** %15
%22 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %20, i8* %21)
%23 = load i8*, i8** %7
%24 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %23)
%25 = load i8*, i8** %6
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %26, i32** %11
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %30
28: ; preds = %3
%29 = call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %4
br label %202
30: ; preds = %3
br label %31
31: ; preds = %45, %30
%32 = load i32*, i32** %11
%33 = getelementptr inbounds [25 x i8], [25 x i8]* %13, i64 0, i64 0
%34 = call i64 @fscanf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %33)
%35 = load i64, i64* @EOF
%36 = icmp ne i64 %34, %35
br i1 %36, label %37, label %46
37: ; preds = %31
%38 = getelementptr inbounds [25 x i8], [25 x i8]* %13, i64 0, i64 0
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp ne i32 %40, 35
br i1 %41, label %42, label %45
42: ; preds = %37
%43 = load i32, i32* %14
%44 = add nsw i32 %43, 1
store i32 %44, i32* %14
br label %45
45: ; preds = %42, %37
br label %31
46: ; preds = %31
%47 = load i32*, i32** %11
%48 = call i32 @rewind(i32* %47)
%49 = load i32, i32* %14
%50 = sext i32 %49 to i64
%51 = mul i64 %50, 8
%52 = trunc i64 %51 to i32
%53 = call i32* @malloc(i32 %52)
%54 = bitcast i32* %53 to i8**
store i8** %54, i8*** %16
br label %55
55: ; preds = %85, %46
%56 = load i32*, i32** %11
%57 = getelementptr inbounds [25 x i8], [25 x i8]* %13, i64 0, i64 0
%58 = call i64 @fscanf(i32* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %57)
%59 = load i64, i64* @EOF
%60 = icmp ne i64 %58, %59
br i1 %60, label %61, label %86
61: ; preds = %55
%62 = getelementptr inbounds [25 x i8], [25 x i8]* %13, i64 0, i64 0
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = icmp ne i32 %64, 35
br i1 %65, label %66, label %82
66: ; preds = %61
%67 = call i32* @malloc(i32 15)
%68 = bitcast i32* %67 to i8*
%69 = load i8**, i8*** %16
%70 = load i32, i32* %8
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8*, i8** %69, i64 %71
store i8* %68, i8** %72
%73 = load i8**, i8*** %16
%74 = load i32, i32* %8
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8*, i8** %73, i64 %75
%77 = load i8*, i8** %76
%78 = getelementptr inbounds [25 x i8], [25 x i8]* %13, i64 0, i64 0
%79 = call i32 @memcpy(i8* %77, i8* %78, i32 15)
%80 = load i32, i32* %8
%81 = add nsw i32 %80, 1
store i32 %81, i32* %8
br label %85
82: ; preds = %61
%83 = getelementptr inbounds [25 x i8], [25 x i8]* %13, i64 0, i64 0
%84 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %83)
br label %85
85: ; preds = %82, %66
br label %55
86: ; preds = %55
%87 = load i32*, i32** %11
%88 = call i32 @fclose(i32* %87)
%89 = load i32, i32* %14
%90 = sext i32 %89 to i64
%91 = mul i64 4, %90
%92 = trunc i64 %91 to i32
%93 = call i32* @malloc(i32 %92)
store i32* %93, i32** %9
store i32 0, i32* %8
br label %94
94: ; preds = %198, %86
%95 = load i32, i32* %8
%96 = load i32, i32* %14
%97 = icmp slt i32 %95, %96
br i1 %97, label %98, label %201
98: ; preds = %94
%99 = load i8**, i8*** %16
%100 = load i32, i32* %8
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i8*, i8** %99, i64 %101
%103 = load i8*, i8** %102
%104 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %103)
%105 = load i32, i32* @AF_INET
%106 = load i32, i32* @SOCK_STREAM
%107 = call i32 @socket(i32 %105, i32 %106, i32 0)
%108 = load i32*, i32** %9
%109 = load i32, i32* %8
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i32, i32* %108, i64 %110
store i32 %107, i32* %111
%112 = load i32*, i32** %9
%113 = load i32, i32* %8
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds i32, i32* %112, i64 %114
%116 = load i32, i32* %115
%117 = icmp slt i32 %116, 0
br i1 %117, label %118, label %120
118: ; preds = %98
%119 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
br label %120
120: ; preds = %118, %98
%121 = load i8**, i8*** %16
%122 = load i32, i32* %8
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds i8*, i8** %121, i64 %123
%125 = load i8*, i8** %124
%126 = call %struct.hostent* @gethostbyname(i8* %125)
store %struct.hostent* %126, %struct.hostent** %18
%127 = load %struct.hostent*, %struct.hostent** %18
%128 = icmp eq %struct.hostent* %127, null
br i1 %128, label %129, label %133
129: ; preds = %120
%130 = load i32, i32* @stderr
%131 = call i32 @fprintf(i32 %130, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%132 = call i32 @exit(i32 0)
unreachable
133: ; preds = %120
%134 = bitcast %struct.sockaddr_in* %17 to i8*
%135 = call i32 @bzero(i8* %134, i32 12)
%136 = load i32, i32* @AF_INET
%137 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %17, i32 0, i32 2
store i32 %136, i32* %137
%138 = load %struct.hostent*, %struct.hostent** %18
%139 = getelementptr inbounds %struct.hostent, %struct.hostent* %138, i32 0, i32 1
%140 = load i64, i64* %139
%141 = inttoptr i64 %140 to i8*
%142 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %17, i32 0, i32 1
%143 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %142, i32 0, i32 0
%144 = bitcast i32* %143 to i8*
%145 = load %struct.hostent*, %struct.hostent** %18
%146 = getelementptr inbounds %struct.hostent, %struct.hostent* %145, i32 0, i32 0
%147 = load i32, i32* %146
%148 = call i32 @bcopy(i8* %141, i8* %144, i32 %147)
%149 = load i32, i32* %5
%150 = call i32 @htons(i32 %149)
%151 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %17, i32 0, i32 0
store i32 %150, i32* %151
%152 = load i32*, i32** %9
%153 = load i32, i32* %8
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds i32, i32* %152, i64 %154
%156 = load i32, i32* %155
%157 = bitcast %struct.sockaddr_in* %17 to %struct.sockaddr*
%158 = call i64 @connect(i32 %156, %struct.sockaddr* %157, i32 12)
%159 = icmp slt i64 %158, 0
br i1 %159, label %160, label %162
160: ; preds = %133
%161 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
br label %162
162: ; preds = %160, %133
%163 = load i32*, i32** %9
%164 = load i32, i32* %8
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds i32, i32* %163, i64 %165
%167 = load i32, i32* %166
%168 = load i8*, i8** %7
%169 = load i8*, i8** %7
%170 = call i32 @strlen(i8* %169)
%171 = call i32 @write(i32 %167, i8* %168, i32 %170)
store i32 %171, i32* %10
%172 = load i32, i32* %10
%173 = icmp slt i32 %172, 0
br i1 %173, label %174, label %176
174: ; preds = %162
%175 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
br label %176
176: ; preds = %174, %162
%177 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%178 = call i32 @bzero(i8* %177, i32 256)
%179 = load i32*, i32** %9
%180 = load i32, i32* %8
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds i32, i32* %179, i64 %181
%183 = load i32, i32* %182
%184 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%185 = call i32 @read(i32 %183, i8* %184, i32 255)
store i32 %185, i32* %10
%186 = load i32, i32* %10
%187 = icmp slt i32 %186, 0
br i1 %187, label %188, label %190
188: ; preds = %176
%189 = call i32 @error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0))
br label %190
190: ; preds = %188, %176
%191 = load i8**, i8*** %16
%192 = load i32, i32* %8
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds i8*, i8** %191, i64 %193
%195 = load i8*, i8** %194
%196 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%197 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i8* %195, i8* %196)
br label %198
198: ; preds = %190
%199 = load i32, i32* %8
%200 = add nsw i32 %199, 1
store i32 %200, i32* %8
br label %94
201: ; preds = %94
store i32 0, i32* %4
br label %202
202: ; preds = %201, %28
%203 = load i32, i32* %4
ret i32 %203
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
%struct.hostent = type { i32, i64 }
@.str = [17 x i8] c"Open File:%s %s\0A\00"
@.str.1 = [9 x i8] c"VALUE:%s\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [19 x i8] c"ERROR opening file\00"
@.str.4 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.5 = [12 x i8] c"NAME PC:%s\0A\00"
@.str.6 = [7 x i8] c"IP:%s\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.7 = [21 x i8] c"ERROR opening socket\00"
@stderr = global i32 0
@.str.8 = [21 x i8] c"ERROR, no such host\0A\00"
@.str.9 = [17 x i8] c"ERROR connecting\00"
@.str.10 = [24 x i8] c"ERROR writing to socket\00"
@.str.11 = [26 x i8] c"ERROR reading from socket\00"
@.str.12 = [16 x i8] c"IP:%s TIME:%s \0A\00"
define i32 @startFunction(i32 %0, i8* %1, i8* %2) {
%4 = alloca [256 x i8]
%5 = alloca [25 x i8]
%6 = alloca %struct.sockaddr_in
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [25 x i8], [25 x i8]* %5, i64 0, i64 0
%9 = tail call i8* @getcwd(i32* null, i32 0)
%10 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %9)
%11 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%12 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %18, label %14
14: ; preds = %3
%15 = call i64 @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %8)
%16 = load i64, i64* @EOF
%17 = icmp eq i64 %15, %16
br i1 %17, label %29, label %20
18: ; preds = %3
%19 = tail call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %118
20: ; preds = %14, %20
%21 = phi i32 [ %25, %20 ], [ 0, %14 ]
%22 = load i8, i8* %8
%23 = icmp ne i8 %22, 35
%24 = zext i1 %23 to i32
%25 = add nuw nsw i32 %21, %24
%26 = call i64 @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %8)
%27 = load i64, i64* @EOF
%28 = icmp eq i64 %26, %27
br i1 %28, label %29, label %20
29: ; preds = %20, %14
%30 = phi i32 [ 0, %14 ], [ %25, %20 ]
%31 = call i32 @rewind(i32* %12)
%32 = shl i32 %30, 3
%33 = call i32* @malloc(i32 %32)
%34 = bitcast i32* %33 to i8**
%35 = call i64 @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %8)
%36 = load i64, i64* @EOF
%37 = icmp eq i64 %35, %36
br i1 %37, label %57, label %38
38: ; preds = %29, %52
%39 = phi i32 [ %53, %52 ], [ 0, %29 ]
%40 = load i8, i8* %8
%41 = icmp eq i8 %40, 35
br i1 %41, label %50, label %42
42: ; preds = %38
%43 = call i32* @malloc(i32 15)
%44 = bitcast i32* %43 to i8*
%45 = sext i32 %39 to i64
%46 = getelementptr inbounds i8*, i8** %34, i64 %45
%47 = bitcast i8** %46 to i32**
store i32* %43, i32** %47
%48 = call i32 @memcpy(i8* %44, i8* %8, i32 15)
%49 = add nsw i32 %39, 1
br label %52
50: ; preds = %38
%51 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %8)
br label %52
52: ; preds = %50, %42
%53 = phi i32 [ %49, %42 ], [ %39, %50 ]
%54 = call i64 @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %8)
%55 = load i64, i64* @EOF
%56 = icmp eq i64 %54, %55
br i1 %56, label %57, label %38
57: ; preds = %52, %29
%58 = call i32 @fclose(i32* %12)
%59 = shl i32 %30, 2
%60 = call i32* @malloc(i32 %59)
%61 = icmp eq i32 %30, 0
br i1 %61, label %118, label %62
62: ; preds = %57
%63 = bitcast %struct.sockaddr_in* %6 to i8*
%64 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 2
%65 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 1, i32 0
%66 = bitcast i32* %65 to i8*
%67 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 0
%68 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%69 = zext i32 %30 to i64
br label %70
70: ; preds = %62, %114
%71 = phi i64 [ 0, %62 ], [ %116, %114 ]
%72 = getelementptr inbounds i8*, i8** %34, i64 %71
%73 = load i8*, i8** %72
%74 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %73)
%75 = load i32, i32* @AF_INET
%76 = load i32, i32* @SOCK_STREAM
%77 = call i32 @socket(i32 %75, i32 %76, i32 0)
%78 = getelementptr inbounds i32, i32* %60, i64 %71
store i32 %77, i32* %78
%79 = icmp slt i32 %77, 0
br i1 %79, label %80, label %82
80: ; preds = %70
%81 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
br label %82
82: ; preds = %80, %70
%83 = call %struct.hostent* @gethostbyname(i8* %73)
%84 = icmp eq %struct.hostent* %83, null
br i1 %84, label %85, label %89
85: ; preds = %82
%86 = load i32, i32* @stderr
%87 = call i32 @fprintf(i32 %86, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%88 = call i32 @exit(i32 0)
unreachable
89: ; preds = %82
%90 = call i32 @bzero(i8* %63, i32 12)
%91 = load i32, i32* @AF_INET
store i32 %91, i32* %64
%92 = getelementptr inbounds %struct.hostent, %struct.hostent* %83, i64 0, i32 1
%93 = load i64, i64* %92
%94 = inttoptr i64 %93 to i8*
%95 = getelementptr inbounds %struct.hostent, %struct.hostent* %83, i64 0, i32 0
%96 = load i32, i32* %95
%97 = call i32 @htons(i32 %0)
store i32 %97, i32* %67
%98 = call i64 @connect(i32 %77, %struct.sockaddr* %68, i32 12)
%99 = icmp slt i64 %98, 0
br i1 %99, label %100, label %102
100: ; preds = %89
%101 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
br label %102
102: ; preds = %100, %89
%103 = call i32 @strlen(i8* %2)
%104 = call i32 @write(i32 %77, i8* %2, i32 %103)
%105 = icmp slt i32 %104, 0
br i1 %105, label %106, label %108
106: ; preds = %102
%107 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
br label %108
108: ; preds = %106, %102
%109 = call i32 @bzero(i8* %7, i32 256)
%110 = call i32 @read(i32 %77, i8* %7, i32 255)
%111 = icmp slt i32 %110, 0
br i1 %111, label %112, label %114
112: ; preds = %108
%113 = call i32 @error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0))
br label %114
114: ; preds = %112, %108
%115 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i8* %73, i8* %7)
%116 = add nuw nsw i64 %71, 1
%117 = icmp eq i64 %116, %69
br i1 %117, label %118, label %70
118: ; preds = %114, %57, %18
%119 = phi i32 [ -1, %18 ], [ 0, %57 ], [ 0, %114 ]
ret i32 %119
}