#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 */

/* Variables and functions */
void *atoi(char const *);
int /*<<< orphan*/ chdir(char *);
int /*<<< orphan*/ close(int);
int establish_connection();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read(int, int *, int);
scalar_t__ strcmp(char const *, char *);
int /*<<< orphan*/ write(int, int const *, int);
int client_handle_input(int argc, const char *argv[]) {
  chdir("/");
  int command = -1;
  if (argc >= 2) {
    if (strcmp(argv[1], "-halt") == 0 || strcmp(argv[1], "-h") == 0) {
      command = 1;
      int sock = establish_connection();
      if (sock != -1) {
        write(sock, &command, sizeof(int));
        close(sock);
      }
    } else if (strcmp(argv[1], "-stclr") == 0 || strcmp(argv[1], "-sc") == 0) {
      command = 2;
      if (argc >= 5) {
        int sock = establish_connection();
        if (sock != -1) {
          const int red = atoi(argv[2]);
          const int green = atoi(argv[3]);
          const int blue = atoi(argv[4]);
          write(sock, &command, sizeof(int));
          write(sock, &red, sizeof(int));
          write(sock, &green, sizeof(int));
          write(sock, &blue, sizeof(int));
          close(sock);
        }
      }
    } else if (strcmp(argv[1], "-getcolor") == 0) {
      command = 4;
      int sock = establish_connection();
      if (sock != -1) {
        int red;
        int green;
        int blue;
        write(sock, &command, sizeof(int));
        read(sock, &red, sizeof(int));
        read(sock, &green, sizeof(int));
        read(sock, &blue, sizeof(int));
        close(sock);
        printf("{red: %d, green: %d, blue: %d}\n", red, green, blue);
      }
    } else if (strcmp(argv[1], "-st") == 0) {
      if (argc >= 4) {
        command = 6;
        int sock = establish_connection();
        if (sock != -1) {
          int num = (int)*(argv[2]);
          int val = atoi(argv[3]);
          write(sock, &command, sizeof(int));
          write(sock, &num, sizeof(int));
          write(sock, &val, sizeof(int));
          close(sock);
        }
      }
    } else {
      printf("\n%s: invalid command\n", argv[1]);
    }
  }
  return command;
}


x86 assembly (clang, -O0):
<client_handle_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe6a(%rip),%rdi
call   1050 <chdir@plt>
movl   $0xffffffff,-0x14(%rbp)
cmpl   $0x2,-0x4(%rbp)
jl     1479 <client_handle_input+0x2f9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe47(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     11e8 <client_handle_input+0x68>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe2f(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1221 <client_handle_input+0xa1>
movl   $0x1,-0x14(%rbp)
mov    $0x0,%al
call   1030 <establish_connection@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
je     121c <client_handle_input+0x9c>
mov    -0x18(%rbp),%edi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
jmp    1474 <client_handle_input+0x2f4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xddb(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     125d <client_handle_input+0xdd>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdc4(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1308 <client_handle_input+0x188>
movl   $0x2,-0x14(%rbp)
cmpl   $0x5,-0x4(%rbp)
jl     1303 <client_handle_input+0x183>
mov    $0x0,%al
call   1030 <establish_connection@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
je     12fe <client_handle_input+0x17e>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%edi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    -0x1c(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    -0x1c(%rbp),%edi
lea    -0x24(%rbp),%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    -0x1c(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    -0x1c(%rbp),%edi
call   1070 <close@plt>
jmp    1303 <client_handle_input+0x183>
jmp    146f <client_handle_input+0x2ef>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xcff(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    13a9 <client_handle_input+0x229>
movl   $0x4,-0x14(%rbp)
mov    $0x0,%al
call   1030 <establish_connection@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0xffffffff,-0x2c(%rbp)
je     13a4 <client_handle_input+0x224>
mov    -0x2c(%rbp),%edi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    -0x2c(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x4,%edx
call   1080 <read@plt>
mov    -0x2c(%rbp),%edi
lea    -0x34(%rbp),%rsi
mov    $0x4,%edx
call   1080 <read@plt>
mov    -0x2c(%rbp),%edi
lea    -0x38(%rbp),%rsi
mov    $0x4,%edx
call   1080 <read@plt>
mov    -0x2c(%rbp),%edi
call   1070 <close@plt>
mov    -0x30(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
lea    0xc83(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    146a <client_handle_input+0x2ea>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xc88(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    144f <client_handle_input+0x2cf>
cmpl   $0x4,-0x4(%rbp)
jl     144a <client_handle_input+0x2ca>
movl   $0x6,-0x14(%rbp)
mov    $0x0,%al
call   1030 <establish_connection@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0xffffffff,-0x3c(%rbp)
je     1445 <client_handle_input+0x2c5>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x44(%rbp)
mov    -0x3c(%rbp),%edi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    -0x3c(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    -0x3c(%rbp),%edi
lea    -0x44(%rbp),%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    -0x3c(%rbp),%edi
call   1070 <close@plt>
jmp    144a <client_handle_input+0x2ca>
jmp    1465 <client_handle_input+0x2e5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xbe6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    146a <client_handle_input+0x2ea>
jmp    146f <client_handle_input+0x2ef>
jmp    1474 <client_handle_input+0x2f4>
jmp    1479 <client_handle_input+0x2f9>
mov    -0x14(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<client_handle_input>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe6c(%rip),%rdi
call   1050 <chdir@plt>
mov    $0xffffffff,%r14d
cmp    $0x2,%ebp
jl     1414 <client_handle_input+0x294>
mov    0x8(%rbx),%rdi
lea    0xe4f(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1251 <client_handle_input+0xd1>
mov    0x8(%rbx),%rdi
lea    0xe3c(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1251 <client_handle_input+0xd1>
mov    0x8(%rbx),%rdi
lea    0xe2a(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     128b <client_handle_input+0x10b>
mov    0x8(%rbx),%rdi
lea    0xe18(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     128b <client_handle_input+0x10b>
mov    0x8(%rbx),%rdi
lea    0xe03(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1328 <client_handle_input+0x1a8>
mov    0x8(%rbx),%rdi
lea    0xe14(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     13ac <client_handle_input+0x22c>
mov    0x8(%rbx),%rsi
lea    0xdff(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1414 <client_handle_input+0x294>
movl   $0x1,(%rsp)
xor    %eax,%eax
call   1030 <establish_connection@plt>
mov    $0x1,%r14d
cmp    $0xffffffff,%eax
je     1414 <client_handle_input+0x294>
mov    %eax,%ebx
mov    %rsp,%rsi
mov    %eax,%edi
mov    $0x4,%edx
call   1040 <write@plt>
mov    %ebx,%edi
call   1070 <close@plt>
jmp    1414 <client_handle_input+0x294>
movl   $0x2,(%rsp)
mov    $0x2,%r14d
cmp    $0x5,%ebp
jb     1414 <client_handle_input+0x294>
xor    %eax,%eax
call   1030 <establish_connection@plt>
cmp    $0xffffffff,%eax
je     1414 <client_handle_input+0x294>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %eax,0x8(%rsp)
mov    0x18(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %eax,0x4(%rsp)
mov    0x20(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %eax,0xc(%rsp)
mov    %rsp,%rsi
mov    %ebp,%edi
mov    $0x4,%edx
call   1040 <write@plt>
lea    0x8(%rsp),%rsi
mov    %ebp,%edi
mov    $0x4,%edx
call   1040 <write@plt>
lea    0x4(%rsp),%rsi
mov    %ebp,%edi
mov    $0x4,%edx
call   1040 <write@plt>
lea    0xc(%rsp),%rsi
mov    %ebp,%edi
mov    $0x4,%edx
call   1040 <write@plt>
mov    %ebp,%edi
call   1070 <close@plt>
jmp    1414 <client_handle_input+0x294>
movl   $0x4,(%rsp)
xor    %eax,%eax
call   1030 <establish_connection@plt>
cmp    $0xffffffff,%eax
je     140e <client_handle_input+0x28e>
mov    %eax,%ebx
mov    %rsp,%rsi
mov    $0x4,%r14d
mov    %eax,%edi
mov    $0x4,%edx
call   1040 <write@plt>
lea    0x8(%rsp),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1080 <read@plt>
lea    0x4(%rsp),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1080 <read@plt>
lea    0xc(%rsp),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1080 <read@plt>
mov    %ebx,%edi
call   1070 <close@plt>
mov    0x8(%rsp),%esi
mov    0x4(%rsp),%edx
mov    0xc(%rsp),%ecx
lea    0xc7d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1414 <client_handle_input+0x294>
cmp    $0x4,%ebp
jb     1414 <client_handle_input+0x294>
movl   $0x6,(%rsp)
xor    %eax,%eax
call   1030 <establish_connection@plt>
mov    $0x6,%r14d
cmp    $0xffffffff,%eax
je     1414 <client_handle_input+0x294>
mov    %eax,%ebp
mov    0x10(%rbx),%rax
movsbl (%rax),%eax
mov    %eax,0x8(%rsp)
mov    0x18(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %eax,0x4(%rsp)
mov    %rsp,%rsi
mov    %ebp,%edi
mov    $0x4,%edx
call   1040 <write@plt>
lea    0x8(%rsp),%rsi
mov    %ebp,%edi
mov    $0x4,%edx
call   1040 <write@plt>
lea    0x4(%rsp),%rsi
jmp    1310 <client_handle_input+0x190>
mov    $0x4,%r14d
mov    %r14d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
@.str.1 = [6 x i8] c"-halt\00"
@.str.2 = [3 x i8] c"-h\00"
@.str.3 = [7 x i8] c"-stclr\00"
@.str.4 = [4 x i8] c"-sc\00"
@.str.5 = [10 x i8] c"-getcolor\00"
@.str.6 = [32 x i8] c"{red: %d, green: %d, blue: %d}\0A\00"
@.str.7 = [4 x i8] c"-st\00"
@.str.8 = [22 x i8] c"\0A%s: invalid command\0A\00"
define i32 @client_handle_input(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%18 = call i32 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %5
%19 = load i32, i32* %3
%20 = icmp sge i32 %19, 2
br i1 %20, label %21, label %159
21: ; preds = %2
%22 = load i8**, i8*** %4
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %33, label %27
27: ; preds = %21
%28 = load i8**, i8*** %4
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %43
33: ; preds = %27, %21
store i32 1, i32* %5
%34 = call i32 (...) @establish_connection()
store i32 %34, i32* %6
%35 = load i32, i32* %6
%36 = icmp ne i32 %35, -1
br i1 %36, label %37, label %42
37: ; preds = %33
%38 = load i32, i32* %6
%39 = call i32 @write(i32 %38, i32* %5, i32 4)
%40 = load i32, i32* %6
%41 = call i32 @close(i32 %40)
br label %42
42: ; preds = %37, %33
br label %158
43: ; preds = %27
%44 = load i8**, i8*** %4
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = load i8*, i8** %45
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %55, label %49
49: ; preds = %43
%50 = load i8**, i8*** %4
%51 = getelementptr inbounds i8*, i8** %50, i64 1
%52 = load i8*, i8** %51
%53 = call i64 @strcmp(i8* %52, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %90
55: ; preds = %49, %43
store i32 2, i32* %5
%56 = load i32, i32* %3
%57 = icmp sge i32 %56, 5
br i1 %57, label %58, label %89
58: ; preds = %55
%59 = call i32 (...) @establish_connection()
store i32 %59, i32* %7
%60 = load i32, i32* %7
%61 = icmp ne i32 %60, -1
br i1 %61, label %62, label %88
62: ; preds = %58
%63 = load i8**, i8*** %4
%64 = getelementptr inbounds i8*, i8** %63, i64 2
%65 = load i8*, i8** %64
%66 = call i8* @atoi(i8* %65)
%67 = ptrtoint i8* %66 to i32
store i32 %67, i32* %8
%68 = load i8**, i8*** %4
%69 = getelementptr inbounds i8*, i8** %68, i64 3
%70 = load i8*, i8** %69
%71 = call i8* @atoi(i8* %70)
%72 = ptrtoint i8* %71 to i32
store i32 %72, i32* %9
%73 = load i8**, i8*** %4
%74 = getelementptr inbounds i8*, i8** %73, i64 4
%75 = load i8*, i8** %74
%76 = call i8* @atoi(i8* %75)
%77 = ptrtoint i8* %76 to i32
store i32 %77, i32* %10
%78 = load i32, i32* %7
%79 = call i32 @write(i32 %78, i32* %5, i32 4)
%80 = load i32, i32* %7
%81 = call i32 @write(i32 %80, i32* %8, i32 4)
%82 = load i32, i32* %7
%83 = call i32 @write(i32 %82, i32* %9, i32 4)
%84 = load i32, i32* %7
%85 = call i32 @write(i32 %84, i32* %10, i32 4)
%86 = load i32, i32* %7
%87 = call i32 @close(i32 %86)
br label %88
88: ; preds = %62, %58
br label %89
89: ; preds = %88, %55
br label %157
90: ; preds = %49
%91 = load i8**, i8*** %4
%92 = getelementptr inbounds i8*, i8** %91, i64 1
%93 = load i8*, i8** %92
%94 = call i64 @strcmp(i8* %93, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %116
96: ; preds = %90
store i32 4, i32* %5
%97 = call i32 (...) @establish_connection()
store i32 %97, i32* %11
%98 = load i32, i32* %11
%99 = icmp ne i32 %98, -1
br i1 %99, label %100, label %115
100: ; preds = %96
%101 = load i32, i32* %11
%102 = call i32 @write(i32 %101, i32* %5, i32 4)
%103 = load i32, i32* %11
%104 = call i32 @read(i32 %103, i32* %12, i32 4)
%105 = load i32, i32* %11
%106 = call i32 @read(i32 %105, i32* %13, i32 4)
%107 = load i32, i32* %11
%108 = call i32 @read(i32 %107, i32* %14, i32 4)
%109 = load i32, i32* %11
%110 = call i32 @close(i32 %109)
%111 = load i32, i32* %12
%112 = load i32, i32* %13
%113 = load i32, i32* %14
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i32 %111, i32 %112, i32 %113)
br label %115
115: ; preds = %100, %96
br label %156
116: ; preds = %90
%117 = load i8**, i8*** %4
%118 = getelementptr inbounds i8*, i8** %117, i64 1
%119 = load i8*, i8** %118
%120 = call i64 @strcmp(i8* %119, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%121 = icmp eq i64 %120, 0
br i1 %121, label %122, label %150
122: ; preds = %116
%123 = load i32, i32* %3
%124 = icmp sge i32 %123, 4
br i1 %124, label %125, label %149
125: ; preds = %122
store i32 6, i32* %5
%126 = call i32 (...) @establish_connection()
store i32 %126, i32* %15
%127 = load i32, i32* %15
%128 = icmp ne i32 %127, -1
br i1 %128, label %129, label %148
129: ; preds = %125
%130 = load i8**, i8*** %4
%131 = getelementptr inbounds i8*, i8** %130, i64 2
%132 = load i8*, i8** %131
%133 = load i8, i8* %132
%134 = sext i8 %133 to i32
store i32 %134, i32* %16
%135 = load i8**, i8*** %4
%136 = getelementptr inbounds i8*, i8** %135, i64 3
%137 = load i8*, i8** %136
%138 = call i8* @atoi(i8* %137)
%139 = ptrtoint i8* %138 to i32
store i32 %139, i32* %17
%140 = load i32, i32* %15
%141 = call i32 @write(i32 %140, i32* %5, i32 4)
%142 = load i32, i32* %15
%143 = call i32 @write(i32 %142, i32* %16, i32 4)
%144 = load i32, i32* %15
%145 = call i32 @write(i32 %144, i32* %17, i32 4)
%146 = load i32, i32* %15
%147 = call i32 @close(i32 %146)
br label %148
148: ; preds = %129, %125
br label %149
149: ; preds = %148, %122
br label %155
150: ; preds = %116
%151 = load i8**, i8*** %4
%152 = getelementptr inbounds i8*, i8** %151, i64 1
%153 = load i8*, i8** %152
%154 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i8* %153)
br label %155
155: ; preds = %150, %149
br label %156
156: ; preds = %155, %115
br label %157
157: ; preds = %156, %89
br label %158
158: ; preds = %157, %42
br label %159
159: ; preds = %158, %2
%160 = load i32, i32* %5
ret i32 %160
}

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
@.str.1 = [6 x i8] c"-halt\00"
@.str.2 = [3 x i8] c"-h\00"
@.str.3 = [7 x i8] c"-stclr\00"
@.str.4 = [4 x i8] c"-sc\00"
@.str.5 = [10 x i8] c"-getcolor\00"
@.str.6 = [32 x i8] c"{red: %d, green: %d, blue: %d}\0A\00"
@.str.7 = [4 x i8] c"-st\00"
@.str.8 = [22 x i8] c"\0A%s: invalid command\0A\00"
define i32 @client_handle_input(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = tail call i32 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = bitcast i32* %3 to i8*
%14 = icmp sgt i32 %0, 1
br i1 %14, label %15, label %115
15: ; preds = %2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = tail call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %15
%21 = load i8*, i8** %16
%22 = tail call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %30
24: ; preds = %20, %15
store i32 1, i32* %3
%25 = tail call i32 (...) @establish_connection()
%26 = icmp eq i32 %25, -1
br i1 %26, label %115, label %27
27: ; preds = %24
%28 = call i32 @write(i32 %25, i32* %3, i32 4)
%29 = tail call i32 @close(i32 %25)
br label %115
30: ; preds = %20
%31 = load i8*, i8** %16
%32 = tail call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %38, label %34
34: ; preds = %30
%35 = load i8*, i8** %16
%36 = tail call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %67
38: ; preds = %34, %30
store i32 2, i32* %3
%39 = icmp ugt i32 %0, 4
br i1 %39, label %40, label %115
40: ; preds = %38
%41 = tail call i32 (...) @establish_connection()
%42 = icmp eq i32 %41, -1
br i1 %42, label %115, label %43
43: ; preds = %40
%44 = bitcast i32* %4 to i8*
%45 = getelementptr inbounds i8*, i8** %1, i64 2
%46 = load i8*, i8** %45
%47 = tail call i8* @atoi(i8* %46)
%48 = ptrtoint i8* %47 to i64
%49 = trunc i64 %48 to i32
store i32 %49, i32* %4
%50 = bitcast i32* %5 to i8*
%51 = getelementptr inbounds i8*, i8** %1, i64 3
%52 = load i8*, i8** %51
%53 = tail call i8* @atoi(i8* %52)
%54 = ptrtoint i8* %53 to i64
%55 = trunc i64 %54 to i32
store i32 %55, i32* %5
%56 = bitcast i32* %6 to i8*
%57 = getelementptr inbounds i8*, i8** %1, i64 4
%58 = load i8*, i8** %57
%59 = tail call i8* @atoi(i8* %58)
%60 = ptrtoint i8* %59 to i64
%61 = trunc i64 %60 to i32
store i32 %61, i32* %6
%62 = call i32 @write(i32 %41, i32* %3, i32 4)
%63 = call i32 @write(i32 %41, i32* %4, i32 4)
%64 = call i32 @write(i32 %41, i32* %5, i32 4)
%65 = call i32 @write(i32 %41, i32* %6, i32 4)
%66 = tail call i32 @close(i32 %41)
br label %115
67: ; preds = %34
%68 = load i8*, i8** %16
%69 = tail call i64 @strcmp(i8* %68, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%70 = icmp eq i64 %69, 0
br i1 %70, label %71, label %87
71: ; preds = %67
store i32 4, i32* %3
%72 = tail call i32 (...) @establish_connection()
%73 = icmp eq i32 %72, -1
br i1 %73, label %115, label %74
74: ; preds = %71
%75 = bitcast i32* %7 to i8*
%76 = bitcast i32* %8 to i8*
%77 = bitcast i32* %9 to i8*
%78 = call i32 @write(i32 %72, i32* %3, i32 4)
%79 = call i32 @read(i32 %72, i32* %7, i32 4)
%80 = call i32 @read(i32 %72, i32* %8, i32 4)
%81 = call i32 @read(i32 %72, i32* %9, i32 4)
%82 = tail call i32 @close(i32 %72)
%83 = load i32, i32* %7
%84 = load i32, i32* %8
%85 = load i32, i32* %9
%86 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i32 %83, i32 %84, i32 %85)
br label %115
87: ; preds = %67
%88 = load i8*, i8** %16
%89 = tail call i64 @strcmp(i8* %88, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%90 = icmp eq i64 %89, 0
br i1 %90, label %91, label %112
91: ; preds = %87
%92 = icmp ugt i32 %0, 3
br i1 %92, label %93, label %115
93: ; preds = %91
store i32 6, i32* %3
%94 = tail call i32 (...) @establish_connection()
%95 = icmp eq i32 %94, -1
br i1 %95, label %115, label %96
96: ; preds = %93
%97 = bitcast i32* %10 to i8*
%98 = getelementptr inbounds i8*, i8** %1, i64 2
%99 = load i8*, i8** %98
%100 = load i8, i8* %99
%101 = sext i8 %100 to i32
store i32 %101, i32* %10
%102 = bitcast i32* %11 to i8*
%103 = getelementptr inbounds i8*, i8** %1, i64 3
%104 = load i8*, i8** %103
%105 = tail call i8* @atoi(i8* %104)
%106 = ptrtoint i8* %105 to i64
%107 = trunc i64 %106 to i32
store i32 %107, i32* %11
%108 = call i32 @write(i32 %94, i32* %3, i32 4)
%109 = call i32 @write(i32 %94, i32* %10, i32 4)
%110 = call i32 @write(i32 %94, i32* %11, i32 4)
%111 = tail call i32 @close(i32 %94)
br label %115
112: ; preds = %87
%113 = load i8*, i8** %16
%114 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i8* %113)
br label %115
115: ; preds = %93, %96, %71, %74, %40, %43, %24, %27, %91, %112, %38, %2
%116 = phi i32 [ 6, %93 ], [ 6, %96 ], [ 4, %71 ], [ 4, %74 ], [ 2, %40 ], [ 2, %43 ], [ 1, %24 ], [ 1, %27 ], [ -1, %91 ], [ -1, %112 ], [ 2, %38 ], [ -1, %2 ]
ret i32 %116
}