#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 */
typedef int uint8_t;
struct timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
scalar_t__ FD_ISSET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ Recv(int, unsigned char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ bzero(unsigned char *, int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ negotiate(int, unsigned char *, int);
int parse(char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, struct timeval *);
int /*<<< orphan*/ sendch(int, char *);
int /*<<< orphan*/ strcat(char *, char const *);
int strlen(char const *);
uint8_t trycredentials(int sockfd, char *username, char *password) {
  struct timeval ts;
  ts.tv_sec = 1;
  ts.tv_usec = 0;
  unsigned char buf[20 + 1];
  unsigned char buff_r[2048];
  ssize_t rc;
  int level, flag = 0;
  fd_set fds;
  int connfd;
  bzero(buff_r, 2048);
  while (1) {
    FD_ZERO(&fds);
    FD_SET(sockfd, &fds);
    FD_SET(0, &fds);
    if ((connfd = select(sockfd + 1, &fds, (fd_set *)0, (fd_set *)0, &ts)) <
        0) {
      perror("select");
      return (1);
    } else if (sockfd != 0 && FD_ISSET(sockfd, &fds)) {
      if (!(rc = Recv(sockfd, buf, 1, 0))) {
        printf("Connection closed by local host!\n\r");
        return (2);
      }
      if (buf[0] == 0xff) {
        if (!(rc = Recv(sockfd, (buf + 1), 2, 0))) {
          printf("Connection closed by the remote host!\n\r");
          return (2);
        }
        negotiate(sockfd, buf, 3);
      } else {
        buf[1] = '\0';
        if (strlen((const char *)buff_r) < (2048 - 2))
          strcat((char *)buff_r, (const char *)buf);
        else
          printf("[ERROR] Overload of buff_r for parsing! edite code and "
                 "change BUFF_R_SIZE\n");
        fflush(0);
      }
    } else if (!(FD_ISSET(sockfd, &fds))) {
      if ((level = parse((char *)buff_r, flag)) > 0) {
        switch (level) {
        case 1: {
          sendch(sockfd, username);
          break;
        }
        case 2: {
          sendch(sockfd, password);
          break;
        }
        case 3:
          return (0);
        default:
          break;
        }
        flag = level;
      } else {
        if (parse((char *)buff_r, 3) == 4)
          return (1);
      }
    }
  }
}


x86 assembly (clang, -O0):
<trycredentials>:
push   %rbp
mov    %rsp,%rbp
sub    $0x860,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x1,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x84c(%rbp)
lea    -0x840(%rbp),%rdi
mov    $0x800,%esi
call   10b0 <bzero@plt>
lea    -0x850(%rbp),%rdi
call   1070 <FD_ZERO@plt>
mov    -0x8(%rbp),%edi
lea    -0x850(%rbp),%rsi
call   10f0 <FD_SET@plt>
xor    %edi,%edi
lea    -0x850(%rbp),%rsi
call   10f0 <FD_SET@plt>
mov    -0x8(%rbp),%edi
add    $0x1,%edi
lea    -0x850(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x28(%rbp),%r8
mov    %rcx,%rdx
call   1080 <select@plt>
mov    %eax,-0x854(%rbp)
cmp    $0x0,%eax
jge    128d <trycredentials+0xad>
lea    0xd84(%rip),%rdi
call   10a0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1494 <trycredentials+0x2b4>
cmpl   $0x0,-0x8(%rbp)
je     1395 <trycredentials+0x1b5>
mov    -0x8(%rbp),%edi
lea    -0x850(%rbp),%rsi
call   1030 <FD_ISSET@plt>
cmp    $0x0,%rax
je     1395 <trycredentials+0x1b5>
mov    -0x8(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1100 <Recv@plt>
mov    %eax,-0x844(%rbp)
cmp    $0x0,%eax
jne    12ea <trycredentials+0x10a>
lea    0xd2e(%rip),%rdi
call   1050 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1494 <trycredentials+0x2b4>
movzbl -0x40(%rbp),%eax
cmp    $0xff,%eax
jne    134d <trycredentials+0x16d>
mov    -0x8(%rbp),%edi
lea    -0x40(%rbp),%rsi
add    $0x1,%rsi
mov    $0x2,%edx
xor    %ecx,%ecx
call   1100 <Recv@plt>
mov    %eax,-0x844(%rbp)
cmp    $0x0,%eax
jne    1337 <trycredentials+0x157>
lea    0xd04(%rip),%rdi
call   1050 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1494 <trycredentials+0x2b4>
mov    -0x8(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x3,%edx
call   10e0 <negotiate@plt>
jmp    1390 <trycredentials+0x1b0>
movb   $0x0,-0x3f(%rbp)
lea    -0x840(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x7fe,%eax
jge    137d <trycredentials+0x19d>
lea    -0x840(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   10c0 <strcat@plt>
jmp    1389 <trycredentials+0x1a9>
lea    0xcce(%rip),%rdi
call   1050 <printf@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
jmp    148a <trycredentials+0x2aa>
mov    -0x8(%rbp),%edi
lea    -0x850(%rbp),%rsi
call   1030 <FD_ISSET@plt>
cmp    $0x0,%rax
jne    1485 <trycredentials+0x2a5>
lea    -0x840(%rbp),%rdi
mov    -0x84c(%rbp),%esi
call   10d0 <parse@plt>
mov    %eax,-0x848(%rbp)
cmp    $0x0,%eax
jle    1455 <trycredentials+0x275>
mov    -0x848(%rbp),%eax
mov    %eax,-0x858(%rbp)
sub    $0x1,%eax
je     1411 <trycredentials+0x231>
jmp    13e9 <trycredentials+0x209>
mov    -0x858(%rbp),%eax
sub    $0x2,%eax
je     1422 <trycredentials+0x242>
jmp    13fd <trycredentials+0x21d>
mov    -0x858(%rbp),%eax
sub    $0x3,%eax
je     1433 <trycredentials+0x253>
jmp    143f <trycredentials+0x25f>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <sendch@plt>
jmp    1444 <trycredentials+0x264>
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1060 <sendch@plt>
jmp    1444 <trycredentials+0x264>
movl   $0x0,-0x4(%rbp)
jmp    1494 <trycredentials+0x2b4>
jmp    1444 <trycredentials+0x264>
mov    -0x848(%rbp),%eax
mov    %eax,-0x84c(%rbp)
jmp    1480 <trycredentials+0x2a0>
lea    -0x840(%rbp),%rdi
mov    $0x3,%esi
call   10d0 <parse@plt>
cmp    $0x4,%eax
jne    147b <trycredentials+0x29b>
movl   $0x1,-0x4(%rbp)
jmp    1494 <trycredentials+0x2b4>
jmp    1480 <trycredentials+0x2a0>
jmp    1485 <trycredentials+0x2a5>
jmp    148a <trycredentials+0x2aa>
jmp    148f <trycredentials+0x2af>
jmp    1220 <trycredentials+0x40>
mov    -0x4(%rbp),%eax
add    $0x860,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trycredentials>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x858,%rsp
mov    %rdx,0x38(%rsp)
mov    %rsi,0x30(%rsp)
mov    %edi,%ebx
movl   $0x1,0x40(%rsp)
movq   $0x0,0x48(%rsp)
lea    0x50(%rsp),%rdi
mov    $0x800,%esi
call   10c0 <bzero@plt>
lea    0x1(%rbx),%r13d
lea    0xc(%rsp),%rbp
mov    %rbp,%rdi
call   1080 <FD_ZERO@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
call   1100 <FD_SET@plt>
xor    %r15d,%r15d
xor    %edi,%edi
mov    %rbp,%rsi
call   1100 <FD_SET@plt>
lea    0x40(%rsp),%r8
mov    %r13d,%edi
mov    %rbp,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1090 <select@plt>
test   %eax,%eax
js     1415 <trycredentials+0x225>
lea    0xc(%rsp),%rbp
lea    0x50(%rsp),%r14
lea    0x40(%rsp),%r12
jmp    12d9 <trycredentials+0xe9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%edi
mov    %rbp,%rsi
call   1040 <FD_ISSET@plt>
test   %rax,%rax
je     1340 <trycredentials+0x150>
mov    %rbp,%rdi
call   1080 <FD_ZERO@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
call   1100 <FD_SET@plt>
xor    %edi,%edi
mov    %rbp,%rsi
call   1100 <FD_SET@plt>
mov    %r13d,%edi
mov    %rbp,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %r12,%r8
call   1090 <select@plt>
test   %eax,%eax
js     1415 <trycredentials+0x225>
test   %ebx,%ebx
je     1290 <trycredentials+0xa0>
mov    %ebx,%edi
mov    %rbp,%rsi
call   1040 <FD_ISSET@plt>
test   %rax,%rax
je     1290 <trycredentials+0xa0>
mov    %ebx,%edi
lea    0x10(%rsp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1110 <Recv@plt>
test   %eax,%eax
je     13f9 <trycredentials+0x209>
cmpb   $0xff,0x10(%rsp)
je     136e <trycredentials+0x17e>
movb   $0x0,0x11(%rsp)
mov    %r14,%rdi
call   1050 <strlen@plt>
cmp    $0x7fd,%eax
jg     139b <trycredentials+0x1ab>
mov    %r14,%rdi
lea    0x10(%rsp),%rsi
call   10d0 <strcat@plt>
jmp    13a7 <trycredentials+0x1b7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15d,%esi
call   10e0 <parse@plt>
test   %eax,%eax
jle    13b3 <trycredentials+0x1c3>
cmp    $0x1,%eax
je     13cb <trycredentials+0x1db>
cmp    $0x2,%eax
je     13e2 <trycredentials+0x1f2>
mov    %eax,%r15d
cmp    $0x3,%eax
jne    12a3 <trycredentials+0xb3>
jmp    1428 <trycredentials+0x238>
mov    %ebx,%edi
lea    0x11(%rsp),%rsi
mov    $0x2,%edx
xor    %ecx,%ecx
call   1110 <Recv@plt>
test   %eax,%eax
je     1402 <trycredentials+0x212>
mov    %ebx,%edi
lea    0x10(%rsp),%rsi
mov    $0x3,%edx
call   10f0 <negotiate@plt>
jmp    12a3 <trycredentials+0xb3>
lea    0xcb0(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
jmp    12a3 <trycredentials+0xb3>
mov    %r14,%rdi
mov    $0x3,%esi
call   10e0 <parse@plt>
cmp    $0x4,%eax
jne    12a3 <trycredentials+0xb3>
jmp    1421 <trycredentials+0x231>
mov    %ebx,%edi
mov    0x30(%rsp),%rsi
call   1070 <sendch@plt>
mov    $0x1,%r15d
jmp    12a3 <trycredentials+0xb3>
mov    %ebx,%edi
mov    0x38(%rsp),%rsi
call   1070 <sendch@plt>
mov    $0x2,%r15d
jmp    12a3 <trycredentials+0xb3>
lea    0xc07(%rip),%rdi
jmp    1409 <trycredentials+0x219>
lea    0xc21(%rip),%rdi
call   1060 <printf@plt>
mov    $0x2,%eax
jmp    142a <trycredentials+0x23a>
lea    0xbe4(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%eax
jmp    142a <trycredentials+0x23a>
xor    %eax,%eax
add    $0x858,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
@.str = [7 x i8] c"select\00"
@.str.1 = [35 x i8] c"Connection closed by local host!\0A\0D\00"
@.str.2 = [40 x i8] c"Connection closed by the remote host!\0A\0D\00"
@.str.3 = [75 x i8] c"[ERROR] Overload of buff_r for parsing! edite code and change BUFF_R_SIZE\0A\00"
define i32 @trycredentials(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca %struct.timeval
%9 = alloca [21 x i8]
%10 = alloca [2048 x i8]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%16 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 0
store i32 1, i32* %16
%17 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 1
store i64 0, i64* %17
store i32 0, i32* %13
%18 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%19 = call i32 @bzero(i8* %18, i32 2048)
br label %20
20: ; preds = %3, %108
%21 = call i32 @FD_ZERO(i32* %14)
%22 = load i32, i32* %5
%23 = call i32 @FD_SET(i32 %22, i32* %14)
%24 = call i32 @FD_SET(i32 0, i32* %14)
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
%27 = call i32 @select(i32 %26, i32* %14, i32* null, i32* null, %struct.timeval* %8)
store i32 %27, i32* %15
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %20
%30 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %4
br label %109
31: ; preds = %20
%32 = load i32, i32* %5
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %76
34: ; preds = %31
%35 = load i32, i32* %5
%36 = call i64 @FD_ISSET(i32 %35, i32* %14)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %76
38: ; preds = %34
%39 = load i32, i32* %5
%40 = getelementptr inbounds [21 x i8], [21 x i8]* %9, i64 0, i64 0
%41 = call i32 @Recv(i32 %39, i8* %40, i32 1, i32 0)
store i32 %41, i32* %11
%42 = icmp ne i32 %41, 0
br i1 %42, label %45, label %43
43: ; preds = %38
%44 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
store i32 2, i32* %4
br label %109
45: ; preds = %38
%46 = getelementptr inbounds [21 x i8], [21 x i8]* %9, i64 0, i64 0
%47 = load i8, i8* %46
%48 = zext i8 %47 to i32
%49 = icmp eq i32 %48, 255
br i1 %49, label %50, label %62
50: ; preds = %45
%51 = load i32, i32* %5
%52 = getelementptr inbounds [21 x i8], [21 x i8]* %9, i64 0, i64 0
%53 = getelementptr inbounds i8, i8* %52, i64 1
%54 = call i32 @Recv(i32 %51, i8* %53, i32 2, i32 0)
store i32 %54, i32* %11
%55 = icmp ne i32 %54, 0
br i1 %55, label %58, label %56
56: ; preds = %50
%57 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
store i32 2, i32* %4
br label %109
58: ; preds = %50
%59 = load i32, i32* %5
%60 = getelementptr inbounds [21 x i8], [21 x i8]* %9, i64 0, i64 0
%61 = call i32 @negotiate(i32 %59, i8* %60, i32 3)
br label %75
62: ; preds = %45
%63 = getelementptr inbounds [21 x i8], [21 x i8]* %9, i64 0, i64 1
store i8 0, i8* %63
%64 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%65 = call i32 @strlen(i8* %64)
%66 = icmp slt i32 %65, 2046
br i1 %66, label %67, label %71
67: ; preds = %62
%68 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%69 = getelementptr inbounds [21 x i8], [21 x i8]* %9, i64 0, i64 0
%70 = call i32 @strcat(i8* %68, i8* %69)
br label %73
71: ; preds = %62
%72 = call i32 @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.3, i64 0, i64 0))
br label %73
73: ; preds = %71, %67
%74 = call i32 @fflush(i32 0)
br label %75
75: ; preds = %73, %58
br label %107
76: ; preds = %34, %31
%77 = load i32, i32* %5
%78 = call i64 @FD_ISSET(i32 %77, i32* %14)
%79 = icmp ne i64 %78, 0
br i1 %79, label %106, label %80
80: ; preds = %76
%81 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%82 = load i32, i32* %13
%83 = call i32 @parse(i8* %81, i32 %82)
store i32 %83, i32* %12
%84 = icmp sgt i32 %83, 0
br i1 %84, label %85, label %99
85: ; preds = %80
%86 = load i32, i32* %12
switch i32 %86, label %96 [
i32 1, label %87
i32 2, label %91
i32 3, label %95
]
87: ; preds = %85
%88 = load i32, i32* %5
%89 = load i8*, i8** %6
%90 = call i32 @sendch(i32 %88, i8* %89)
br label %97
91: ; preds = %85
%92 = load i32, i32* %5
%93 = load i8*, i8** %7
%94 = call i32 @sendch(i32 %92, i8* %93)
br label %97
95: ; preds = %85
store i32 0, i32* %4
br label %109
96: ; preds = %85
br label %97
97: ; preds = %96, %91, %87
%98 = load i32, i32* %12
store i32 %98, i32* %13
br label %105
99: ; preds = %80
%100 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%101 = call i32 @parse(i8* %100, i32 3)
%102 = icmp eq i32 %101, 4
br i1 %102, label %103, label %104
103: ; preds = %99
store i32 1, i32* %4
br label %109
104: ; preds = %99
br label %105
105: ; preds = %104, %97
br label %106
106: ; preds = %105, %76
br label %107
107: ; preds = %106, %75
br label %108
108: ; preds = %107
br label %20
109: ; preds = %103, %95, %56, %43, %29
%110 = load i32, i32* %4
ret i32 %110
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
@.str = [7 x i8] c"select\00"
@.str.1 = [35 x i8] c"Connection closed by local host!\0A\0D\00"
@.str.2 = [40 x i8] c"Connection closed by the remote host!\0A\0D\00"
@str = [74 x i8] c"[ERROR] Overload of buff_r for parsing! edite code and change BUFF_R_SIZE\00"
define i32 @trycredentials(i32 %0, i8* %1, i8* %2) {
%4 = alloca %struct.timeval
%5 = alloca [21 x i8]
%6 = alloca [2048 x i8]
%7 = alloca i32
%8 = bitcast %struct.timeval* %4 to i8*
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
store i32 1, i32* %9
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
store i64 0, i64* %10
%11 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%13 = bitcast i32* %7 to i8*
%14 = call i32 @bzero(i8* %12, i32 2048)
%15 = add nsw i32 %0, 1
%16 = icmp eq i32 %0, 0
%17 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 1
%18 = call i32 @FD_ZERO(i32* %7)
%19 = call i32 @FD_SET(i32 %0, i32* %7)
%20 = call i32 @FD_SET(i32 0, i32* %7)
%21 = call i32 @select(i32 %15, i32* %7, i32* null, i32* null, %struct.timeval* %4)
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %68, %3
%24 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %75
25: ; preds = %3, %68
%26 = phi i32 [ %69, %68 ], [ 0, %3 ]
br i1 %16, label %54, label %27
27: ; preds = %25
%28 = call i64 @FD_ISSET(i32 %0, i32* %7)
%29 = icmp eq i64 %28, 0
br i1 %29, label %54, label %30
30: ; preds = %27
%31 = call i32 @Recv(i32 %0, i8* %11, i32 1, i32 0)
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %75
35: ; preds = %30
%36 = load i8, i8* %11
%37 = icmp eq i8 %36, -1
br i1 %37, label %38, label %45
38: ; preds = %35
%39 = call i32 @Recv(i32 %0, i8* %17, i32 2, i32 0)
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
br label %75
43: ; preds = %38
%44 = call i32 @negotiate(i32 %0, i8* %11, i32 3)
br label %68
45: ; preds = %35
store i8 0, i8* %17
%46 = call i32 @strlen(i8* %12)
%47 = icmp slt i32 %46, 2046
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = call i32 @strcat(i8* %12, i8* %11)
br label %52
50: ; preds = %45
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str, i64 0, i64 0))
br label %52
52: ; preds = %50, %48
%53 = call i32 @fflush(i32 0)
br label %68
54: ; preds = %27, %25
%55 = call i64 @FD_ISSET(i32 %0, i32* %7)
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %68
57: ; preds = %54
%58 = call i32 @parse(i8* %12, i32 %26)
%59 = icmp sgt i32 %58, 0
br i1 %59, label %60, label %65
60: ; preds = %57
switch i32 %58, label %68 [
i32 1, label %61
i32 2, label %63
i32 3, label %75
]
61: ; preds = %60
%62 = call i32 @sendch(i32 %0, i8* %1)
br label %68
63: ; preds = %60
%64 = call i32 @sendch(i32 %0, i8* %2)
br label %68
65: ; preds = %57
%66 = call i32 @parse(i8* %12, i32 3)
%67 = icmp eq i32 %66, 4
br i1 %67, label %75, label %68
68: ; preds = %61, %63, %60, %52, %43, %65, %54
%69 = phi i32 [ %26, %43 ], [ %26, %52 ], [ %26, %54 ], [ %26, %65 ], [ %58, %60 ], [ 2, %63 ], [ 1, %61 ]
%70 = call i32 @FD_ZERO(i32* %7)
%71 = call i32 @FD_SET(i32 %0, i32* %7)
%72 = call i32 @FD_SET(i32 0, i32* %7)
%73 = call i32 @select(i32 %15, i32* %7, i32* null, i32* null, %struct.timeval* %4)
%74 = icmp slt i32 %73, 0
br i1 %74, label %23, label %25
75: ; preds = %65, %60, %41, %33, %23
%76 = phi i32 [ 1, %23 ], [ 2, %41 ], [ 2, %33 ], [ 1, %65 ], [ 0, %60 ]
ret i32 %76
}