#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ to_receive;
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  int /*<<< orphan*/ h_length;
  int /*<<< orphan*/ *h_addr_list;
};
typedef int /*<<< orphan*/ sin;

/* Variables and functions */
int EXIT_FAILURE;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int atoi(char *);
int /*<<< orphan*/ bzero(char *, int);
scalar_t__ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
struct hostent *gethostbyname(char *);
int getopt(int, char **, char *);
int /*<<< orphan*/ htons(int);
char *malloc(int);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/,
                          int /*<<< orphan*/);
char *optarg;
int optind;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ print_usage();
int /*<<< orphan*/ printf(char *, char *);
int read(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
scalar_t__ write(int, char *, scalar_t__);
int main(int argc, char *argv[]) {
  int option = 0;
  int cislo_portu = 0;
  char *hostname;
  char *loginz[100];
  int number_of_loginz = 0;
  char *uidz[100];
  int number_of_uidz = 0;
  int lflag = 0, uflag = 0, pflag = 0, hflag = 0;
  char flagz[6] = "______";
  int s, n;
  struct sockaddr_in sin;
  struct hostent *hptr;
  int poradie = 0;
  while ((option = getopt(argc, argv, "h:p:l:u:LUGNHS")) != -1) {
    switch (option) {
    case 'p':
      cislo_portu = atoi(optarg);
      pflag = 1;
      break;
    case 'h':
      hostname = optarg;
      hflag = 1;
      break;
    case 'l':
      optind -= 1;
      number_of_loginz = 0;
      for (; optind < argc && *argv[optind] != '-'; optind++) {
        loginz[number_of_loginz] = argv[optind];
        number_of_loginz++;
      }
      lflag = 1;
      uflag = 0;
      break;
    case 'u':
      optind -= 1;
      number_of_uidz = 0;
      for (; optind < argc && *argv[optind] != '-'; optind++) {
        uidz[number_of_uidz] = argv[optind];
        number_of_uidz++;
      }
      uflag = 1;
      lflag = 0;
      break;
    case 'L':
      flagz[poradie] = 'L';
      poradie++;
      break;
    case 'U':
      flagz[poradie] = 'U';
      poradie++;
      break;
    case 'G':
      flagz[poradie] = 'G';
      poradie++;
      break;
    case 'N':
      flagz[poradie] = 'N';
      poradie++;
      break;
    case 'H':
      flagz[poradie] = 'H';
      poradie++;
      break;
    case 'S':
      flagz[poradie] = 'S';
      poradie++;
      break;
    default:
      print_usage();
      exit(EXIT_FAILURE);
    }
  }
  if ((pflag == 0 || hflag == 0) || (lflag == 0 && uflag == 0)) {
    fprintf(stderr, "Missing some of the required parameters!\n");
    exit(1);
  }
  char *to_send = malloc(1000 * sizeof(char));
  for (int i = 0; i < 6; i++) {
    to_send[i] = flagz[i];
  }
  if (lflag) {
    to_send[6] = (int)'l';
    for (int i = 0; i < number_of_loginz; i++) {
      strcat(to_send, loginz[i]);
      strcat(to_send, "*");
    }
    strcat(to_send, "^");
  }
  if (uflag) {
    to_send[6] = (int)'u';
    for (int i = 0; i < number_of_uidz; i++) {
      strcat(to_send, uidz[i]);
      strcat(to_send, "*");
    }
    strcat(to_send, "^");
  }
  if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
    perror("Error on socket: ");
    return -1;
  }
  sin.sin_family = PF_INET;
  sin.sin_port = htons(cislo_portu);
  if ((hptr = gethostbyname(hostname)) == NULL) {
    fprintf(stderr, "Gethostname error!\n");
    return -1;
  }
  memcpy(&sin.sin_addr, hptr->h_addr_list[0], hptr->h_length);
  if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
    perror("Error on connect: ");
    return -1;
  }
  if (write(s, to_send, strlen(to_send) + 1) < 0) {
    perror("Error on write: ");
    return -1;
  }
  free(to_send);
  char to_receive[10000];
  bzero(to_receive, 10000);
  char test[10];
  bzero(test, 10);
  while (1) {
    int numread;
    if ((numread = read(s, to_receive, sizeof(to_receive) - 1)) == -1) {
      perror("Error on read: ");
      exit(1);
    }
    if (numread == 0)
      break;
    to_receive[numread] = '\0';
    strncpy(test, to_receive, 5);
    if (strlen(to_receive) != 0) {
      if (strcmp(test, "Chyba") == 0) {
        fprintf(stderr, "%s", to_receive);
      } else {
        printf("%s", to_receive);
      }
    }
  }
  if (close(s) < 0) {
    perror("Error on close: ");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2e10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x344(%rbp)
movl   $0x0,-0x674(%rbp)
movl   $0x0,-0x678(%rbp)
movl   $0x0,-0x67c(%rbp)
movl   $0x0,-0x680(%rbp)
movl   $0x0,-0x684(%rbp)
mov    0xdf3(%rip),%eax
mov    %eax,-0x68a(%rbp)
mov    0xdea(%rip),%ax
mov    %ax,-0x686(%rbp)
movl   $0x0,-0x6ac(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdcd(%rip),%rdx
call   1120 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     15ff <main+0x39f>
mov    -0x14(%rbp),%eax
add    $0xffffffb9,%eax
mov    %eax,%ecx
mov    %rcx,-0x2df8(%rbp)
sub    $0x2e,%eax
ja     15e5 <main+0x385>
mov    -0x2df8(%rbp),%rax
lea    0xcd4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2cbc(%rip),%rax
mov    (%rax),%rdi
call   1130 <atoi@plt>
mov    %eax,-0x18(%rbp)
movl   $0x1,-0x680(%rbp)
jmp    15fa <main+0x39a>
mov    0x2c9b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
movl   $0x1,-0x684(%rbp)
jmp    15fa <main+0x39a>
mov    0x2c66(%rip),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    0x2c5a(%rip),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x344(%rbp)
mov    0x2c47(%rip),%rax
mov    (%rax),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x2df9(%rbp)
jge    13cd <main+0x16d>
mov    -0x10(%rbp),%rax
mov    0x2c29(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
setne  %al
mov    %al,-0x2df9(%rbp)
mov    -0x2df9(%rbp),%al
test   $0x1,%al
jne    13e0 <main+0x180>
jmp    142a <main+0x1ca>
mov    -0x10(%rbp),%rax
mov    0x2bf5(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rcx
movslq -0x344(%rbp),%rax
mov    %rcx,-0x340(%rbp,%rax,8)
mov    -0x344(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x344(%rbp)
mov    0x2bc9(%rip),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    0x2bbd(%rip),%rax
mov    %ecx,(%rax)
jmp    1392 <main+0x132>
movl   $0x1,-0x678(%rbp)
movl   $0x0,-0x67c(%rbp)
jmp    15fa <main+0x39a>
mov    0x2b96(%rip),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    0x2b8a(%rip),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x674(%rbp)
mov    0x2b77(%rip),%rax
mov    (%rax),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x2dfa(%rbp)
jge    149d <main+0x23d>
mov    -0x10(%rbp),%rax
mov    0x2b59(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
setne  %al
mov    %al,-0x2dfa(%rbp)
mov    -0x2dfa(%rbp),%al
test   $0x1,%al
jne    14b0 <main+0x250>
jmp    14fa <main+0x29a>
mov    -0x10(%rbp),%rax
mov    0x2b25(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rcx
movslq -0x674(%rbp),%rax
mov    %rcx,-0x670(%rbp,%rax,8)
ff
mov    -0x674(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x674(%rbp)
mov    0x2af9(%rip),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    0x2aed(%rip),%rax
mov    %ecx,(%rax)
jmp    1462 <main+0x202>
movl   $0x1,-0x67c(%rbp)
movl   $0x0,-0x678(%rbp)
jmp    15fa <main+0x39a>
movslq -0x6ac(%rbp),%rax
movb   $0x4c,-0x68a(%rbp,%rax,1)
4c
mov    -0x6ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6ac(%rbp)
jmp    15fa <main+0x39a>
movslq -0x6ac(%rbp),%rax
movb   $0x55,-0x68a(%rbp,%rax,1)
55
mov    -0x6ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6ac(%rbp)
jmp    15fa <main+0x39a>
movslq -0x6ac(%rbp),%rax
movb   $0x47,-0x68a(%rbp,%rax,1)
47
mov    -0x6ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6ac(%rbp)
jmp    15fa <main+0x39a>
movslq -0x6ac(%rbp),%rax
movb   $0x4e,-0x68a(%rbp,%rax,1)
4e
mov    -0x6ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6ac(%rbp)
jmp    15fa <main+0x39a>
movslq -0x6ac(%rbp),%rax
movb   $0x48,-0x68a(%rbp,%rax,1)
48
mov    -0x6ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6ac(%rbp)
jmp    15fa <main+0x39a>
movslq -0x6ac(%rbp),%rax
movb   $0x53,-0x68a(%rbp,%rax,1)
53
mov    -0x6ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6ac(%rbp)
jmp    15fa <main+0x39a>
mov    $0x0,%al
call   1170 <print_usage@plt>
mov    0x29c5(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>
jmp    12e7 <main+0x87>
cmpl   $0x0,-0x680(%rbp)
je     1633 <main+0x3d3>
cmpl   $0x0,-0x684(%rbp)
je     1633 <main+0x3d3>
cmpl   $0x0,-0x678(%rbp)
jne    1654 <main+0x3f4>
cmpl   $0x0,-0x67c(%rbp)
jne    1654 <main+0x3f4>
mov    0x2996(%rip),%rax
mov    (%rax),%edi
lea    0xa8e(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    $0x3e8,%edi
call   10f0 <malloc@plt>
mov    %rax,-0x6b8(%rbp)
movl   $0x0,-0x6bc(%rbp)
cmpl   $0x6,-0x6bc(%rbp)
jge    16af <main+0x44f>
movslq -0x6bc(%rbp),%rax
mov    -0x68a(%rbp,%rax,1),%dl
mov    -0x6b8(%rbp),%rax
movslq -0x6bc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x6bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6bc(%rbp)
jmp    166f <main+0x40f>
cmpl   $0x0,-0x678(%rbp)
je     1738 <main+0x4d8>
mov    -0x6b8(%rbp),%rax
movb   $0x6c,0x6(%rax)
movl   $0x0,-0x6c0(%rbp)
mov    -0x6c0(%rbp),%eax
cmp    -0x344(%rbp),%eax
jge    1725 <main+0x4c5>
mov    -0x6b8(%rbp),%rdi
movslq -0x6c0(%rbp),%rax
mov    -0x340(%rbp,%rax,8),%rsi
ff
call   1140 <strcat@plt>
mov    -0x6b8(%rbp),%rdi
lea    0x9ef(%rip),%rsi
call   1140 <strcat@plt>
mov    -0x6c0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c0(%rbp)
jmp    16d1 <main+0x471>
mov    -0x6b8(%rbp),%rdi
lea    0x9ca(%rip),%rsi
call   1140 <strcat@plt>
cmpl   $0x0,-0x67c(%rbp)
je     17c1 <main+0x561>
mov    -0x6b8(%rbp),%rax
movb   $0x75,0x6(%rax)
movl   $0x0,-0x6c4(%rbp)
mov    -0x6c4(%rbp),%eax
cmp    -0x674(%rbp),%eax
jge    17ae <main+0x54e>
mov    -0x6b8(%rbp),%rdi
movslq -0x6c4(%rbp),%rax
mov    -0x670(%rbp,%rax,8),%rsi
ff
call   1140 <strcat@plt>
mov    -0x6b8(%rbp),%rdi
lea    0x966(%rip),%rsi
call   1140 <strcat@plt>
mov    -0x6c4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c4(%rbp)
jmp    175a <main+0x4fa>
mov    -0x6b8(%rbp),%rdi
lea    0x941(%rip),%rsi
call   1140 <strcat@plt>
mov    0x27f8(%rip),%rax
mov    (%rax),%edi
mov    0x27f7(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1180 <socket@plt>
mov    %eax,-0x690(%rbp)
cmp    $0x0,%eax
jge    1801 <main+0x5a1>
lea    0x90f(%rip),%rdi
call   1100 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1a61 <main+0x801>
mov    0x27b8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x698(%rbp)
mov    -0x18(%rbp),%edi
call   1070 <htons@plt>
mov    %eax,-0x69c(%rbp)
mov    -0x20(%rbp),%rdi
call   10c0 <gethostbyname@plt>
mov    %rax,-0x6a8(%rbp)
cmp    $0x0,%rax
jne    185b <main+0x5fb>
mov    0x2791(%rip),%rax
mov    (%rax),%edi
lea    0x8c9(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1a61 <main+0x801>
lea    -0x6a0(%rbp),%rdi
mov    -0x6a8(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%esi
mov    -0x6a8(%rbp),%rax
mov    (%rax),%edx
call   10e0 <memcpy@plt>
mov    -0x690(%rbp),%edi
lea    -0x6a0(%rbp),%rsi
mov    $0xc,%edx
call   1160 <connect@plt>
cmp    $0x0,%rax
jge    18b6 <main+0x656>
lea    0x880(%rip),%rdi
call   1100 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1a61 <main+0x801>
mov    -0x690(%rbp),%eax
mov    %eax,-0x2e0c(%rbp)
mov    -0x6b8(%rbp),%rax
mov    %rax,-0x2e08(%rbp)
mov    -0x6b8(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x2e0c(%rbp),%edi
mov    -0x2e08(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1050 <write@plt>
cmp    $0x0,%rax
jge    1917 <main+0x6b7>
lea    0x832(%rip),%rdi
call   1100 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1a61 <main+0x801>
mov    -0x6b8(%rbp),%rdi
call   1030 <free@plt>
lea    -0x2de0(%rbp),%rdi
mov    $0x2710,%esi
call   1110 <bzero@plt>
lea    -0x2dea(%rbp),%rdi
mov    $0xa,%esi
call   1110 <bzero@plt>
mov    -0x690(%rbp),%edi
lea    -0x2de0(%rbp),%rsi
mov    $0x270f,%edx
call   10a0 <read@plt>
mov    %eax,-0x2df0(%rbp)
cmp    $0xffffffff,%eax
jne    1981 <main+0x721>
lea    0x7d7(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
cmpl   $0x0,-0x2df0(%rbp)
jne    1993 <main+0x733>
jmp    1a2d <main+0x7cd>
movslq -0x2df0(%rbp),%rax
movb   $0x0,-0x2de0(%rbp,%rax,1)
lea    -0x2dea(%rbp),%rdi
lea    -0x2de0(%rbp),%rsi
mov    $0x5,%edx
call   1040 <strncpy@plt>
lea    -0x2de0(%rbp),%rdi
call   1060 <strlen@plt>
cmp    $0x0,%rax
je     1a28 <main+0x7c8>
lea    -0x2dea(%rbp),%rdi
lea    0x77b(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    1a10 <main+0x7b0>
mov    0x25dc(%rip),%rax
mov    (%rax),%edi
lea    -0x2de0(%rbp),%rdx
lea    0x75b(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    1a23 <main+0x7c3>
lea    -0x2de0(%rbp),%rsi
lea    0x741(%rip),%rdi
call   1080 <printf@plt>
jmp    1a28 <main+0x7c8>
jmp    1945 <main+0x6e5>
mov    -0x690(%rbp),%edi
call   1090 <close@plt>
cmp    $0x0,%rax
jge    1a5a <main+0x7fa>
lea    0x719(%rip),%rdi
call   1100 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1a61 <main+0x801>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2e10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2da8,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movw   $0x5f5f,0xc(%rsp)
movl   $0x5f5f5f5f,0x8(%rsp)
5f
lea    0x1(%rbp),%eax
mov    %eax,0x18(%rsp)
xor    %eax,%eax
mov    %rax,0x28(%rsp)
lea    0xd66(%rip),%r14
mov    0x2d3f(%rip),%r12
movl   $0x0,0x10(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x20(%rsp)
movl   $0x0,0x24(%rsp)
xor    %r15d,%r15d
movl   $0x0,0x1c(%rsp)
xor    %r13d,%r13d
jmp    12f0 <main+0x90>
mov    0x2d20(%rip),%rax
mov    (%rax),%rdi
call   1130 <atoi@plt>
mov    %eax,0x1c(%rsp)
movl   $0x1,0x20(%rsp)
nopl   0x0(%rax)
mov    %ebp,%edi
mov    %rbx,%rsi
lea    0xdc0(%rip),%rdx
call   1120 <getopt@plt>
lea    -0x47(%rax),%ecx
cmp    $0x2e,%ecx
ja     14a2 <main+0x242>
movslq (%r14,%rcx,4),%rax
add    %r14,%rax
jmp    *%rax
movslq %r13d,%rax
movb   $0x47,0x8(%rsp,%rax,1)
add    $0x1,%r13d
jmp    12f0 <main+0x90>
mov    (%r12),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,(%r12)
movl   $0x1,0x14(%rsp)
mov    $0x0,%edx
mov    %rdx,0x28(%rsp)
movl   $0x0,0x10(%rsp)
cmp    %ebp,%eax
jg     12f0 <main+0x90>
movslq %ecx,%rcx
mov    0x18(%rsp),%edx
mov    %edx,%edi
sub    %eax,%edi
lea    (%rbx,%rcx,8),%rcx
xor    %edx,%edx
xchg   %ax,%ax
mov    (%rcx,%rdx,8),%rsi
cmpb   $0x2d,(%rsi)
je     1480 <main+0x220>
mov    %rsi,0x50(%rsp,%rdx,8)
lea    0x1(%rdx),%rsi
add    %eax,%edx
mov    %edx,(%r12)
mov    %rsi,%rdx
cmp    %rsi,%rdi
jne    1360 <main+0x100>
mov    %rdi,0x28(%rsp)
movl   $0x0,0x10(%rsp)
jmp    12f0 <main+0x90>
movslq %r13d,%rax
movb   $0x48,0x8(%rsp,%rax,1)
add    $0x1,%r13d
jmp    12f0 <main+0x90>
movslq %r13d,%rax
movb   $0x4c,0x8(%rsp,%rax,1)
add    $0x1,%r13d
jmp    12f0 <main+0x90>
movslq %r13d,%rax
movb   $0x4e,0x8(%rsp,%rax,1)
add    $0x1,%r13d
jmp    12f0 <main+0x90>
movslq %r13d,%r13
movb   $0x53,0x8(%rsp,%r13,1)
add    $0x1,%r13d
jmp    12f0 <main+0x90>
movslq %r13d,%rax
movb   $0x55,0x8(%rsp,%rax,1)
add    $0x1,%r13d
jmp    12f0 <main+0x90>
mov    0x2c05(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x30(%rsp)
movl   $0x1,0x24(%rsp)
jmp    12f0 <main+0x90>
mov    (%r12),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,(%r12)
movl   $0x1,0x10(%rsp)
movl   $0x0,0x14(%rsp)
mov    $0x0,%r15d
cmp    %ebp,%eax
jg     12f0 <main+0x90>
movslq %ecx,%rcx
mov    0x18(%rsp),%edx
mov    %edx,%r15d
sub    %eax,%r15d
lea    (%rbx,%rcx,8),%rdx
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rdx,%rcx,8),%rsi
cmpb   $0x2d,(%rsi)
je     1492 <main+0x232>
mov    %rsi,0x370(%rsp,%rcx,8)
lea    0x1(%rcx),%rsi
add    %eax,%ecx
mov    %ecx,(%r12)
mov    %rsi,%rcx
cmp    %rsi,%r15
jne    1450 <main+0x1f0>
movl   $0x0,0x14(%rsp)
jmp    12f0 <main+0x90>
mov    %rdx,0x28(%rsp)
movl   $0x0,0x10(%rsp)
jmp    12f0 <main+0x90>
movl   $0x0,0x14(%rsp)
mov    %ecx,%r15d
jmp    12f0 <main+0x90>
cmp    $0xffffffff,%eax
jne    1758 <main+0x4f8>
cmpl   $0x0,0x20(%rsp)
mov    0x14(%rsp),%r12d
mov    0x10(%rsp),%ebp
je     1783 <main+0x523>
cmpl   $0x0,0x24(%rsp)
je     1783 <main+0x523>
mov    %ebp,%eax
or     %r12d,%eax
je     1783 <main+0x523>
mov    $0x3e8,%edi
call   10f0 <malloc@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%eax
mov    %eax,(%rbx)
movzwl 0xc(%rsp),%eax
mov    %ax,0x4(%rbx)
test   %ebp,%ebp
je     1543 <main+0x2e3>
movb   $0x6c,0x6(%rbx)
test   %r15d,%r15d
jle    1534 <main+0x2d4>
mov    %r15d,%r15d
xor    %ebp,%ebp
lea    0xbeb(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    0x370(%rsp,%rbp,8),%rsi
mov    %rbx,%rdi
call   1140 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1140 <strcat@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1510 <main+0x2b0>
lea    0xbbc(%rip),%rsi
mov    %rbx,%rdi
call   1140 <strcat@plt>
test   %r12d,%r12d
je     15a0 <main+0x340>
movb   $0x75,0x6(%rbx)
mov    0x28(%rsp),%rax
test   %eax,%eax
jle    1591 <main+0x331>
mov    %eax,%r15d
xor    %ebp,%ebp
lea    0xb94(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x50(%rsp,%rbp,8),%rsi
mov    %rbx,%rdi
call   1140 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1140 <strcat@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1570 <main+0x310>
lea    0xb5f(%rip),%rsi
mov    %rbx,%rdi
call   1140 <strcat@plt>
mov    0x2a19(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2a17(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1180 <socket@plt>
test   %eax,%eax
js     1723 <main+0x4c3>
mov    %eax,%r12d
mov    0x0(%rbp),%eax
mov    %eax,0x40(%rsp)
mov    0x1c(%rsp),%edi
call   1070 <htons@plt>
mov    %eax,0x3c(%rsp)
mov    0x30(%rsp),%rdi
call   10c0 <gethostbyname@plt>
test   %rax,%rax
je     170a <main+0x4aa>
mov    0x8(%rax),%rcx
mov    (%rcx),%esi
mov    (%rax),%edx
lea    0x38(%rsp),%rbp
mov    %rbp,%rdi
call   10e0 <memcpy@plt>
mov    %r12d,%edi
mov    %rbp,%rsi
mov    $0xc,%edx
call   1160 <connect@plt>
test   %rax,%rax
js     172c <main+0x4cc>
mov    %rbx,%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r12d,%edi
mov    %rbx,%rsi
call   1050 <write@plt>
test   %rax,%rax
js     1735 <main+0x4d5>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0x690(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2710,%esi
call   1110 <bzero@plt>
lea    0x46(%rsp),%rbp
mov    %rbp,%rdi
mov    $0xa,%esi
call   1110 <bzero@plt>
lea    0xae3(%rip),%r14
mov    0x2959(%rip),%r13
lea    0xadb(%rip),%r15
jmp    1691 <main+0x431>
mov    0x0(%r13),%edi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    $0x270f,%edx
call   10a0 <read@plt>
test   %eax,%eax
je     16ef <main+0x48f>
cmp    $0xffffffff,%eax
je     176d <main+0x50d>
cltq
movb   $0x0,0x690(%rsp,%rax,1)
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1040 <strncpy@plt>
cmpb   $0x0,0x690(%rsp)
je     1691 <main+0x431>
mov    %rbp,%rdi
mov    %r14,%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     1680 <main+0x420>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1080 <printf@plt>
jmp    1691 <main+0x431>
mov    %r12d,%edi
call   1090 <close@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jns    1746 <main+0x4e6>
lea    0xa54(%rip),%rdi
jmp    173c <main+0x4dc>
mov    0x28bf(%rip),%rax
mov    (%rax),%edi
lea    0x9f1(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    1741 <main+0x4e1>
lea    0x9cf(%rip),%rdi
jmp    173c <main+0x4dc>
lea    0x9ec(%rip),%rdi
jmp    173c <main+0x4dc>
lea    0x9f6(%rip),%rdi
call   1100 <perror@plt>
mov    $0xffffffff,%eax
add    $0x2da8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1170 <print_usage@plt>
mov    0x2852(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>
lea    0x9cf(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    0x2846(%rip),%rax
mov    (%rax),%edi
lea    0x938(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.hostent = type { i32, i32* }
%struct.sockaddr = type { i32 }
@__const.main.flagz = [6 x i8] c"______"
@.str = [15 x i8] c"h:p:l:u:LUGNHS\00"
@optarg = global i8* null
@optind = global i32 0
@EXIT_FAILURE = global i32 0
@stderr = global i32 0
@.str.1 = [42 x i8] c"Missing some of the required parameters!\0A\00"
@.str.2 = [2 x i8] c"*\00"
@.str.3 = [2 x i8] c"^\00"
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.4 = [18 x i8] c"Error on socket: \00"
@.str.5 = [20 x i8] c"Gethostname error!\0A\00"
@.str.6 = [19 x i8] c"Error on connect: \00"
@.str.7 = [17 x i8] c"Error on write: \00"
@.str.8 = [16 x i8] c"Error on read: \00"
@.str.9 = [6 x i8] c"Chyba\00"
@.str.10 = [3 x i8] c"%s\00"
@.str.11 = [17 x i8] c"Error on close: \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca [100 x i8*]
%10 = alloca i32
%11 = alloca [100 x i8*]
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [6 x i8]
%18 = alloca i32
%19 = alloca i32
%20 = alloca %struct.sockaddr_in
%21 = alloca %struct.hostent*
%22 = alloca i32
%23 = alloca i8*
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca [10000 x i8]
%28 = alloca [10 x i8]
%29 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %10
store i32 0, i32* %12
store i32 0, i32* %13
store i32 0, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
%30 = bitcast [6 x i8]* %17 to i8*
store i32 0, i32* %22
br label %31
31: ; preds = %149, %2
%32 = load i32, i32* %4
%33 = load i8**, i8*** %5
%34 = call i32 @getopt(i32 %32, i8** %33, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i32 %34, i32* %6
%35 = icmp ne i32 %34, -1
br i1 %35, label %36, label %150
36: ; preds = %31
%37 = load i32, i32* %6
switch i32 %37, label %145 [
i32 112, label %38
i32 104, label %41
i32 108, label %43
i32 117, label %76
i32 76, label %109
i32 85, label %115
i32 71, label %121
i32 78, label %127
i32 72, label %133
i32 83, label %139
]
38: ; preds = %36
%39 = load i8*, i8** @optarg
%40 = call i32 @atoi(i8* %39)
store i32 %40, i32* %7
store i32 1, i32* %15
br label %149
41: ; preds = %36
%42 = load i8*, i8** @optarg
store i8* %42, i8** %8
store i32 1, i32* %16
br label %149
43: ; preds = %36
%44 = load i32, i32* @optind
%45 = sub nsw i32 %44, 1
store i32 %45, i32* @optind
store i32 0, i32* %10
br label %46
46: ; preds = %72, %43
%47 = load i32, i32* @optind
%48 = load i32, i32* %4
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %59
50: ; preds = %46
%51 = load i8**, i8*** %5
%52 = load i32, i32* @optind
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %51, i64 %53
%55 = load i8*, i8** %54
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp ne i32 %57, 45
br label %59
59: ; preds = %50, %46
%60 = phi i1 [ false, %46 ], [ %58, %50 ]
br i1 %60, label %61, label %75
61: ; preds = %59
%62 = load i8**, i8*** %5
%63 = load i32, i32* @optind
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8*, i8** %62, i64 %64
%66 = load i8*, i8** %65
%67 = load i32, i32* %10
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [100 x i8*], [100 x i8*]* %9, i64 0, i64 %68
store i8* %66, i8** %69
%70 = load i32, i32* %10
%71 = add nsw i32 %70, 1
store i32 %71, i32* %10
br label %72
72: ; preds = %61
%73 = load i32, i32* @optind
%74 = add nsw i32 %73, 1
store i32 %74, i32* @optind
br label %46
75: ; preds = %59
store i32 1, i32* %13
store i32 0, i32* %14
br label %149
76: ; preds = %36
%77 = load i32, i32* @optind
%78 = sub nsw i32 %77, 1
store i32 %78, i32* @optind
store i32 0, i32* %12
br label %79
79: ; preds = %105, %76
%80 = load i32, i32* @optind
%81 = load i32, i32* %4
%82 = icmp slt i32 %80, %81
br i1 %82, label %83, label %92
83: ; preds = %79
%84 = load i8**, i8*** %5
%85 = load i32, i32* @optind
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8*, i8** %84, i64 %86
%88 = load i8*, i8** %87
%89 = load i8, i8* %88
%90 = sext i8 %89 to i32
%91 = icmp ne i32 %90, 45
br label %92
92: ; preds = %83, %79
%93 = phi i1 [ false, %79 ], [ %91, %83 ]
br i1 %93, label %94, label %108
94: ; preds = %92
%95 = load i8**, i8*** %5
%96 = load i32, i32* @optind
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i8*, i8** %95, i64 %97
%99 = load i8*, i8** %98
%100 = load i32, i32* %12
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds [100 x i8*], [100 x i8*]* %11, i64 0, i64 %101
store i8* %99, i8** %102
%103 = load i32, i32* %12
%104 = add nsw i32 %103, 1
store i32 %104, i32* %12
br label %105
105: ; preds = %94
%106 = load i32, i32* @optind
%107 = add nsw i32 %106, 1
store i32 %107, i32* @optind
br label %79
108: ; preds = %92
store i32 1, i32* %14
store i32 0, i32* %13
br label %149
109: ; preds = %36
%110 = load i32, i32* %22
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [6 x i8], [6 x i8]* %17, i64 0, i64 %111
store i8 76, i8* %112
%113 = load i32, i32* %22
%114 = add nsw i32 %113, 1
store i32 %114, i32* %22
br label %149
115: ; preds = %36
%116 = load i32, i32* %22
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds [6 x i8], [6 x i8]* %17, i64 0, i64 %117
store i8 85, i8* %118
%119 = load i32, i32* %22
%120 = add nsw i32 %119, 1
store i32 %120, i32* %22
br label %149
121: ; preds = %36
%122 = load i32, i32* %22
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [6 x i8], [6 x i8]* %17, i64 0, i64 %123
store i8 71, i8* %124
%125 = load i32, i32* %22
%126 = add nsw i32 %125, 1
store i32 %126, i32* %22
br label %149
127: ; preds = %36
%128 = load i32, i32* %22
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds [6 x i8], [6 x i8]* %17, i64 0, i64 %129
store i8 78, i8* %130
%131 = load i32, i32* %22
%132 = add nsw i32 %131, 1
store i32 %132, i32* %22
br label %149
133: ; preds = %36
%134 = load i32, i32* %22
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds [6 x i8], [6 x i8]* %17, i64 0, i64 %135
store i8 72, i8* %136
%137 = load i32, i32* %22
%138 = add nsw i32 %137, 1
store i32 %138, i32* %22
br label %149
139: ; preds = %36
%140 = load i32, i32* %22
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds [6 x i8], [6 x i8]* %17, i64 0, i64 %141
store i8 83, i8* %142
%143 = load i32, i32* %22
%144 = add nsw i32 %143, 1
store i32 %144, i32* %22
br label %149
145: ; preds = %36
%146 = call i32 (...) @print_usage()
%147 = load i32, i32* @EXIT_FAILURE
%148 = call i32 @exit(i32 %147)
unreachable
149: ; preds = %139, %133, %127, %121, %115, %109, %108, %75, %41, %38
br label %31
150: ; preds = %31
%151 = load i32, i32* %15
%152 = icmp eq i32 %151, 0
br i1 %152, label %162, label %153
153: ; preds = %150
%154 = load i32, i32* %16
%155 = icmp eq i32 %154, 0
br i1 %155, label %162, label %156
156: ; preds = %153
%157 = load i32, i32* %13
%158 = icmp eq i32 %157, 0
br i1 %158, label %159, label %166
159: ; preds = %156
%160 = load i32, i32* %14
%161 = icmp eq i32 %160, 0
br i1 %161, label %162, label %166
162: ; preds = %159, %153, %150
%163 = load i32, i32* @stderr
%164 = call i32 (i32, i8*, ...) @fprintf(i32 %163, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%165 = call i32 @exit(i32 1)
unreachable
166: ; preds = %159, %156
%167 = call i8* @malloc(i32 1000)
store i8* %167, i8** %23
store i32 0, i32* %24
br label %168
168: ; preds = %180, %166
%169 = load i32, i32* %24
%170 = icmp slt i32 %169, 6
br i1 %170, label %171, label %183
171: ; preds = %168
%172 = load i32, i32* %24
%173 = sext i32 %172 to i64
%174 = getelementptr inbounds [6 x i8], [6 x i8]* %17, i64 0, i64 %173
%175 = load i8, i8* %174
%176 = load i8*, i8** %23
%177 = load i32, i32* %24
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds i8, i8* %176, i64 %178
store i8 %175, i8* %179
br label %180
180: ; preds = %171
%181 = load i32, i32* %24
%182 = add nsw i32 %181, 1
store i32 %182, i32* %24
br label %168
183: ; preds = %168
%184 = load i32, i32* %13
%185 = icmp ne i32 %184, 0
br i1 %185, label %186, label %208
186: ; preds = %183
%187 = load i8*, i8** %23
%188 = getelementptr inbounds i8, i8* %187, i64 6
store i8 108, i8* %188
store i32 0, i32* %25
br label %189
189: ; preds = %202, %186
%190 = load i32, i32* %25
%191 = load i32, i32* %10
%192 = icmp slt i32 %190, %191
br i1 %192, label %193, label %205
193: ; preds = %189
%194 = load i8*, i8** %23
%195 = load i32, i32* %25
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds [100 x i8*], [100 x i8*]* %9, i64 0, i64 %196
%198 = load i8*, i8** %197
%199 = call i32 @strcat(i8* %194, i8* %198)
%200 = load i8*, i8** %23
%201 = call i32 @strcat(i8* %200, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %202
202: ; preds = %193
%203 = load i32, i32* %25
%204 = add nsw i32 %203, 1
store i32 %204, i32* %25
br label %189
205: ; preds = %189
%206 = load i8*, i8** %23
%207 = call i32 @strcat(i8* %206, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %208
208: ; preds = %205, %183
%209 = load i32, i32* %14
%210 = icmp ne i32 %209, 0
br i1 %210, label %211, label %233
211: ; preds = %208
%212 = load i8*, i8** %23
%213 = getelementptr inbounds i8, i8* %212, i64 6
store i8 117, i8* %213
store i32 0, i32* %26
br label %214
214: ; preds = %227, %211
%215 = load i32, i32* %26
%216 = load i32, i32* %12
%217 = icmp slt i32 %215, %216
br i1 %217, label %218, label %230
218: ; preds = %214
%219 = load i8*, i8** %23
%220 = load i32, i32* %26
%221 = sext i32 %220 to i64
%222 = getelementptr inbounds [100 x i8*], [100 x i8*]* %11, i64 0, i64 %221
%223 = load i8*, i8** %222
%224 = call i32 @strcat(i8* %219, i8* %223)
%225 = load i8*, i8** %23
%226 = call i32 @strcat(i8* %225, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %227
227: ; preds = %218
%228 = load i32, i32* %26
%229 = add nsw i32 %228, 1
store i32 %229, i32* %26
br label %214
230: ; preds = %214
%231 = load i8*, i8** %23
%232 = call i32 @strcat(i8* %231, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %233
233: ; preds = %230, %208
%234 = load i32, i32* @PF_INET
%235 = load i32, i32* @SOCK_STREAM
%236 = call i32 @socket(i32 %234, i32 %235, i32 0)
store i32 %236, i32* %18
%237 = icmp slt i32 %236, 0
br i1 %237, label %238, label %240
238: ; preds = %233
%239 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %3
br label %328
240: ; preds = %233
%241 = load i32, i32* @PF_INET
%242 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %20, i32 0, i32 2
store i32 %241, i32* %242
%243 = load i32, i32* %7
%244 = call i32 @htons(i32 %243)
%245 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %20, i32 0, i32 1
store i32 %244, i32* %245
%246 = load i8*, i8** %8
%247 = call %struct.hostent* @gethostbyname(i8* %246)
store %struct.hostent* %247, %struct.hostent** %21
%248 = icmp eq %struct.hostent* %247, null
br i1 %248, label %249, label %252
249: ; preds = %240
%250 = load i32, i32* @stderr
%251 = call i32 (i32, i8*, ...) @fprintf(i32 %250, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %3
br label %328
252: ; preds = %240
%253 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %20, i32 0, i32 0
%254 = load %struct.hostent*, %struct.hostent** %21
%255 = getelementptr inbounds %struct.hostent, %struct.hostent* %254, i32 0, i32 1
%256 = load i32*, i32** %255
%257 = getelementptr inbounds i32, i32* %256, i64 0
%258 = load i32, i32* %257
%259 = load %struct.hostent*, %struct.hostent** %21
%260 = getelementptr inbounds %struct.hostent, %struct.hostent* %259, i32 0, i32 0
%261 = load i32, i32* %260
%262 = call i32 @memcpy(i32* %253, i32 %258, i32 %261)
%263 = load i32, i32* %18
%264 = bitcast %struct.sockaddr_in* %20 to %struct.sockaddr*
%265 = call i64 @connect(i32 %263, %struct.sockaddr* %264, i32 12)
%266 = icmp slt i64 %265, 0
br i1 %266, label %267, label %269
267: ; preds = %252
%268 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %3
br label %328
269: ; preds = %252
%270 = load i32, i32* %18
%271 = load i8*, i8** %23
%272 = load i8*, i8** %23
%273 = call i64 @strlen(i8* %272)
%274 = add nsw i64 %273, 1
%275 = call i64 @write(i32 %270, i8* %271, i64 %274)
%276 = icmp slt i64 %275, 0
br i1 %276, label %277, label %279
277: ; preds = %269
%278 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
store i32 -1, i32* %3
br label %328
279: ; preds = %269
%280 = load i8*, i8** %23
%281 = call i32 @free(i8* %280)
%282 = getelementptr inbounds [10000 x i8], [10000 x i8]* %27, i64 0, i64 0
%283 = call i32 @bzero(i8* %282, i32 10000)
%284 = getelementptr inbounds [10 x i8], [10 x i8]* %28, i64 0, i64 0
%285 = call i32 @bzero(i8* %284, i32 10)
br label %286
286: ; preds = %279, %320
%287 = load i32, i32* %18
%288 = getelementptr inbounds [10000 x i8], [10000 x i8]* %27, i64 0, i64 0
%289 = call i32 @read(i32 %287, i8* %288, i32 9999)
store i32 %289, i32* %29
%290 = icmp eq i32 %289, -1
br i1 %290, label %291, label %294
291: ; preds = %286
%292 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%293 = call i32 @exit(i32 1)
unreachable
294: ; preds = %286
%295 = load i32, i32* %29
%296 = icmp eq i32 %295, 0
br i1 %296, label %297, label %298
297: ; preds = %294
br label %321
298: ; preds = %294
%299 = load i32, i32* %29
%300 = sext i32 %299 to i64
%301 = getelementptr inbounds [10000 x i8], [10000 x i8]* %27, i64 0, i64 %300
store i8 0, i8* %301
%302 = getelementptr inbounds [10 x i8], [10 x i8]* %28, i64 0, i64 0
%303 = getelementptr inbounds [10000 x i8], [10000 x i8]* %27, i64 0, i64 0
%304 = call i32 @strncpy(i8* %302, i8* %303, i32 5)
%305 = getelementptr inbounds [10000 x i8], [10000 x i8]* %27, i64 0, i64 0
%306 = call i64 @strlen(i8* %305)
%307 = icmp ne i64 %306, 0
br i1 %307, label %308, label %320
308: ; preds = %298
%309 = getelementptr inbounds [10 x i8], [10 x i8]* %28, i64 0, i64 0
%310 = call i64 @strcmp(i8* %309, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%311 = icmp eq i64 %310, 0
br i1 %311, label %312, label %316
312: ; preds = %308
%313 = load i32, i32* @stderr
%314 = getelementptr inbounds [10000 x i8], [10000 x i8]* %27, i64 0, i64 0
%315 = call i32 (i32, i8*, ...) @fprintf(i32 %313, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %314)
br label %319
316: ; preds = %308
%317 = getelementptr inbounds [10000 x i8], [10000 x i8]* %27, i64 0, i64 0
%318 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %317)
br label %319
319: ; preds = %316, %312
br label %320
320: ; preds = %319, %298
br label %286
321: ; preds = %297
%322 = load i32, i32* %18
%323 = call i64 @close(i32 %322)
%324 = icmp slt i64 %323, 0
br i1 %324, label %325, label %327
325: ; preds = %321
%326 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
store i32 -1, i32* %3
br label %328
327: ; preds = %321
store i32 0, i32* %3
br label %328
328: ; preds = %327, %325, %277, %267, %249, %238
%329 = load i32, i32* %3
ret i32 %329
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.hostent = type { i32, i32* }
%struct.sockaddr = type { i32 }
@.str = [15 x i8] c"h:p:l:u:LUGNHS\00"
@optarg = global i8* null
@optind = global i32 0
@EXIT_FAILURE = global i32 0
@stderr = global i32 0
@.str.1 = [42 x i8] c"Missing some of the required parameters!\0A\00"
@.str.2 = [2 x i8] c"*\00"
@.str.3 = [2 x i8] c"^\00"
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.4 = [18 x i8] c"Error on socket: \00"
@.str.5 = [20 x i8] c"Gethostname error!\0A\00"
@.str.6 = [19 x i8] c"Error on connect: \00"
@.str.7 = [17 x i8] c"Error on write: \00"
@.str.8 = [16 x i8] c"Error on read: \00"
@.str.9 = [6 x i8] c"Chyba\00"
@.str.10 = [3 x i8] c"%s\00"
@.str.11 = [17 x i8] c"Error on close: \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [100 x i8*]
%4 = alloca [100 x i8*]
%5 = alloca [6 x i8]
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%7 = alloca %struct.sockaddr_in
%8 = alloca [10000 x i8]
%9 = alloca [10 x i8]
%10 = bitcast [100 x i8*]* %3 to i8*
%11 = bitcast [100 x i8*]* %4 to i8*
%12 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%13 = bitcast %struct.sockaddr_in* %7 to i8*
%14 = add i32 %0, 1
br label %15
15: ; preds = %105, %2
%16 = phi i32 [ 0, %2 ], [ %106, %105 ]
%17 = phi i32 [ 0, %2 ], [ %107, %105 ]
%18 = phi i32 [ 0, %2 ], [ %108, %105 ]
%19 = phi i32 [ 0, %2 ], [ %109, %105 ]
%20 = phi i32 [ 0, %2 ], [ %110, %105 ]
%21 = phi i32 [ 0, %2 ], [ %111, %105 ]
%22 = phi i8* [ undef, %2 ], [ %112, %105 ]
%23 = phi i32 [ 0, %2 ], [ %113, %105 ]
%24 = phi i32 [ 0, %2 ], [ %114, %105 ]
%25 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
switch i32 %25, label %97 [
i32 -1, label %115
i32 112, label %26
i32 104, label %29
i32 108, label %31
i32 117, label %52
i32 76, label %73
i32 85, label %77
i32 71, label %81
i32 78, label %85
i32 72, label %89
i32 83, label %93
]
26: ; preds = %15
%27 = load i8*, i8** @optarg
%28 = tail call i32 @atoi(i8* %27)
br label %105
29: ; preds = %15
%30 = load i8*, i8** @optarg
br label %105
31: ; preds = %15
%32 = load i32, i32* @optind
%33 = add i32 %32, -1
store i32 %33, i32* @optind
%34 = icmp sgt i32 %32, %0
br i1 %34, label %105, label %35
35: ; preds = %31
%36 = sext i32 %33 to i64
%37 = sub i32 %14, %32
%38 = zext i32 %37 to i64
br label %39
39: ; preds = %35, %46
%40 = phi i64 [ %36, %35 ], [ %49, %46 ]
%41 = phi i64 [ 0, %35 ], [ %48, %46 ]
%42 = getelementptr inbounds i8*, i8** %1, i64 %40
%43 = load i8*, i8** %42
%44 = load i8, i8* %43
%45 = icmp eq i8 %44, 45
br i1 %45, label %101, label %46
46: ; preds = %39
%47 = getelementptr inbounds [100 x i8*], [100 x i8*]* %3, i64 0, i64 %41
store i8* %43, i8** %47
%48 = add nuw nsw i64 %41, 1
%49 = add nsw i64 %40, 1
%50 = trunc i64 %49 to i32
store i32 %50, i32* @optind
%51 = icmp eq i64 %48, %38
br i1 %51, label %105, label %39
52: ; preds = %15
%53 = load i32, i32* @optind
%54 = add i32 %53, -1
store i32 %54, i32* @optind
%55 = icmp sgt i32 %53, %0
br i1 %55, label %105, label %56
56: ; preds = %52
%57 = sext i32 %54 to i64
%58 = sub i32 %14, %53
%59 = zext i32 %58 to i64
br label %60
60: ; preds = %56, %67
%61 = phi i64 [ %57, %56 ], [ %70, %67 ]
%62 = phi i64 [ 0, %56 ], [ %69, %67 ]
%63 = getelementptr inbounds i8*, i8** %1, i64 %61
%64 = load i8*, i8** %63
%65 = load i8, i8* %64
%66 = icmp eq i8 %65, 45
br i1 %66, label %103, label %67
67: ; preds = %60
%68 = getelementptr inbounds [100 x i8*], [100 x i8*]* %4, i64 0, i64 %62
store i8* %64, i8** %68
%69 = add nuw nsw i64 %62, 1
%70 = add nsw i64 %61, 1
%71 = trunc i64 %70 to i32
store i32 %71, i32* @optind
%72 = icmp eq i64 %69, %59
br i1 %72, label %105, label %60
73: ; preds = %15
%74 = sext i32 %24 to i64
%75 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 %74
store i8 76, i8* %75
%76 = add nsw i32 %24, 1
br label %105
77: ; preds = %15
%78 = sext i32 %24 to i64
%79 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 %78
store i8 85, i8* %79
%80 = add nsw i32 %24, 1
br label %105
81: ; preds = %15
%82 = sext i32 %24 to i64
%83 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 %82
store i8 71, i8* %83
%84 = add nsw i32 %24, 1
br label %105
85: ; preds = %15
%86 = sext i32 %24 to i64
%87 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 %86
store i8 78, i8* %87
%88 = add nsw i32 %24, 1
br label %105
89: ; preds = %15
%90 = sext i32 %24 to i64
%91 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 %90
store i8 72, i8* %91
%92 = add nsw i32 %24, 1
br label %105
93: ; preds = %15
%94 = sext i32 %24 to i64
%95 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 %94
store i8 83, i8* %95
%96 = add nsw i32 %24, 1
br label %105
97: ; preds = %15
%98 = tail call i32 (...) @print_usage()
%99 = load i32, i32* @EXIT_FAILURE
%100 = tail call i32 @exit(i32 %99)
unreachable
101: ; preds = %39
%102 = trunc i64 %41 to i32
br label %105
103: ; preds = %60
%104 = trunc i64 %62 to i32
br label %105
105: ; preds = %67, %46, %103, %101, %52, %31, %93, %89, %85, %81, %77, %73, %29, %26
%106 = phi i32 [ %16, %93 ], [ %16, %89 ], [ %16, %85 ], [ %16, %81 ], [ %16, %77 ], [ %16, %73 ], [ %16, %29 ], [ %16, %26 ], [ %16, %31 ], [ 0, %52 ], [ %16, %101 ], [ %104, %103 ], [ %16, %46 ], [ %58, %67 ]
%107 = phi i32 [ %17, %93 ], [ %17, %89 ], [ %17, %85 ], [ %17, %81 ], [ %17, %77 ], [ %17, %73 ], [ %17, %29 ], [ %17, %26 ], [ 1, %31 ], [ 0, %52 ], [ 1, %101 ], [ 0, %103 ], [ 1, %46 ], [ 0, %67 ]
%108 = phi i32 [ %18, %93 ], [ %18, %89 ], [ %18, %85 ], [ %18, %81 ], [ %18, %77 ], [ %18, %73 ], [ %18, %29 ], [ %18, %26 ], [ 0, %31 ], [ 1, %52 ], [ 0, %101 ], [ 1, %103 ], [ 0, %46 ], [ 1, %67 ]
%109 = phi i32 [ %19, %93 ], [ %19, %89 ], [ %19, %85 ], [ %19, %81 ], [ %19, %77 ], [ %19, %73 ], [ %19, %29 ], [ 1, %26 ], [ %19, %31 ], [ %19, %52 ], [ %19, %101 ], [ %19, %103 ], [ %19, %46 ], [ %19, %67 ]
%110 = phi i32 [ %20, %93 ], [ %20, %89 ], [ %20, %85 ], [ %20, %81 ], [ %20, %77 ], [ %20, %73 ], [ 1, %29 ], [ %20, %26 ], [ %20, %31 ], [ %20, %52 ], [ %20, %101 ], [ %20, %103 ], [ %20, %46 ], [ %20, %67 ]
%111 = phi i32 [ %21, %93 ], [ %21, %89 ], [ %21, %85 ], [ %21, %81 ], [ %21, %77 ], [ %21, %73 ], [ %21, %29 ], [ %21, %26 ], [ 0, %31 ], [ %21, %52 ], [ %102, %101 ], [ %21, %103 ], [ %37, %46 ], [ %21, %67 ]
%112 = phi i8* [ %22, %93 ], [ %22, %89 ], [ %22, %85 ], [ %22, %81 ], [ %22, %77 ], [ %22, %73 ], [ %30, %29 ], [ %22, %26 ], [ %22, %31 ], [ %22, %52 ], [ %22, %101 ], [ %22, %103 ], [ %22, %46 ], [ %22, %67 ]
%113 = phi i32 [ %23, %93 ], [ %23, %89 ], [ %23, %85 ], [ %23, %81 ], [ %23, %77 ], [ %23, %73 ], [ %23, %29 ], [ %28, %26 ], [ %23, %31 ], [ %23, %52 ], [ %23, %101 ], [ %23, %103 ], [ %23, %46 ], [ %23, %67 ]
%114 = phi i32 [ %96, %93 ], [ %92, %89 ], [ %88, %85 ], [ %84, %81 ], [ %80, %77 ], [ %76, %73 ], [ %24, %29 ], [ %24, %26 ], [ %24, %31 ], [ %24, %52 ], [ %24, %101 ], [ %24, %103 ], [ %24, %46 ], [ %24, %67 ]
br label %15
115: ; preds = %15
%116 = icmp eq i32 %19, 0
%117 = icmp eq i32 %20, 0
%118 = select i1 %116, i1 true, i1 %117
br i1 %118, label %123, label %119
119: ; preds = %115
%120 = icmp eq i32 %17, 0
%121 = icmp eq i32 %18, 0
%122 = select i1 %120, i1 %121, i1 false
br i1 %122, label %123, label %127
123: ; preds = %119, %115
%124 = load i32, i32* @stderr
%125 = tail call i32 (i32, i8*, ...) @fprintf(i32 %124, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%126 = tail call i32 @exit(i32 1)
unreachable
127: ; preds = %119
%128 = tail call dereferenceable_or_null(1000) i8* @malloc(i32 1000)
br i1 %120, label %144, label %129
129: ; preds = %127
%130 = getelementptr inbounds i8, i8* %128, i64 6
store i8 108, i8* %130
%131 = icmp sgt i32 %21, 0
br i1 %131, label %132, label %134
132: ; preds = %129
%133 = zext i32 %21 to i64
br label %136
134: ; preds = %136, %129
%135 = tail call i32 @strcat(i8* %128, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %144
136: ; preds = %132, %136
%137 = phi i64 [ 0, %132 ], [ %142, %136 ]
%138 = getelementptr inbounds [100 x i8*], [100 x i8*]* %3, i64 0, i64 %137
%139 = load i8*, i8** %138
%140 = tail call i32 @strcat(i8* %128, i8* %139)
%141 = tail call i32 @strcat(i8* %128, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%142 = add nuw nsw i64 %137, 1
%143 = icmp eq i64 %142, %133
br i1 %143, label %134, label %136
144: ; preds = %134, %127
br i1 %121, label %160, label %145
145: ; preds = %144
%146 = getelementptr inbounds i8, i8* %128, i64 6
store i8 117, i8* %146
%147 = icmp sgt i32 %16, 0
br i1 %147, label %148, label %150
148: ; preds = %145
%149 = zext i32 %16 to i64
br label %152
150: ; preds = %152, %145
%151 = tail call i32 @strcat(i8* %128, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %160
152: ; preds = %148, %152
%153 = phi i64 [ 0, %148 ], [ %158, %152 ]
%154 = getelementptr inbounds [100 x i8*], [100 x i8*]* %4, i64 0, i64 %153
%155 = load i8*, i8** %154
%156 = tail call i32 @strcat(i8* %128, i8* %155)
%157 = tail call i32 @strcat(i8* %128, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%158 = add nuw nsw i64 %153, 1
%159 = icmp eq i64 %158, %149
br i1 %159, label %150, label %152
160: ; preds = %150, %144
%161 = load i32, i32* @PF_INET
%162 = load i32, i32* @SOCK_STREAM
%163 = tail call i32 @socket(i32 %161, i32 %162, i32 0)
%164 = icmp slt i32 %163, 0
br i1 %164, label %165, label %167
165: ; preds = %160
%166 = tail call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %230
167: ; preds = %160
%168 = load i32, i32* @PF_INET
%169 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i64 0, i32 2
store i32 %168, i32* %169
%170 = tail call i32 @htons(i32 %23)
%171 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i64 0, i32 1
store i32 %170, i32* %171
%172 = tail call %struct.hostent* @gethostbyname(i8* %22)
%173 = icmp eq %struct.hostent* %172, null
br i1 %173, label %174, label %177
174: ; preds = %167
%175 = load i32, i32* @stderr
%176 = tail call i32 (i32, i8*, ...) @fprintf(i32 %175, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %230
177: ; preds = %167
%178 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i64 0, i32 0
%179 = getelementptr inbounds %struct.hostent, %struct.hostent* %172, i64 0, i32 1
%180 = load i32*, i32** %179
%181 = load i32, i32* %180
%182 = getelementptr inbounds %struct.hostent, %struct.hostent* %172, i64 0, i32 0
%183 = load i32, i32* %182
%184 = call i32 @memcpy(i32* %178, i32 %181, i32 %183)
%185 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%186 = call i64 @connect(i32 %163, %struct.sockaddr* %185, i32 12)
%187 = icmp slt i64 %186, 0
br i1 %187, label %188, label %190
188: ; preds = %177
%189 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
br label %230
190: ; preds = %177
%191 = call i64 @strlen(i8* dereferenceable(1) %128)
%192 = add nsw i64 %191, 1
%193 = call i64 @write(i32 %163, i8* %128, i64 %192)
%194 = icmp slt i64 %193, 0
br i1 %194, label %195, label %197
195: ; preds = %190
%196 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
br label %230
197: ; preds = %190
%198 = call i32 @free(i8* %128)
%199 = getelementptr inbounds [10000 x i8], [10000 x i8]* %8, i64 0, i64 0
%200 = call i32 @bzero(i8* %199, i32 10000)
%201 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%202 = call i32 @bzero(i8* %201, i32 10)
br label %203
203: ; preds = %214, %197
%204 = call i32 @read(i32 %163, i8* %199, i32 9999)
switch i32 %204, label %208 [
i32 -1, label %205
i32 0, label %223
]
205: ; preds = %203
%206 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%207 = call i32 @exit(i32 1)
unreachable
208: ; preds = %203
%209 = sext i32 %204 to i64
%210 = getelementptr inbounds [10000 x i8], [10000 x i8]* %8, i64 0, i64 %209
store i8 0, i8* %210
%211 = call i32 @strncpy(i8* %201, i8* %199, i32 5)
%212 = load i8, i8* %199
%213 = icmp eq i8 %212, 0
br i1 %213, label %214, label %215
214: ; preds = %208, %221, %218
br label %203
215: ; preds = %208
%216 = call i64 @strcmp(i8* %201, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%217 = icmp eq i64 %216, 0
br i1 %217, label %218, label %221
218: ; preds = %215
%219 = load i32, i32* @stderr
%220 = call i32 (i32, i8*, ...) @fprintf(i32 %219, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %199)
br label %214
221: ; preds = %215
%222 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %199)
br label %214
223: ; preds = %203
%224 = call i64 @close(i32 %163)
%225 = icmp slt i64 %224, 0
br i1 %225, label %226, label %228
226: ; preds = %223
%227 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
br label %228
228: ; preds = %223, %226
%229 = phi i32 [ -1, %226 ], [ 0, %223 ]
br label %230
230: ; preds = %228, %195, %188, %174, %165
%231 = phi i32 [ -1, %165 ], [ -1, %174 ], [ -1, %188 ], [ -1, %195 ], [ %229, %228 ]
ret i32 %231
}