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

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ MSG_NOSIGNAL;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int /*<<< orphan*/ *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ listen(int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
scalar_t__ read(int, char *, int);
int send(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ usleep(int);
int main(int argc, char *argv[]) {
  int socket_desc, client_sock, c, read_size;
  int read_cnt = 0;
  struct sockaddr_in server, client;
  char client_message[2000];
  char sendBuff[1025];
  time_t ticks;
  int connected = 0;
  int temp1 = 1;
  int temp2 = 2;
  int temp3 = 3;
  int temp4 = 4;
  socket_desc = socket(AF_INET, SOCK_STREAM, 0);
  if (socket_desc == -1) {
    printf("Could not create socket");
  }
  puts("Socket created");
  server.sin_family = AF_INET;
  server.sin_addr.s_addr = INADDR_ANY;
  server.sin_port = htons(5000);
  if (bind(socket_desc, (struct sockaddr *)&server, sizeof(server)) < 0) {
    perror("bind failed. Error");
    return 1;
  }
  puts("bind done");
  listen(socket_desc, 3);
  puts("Waiting for incoming connections...");
  c = sizeof(struct sockaddr_in);
  while (1) {
    usleep(100000);
    if (connected == 0) {
      client_sock =
          accept(socket_desc, (struct sockaddr *)&client, (socklen_t *)&c);
      if (client_sock < 0) {
        perror("accept failed");
        return 1;
      } else {
        printf("Connection accepted %d\n", read_cnt);
        connected = 1;
      }
    } else {
      if (read(client_sock, sendBuff, 10) > 0) {
        if (sendBuff[0] = 0x5a) {
          printf("wyslij...\n");
          sendBuff[0] = temp1 & 0x00ff;
          sendBuff[1] = (temp1 & 0xff00) >> 8;
          sendBuff[2] = temp2 & 0x00ff;
          sendBuff[3] = (temp2 & 0xff00) >> 8;
          sendBuff[4] = temp3 & 0x00ff;
          sendBuff[5] = (temp3 & 0xff00) >> 8;
          sendBuff[6] = temp4 & 0x00ff;
          sendBuff[7] = (temp4 & 0xff00) >> 8;
          int stat = send(client_sock, sendBuff, 10, MSG_NOSIGNAL);
          if (stat == -1) {
            close(client_sock);
            connected = 0;
            printf("zamknij soket!!!!\n");
          } else {
            temp1++;
            temp2++;
            temp3++;
            temp4++;
            printf("%d %d %d %d\n", temp1, temp2, temp3, temp4);
          }
        }
      } else {
        close(client_sock);
        connected = 0;
        printf("zamknij soket!!!!\n");
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0xc28(%rbp)
movl   $0x1,-0xc2c(%rbp)
movl   $0x2,-0xc30(%rbp)
movl   $0x3,-0xc34(%rbp)
movl   $0x4,-0xc38(%rbp)
mov    0x2dcf(%rip),%rax
mov    (%rax),%edi
mov    0x2dae(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1246 <main+0x86>
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdcb(%rip),%rdi
call   1030 <puts@plt>
mov    0x2d8f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2d7b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    $0x1388,%edi
call   1040 <htons@plt>
mov    %eax,-0x30(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0xc,%edx
call   10a0 <bind@plt>
cmp    $0x0,%rax
jge    12aa <main+0xea>
lea    0xd8e(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1504 <main+0x344>
lea    0xd89(%rip),%rdi
call   1030 <puts@plt>
mov    -0x14(%rbp),%edi
mov    $0x3,%esi
call   1090 <listen@plt>
lea    0xd7a(%rip),%rdi
call   1030 <puts@plt>
movl   $0xc,-0x1c(%rbp)
mov    $0x186a0,%edi
call   10d0 <usleep@plt>
cmpl   $0x0,-0xc28(%rbp)
jne    1342 <main+0x182>
mov    -0x14(%rbp),%edi
lea    -0x40(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   10c0 <accept@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1322 <main+0x162>
lea    0xd57(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1504 <main+0x344>
mov    -0x24(%rbp),%esi
lea    0xd4a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0xc28(%rbp)
jmp    14ff <main+0x33f>
mov    -0x18(%rbp),%edi
lea    -0xc20(%rbp),%rsi
mov    $0xa,%edx
call   1080 <read@plt>
cmp    $0x0,%rax
jle    14da <main+0x31a>
movb   $0x5a,-0xc20(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    1376 <main+0x1b6>
jmp    14d5 <main+0x315>
lea    0xd11(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xc2c(%rbp),%eax
and    $0xff,%eax
mov    %al,-0xc20(%rbp)
mov    -0xc2c(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
mov    %al,-0xc1f(%rbp)
mov    -0xc30(%rbp),%eax
and    $0xff,%eax
mov    %al,-0xc1e(%rbp)
mov    -0xc30(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
mov    %al,-0xc1d(%rbp)
mov    -0xc34(%rbp),%eax
and    $0xff,%eax
mov    %al,-0xc1c(%rbp)
mov    -0xc34(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
mov    %al,-0xc1b(%rbp)
mov    -0xc38(%rbp),%eax
and    $0xff,%eax
mov    %al,-0xc1a(%rbp)
mov    -0xc38(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
mov    %al,-0xc19(%rbp)
mov    -0x18(%rbp),%edi
lea    -0xc20(%rbp),%rsi
mov    0x2b9f(%rip),%rax
mov    (%rax),%ecx
mov    $0xa,%edx
call   1050 <send@plt>
mov    %eax,-0xc3c(%rbp)
cmpl   $0xffffffff,-0xc3c(%rbp)
jne    146d <main+0x2ad>
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
movl   $0x0,-0xc28(%rbp)
lea    0xc38(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    14d0 <main+0x310>
mov    -0xc2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc2c(%rbp)
mov    -0xc30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc30(%rbp)
mov    -0xc34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc34(%rbp)
mov    -0xc38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc38(%rbp)
mov    -0xc2c(%rbp),%esi
mov    -0xc30(%rbp),%edx
mov    -0xc34(%rbp),%ecx
mov    -0xc38(%rbp),%r8d
lea    0xbe3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    14d5 <main+0x315>
jmp    14fa <main+0x33a>
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
movl   $0x0,-0xc28(%rbp)
lea    0xba6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    14ff <main+0x33f>
jmp    12d6 <main+0x116>
mov    -0x4(%rbp),%eax
add    $0xc40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x478,%rsp
mov    0x2e10(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2dee(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1200 <main+0x40>
lea    0xe07(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe11(%rip),%rdi
call   1030 <puts@plt>
mov    0x0(%rbp),%eax
mov    %eax,0x48(%rsp)
mov    0x2dc6(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x44(%rsp)
mov    $0x1388,%edi
call   1040 <htons@plt>
mov    %eax,0x40(%rsp)
lea    0x40(%rsp),%rsi
mov    %ebx,%edi
mov    $0xc,%edx
call   10a0 <bind@plt>
test   %rax,%rax
jns    1250 <main+0x90>
lea    0xddc(%rip),%rdi
jmp    149b <main+0x2db>
lea    0xde3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x3,%eax
mov    %rax,0x28(%rsp)
mov    %ebx,0x30(%rsp)
mov    %ebx,%edi
mov    $0x3,%esi
call   1090 <listen@plt>
lea    0xdc7(%rip),%rdi
call   1030 <puts@plt>
movl   $0xc,0x3c(%rsp)
mov    $0x4,%r15d
mov    $0x2,%eax
mov    $0x1,%ecx
mov    %rcx,0x20(%rsp)
mov    $0x1,%cl
mov    %ecx,0x18(%rsp)
lea    0x70(%rsp),%r14
nopw   0x0(%rax,%rax,1)
xor    %ebx,%ebx
mov    0x18(%rsp),%r12d
mov    %r13d,0x38(%rsp)
mov    %rax,0x58(%rsp)
mov    %r15,0x50(%rsp)
cs nopw 0x0(%rax,%rax,1)
mov    0x20(%rsp),%rcx
lea    (%rcx,%rbx,1),%ebp
add    %ebx,%eax
mov    %eax,0x10(%rsp)
mov    0x28(%rsp),%rax
add    %ebx,%eax
mov    %eax,0xc(%rsp)
lea    (%r15,%rbx,1),%eax
mov    %eax,0x14(%rsp)
mov    $0x186a0,%edi
call   10d0 <usleep@plt>
test   $0x1,%r12b
jne    1442 <main+0x282>
mov    %r13d,%edi
mov    %r14,%rsi
mov    $0xa,%edx
call   1080 <read@plt>
test   %rax,%rax
jle    1400 <main+0x240>
mov    %rbx,0x18(%rsp)
mov    %ebp,%r14d
shr    $0x8,%r14d
mov    0x10(%rsp),%ebx
shr    $0x8,%ebx
mov    0xc(%rsp),%r15d
shr    $0x8,%r15d
mov    0x14(%rsp),%r12d
mov    %r12d,%r13d
shr    $0x8,%r13d
movb   $0x5a,0x70(%rsp)
lea    0xd49(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,0x34(%rsp)
mov    %bpl,0x70(%rsp)
mov    %r14b,0x71(%rsp)
mov    0x10(%rsp),%edx
mov    %dl,0x72(%rsp)
mov    %bl,0x73(%rsp)
lea    0x70(%rsp),%r14
mov    0xc(%rsp),%eax
mov    %al,0x74(%rsp)
mov    %r15b,0x75(%rsp)
mov    %r12b,0x76(%rsp)
mov    %r13b,0x77(%rsp)
mov    0x38(%rsp),%r13d
mov    0x2c2f(%rip),%rax
mov    (%rax),%ecx
mov    %r13d,%edi
mov    %r14,%rsi
mov    $0xa,%edx
call   1050 <send@plt>
cmp    $0xffffffff,%eax
je     1420 <main+0x260>
mov    0x20(%rsp),%rax
mov    0x18(%rsp),%rbx
lea    (%rax,%rbx,1),%esi
add    $0x1,%esi
mov    0x58(%rsp),%rbp
lea    0x1(%rbp,%rbx,1),%edx
mov    0x28(%rsp),%rax
lea    (%rax,%rbx,1),%ecx
add    $0x1,%ecx
mov    0x50(%rsp),%r15
lea    (%r15,%rbx,1),%r8d
add    $0x1,%r8d
xor    %r12d,%r12d
lea    0xca3(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rax
add    $0x1,%ebx
jmp    12d0 <main+0x110>
nopl   (%rax)
mov    %r13d,%edi
call   1070 <close@plt>
lea    0xc96(%rip),%rdi
call   1030 <puts@plt>
jmp    1438 <main+0x278>
cs nopw 0x0(%rax,%rax,1)
mov    %r13d,%edi
call   1070 <close@plt>
lea    0xc76(%rip),%rdi
call   1030 <puts@plt>
mov    0x34(%rsp),%ebp
mov    $0x186a0,%edi
call   10d0 <usleep@plt>
mov    0x30(%rsp),%edi
lea    0x60(%rsp),%rsi
lea    0x3c(%rsp),%rdx
call   10c0 <accept@plt>
test   %eax,%eax
js     1494 <main+0x2d4>
mov    %eax,%r13d
movl   $0x0,0x18(%rsp)
lea    0xc0b(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,%eax
mov    %rax,0x20(%rsp)
mov    0x10(%rsp),%eax
mov    0xc(%rsp),%ecx
mov    %rcx,0x28(%rsp)
mov    0x14(%rsp),%ecx
mov    %ecx,%r15d
jmp    12b0 <main+0xf0>
lea    0xbcd(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%eax
add    $0x478,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [24 x i8] c"Could not create socket\00"
@.str.1 = [15 x i8] c"Socket created\00"
@INADDR_ANY = global i32 0
@.str.2 = [19 x i8] c"bind failed. Error\00"
@.str.3 = [10 x i8] c"bind done\00"
@.str.4 = [36 x i8] c"Waiting for incoming connections...\00"
@.str.5 = [14 x i8] c"accept failed\00"
@.str.6 = [24 x i8] c"Connection accepted %d\0A\00"
@.str.7 = [11 x i8] c"wyslij...\0A\00"
@MSG_NOSIGNAL = global i32 0
@.str.8 = [19 x i8] c"zamknij soket!!!!\0A\00"
@.str.9 = [13 x i8] c"%d %d %d %d\0A\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 i32
%11 = alloca %struct.sockaddr_in
%12 = alloca %struct.sockaddr_in
%13 = alloca [2000 x i8]
%14 = alloca [1025 x i8]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
store i32 0, i32* %16
store i32 1, i32* %17
store i32 2, i32* %18
store i32 3, i32* %19
store i32 4, i32* %20
%22 = load i32, i32* @AF_INET
%23 = load i32, i32* @SOCK_STREAM
%24 = call i32 @socket(i32 %22, i32 %23, i32 0)
store i32 %24, i32* %6
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, -1
br i1 %26, label %27, label %29
27: ; preds = %2
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %29
29: ; preds = %27, %2
%30 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%31 = load i32, i32* @AF_INET
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 2
store i32 %31, i32* %32
%33 = load i32, i32* @INADDR_ANY
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
%35 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %34, i32 0, i32 0
store i32 %33, i32* %35
%36 = call i32 @htons(i32 5000)
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
store i32 %36, i32* %37
%38 = load i32, i32* %6
%39 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%40 = call i64 @bind(i32 %38, %struct.sockaddr* %39, i32 12)
%41 = icmp slt i64 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %29
%43 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %142
44: ; preds = %29
%45 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%46 = load i32, i32* %6
%47 = call i32 @listen(i32 %46, i32 3)
%48 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
store i32 12, i32* %8
br label %49
49: ; preds = %44, %141
%50 = call i32 @usleep(i32 100000)
%51 = load i32, i32* %16
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %65
53: ; preds = %49
%54 = load i32, i32* %6
%55 = bitcast %struct.sockaddr_in* %12 to %struct.sockaddr*
%56 = call i32 @accept(i32 %54, %struct.sockaddr* %55, i32* %8)
store i32 %56, i32* %7
%57 = load i32, i32* %7
%58 = icmp slt i32 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %53
%60 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %142
61: ; preds = %53
%62 = load i32, i32* %10
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i32 %62)
store i32 1, i32* %16
br label %64
64: ; preds = %61
br label %141
65: ; preds = %49
%66 = load i32, i32* %7
%67 = getelementptr inbounds [1025 x i8], [1025 x i8]* %14, i64 0, i64 0
%68 = call i64 @read(i32 %66, i8* %67, i32 10)
%69 = icmp sgt i64 %68, 0
br i1 %69, label %70, label %136
70: ; preds = %65
%71 = getelementptr inbounds [1025 x i8], [1025 x i8]* %14, i64 0, i64 0
store i8 90, i8* %71
br i1 true, label %72, label %135
72: ; preds = %70
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%74 = load i32, i32* %17
%75 = and i32 %74, 255
%76 = trunc i32 %75 to i8
%77 = getelementptr inbounds [1025 x i8], [1025 x i8]* %14, i64 0, i64 0
store i8 %76, i8* %77
%78 = load i32, i32* %17
%79 = and i32 %78, 65280
%80 = ashr i32 %79, 8
%81 = trunc i32 %80 to i8
%82 = getelementptr inbounds [1025 x i8], [1025 x i8]* %14, i64 0, i64 1
store i8 %81, i8* %82
%83 = load i32, i32* %18
%84 = and i32 %83, 255
%85 = trunc i32 %84 to i8
%86 = getelementptr inbounds [1025 x i8], [1025 x i8]* %14, i64 0, i64 2
store i8 %85, i8* %86
%87 = load i32, i32* %18
%88 = and i32 %87, 65280
%89 = ashr i32 %88, 8
%90 = trunc i32 %89 to i8
%91 = getelementptr inbounds [1025 x i8], [1025 x i8]* %14, i64 0, i64 3
store i8 %90, i8* %91
%92 = load i32, i32* %19
%93 = and i32 %92, 255
%94 = trunc i32 %93 to i8
%95 = getelementptr inbounds [1025 x i8], [1025 x i8]* %14, i64 0, i64 4
store i8 %94, i8* %95
%96 = load i32, i32* %19
%97 = and i32 %96, 65280
%98 = ashr i32 %97, 8
%99 = trunc i32 %98 to i8
%100 = getelementptr inbounds [1025 x i8], [1025 x i8]* %14, i64 0, i64 5
store i8 %99, i8* %100
%101 = load i32, i32* %20
%102 = and i32 %101, 255
%103 = trunc i32 %102 to i8
%104 = getelementptr inbounds [1025 x i8], [1025 x i8]* %14, i64 0, i64 6
store i8 %103, i8* %104
%105 = load i32, i32* %20
%106 = and i32 %105, 65280
%107 = ashr i32 %106, 8
%108 = trunc i32 %107 to i8
%109 = getelementptr inbounds [1025 x i8], [1025 x i8]* %14, i64 0, i64 7
store i8 %108, i8* %109
%110 = load i32, i32* %7
%111 = getelementptr inbounds [1025 x i8], [1025 x i8]* %14, i64 0, i64 0
%112 = load i32, i32* @MSG_NOSIGNAL
%113 = call i32 @send(i32 %110, i8* %111, i32 10, i32 %112)
store i32 %113, i32* %21
%114 = load i32, i32* %21
%115 = icmp eq i32 %114, -1
br i1 %115, label %116, label %120
116: ; preds = %72
%117 = load i32, i32* %7
%118 = call i32 @close(i32 %117)
store i32 0, i32* %16
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
br label %134
120: ; preds = %72
%121 = load i32, i32* %17
%122 = add nsw i32 %121, 1
store i32 %122, i32* %17
%123 = load i32, i32* %18
%124 = add nsw i32 %123, 1
store i32 %124, i32* %18
%125 = load i32, i32* %19
%126 = add nsw i32 %125, 1
store i32 %126, i32* %19
%127 = load i32, i32* %20
%128 = add nsw i32 %127, 1
store i32 %128, i32* %20
%129 = load i32, i32* %17
%130 = load i32, i32* %18
%131 = load i32, i32* %19
%132 = load i32, i32* %20
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %129, i32 %130, i32 %131, i32 %132)
br label %134
134: ; preds = %120, %116
br label %135
135: ; preds = %134, %70
br label %140
136: ; preds = %65
%137 = load i32, i32* %7
%138 = call i32 @close(i32 %137)
store i32 0, i32* %16
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
br label %140
140: ; preds = %136, %135
br label %141
141: ; preds = %140, %64
br label %49
142: ; preds = %59, %42
%143 = load i32, i32* %3
ret i32 %143
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [24 x i8] c"Could not create socket\00"
@.str.1 = [15 x i8] c"Socket created\00"
@INADDR_ANY = global i32 0
@.str.2 = [19 x i8] c"bind failed. Error\00"
@.str.3 = [10 x i8] c"bind done\00"
@.str.4 = [36 x i8] c"Waiting for incoming connections...\00"
@.str.5 = [14 x i8] c"accept failed\00"
@.str.6 = [24 x i8] c"Connection accepted %d\0A\00"
@MSG_NOSIGNAL = global i32 0
@.str.9 = [13 x i8] c"%d %d %d %d\0A\00"
@str.10 = [10 x i8] c"wyslij...\00"
@str.11 = [18 x i8] c"zamknij soket!!!!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca %struct.sockaddr_in
%6 = alloca [1025 x i8]
%7 = bitcast i32* %3 to i8*
%8 = bitcast %struct.sockaddr_in* %4 to i8*
%9 = bitcast %struct.sockaddr_in* %5 to i8*
%10 = getelementptr inbounds [1025 x i8], [1025 x i8]* %6, i64 0, i64 0
%11 = load i32, i32* @AF_INET
%12 = load i32, i32* @SOCK_STREAM
%13 = tail call i32 @socket(i32 %11, i32 %12, i32 0)
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %2
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%19 = load i32, i32* @AF_INET
%20 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %19, i32* %20
%21 = load i32, i32* @INADDR_ANY
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1, i32 0
store i32 %21, i32* %22
%23 = tail call i32 @htons(i32 5000)
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
store i32 %23, i32* %24
%25 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%26 = call i64 @bind(i32 %13, %struct.sockaddr* %25, i32 12)
%27 = icmp slt i64 %26, 0
br i1 %27, label %93, label %28
28: ; preds = %17
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 @listen(i32 %13, i32 3)
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
store i32 12, i32* %3
%32 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%33 = getelementptr inbounds [1025 x i8], [1025 x i8]* %6, i64 0, i64 1
%34 = getelementptr inbounds [1025 x i8], [1025 x i8]* %6, i64 0, i64 2
%35 = getelementptr inbounds [1025 x i8], [1025 x i8]* %6, i64 0, i64 3
%36 = getelementptr inbounds [1025 x i8], [1025 x i8]* %6, i64 0, i64 4
%37 = getelementptr inbounds [1025 x i8], [1025 x i8]* %6, i64 0, i64 5
%38 = getelementptr inbounds [1025 x i8], [1025 x i8]* %6, i64 0, i64 6
%39 = getelementptr inbounds [1025 x i8], [1025 x i8]* %6, i64 0, i64 7
br label %40
40: ; preds = %71, %28
%41 = phi i32 [ %69, %71 ], [ undef, %28 ]
%42 = phi i1 [ false, %71 ], [ true, %28 ]
%43 = phi i32 [ %49, %71 ], [ 1, %28 ]
%44 = phi i32 [ %50, %71 ], [ 2, %28 ]
%45 = phi i32 [ %51, %71 ], [ 3, %28 ]
%46 = phi i32 [ %52, %71 ], [ 4, %28 ]
br label %47
47: ; preds = %40, %84
%48 = phi i1 [ %42, %40 ], [ false, %84 ]
%49 = phi i32 [ %43, %40 ], [ %85, %84 ]
%50 = phi i32 [ %44, %40 ], [ %86, %84 ]
%51 = phi i32 [ %45, %40 ], [ %87, %84 ]
%52 = phi i32 [ %46, %40 ], [ %88, %84 ]
%53 = trunc i32 %49 to i8
%54 = lshr i32 %49, 8
%55 = trunc i32 %54 to i8
%56 = trunc i32 %50 to i8
%57 = lshr i32 %50, 8
%58 = trunc i32 %57 to i8
%59 = trunc i32 %51 to i8
%60 = lshr i32 %51, 8
%61 = trunc i32 %60 to i8
%62 = trunc i32 %52 to i8
%63 = lshr i32 %52, 8
%64 = trunc i32 %63 to i8
%65 = call i32 @usleep(i32 100000)
br i1 %48, label %68, label %73
66: ; preds = %90, %81
%67 = call i32 @usleep(i32 100000)
br label %68
68: ; preds = %66, %47
%69 = call i32 @accept(i32 %13, %struct.sockaddr* %32, i32* %3)
%70 = icmp slt i32 %69, 0
br i1 %70, label %93, label %71
71: ; preds = %68
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i32 0)
br label %40
73: ; preds = %47
%74 = call i64 @read(i32 %41, i8* %10, i32 10)
%75 = icmp sgt i64 %74, 0
br i1 %75, label %76, label %90
76: ; preds = %73
store i8 90, i8* %10
%77 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.10, i64 0, i64 0))
store i8 %53, i8* %10
store i8 %55, i8* %33
store i8 %56, i8* %34
store i8 %58, i8* %35
store i8 %59, i8* %36
store i8 %61, i8* %37
store i8 %62, i8* %38
store i8 %64, i8* %39
%78 = load i32, i32* @MSG_NOSIGNAL
%79 = call i32 @send(i32 %41, i8* %10, i32 10, i32 %78)
%80 = icmp eq i32 %79, -1
br i1 %80, label %81, label %84
81: ; preds = %76
%82 = call i32 @close(i32 %41)
%83 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.11, i64 0, i64 0))
br label %66
84: ; preds = %76
%85 = add nsw i32 %49, 1
%86 = add nsw i32 %50, 1
%87 = add nsw i32 %51, 1
%88 = add nsw i32 %52, 1
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %85, i32 %86, i32 %87, i32 %88)
br label %47
90: ; preds = %73
%91 = call i32 @close(i32 %41)
%92 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.11, i64 0, i64 0))
br label %66
93: ; preds = %68, %17
%94 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), %17 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), %68 ]
%95 = call i32 @perror(i8* %94)
ret i32 1
}