#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 {
  TYPE_1__ sin_addr;
  void *sin_port;
  void *sin_family;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  int /*<<< orphan*/ h_length;
  int /*<<< orphan*/ *h_addr_list;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ servaddr;
typedef int /*<<< orphan*/ myaddr;
typedef int /*<<< orphan*/ caddr_t;

/* Variables and functions */
void *AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ bcopy(int /*<<< orphan*/, int /*<<< orphan*/,
                         int /*<<< orphan*/);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
void *htons(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int read(int, char *, int);
int sendto(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int);
int socket(void *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int fd;
  socklen_t size;
  int fdesc;
  int ndata;
  char data[1024];
  char data1[1024];
  struct hostent *hp;
  struct sockaddr_in myaddr;
  struct sockaddr_in servaddr;
  if (argc < 3) {
    fprintf(stderr, "Usage: %s host_name(IP address) file_name\n", argv[0]);
    exit(2);
  }
  if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
    perror("socket failed!");
    exit(1);
  }
  bzero((char *)&myaddr, sizeof(myaddr));
  myaddr.sin_family = AF_INET;
  myaddr.sin_addr.s_addr = htonl(INADDR_ANY);
  myaddr.sin_port = htons(0);
  if (bind(fd, (struct sockaddr *)&myaddr, sizeof(myaddr)) < 0) {
    perror("bind failed!");
    exit(1);
  }
  bzero((char *)&servaddr, sizeof(servaddr));
  servaddr.sin_family = AF_INET;
  servaddr.sin_port = htons(5134);
  hp = gethostbyname(argv[1]);
  if (hp == 0) {
    fprintf(stderr, "could not obtain address of %s\n", argv[2]);
    return (-1);
  }
  bcopy(hp->h_addr_list[0], (caddr_t)&servaddr.sin_addr, hp->h_length);
  fdesc = open(argv[2], O_RDONLY);
  if (fdesc == -1) {
    perror("open file error!");
    exit(1);
  }
  ndata = read(fdesc, data, 1024);
  if (ndata < 0) {
    perror("read file error !");
    exit(1);
  }
  data[ndata + 1] = '\0';
  size = sizeof(servaddr);
  if (sendto(fd, data, ndata, 0, (struct sockaddr *)&servaddr, size) == -1) {
    perror("write to server error !");
    exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x860,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1219 <main+0x49>
mov    0x2dc6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdf6(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x2,%edi
call   10e0 <exit@plt>
mov    0x2dc8(%rip),%rax
mov    (%rax),%rdi
mov    0x2da6(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1255 <main+0x85>
lea    0xde5(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    -0x840(%rbp),%rdi
mov    $0x18,%esi
call   10d0 <bzero@plt>
mov    0x2d7b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x830(%rbp)
mov    0x2d5a(%rip),%rax
mov    (%rax),%edi
call   1040 <htonl@plt>
mov    %eax,-0x840(%rbp)
xor    %edi,%edi
call   1030 <htons@plt>
mov    %rax,-0x838(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x840(%rbp),%rsi
mov    $0x18,%edx
call   10a0 <bind@plt>
cmp    $0x0,%rax
jge    12cd <main+0xfd>
lea    0xd7c(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    -0x858(%rbp),%rdi
mov    $0x18,%esi
call   10d0 <bzero@plt>
mov    0x2d03(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x848(%rbp)
mov    $0x140e,%edi
call   1030 <htons@plt>
mov    %rax,-0x850(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <gethostbyname@plt>
mov    %rax,-0x828(%rbp)
cmpq   $0x0,-0x828(%rbp)
jne    134b <main+0x17b>
mov    0x2c97(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xd0d(%rip),%rsi
call   1080 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    143b <main+0x26b>
mov    -0x828(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%edi
lea    -0x858(%rbp),%rax
mov    %eax,%esi
mov    -0x828(%rbp),%rax
mov    (%rax),%edx
call   1090 <bcopy@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x2c62(%rip),%rax
mov    (%rax),%esi
call   10b0 <open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    13a8 <main+0x1d8>
lea    0xcce(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x1c(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
call   1060 <read@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    13df <main+0x20f>
lea    0xca8(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x0,-0x420(%rbp,%rax,1)
movl   $0x18,-0x18(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    -0x20(%rbp),%edx
lea    -0x858(%rbp),%r8
mov    -0x18(%rbp),%r9d
xor    %ecx,%ecx
call   1050 <sendto@plt>
cmp    $0xffffffff,%eax
jne    1434 <main+0x264>
lea    0xc65(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x860,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x438,%rsp
mov    %rsi,%r14
cmp    $0x2,%edi
jle    1338 <main+0x168>
mov    0x2df8(%rip),%rbp
mov    0x0(%rbp),%rdi
mov    0x2dd5(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
test   %eax,%eax
js     135a <main+0x18a>
mov    %eax,%r15d
lea    0x18(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x18,%esi
call   10d0 <bzero@plt>
mov    0x0(%rbp),%rax
mov    %rax,0x28(%rsp)
mov    0x2da7(%rip),%rax
mov    (%rax),%edi
call   1040 <htonl@plt>
mov    %eax,0x18(%rsp)
xor    %edi,%edi
call   1030 <htons@plt>
mov    %rax,0x20(%rsp)
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x18,%edx
call   10a0 <bind@plt>
test   %rax,%rax
js     1363 <main+0x193>
mov    %rsp,%rdi
mov    $0x18,%esi
call   10d0 <bzero@plt>
mov    0x0(%rbp),%rax
mov    %rax,0x10(%rsp)
mov    $0x140e,%edi
call   1030 <htons@plt>
mov    %rax,0x8(%rsp)
mov    0x8(%r14),%rdi
call   1070 <gethostbyname@plt>
test   %rax,%rax
je     130a <main+0x13a>
mov    0x8(%rax),%rcx
mov    (%rcx),%edi
mov    %rsp,%rsi
mov    (%rax),%edx
call   1090 <bcopy@plt>
mov    0x10(%r14),%rdi
mov    0x2d31(%rip),%rax
mov    (%rax),%esi
call   10b0 <open@plt>
cmp    $0xffffffff,%eax
je     136c <main+0x19c>
lea    0x30(%rsp),%rbx
mov    %eax,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1060 <read@plt>
test   %eax,%eax
js     1375 <main+0x1a5>
mov    %eax,%ecx
movb   $0x0,0x1(%rcx,%rbx,1)
xor    %ebp,%ebp
mov    %rsp,%r8
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
mov    $0x18,%r9d
call   1050 <sendto@plt>
cmp    $0xffffffff,%eax
jne    1328 <main+0x158>
lea    0xd82(%rip),%rdi
jmp    137c <main+0x1ac>
mov    0x2caf(%rip),%rax
mov    (%rax),%edi
mov    0x10(%r14),%rdx
lea    0xd29(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x438,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c81(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xcb5(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x2,%edi
call   10e0 <exit@plt>
lea    0xcca(%rip),%rdi
jmp    137c <main+0x1ac>
lea    0xcd0(%rip),%rdi
jmp    137c <main+0x1ac>
lea    0xcf4(%rip),%rdi
jmp    137c <main+0x1ac>
lea    0xcfc(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.hostent = type { i32, i32* }
%struct.sockaddr_in = type { %struct.TYPE_2__, i8*, i8* }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [43 x i8] c"Usage: %s host_name(IP address) file_name\0A\00"
@AF_INET = global i8* null
@SOCK_DGRAM = global i32 0
@.str.1 = [15 x i8] c"socket failed!\00"
@INADDR_ANY = global i32 0
@.str.2 = [13 x i8] c"bind failed!\00"
@.str.3 = [32 x i8] c"could not obtain address of %s\0A\00"
@O_RDONLY = global i32 0
@.str.4 = [17 x i8] c"open file error!\00"
@.str.5 = [18 x i8] c"read file error !\00"
@.str.6 = [24 x i8] c"write to server error !\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [1024 x i8]
%11 = alloca [1024 x i8]
%12 = alloca %struct.hostent*
%13 = alloca %struct.sockaddr_in
%14 = alloca %struct.sockaddr_in
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 3
br i1 %16, label %17, label %24
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = call i32 @exit(i32 2)
unreachable
24: ; preds = %2
%25 = load i8*, i8** @AF_INET
%26 = load i32, i32* @SOCK_DGRAM
%27 = call i32 @socket(i8* %25, i32 %26, i32 0)
store i32 %27, i32* %6
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %24
%30 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %24
%33 = bitcast %struct.sockaddr_in* %13 to i8*
%34 = call i32 @bzero(i8* %33, i32 24)
%35 = load i8*, i8** @AF_INET
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %13, i32 0, i32 2
store i8* %35, i8** %36
%37 = load i32, i32* @INADDR_ANY
%38 = call i32 @htonl(i32 %37)
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %13, i32 0, i32 0
%40 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %39, i32 0, i32 0
store i32 %38, i32* %40
%41 = call i8* @htons(i32 0)
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %13, i32 0, i32 1
store i8* %41, i8** %42
%43 = load i32, i32* %6
%44 = bitcast %struct.sockaddr_in* %13 to %struct.sockaddr*
%45 = call i64 @bind(i32 %43, %struct.sockaddr* %44, i32 24)
%46 = icmp slt i64 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %32
%48 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %32
%51 = bitcast %struct.sockaddr_in* %14 to i8*
%52 = call i32 @bzero(i8* %51, i32 24)
%53 = load i8*, i8** @AF_INET
%54 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %14, i32 0, i32 2
store i8* %53, i8** %54
%55 = call i8* @htons(i32 5134)
%56 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %14, i32 0, i32 1
store i8* %55, i8** %56
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 1
%59 = load i8*, i8** %58
%60 = call %struct.hostent* @gethostbyname(i8* %59)
store %struct.hostent* %60, %struct.hostent** %12
%61 = load %struct.hostent*, %struct.hostent** %12
%62 = icmp eq %struct.hostent* %61, null
br i1 %62, label %63, label %69
63: ; preds = %50
%64 = load i32, i32* @stderr
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i64 2
%67 = load i8*, i8** %66
%68 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %67)
store i32 -1, i32* %3
br label %116
69: ; preds = %50
%70 = load %struct.hostent*, %struct.hostent** %12
%71 = getelementptr inbounds %struct.hostent, %struct.hostent* %70, i32 0, i32 1
%72 = load i32*, i32** %71
%73 = getelementptr inbounds i32, i32* %72, i64 0
%74 = load i32, i32* %73
%75 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %14, i32 0, i32 0
%76 = ptrtoint %struct.TYPE_2__* %75 to i32
%77 = load %struct.hostent*, %struct.hostent** %12
%78 = getelementptr inbounds %struct.hostent, %struct.hostent* %77, i32 0, i32 0
%79 = load i32, i32* %78
%80 = call i32 @bcopy(i32 %74, i32 %76, i32 %79)
%81 = load i8**, i8*** %5
%82 = getelementptr inbounds i8*, i8** %81, i64 2
%83 = load i8*, i8** %82
%84 = load i32, i32* @O_RDONLY
%85 = call i32 @open(i8* %83, i32 %84)
store i32 %85, i32* %8
%86 = load i32, i32* %8
%87 = icmp eq i32 %86, -1
br i1 %87, label %88, label %91
88: ; preds = %69
%89 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%90 = call i32 @exit(i32 1)
unreachable
91: ; preds = %69
%92 = load i32, i32* %8
%93 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%94 = call i32 @read(i32 %92, i8* %93, i32 1024)
store i32 %94, i32* %9
%95 = load i32, i32* %9
%96 = icmp slt i32 %95, 0
br i1 %96, label %97, label %100
97: ; preds = %91
%98 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%99 = call i32 @exit(i32 1)
unreachable
100: ; preds = %91
%101 = load i32, i32* %9
%102 = add nsw i32 %101, 1
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 %103
store i8 0, i8* %104
store i32 24, i32* %7
%105 = load i32, i32* %6
%106 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%107 = load i32, i32* %9
%108 = bitcast %struct.sockaddr_in* %14 to %struct.sockaddr*
%109 = load i32, i32* %7
%110 = call i32 @sendto(i32 %105, i8* %106, i32 %107, i32 0, %struct.sockaddr* %108, i32 %109)
%111 = icmp eq i32 %110, -1
br i1 %111, label %112, label %115
112: ; preds = %100
%113 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%114 = call i32 @exit(i32 1)
unreachable
115: ; preds = %100
store i32 0, i32* %3
br label %116
116: ; preds = %115, %63
%117 = load i32, i32* %3
ret i32 %117
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i8*, i8* }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
%struct.hostent = type { i32, i32* }
@stderr = global i32 0
@.str = [43 x i8] c"Usage: %s host_name(IP address) file_name\0A\00"
@AF_INET = global i8* null
@SOCK_DGRAM = global i32 0
@.str.1 = [15 x i8] c"socket failed!\00"
@INADDR_ANY = global i32 0
@.str.2 = [13 x i8] c"bind failed!\00"
@.str.3 = [32 x i8] c"could not obtain address of %s\0A\00"
@O_RDONLY = global i32 0
@.str.4 = [17 x i8] c"open file error!\00"
@.str.5 = [18 x i8] c"read file error !\00"
@.str.6 = [24 x i8] c"write to server error !\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca %struct.sockaddr_in
%5 = alloca %struct.sockaddr_in
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = bitcast %struct.sockaddr_in* %4 to i8*
%8 = bitcast %struct.sockaddr_in* %5 to i8*
%9 = icmp slt i32 %0, 3
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %1
%13 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = tail call i32 @exit(i32 2)
unreachable
15: ; preds = %2
%16 = load i8*, i8** @AF_INET
%17 = load i32, i32* @SOCK_DGRAM
%18 = tail call i32 @socket(i8* %16, i32 %17, i32 0)
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = tail call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%22 = tail call i32 @exit(i32 1)
unreachable
23: ; preds = %15
%24 = call i32 @bzero(i8* %7, i32 24)
%25 = load i8*, i8** @AF_INET
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i8* %25, i8** %26
%27 = load i32, i32* @INADDR_ANY
%28 = tail call i32 @htonl(i32 %27)
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0, i32 0
store i32 %28, i32* %29
%30 = tail call i8* @htons(i32 0)
%31 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1
store i8* %30, i8** %31
%32 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%33 = call i64 @bind(i32 %18, %struct.sockaddr* %32, i32 24)
%34 = icmp slt i64 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %23
%36 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %23
%39 = call i32 @bzero(i8* %8, i32 24)
%40 = load i8*, i8** @AF_INET
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 2
store i8* %40, i8** %41
%42 = call i8* @htons(i32 5134)
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 1
store i8* %42, i8** %43
%44 = getelementptr inbounds i8*, i8** %1, i64 1
%45 = load i8*, i8** %44
%46 = call %struct.hostent* @gethostbyname(i8* %45)
%47 = icmp eq %struct.hostent* %46, null
br i1 %47, label %48, label %53
48: ; preds = %38
%49 = load i32, i32* @stderr
%50 = getelementptr inbounds i8*, i8** %1, i64 2
%51 = load i8*, i8** %50
%52 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %51)
br label %86
53: ; preds = %38
%54 = getelementptr inbounds %struct.hostent, %struct.hostent* %46, i64 0, i32 1
%55 = load i32*, i32** %54
%56 = load i32, i32* %55
%57 = ptrtoint %struct.sockaddr_in* %5 to i64
%58 = trunc i64 %57 to i32
%59 = getelementptr inbounds %struct.hostent, %struct.hostent* %46, i64 0, i32 0
%60 = load i32, i32* %59
%61 = call i32 @bcopy(i32 %56, i32 %58, i32 %60)
%62 = getelementptr inbounds i8*, i8** %1, i64 2
%63 = load i8*, i8** %62
%64 = load i32, i32* @O_RDONLY
%65 = call i32 @open(i8* %63, i32 %64)
%66 = icmp eq i32 %65, -1
br i1 %66, label %67, label %70
67: ; preds = %53
%68 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%69 = call i32 @exit(i32 1)
unreachable
70: ; preds = %53
%71 = call i32 @read(i32 %65, i8* %6, i32 1024)
%72 = icmp slt i32 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %70
%74 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %70
%77 = add nuw nsw i32 %71, 1
%78 = zext i32 %77 to i64
%79 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %78
store i8 0, i8* %79
%80 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%81 = call i32 @sendto(i32 %18, i8* %6, i32 %71, i32 0, %struct.sockaddr* %80, i32 24)
%82 = icmp eq i32 %81, -1
br i1 %82, label %83, label %86
83: ; preds = %76
%84 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%85 = call i32 @exit(i32 1)
unreachable
86: ; preds = %76, %48
%87 = phi i32 [ -1, %48 ], [ 0, %76 ]
ret i32 %87
}