#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 */
int /*<<< orphan*/ appendleftCommandArgv(char *, int, char **, size_t *);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ close(int);
int getSocket();
int /*<<< orphan*/ gets(char *);
void *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int /*<<< orphan*/ write(int, char *, int);
int main() {
  char cmd[256] = "";
  char buf[256] = "";
  gets(buf);
  char **argv = malloc(10 * sizeof(char *));
  int argc = 0;
  while (strcmp(buf, "exit") != 0) {
    int sfd = getSocket();
    char *tmp = buf;
    argv[argc++] = tmp;
    while (*tmp != '\0') {
      if (*tmp != ' ') {
        ++tmp;
      } else {
        *tmp = '\0';
        argv[argc++] = ++tmp;
      }
    }
    size_t *argvlen = malloc(argc * sizeof(size_t *));
    int i = 0;
    while (i < argc) {
      int len = strlen(argv[i]);
      argvlen[i] = len;
      ++i;
    }
    bzero(cmd, 256);
    appendleftCommandArgv(cmd, argc, argv, argvlen);
    write(sfd, cmd, 256);
    char reply[1024] = "";
    int ret = read(sfd, reply, 1024);
    char *s = reply;
    char *pos = reply;
    while (*s != '\0') {
      if (*s == '$' || *s == '*') {
        ++s;
        while (*s != '\r') {
          if (*s == '-') {
            break;
          }
          ++s;
        }
      }
      if (*s == '\r' || *s == '\n') {
        ++s;
      } else {
        *pos = *s;
        ++pos;
        ++s;
      }
    }
    *pos = '\r';
    ++pos;
    *pos = '\n';
    ++pos;
    *pos = '\0';
    if (ret == 0) {
      printf("wrong msg... please try again^-^\n");
    } else {
      printf("%s", reply);
    }
    close(sfd);
    argc = 0;
    bzero(buf, 256);
    gets(buf);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x660,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1070 <memset@plt>
lea    -0x210(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1070 <memset@plt>
lea    -0x210(%rbp),%rdi
call   10c0 <gets@plt>
mov    $0x50,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x218(%rbp)
movl   $0x0,-0x21c(%rbp)
lea    -0x210(%rbp),%rdi
lea    0xdd3(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     15c5 <main+0x405>
mov    $0x0,%al
call   10b0 <getSocket@plt>
mov    %eax,-0x220(%rbp)
lea    -0x210(%rbp),%rax
mov    %rax,-0x228(%rbp)
mov    -0x228(%rbp),%rdx
mov    -0x218(%rbp),%rax
mov    -0x21c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x21c(%rbp)
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x228(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     12fa <main+0x13a>
mov    -0x228(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     12ba <main+0xfa>
mov    -0x228(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x228(%rbp)
jmp    12f5 <main+0x135>
mov    -0x228(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x228(%rbp),%rdx
add    $0x1,%rdx
mov    %rdx,-0x228(%rbp)
mov    -0x218(%rbp),%rax
mov    -0x21c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x21c(%rbp)
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    127d <main+0xbd>
movslq -0x21c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x230(%rbp)
movl   $0x0,-0x234(%rbp)
mov    -0x234(%rbp),%eax
cmp    -0x21c(%rbp),%eax
jge    1379 <main+0x1b9>
mov    -0x218(%rbp),%rax
movslq -0x234(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x238(%rbp)
movslq -0x238(%rbp),%rdx
mov    -0x230(%rbp),%rax
movslq -0x234(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x234(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x234(%rbp)
jmp    131d <main+0x15d>
lea    -0x110(%rbp),%rdi
mov    $0x100,%esi
call   10e0 <bzero@plt>
lea    -0x110(%rbp),%rdi
mov    -0x21c(%rbp),%esi
mov    -0x218(%rbp),%rdx
mov    -0x230(%rbp),%rcx
call   1030 <appendleftCommandArgv@plt>
mov    -0x220(%rbp),%edi
lea    -0x110(%rbp),%rsi
mov    $0x100,%edx
call   1040 <write@plt>
lea    -0x640(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    -0x220(%rbp),%edi
lea    -0x640(%rbp),%rsi
mov    $0x400,%edx
call   1090 <read@plt>
mov    %eax,-0x644(%rbp)
lea    -0x640(%rbp),%rax
mov    %rax,-0x650(%rbp)
lea    -0x640(%rbp),%rax
mov    %rax,-0x658(%rbp)
mov    -0x650(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1517 <main+0x357>
mov    -0x650(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x24,%eax
je     1446 <main+0x286>
mov    -0x650(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
jne    149f <main+0x2df>
mov    -0x650(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x650(%rbp)
mov    -0x650(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
je     149a <main+0x2da>
mov    -0x650(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1483 <main+0x2c3>
jmp    149a <main+0x2da>
mov    -0x650(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x650(%rbp)
jmp    1458 <main+0x298>
jmp    149f <main+0x2df>
mov    -0x650(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
je     14c5 <main+0x305>
mov    -0x650(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    14dc <main+0x31c>
mov    -0x650(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x650(%rbp)
jmp    1512 <main+0x352>
mov    -0x650(%rbp),%rax
mov    (%rax),%cl
mov    -0x658(%rbp),%rax
mov    %cl,(%rax)
mov    -0x658(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x658(%rbp)
mov    -0x650(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x650(%rbp)
jmp    140d <main+0x24d>
mov    -0x658(%rbp),%rax
movb   $0xd,(%rax)
mov    -0x658(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x658(%rbp)
mov    -0x658(%rbp),%rax
movb   $0xa,(%rax)
mov    -0x658(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x658(%rbp)
mov    -0x658(%rbp),%rax
movb   $0x0,(%rax)
cmpl   $0x0,-0x644(%rbp)
jne    1579 <main+0x3b9>
lea    0xa98(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    158e <main+0x3ce>
lea    -0x640(%rbp),%rsi
lea    0xaa0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x220(%rbp),%edi
call   1080 <close@plt>
movl   $0x0,-0x21c(%rbp)
lea    -0x210(%rbp),%rdi
mov    $0x100,%esi
call   10e0 <bzero@plt>
lea    -0x210(%rbp),%rdi
call   10c0 <gets@plt>
jmp    121f <main+0x5f>
mov    -0x4(%rbp),%eax
add    $0x660,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x618,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x200(%rsp)
movaps %xmm0,0x1f0(%rsp)
movaps %xmm0,0x1e0(%rsp)
movaps %xmm0,0x1d0(%rsp)
movaps %xmm0,0x1c0(%rsp)
movaps %xmm0,0x1b0(%rsp)
movaps %xmm0,0x1a0(%rsp)
movaps %xmm0,0x190(%rsp)
movaps %xmm0,0x180(%rsp)
movaps %xmm0,0x170(%rsp)
movaps %xmm0,0x160(%rsp)
movaps %xmm0,0x150(%rsp)
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%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)
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%r13
mov    %r13,%rdi
call   10d0 <gets@plt>
mov    $0x50,%edi
call   10e0 <malloc@plt>
mov    %rax,%r14
lea    0xd10(%rip),%rsi
mov    %r13,%rdi
jmp    134d <main+0x17d>
cs nopw 0x0(%rax,%rax,1)
nop
movw   $0xa0d,(%rsi)
movb   $0x0,0x2(%rsi)
test   %eax,%eax
je     14a0 <main+0x2d0>
lea    0xced(%rip),%rdi
lea    0x210(%rsp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebp,%edi
call   1090 <close@plt>
mov    %r13,%rdi
mov    $0x100,%esi
call   10f0 <bzero@plt>
mov    %r13,%rdi
call   10d0 <gets@plt>
mov    %r13,%rdi
lea    0xcb3(%rip),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     14b1 <main+0x2e1>
xor    %eax,%eax
call   10c0 <getSocket@plt>
mov    %eax,0xc(%rsp)
mov    %r13,(%r14)
mov    $0x1,%ebp
mov    $0x1,%r15d
mov    %r13,%rax
nopw   0x0(%rax,%rax,1)
add    $0x1,%rax
movzbl -0x1(%rax),%ecx
test   %cl,%cl
je     13b0 <main+0x1e0>
cmp    $0x20,%cl
jne    1380 <main+0x1b0>
movb   $0x0,-0x1(%rax)
mov    %ebp,%ecx
add    $0x1,%ebp
mov    %rax,(%r14,%rcx,8)
add    $0x1,%r15
jmp    1380 <main+0x1b0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0x0(,%rbp,8),%edi
call   10e0 <malloc@plt>
mov    %rax,%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,1),%rdi
call   1060 <strlen@plt>
cltq
mov    %rax,(%r12,%rbx,1)
add    $0x8,%rbx
add    $0xffffffffffffffff,%r15
jne    13d0 <main+0x200>
lea    0x110(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   10f0 <bzero@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %r12,%rcx
call   1040 <appendleftCommandArgv@plt>
mov    0xc(%rsp),%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x100,%edx
call   1050 <write@plt>
mov    $0x400,%edx
lea    0x210(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <memset@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   10a0 <read@plt>
mov    %rbx,%rdx
mov    %rbx,%rsi
jmp    1454 <main+0x284>
nop
add    $0x1,%rdx
mov    (%rdx),%cl
cmp    $0x24,%cl
je     1470 <main+0x2a0>
cmp    $0x2a,%cl
je     1470 <main+0x2a0>
test   %cl,%cl
jne    1482 <main+0x2b2>
jmp    1300 <main+0x130>
nopl   0x0(%rax)
movzbl 0x1(%rdx),%ecx
add    $0x1,%rdx
mov    %ecx,%ebx
or     $0x20,%bl
cmp    $0x2d,%bl
jne    1470 <main+0x2a0>
cmp    $0xa,%cl
je     1450 <main+0x280>
cmp    $0xd,%cl
je     1450 <main+0x280>
mov    %cl,(%rsi)
add    $0x1,%rsi
jmp    1450 <main+0x280>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xb61(%rip),%rdi
call   1030 <puts@plt>
jmp    1327 <main+0x157>
xor    %eax,%eax
add    $0x618,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"exit\00"
@.str.1 = [34 x i8] c"wrong msg... please try again^-^\0A\00"
@.str.2 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca [256 x i8]
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64*
%9 = alloca i32
%10 = alloca i32
%11 = alloca [1024 x i8]
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i8*
store i32 0, i32* %1
%15 = bitcast [256 x i8]* %2 to i8*
%16 = bitcast [256 x i8]* %3 to i8*
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%18 = call i32 @gets(i8* %17)
%19 = call i8* @malloc(i32 80)
%20 = bitcast i8* %19 to i8**
store i8** %20, i8*** %4
store i32 0, i32* %5
br label %21
21: ; preds = %170, %0
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %177
25: ; preds = %21
%26 = call i32 (...) @getSocket()
store i32 %26, i32* %6
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
store i8* %27, i8** %7
%28 = load i8*, i8** %7
%29 = load i8**, i8*** %4
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
%32 = sext i32 %30 to i64
%33 = getelementptr inbounds i8*, i8** %29, i64 %32
store i8* %28, i8** %33
br label %34
34: ; preds = %56, %25
%35 = load i8*, i8** %7
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %57
39: ; preds = %34
%40 = load i8*, i8** %7
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp ne i32 %42, 32
br i1 %43, label %44, label %47
44: ; preds = %39
%45 = load i8*, i8** %7
%46 = getelementptr inbounds i8, i8* %45, i32 1
store i8* %46, i8** %7
br label %56
47: ; preds = %39
%48 = load i8*, i8** %7
store i8 0, i8* %48
%49 = load i8*, i8** %7
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %7
%51 = load i8**, i8*** %4
%52 = load i32, i32* %5
%53 = add nsw i32 %52, 1
store i32 %53, i32* %5
%54 = sext i32 %52 to i64
%55 = getelementptr inbounds i8*, i8** %51, i64 %54
store i8* %50, i8** %55
br label %56
56: ; preds = %47, %44
br label %34
57: ; preds = %34
%58 = load i32, i32* %5
%59 = sext i32 %58 to i64
%60 = mul i64 %59, 8
%61 = trunc i64 %60 to i32
%62 = call i8* @malloc(i32 %61)
%63 = bitcast i8* %62 to i64*
store i64* %63, i64** %8
store i32 0, i32* %9
br label %64
64: ; preds = %68, %57
%65 = load i32, i32* %9
%66 = load i32, i32* %5
%67 = icmp slt i32 %65, %66
br i1 %67, label %68, label %83
68: ; preds = %64
%69 = load i8**, i8*** %4
%70 = load i32, i32* %9
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8*, i8** %69, i64 %71
%73 = load i8*, i8** %72
%74 = call i32 @strlen(i8* %73)
store i32 %74, i32* %10
%75 = load i32, i32* %10
%76 = sext i32 %75 to i64
%77 = load i64*, i64** %8
%78 = load i32, i32* %9
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i64, i64* %77, i64 %79
store i64 %76, i64* %80
%81 = load i32, i32* %9
%82 = add nsw i32 %81, 1
store i32 %82, i32* %9
br label %64
83: ; preds = %64
%84 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%85 = call i32 @bzero(i8* %84, i32 256)
%86 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%87 = load i32, i32* %5
%88 = load i8**, i8*** %4
%89 = load i64*, i64** %8
%90 = call i32 @appendleftCommandArgv(i8* %86, i32 %87, i8** %88, i64* %89)
%91 = load i32, i32* %6
%92 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%93 = call i32 @write(i32 %91, i8* %92, i32 256)
%94 = bitcast [1024 x i8]* %11 to i8*
%95 = load i32, i32* %6
%96 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%97 = call i32 @read(i32 %95, i8* %96, i32 1024)
store i32 %97, i32* %12
%98 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
store i8* %98, i8** %13
%99 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
store i8* %99, i8** %14
br label %100
100: ; preds = %154, %83
%101 = load i8*, i8** %13
%102 = load i8, i8* %101
%103 = sext i8 %102 to i32
%104 = icmp ne i32 %103, 0
br i1 %104, label %105, label %155
105: ; preds = %100
%106 = load i8*, i8** %13
%107 = load i8, i8* %106
%108 = sext i8 %107 to i32
%109 = icmp eq i32 %108, 36
br i1 %109, label %115, label %110
110: ; preds = %105
%111 = load i8*, i8** %13
%112 = load i8, i8* %111
%113 = sext i8 %112 to i32
%114 = icmp eq i32 %113, 42
br i1 %114, label %115, label %133
115: ; preds = %110, %105
%116 = load i8*, i8** %13
%117 = getelementptr inbounds i8, i8* %116, i32 1
store i8* %117, i8** %13
br label %118
118: ; preds = %129, %115
%119 = load i8*, i8** %13
%120 = load i8, i8* %119
%121 = sext i8 %120 to i32
%122 = icmp ne i32 %121, 13
br i1 %122, label %123, label %132
123: ; preds = %118
%124 = load i8*, i8** %13
%125 = load i8, i8* %124
%126 = sext i8 %125 to i32
%127 = icmp eq i32 %126, 45
br i1 %127, label %128, label %129
128: ; preds = %123
br label %132
129: ; preds = %123
%130 = load i8*, i8** %13
%131 = getelementptr inbounds i8, i8* %130, i32 1
store i8* %131, i8** %13
br label %118
132: ; preds = %128, %118
br label %133
133: ; preds = %132, %110
%134 = load i8*, i8** %13
%135 = load i8, i8* %134
%136 = sext i8 %135 to i32
%137 = icmp eq i32 %136, 13
br i1 %137, label %143, label %138
138: ; preds = %133
%139 = load i8*, i8** %13
%140 = load i8, i8* %139
%141 = sext i8 %140 to i32
%142 = icmp eq i32 %141, 10
br i1 %142, label %143, label %146
143: ; preds = %138, %133
%144 = load i8*, i8** %13
%145 = getelementptr inbounds i8, i8* %144, i32 1
store i8* %145, i8** %13
br label %154
146: ; preds = %138
%147 = load i8*, i8** %13
%148 = load i8, i8* %147
%149 = load i8*, i8** %14
store i8 %148, i8* %149
%150 = load i8*, i8** %14
%151 = getelementptr inbounds i8, i8* %150, i32 1
store i8* %151, i8** %14
%152 = load i8*, i8** %13
%153 = getelementptr inbounds i8, i8* %152, i32 1
store i8* %153, i8** %13
br label %154
154: ; preds = %146, %143
br label %100
155: ; preds = %100
%156 = load i8*, i8** %14
store i8 13, i8* %156
%157 = load i8*, i8** %14
%158 = getelementptr inbounds i8, i8* %157, i32 1
store i8* %158, i8** %14
%159 = load i8*, i8** %14
store i8 10, i8* %159
%160 = load i8*, i8** %14
%161 = getelementptr inbounds i8, i8* %160, i32 1
store i8* %161, i8** %14
%162 = load i8*, i8** %14
store i8 0, i8* %162
%163 = load i32, i32* %12
%164 = icmp eq i32 %163, 0
br i1 %164, label %165, label %167
165: ; preds = %155
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %170
167: ; preds = %155
%168 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %168)
br label %170
170: ; preds = %167, %165
%171 = load i32, i32* %6
%172 = call i32 @close(i32 %171)
store i32 0, i32* %5
%173 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%174 = call i32 @bzero(i8* %173, i32 256)
%175 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%176 = call i32 @gets(i8* %175)
br label %21
177: ; preds = %21
%178 = load i32, i32* %1
ret i32 %178
}

LLVM IR (-O2):
@.str = [5 x i8] c"exit\00"
@.str.2 = [3 x i8] c"%s\00"
@str = [33 x i8] c"wrong msg... please try again^-^\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = alloca [256 x i8]
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
%7 = call dereferenceable_or_null(80) i8* @malloc(i32 80)
%8 = bitcast i8* %7 to i8**
%9 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %78, label %11
11: ; preds = %0
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
br label %13
13: ; preds = %11, %72
%14 = call i32 (...) @getSocket()
store i8* %5, i8** %8
br label %15
15: ; preds = %23, %13
%16 = phi i8* [ %24, %23 ], [ %5, %13 ]
%17 = phi i32 [ %25, %23 ], [ 1, %13 ]
br label %18
18: ; preds = %15, %21
%19 = phi i8* [ %22, %21 ], [ %16, %15 ]
%20 = load i8, i8* %19
switch i8 %20, label %21 [
i8 0, label %28
i8 32, label %23
]
21: ; preds = %18
%22 = getelementptr inbounds i8, i8* %19, i64 1
br label %18
23: ; preds = %18
store i8 0, i8* %19
%24 = getelementptr inbounds i8, i8* %19, i64 1
%25 = add nuw nsw i32 %17, 1
%26 = zext i32 %17 to i64
%27 = getelementptr inbounds i8*, i8** %8, i64 %26
store i8* %24, i8** %27
br label %15
28: ; preds = %18
%29 = shl i32 %17, 3
%30 = call i8* @malloc(i32 %29)
%31 = bitcast i8* %30 to i64*
%32 = zext i32 %17 to i64
br label %33
33: ; preds = %28, %33
%34 = phi i64 [ 0, %28 ], [ %40, %33 ]
%35 = getelementptr inbounds i8*, i8** %8, i64 %34
%36 = load i8*, i8** %35
%37 = call i32 @strlen(i8* %36)
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i64, i64* %31, i64 %34
store i64 %38, i64* %39
%40 = add nuw nsw i64 %34, 1
%41 = icmp eq i64 %40, %32
br i1 %41, label %42, label %33
42: ; preds = %33
%43 = call i32 @bzero(i8* %4, i32 256)
%44 = call i32 @appendleftCommandArgv(i8* %4, i32 %17, i8** %8, i64* %31)
%45 = call i32 @write(i32 %14, i8* %4, i32 256)
%46 = call i32 @read(i32 %14, i8* %12, i32 1024)
br label %47
47: ; preds = %61, %42
%48 = phi i8* [ %12, %42 ], [ %63, %61 ]
%49 = phi i8* [ %12, %42 ], [ %62, %61 ]
%50 = load i8, i8* %48
switch i8 %50, label %56 [
i8 0, label %64
i8 36, label %51
i8 42, label %51
]
51: ; preds = %47, %47
br label %52
52: ; preds = %51, %52
%53 = phi i8* [ %54, %52 ], [ %48, %51 ]
%54 = getelementptr inbounds i8, i8* %53, i64 1
%55 = load i8, i8* %54
switch i8 %55, label %52 [
i8 13, label %56
i8 45, label %56
]
56: ; preds = %52, %52, %47
%57 = phi i8 [ %50, %47 ], [ %55, %52 ], [ %55, %52 ]
%58 = phi i8* [ %48, %47 ], [ %54, %52 ], [ %54, %52 ]
switch i8 %57, label %59 [
i8 13, label %61
i8 10, label %61
]
59: ; preds = %56
store i8 %57, i8* %49
%60 = getelementptr inbounds i8, i8* %49, i64 1
br label %61
61: ; preds = %56, %56, %59
%62 = phi i8* [ %60, %59 ], [ %49, %56 ], [ %49, %56 ]
%63 = getelementptr inbounds i8, i8* %58, i64 1
br label %47
64: ; preds = %47
store i8 13, i8* %49
%65 = getelementptr inbounds i8, i8* %49, i64 1
store i8 10, i8* %65
%66 = getelementptr inbounds i8, i8* %49, i64 2
store i8 0, i8* %66
%67 = icmp eq i32 %46, 0
br i1 %67, label %68, label %70
68: ; preds = %64
%69 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
br label %72
70: ; preds = %64
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %12)
br label %72
72: ; preds = %70, %68
%73 = call i32 @close(i32 %14)
%74 = call i32 @bzero(i8* %5, i32 256)
%75 = call i32 @gets(i8* %5)
%76 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %13
78: ; preds = %72, %0
ret i32 0
}