#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct stat {
  int st_size;
};
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  int /*<<< orphan*/ h_length;
  scalar_t__ h_addr;
};
typedef int /*<<< orphan*/ serv_addr;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
scalar_t__ EINTR;
int EOF;
int /*<<< orphan*/ SOCK_STREAM;
int atoi(char *);
int /*<<< orphan*/ bcopy(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
scalar_t__ errno;
int /*<<< orphan*/ error(char *, int);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int read(int, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int validator(int);
int write(int, char *, int);
int main(int argc, char **argv) {
  FILE *file1, *file2;
  struct stat fStat1, fStat2;
  int fSize1, fSize2;
  char string1[15];
  char string2[15];
  char header[10];
  if (argc < 4) {
    error("Syntax is wrong.  Boo.", 1);
  }
  strcpy(string1, argv[1]);
  strcpy(string2, argv[2]);
  file1 = fopen(string1, "r");
  if (file1 == NULL) {
    error("Error opening file.\n", 1);
  }
  file2 = fopen(string2, "r");
  if (file2 == NULL) {
    error("Error opening file.\n", 1);
  }
  if (stat(string1, &fStat1) < 0) {
    error("Stat error\n", 1);
  }
  if (stat(string2, &fStat2) < 0) {
    error("Stat error\n", 1);
  }
  fSize1 = fStat1.st_size;
  fSize2 = fStat2.st_size;
  if (fSize1 > fSize2) {
    error("Key needs to be longer.\n", 1);
  }
  int v, b, s = 0;
  char stringOne[fSize1];
  b = fgetc(file1);
  while (b != EOF) {
    v = validator(b);
    if (v == -1) {
      error("Bad characters.\n", 1);
    }
    stringOne[s] = b;
    b = fgetc(file1);
    s++;
  }
  s = 0;
  char stringTwo[fSize2];
  b = fgetc(file2);
  while (b != EOF) {
    stringTwo[s] = b;
    b = fgetc(file2);
    s++;
  }
  snprintf(header, 10, "^#%d#######", fSize1);
  int sockfd, portno, n;
  struct sockaddr_in serv_addr;
  struct hostent *server;
  portno = atoi(argv[3]);
  sockfd = socket(AF_INET, SOCK_STREAM, 0);
  if (sockfd < 0) {
    error("Socket error\n", 2);
  }
  server = gethostbyname("localhost");
  if (server == NULL) {
    error("Host problems.\n", 1);
  }
  memset((char *)&serv_addr, 0, sizeof(serv_addr));
  serv_addr.sin_family = AF_INET;
  bcopy((char *)server->h_addr, (char *)&serv_addr.sin_addr.s_addr,
        server->h_length);
  serv_addr.sin_port = htons(portno);
  if (connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
    error("Error in connecting, client.\n", 1);
  }
  int b2write = strlen(header);
  int bWritten = 0;
  while (bWritten != b2write) {
    int current;
    do {
      current = write(sockfd, header, strlen(header));
    } while ((current == -1) && (errno == EINTR));
    if (current == -1) {
      error("Error in writing, 1\n", 1);
    }
    bWritten += current;
  }
  b2write = strlen(stringOne);
  bWritten = 0;
  int b2w2 = strlen(stringTwo);
  int bWritten2 = 0;
  while (bWritten != b2write) {
    int current;
    do {
      current = write(sockfd, stringOne, strlen(stringOne));
    } while ((current == -1) && (errno == EINTR));
    if (current == -1) {
      error("Error in writing, 1\n", 1);
    }
    bWritten += current;
  }
  while (bWritten2 != b2w2) {
    int cur2;
    do {
      cur2 = write(sockfd, stringTwo, strlen(stringTwo));
    } while ((cur2 == -1) && (errno == EINTR));
    if (cur2 == -1) {
      error("Error in writing, 1\n", 1);
    }
    bWritten2 += cur2;
  }
  char finalSet[fSize1];
  int b2read = fSize1;
  int bRed = 0;
  while (bRed != b2read) {
    int currentLoop;
    do {
      currentLoop = read(sockfd, finalSet, fSize1);
    } while ((currentLoop == -1) && (errno == EINTR));
    if (currentLoop == -1) {
      error("Error in writing, 1\n", 1);
    }
    bRed += currentLoop;
  }
  fprintf(stdout, "%s\n", finalSet);
  close(sockfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    1264 <main+0x34>
lea    0xda6(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
lea    -0x47(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x56(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x47(%rbp),%rdi
lea    0xd86(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    12b6 <main+0x86>
lea    0xd6d(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
lea    -0x56(%rbp),%rdi
lea    0xd56(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    12e6 <main+0xb6>
lea    0xd3d(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
lea    -0x47(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   10e0 <stat@plt>
cmp    $0x0,%rax
jge    130e <main+0xde>
lea    0xd2a(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
lea    -0x56(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   10e0 <stat@plt>
cmp    $0x0,%rax
jge    1336 <main+0x106>
lea    0xd02(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x38(%rbp),%eax
jle    135f <main+0x12f>
lea    0xce5(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
movl   $0x0,-0x6c(%rbp)
mov    -0x34(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x78(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xe8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x80(%rbp)
mov    -0x18(%rbp),%rdi
call   1090 <fgetc@plt>
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%eax
mov    0x2c3b(%rip),%rcx
cmp    (%rcx),%eax
je     1400 <main+0x1d0>
mov    -0x68(%rbp),%edi
call   1140 <validator@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
jne    13d3 <main+0x1a3>
lea    0xc8a(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
mov    -0xe8(%rbp),%rax
mov    -0x68(%rbp),%ecx
mov    %cl,%dl
movslq -0x6c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rdi
call   1090 <fgetc@plt>
mov    %eax,-0x68(%rbp)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    139b <main+0x16b>
movl   $0x0,-0x6c(%rbp)
mov    -0x38(%rbp),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xf0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x88(%rbp)
mov    -0x20(%rbp),%rdi
call   1090 <fgetc@plt>
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%eax
mov    0x2b9e(%rip),%rcx
cmp    (%rcx),%eax
je     1477 <main+0x247>
mov    -0xf0(%rbp),%rax
mov    -0x68(%rbp),%ecx
mov    %cl,%dl
movslq -0x6c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rdi
call   1090 <fgetc@plt>
mov    %eax,-0x68(%rbp)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1438 <main+0x208>
lea    -0x60(%rbp),%rdi
mov    -0x34(%rbp),%ecx
mov    $0xa,%esi
lea    0xbda(%rip),%rdx
call   1070 <snprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1120 <atoi@plt>
mov    %eax,-0x90(%rbp)
mov    0x2b3f(%rip),%rax
mov    (%rax),%edi
mov    0x2b1e(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1150 <socket@plt>
mov    %eax,-0x8c(%rbp)
cmpl   $0x0,-0x8c(%rbp)
jge    14df <main+0x2af>
lea    0xb9b(%rip),%rdi
mov    $0x2,%esi
call   1100 <error@plt>
lea    0xb98(%rip),%rdi
call   10c0 <gethostbyname@plt>
mov    %rax,-0xa8(%rbp)
cmpq   $0x0,-0xa8(%rbp)
jne    1511 <main+0x2e1>
lea    0xb81(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1080 <memset@plt>
mov    0x2abd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x98(%rbp)
mov    -0xa8(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0xa0(%rbp),%rsi
add    $0x4,%rsi
mov    -0xa8(%rbp),%rax
mov    (%rax),%edx
call   10f0 <bcopy@plt>
mov    -0x90(%rbp),%edi
call   1060 <htons@plt>
mov    %eax,-0xa0(%rbp)
mov    -0x8c(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    $0xc,%edx
call   1130 <connect@plt>
cmp    $0x0,%rax
jge    159a <main+0x36a>
lea    0xb08(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
lea    -0x60(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0xac(%rbp)
movl   $0x0,-0xb0(%rbp)
mov    -0xb0(%rbp),%eax
cmp    -0xac(%rbp),%eax
je     1679 <main+0x449>
jmp    15ca <main+0x39a>
mov    -0x8c(%rbp),%eax
mov    %eax,-0xfc(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0xf8(%rbp)
lea    -0x60(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xfc(%rbp),%edi
mov    -0xf8(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %eax,-0xb4(%rbp)
xor    %eax,%eax
cmpl   $0xffffffff,-0xb4(%rbp)
mov    %al,-0xfd(%rbp)
jne    1636 <main+0x406>
mov    0x29a8(%rip),%rax
mov    (%rax),%rax
mov    0x2996(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0xfd(%rbp)
mov    -0xfd(%rbp),%al
test   $0x1,%al
jne    15ca <main+0x39a>
cmpl   $0xffffffff,-0xb4(%rbp)
jne    1662 <main+0x432>
lea    0xa5e(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
mov    -0xb4(%rbp),%eax
add    -0xb0(%rbp),%eax
mov    %eax,-0xb0(%rbp)
jmp    15b3 <main+0x383>
mov    -0xe8(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xf0(%rbp),%rdi
mov    %eax,-0xac(%rbp)
movl   $0x0,-0xb0(%rbp)
call   1050 <strlen@plt>
mov    %eax,-0xb8(%rbp)
movl   $0x0,-0xbc(%rbp)
mov    -0xb0(%rbp),%eax
cmp    -0xac(%rbp),%eax
je     176f <main+0x53f>
jmp    16c8 <main+0x498>
mov    -0xe8(%rbp),%rdi
mov    -0x8c(%rbp),%eax
mov    %eax,-0x104(%rbp)
call   1050 <strlen@plt>
mov    -0x104(%rbp),%edi
mov    -0xe8(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %eax,-0xc0(%rbp)
xor    %eax,%eax
cmpl   $0xffffffff,-0xc0(%rbp)
mov    %al,-0x105(%rbp)
jne    172c <main+0x4fc>
mov    0x28b2(%rip),%rax
mov    (%rax),%rax
mov    0x28a0(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x105(%rbp)
mov    -0x105(%rbp),%al
test   $0x1,%al
jne    16c8 <main+0x498>
cmpl   $0xffffffff,-0xc0(%rbp)
jne    1758 <main+0x528>
lea    0x968(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
mov    -0xc0(%rbp),%eax
add    -0xb0(%rbp),%eax
mov    %eax,-0xb0(%rbp)
jmp    16b1 <main+0x481>
jmp    1774 <main+0x544>
mov    -0xbc(%rbp),%eax
cmp    -0xb8(%rbp),%eax
je     1832 <main+0x602>
jmp    178b <main+0x55b>
mov    -0xf0(%rbp),%rdi
mov    -0x8c(%rbp),%eax
mov    %eax,-0x10c(%rbp)
call   1050 <strlen@plt>
mov    -0x10c(%rbp),%edi
mov    -0xf0(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %eax,-0xc4(%rbp)
xor    %eax,%eax
cmpl   $0xffffffff,-0xc4(%rbp)
mov    %al,-0x10d(%rbp)
jne    17ef <main+0x5bf>
mov    0x27ef(%rip),%rax
mov    (%rax),%rax
mov    0x27dd(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x10d(%rbp)
mov    -0x10d(%rbp),%al
test   $0x1,%al
jne    178b <main+0x55b>
cmpl   $0xffffffff,-0xc4(%rbp)
jne    181b <main+0x5eb>
lea    0x8a5(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
mov    -0xc4(%rbp),%eax
add    -0xbc(%rbp),%eax
mov    %eax,-0xbc(%rbp)
jmp    1774 <main+0x544>
mov    -0x34(%rbp),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x118(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xd0(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0xd4(%rbp)
movl   $0x0,-0xd8(%rbp)
mov    -0xd8(%rbp),%eax
cmp    -0xd4(%rbp),%eax
je     1911 <main+0x6e1>
jmp    1881 <main+0x651>
mov    -0x118(%rbp),%rsi
mov    -0x8c(%rbp),%edi
mov    -0x34(%rbp),%edx
call   10b0 <read@plt>
mov    %eax,-0xdc(%rbp)
xor    %eax,%eax
cmpl   $0xffffffff,-0xdc(%rbp)
mov    %al,-0x119(%rbp)
jne    18ce <main+0x69e>
mov    0x2710(%rip),%rax
mov    (%rax),%rax
mov    0x26fe(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x119(%rbp)
mov    -0x119(%rbp),%al
test   $0x1,%al
jne    1881 <main+0x651>
cmpl   $0xffffffff,-0xdc(%rbp)
jne    18fa <main+0x6ca>
lea    0x7c6(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
mov    -0xdc(%rbp),%eax
add    -0xd8(%rbp),%eax
mov    %eax,-0xd8(%rbp)
jmp    186a <main+0x63a>
mov    -0x118(%rbp),%rdx
mov    0x2699(%rip),%rax
mov    (%rax),%edi
lea    0x7a3(%rip),%rsi
call   10d0 <fprintf@plt>
mov    -0x8c(%rbp),%edi
call   10a0 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rsi,%r14
cmp    $0x3,%edi
jg     125d <main+0x2d>
lea    0xdad(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
mov    0x8(%r14),%rsi
lea    -0xb6(%rbp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    0x10(%r14),%rsi
lea    -0xa7(%rbp),%rdi
call   1030 <strcpy@plt>
lea    0xd90(%rip),%rsi
mov    %rbx,%rdi
call   1110 <fopen@plt>
mov    %rax,%r12
test   %rax,%rax
jne    12a8 <main+0x78>
lea    0xd7b(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
lea    0xd68(%rip),%rsi
lea    -0xa7(%rbp),%rdi
call   1110 <fopen@plt>
mov    %rax,%r13
test   %rax,%rax
jne    12d4 <main+0xa4>
lea    0xd4f(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
lea    -0xb6(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   10e0 <stat@plt>
test   %rax,%rax
jns    12fa <main+0xca>
lea    0xd3e(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
lea    -0xa7(%rbp),%rdi
lea    -0x48(%rbp),%rsi
call   10e0 <stat@plt>
test   %rax,%rax
jns    1320 <main+0xf0>
lea    0xd18(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
mov    %r14,-0x30(%rbp)
mov    -0x50(%rbp),%eax
mov    -0x48(%rbp),%ecx
mov    %rcx,-0x38(%rbp)
cmp    %ecx,%eax
mov    %rax,-0x40(%rbp)
jle    134b <main+0x11b>
lea    0xcfd(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
mov    -0x40(%rbp),%rax
mov    %rsp,-0x98(%rbp)
mov    %rsp,%rcx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rax,-0x90(%rbp)
sub    %rax,%rcx
mov    %rcx,-0x60(%rbp)
mov    %rcx,%rsp
mov    %r12,%rdi
call   1090 <fgetc@plt>
mov    0x2c63(%rip),%r14
cmp    (%r14),%eax
jne    16e6 <main+0x4b6>
mov    %rsp,%r15
mov    -0x38(%rbp),%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    %r13,%rdi
call   1090 <fgetc@plt>
cmp    (%r14),%eax
je     13c3 <main+0x193>
mov    %r15,%rbx
nopl   0x0(%rax,%rax,1)
mov    %al,(%rbx)
mov    %r13,%rdi
call   1090 <fgetc@plt>
add    $0x1,%rbx
cmp    (%r14),%eax
jne    13b0 <main+0x180>
lea    0xc9a(%rip),%rdx
lea    -0x82(%rbp),%rdi
mov    $0xa,%esi
mov    -0x40(%rbp),%rcx
call   1070 <snprintf@plt>
mov    -0x30(%rbp),%rax
mov    0x18(%rax),%rdi
call   1120 <atoi@plt>
mov    %eax,%r12d
mov    0x2bf2(%rip),%rax
mov    (%rax),%edi
mov    0x2bd1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1150 <socket@plt>
mov    %eax,%r13d
test   %eax,%eax
jns    1420 <main+0x1f0>
lea    0xc5a(%rip),%rdi
mov    $0x2,%esi
call   1100 <error@plt>
lea    0xc57(%rip),%rdi
call   10c0 <gethostbyname@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1445 <main+0x215>
lea    0xc4d(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
lea    -0x78(%rbp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1080 <memset@plt>
mov    0x2b89(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x70(%rbp)
mov    0x8(%rbx),%rsi
lea    -0x74(%rbp),%rdi
mov    (%rbx),%edx
call   10f0 <memmove@plt>
mov    %r12d,%edi
call   1060 <htons@plt>
mov    %eax,-0x78(%rbp)
mov    %r13d,%edi
mov    %r14,%rsi
mov    $0xc,%edx
call   1130 <connect@plt>
test   %rax,%rax
jns    14a4 <main+0x274>
lea    0xbfe(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
mov    %r15,-0x68(%rbp)
lea    -0x82(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x38(%rbp)
test   %eax,%eax
je     152f <main+0x2ff>
xor    %eax,%eax
lea    -0x82(%rbp),%rbx
mov    0x2afd(%rip),%r15
mov    0x2aee(%rip),%r12
jmp    14eb <main+0x2bb>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    -0x30(%rbp),%eax
add    %r14d,%eax
cmp    -0x38(%rbp),%eax
je     152f <main+0x2ff>
mov    %eax,-0x30(%rbp)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %eax,%r14d
cmp    $0xffffffff,%eax
jne    1516 <main+0x2e6>
mov    (%r12),%rax
cmp    %rax,(%r15)
je     14f0 <main+0x2c0>
cmp    $0xffffffff,%r14d
jne    14e0 <main+0x2b0>
lea    0xb93(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
jmp    14e0 <main+0x2b0>
mov    -0x60(%rbp),%r12
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebx
mov    -0x68(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x38(%rbp)
mov    %ebx,-0x54(%rbp)
test   %ebx,%ebx
je     15bc <main+0x38c>
xor    %eax,%eax
mov    0x2a6f(%rip),%r14
mov    0x2a60(%rip),%r15
jmp    157a <main+0x34a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    -0x30(%rbp),%eax
add    %ebx,%eax
cmp    -0x54(%rbp),%eax
je     15bc <main+0x38c>
mov    %eax,-0x30(%rbp)
nopl   (%rax)
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %r13d,%edi
mov    %r12,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    15a4 <main+0x374>
mov    (%r15),%rax
cmp    %rax,(%r14)
je     1580 <main+0x350>
cmp    $0xffffffff,%ebx
jne    1570 <main+0x340>
lea    0xb06(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
jmp    1570 <main+0x340>
cmpl   $0x0,-0x38(%rbp)
mov    -0x68(%rbp),%r12
je     162c <main+0x3fc>
xor    %eax,%eax
mov    0x29f9(%rip),%r14
mov    0x29ea(%rip),%r15
jmp    15ea <main+0x3ba>
nopl   0x0(%rax,%rax,1)
mov    -0x30(%rbp),%eax
add    %ebx,%eax
cmp    -0x38(%rbp),%eax
je     162c <main+0x3fc>
mov    %eax,-0x30(%rbp)
nopl   (%rax)
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %r13d,%edi
mov    %r12,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1614 <main+0x3e4>
mov    (%r15),%rax
cmp    %rax,(%r14)
je     15f0 <main+0x3c0>
cmp    $0xffffffff,%ebx
jne    15e0 <main+0x3b0>
lea    0xa96(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
jmp    15e0 <main+0x3b0>
mov    %rsp,%r12
sub    -0x90(%rbp),%r12
mov    %r12,%rsp
cmpq   $0x0,-0x40(%rbp)
je     16ae <main+0x47e>
xor    %eax,%eax
mov    0x297f(%rip),%r15
mov    0x2970(%rip),%r14
jmp    1669 <main+0x439>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    -0x30(%rbp),%eax
add    %ebx,%eax
cmp    %ecx,%eax
je     16ae <main+0x47e>
mov    %eax,-0x30(%rbp)
nopl   0x0(%rax)
mov    %r13d,%edi
mov    %r12,%rsi
mov    -0x40(%rbp),%rdx
call   10b0 <read@plt>
mov    -0x40(%rbp),%rcx
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1692 <main+0x462>
mov    (%r14),%rax
cmp    %rax,(%r15)
je     1670 <main+0x440>
cmp    $0xffffffff,%ebx
jne    1660 <main+0x430>
lea    0xa18(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
mov    -0x40(%rbp),%rcx
jmp    1660 <main+0x430>
mov    0x2903(%rip),%rax
mov    (%rax),%edi
lea    0xa0d(%rip),%rsi
mov    %r12,%rdx
call   10d0 <fprintf@plt>
mov    %r13d,%edi
call   10a0 <close@plt>
mov    -0x98(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%r15d
mov    -0x60(%rbp),%rbx
jmp    170b <main+0x4db>
nop
mov    %r15b,(%rbx)
mov    %r12,%rdi
call   1090 <fgetc@plt>
mov    %eax,%r15d
add    $0x1,%rbx
cmp    (%r14),%eax
je     1386 <main+0x156>
mov    %r15d,%edi
call   1140 <validator@plt>
cmp    $0xffffffff,%eax
jne    16f0 <main+0x4c0>
lea    0x934(%rip),%rdi
mov    $0x1,%esi
call   1100 <error@plt>
jmp    16f0 <main+0x4c0>

LLVM IR (-O0):
%struct.stat = type { i32 }
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i64 }
%struct.sockaddr = type { i32 }
@.str = [23 x i8] c"Syntax is wrong. Boo.\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [21 x i8] c"Error opening file.\0A\00"
@.str.3 = [12 x i8] c"Stat error\0A\00"
@.str.4 = [25 x i8] c"Key needs to be longer.\0A\00"
@EOF = global i32 0
@.str.5 = [17 x i8] c"Bad characters.\0A\00"
@.str.6 = [12 x i8] c"^#%d#######\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.7 = [14 x i8] c"Socket error\0A\00"
@.str.8 = [10 x i8] c"localhost\00"
@.str.9 = [16 x i8] c"Host problems.\0A\00"
@.str.10 = [30 x i8] c"Error in connecting, client.\0A\00"
@errno = global i64 0
@EINTR = global i64 0
@.str.11 = [21 x i8] c"Error in writing, 1\0A\00"
@stdout = global i32 0
@.str.12 = [4 x i8] c"%s\0A\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 %struct.stat
%9 = alloca %struct.stat
%10 = alloca i32
%11 = alloca i32
%12 = alloca [15 x i8]
%13 = alloca [15 x i8]
%14 = alloca [10 x i8]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
%19 = alloca i64
%20 = alloca i64
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca %struct.sockaddr_in
%25 = alloca %struct.hostent*
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i64
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%37 = load i32, i32* %4
%38 = icmp slt i32 %37, 4
br i1 %38, label %39, label %41
39: ; preds = %2
%40 = call i32 @error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 1)
br label %41
41: ; preds = %39, %2
%42 = getelementptr inbounds [15 x i8], [15 x i8]* %12, i64 0, i64 0
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = call i32 @strcpy(i8* %42, i8* %45)
%47 = getelementptr inbounds [15 x i8], [15 x i8]* %13, i64 0, i64 0
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 2
%50 = load i8*, i8** %49
%51 = call i32 @strcpy(i8* %47, i8* %50)
%52 = getelementptr inbounds [15 x i8], [15 x i8]* %12, i64 0, i64 0
%53 = call i32* @fopen(i8* %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %53, i32** %6
%54 = load i32*, i32** %6
%55 = icmp eq i32* %54, null
br i1 %55, label %56, label %58
56: ; preds = %41
%57 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 1)
br label %58
58: ; preds = %56, %41
%59 = getelementptr inbounds [15 x i8], [15 x i8]* %13, i64 0, i64 0
%60 = call i32* @fopen(i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %60, i32** %7
%61 = load i32*, i32** %7
%62 = icmp eq i32* %61, null
br i1 %62, label %63, label %65
63: ; preds = %58
%64 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 1)
br label %65
65: ; preds = %63, %58
%66 = getelementptr inbounds [15 x i8], [15 x i8]* %12, i64 0, i64 0
%67 = call i64 @stat(i8* %66, %struct.stat* %8)
%68 = icmp slt i64 %67, 0
br i1 %68, label %69, label %71
69: ; preds = %65
%70 = call i32 @error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 1)
br label %71
71: ; preds = %69, %65
%72 = getelementptr inbounds [15 x i8], [15 x i8]* %13, i64 0, i64 0
%73 = call i64 @stat(i8* %72, %struct.stat* %9)
%74 = icmp slt i64 %73, 0
br i1 %74, label %75, label %77
75: ; preds = %71
%76 = call i32 @error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 1)
br label %77
77: ; preds = %75, %71
%78 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%79 = load i32, i32* %78
store i32 %79, i32* %10
%80 = getelementptr inbounds %struct.stat, %struct.stat* %9, i32 0, i32 0
%81 = load i32, i32* %80
store i32 %81, i32* %11
%82 = load i32, i32* %10
%83 = load i32, i32* %11
%84 = icmp sgt i32 %82, %83
br i1 %84, label %85, label %87
85: ; preds = %77
%86 = call i32 @error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 1)
br label %87
87: ; preds = %85, %77
store i32 0, i32* %17
%88 = load i32, i32* %10
%89 = zext i32 %88 to i64
%90 = call i8* @llvm.stacksave()
store i8* %90, i8** %18
%91 = alloca i8, i64 %89
store i64 %89, i64* %19
%92 = load i32*, i32** %6
%93 = call i32 @fgetc(i32* %92)
store i32 %93, i32* %16
br label %94
94: ; preds = %105, %87
%95 = load i32, i32* %16
%96 = load i32, i32* @EOF
%97 = icmp ne i32 %95, %96
br i1 %97, label %98, label %115
98: ; preds = %94
%99 = load i32, i32* %16
%100 = call i32 @validator(i32 %99)
store i32 %100, i32* %15
%101 = load i32, i32* %15
%102 = icmp eq i32 %101, -1
br i1 %102, label %103, label %105
103: ; preds = %98
%104 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 1)
br label %105
105: ; preds = %103, %98
%106 = load i32, i32* %16
%107 = trunc i32 %106 to i8
%108 = load i32, i32* %17
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds i8, i8* %91, i64 %109
store i8 %107, i8* %110
%111 = load i32*, i32** %6
%112 = call i32 @fgetc(i32* %111)
store i32 %112, i32* %16
%113 = load i32, i32* %17
%114 = add nsw i32 %113, 1
store i32 %114, i32* %17
br label %94
115: ; preds = %94
store i32 0, i32* %17
%116 = load i32, i32* %11
%117 = zext i32 %116 to i64
%118 = alloca i8, i64 %117
store i64 %117, i64* %20
%119 = load i32*, i32** %7
%120 = call i32 @fgetc(i32* %119)
store i32 %120, i32* %16
br label %121
121: ; preds = %125, %115
%122 = load i32, i32* %16
%123 = load i32, i32* @EOF
%124 = icmp ne i32 %122, %123
br i1 %124, label %125, label %135
125: ; preds = %121
%126 = load i32, i32* %16
%127 = trunc i32 %126 to i8
%128 = load i32, i32* %17
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds i8, i8* %118, i64 %129
store i8 %127, i8* %130
%131 = load i32*, i32** %7
%132 = call i32 @fgetc(i32* %131)
store i32 %132, i32* %16
%133 = load i32, i32* %17
%134 = add nsw i32 %133, 1
store i32 %134, i32* %17
br label %121
135: ; preds = %121
%136 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%137 = load i32, i32* %10
%138 = call i32 @snprintf(i8* %136, i32 10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %137)
%139 = load i8**, i8*** %5
%140 = getelementptr inbounds i8*, i8** %139, i64 3
%141 = load i8*, i8** %140
%142 = call i32 @atoi(i8* %141)
store i32 %142, i32* %22
%143 = load i32, i32* @AF_INET
%144 = load i32, i32* @SOCK_STREAM
%145 = call i32 @socket(i32 %143, i32 %144, i32 0)
store i32 %145, i32* %21
%146 = load i32, i32* %21
%147 = icmp slt i32 %146, 0
br i1 %147, label %148, label %150
148: ; preds = %135
%149 = call i32 @error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 2)
br label %150
150: ; preds = %148, %135
%151 = call %struct.hostent* @gethostbyname(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
store %struct.hostent* %151, %struct.hostent** %25
%152 = load %struct.hostent*, %struct.hostent** %25
%153 = icmp eq %struct.hostent* %152, null
br i1 %153, label %154, label %156
154: ; preds = %150
%155 = call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32 1)
br label %156
156: ; preds = %154, %150
%157 = bitcast %struct.sockaddr_in* %24 to i8*
%158 = call i32 @memset(i8* %157, i32 0, i32 12)
%159 = load i32, i32* @AF_INET
%160 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %24, i32 0, i32 2
store i32 %159, i32* %160
%161 = load %struct.hostent*, %struct.hostent** %25
%162 = getelementptr inbounds %struct.hostent, %struct.hostent* %161, i32 0, i32 1
%163 = load i64, i64* %162
%164 = inttoptr i64 %163 to i8*
%165 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %24, i32 0, i32 1
%166 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %165, i32 0, i32 0
%167 = bitcast i32* %166 to i8*
%168 = load %struct.hostent*, %struct.hostent** %25
%169 = getelementptr inbounds %struct.hostent, %struct.hostent* %168, i32 0, i32 0
%170 = load i32, i32* %169
%171 = call i32 @bcopy(i8* %164, i8* %167, i32 %170)
%172 = load i32, i32* %22
%173 = call i32 @htons(i32 %172)
%174 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %24, i32 0, i32 0
store i32 %173, i32* %174
%175 = load i32, i32* %21
%176 = bitcast %struct.sockaddr_in* %24 to %struct.sockaddr*
%177 = call i64 @connect(i32 %175, %struct.sockaddr* %176, i32 12)
%178 = icmp slt i64 %177, 0
br i1 %178, label %179, label %181
179: ; preds = %156
%180 = call i32 @error(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i32 1)
br label %181
181: ; preds = %179, %156
%182 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%183 = call i32 @strlen(i8* %182)
store i32 %183, i32* %26
store i32 0, i32* %27
br label %184
184: ; preds = %209, %181
%185 = load i32, i32* %27
%186 = load i32, i32* %26
%187 = icmp ne i32 %185, %186
br i1 %187, label %188, label %213
188: ; preds = %184
br label %189
189: ; preds = %202, %188
%190 = load i32, i32* %21
%191 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%192 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%193 = call i32 @strlen(i8* %192)
%194 = call i32 @write(i32 %190, i8* %191, i32 %193)
store i32 %194, i32* %28
br label %195
195: ; preds = %189
%196 = load i32, i32* %28
%197 = icmp eq i32 %196, -1
br i1 %197, label %198, label %202
198: ; preds = %195
%199 = load i64, i64* @errno
%200 = load i64, i64* @EINTR
%201 = icmp eq i64 %199, %200
br label %202
202: ; preds = %198, %195
%203 = phi i1 [ false, %195 ], [ %201, %198 ]
br i1 %203, label %189, label %204
204: ; preds = %202
%205 = load i32, i32* %28
%206 = icmp eq i32 %205, -1
br i1 %206, label %207, label %209
207: ; preds = %204
%208 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i32 1)
br label %209
209: ; preds = %207, %204
%210 = load i32, i32* %28
%211 = load i32, i32* %27
%212 = add nsw i32 %211, %210
store i32 %212, i32* %27
br label %184
213: ; preds = %184
%214 = call i32 @strlen(i8* %91)
store i32 %214, i32* %26
store i32 0, i32* %27
%215 = call i32 @strlen(i8* %118)
store i32 %215, i32* %29
store i32 0, i32* %30
br label %216
216: ; preds = %239, %213
%217 = load i32, i32* %27
%218 = load i32, i32* %26
%219 = icmp ne i32 %217, %218
br i1 %219, label %220, label %243
220: ; preds = %216
br label %221
221: ; preds = %232, %220
%222 = load i32, i32* %21
%223 = call i32 @strlen(i8* %91)
%224 = call i32 @write(i32 %222, i8* %91, i32 %223)
store i32 %224, i32* %31
br label %225
225: ; preds = %221
%226 = load i32, i32* %31
%227 = icmp eq i32 %226, -1
br i1 %227, label %228, label %232
228: ; preds = %225
%229 = load i64, i64* @errno
%230 = load i64, i64* @EINTR
%231 = icmp eq i64 %229, %230
br label %232
232: ; preds = %228, %225
%233 = phi i1 [ false, %225 ], [ %231, %228 ]
br i1 %233, label %221, label %234
234: ; preds = %232
%235 = load i32, i32* %31
%236 = icmp eq i32 %235, -1
br i1 %236, label %237, label %239
237: ; preds = %234
%238 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i32 1)
br label %239
239: ; preds = %237, %234
%240 = load i32, i32* %31
%241 = load i32, i32* %27
%242 = add nsw i32 %241, %240
store i32 %242, i32* %27
br label %216
243: ; preds = %216
br label %244
244: ; preds = %267, %243
%245 = load i32, i32* %30
%246 = load i32, i32* %29
%247 = icmp ne i32 %245, %246
br i1 %247, label %248, label %271
248: ; preds = %244
br label %249
249: ; preds = %260, %248
%250 = load i32, i32* %21
%251 = call i32 @strlen(i8* %118)
%252 = call i32 @write(i32 %250, i8* %118, i32 %251)
store i32 %252, i32* %32
br label %253
253: ; preds = %249
%254 = load i32, i32* %32
%255 = icmp eq i32 %254, -1
br i1 %255, label %256, label %260
256: ; preds = %253
%257 = load i64, i64* @errno
%258 = load i64, i64* @EINTR
%259 = icmp eq i64 %257, %258
br label %260
260: ; preds = %256, %253
%261 = phi i1 [ false, %253 ], [ %259, %256 ]
br i1 %261, label %249, label %262
262: ; preds = %260
%263 = load i32, i32* %32
%264 = icmp eq i32 %263, -1
br i1 %264, label %265, label %267
265: ; preds = %262
%266 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i32 1)
br label %267
267: ; preds = %265, %262
%268 = load i32, i32* %32
%269 = load i32, i32* %30
%270 = add nsw i32 %269, %268
store i32 %270, i32* %30
br label %244
271: ; preds = %244
%272 = load i32, i32* %10
%273 = zext i32 %272 to i64
%274 = alloca i8, i64 %273
store i64 %273, i64* %33
%275 = load i32, i32* %10
store i32 %275, i32* %34
store i32 0, i32* %35
br label %276
276: ; preds = %299, %271
%277 = load i32, i32* %35
%278 = load i32, i32* %34
%279 = icmp ne i32 %277, %278
br i1 %279, label %280, label %303
280: ; preds = %276
br label %281
281: ; preds = %292, %280
%282 = load i32, i32* %21
%283 = load i32, i32* %10
%284 = call i32 @read(i32 %282, i8* %274, i32 %283)
store i32 %284, i32* %36
br label %285
285: ; preds = %281
%286 = load i32, i32* %36
%287 = icmp eq i32 %286, -1
br i1 %287, label %288, label %292
288: ; preds = %285
%289 = load i64, i64* @errno
%290 = load i64, i64* @EINTR
%291 = icmp eq i64 %289, %290
br label %292
292: ; preds = %288, %285
%293 = phi i1 [ false, %285 ], [ %291, %288 ]
br i1 %293, label %281, label %294
294: ; preds = %292
%295 = load i32, i32* %36
%296 = icmp eq i32 %295, -1
br i1 %296, label %297, label %299
297: ; preds = %294
%298 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i32 1)
br label %299
299: ; preds = %297, %294
%300 = load i32, i32* %36
%301 = load i32, i32* %35
%302 = add nsw i32 %301, %300
store i32 %302, i32* %35
br label %276
303: ; preds = %276
%304 = load i32, i32* @stdout
%305 = call i32 @fprintf(i32 %304, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %274)
%306 = load i32, i32* %21
%307 = call i32 @close(i32 %306)
store i32 0, i32* %3
%308 = load i8*, i8** %18
%309 = load i32, i32* %3
ret i32 %309
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i64 }
%struct.sockaddr = type { i32 }
@.str = [23 x i8] c"Syntax is wrong. Boo.\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [21 x i8] c"Error opening file.\0A\00"
@.str.3 = [12 x i8] c"Stat error\0A\00"
@.str.4 = [25 x i8] c"Key needs to be longer.\0A\00"
@EOF = global i32 0
@.str.5 = [17 x i8] c"Bad characters.\0A\00"
@.str.6 = [12 x i8] c"^#%d#######\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.7 = [14 x i8] c"Socket error\0A\00"
@.str.8 = [10 x i8] c"localhost\00"
@.str.9 = [16 x i8] c"Host problems.\0A\00"
@.str.10 = [30 x i8] c"Error in connecting, client.\0A\00"
@errno = global i64 0
@EINTR = global i64 0
@.str.11 = [21 x i8] c"Error in writing, 1\0A\00"
@stdout = global i32 0
@.str.12 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = alloca %struct.stat
%5 = alloca [15 x i8]
%6 = alloca [15 x i8]
%7 = alloca [10 x i8]
%8 = alloca %struct.sockaddr_in
%9 = bitcast %struct.stat* %3 to i8*
%10 = bitcast %struct.stat* %4 to i8*
%11 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 0
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%14 = icmp slt i32 %0, 4
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = tail call i32 @error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 1)
br label %17
17: ; preds = %15, %2
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @strcpy(i8* %11, i8* %19)
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @strcpy(i8* %12, i8* %22)
%24 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %28
26: ; preds = %17
%27 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 1)
br label %28
28: ; preds = %26, %17
%29 = call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 1)
br label %33
33: ; preds = %31, %28
%34 = call i64 @stat(i8* %11, %struct.stat* %3)
%35 = icmp slt i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = call i32 @error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 1)
br label %38
38: ; preds = %36, %33
%39 = call i64 @stat(i8* %12, %struct.stat* %4)
%40 = icmp slt i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = call i32 @error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 1)
br label %43
43: ; preds = %41, %38
%44 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%45 = load i32, i32* %44
%46 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
%47 = load i32, i32* %46
%48 = icmp sgt i32 %45, %47
br i1 %48, label %49, label %51
49: ; preds = %43
%50 = call i32 @error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 1)
br label %51
51: ; preds = %49, %43
%52 = zext i32 %45 to i64
%53 = call i8* @llvm.stacksave()
%54 = alloca i8, i64 %52
%55 = call i32 @fgetc(i32* %24)
%56 = load i32, i32* @EOF
%57 = icmp eq i32 %55, %56
br i1 %57, label %72, label %58
58: ; preds = %51, %65
%59 = phi i64 [ %69, %65 ], [ 0, %51 ]
%60 = phi i32 [ %68, %65 ], [ %55, %51 ]
%61 = call i32 @validator(i32 %60)
%62 = icmp eq i32 %61, -1
br i1 %62, label %63, label %65
63: ; preds = %58
%64 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 1)
br label %65
65: ; preds = %63, %58
%66 = trunc i32 %60 to i8
%67 = getelementptr inbounds i8, i8* %54, i64 %59
store i8 %66, i8* %67
%68 = call i32 @fgetc(i32* %24)
%69 = add nuw i64 %59, 1
%70 = load i32, i32* @EOF
%71 = icmp eq i32 %68, %70
br i1 %71, label %72, label %58
72: ; preds = %65, %51
%73 = zext i32 %47 to i64
%74 = alloca i8, i64 %73
%75 = call i32 @fgetc(i32* %29)
%76 = load i32, i32* @EOF
%77 = icmp eq i32 %75, %76
br i1 %77, label %87, label %78
78: ; preds = %72, %78
%79 = phi i64 [ %84, %78 ], [ 0, %72 ]
%80 = phi i32 [ %83, %78 ], [ %75, %72 ]
%81 = trunc i32 %80 to i8
%82 = getelementptr inbounds i8, i8* %74, i64 %79
store i8 %81, i8* %82
%83 = call i32 @fgetc(i32* %29)
%84 = add nuw i64 %79, 1
%85 = load i32, i32* @EOF
%86 = icmp eq i32 %83, %85
br i1 %86, label %87, label %78
87: ; preds = %78, %72
%88 = call i32 @snprintf(i8* %13, i32 10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %45)
%89 = bitcast %struct.sockaddr_in* %8 to i8*
%90 = getelementptr inbounds i8*, i8** %1, i64 3
%91 = load i8*, i8** %90
%92 = call i32 @atoi(i8* %91)
%93 = load i32, i32* @AF_INET
%94 = load i32, i32* @SOCK_STREAM
%95 = call i32 @socket(i32 %93, i32 %94, i32 0)
%96 = icmp slt i32 %95, 0
br i1 %96, label %97, label %99
97: ; preds = %87
%98 = call i32 @error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 2)
br label %99
99: ; preds = %97, %87
%100 = call %struct.hostent* @gethostbyname(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%101 = icmp eq %struct.hostent* %100, null
br i1 %101, label %102, label %104
102: ; preds = %99
%103 = call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32 1)
br label %104
104: ; preds = %102, %99
%105 = call i32 @memset(i8* %89, i32 0, i32 12)
%106 = load i32, i32* @AF_INET
%107 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i64 0, i32 2
store i32 %106, i32* %107
%108 = getelementptr inbounds %struct.hostent, %struct.hostent* %100, i64 0, i32 1
%109 = load i64, i64* %108
%110 = inttoptr i64 %109 to i8*
%111 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i64 0, i32 1, i32 0
%112 = bitcast i32* %111 to i8*
%113 = getelementptr inbounds %struct.hostent, %struct.hostent* %100, i64 0, i32 0
%114 = load i32, i32* %113
%115 = call i32 @htons(i32 %92)
%116 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i64 0, i32 0
store i32 %115, i32* %116
%117 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%118 = call i64 @connect(i32 %95, %struct.sockaddr* %117, i32 12)
%119 = icmp slt i64 %118, 0
br i1 %119, label %120, label %122
120: ; preds = %104
%121 = call i32 @error(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i32 1)
br label %122
122: ; preds = %120, %104
%123 = call i32 @strlen(i8* %13)
%124 = icmp eq i32 %123, 0
br i1 %124, label %141, label %125
125: ; preds = %122, %138
%126 = phi i32 [ %139, %138 ], [ 0, %122 ]
br label %127
127: ; preds = %125, %127
%128 = call i32 @strlen(i8* %13)
%129 = call i32 @write(i32 %95, i8* %13, i32 %128)
%130 = icmp eq i32 %129, -1
%131 = load i64, i64* @errno
%132 = load i64, i64* @EINTR
%133 = icmp eq i64 %131, %132
%134 = select i1 %130, i1 %133, i1 false
br i1 %134, label %127, label %135
135: ; preds = %127
br i1 %130, label %136, label %138
136: ; preds = %135
%137 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i32 1)
br label %138
138: ; preds = %136, %135
%139 = add nsw i32 %129, %126
%140 = icmp eq i32 %139, %123
br i1 %140, label %141, label %125
141: ; preds = %138, %122
%142 = call i32 @strlen(i8* %54)
%143 = call i32 @strlen(i8* %74)
%144 = icmp eq i32 %142, 0
br i1 %144, label %147, label %145
145: ; preds = %141, %160
%146 = phi i32 [ %161, %160 ], [ 0, %141 ]
br label %149
147: ; preds = %160, %141
%148 = icmp eq i32 %143, 0
br i1 %148, label %179, label %163
149: ; preds = %145, %149
%150 = call i32 @strlen(i8* %54)
%151 = call i32 @write(i32 %95, i8* %54, i32 %150)
%152 = icmp eq i32 %151, -1
%153 = load i64, i64* @errno
%154 = load i64, i64* @EINTR
%155 = icmp eq i64 %153, %154
%156 = select i1 %152, i1 %155, i1 false
br i1 %156, label %149, label %157
157: ; preds = %149
br i1 %152, label %158, label %160
158: ; preds = %157
%159 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i32 1)
br label %160
160: ; preds = %158, %157
%161 = add nsw i32 %151, %146
%162 = icmp eq i32 %161, %142
br i1 %162, label %147, label %145
163: ; preds = %147, %176
%164 = phi i32 [ %177, %176 ], [ 0, %147 ]
br label %165
165: ; preds = %163, %165
%166 = call i32 @strlen(i8* %74)
%167 = call i32 @write(i32 %95, i8* %74, i32 %166)
%168 = icmp eq i32 %167, -1
%169 = load i64, i64* @errno
%170 = load i64, i64* @EINTR
%171 = icmp eq i64 %169, %170
%172 = select i1 %168, i1 %171, i1 false
br i1 %172, label %165, label %173
173: ; preds = %165
br i1 %168, label %174, label %176
174: ; preds = %173
%175 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i32 1)
br label %176
176: ; preds = %174, %173
%177 = add nsw i32 %167, %164
%178 = icmp eq i32 %177, %143
br i1 %178, label %179, label %163
179: ; preds = %176, %147
%180 = alloca i8, i64 %52
%181 = icmp eq i32 %45, 0
br i1 %181, label %197, label %182
182: ; preds = %179, %194
%183 = phi i32 [ %195, %194 ], [ 0, %179 ]
br label %184
184: ; preds = %182, %184
%185 = call i32 @read(i32 %95, i8* %180, i32 %45)
%186 = icmp eq i32 %185, -1
%187 = load i64, i64* @errno
%188 = load i64, i64* @EINTR
%189 = icmp eq i64 %187, %188
%190 = select i1 %186, i1 %189, i1 false
br i1 %190, label %184, label %191
191: ; preds = %184
br i1 %186, label %192, label %194
192: ; preds = %191
%193 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i32 1)
br label %194
194: ; preds = %192, %191
%195 = add nsw i32 %185, %183
%196 = icmp eq i32 %195, %45
br i1 %196, label %197, label %182
197: ; preds = %194, %179
%198 = load i32, i32* @stdout
%199 = call i32 @fprintf(i32 %198, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %180)
%200 = call i32 @close(i32 %95)
ret i32 0
}