#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;
};
typedef int /*<<< orphan*/ msgtype;
typedef int msgaddr;
typedef int /*<<< orphan*/ msg;
typedef int /*<<< orphan*/ koserver;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ Die(char *);
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int atoi(char *);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int recv_line(int, char *);
int send(int, char *, scalar_t__, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
scalar_t__ strlen(char *);
char *strtok(char *, char *);
int main(int argc, char *argv[]) {
  int sock;
  struct sockaddr_in koserver;
  char buffer[32000];
  unsigned int secretlen;
  int received = 0;
  char secret[255] = "\0";
  int n;
  if (argc < 3) {
    fprintf(stderr, "USAGE: <hs_ip> <port> <secret>\n");
    exit(1);
  }
  if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
    Die("Failed to create socket");
  }
  memset(&koserver, 0, sizeof(koserver));
  koserver.sin_family = AF_INET;
  koserver.sin_addr.s_addr = inet_addr(argv[1]);
  koserver.sin_port = htons(atoi(argv[2]));
  if (connect(sock, (struct sockaddr *)&koserver, sizeof(koserver)) < 0) {
    Die("Failed to connect with server");
  }
  n = send(sock, secret, strlen(secret) + 1, 0);
  fprintf(stdout, "Received: ");
  int bytes = 1;
  int processed = 0;
  char recvchar = 1;
  int msizeDebug = 0;
  int msgCountDebug = 0;
  int msgtype;
  int msgaddr;
  unsigned char *msg;
  while (1) {
    bytes = recv_line(sock, buffer);
    if (bytes == 0)
      printf("NULL!\n");
    msgtype = atoi(strtok(buffer, "|"));
    msgaddr = atoi(strtok(NULL, "|"));
    msg = strtok(NULL, "|");
    printf("mem:%d t:%d %d/%d/%d D:%s\n", msizeDebug, msgtype,
           (msgaddr >> 11) & 0xff, (msgaddr >> 8) & 0x07, (msgaddr)&0xff, msg);
    if (msgtype == 2) {
      msizeDebug += sizeof(msgtype) + sizeof(msgaddr) + sizeof(msg);
    } else {
      msgCountDebug++;
    }
    if (msgCountDebug > 500)
      exit(0);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7e70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x7d28(%rbp)
lea    -0x7e30(%rbp),%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1070 <memset@plt>
cmpl   $0x3,-0x8(%rbp)
jge    123f <main+0x5f>
mov    0x2da9(%rip),%rax
mov    (%rax),%edi
lea    0xdd0(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2d7a(%rip),%rax
mov    (%rax),%edi
mov    0x2d79(%rip),%rax
mov    (%rax),%esi
mov    0x2d88(%rip),%rax
mov    (%rax),%edx
call   1100 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1277 <main+0x97>
lea    0xdae(%rip),%rdi
call   10a0 <Die@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1070 <memset@plt>
mov    0x2d5a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <inet_addr@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,%edi
call   1040 <htons@plt>
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   10f0 <connect@plt>
cmp    $0x0,%rax
jge    12e1 <main+0x101>
lea    0xd5c(%rip),%rdi
call   10a0 <Die@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x7e64(%rbp)
lea    -0x7e30(%rbp),%rax
mov    %rax,-0x7e60(%rbp)
lea    -0x7e30(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x7e64(%rbp),%edi
mov    -0x7e60(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
xor    %ecx,%ecx
call   1050 <send@plt>
mov    %eax,-0x7e34(%rbp)
mov    0x2c8c(%rip),%rax
mov    (%rax),%edi
lea    0xd21(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0x1,-0x7e38(%rbp)
movl   $0x0,-0x7e3c(%rbp)
movb   $0x1,-0x7e3d(%rbp)
movl   $0x0,-0x7e44(%rbp)
movl   $0x0,-0x7e48(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x7d20(%rbp),%rsi
call   10c0 <recv_line@plt>
mov    %eax,-0x7e38(%rbp)
cmpl   $0x0,-0x7e38(%rbp)
jne    1399 <main+0x1b9>
lea    0xccf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x7d20(%rbp),%rdi
lea    0xcc1(%rip),%rsi
call   10b0 <strtok@plt>
mov    %rax,%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x7e4c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xca3(%rip),%rsi
call   10b0 <strtok@plt>
mov    %rax,%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x7e50(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xc85(%rip),%rsi
call   10b0 <strtok@plt>
mov    %rax,-0x7e58(%rbp)
mov    -0x7e44(%rbp),%esi
mov    -0x7e4c(%rbp),%edx
mov    -0x7e50(%rbp),%ecx
sar    $0xb,%ecx
and    $0xff,%ecx
mov    -0x7e50(%rbp),%r8d
sar    $0x8,%r8d
and    $0x7,%r8d
mov    -0x7e50(%rbp),%r9d
and    $0xff,%r9d
mov    -0x7e58(%rbp),%rax
lea    0xc35(%rip),%rdi
mov    %rax,(%rsp)
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0x2,-0x7e4c(%rbp)
jne    1463 <main+0x283>
movslq -0x7e44(%rbp),%rax
add    $0x10,%rax
mov    %eax,-0x7e44(%rbp)
jmp    1472 <main+0x292>
mov    -0x7e48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7e48(%rbp)
cmpl   $0x1f4,-0x7e48(%rbp)
jle    1489 <main+0x2a9>
xor    %edi,%edi
call   10e0 <exit@plt>
jmp    1369 <main+0x189>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7e28,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0x10f(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
cmp    $0x2,%edi
jg     1296 <main+0xa6>
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
lea    0xd79(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    %rsi,%rbx
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
mov    0x2d1f(%rip),%rax
mov    (%rax),%esi
mov    0x2d2e(%rip),%rax
mov    (%rax),%edx
call   1110 <socket@plt>
mov    %eax,0xc(%rsp)
test   %eax,%eax
jns    12cd <main+0xdd>
lea    0xd58(%rip),%rdi
call   10b0 <Die@plt>
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1080 <memset@plt>
mov    0x2d00(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
mov    0x8(%rbx),%rdi
call   1090 <inet_addr@plt>
mov    %eax,0x14(%rsp)
mov    0x10(%rbx),%rdi
call   10e0 <atoi@plt>
mov    %eax,%edi
call   1050 <htons@plt>
mov    %eax,0x10(%rsp)
mov    0xc(%rsp),%edi
mov    %rbp,%rsi
mov    $0xc,%edx
call   1100 <connect@plt>
test   %rax,%rax
jns    1331 <main+0x141>
lea    0xd0c(%rip),%rdi
call   10b0 <Die@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdx
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
xor    %ecx,%ecx
call   1060 <send@plt>
mov    0x2c61(%rip),%rax
mov    (%rax),%edi
lea    0xcf6(%rip),%rsi
call   10a0 <fprintf@plt>
lea    0x120(%rsp),%r13
lea    0xced(%rip),%rbp
xor    %r15d,%r15d
xor    %ebx,%ebx
jmp    1401 <main+0x211>
xchg   %ax,%ax
mov    %r13,%rdi
mov    %rbp,%rsi
call   10c0 <strtok@plt>
mov    %rax,%rdi
call   10e0 <atoi@plt>
mov    %eax,%r14d
xor    %edi,%edi
mov    %rbp,%rsi
call   10c0 <strtok@plt>
mov    %rax,%rdi
call   10e0 <atoi@plt>
mov    %eax,%r12d
xor    %edi,%edi
mov    %rbp,%rsi
call   10c0 <strtok@plt>
mov    %r12d,%ecx
shr    $0xb,%ecx
movzbl %cl,%ecx
mov    %r12d,%r8d
shr    $0x8,%r8d
and    $0x7,%r8d
movzbl %r12b,%r9d
mov    %rax,(%rsp)
lea    0xc8b(%rip),%rdi
mov    %ebx,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x10(%rbx),%eax
xor    %ecx,%ecx
cmp    $0x2,%r14d
setne  %cl
cmovne %ebx,%eax
add    %ecx,%r15d
mov    %eax,%ebx
cmp    $0x1f5,%r15d
jae    1426 <main+0x236>
mov    0xc(%rsp),%edi
mov    %r13,%rsi
call   10d0 <recv_line@plt>
test   %eax,%eax
jne    1380 <main+0x190>
lea    0xc62(%rip),%rdi
call   1030 <puts@plt>
jmp    1380 <main+0x190>
xor    %edi,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [32 x i8] c"USAGE: <hs_ip> <port> <secret>\0A\00"
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str.1 = [24 x i8] c"Failed to create socket\00"
@AF_INET = global i32 0
@.str.2 = [30 x i8] c"Failed to connect with server\00"
@stdout = global i32 0
@.str.3 = [11 x i8] c"Received: \00"
@.str.4 = [7 x i8] c"NULL!\0A\00"
@.str.5 = [2 x i8] c"|\00"
@.str.6 = [27 x i8] c"mem:%d t:%d %d/%d/%d D:%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.sockaddr_in
%8 = alloca [32000 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca [255 x i8]
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
%21 = bitcast [255 x i8]* %11 to i8*
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 3
br i1 %23, label %24, label %28
24: ; preds = %2
%25 = load i32, i32* @stderr
%26 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %2
%29 = load i32, i32* @PF_INET
%30 = load i32, i32* @SOCK_STREAM
%31 = load i32, i32* @IPPROTO_TCP
%32 = call i32 @socket(i32 %29, i32 %30, i32 %31)
store i32 %32, i32* %6
%33 = icmp slt i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %28
%35 = call i32 @Die(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %36
36: ; preds = %34, %28
%37 = call i32 @memset(%struct.sockaddr_in* %7, i32 0, i32 12)
%38 = load i32, i32* @AF_INET
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 2
store i32 %38, i32* %39
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = call i32 @inet_addr(i8* %42)
%44 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
%45 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %44, i32 0, i32 0
store i32 %43, i32* %45
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 2
%48 = load i8*, i8** %47
%49 = call i32 @atoi(i8* %48)
%50 = call i32 @htons(i32 %49)
%51 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
store i32 %50, i32* %51
%52 = load i32, i32* %6
%53 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%54 = call i64 @connect(i32 %52, %struct.sockaddr* %53, i32 12)
%55 = icmp slt i64 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %36
%57 = call i32 @Die(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %58
58: ; preds = %56, %36
%59 = load i32, i32* %6
%60 = getelementptr inbounds [255 x i8], [255 x i8]* %11, i64 0, i64 0
%61 = getelementptr inbounds [255 x i8], [255 x i8]* %11, i64 0, i64 0
%62 = call i64 @strlen(i8* %61)
%63 = add nsw i64 %62, 1
%64 = call i32 @send(i32 %59, i8* %60, i64 %63, i32 0)
store i32 %64, i32* %12
%65 = load i32, i32* @stdout
%66 = call i32 @fprintf(i32 %65, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %13
store i32 0, i32* %14
store i8 1, i8* %15
store i32 0, i32* %16
store i32 0, i32* %17
br label %67
67: ; preds = %58, %109
%68 = load i32, i32* %6
%69 = getelementptr inbounds [32000 x i8], [32000 x i8]* %8, i64 0, i64 0
%70 = call i32 @recv_line(i32 %68, i8* %69)
store i32 %70, i32* %13
%71 = load i32, i32* %13
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %67
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %75
75: ; preds = %73, %67
%76 = getelementptr inbounds [32000 x i8], [32000 x i8]* %8, i64 0, i64 0
%77 = call i8* @strtok(i8* %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%78 = call i32 @atoi(i8* %77)
store i32 %78, i32* %18
%79 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%80 = call i32 @atoi(i8* %79)
store i32 %80, i32* %19
%81 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i8* %81, i8** %20
%82 = load i32, i32* %16
%83 = load i32, i32* %18
%84 = load i32, i32* %19
%85 = ashr i32 %84, 11
%86 = and i32 %85, 255
%87 = load i32, i32* %19
%88 = ashr i32 %87, 8
%89 = and i32 %88, 7
%90 = load i32, i32* %19
%91 = and i32 %90, 255
%92 = load i8*, i8** %20
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 %82, i32 %83, i32 %86, i32 %89, i32 %91, i8* %92)
%94 = load i32, i32* %18
%95 = icmp eq i32 %94, 2
br i1 %95, label %96, label %101
96: ; preds = %75
%97 = load i32, i32* %16
%98 = sext i32 %97 to i64
%99 = add i64 %98, 16
%100 = trunc i64 %99 to i32
store i32 %100, i32* %16
br label %104
101: ; preds = %75
%102 = load i32, i32* %17
%103 = add nsw i32 %102, 1
store i32 %103, i32* %17
br label %104
104: ; preds = %101, %96
%105 = load i32, i32* %17
%106 = icmp sgt i32 %105, 500
br i1 %106, label %107, label %109
107: ; preds = %104
%108 = call i32 @exit(i32 0)
unreachable
109: ; preds = %104
br label %67
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [32 x i8] c"USAGE: <hs_ip> <port> <secret>\0A\00"
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str.1 = [24 x i8] c"Failed to create socket\00"
@AF_INET = global i32 0
@.str.2 = [30 x i8] c"Failed to connect with server\00"
@stdout = global i32 0
@.str.3 = [11 x i8] c"Received: \00"
@.str.5 = [2 x i8] c"|\00"
@.str.6 = [27 x i8] c"mem:%d t:%d %d/%d/%d D:%s\0A\00"
@str = [6 x i8] c"NULL!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [32000 x i8]
%5 = alloca [255 x i8]
%6 = bitcast %struct.sockaddr_in* %3 to i8*
%7 = getelementptr inbounds [32000 x i8], [32000 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%9 = icmp slt i32 %0, 3
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = load i32, i32* @PF_INET
%16 = load i32, i32* @SOCK_STREAM
%17 = load i32, i32* @IPPROTO_TCP
%18 = tail call i32 @socket(i32 %15, i32 %16, i32 %17)
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = tail call i32 @Die(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %14
%23 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%24 = load i32, i32* @AF_INET
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %24, i32* %25
%26 = getelementptr inbounds i8*, i8** %1, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @inet_addr(i8* %27)
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %28, i32* %29
%30 = getelementptr inbounds i8*, i8** %1, i64 2
%31 = load i8*, i8** %30
%32 = call i32 @atoi(i8* %31)
%33 = call i32 @htons(i32 %32)
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %33, i32* %34
%35 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%36 = call i64 @connect(i32 %18, %struct.sockaddr* %35, i32 12)
%37 = icmp slt i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %22
%39 = call i32 @Die(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %40
40: ; preds = %38, %22
%41 = call i64 @strlen(i8* %8)
%42 = add nsw i64 %41, 1
%43 = call i32 @send(i32 %18, i8* %8, i64 %42, i32 0)
%44 = load i32, i32* @stdout
%45 = call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %46
46: ; preds = %53, %40
%47 = phi i32 [ 0, %40 ], [ %69, %53 ]
%48 = phi i32 [ 0, %40 ], [ %70, %53 ]
%49 = call i32 @recv_line(i32 %18, i8* %7)
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %46
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %53
53: ; preds = %51, %46
%54 = call i8* @strtok(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%55 = call i32 @atoi(i8* %54)
%56 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%57 = call i32 @atoi(i8* %56)
%58 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%59 = lshr i32 %57, 11
%60 = and i32 %59, 255
%61 = lshr i32 %57, 8
%62 = and i32 %61, 7
%63 = and i32 %57, 255
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 %48, i32 %55, i32 %60, i32 %62, i32 %63, i8* %58)
%65 = icmp eq i32 %55, 2
%66 = add i32 %48, 16
%67 = xor i1 %65, true
%68 = zext i1 %67 to i32
%69 = add nuw nsw i32 %47, %68
%70 = select i1 %65, i32 %66, i32 %48
%71 = icmp ugt i32 %69, 500
br i1 %71, label %72, label %46
72: ; preds = %53
%73 = call i32 @exit(i32 0)
unreachable
}