#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;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ remaddr;
typedef int /*<<< orphan*/ cli_addr;

/* Variables and functions */
void *AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
void *htons(int);
scalar_t__ inet_aton(char *, TYPE_1__ *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int socket(void *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ strlen(char *);
int main(int argc, char **argv) {
  struct sockaddr_in cli_addr;
  struct sockaddr_in remaddr;
  int s = 0;
  int recvlen = 0;
  char buf[1024];
  char *server = "192.168.1.3";
  socklen_t addrlen = sizeof(remaddr);
  if (argc < 2) {
    printf("Please input string\n");
    return 1;
  }
  if ((s = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
    printf("open socket fail.\n");
    return 0;
  }
  memset((char *)&cli_addr, 0, sizeof(cli_addr));
  cli_addr.sin_family = AF_INET;
  cli_addr.sin_addr.s_addr = htonl(INADDR_ANY);
  cli_addr.sin_port = htons(0);
  if (bind(s, (struct sockaddr *)&cli_addr, sizeof(cli_addr)) < 0) {
    printf("bind failed.\n");
    return 0;
  }
  memset((char *)&remaddr, 0, sizeof(remaddr));
  remaddr.sin_family = AF_INET;
  remaddr.sin_port = htons(11111);
  if (inet_aton(server, &remaddr.sin_addr) == 0) {
    printf("inet_aton() failed.\n");
    return 1;
  }
  if (connect(s, (struct sockaddr *)&remaddr, addrlen) < 0) {
    printf("connect fail\n");
    close(s);
    return 1;
  }
  printf("sending packet to %s port %s\n", server, "11111");
  sprintf(buf, "%s", argv[1]);
  if (send(s, buf, strlen(buf), 0) == -1) {
    printf("sendto fail\n");
    return 1;
  }
  if ((recvlen = recv(s, buf, 1024, 0)) < 0) {
    printf("recv fail\n");
  } else {
    buf[recvlen] = 0;
    printf("recv message=%s\n", buf);
  }
  close(s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x470,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
lea    0xe02(%rip),%rax
mov    %rax,-0x458(%rbp)
movl   $0x18,-0x45c(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1233 <main+0x63>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1478 <main+0x2a8>
mov    0x2dae(%rip),%rax
mov    (%rax),%rdi
mov    0x2d8c(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,-0x44(%rbp)
cmp    $0xffffffff,%eax
jne    1273 <main+0xa3>
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1478 <main+0x2a8>
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1090 <memset@plt>
mov    0x2d5e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,-0x28(%rbp)
xor    %edi,%edi
call   1050 <htons@plt>
mov    %rax,-0x20(%rbp)
mov    -0x44(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x18,%edx
call   10c0 <bind@plt>
cmp    $0x0,%rax
jge    12e2 <main+0x112>
lea    0xd65(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1478 <main+0x2a8>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1090 <memset@plt>
mov    0x2cef(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    $0x2b67,%edi
call   1050 <htons@plt>
mov    %rax,-0x38(%rbp)
mov    -0x458(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   10b0 <inet_aton@plt>
cmp    $0x0,%rax
jne    1342 <main+0x172>
lea    0xd13(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1478 <main+0x2a8>
mov    -0x44(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    -0x45c(%rbp),%edx
call   10e0 <connect@plt>
cmp    $0x0,%rax
jge    1380 <main+0x1b0>
lea    0xcf2(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x44(%rbp),%edi
call   10a0 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    1478 <main+0x2a8>
mov    -0x458(%rbp),%rsi
lea    0xcd7(%rip),%rdi
lea    0xcee(%rip),%rdx
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x450(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xcd7(%rip),%rsi
call   10d0 <sprintf@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x46c(%rbp)
lea    -0x450(%rbp),%rax
mov    %rax,-0x468(%rbp)
lea    -0x450(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x46c(%rbp),%edi
mov    -0x468(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0xffffffff,%eax
jne    1413 <main+0x243>
lea    0xc8c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1478 <main+0x2a8>
mov    -0x44(%rbp),%edi
lea    -0x450(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x48(%rbp)
cmp    $0x0,%eax
jge    1448 <main+0x278>
lea    0xc5d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1469 <main+0x299>
movslq -0x48(%rbp),%rax
movb   $0x0,-0x450(%rbp,%rax,1)
lea    -0x450(%rbp),%rsi
lea    0xc42(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x44(%rbp),%edi
call   10a0 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x470,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x430,%rsp
cmp    $0x1,%edi
jg     120a <main+0x2a>
lea    0xe9c(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%ebp
jmp    13c9 <main+0x1e9>
mov    %rsi,%r14
mov    0x2dd4(%rip),%r12
mov    (%r12),%rdi
mov    0x2db1(%rip),%rax
mov    (%rax),%esi
xor    %ebp,%ebp
xor    %edx,%edx
call   1100 <socket@plt>
cmp    $0xffffffff,%eax
je     1364 <main+0x184>
mov    %eax,%r15d
lea    0x18(%rsp),%rbx
xor    %ebp,%ebp
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   10b0 <memset@plt>
mov    (%r12),%rax
mov    %rax,0x28(%rsp)
mov    0x2d84(%rip),%rax
mov    (%rax),%edi
call   10a0 <htonl@plt>
mov    %eax,0x18(%rsp)
xor    %edi,%edi
call   1070 <htons@plt>
mov    %rax,0x20(%rsp)
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x18,%edx
call   10e0 <bind@plt>
test   %rax,%rax
js     1372 <main+0x192>
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   10b0 <memset@plt>
mov    (%r12),%rax
mov    %rax,0x10(%rsp)
mov    $0x2b67,%edi
call   1070 <htons@plt>
mov    %rax,0x8(%rsp)
lea    0xd43(%rip),%rdi
mov    %rbx,%rsi
call   10d0 <inet_aton@plt>
test   %rax,%rax
je     1380 <main+0x1a0>
mov    %rsp,%rsi
mov    %r15d,%edi
mov    $0x18,%edx
call   10f0 <connect@plt>
test   %rax,%rax
js     138c <main+0x1ac>
lea    0xd1e(%rip),%rdi
lea    0xd0b(%rip),%rsi
lea    0xd2e(%rip),%rdx
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x8(%r14),%rsi
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
cmp    $0xffffffff,%eax
je     13a7 <main+0x1c7>
lea    0x30(%rsp),%rsi
mov    %r15d,%edi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
js     13b3 <main+0x1d3>
mov    %eax,%eax
movb   $0x0,0x30(%rsp,%rax,1)
lea    0xcda(%rip),%rdi
lea    0x30(%rsp),%rsi
xor    %eax,%eax
call   1090 <printf@plt>
jmp    13bf <main+0x1df>
lea    0xd1a(%rip),%rdi
call   1050 <puts@plt>
jmp    13c9 <main+0x1e9>
lea    0xcff(%rip),%rdi
call   1050 <puts@plt>
jmp    13c9 <main+0x1e9>
lea    0xcdd(%rip),%rdi
jmp    11fb <main+0x1b>
lea    0xcc4(%rip),%rdi
call   1050 <puts@plt>
mov    %r15d,%edi
call   10c0 <close@plt>
mov    $0x1,%ebp
jmp    13c9 <main+0x1e9>
lea    0xc9d(%rip),%rdi
jmp    11fb <main+0x1b>
lea    0xc87(%rip),%rdi
call   1050 <puts@plt>
mov    %r15d,%edi
call   10c0 <close@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x430,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i8*, i8* }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [12 x i8] c"192.168.1.3\00"
@.str.1 = [21 x i8] c"Please input string\0A\00"
@AF_INET = global i8* null
@SOCK_STREAM = global i32 0
@.str.2 = [19 x i8] c"open socket fail.\0A\00"
@INADDR_ANY = global i32 0
@.str.3 = [14 x i8] c"bind failed.\0A\00"
@.str.4 = [21 x i8] c"inet_aton() failed.\0A\00"
@.str.5 = [14 x i8] c"connect fail\0A\00"
@.str.6 = [30 x i8] c"sending packet to %s port %s\0A\00"
@.str.7 = [6 x i8] c"11111\00"
@.str.8 = [3 x i8] c"%s\00"
@.str.9 = [13 x i8] c"sendto fail\0A\00"
@.str.10 = [11 x i8] c"recv fail\0A\00"
@.str.11 = [17 x i8] c"recv message=%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.sockaddr_in
%7 = alloca %struct.sockaddr_in
%8 = alloca i32
%9 = alloca i32
%10 = alloca [1024 x i8]
%11 = alloca i8*
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 0, i32* %9
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %11
store i32 24, i32* %12
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 2
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %96
17: ; preds = %2
%18 = load i8*, i8** @AF_INET
%19 = load i32, i32* @SOCK_STREAM
%20 = call i32 @socket(i8* %18, i32 %19, i32 0)
store i32 %20, i32* %8
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %96
24: ; preds = %17
%25 = bitcast %struct.sockaddr_in* %6 to i8*
%26 = call i32 @memset(i8* %25, i32 0, i32 24)
%27 = load i8*, i8** @AF_INET
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 2
store i8* %27, i8** %28
%29 = load i32, i32* @INADDR_ANY
%30 = call i32 @htonl(i32 %29)
%31 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
%32 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %31, i32 0, i32 0
store i32 %30, i32* %32
%33 = call i8* @htons(i32 0)
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 1
store i8* %33, i8** %34
%35 = load i32, i32* %8
%36 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%37 = call i64 @bind(i32 %35, %struct.sockaddr* %36, i32 24)
%38 = icmp slt i64 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %24
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %96
41: ; preds = %24
%42 = bitcast %struct.sockaddr_in* %7 to i8*
%43 = call i32 @memset(i8* %42, i32 0, i32 24)
%44 = load i8*, i8** @AF_INET
%45 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 2
store i8* %44, i8** %45
%46 = call i8* @htons(i32 11111)
%47 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
store i8* %46, i8** %47
%48 = load i8*, i8** %11
%49 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
%50 = call i64 @inet_aton(i8* %48, %struct.TYPE_2__* %49)
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %41
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %96
54: ; preds = %41
%55 = load i32, i32* %8
%56 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%57 = load i32, i32* %12
%58 = call i64 @connect(i32 %55, %struct.sockaddr* %56, i32 %57)
%59 = icmp slt i64 %58, 0
br i1 %59, label %60, label %64
60: ; preds = %54
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%62 = load i32, i32* %8
%63 = call i32 @close(i32 %62)
store i32 1, i32* %3
br label %96
64: ; preds = %54
%65 = load i8*, i8** %11
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i8* %65, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%67 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%68 = load i8**, i8*** %5
%69 = getelementptr inbounds i8*, i8** %68, i64 1
%70 = load i8*, i8** %69
%71 = call i32 @sprintf(i8* %67, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %70)
%72 = load i32, i32* %8
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%74 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%75 = call i32 @strlen(i8* %74)
%76 = call i32 @send(i32 %72, i8* %73, i32 %75, i32 0)
%77 = icmp eq i32 %76, -1
br i1 %77, label %78, label %80
78: ; preds = %64
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %3
br label %96
80: ; preds = %64
%81 = load i32, i32* %8
%82 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%83 = call i32 @recv(i32 %81, i8* %82, i32 1024, i32 0)
store i32 %83, i32* %9
%84 = icmp slt i32 %83, 0
br i1 %84, label %85, label %87
85: ; preds = %80
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
br label %93
87: ; preds = %80
%88 = load i32, i32* %9
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 %89
store i8 0, i8* %90
%91 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i8* %91)
br label %93
93: ; preds = %87, %85
%94 = load i32, i32* %8
%95 = call i32 @close(i32 %94)
store i32 0, i32* %3
br label %96
96: ; preds = %93, %78, %60, %52, %39, %22, %15
%97 = load i32, i32* %3
ret i32 %97
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i8*, i8* }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [12 x i8] c"192.168.1.3\00"
@AF_INET = global i8* null
@SOCK_STREAM = global i32 0
@INADDR_ANY = global i32 0
@.str.6 = [30 x i8] c"sending packet to %s port %s\0A\00"
@.str.7 = [6 x i8] c"11111\00"
@.str.11 = [17 x i8] c"recv message=%s\0A\00"
@str = [10 x i8] c"recv fail\00"
@str.12 = [12 x i8] c"sendto fail\00"
@str.13 = [13 x i8] c"connect fail\00"
@str.14 = [20 x i8] c"inet_aton() failed.\00"
@str.15 = [13 x i8] c"bind failed.\00"
@str.16 = [18 x i8] c"open socket fail.\00"
@str.17 = [20 x i8] c"Please input string\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca [1024 x i8]
%6 = bitcast %struct.sockaddr_in* %3 to i8*
%7 = bitcast %struct.sockaddr_in* %4 to i8*
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%9 = icmp slt i32 %0, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.17, i64 0, i64 0))
br label %72
12: ; preds = %2
%13 = load i8*, i8** @AF_INET
%14 = load i32, i32* @SOCK_STREAM
%15 = tail call i32 @socket(i8* %13, i32 %14, i32 0)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.16, i64 0, i64 0))
br label %72
19: ; preds = %12
%20 = call i32 @memset(i8* %6, i32 0, i32 24)
%21 = load i8*, i8** @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i8* %21, i8** %22
%23 = load i32, i32* @INADDR_ANY
%24 = call i32 @htonl(i32 %23)
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i32 %24, i32* %25
%26 = call i8* @htons(i32 0)
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i8* %26, i8** %27
%28 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%29 = call i64 @bind(i32 %15, %struct.sockaddr* %28, i32 24)
%30 = icmp slt i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %19
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.15, i64 0, i64 0))
br label %72
33: ; preds = %19
%34 = call i32 @memset(i8* %7, i32 0, i32 24)
%35 = load i8*, i8** @AF_INET
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i8* %35, i8** %36
%37 = call i8* @htons(i32 11111)
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1
store i8* %37, i8** %38
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
%40 = call i64 @inet_aton(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %struct.TYPE_2__* %39)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %33
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.14, i64 0, i64 0))
br label %72
44: ; preds = %33
%45 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%46 = call i64 @connect(i32 %15, %struct.sockaddr* %45, i32 24)
%47 = icmp slt i64 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %44
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.13, i64 0, i64 0))
%50 = call i32 @close(i32 %15)
br label %72
51: ; preds = %44
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%53 = getelementptr inbounds i8*, i8** %1, i64 1
%54 = load i8*, i8** %53
%55 = call i8* @strcpy(i8* %8, i8* dereferenceable(1) %54)
%56 = call i32 @strlen(i8* %8)
%57 = call i32 @send(i32 %15, i8* %8, i32 %56, i32 0)
%58 = icmp eq i32 %57, -1
br i1 %58, label %59, label %61
59: ; preds = %51
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.12, i64 0, i64 0))
br label %72
61: ; preds = %51
%62 = call i32 @recv(i32 %15, i8* %8, i32 1024, i32 0)
%63 = icmp slt i32 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %61
%65 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %70
66: ; preds = %61
%67 = zext i32 %62 to i64
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %67
store i8 0, i8* %68
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i8* %8)
br label %70
70: ; preds = %66, %64
%71 = call i32 @close(i32 %15)
br label %72
72: ; preds = %70, %59, %48, %42, %31, %17, %10
%73 = phi i32 [ 1, %10 ], [ 0, %17 ], [ 0, %31 ], [ 1, %42 ], [ 1, %48 ], [ 1, %59 ], [ 0, %70 ]
ret i32 %73
}