#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
};
struct sockaddr {
  int /*<<< orphan*/ sa_family;
};
struct addrinfo {
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ ai_addr;
  scalar_t__ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
  int /*<<< orphan*/ ai_flags;
};
typedef int socklen_t;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ AI_PASSIVE;
int INET_ADDRSTRLEN;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int bind(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int getaddrinfo(int /*<<< orphan*/ *, char *, struct addrinfo *,
                struct addrinfo **);
int /*<<< orphan*/ inet_ntop(int /*<<< orphan*/, int /*<<< orphan*/ *, char *,
                             int);
int /*<<< orphan*/ listen(int, int);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, scalar_t__, int /*<<< orphan*/);
scalar_t__ send(int, char *, scalar_t__, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, scalar_t__);
int /*<<< orphan*/ stdout;
scalar_t__ strlen(char *);
int main(int argc, char *argv[]) {
  int a, b;
  struct addrinfo hints, *result, *p;
  memset(&hints, 0, sizeof hints);
  hints.ai_family = AF_INET;
  hints.ai_protocol = 0;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_flags = AI_PASSIVE;
  if ((a = getaddrinfo(NULL, "1305", &hints, &result)) != 0) {
    printf("Error Getaddressinfo\n");
  } else {
    printf("Getaddressinfo...OK\n");
  }
  int sockfd1;
  if ((sockfd1 = socket(result->ai_family, result->ai_socktype,
                        result->ai_protocol)) == -1) {
    printf("Error socket loading\n");
  } else {
    printf("Socket...OK\n");
  }
  if (b = bind(sockfd1, result->ai_addr, result->ai_addrlen) == -1) {
    printf("Error socket binding\n");
  } else {
    printf("Bind...OK\n");
  }
  listen(sockfd1, 10);
  int sockld1;
  struct sockaddr clientaddr;
  socklen_t c = sizeof clientaddr;
  char str[INET_ADDRSTRLEN];
  while (1) {
    if ((sockld1 = accept(sockfd1, &clientaddr, &c)) == -1) {
      printf("Error accepting connection\n");
      continue;
    } else {
      struct sockaddr_in *clientaddr_inp;
      clientaddr_inp = (struct sockaddr_in *)&clientaddr;
      inet_ntop(clientaddr.sa_family, &(clientaddr_inp->sin_addr), str,
                INET_ADDRSTRLEN);
      printf("Accepting connection ...OK\nConnecting to %s...\n", str);
    }
    char *messagesd = "Welcome to the server. Send your message";
    if ((send(sockld1, messagesd, strlen(messagesd), 0)) < strlen(messagesd)) {
      printf("Warning:not all of the welcome message has been sent...\n");
    };
    char messagerc[1000];
    while (1) {
      if ((recv(sockld1, messagerc, strlen(messagerc), 0)) < 1) {
        printf("Server faces an error receiving bytes...");
        break;
      } else {
        printf("%s", messagerc);
        fflush(stdout);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <memset@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
mov    0x2dcc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2dd8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xde0(%rip),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   10d0 <getaddrinfo@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     124c <main+0x8c>
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    125a <main+0x9a>
lea    0xdc8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x40(%rbp),%rax
mov    0x14(%rax),%edi
mov    -0x40(%rbp),%rax
mov    0x10(%rax),%esi
mov    -0x40(%rbp),%rax
mov    0x8(%rax),%rdx
call   10e0 <socket@plt>
mov    %eax,-0x4c(%rbp)
cmp    $0xffffffff,%eax
jne    1294 <main+0xd4>
lea    0xda8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    12a2 <main+0xe2>
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x4c(%rbp),%edi
mov    -0x40(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x40(%rbp),%rax
mov    (%rax),%edx
call   10b0 <bind@plt>
cmp    $0xffffffff,%eax
sete   %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x18(%rbp)
test   $0x1,%al
jne    12d5 <main+0x115>
jmp    12e8 <main+0x128>
lea    0xd77(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    12f6 <main+0x136>
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x4c(%rbp),%edi
mov    $0xa,%esi
call   10a0 <listen@plt>
movl   $0x4,-0x5c(%rbp)
mov    0x2cb7(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x68(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x478(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x70(%rbp)
jmp    133e <main+0x17e>
mov    -0x4c(%rbp),%edi
lea    -0x58(%rbp),%rsi
lea    -0x5c(%rbp),%rdx
call   10c0 <accept@plt>
mov    %eax,-0x50(%rbp)
cmp    $0xffffffff,%eax
jne    136d <main+0x1ad>
lea    0xd13(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1339 <main+0x179>
mov    -0x478(%rbp),%rdx
lea    -0x58(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x58(%rbp),%edi
mov    -0x78(%rbp),%rsi
mov    0x2c3e(%rip),%rax
mov    (%rax),%ecx
call   1030 <inet_ntop@plt>
mov    -0x478(%rbp),%rsi
lea    0xcf1(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xd13(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x48c(%rbp)
mov    -0x80(%rbp),%rax
mov    %rax,-0x488(%rbp)
mov    -0x80(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x48c(%rbp),%edi
mov    -0x488(%rbp),%rsi
mov    %rax,%rdx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    %rax,-0x480(%rbp)
mov    -0x80(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x480(%rbp),%rax
cmp    %rcx,%rax
jge    1416 <main+0x256>
lea    0xcda(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    141b <main+0x25b>
jmp    1420 <main+0x260>
mov    -0x50(%rbp),%eax
mov    %eax,-0x49c(%rbp)
lea    -0x470(%rbp),%rax
mov    %rax,-0x498(%rbp)
lea    -0x470(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x49c(%rbp),%edi
mov    -0x498(%rbp),%rsi
mov    %rax,%rdx
xor    %ecx,%ecx
call   1040 <recv@plt>
cmp    $0x1,%eax
jge    1476 <main+0x2b6>
lea    0xcb8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    149e <main+0x2de>
lea    -0x470(%rbp),%rsi
lea    0xcc7(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2b2e(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
jmp    141b <main+0x25b>
jmp    1339 <main+0x179>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
lea    -0x68(%rbp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1090 <memset@plt>
mov    0x2de2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
movq   $0x0,-0x60(%rbp)
mov    0x2dbe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
mov    0x2dca(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
lea    0xdd6(%rip),%rsi
lea    -0x40(%rbp),%rcx
xor    %edi,%edi
mov    %rbx,%rdx
call   10e0 <getaddrinfo@plt>
test   %eax,%eax
lea    0xe49(%rip),%rax
lea    0xee9(%rip),%rdi
cmove  %rax,%rdi
call   1050 <puts@plt>
mov    -0x40(%rbp),%rax
mov    0x14(%rax),%edi
mov    0x10(%rax),%esi
mov    0x8(%rax),%rdx
call   10f0 <socket@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
lea    0xeac(%rip),%rax
lea    0xe27(%rip),%rdi
cmove  %rax,%rdi
call   1050 <puts@plt>
mov    -0x40(%rbp),%rax
mov    (%rax),%edx
mov    0x4(%rax),%esi
mov    %ebx,%edi
call   10c0 <bind@plt>
cmp    $0xffffffff,%eax
lea    0xe6d(%rip),%rax
lea    0xe09(%rip),%rdi
cmove  %rax,%rdi
call   1050 <puts@plt>
mov    %ebx,-0x34(%rbp)
mov    %ebx,%edi
mov    $0xa,%esi
call   10b0 <listen@plt>
movl   $0x4,-0x38(%rbp)
mov    0x2d01(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
lea    -0x30(%rbp),%rbx
lea    -0x450(%rbp),%r13
lea    0xd97(%rip),%r12
mov    0x2cc9(%rip),%r15
jmp    130c <main+0x13c>
nopl   0x0(%rax)
lea    0xde5(%rip),%rdi
call   1050 <puts@plt>
mov    -0x34(%rbp),%edi
mov    %rbx,%rsi
lea    -0x38(%rbp),%rdx
call   10d0 <accept@plt>
cmp    $0xffffffff,%eax
je     1300 <main+0x130>
mov    %eax,%r14d
mov    -0x30(%rbp),%edi
mov    0x2c9b(%rip),%rax
mov    (%rax),%ecx
mov    %rbx,%rsi
mov    -0x48(%rbp),%rbx
mov    %rbx,%rdx
call   1030 <inet_ntop@plt>
lea    0xcc0(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x28,%edx
mov    %r14d,%edi
lea    0xcd7(%rip),%rsi
xor    %ecx,%ecx
call   1070 <send@plt>
cmp    $0x27,%rax
jg     1395 <main+0x1c5>
lea    0xd42(%rip),%rdi
call   1050 <puts@plt>
jmp    1395 <main+0x1c5>
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    (%r15),%edi
call   10a0 <fflush@plt>
mov    %r13,%rdi
call   1060 <strlen@plt>
mov    %r14d,%edi
mov    %r13,%rsi
mov    %rax,%rdx
xor    %ecx,%ecx
call   1040 <recv@plt>
test   %eax,%eax
jg     1380 <main+0x1b0>
lea    0xca6(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    -0x30(%rbp),%rbx
jmp    130c <main+0x13c>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32, i64, i32, i32, i32 }
%struct.sockaddr = type { i32 }
%struct.sockaddr_in = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@AI_PASSIVE = global i32 0
@.str = [5 x i8] c"1305\00"
@.str.1 = [22 x i8] c"Error Getaddressinfo\0A\00"
@.str.2 = [21 x i8] c"Getaddressinfo...OK\0A\00"
@.str.3 = [22 x i8] c"Error socket loading\0A\00"
@.str.4 = [13 x i8] c"Socket...OK\0A\00"
@.str.5 = [22 x i8] c"Error socket binding\0A\00"
@.str.6 = [11 x i8] c"Bind...OK\0A\00"
@INET_ADDRSTRLEN = global i32 0
@.str.7 = [28 x i8] c"Error accepting connection\0A\00"
@.str.8 = [48 x i8] c"Accepting connection ...OK\0AConnecting to %s...\0A\00"
@.str.9 = [41 x i8] c"Welcome to the server. Send your message\00"
@.str.10 = [57 x i8] c"Warning:not all of the welcome message has been sent...\0A\00"
@.str.11 = [41 x i8] c"Server faces an error receiving bytes...\00"
@.str.12 = [3 x i8] c"%s\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.addrinfo
%9 = alloca %struct.addrinfo*
%10 = alloca %struct.addrinfo*
%11 = alloca i32
%12 = alloca i32
%13 = alloca %struct.sockaddr
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i64
%17 = alloca %struct.sockaddr_in*
%18 = alloca i8*
%19 = alloca [1000 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = call i32 @memset(%struct.addrinfo* %8, i32 0, i32 32)
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 4
store i32 %21, i32* %22
%23 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 2
store i64 0, i64* %23
%24 = load i32, i32* @SOCK_STREAM
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 3
store i32 %24, i32* %25
%26 = load i32, i32* @AI_PASSIVE
%27 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 5
store i32 %26, i32* %27
%28 = call i32 @getaddrinfo(i32* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %struct.addrinfo* %8, %struct.addrinfo** %9)
store i32 %28, i32* %6
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %2
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %34
32: ; preds = %2
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %34
34: ; preds = %32, %30
%35 = load %struct.addrinfo*, %struct.addrinfo** %9
%36 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %35, i32 0, i32 4
%37 = load i32, i32* %36
%38 = load %struct.addrinfo*, %struct.addrinfo** %9
%39 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %38, i32 0, i32 3
%40 = load i32, i32* %39
%41 = load %struct.addrinfo*, %struct.addrinfo** %9
%42 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %41, i32 0, i32 2
%43 = load i64, i64* %42
%44 = call i32 @socket(i32 %37, i32 %40, i64 %43)
store i32 %44, i32* %11
%45 = icmp eq i32 %44, -1
br i1 %45, label %46, label %48
46: ; preds = %34
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %50
48: ; preds = %34
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %50
50: ; preds = %48, %46
%51 = load i32, i32* %11
%52 = load %struct.addrinfo*, %struct.addrinfo** %9
%53 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %52, i32 0, i32 1
%54 = load i32, i32* %53
%55 = load %struct.addrinfo*, %struct.addrinfo** %9
%56 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %55, i32 0, i32 0
%57 = load i32, i32* %56
%58 = call i32 @bind(i32 %51, i32 %54, i32 %57)
%59 = icmp eq i32 %58, -1
%60 = zext i1 %59 to i32
store i32 %60, i32* %7
br i1 %59, label %61, label %63
61: ; preds = %50
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
br label %65
63: ; preds = %50
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %65
65: ; preds = %63, %61
%66 = load i32, i32* %11
%67 = call i32 @listen(i32 %66, i32 10)
store i32 4, i32* %14
%68 = load i32, i32* @INET_ADDRSTRLEN
%69 = zext i32 %68 to i64
%70 = call i8* @llvm.stacksave()
store i8* %70, i8** %15
%71 = alloca i8, i64 %69
store i64 %69, i64* %16
br label %72
72: ; preds = %116, %77, %65
br label %73
73: ; preds = %72
%74 = load i32, i32* %11
%75 = call i32 @accept(i32 %74, %struct.sockaddr* %13, i32* %14)
store i32 %75, i32* %12
%76 = icmp eq i32 %75, -1
br i1 %76, label %77, label %79
77: ; preds = %73
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
br label %72
79: ; preds = %73
%80 = bitcast %struct.sockaddr* %13 to %struct.sockaddr_in*
store %struct.sockaddr_in* %80, %struct.sockaddr_in** %17
%81 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %13, i32 0, i32 0
%82 = load i32, i32* %81
%83 = load %struct.sockaddr_in*, %struct.sockaddr_in** %17
%84 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %83, i32 0, i32 0
%85 = load i32, i32* @INET_ADDRSTRLEN
%86 = call i32 @inet_ntop(i32 %82, i32* %84, i8* %71, i32 %85)
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0), i8* %71)
br label %88
88: ; preds = %79
store i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.9, i64 0, i64 0), i8** %18
%89 = load i32, i32* %12
%90 = load i8*, i8** %18
%91 = load i8*, i8** %18
%92 = call i64 @strlen(i8* %91)
%93 = call i64 @send(i32 %89, i8* %90, i64 %92, i32 0)
%94 = load i8*, i8** %18
%95 = call i64 @strlen(i8* %94)
%96 = icmp slt i64 %93, %95
br i1 %96, label %97, label %99
97: ; preds = %88
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.10, i64 0, i64 0))
br label %99
99: ; preds = %97, %88
br label %100
100: ; preds = %115, %99
br label %101
101: ; preds = %100
%102 = load i32, i32* %12
%103 = getelementptr inbounds [1000 x i8], [1000 x i8]* %19, i64 0, i64 0
%104 = getelementptr inbounds [1000 x i8], [1000 x i8]* %19, i64 0, i64 0
%105 = call i64 @strlen(i8* %104)
%106 = call i32 @recv(i32 %102, i8* %103, i64 %105, i32 0)
%107 = icmp slt i32 %106, 1
br i1 %107, label %108, label %110
108: ; preds = %101
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.11, i64 0, i64 0))
br label %116
110: ; preds = %101
%111 = getelementptr inbounds [1000 x i8], [1000 x i8]* %19, i64 0, i64 0
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %111)
%113 = load i32, i32* @stdout
%114 = call i32 @fflush(i32 %113)
br label %115
115: ; preds = %110
br label %100
116: ; preds = %108
br label %72
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32, i64, i32, i32, i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@AI_PASSIVE = global i32 0
@.str = [5 x i8] c"1305\00"
@INET_ADDRSTRLEN = global i32 0
@.str.8 = [48 x i8] c"Accepting connection ...OK\0AConnecting to %s...\0A\00"
@.str.9 = [41 x i8] c"Welcome to the server. Send your message\00"
@.str.11 = [41 x i8] c"Server faces an error receiving bytes...\00"
@.str.12 = [3 x i8] c"%s\00"
@stdout = global i32 0
@str = [20 x i8] c"Getaddressinfo...OK\00"
@str.13 = [12 x i8] c"Socket...OK\00"
@str.14 = [10 x i8] c"Bind...OK\00"
@str.15 = [56 x i8] c"Warning:not all of the welcome message has been sent...\00"
@str.16 = [27 x i8] c"Error accepting connection\00"
@str.17 = [21 x i8] c"Error socket binding\00"
@str.18 = [21 x i8] c"Error socket loading\00"
@str.19 = [21 x i8] c"Error Getaddressinfo\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = alloca %struct.sockaddr
%6 = alloca i32
%7 = alloca [1000 x i8]
%8 = bitcast %struct.addrinfo* %3 to i8*
%9 = bitcast %struct.addrinfo** %4 to i8*
%10 = call i32 @memset(%struct.addrinfo* %3, i32 0, i32 32)
%11 = load i32, i32* @AF_INET
%12 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i32 %11, i32* %12
%13 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 2
store i64 0, i64* %13
%14 = load i32, i32* @SOCK_STREAM
%15 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 3
store i32 %14, i32* %15
%16 = load i32, i32* @AI_PASSIVE
%17 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 5
store i32 %16, i32* %17
%18 = call i32 @getaddrinfo(i32* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %struct.addrinfo* %3, %struct.addrinfo** %4)
%19 = icmp eq i32 %18, 0
%20 = select i1 %19, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str.19, i64 0, i64 0)
%21 = call i32 @puts(i8* dereferenceable(1) %20)
%22 = load %struct.addrinfo*, %struct.addrinfo** %4
%23 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %22, i64 0, i32 4
%24 = load i32, i32* %23
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %22, i64 0, i32 3
%26 = load i32, i32* %25
%27 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %22, i64 0, i32 2
%28 = load i64, i64* %27
%29 = call i32 @socket(i32 %24, i32 %26, i64 %28)
%30 = icmp eq i32 %29, -1
%31 = select i1 %30, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str.18, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.13, i64 0, i64 0)
%32 = call i32 @puts(i8* dereferenceable(1) %31)
%33 = load %struct.addrinfo*, %struct.addrinfo** %4
%34 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %33, i64 0, i32 1
%35 = load i32, i32* %34
%36 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %33, i64 0, i32 0
%37 = load i32, i32* %36
%38 = call i32 @bind(i32 %29, i32 %35, i32 %37)
%39 = icmp eq i32 %38, -1
%40 = select i1 %39, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str.17, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.14, i64 0, i64 0)
%41 = call i32 @puts(i8* dereferenceable(1) %40)
%42 = call i32 @listen(i32 %29, i32 10)
%43 = bitcast %struct.sockaddr* %5 to i8*
%44 = bitcast i32* %6 to i8*
store i32 4, i32* %6
%45 = load i32, i32* @INET_ADDRSTRLEN
%46 = zext i32 %45 to i64
%47 = alloca i8, i64 %46
%48 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %5, i64 0, i32 0
%49 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
br label %50
50: ; preds = %55, %2
%51 = call i32 @accept(i32 %29, %struct.sockaddr* %5, i32* %6)
%52 = icmp eq i32 %51, -1
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.16, i64 0, i64 0))
br label %55
55: ; preds = %53, %69
br label %50
56: ; preds = %50
%57 = load i32, i32* %48
%58 = load i32, i32* @INET_ADDRSTRLEN
%59 = call i32 @inet_ntop(i32 %57, i32* %48, i8* %47, i32 %58)
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0), i8* %47)
%61 = call i64 @send(i32 %51, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.9, i64 0, i64 0), i64 40, i32 0)
%62 = icmp slt i64 %61, 40
br i1 %62, label %63, label %65
63: ; preds = %56
%64 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.15, i64 0, i64 0))
br label %65
65: ; preds = %63, %56
%66 = call i64 @strlen(i8* %49)
%67 = call i32 @recv(i32 %51, i8* %49, i64 %66, i32 0)
%68 = icmp slt i32 %67, 1
br i1 %68, label %69, label %71
69: ; preds = %71, %65
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.11, i64 0, i64 0))
br label %55
71: ; preds = %65, %71
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %49)
%73 = load i32, i32* @stdout
%74 = call i32 @fflush(i32 %73)
%75 = call i64 @strlen(i8* %49)
%76 = call i32 @recv(i32 %51, i8* %49, i64 %75, i32 0)
%77 = icmp slt i32 %76, 1
br i1 %77, label %69, label %71
}