#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 */
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
scalar_t__ EAGAIN;
int EOF;
int SOCK_CLOEXEC;
int SOCK_STREAM;
scalar_t__ connect(int, struct sockaddr *, int);
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int getopt(int, char **, char *);
int /*<<< orphan*/ help(char **);
int /*<<< orphan*/ htons(int);
scalar_t__ inet_aton(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
char *optarg;
int optind;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int read(int, char *, int);
scalar_t__ snprintf(char *, int, char *, char *);
int socket(int /*<<< orphan*/, int, int /*<<< orphan*/);
int sprintf(char *, char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, int *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ usage();
int write(int, char *, int);
int main(int argc, char **argv) {
  char bindaddress[50];
  int bindport;
  int cmdc;
  int tmp_int;
  static int srvfd = -1;
  struct sockaddr_in skt;
  int adrlen;
  int i;
  int ret;
  char buf[250];
  int slen;
  int nout;
  char c;
  strncpy(bindaddress, "127.0.0.1", 50 - 1);
  bindport = 8870;
  if (strcmp(argv[0], "ed"
                      "get") &&
      strcmp(argv[0], "ed"
                      "set") &&
      strcmp(argv[0], "ed"
                      "cat") &&
      strcmp(argv[0], "ed"
                      "list") &&
      strcmp(argv[0], "ed"
                      "loadso")) {
    printf("Unrecognized command '%s'.  Commands must be one of\n", argv[0]);
    printf(" %sget, %sset, %scat, %slist, or %sloadso\n", "ed", "ed", "ed",
           "ed", "ed");
    exit(-1);
  }
  optind = 0;
  optarg = argv[0];
  while ((cmdc = getopt(argc, argv, "a:hp:")) != EOF) {
    switch ((char)cmdc) {
    case 'a':
      strncpy(bindaddress, optarg, 50);
      break;
    case 'h':
      help(argv);
      exit(0);
      break;
    case 'p':
      if (sscanf(optarg, "%d", &tmp_int)) {
        bindport = tmp_int;
      }
      break;
    default:
      usage();
      exit(-1);
      break;
    }
  }
  adrlen = sizeof(struct sockaddr_in);
  (void)memset((void *)&skt, 0, (size_t)adrlen);
  skt.sin_family = AF_INET;
  skt.sin_port = htons(bindport);
  if ((inet_aton(bindaddress, &(skt.sin_addr)) == 0) ||
      ((srvfd = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0)) < 0) ||
      (connect(srvfd, (struct sockaddr *)&skt, adrlen) < 0)) {
    printf("Error: unable to connect to the empty daemon.\n");
    exit(-1);
  }
  slen = sprintf(buf, "%s ", argv[0]);
  for (i = optind; (i < argc && slen < 250 - 1); i++) {
    slen += snprintf(&(buf[slen]), (250 - slen), "%s ", argv[i]);
  }
  if (slen >= 250 - 1) {
    printf("Error: command exceeds maximum length of %d\n", 250);
    exit(-1);
  }
  buf[slen - 1] = '\n';
  nout = 0;
  while (nout != slen) {
    ret = write(srvfd, &(buf[nout]), (slen - nout));
    if ((ret < 0) && (errno == EAGAIN))
      continue;
    else if (ret <= 0) {
      printf("Error writing to empty daemon\n");
      exit(-1);
    }
    nout += ret;
  }
  while (1) {
    ret = read(srvfd, &c, 1);
    if ((c == '\\') || (ret == 0)) {
      exit(0);
    } else if ((ret < 0) && (errno != EAGAIN)) {
      printf("\nError reading from empty daemon connection\n");
      exit(-1);
    }
    if (errno == EAGAIN) {
      continue;
    }
    putchar(c);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xdbc(%rip),%rsi
mov    $0x31,%edx
call   1040 <strncpy@plt>
movl   $0x22a6,-0x54(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xda7(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
je     1326 <main+0x106>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd90(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
je     1326 <main+0x106>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd79(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
je     1326 <main+0x106>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd62(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
je     1326 <main+0x106>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd4c(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
je     1326 <main+0x106>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd38(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xd5f(%rip),%rdi
lea    0xd83(%rip),%r9
mov    %r9,%rsi
mov    %r9,%rdx
mov    %r9,%rcx
mov    %r9,%r8
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0xffffffff,%edi
call   1120 <exit@plt>
mov    0x2c9b(%rip),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    0x2cb7(%rip),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xd3d(%rip),%rdx
call   10f0 <getopt@plt>
mov    %eax,-0x58(%rbp)
mov    0x2c6f(%rip),%rcx
cmp    (%rcx),%eax
je     141a <main+0x1fa>
movsbl -0x58(%rbp),%eax
mov    %eax,-0x180(%rbp)
sub    $0x61,%eax
je     13a9 <main+0x189>
jmp    1381 <main+0x161>
mov    -0x180(%rbp),%eax
sub    $0x68,%eax
je     13c6 <main+0x1a6>
jmp    1395 <main+0x175>
mov    -0x180(%rbp),%eax
sub    $0x70,%eax
je     13d6 <main+0x1b6>
jmp    1404 <main+0x1e4>
lea    -0x50(%rbp),%rdi
mov    0x2c44(%rip),%rax
mov    (%rax),%rsi
mov    $0x32,%edx
call   1040 <strncpy@plt>
jmp    1415 <main+0x1f5>
mov    -0x10(%rbp),%rdi
call   1100 <help@plt>
xor    %edi,%edi
call   1120 <exit@plt>
mov    0x2c1b(%rip),%rax
mov    (%rax),%rdi
lea    0xcae(%rip),%rsi
lea    -0x5c(%rbp),%rdx
call   10d0 <sscanf@plt>
cmp    $0x0,%eax
je     13ff <main+0x1df>
mov    -0x5c(%rbp),%eax
mov    %eax,-0x54(%rbp)
jmp    1415 <main+0x1f5>
mov    $0x0,%al
call   10e0 <usage@plt>
mov    $0xffffffff,%edi
call   1120 <exit@plt>
jmp    1344 <main+0x124>
movl   $0xc,-0x6c(%rbp)
lea    -0x68(%rbp),%rdi
movslq -0x6c(%rbp),%rdx
xor    %esi,%esi
call   1090 <memset@plt>
mov    0x2ba1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
mov    -0x54(%rbp),%edi
call   1060 <htons@plt>
mov    %eax,-0x64(%rbp)
lea    -0x50(%rbp),%rdi
lea    -0x68(%rbp),%rsi
call   10c0 <inet_aton@plt>
cmp    $0x0,%rax
je     14ab <main+0x28b>
mov    0x2b73(%rip),%rax
mov    (%rax),%edi
mov    0x2b4a(%rip),%rax
mov    (%rax),%esi
mov    0x2b71(%rip),%rax
or     (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,0x2c2a(%rip)
cmp    $0x0,%eax
jl     14ab <main+0x28b>
mov    0x2c1b(%rip),%edi
lea    -0x68(%rbp),%rsi
mov    -0x6c(%rbp),%edx
call   1130 <connect@plt>
cmp    $0x0,%rax
jge    14c3 <main+0x2a3>
lea    0xbe6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0xffffffff,%edi
call   1120 <exit@plt>
lea    -0x170(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xbef(%rip),%rsi
call   1110 <sprintf@plt>
mov    %eax,-0x174(%rbp)
mov    0x2ade(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x70(%rbp)
mov    -0x70(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x181(%rbp)
jge    1516 <main+0x2f6>
cmpl   $0xf9,-0x174(%rbp)
setl   %al
mov    %al,-0x181(%rbp)
mov    -0x181(%rbp),%al
test   $0x1,%al
jne    1529 <main+0x309>
jmp    157e <main+0x35e>
movslq -0x174(%rbp),%rax
lea    -0x170(%rbp),%rdi
add    %rax,%rdi
mov    $0xfa,%esi
sub    -0x174(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x70(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xb6f(%rip),%rdx
call   1080 <snprintf@plt>
mov    %rax,%rcx
movslq -0x174(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x174(%rbp)
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    14ef <main+0x2cf>
cmpl   $0xf9,-0x174(%rbp)
jl     15ab <main+0x38b>
lea    0xb36(%rip),%rdi
mov    $0xfa,%esi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0xffffffff,%edi
call   1120 <exit@plt>
mov    -0x174(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0xa,-0x170(%rbp,%rax,1)
0a
movl   $0x0,-0x178(%rbp)
mov    -0x178(%rbp),%eax
cmp    -0x174(%rbp),%eax
je     1669 <main+0x449>
mov    0x2ad0(%rip),%edi
movslq -0x178(%rbp),%rax
lea    -0x170(%rbp),%rsi
add    %rax,%rsi
mov    -0x174(%rbp),%edx
sub    -0x178(%rbp),%edx
call   1050 <write@plt>
mov    %eax,-0x74(%rbp)
cmpl   $0x0,-0x74(%rbp)
jge    162e <main+0x40e>
mov    0x299a(%rip),%rax
mov    (%rax),%rax
mov    0x2980(%rip),%rcx
cmp    (%rcx),%rax
jne    162e <main+0x40e>
jmp    15c8 <main+0x3a8>
cmpl   $0x0,-0x74(%rbp)
jg     1650 <main+0x430>
lea    0xab9(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0xffffffff,%edi
call   1120 <exit@plt>
jmp    1655 <main+0x435>
mov    -0x74(%rbp),%eax
add    -0x178(%rbp),%eax
mov    %eax,-0x178(%rbp)
jmp    15c8 <main+0x3a8>
jmp    166e <main+0x44e>
mov    0x2a3c(%rip),%edi
lea    -0x179(%rbp),%rsi
mov    $0x1,%edx
call   10a0 <read@plt>
mov    %eax,-0x74(%rbp)
movsbl -0x179(%rbp),%eax
cmp    $0x5c,%eax
je     16a2 <main+0x482>
cmpl   $0x0,-0x74(%rbp)
jne    16a9 <main+0x489>
xor    %edi,%edi
call   1120 <exit@plt>
cmpl   $0x0,-0x74(%rbp)
jge    16e5 <main+0x4c5>
mov    0x28f6(%rip),%rax
mov    (%rax),%rax
mov    0x28dc(%rip),%rcx
cmp    (%rcx),%rax
je     16e5 <main+0x4c5>
lea    0xa43(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0xffffffff,%edi
call   1120 <exit@plt>
jmp    16ea <main+0x4ca>
mov    0x28bf(%rip),%rax
mov    (%rax),%rax
mov    0x28a5(%rip),%rcx
cmp    (%rcx),%rax
jne    1709 <main+0x4e9>
jmp    166e <main+0x44e>
movsbl -0x179(%rbp),%edi
call   1030 <putchar@plt>
jmp    166e <main+0x44e>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x168,%rsp
mov    %rsi,%r14
mov    %edi,%r15d
lea    0xdb2(%rip),%rsi
lea    0x20(%rsp),%rdi
mov    $0x31,%edx
call   1040 <strncpy@plt>
mov    (%r14),%rdi
lea    0xda3(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     12c5 <main+0x95>
mov    (%r14),%rdi
lea    0xd95(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     12c5 <main+0x95>
mov    (%r14),%rdi
lea    0xd87(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     12c5 <main+0x95>
mov    (%r14),%rdi
lea    0xd79(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     12c5 <main+0x95>
mov    (%r14),%rdi
lea    0xd6c(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
jne    1581 <main+0x351>
mov    0x2cfc(%rip),%rax
movl   $0x0,(%rax)
mov    (%r14),%rax
mov    0x2d1c(%rip),%r12
mov    %rax,(%r12)
lea    0xda8(%rip),%rdx
mov    %r15d,%edi
mov    %r14,%rsi
call   1100 <getopt@plt>
mov    0x2cd7(%rip),%r13
movl   $0x22a6,0x8(%rsp)
cmp    0x0(%r13),%eax
jne    13a0 <main+0x170>
lea    0x10(%rsp),%rbp
mov    $0xc,%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   10a0 <memset@plt>
mov    0x2cb2(%rip),%rbx
mov    (%rbx),%eax
mov    %eax,0x18(%rsp)
mov    0x8(%rsp),%edi
call   1070 <htons@plt>
mov    %eax,0x14(%rsp)
lea    0x20(%rsp),%rdi
mov    %rbp,%rsi
call   10d0 <inet_aton@plt>
test   %rax,%rax
je     138a <main+0x15a>
mov    (%rbx),%edi
mov    0x2c64(%rip),%rax
mov    0x2c8d(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
xor    %edx,%edx
call   1150 <socket@plt>
mov    %eax,0x2d4c(%rip)
test   %eax,%eax
js     138a <main+0x15a>
lea    0x10(%rsp),%rsi
mov    %eax,%edi
mov    $0xc,%edx
call   1140 <connect@plt>
test   %rax,%rax
jns    143d <main+0x20d>
lea    0xd82(%rip),%rdi
call   1050 <puts@plt>
mov    $0xffffffff,%edi
call   1130 <exit@plt>
movl   $0x22a6,0x8(%rsp)
lea    0xce0(%rip),%rbp
lea    0xc(%rsp),%rbx
jmp    13eb <main+0x1bb>
cs nopw 0x0(%rax,%rax,1)
mov    (%r12),%rsi
lea    0x20(%rsp),%rdi
mov    $0x32,%edx
call   1040 <strncpy@plt>
mov    %r15d,%edi
mov    %r14,%rsi
mov    %rbp,%rdx
call   1100 <getopt@plt>
cmp    0x0(%r13),%eax
je     130b <main+0xdb>
cmp    $0x61,%al
je     13c0 <main+0x190>
movsbl %al,%eax
cmp    $0x70,%eax
jne    1418 <main+0x1e8>
mov    (%r12),%rdi
lea    0xc93(%rip),%rsi
mov    %rbx,%rdx
call   10e0 <sscanf@plt>
test   %eax,%eax
je     13d3 <main+0x1a3>
mov    0xc(%rsp),%eax
mov    %eax,0x8(%rsp)
jmp    13d3 <main+0x1a3>
cmp    $0x68,%eax
jne    142c <main+0x1fc>
mov    %r14,%rdi
call   1110 <help@plt>
xor    %edi,%edi
call   1130 <exit@plt>
xor    %eax,%eax
call   10f0 <usage@plt>
mov    $0xffffffff,%edi
call   1130 <exit@plt>
mov    (%r14),%rdx
lea    0xc51(%rip),%rsi
lea    0x60(%rsp),%rdi
call   1120 <sprintf@plt>
mov    %eax,%ebp
mov    0x2b6e(%rip),%rax
movslq (%rax),%rbx
cmp    %r15d,%ebx
jge    14b7 <main+0x287>
cmp    $0xf8,%ebp
jg     14b7 <main+0x287>
movslq %r15d,%r13
add    $0x1,%rbx
lea    0xc20(%rip),%r15
nopl   0x0(%rax,%rax,1)
movslq %ebp,%r12
lea    (%rsp,%r12,1),%rdi
add    $0x60,%rdi
mov    $0xfa,%esi
sub    %r12d,%esi
mov    -0x8(%r14,%rbx,8),%rcx
mov    %r15,%rdx
call   1090 <snprintf@plt>
mov    %rax,%rbp
add    %r12d,%ebp
cmp    %r13,%rbx
jge    14b7 <main+0x287>
add    $0x1,%rbx
cmp    $0xf9,%ebp
jl     1480 <main+0x250>
cmp    $0xf9,%ebp
jl     14dc <main+0x2ac>
lea    0xbd6(%rip),%rdi
mov    $0xfa,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xffffffff,%edi
call   1130 <exit@plt>
movslq %ebp,%rax
lea    0x60(%rsp),%r12
movb   $0xa,-0x1(%rax,%r12,1)
test   %ebp,%ebp
jne    15bd <main+0x38d>
mov    0x2bc0(%rip),%edi
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   10b0 <read@plt>
test   %eax,%eax
je     157a <main+0x34a>
mov    0x7(%rsp),%cl
cmp    $0x5c,%cl
je     157a <main+0x34a>
mov    0x2a95(%rip),%r14
mov    0x2a7e(%rip),%rbp
lea    0x7(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    (%r14),%rdx
mov    0x0(%rbp),%rsi
test   %eax,%eax
js     1550 <main+0x320>
cmp    %rsi,%rdx
je     1559 <main+0x329>
movsbl %cl,%edi
call   1030 <putchar@plt>
jmp    1559 <main+0x329>
nopw   0x0(%rax,%rax,1)
cmp    %rsi,%rdx
jne    1625 <main+0x3f5>
mov    0x2b59(%rip),%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   10b0 <read@plt>
test   %eax,%eax
je     157a <main+0x34a>
movzbl 0x7(%rsp),%ecx
cmp    $0x5c,%cl
jne    1530 <main+0x300>
xor    %edi,%edi
call   1130 <exit@plt>
mov    (%r14),%rsi
lea    0xaa1(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xac8(%rip),%rdi
lea    0xaec(%rip),%rcx
mov    %rcx,%rsi
mov    %rcx,%rdx
mov    %rcx,%r8
mov    %rcx,%r9
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xffffffff,%edi
call   1130 <exit@plt>
xor    %r14d,%r14d
mov    0x29e9(%rip),%r15
mov    0x29d2(%rip),%r13
mov    %ebp,%ebx
jmp    15e9 <main+0x3b9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r15),%rax
cmp    0x0(%r13),%rax
jne    1619 <main+0x3e9>
mov    0x2ac9(%rip),%edi
mov    %r12,%rsi
mov    %ebx,%edx
call   1060 <write@plt>
test   %eax,%eax
js     15e0 <main+0x3b0>
je     1619 <main+0x3e9>
add    %eax,%r14d
mov    %ebp,%ebx
movslq %r14d,%rax
lea    (%rsp,%rax,1),%r12
add    $0x60,%r12
sub    %r14d,%ebx
jne    15e9 <main+0x3b9>
jmp    14f2 <main+0x2c2>
lea    0xad5(%rip),%rdi
jmp    1391 <main+0x161>
lea    0xa9d(%rip),%rdi
jmp    1391 <main+0x161>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@main.srvfd = internal global i32 -1
@.str = [10 x i8] c"127.0.0.1\00"
@.str.1 = [6 x i8] c"edget\00"
@.str.2 = [6 x i8] c"edset\00"
@.str.3 = [6 x i8] c"edcat\00"
@.str.4 = [7 x i8] c"edlist\00"
@.str.5 = [9 x i8] c"edloadso\00"
@.str.6 = [53 x i8] c"Unrecognized command '%s'. Commands must be one of\0A\00"
@.str.7 = [43 x i8] c" %sget, %sset, %scat, %slist, or %sloadso\0A\00"
@.str.8 = [3 x i8] c"ed\00"
@optind = global i32 0
@optarg = global i8* null
@.str.9 = [6 x i8] c"a:hp:\00"
@EOF = global i32 0
@.str.10 = [3 x i8] c"%d\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@SOCK_CLOEXEC = global i32 0
@.str.11 = [47 x i8] c"Error: unable to connect to the empty daemon.\0A\00"
@.str.12 = [4 x i8] c"%s \00"
@.str.13 = [45 x i8] c"Error: command exceeds maximum length of %d\0A\00"
@errno = global i64 0
@EAGAIN = global i64 0
@.str.14 = [31 x i8] c"Error writing to empty daemon\0A\00"
@.str.15 = [45 x i8] c"\0AError reading from empty daemon connection\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [50 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.sockaddr_in
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca [250 x i8]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%18 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%19 = call i32 @strncpy(i8* %18, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 49)
store i32 8870, i32* %7
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %56
25: ; preds = %2
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 0
%28 = load i8*, i8** %27
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %56
31: ; preds = %25
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %56
37: ; preds = %31
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 0
%40 = load i8*, i8** %39
%41 = call i64 @strcmp(i8* %40, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%42 = icmp ne i64 %41, 0
br i1 %42, label %43, label %56
43: ; preds = %37
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 0
%46 = load i8*, i8** %45
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %56
49: ; preds = %43
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 0
%52 = load i8*, i8** %51
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.6, i64 0, i64 0), i8* %52)
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%55 = call i32 @exit(i32 -1)
unreachable
56: ; preds = %43, %37, %31, %25, %2
store i32 0, i32* @optind
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 0
%59 = load i8*, i8** %58
store i8* %59, i8** @optarg
br label %60
60: ; preds = %88, %56
%61 = load i32, i32* %4
%62 = load i8**, i8*** %5
%63 = call i32 @getopt(i32 %61, i8** %62, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
store i32 %63, i32* %8
%64 = load i32, i32* @EOF
%65 = icmp ne i32 %63, %64
br i1 %65, label %66, label %89
66: ; preds = %60
%67 = load i32, i32* %8
%68 = trunc i32 %67 to i8
%69 = sext i8 %68 to i32
switch i32 %69, label %85 [
i32 97, label %70
i32 104, label %74
i32 112, label %78
]
70: ; preds = %66
%71 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%72 = load i8*, i8** @optarg
%73 = call i32 @strncpy(i8* %71, i8* %72, i32 50)
br label %88
74: ; preds = %66
%75 = load i8**, i8*** %5
%76 = call i32 @help(i8** %75)
%77 = call i32 @exit(i32 0)
unreachable
78: ; preds = %66
%79 = load i8*, i8** @optarg
%80 = call i32 @sscanf(i8* %79, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %9)
%81 = icmp ne i32 %80, 0
br i1 %81, label %82, label %84
82: ; preds = %78
%83 = load i32, i32* %9
store i32 %83, i32* %7
br label %84
84: ; preds = %82, %78
br label %88
85: ; preds = %66
%86 = call i32 (...) @usage()
%87 = call i32 @exit(i32 -1)
unreachable
88: ; preds = %84, %70
br label %60
89: ; preds = %60
store i32 12, i32* %11
%90 = bitcast %struct.sockaddr_in* %10 to i8*
%91 = load i32, i32* %11
%92 = sext i32 %91 to i64
%93 = call i32 @memset(i8* %90, i32 0, i64 %92)
%94 = load i32, i32* @AF_INET
%95 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 2
store i32 %94, i32* %95
%96 = load i32, i32* %7
%97 = call i32 @htons(i32 %96)
%98 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
store i32 %97, i32* %98
%99 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%100 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
%101 = call i64 @inet_aton(i8* %99, i32* %100)
%102 = icmp eq i64 %101, 0
br i1 %102, label %116, label %103
103: ; preds = %89
%104 = load i32, i32* @AF_INET
%105 = load i32, i32* @SOCK_STREAM
%106 = load i32, i32* @SOCK_CLOEXEC
%107 = or i32 %105, %106
%108 = call i32 @socket(i32 %104, i32 %107, i32 0)
store i32 %108, i32* @main.srvfd
%109 = icmp slt i32 %108, 0
br i1 %109, label %116, label %110
110: ; preds = %103
%111 = load i32, i32* @main.srvfd
%112 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%113 = load i32, i32* %11
%114 = call i64 @connect(i32 %111, %struct.sockaddr* %112, i32 %113)
%115 = icmp slt i64 %114, 0
br i1 %115, label %116, label %119
116: ; preds = %110, %103, %89
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.11, i64 0, i64 0))
%118 = call i32 @exit(i32 -1)
unreachable
119: ; preds = %110
%120 = getelementptr inbounds [250 x i8], [250 x i8]* %14, i64 0, i64 0
%121 = load i8**, i8*** %5
%122 = getelementptr inbounds i8*, i8** %121, i64 0
%123 = load i8*, i8** %122
%124 = call i32 @sprintf(i8* %120, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %123)
store i32 %124, i32* %15
%125 = load i32, i32* @optind
store i32 %125, i32* %12
br label %126
126: ; preds = %151, %119
%127 = load i32, i32* %12
%128 = load i32, i32* %4
%129 = icmp slt i32 %127, %128
br i1 %129, label %130, label %133
130: ; preds = %126
%131 = load i32, i32* %15
%132 = icmp slt i32 %131, 249
br label %133
133: ; preds = %130, %126
%134 = phi i1 [ false, %126 ], [ %132, %130 ]
br i1 %134, label %135, label %154
135: ; preds = %133
%136 = load i32, i32* %15
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds [250 x i8], [250 x i8]* %14, i64 0, i64 %137
%139 = load i32, i32* %15
%140 = sub nsw i32 250, %139
%141 = load i8**, i8*** %5
%142 = load i32, i32* %12
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i8*, i8** %141, i64 %143
%145 = load i8*, i8** %144
%146 = call i64 @snprintf(i8* %138, i32 %140, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %145)
%147 = load i32, i32* %15
%148 = sext i32 %147 to i64
%149 = add nsw i64 %148, %146
%150 = trunc i64 %149 to i32
store i32 %150, i32* %15
br label %151
151: ; preds = %135
%152 = load i32, i32* %12
%153 = add nsw i32 %152, 1
store i32 %153, i32* %12
br label %126
154: ; preds = %133
%155 = load i32, i32* %15
%156 = icmp sge i32 %155, 249
br i1 %156, label %157, label %160
157: ; preds = %154
%158 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.13, i64 0, i64 0), i32 250)
%159 = call i32 @exit(i32 -1)
unreachable
160: ; preds = %154
%161 = load i32, i32* %15
%162 = sub nsw i32 %161, 1
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds [250 x i8], [250 x i8]* %14, i64 0, i64 %163
store i8 10, i8* %164
store i32 0, i32* %16
br label %165
165: ; preds = %192, %184, %160
%166 = load i32, i32* %16
%167 = load i32, i32* %15
%168 = icmp ne i32 %166, %167
br i1 %168, label %169, label %196
169: ; preds = %165
%170 = load i32, i32* @main.srvfd
%171 = load i32, i32* %16
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds [250 x i8], [250 x i8]* %14, i64 0, i64 %172
%174 = load i32, i32* %15
%175 = load i32, i32* %16
%176 = sub nsw i32 %174, %175
%177 = call i32 @write(i32 %170, i8* %173, i32 %176)
store i32 %177, i32* %13
%178 = load i32, i32* %13
%179 = icmp slt i32 %178, 0
br i1 %179, label %180, label %185
180: ; preds = %169
%181 = load i64, i64* @errno
%182 = load i64, i64* @EAGAIN
%183 = icmp eq i64 %181, %182
br i1 %183, label %184, label %185
184: ; preds = %180
br label %165
185: ; preds = %180, %169
%186 = load i32, i32* %13
%187 = icmp sle i32 %186, 0
br i1 %187, label %188, label %191
188: ; preds = %185
%189 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.14, i64 0, i64 0))
%190 = call i32 @exit(i32 -1)
unreachable
191: ; preds = %185
br label %192
192: ; preds = %191
%193 = load i32, i32* %13
%194 = load i32, i32* %16
%195 = add nsw i32 %194, %193
store i32 %195, i32* %16
br label %165
196: ; preds = %165
br label %197
197: ; preds = %196, %223, %224
%198 = load i32, i32* @main.srvfd
%199 = call i32 @read(i32 %198, i8* %17, i32 1)
store i32 %199, i32* %13
%200 = load i8, i8* %17
%201 = sext i8 %200 to i32
%202 = icmp eq i32 %201, 92
br i1 %202, label %206, label %203
203: ; preds = %197
%204 = load i32, i32* %13
%205 = icmp eq i32 %204, 0
br i1 %205, label %206, label %208
206: ; preds = %203, %197
%207 = call i32 @exit(i32 0)
unreachable
208: ; preds = %203
%209 = load i32, i32* %13
%210 = icmp slt i32 %209, 0
br i1 %210, label %211, label %218
211: ; preds = %208
%212 = load i64, i64* @errno
%213 = load i64, i64* @EAGAIN
%214 = icmp ne i64 %212, %213
br i1 %214, label %215, label %218
215: ; preds = %211
%216 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.15, i64 0, i64 0))
%217 = call i32 @exit(i32 -1)
unreachable
218: ; preds = %211, %208
br label %219
219: ; preds = %218
%220 = load i64, i64* @errno
%221 = load i64, i64* @EAGAIN
%222 = icmp eq i64 %220, %221
br i1 %222, label %223, label %224
223: ; preds = %219
br label %197
224: ; preds = %219
%225 = load i8, i8* %17
%226 = call i32 @putchar(i8 signext %225)
br label %197
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@main.srvfd = internal unnamed_addr global i32 -1
@.str = [10 x i8] c"127.0.0.1\00"
@.str.1 = [6 x i8] c"edget\00"
@.str.2 = [6 x i8] c"edset\00"
@.str.3 = [6 x i8] c"edcat\00"
@.str.4 = [7 x i8] c"edlist\00"
@.str.5 = [9 x i8] c"edloadso\00"
@.str.6 = [53 x i8] c"Unrecognized command '%s'. Commands must be one of\0A\00"
@.str.7 = [43 x i8] c" %sget, %sset, %scat, %slist, or %sloadso\0A\00"
@.str.8 = [3 x i8] c"ed\00"
@optind = global i32 0
@optarg = global i8* null
@.str.9 = [6 x i8] c"a:hp:\00"
@EOF = global i32 0
@.str.10 = [3 x i8] c"%d\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@SOCK_CLOEXEC = global i32 0
@.str.12 = [4 x i8] c"%s \00"
@.str.13 = [45 x i8] c"Error: command exceeds maximum length of %d\0A\00"
@errno = global i64 0
@EAGAIN = global i64 0
@str = [44 x i8] c"\0AError reading from empty daemon connection\00"
@str.16 = [30 x i8] c"Error writing to empty daemon\00"
@str.17 = [46 x i8] c"Error: unable to connect to the empty daemon.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [50 x i8]
%4 = alloca i32
%5 = alloca %struct.sockaddr_in
%6 = alloca [250 x i8]
%7 = alloca i8
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%9 = bitcast i32* %4 to i8*
%10 = bitcast %struct.sockaddr_in* %5 to i8*
%11 = getelementptr inbounds [250 x i8], [250 x i8]* %6, i64 0, i64 0
%12 = call i32 @strncpy(i8* %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 49)
%13 = load i8*, i8** %1
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %37, label %16
16: ; preds = %2
%17 = load i8*, i8** %1
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %37, label %20
20: ; preds = %16
%21 = load i8*, i8** %1
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %37, label %24
24: ; preds = %20
%25 = load i8*, i8** %1
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %37, label %28
28: ; preds = %24
%29 = load i8*, i8** %1
%30 = call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %37, label %32
32: ; preds = %28
%33 = load i8*, i8** %1
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.6, i64 0, i64 0), i8* %33)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%36 = call i32 @exit(i32 -1)
unreachable
37: ; preds = %28, %24, %20, %16, %2
store i32 0, i32* @optind
%38 = load i8*, i8** %1
store i8* %38, i8** @optarg
%39 = call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%40 = load i32, i32* @EOF
%41 = icmp eq i32 %39, %40
br i1 %41, label %67, label %42
42: ; preds = %37, %62
%43 = phi i32 [ %64, %62 ], [ %39, %37 ]
%44 = phi i32 [ %63, %62 ], [ 8870, %37 ]
%45 = shl i32 %43, 24
%46 = ashr exact i32 %45, 24
switch i32 %46, label %59 [
i32 97, label %47
i32 104, label %50
i32 112, label %53
]
47: ; preds = %42
%48 = load i8*, i8** @optarg
%49 = call i32 @strncpy(i8* %8, i8* %48, i32 50)
br label %62
50: ; preds = %42
%51 = call i32 @help(i8** %1)
%52 = call i32 @exit(i32 0)
unreachable
53: ; preds = %42
%54 = load i8*, i8** @optarg
%55 = call i32 @sscanf(i8* %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %4)
%56 = icmp eq i32 %55, 0
%57 = load i32, i32* %4
%58 = select i1 %56, i32 %44, i32 %57
br label %62
59: ; preds = %42
%60 = call i32 (...) @usage()
%61 = call i32 @exit(i32 -1)
unreachable
62: ; preds = %53, %47
%63 = phi i32 [ %44, %47 ], [ %58, %53 ]
%64 = call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%65 = load i32, i32* @EOF
%66 = icmp eq i32 %64, %65
br i1 %66, label %67, label %42
67: ; preds = %62, %37
%68 = phi i32 [ 8870, %37 ], [ %63, %62 ]
%69 = call i32 @memset(i8* %10, i32 0, i64 12)
%70 = load i32, i32* @AF_INET
%71 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 2
store i32 %70, i32* %71
%72 = call i32 @htons(i32 %68)
%73 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 1
store i32 %72, i32* %73
%74 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 0
%75 = call i64 @inet_aton(i8* %8, i32* %74)
%76 = icmp eq i64 %75, 0
br i1 %76, label %88, label %77
77: ; preds = %67
%78 = load i32, i32* @AF_INET
%79 = load i32, i32* @SOCK_STREAM
%80 = load i32, i32* @SOCK_CLOEXEC
%81 = or i32 %80, %79
%82 = call i32 @socket(i32 %78, i32 %81, i32 0)
store i32 %82, i32* @main.srvfd
%83 = icmp slt i32 %82, 0
br i1 %83, label %88, label %84
84: ; preds = %77
%85 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%86 = call i64 @connect(i32 %82, %struct.sockaddr* %85, i32 12)
%87 = icmp slt i64 %86, 0
br i1 %87, label %88, label %91
88: ; preds = %84, %77, %67
%89 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.17, i64 0, i64 0))
%90 = call i32 @exit(i32 -1)
unreachable
91: ; preds = %84
%92 = load i8*, i8** %1
%93 = call i32 @sprintf(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %92)
%94 = load i32, i32* @optind
%95 = icmp slt i32 %94, %0
%96 = icmp slt i32 %93, 249
%97 = and i1 %95, %96
br i1 %97, label %98, label %116
98: ; preds = %91
%99 = sext i32 %94 to i64
%100 = sext i32 %0 to i64
br label %101
101: ; preds = %98, %101
%102 = phi i64 [ %99, %98 ], [ %112, %101 ]
%103 = phi i32 [ %93, %98 ], [ %111, %101 ]
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [250 x i8], [250 x i8]* %6, i64 0, i64 %104
%106 = sub nsw i32 250, %103
%107 = getelementptr inbounds i8*, i8** %1, i64 %102
%108 = load i8*, i8** %107
%109 = call i64 @snprintf(i8* %105, i32 %106, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %108)
%110 = trunc i64 %109 to i32
%111 = add i32 %103, %110
%112 = add nsw i64 %102, 1
%113 = icmp slt i64 %112, %100
%114 = icmp slt i32 %111, 249
%115 = select i1 %113, i1 %114, i1 false
br i1 %115, label %101, label %116
116: ; preds = %101, %91
%117 = phi i32 [ %93, %91 ], [ %111, %101 ]
%118 = icmp sgt i32 %117, 248
br i1 %118, label %119, label %122
119: ; preds = %116
%120 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.13, i64 0, i64 0), i32 250)
%121 = call i32 @exit(i32 -1)
unreachable
122: ; preds = %116
%123 = add nsw i32 %117, -1
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds [250 x i8], [250 x i8]* %6, i64 0, i64 %124
store i8 10, i8* %125
%126 = icmp eq i32 %117, 0
br i1 %126, label %140, label %132
127: ; preds = %151
%128 = icmp eq i32 %117, %153
%129 = sext i32 %153 to i64
%130 = getelementptr inbounds [250 x i8], [250 x i8]* %6, i64 0, i64 %129
%131 = sub nsw i32 %117, %153
br i1 %128, label %140, label %132
132: ; preds = %122, %127
%133 = phi i32 [ %131, %127 ], [ %117, %122 ]
%134 = phi i8* [ %130, %127 ], [ %11, %122 ]
%135 = phi i32 [ %153, %127 ], [ 0, %122 ]
br label %136
136: ; preds = %132, %147
%137 = load i32, i32* @main.srvfd
%138 = call i32 @write(i32 %137, i8* %134, i32 %133)
%139 = icmp slt i32 %138, 0
br i1 %139, label %147, label %151
140: ; preds = %127, %122
%141 = load i32, i32* @main.srvfd
%142 = call i32 @read(i32 %141, i8* %7, i32 1)
%143 = load i8, i8* %7
%144 = icmp eq i8 %143, 92
%145 = icmp eq i32 %142, 0
%146 = or i1 %145, %144
br i1 %146, label %157, label %159
147: ; preds = %136
%148 = load i64, i64* @errno
%149 = load i64, i64* @EAGAIN
%150 = icmp eq i64 %148, %149
br i1 %150, label %136, label %154
151: ; preds = %136
%152 = icmp eq i32 %138, 0
%153 = add nsw i32 %138, %135
br i1 %152, label %154, label %127
154: ; preds = %151, %147
%155 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.16, i64 0, i64 0))
%156 = call i32 @exit(i32 -1)
unreachable
157: ; preds = %173, %140
%158 = call i32 @exit(i32 0)
unreachable
159: ; preds = %140, %173
%160 = phi i8 [ %176, %173 ], [ %143, %140 ]
%161 = phi i32 [ %175, %173 ], [ %142, %140 ]
%162 = icmp slt i32 %161, 0
%163 = load i64, i64* @errno
%164 = load i64, i64* @EAGAIN
%165 = icmp eq i64 %163, %164
br i1 %162, label %166, label %170
166: ; preds = %159
br i1 %165, label %173, label %167
167: ; preds = %166
%168 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%169 = call i32 @exit(i32 -1)
unreachable
170: ; preds = %159
br i1 %165, label %173, label %171
171: ; preds = %170
%172 = call i32 @putchar(i8 signext %160)
br label %173
173: ; preds = %166, %171, %170
%174 = load i32, i32* @main.srvfd
%175 = call i32 @read(i32 %174, i8* %7, i32 1)
%176 = load i8, i8* %7
%177 = icmp eq i8 %176, 92
%178 = icmp eq i32 %175, 0
%179 = or i1 %178, %177
br i1 %179, label %157, label %159
}