#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;
};
typedef int ssize_t;
typedef int /*<<< orphan*/ lenparam;
typedef int /*<<< orphan*/ command;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int STDERR_FILENO;
int close(int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ get(int);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_aton(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ list(int);
scalar_t__ malloc(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ put(int, char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sscanf(char *, char *, int *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char const *);
int write(int, ...);
int main(int argc, char *argv[]) {
  struct sockaddr_in info_server;
  int server, port;
  char command[5], *param;
  ssize_t lenparam;
  const char *error = "Command not found!\n";
  if (argc < 4) {
    perror("Error arguments");
    exit(EXIT_FAILURE);
  }
  sscanf(argv[3], "%d", &port);
  info_server.sin_family = AF_INET;
  info_server.sin_port = htons(port);
  inet_aton("127.0.0.1", &info_server.sin_addr);
  server = socket(PF_INET, SOCK_STREAM, 0);
  if (server == -1) {
    perror("Error socket");
    exit(EXIT_FAILURE);
  }
  param = (char *)malloc(sizeof(char) * 1024 + 1);
  if (param == NULL) {
    perror("Error malloc");
    exit(EXIT_FAILURE);
  }
  if (strlen(argv[1]) >= sizeof(command)) {
    perror("Error: the length of the command is too big. Memory leak");
    exit(EXIT_FAILURE);
  }
  if (strlen(argv[2]) >= 1024) {
    perror("Error: the length of the param is too big. Memory leak");
    exit(EXIT_FAILURE);
  }
  strcpy(command, argv[1]);
  strcpy(param, argv[2]);
  lenparam = strlen(param);
  if (connect(server, (struct sockaddr *)&info_server,
              sizeof(struct sockaddr_in)) == -1) {
    perror("Error connect");
    exit(EXIT_FAILURE);
  }
  if (strcmp(command, "Get") == 0) {
    if (write(server, command, strlen(command)) < strlen(command)) {
      perror("Error write");
      exit(EXIT_FAILURE);
    }
    if (write(server, &lenparam, sizeof(lenparam)) < sizeof(lenparam)) {
      perror("Error write");
      exit(EXIT_FAILURE);
    }
    if (write(server, param, lenparam) < lenparam) {
      perror("Error write");
      exit(EXIT_FAILURE);
    }
    get(server);
  } else if (strcmp(command, "Put") == 0) {
    if (write(server, command, strlen(command)) < strlen(command)) {
      perror("Error write");
      exit(EXIT_FAILURE);
    }
    if (write(server, &lenparam, sizeof(lenparam)) < sizeof(lenparam)) {
      perror("Error write");
      exit(EXIT_FAILURE);
    }
    if (write(server, param, lenparam) < lenparam) {
      perror("Error write");
      exit(EXIT_FAILURE);
    }
    put(server, param);
  } else if (strcmp(command, "List") == 0) {
    if (write(server, command, strlen(command) - 1) < strlen(command) - 1) {
      perror("Error write");
      exit(EXIT_FAILURE);
    }
    if (write(server, &lenparam, sizeof(lenparam)) < sizeof(lenparam)) {
      perror("Error write");
      exit(EXIT_FAILURE);
    }
    if (write(server, param, lenparam) < lenparam) {
      perror("Error write");
      exit(EXIT_FAILURE);
    }
    list(server);
  } else {
    if (write(STDERR_FILENO, error, strlen(error)) < strlen(error)) {
      perror("Error write");
      exit(EXIT_FAILURE);
    }
    exit(EXIT_FAILURE);
  }
  free(param);
  if (close(server) == -1) {
    perror("Error close server");
    exit(EXIT_FAILURE);
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xdd0(%rip),%rax
mov    %rax,-0x48(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    1258 <main+0x48>
lea    0xdcf(%rip),%rdi
call   1100 <perror@plt>
mov    0x2d6f(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xdbd(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   10e0 <sscanf@plt>
mov    0x2d71(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x28(%rbp),%edi
call   1080 <htons@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xd95(%rip),%rdi
call   10c0 <inet_aton@plt>
mov    0x2d32(%rip),%rax
mov    (%rax),%edi
mov    0x2d31(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    12d7 <main+0xc7>
lea    0xd6d(%rip),%rdi
call   1100 <perror@plt>
mov    0x2cf0(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    $0x401,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    130a <main+0xfa>
lea    0xd47(%rip),%rdi
call   1100 <perror@plt>
mov    0x2cbd(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <strlen@plt>
cltq
cmp    $0x5,%rax
jb     133d <main+0x12d>
lea    0xd21(%rip),%rdi
call   1100 <perror@plt>
mov    0x2c8a(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <strlen@plt>
cmp    $0x400,%eax
jl     136f <main+0x15f>
lea    0xd28(%rip),%rdi
call   1100 <perror@plt>
mov    0x2c58(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
lea    -0x2d(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1040 <strcpy@plt>
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1040 <strcpy@plt>
mov    -0x38(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   1120 <connect@plt>
cmp    $0xffffffff,%eax
jne    13d1 <main+0x1c1>
lea    0xcfd(%rip),%rdi
call   1100 <perror@plt>
mov    0x2bf6(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
lea    -0x2d(%rbp),%rdi
lea    0xced(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    14bf <main+0x2af>
mov    -0x24(%rbp),%eax
mov    %eax,-0x5c(%rbp)
lea    -0x2d(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x2d(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x5c(%rbp),%edi
mov    -0x58(%rbp),%rsi
mov    %eax,%edx
mov    $0x0,%al
call   1050 <write@plt>
mov    %eax,-0x4c(%rbp)
lea    -0x2d(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
cmp    %ecx,%eax
jge    1445 <main+0x235>
lea    0xc9b(%rip),%rdi
call   1100 <perror@plt>
mov    0x2b82(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x24(%rbp),%edi
lea    -0x3c(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1050 <write@plt>
cltq
cmp    $0x4,%rax
jae    147e <main+0x26e>
lea    0xc62(%rip),%rdi
call   1100 <perror@plt>
mov    0x2b49(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x24(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    -0x3c(%rbp),%edx
mov    $0x0,%al
call   1050 <write@plt>
cmp    -0x3c(%rbp),%eax
jge    14b2 <main+0x2a2>
lea    0xc2e(%rip),%rdi
call   1100 <perror@plt>
mov    0x2b15(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x24(%rbp),%edi
call   10f0 <get@plt>
jmp    1729 <main+0x519>
lea    -0x2d(%rbp),%rdi
lea    0xc0f(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    15b1 <main+0x3a1>
mov    -0x24(%rbp),%eax
mov    %eax,-0x6c(%rbp)
lea    -0x2d(%rbp),%rax
mov    %rax,-0x68(%rbp)
lea    -0x2d(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x6c(%rbp),%edi
mov    -0x68(%rbp),%rsi
mov    %eax,%edx
mov    $0x0,%al
call   1050 <write@plt>
mov    %eax,-0x60(%rbp)
lea    -0x2d(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%eax
cmp    %ecx,%eax
jge    1533 <main+0x323>
lea    0xbad(%rip),%rdi
call   1100 <perror@plt>
mov    0x2a94(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x24(%rbp),%edi
lea    -0x3c(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1050 <write@plt>
cltq
cmp    $0x4,%rax
jae    156c <main+0x35c>
lea    0xb74(%rip),%rdi
call   1100 <perror@plt>
mov    0x2a5b(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x24(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    -0x3c(%rbp),%edx
mov    $0x0,%al
call   1050 <write@plt>
cmp    -0x3c(%rbp),%eax
jge    15a0 <main+0x390>
lea    0xb40(%rip),%rdi
call   1100 <perror@plt>
mov    0x2a27(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x24(%rbp),%edi
mov    -0x38(%rbp),%rsi
call   1060 <put@plt>
jmp    1724 <main+0x514>
lea    -0x2d(%rbp),%rdi
lea    0xb21(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    16a5 <main+0x495>
mov    -0x24(%rbp),%eax
mov    %eax,-0x7c(%rbp)
lea    -0x2d(%rbp),%rax
mov    %rax,-0x78(%rbp)
lea    -0x2d(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x7c(%rbp),%edi
mov    -0x78(%rbp),%rsi
mov    %eax,%edx
sub    $0x1,%edx
mov    $0x0,%al
call   1050 <write@plt>
mov    %eax,-0x70(%rbp)
lea    -0x2d(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,%ecx
mov    -0x70(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    162b <main+0x41b>
lea    0xab5(%rip),%rdi
call   1100 <perror@plt>
mov    0x299c(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x24(%rbp),%edi
lea    -0x3c(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1050 <write@plt>
cltq
cmp    $0x4,%rax
jae    1664 <main+0x454>
lea    0xa7c(%rip),%rdi
call   1100 <perror@plt>
mov    0x2963(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x24(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    -0x3c(%rbp),%edx
mov    $0x0,%al
call   1050 <write@plt>
cmp    -0x3c(%rbp),%eax
jge    1698 <main+0x488>
lea    0xa48(%rip),%rdi
call   1100 <perror@plt>
mov    0x292f(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x24(%rbp),%edi
call   10b0 <list@plt>
jmp    171f <main+0x50f>
mov    0x291c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x48(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x8c(%rbp),%edi
mov    -0x88(%rbp),%rsi
mov    %eax,%edx
mov    $0x0,%al
call   1050 <write@plt>
mov    %eax,-0x80(%rbp)
mov    -0x48(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,%ecx
mov    -0x80(%rbp),%eax
cmp    %ecx,%eax
jge    1711 <main+0x501>
lea    0x9cf(%rip),%rdi
call   1100 <perror@plt>
mov    0x28b6(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    0x28a8(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
jmp    1724 <main+0x514>
jmp    1729 <main+0x519>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
cmp    $0xffffffff,%eax
jne    175d <main+0x54d>
lea    0x998(%rip),%rdi
call   1100 <perror@plt>
mov    0x286a(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    0x2854(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
cmp    $0x3,%edi
jg     122b <main+0x1b>
lea    0xdee(%rip),%rdi
jmp    151b <main+0x30b>
mov    %rsi,%rbx
mov    0x18(%rsi),%rdi
lea    0xdeb(%rip),%rsi
lea    0x14(%rsp),%rdx
call   10e0 <sscanf@plt>
mov    0x2d9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
mov    0x14(%rsp),%edi
call   1080 <htons@plt>
mov    %eax,0x1c(%rsp)
lea    0xdc3(%rip),%rdi
lea    0x18(%rsp),%rsi
call   10c0 <inet_aton@plt>
mov    0x2d5b(%rip),%rax
mov    (%rax),%edi
mov    0x2d5a(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
cmp    $0xffffffff,%eax
jne    1298 <main+0x88>
lea    0xd9e(%rip),%rdi
jmp    151b <main+0x30b>
mov    %eax,%ebp
mov    $0x401,%edi
call   10d0 <malloc@plt>
test   %rax,%rax
jne    12b5 <main+0xa5>
lea    0xd8e(%rip),%rdi
jmp    151b <main+0x30b>
mov    %rax,%r14
mov    0x8(%rbx),%rdi
call   1070 <strlen@plt>
cmp    $0x5,%eax
jb     12d2 <main+0xc2>
lea    0xd7e(%rip),%rdi
jmp    151b <main+0x30b>
mov    0x10(%rbx),%rdi
call   1070 <strlen@plt>
cmp    $0x400,%eax
jl     12ee <main+0xde>
lea    0xd9b(%rip),%rdi
jmp    151b <main+0x30b>
mov    0x8(%rbx),%rsi
lea    0xf(%rsp),%rdi
call   1040 <strcpy@plt>
mov    0x10(%rbx),%rsi
mov    %r14,%rdi
call   1040 <strcpy@plt>
mov    %r14,%rdi
call   1070 <strlen@plt>
mov    %eax,0x8(%rsp)
lea    0x18(%rsp),%rsi
mov    %ebp,%edi
mov    $0xc,%edx
call   1120 <connect@plt>
cmp    $0xffffffff,%eax
jne    1336 <main+0x126>
lea    0xd8a(%rip),%rdi
jmp    151b <main+0x30b>
lea    0xd8c(%rip),%rsi
lea    0xf(%rsp),%rdi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    13bb <main+0x1ab>
lea    0xf(%rsp),%r15
mov    %r15,%rdi
call   1070 <strlen@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <write@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1070 <strlen@plt>
cmp    %eax,%ebx
jl     1514 <main+0x304>
lea    0x8(%rsp),%rsi
mov    $0x4,%edx
mov    %ebp,%edi
xor    %eax,%eax
call   1050 <write@plt>
cmp    $0x3,%eax
jbe    1514 <main+0x304>
mov    0x8(%rsp),%edx
mov    %ebp,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <write@plt>
cmp    0x8(%rsp),%eax
jl     1514 <main+0x304>
mov    %ebp,%edi
call   10f0 <get@plt>
jmp    14c3 <main+0x2b3>
lea    0xd17(%rip),%rsi
lea    0xf(%rsp),%rdi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    1443 <main+0x233>
lea    0xf(%rsp),%r15
mov    %r15,%rdi
call   1070 <strlen@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <write@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1070 <strlen@plt>
cmp    %eax,%ebx
jl     1514 <main+0x304>
lea    0x8(%rsp),%rsi
mov    $0x4,%edx
mov    %ebp,%edi
xor    %eax,%eax
call   1050 <write@plt>
cmp    $0x3,%eax
jbe    1514 <main+0x304>
mov    0x8(%rsp),%edx
mov    %ebp,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <write@plt>
cmp    0x8(%rsp),%eax
jl     1514 <main+0x304>
mov    %ebp,%edi
mov    %r14,%rsi
call   1060 <put@plt>
jmp    14c3 <main+0x2b3>
lea    0xc93(%rip),%rsi
lea    0xf(%rsp),%rdi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    14e0 <main+0x2d0>
lea    0xf(%rsp),%r15
mov    %r15,%rdi
call   1070 <strlen@plt>
lea    -0x1(%rax),%edx
mov    %ebp,%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <write@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1070 <strlen@plt>
add    $0xffffffff,%eax
cmp    %eax,%ebx
jl     1514 <main+0x304>
lea    0x8(%rsp),%rsi
mov    $0x4,%edx
mov    %ebp,%edi
xor    %eax,%eax
call   1050 <write@plt>
cmp    $0x3,%eax
jbe    1514 <main+0x304>
mov    0x8(%rsp),%edx
mov    %ebp,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <write@plt>
cmp    0x8(%rsp),%eax
jl     1514 <main+0x304>
mov    %ebp,%edi
call   10b0 <list@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %ebp,%edi
call   1090 <close@plt>
cmp    $0xffffffff,%eax
jne    152e <main+0x31e>
lea    0xc04(%rip),%rdi
jmp    151b <main+0x30b>
mov    0x2ae1(%rip),%rax
mov    (%rax),%ebx
lea    0xb10(%rip),%rbp
mov    %rbp,%rdi
call   1070 <strlen@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <write@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1070 <strlen@plt>
cmp    %eax,%ebx
jge    1520 <main+0x310>
lea    0xbb2(%rip),%rdi
call   1100 <perror@plt>
mov    0x2a99(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    0x2a83(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [20 x i8] c"Command not found!\0A\00"
@.str.1 = [16 x i8] c"Error arguments\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [3 x i8] c"%d\00"
@AF_INET = global i32 0
@.str.3 = [10 x i8] c"127.0.0.1\00"
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.4 = [13 x i8] c"Error socket\00"
@.str.5 = [13 x i8] c"Error malloc\00"
@.str.6 = [57 x i8] c"Error: the length of the command is too big. Memory leak\00"
@.str.7 = [55 x i8] c"Error: the length of the param is too big. Memory leak\00"
@.str.8 = [14 x i8] c"Error connect\00"
@.str.9 = [4 x i8] c"Get\00"
@.str.10 = [12 x i8] c"Error write\00"
@.str.11 = [4 x i8] c"Put\00"
@.str.12 = [5 x i8] c"List\00"
@STDERR_FILENO = global i32 0
@.str.13 = [19 x i8] c"Error close server\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.sockaddr_in
%7 = alloca i32
%8 = alloca i32
%9 = alloca [5 x i8]
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8** %12
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 4
br i1 %14, label %15, label %19
15: ; preds = %2
%16 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 3
%22 = load i8*, i8** %21
%23 = call i32 @sscanf(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%24 = load i32, i32* @AF_INET
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 2
store i32 %24, i32* %25
%26 = load i32, i32* %8
%27 = call i32 @htons(i32 %26)
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 1
store i32 %27, i32* %28
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
%30 = call i32 @inet_aton(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32* %29)
%31 = load i32, i32* @PF_INET
%32 = load i32, i32* @SOCK_STREAM
%33 = call i32 @socket(i32 %31, i32 %32, i32 0)
store i32 %33, i32* %7
%34 = load i32, i32* %7
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %40
36: ; preds = %19
%37 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%38 = load i32, i32* @EXIT_FAILURE
%39 = call i32 @exit(i32 %38)
unreachable
40: ; preds = %19
%41 = call i64 @malloc(i32 1025)
%42 = inttoptr i64 %41 to i8*
store i8* %42, i8** %10
%43 = load i8*, i8** %10
%44 = icmp eq i8* %43, null
br i1 %44, label %45, label %49
45: ; preds = %40
%46 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%47 = load i32, i32* @EXIT_FAILURE
%48 = call i32 @exit(i32 %47)
unreachable
49: ; preds = %40
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 1
%52 = load i8*, i8** %51
%53 = call i32 @strlen(i8* %52)
%54 = sext i32 %53 to i64
%55 = icmp uge i64 %54, 5
br i1 %55, label %56, label %60
56: ; preds = %49
%57 = call i32 @perror(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0))
%58 = load i32, i32* @EXIT_FAILURE
%59 = call i32 @exit(i32 %58)
unreachable
60: ; preds = %49
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 2
%63 = load i8*, i8** %62
%64 = call i32 @strlen(i8* %63)
%65 = icmp sge i32 %64, 1024
br i1 %65, label %66, label %70
66: ; preds = %60
%67 = call i32 @perror(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.7, i64 0, i64 0))
%68 = load i32, i32* @EXIT_FAILURE
%69 = call i32 @exit(i32 %68)
unreachable
70: ; preds = %60
%71 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 1
%74 = load i8*, i8** %73
%75 = call i32 @strcpy(i8* %71, i8* %74)
%76 = load i8*, i8** %10
%77 = load i8**, i8*** %5
%78 = getelementptr inbounds i8*, i8** %77, i64 2
%79 = load i8*, i8** %78
%80 = call i32 @strcpy(i8* %76, i8* %79)
%81 = load i8*, i8** %10
%82 = call i32 @strlen(i8* %81)
store i32 %82, i32* %11
%83 = load i32, i32* %7
%84 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%85 = call i32 @connect(i32 %83, %struct.sockaddr* %84, i32 12)
%86 = icmp eq i32 %85, -1
br i1 %86, label %87, label %91
87: ; preds = %70
%88 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%89 = load i32, i32* @EXIT_FAILURE
%90 = call i32 @exit(i32 %89)
unreachable
91: ; preds = %70
%92 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%93 = call i64 @strcmp(i8* %92, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%94 = icmp eq i64 %93, 0
br i1 %94, label %95, label %131
95: ; preds = %91
%96 = load i32, i32* %7
%97 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%98 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%99 = call i32 @strlen(i8* %98)
%100 = call i32 (i32, ...) @write(i32 %96, i8* %97, i32 %99)
%101 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%102 = call i32 @strlen(i8* %101)
%103 = icmp slt i32 %100, %102
br i1 %103, label %104, label %108
104: ; preds = %95
%105 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%106 = load i32, i32* @EXIT_FAILURE
%107 = call i32 @exit(i32 %106)
unreachable
108: ; preds = %95
%109 = load i32, i32* %7
%110 = call i32 (i32, ...) @write(i32 %109, i32* %11, i64 4)
%111 = sext i32 %110 to i64
%112 = icmp ult i64 %111, 4
br i1 %112, label %113, label %117
113: ; preds = %108
%114 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%115 = load i32, i32* @EXIT_FAILURE
%116 = call i32 @exit(i32 %115)
unreachable
117: ; preds = %108
%118 = load i32, i32* %7
%119 = load i8*, i8** %10
%120 = load i32, i32* %11
%121 = call i32 (i32, ...) @write(i32 %118, i8* %119, i32 %120)
%122 = load i32, i32* %11
%123 = icmp slt i32 %121, %122
br i1 %123, label %124, label %128
124: ; preds = %117
%125 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%126 = load i32, i32* @EXIT_FAILURE
%127 = call i32 @exit(i32 %126)
unreachable
128: ; preds = %117
%129 = load i32, i32* %7
%130 = call i32 @get(i32 %129)
br label %232
131: ; preds = %91
%132 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%133 = call i64 @strcmp(i8* %132, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%134 = icmp eq i64 %133, 0
br i1 %134, label %135, label %172
135: ; preds = %131
%136 = load i32, i32* %7
%137 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%138 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%139 = call i32 @strlen(i8* %138)
%140 = call i32 (i32, ...) @write(i32 %136, i8* %137, i32 %139)
%141 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%142 = call i32 @strlen(i8* %141)
%143 = icmp slt i32 %140, %142
br i1 %143, label %144, label %148
144: ; preds = %135
%145 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%146 = load i32, i32* @EXIT_FAILURE
%147 = call i32 @exit(i32 %146)
unreachable
148: ; preds = %135
%149 = load i32, i32* %7
%150 = call i32 (i32, ...) @write(i32 %149, i32* %11, i64 4)
%151 = sext i32 %150 to i64
%152 = icmp ult i64 %151, 4
br i1 %152, label %153, label %157
153: ; preds = %148
%154 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%155 = load i32, i32* @EXIT_FAILURE
%156 = call i32 @exit(i32 %155)
unreachable
157: ; preds = %148
%158 = load i32, i32* %7
%159 = load i8*, i8** %10
%160 = load i32, i32* %11
%161 = call i32 (i32, ...) @write(i32 %158, i8* %159, i32 %160)
%162 = load i32, i32* %11
%163 = icmp slt i32 %161, %162
br i1 %163, label %164, label %168
164: ; preds = %157
%165 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%166 = load i32, i32* @EXIT_FAILURE
%167 = call i32 @exit(i32 %166)
unreachable
168: ; preds = %157
%169 = load i32, i32* %7
%170 = load i8*, i8** %10
%171 = call i32 @put(i32 %169, i8* %170)
br label %231
172: ; preds = %131
%173 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%174 = call i64 @strcmp(i8* %173, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%175 = icmp eq i64 %174, 0
br i1 %175, label %176, label %214
176: ; preds = %172
%177 = load i32, i32* %7
%178 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%179 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%180 = call i32 @strlen(i8* %179)
%181 = sub nsw i32 %180, 1
%182 = call i32 (i32, ...) @write(i32 %177, i8* %178, i32 %181)
%183 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%184 = call i32 @strlen(i8* %183)
%185 = sub nsw i32 %184, 1
%186 = icmp slt i32 %182, %185
br i1 %186, label %187, label %191
187: ; preds = %176
%188 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%189 = load i32, i32* @EXIT_FAILURE
%190 = call i32 @exit(i32 %189)
unreachable
191: ; preds = %176
%192 = load i32, i32* %7
%193 = call i32 (i32, ...) @write(i32 %192, i32* %11, i64 4)
%194 = sext i32 %193 to i64
%195 = icmp ult i64 %194, 4
br i1 %195, label %196, label %200
196: ; preds = %191
%197 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%198 = load i32, i32* @EXIT_FAILURE
%199 = call i32 @exit(i32 %198)
unreachable
200: ; preds = %191
%201 = load i32, i32* %7
%202 = load i8*, i8** %10
%203 = load i32, i32* %11
%204 = call i32 (i32, ...) @write(i32 %201, i8* %202, i32 %203)
%205 = load i32, i32* %11
%206 = icmp slt i32 %204, %205
br i1 %206, label %207, label %211
207: ; preds = %200
%208 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%209 = load i32, i32* @EXIT_FAILURE
%210 = call i32 @exit(i32 %209)
unreachable
211: ; preds = %200
%212 = load i32, i32* %7
%213 = call i32 @list(i32 %212)
br label %230
214: ; preds = %172
%215 = load i32, i32* @STDERR_FILENO
%216 = load i8*, i8** %12
%217 = load i8*, i8** %12
%218 = call i32 @strlen(i8* %217)
%219 = call i32 (i32, ...) @write(i32 %215, i8* %216, i32 %218)
%220 = load i8*, i8** %12
%221 = call i32 @strlen(i8* %220)
%222 = icmp slt i32 %219, %221
br i1 %222, label %223, label %227
223: ; preds = %214
%224 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%225 = load i32, i32* @EXIT_FAILURE
%226 = call i32 @exit(i32 %225)
unreachable
227: ; preds = %214
%228 = load i32, i32* @EXIT_FAILURE
%229 = call i32 @exit(i32 %228)
unreachable
230: ; preds = %211
br label %231
231: ; preds = %230, %168
br label %232
232: ; preds = %231, %128
%233 = load i8*, i8** %10
%234 = call i32 @free(i8* %233)
%235 = load i32, i32* %7
%236 = call i32 @close(i32 %235)
%237 = icmp eq i32 %236, -1
br i1 %237, label %238, label %242
238: ; preds = %232
%239 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0))
%240 = load i32, i32* @EXIT_FAILURE
%241 = call i32 @exit(i32 %240)
unreachable
242: ; preds = %232
%243 = load i32, i32* @EXIT_SUCCESS
%244 = call i32 @exit(i32 %243)
unreachable
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [20 x i8] c"Command not found!\0A\00"
@.str.1 = [16 x i8] c"Error arguments\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [3 x i8] c"%d\00"
@AF_INET = global i32 0
@.str.3 = [10 x i8] c"127.0.0.1\00"
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.4 = [13 x i8] c"Error socket\00"
@.str.5 = [13 x i8] c"Error malloc\00"
@.str.6 = [57 x i8] c"Error: the length of the command is too big. Memory leak\00"
@.str.7 = [55 x i8] c"Error: the length of the param is too big. Memory leak\00"
@.str.8 = [14 x i8] c"Error connect\00"
@.str.9 = [4 x i8] c"Get\00"
@.str.10 = [12 x i8] c"Error write\00"
@.str.11 = [4 x i8] c"Put\00"
@.str.12 = [5 x i8] c"List\00"
@STDERR_FILENO = global i32 0
@.str.13 = [19 x i8] c"Error close server\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
%5 = alloca [5 x i8]
%6 = alloca i32
%7 = bitcast %struct.sockaddr_in* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%10 = bitcast i32* %6 to i8*
%11 = icmp slt i32 %0, 4
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = tail call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* @EXIT_FAILURE
%15 = tail call i32 @exit(i32 %14)
unreachable
16: ; preds = %2
%17 = getelementptr inbounds i8*, i8** %1, i64 3
%18 = load i8*, i8** %17
%19 = call i32 @sscanf(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%20 = load i32, i32* @AF_INET
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %20, i32* %21
%22 = load i32, i32* %4
%23 = call i32 @htons(i32 %22)
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %23, i32* %24
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
%26 = call i32 @inet_aton(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32* %25)
%27 = load i32, i32* @PF_INET
%28 = load i32, i32* @SOCK_STREAM
%29 = call i32 @socket(i32 %27, i32 %28, i32 0)
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %35
31: ; preds = %16
%32 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%33 = load i32, i32* @EXIT_FAILURE
%34 = call i32 @exit(i32 %33)
unreachable
35: ; preds = %16
%36 = call i64 @malloc(i32 1025)
%37 = inttoptr i64 %36 to i8*
%38 = icmp eq i64 %36, 0
br i1 %38, label %39, label %43
39: ; preds = %35
%40 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%41 = load i32, i32* @EXIT_FAILURE
%42 = call i32 @exit(i32 %41)
unreachable
43: ; preds = %35
%44 = getelementptr inbounds i8*, i8** %1, i64 1
%45 = load i8*, i8** %44
%46 = call i32 @strlen(i8* %45)
%47 = icmp ugt i32 %46, 4
br i1 %47, label %48, label %52
48: ; preds = %43
%49 = call i32 @perror(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0))
%50 = load i32, i32* @EXIT_FAILURE
%51 = call i32 @exit(i32 %50)
unreachable
52: ; preds = %43
%53 = getelementptr inbounds i8*, i8** %1, i64 2
%54 = load i8*, i8** %53
%55 = call i32 @strlen(i8* %54)
%56 = icmp sgt i32 %55, 1023
br i1 %56, label %57, label %61
57: ; preds = %52
%58 = call i32 @perror(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.7, i64 0, i64 0))
%59 = load i32, i32* @EXIT_FAILURE
%60 = call i32 @exit(i32 %59)
unreachable
61: ; preds = %52
%62 = load i8*, i8** %44
%63 = call i32 @strcpy(i8* %9, i8* %62)
%64 = load i8*, i8** %53
%65 = call i32 @strcpy(i8* %37, i8* %64)
%66 = call i32 @strlen(i8* %37)
store i32 %66, i32* %6
%67 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%68 = call i32 @connect(i32 %29, %struct.sockaddr* %67, i32 12)
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %74
70: ; preds = %61
%71 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%72 = load i32, i32* @EXIT_FAILURE
%73 = call i32 @exit(i32 %72)
unreachable
74: ; preds = %61
%75 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %104
77: ; preds = %74
%78 = call i32 @strlen(i8* %9)
%79 = call i32 (i32, ...) @write(i32 %29, i8* %9, i32 %78)
%80 = call i32 @strlen(i8* %9)
%81 = icmp slt i32 %79, %80
br i1 %81, label %82, label %86
82: ; preds = %77
%83 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%84 = load i32, i32* @EXIT_FAILURE
%85 = call i32 @exit(i32 %84)
unreachable
86: ; preds = %77
%87 = call i32 (i32, ...) @write(i32 %29, i32* %6, i64 4)
%88 = icmp ult i32 %87, 4
br i1 %88, label %89, label %93
89: ; preds = %86
%90 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%91 = load i32, i32* @EXIT_FAILURE
%92 = call i32 @exit(i32 %91)
unreachable
93: ; preds = %86
%94 = load i32, i32* %6
%95 = call i32 (i32, ...) @write(i32 %29, i8* %37, i32 %94)
%96 = load i32, i32* %6
%97 = icmp slt i32 %95, %96
br i1 %97, label %98, label %102
98: ; preds = %93
%99 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%100 = load i32, i32* @EXIT_FAILURE
%101 = call i32 @exit(i32 %100)
unreachable
102: ; preds = %93
%103 = call i32 @get(i32 %29)
br label %179
104: ; preds = %74
%105 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%106 = icmp eq i64 %105, 0
br i1 %106, label %107, label %134
107: ; preds = %104
%108 = call i32 @strlen(i8* %9)
%109 = call i32 (i32, ...) @write(i32 %29, i8* %9, i32 %108)
%110 = call i32 @strlen(i8* %9)
%111 = icmp slt i32 %109, %110
br i1 %111, label %112, label %116
112: ; preds = %107
%113 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%114 = load i32, i32* @EXIT_FAILURE
%115 = call i32 @exit(i32 %114)
unreachable
116: ; preds = %107
%117 = call i32 (i32, ...) @write(i32 %29, i32* %6, i64 4)
%118 = icmp ult i32 %117, 4
br i1 %118, label %119, label %123
119: ; preds = %116
%120 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%121 = load i32, i32* @EXIT_FAILURE
%122 = call i32 @exit(i32 %121)
unreachable
123: ; preds = %116
%124 = load i32, i32* %6
%125 = call i32 (i32, ...) @write(i32 %29, i8* %37, i32 %124)
%126 = load i32, i32* %6
%127 = icmp slt i32 %125, %126
br i1 %127, label %128, label %132
128: ; preds = %123
%129 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%130 = load i32, i32* @EXIT_FAILURE
%131 = call i32 @exit(i32 %130)
unreachable
132: ; preds = %123
%133 = call i32 @put(i32 %29, i8* %37)
br label %179
134: ; preds = %104
%135 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%136 = icmp eq i64 %135, 0
br i1 %136, label %137, label %166
137: ; preds = %134
%138 = call i32 @strlen(i8* %9)
%139 = add nsw i32 %138, -1
%140 = call i32 (i32, ...) @write(i32 %29, i8* %9, i32 %139)
%141 = call i32 @strlen(i8* %9)
%142 = add nsw i32 %141, -1
%143 = icmp slt i32 %140, %142
br i1 %143, label %144, label %148
144: ; preds = %137
%145 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%146 = load i32, i32* @EXIT_FAILURE
%147 = call i32 @exit(i32 %146)
unreachable
148: ; preds = %137
%149 = call i32 (i32, ...) @write(i32 %29, i32* %6, i64 4)
%150 = icmp ult i32 %149, 4
br i1 %150, label %151, label %155
151: ; preds = %148
%152 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%153 = load i32, i32* @EXIT_FAILURE
%154 = call i32 @exit(i32 %153)
unreachable
155: ; preds = %148
%156 = load i32, i32* %6
%157 = call i32 (i32, ...) @write(i32 %29, i8* %37, i32 %156)
%158 = load i32, i32* %6
%159 = icmp slt i32 %157, %158
br i1 %159, label %160, label %164
160: ; preds = %155
%161 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%162 = load i32, i32* @EXIT_FAILURE
%163 = call i32 @exit(i32 %162)
unreachable
164: ; preds = %155
%165 = call i32 @list(i32 %29)
br label %179
166: ; preds = %134
%167 = load i32, i32* @STDERR_FILENO
%168 = call i32 @strlen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%169 = call i32 (i32, ...) @write(i32 %167, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %168)
%170 = call i32 @strlen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%171 = icmp slt i32 %169, %170
br i1 %171, label %172, label %176
172: ; preds = %166
%173 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%174 = load i32, i32* @EXIT_FAILURE
%175 = call i32 @exit(i32 %174)
unreachable
176: ; preds = %166
%177 = load i32, i32* @EXIT_FAILURE
%178 = call i32 @exit(i32 %177)
unreachable
179: ; preds = %132, %164, %102
%180 = call i32 @free(i8* %37)
%181 = call i32 @close(i32 %29)
%182 = icmp eq i32 %181, -1
br i1 %182, label %183, label %187
183: ; preds = %179
%184 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0))
%185 = load i32, i32* @EXIT_FAILURE
%186 = call i32 @exit(i32 %185)
unreachable
187: ; preds = %179
%188 = load i32, i32* @EXIT_SUCCESS
%189 = call i32 @exit(i32 %188)
unreachable
}