#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 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;
int BUFSIZ;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ SOCK_STREAM;
int atoi(char *);
int /*<<< orphan*/ bcopy(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
int read(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int write(int, char *, int);
int main(int argc, char *argv[]) {
  int sockfd;
  int n;
  int portno;
  int counter, counter2, i;
  int size;
  char exit2[] = "EXIT";
  char buffer[256];
  char buf[BUFSIZ + 1];
  char html[4000000];
  char name[256];
  struct sockaddr_in serv_addr;
  struct hostent *server;
  bzero(name, 256);
  if (argc < 4) {
    fprintf(stderr, "usage %s -s hostname port\n", argv[0]);
    exit(0);
  } else if (strcmp(argv[1], "-s")) {
    fprintf(stderr, "usage %s -s hostname port\n", argv[0]);
    exit(0);
  }
  portno = atoi(argv[3]);
  while (1) {
    size = 0;
    sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    if (sockfd < 0)
      error("ERROR opening socket");
    server = gethostbyname(argv[2]);
    if (server == NULL) {
      fprintf(stderr, "ERROR, no such host\n");
      exit(0);
    }
    bzero((char *)&serv_addr, 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 connecting");
    printf("Please ");
    bzero(buffer, 256);
    printf("\nGive the address from which you would like to get your html\n");
    printf("with GET or GETNEW(for new copy) in front \n");
    printf("or write EXIT+ press enter to terminate the proxy client:\n");
    gets(buffer);
    counter2 = 0;
    for (counter = 0; counter <= 3; counter++) {
      if (buffer[counter] == exit2[counter])
        counter2++;
    }
    if (counter2 == 4) {
      n = write(sockfd, buffer, strlen(buffer));
      printf("bye bye\n");
      exit(0);
    }
    n = write(sockfd, buffer, strlen(buffer));
    if (n < 0)
      error("ERROR writing to socket");
    bzero(html, 4000000);
    bzero(buffer, 256);
    n = read(sockfd, buffer, 255);
    sscanf(buffer, "%d", &size);
    counter = 0;
    memset(buf, 0, BUFSIZ + 1);
    while (1) {
      n = 0;
      n = read(sockfd, buf, BUFSIZ);
      for (i = 0; i < strlen(buf); i++) {
        html[counter] = buf[i];
        counter++;
      }
      memset(buf, 0, n);
      size -= n;
      if ((n <= 0) || (size <= 0))
        break;
    }
    html[counter] = '\0';
    if (n < 0)
      error("ERROR reading from socket");
    FILE *book;
    printf("\n Please, give the name of file which you want to save your the "
           "html:  \n");
    bzero(name, strlen(name));
    gets(name);
    strcat(name, ".html");
    if ((book = fopen(name, "w")) == NULL)
      error("cant open file or Bad name");
    fwrite(html, 1, strlen(html), book);
    fclose(book);
    close(sockfd);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3d0bb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x30(%rbp)
movl   $0x54495845,-0x34(%rbp)
mov    0x2d25(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x148(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x3d0b78(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x150(%rbp)
lea    -0x3d0b50(%rbp),%rdi
mov    $0x100,%esi
call   1130 <bzero@plt>
cmpl   $0x4,-0x8(%rbp)
jge    130c <main+0x9c>
mov    0x2ce2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd07(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
xor    %edi,%edi
call   1160 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd05(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
je     134f <main+0xdf>
mov    0x2c9f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xcc4(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
xor    %edi,%edi
call   1160 <exit@plt>
jmp    1354 <main+0xe4>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1140 <atoi@plt>
mov    %eax,-0x1c(%rbp)
jmp    1369 <main+0xf9>
movl   $0x0,-0x2c(%rbp)
mov    0x2c71(%rip),%rax
mov    (%rax),%edi
mov    0x2c48(%rip),%rax
mov    (%rax),%esi
mov    0x2c57(%rip),%rax
mov    (%rax),%edx
call   1190 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    13a9 <main+0x139>
lea    0xc7f(%rip),%rdi
call   1110 <error@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10c0 <gethostbyname@plt>
mov    %rax,-0x3d0b68(%rbp)
cmpq   $0x0,-0x3d0b68(%rbp)
jne    13e9 <main+0x179>
mov    0x2bfe(%rip),%rax
mov    (%rax),%edi
lea    0xc5d(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
xor    %edi,%edi
call   1160 <exit@plt>
lea    -0x3d0b60(%rbp),%rdi
mov    $0xc,%esi
call   1130 <bzero@plt>
mov    0x2be7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3d0b58(%rbp)
mov    -0x3d0b68(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x3d0b60(%rbp),%rsi
add    $0x4,%rsi
mov    -0x3d0b68(%rbp),%rax
mov    (%rax),%edx
call   1100 <bcopy@plt>
mov    -0x1c(%rbp),%edi
call   1060 <htons@plt>
mov    %eax,-0x3d0b60(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x3d0b60(%rbp),%rsi
mov    $0xc,%edx
call   1170 <connect@plt>
cmp    $0x0,%rax
jge    1465 <main+0x1f5>
lea    0xbed(%rip),%rdi
call   1110 <error@plt>
lea    0xbf2(%rip),%rdi
call   1070 <printf@plt>
lea    -0x140(%rbp),%rdi
mov    $0x100,%esi
call   1130 <bzero@plt>
lea    0xbdd(%rip),%rdi
call   1070 <printf@plt>
lea    0xc0f(%rip),%rdi
call   1070 <printf@plt>
lea    0xc2f(%rip),%rdi
call   1070 <printf@plt>
lea    -0x140(%rbp),%rdi
call   10e0 <gets@plt>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jg     1503 <main+0x293>
movslq -0x20(%rbp),%rax
movsbl -0x140(%rbp,%rax,1),%eax
ff
movslq -0x20(%rbp),%rcx
movsbl -0x34(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    14f0 <main+0x280>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    14f5 <main+0x285>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    14c0 <main+0x250>
cmpl   $0x4,-0x24(%rbp)
jne    155a <main+0x2ea>
mov    -0x14(%rbp),%eax
mov    %eax,-0x3d0b84(%rbp)
lea    -0x140(%rbp),%rax
mov    %rax,-0x3d0b80(%rbp)
lea    -0x140(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x3d0b84(%rbp),%edi
mov    -0x3d0b80(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
lea    0xbbd(%rip),%rdi
call   1070 <printf@plt>
xor    %edi,%edi
call   1160 <exit@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x3d0b94(%rbp)
lea    -0x140(%rbp),%rax
mov    %rax,-0x3d0b90(%rbp)
lea    -0x140(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x3d0b94(%rbp),%edi
mov    -0x3d0b90(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    15aa <main+0x33a>
lea    0xb6f(%rip),%rdi
call   1110 <error@plt>
lea    -0x3d0a50(%rbp),%rdi
mov    $0x3d0900,%esi
call   1130 <bzero@plt>
lea    -0x140(%rbp),%rdi
mov    $0x100,%esi
call   1130 <bzero@plt>
mov    -0x14(%rbp),%edi
lea    -0x140(%rbp),%rsi
mov    $0xff,%edx
call   10a0 <read@plt>
mov    %eax,-0x18(%rbp)
lea    -0x140(%rbp),%rdi
lea    0xb3b(%rip),%rsi
lea    -0x2c(%rbp),%rdx
call   10f0 <sscanf@plt>
mov    -0x3d0b78(%rbp),%rdi
movl   $0x0,-0x20(%rbp)
mov    0x29b1(%rip),%rax
mov    (%rax),%edx
add    $0x1,%edx
xor    %esi,%esi
call   1080 <memset@plt>
jmp    1620 <main+0x3b0>
mov    -0x3d0b78(%rbp),%rsi
movl   $0x0,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2988(%rip),%rax
mov    (%rax),%edx
call   10a0 <read@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x3d0b78(%rbp),%rdi
mov    -0x28(%rbp),%eax
mov    %eax,-0x3d0b98(%rbp)
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x3d0b98(%rbp),%eax
cmp    %ecx,%eax
jge    169e <main+0x42e>
mov    -0x3d0b78(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x20(%rbp),%rax
mov    %cl,-0x3d0a50(%rbp,%rax,1)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1649 <main+0x3d9>
mov    -0x3d0b78(%rbp),%rdi
mov    -0x18(%rbp),%edx
xor    %esi,%esi
call   1080 <memset@plt>
mov    -0x18(%rbp),%ecx
mov    -0x2c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x18(%rbp)
jle    16ce <main+0x45e>
cmpl   $0x0,-0x2c(%rbp)
jg     16d3 <main+0x463>
jmp    16d8 <main+0x468>
jmp    161b <main+0x3ab>
movslq -0x20(%rbp),%rax
movb   $0x0,-0x3d0a50(%rbp,%rax,1)
cmpl   $0x0,-0x18(%rbp)
jge    16fa <main+0x48a>
lea    0xa3a(%rip),%rdi
call   1110 <error@plt>
lea    0xa48(%rip),%rdi
call   1070 <printf@plt>
lea    -0x3d0b50(%rbp),%rax
mov    %rax,-0x3d0ba0(%rbp)
lea    -0x3d0b50(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x3d0ba0(%rbp),%rdi
mov    %eax,%esi
call   1130 <bzero@plt>
lea    -0x3d0b50(%rbp),%rdi
call   10e0 <gets@plt>
lea    -0x3d0b50(%rbp),%rdi
lea    0xa4a(%rip),%rsi
call   1150 <strcat@plt>
lea    -0x3d0b50(%rbp),%rdi
lea    0xa3d(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x3d0b70(%rbp)
cmp    $0x0,%rax
jne    177d <main+0x50d>
lea    0xa22(%rip),%rdi
call   1110 <error@plt>
lea    -0x3d0a50(%rbp),%rax
mov    %rax,-0x3d0ba8(%rbp)
lea    -0x3d0a50(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x3d0ba8(%rbp),%rdi
mov    %eax,%edx
mov    -0x3d0b70(%rbp),%rcx
mov    $0x1,%esi
call   1180 <fwrite@plt>
mov    -0x3d0b70(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
jmp    1364 <main+0xf4>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3d0b28,%rsp
mov    %rsi,%r13
mov    %edi,%r14d
mov    0x2d1f(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    -0x250(%rbp),%rdi
mov    $0x100,%esi
call   1140 <bzero@plt>
cmp    $0x3,%r14d
jle    15e6 <main+0x366>
mov    0x8(%r13),%rdi
lea    0xd3e(%rip),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
jne    15e6 <main+0x366>
mov    0x18(%r13),%rdi
call   1150 <atoi@plt>
mov    %eax,-0x34(%rbp)
mov    0x2cea(%rip),%r12
mov    %r13,-0x48(%rbp)
jmp    1344 <main+0xc4>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    -0x3d0b50(%rbp),%r13
mov    %r13,%rdi
call   1060 <strlen@plt>
mov    %r13,%rdi
mov    $0x1,%esi
mov    %eax,%edx
mov    %r14,%rcx
call   1190 <fwrite@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    -0x30(%rbp),%edi
call   10a0 <close@plt>
mov    %r15,%r13
movl   $0x0,-0x2c(%rbp)
mov    (%r12),%edi
mov    0x2c72(%rip),%rax
mov    (%rax),%esi
mov    0x2c81(%rip),%rax
mov    (%rax),%edx
call   11a0 <socket@plt>
mov    %eax,%r15d
test   %eax,%eax
jns    1379 <main+0xf9>
lea    0xcaa(%rip),%rdi
call   1120 <error@plt>
mov    0x10(%r13),%rdi
call   10d0 <gethostbyname@plt>
test   %rax,%rax
je     1608 <main+0x388>
mov    %rax,%r14
lea    -0x40(%rbp),%r13
mov    %r13,%rdi
mov    $0xc,%esi
call   1140 <bzero@plt>
mov    (%r12),%eax
mov    %eax,-0x38(%rbp)
mov    0x8(%r14),%rsi
mov    (%r14),%edx
lea    -0x3c(%rbp),%rdi
call   1110 <memmove@plt>
mov    -0x34(%rbp),%edi
call   1070 <htons@plt>
mov    %eax,-0x40(%rbp)
mov    %r15d,%edi
mov    %r13,%rsi
mov    $0xc,%edx
call   1180 <connect@plt>
test   %rax,%rax
jns    13e2 <main+0x162>
lea    0xc6b(%rip),%rdi
call   1120 <error@plt>
lea    0xc70(%rip),%rdi
call   1080 <printf@plt>
lea    -0x150(%rbp),%r12
mov    %r12,%rdi
mov    $0x100,%esi
call   1140 <bzero@plt>
lea    0xcb0(%rip),%rdi
call   1030 <puts@plt>
lea    0xce1(%rip),%rdi
call   1030 <puts@plt>
lea    0xd00(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   10f0 <gets@plt>
mov    -0x150(%rbp),%r14d
mov    %r12,%rdi
call   1060 <strlen@plt>
mov    %r15d,%edi
mov    %r12,%rsi
mov    %eax,%edx
call   1040 <write@plt>
cmp    $0x54495845,%r14d
je     1626 <main+0x3a6>
test   %eax,%eax
jns    1467 <main+0x1e7>
lea    0xbff(%rip),%rdi
call   1120 <error@plt>
lea    -0x3d0b50(%rbp),%rdi
mov    $0x3d0900,%esi
call   1140 <bzero@plt>
lea    -0x150(%rbp),%r14
mov    %r14,%rdi
mov    $0x100,%esi
call   1140 <bzero@plt>
mov    %r15d,%edi
mov    %r14,%rsi
mov    $0xff,%edx
call   10b0 <read@plt>
mov    %r14,%rdi
lea    0xbd3(%rip),%rsi
lea    -0x2c(%rbp),%rdx
call   1100 <sscanf@plt>
mov    0x2b0a(%rip),%rax
mov    (%rax),%edx
add    $0x1,%edx
xor    %r12d,%r12d
mov    %rbx,%rdi
xor    %esi,%esi
call   1090 <memset@plt>
mov    %r15d,-0x30(%rbp)
nopl   0x0(%rax)
mov    0x2ae9(%rip),%rax
mov    (%rax),%edx
mov    %r15d,%edi
mov    %rbx,%rsi
call   10b0 <read@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    1534 <main+0x2b4>
movslq %r12d,%rax
lea    (%rax,%rbp,1),%r13
add    $0xffffffffffc2f4b0,%r13
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rbx,%r15,1),%eax
mov    %al,0x0(%r13,%r15,1)
add    $0x1,%r15
mov    %rbx,%rdi
call   1060 <strlen@plt>
cltq
cmp    %rax,%r15
jl     1510 <main+0x290>
add    %r15d,%r12d
mov    -0x30(%rbp),%r15d
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14d,%edx
call   1090 <memset@plt>
mov    -0x2c(%rbp),%eax
sub    %r14d,%eax
mov    %eax,-0x2c(%rbp)
test   %r14d,%r14d
jle    1557 <main+0x2d7>
test   %eax,%eax
jg     14d0 <main+0x250>
movslq %r12d,%rax
movb   $0x0,-0x3d0b50(%rbp,%rax,1)
test   %r14d,%r14d
jns    1573 <main+0x2f3>
lea    0xb0e(%rip),%rdi
call   1120 <error@plt>
lea    0xbe1(%rip),%rdi
call   1030 <puts@plt>
lea    -0x250(%rbp),%r14
mov    %r14,%rdi
call   1060 <strlen@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1140 <bzero@plt>
mov    %r14,%rdi
call   10f0 <gets@plt>
mov    %r14,%rdi
lea    0xaec(%rip),%rsi
call   1160 <strcat@plt>
mov    %r14,%rdi
lea    0xae3(%rip),%rsi
call   1130 <fopen@plt>
mov    %rax,%r14
test   %rax,%rax
mov    -0x48(%rbp),%r15
mov    0x2a19(%rip),%r12
jne    1310 <main+0x90>
lea    0xac2(%rip),%rdi
call   1120 <error@plt>
jmp    1310 <main+0x90>
mov    0x29e3(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xa06(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
xor    %edi,%edi
call   1170 <exit@plt>
mov    0x29c1(%rip),%rax
mov    (%rax),%edi
lea    0xa1b(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
xor    %edi,%edi
call   1170 <exit@plt>
lea    0xb76(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1170 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i64 }
%struct.sockaddr = type { i32 }
@__const.main.exit2 = [5 x i8] c"EXIT\00"
@BUFSIZ = global i32 0
@stderr = global i32 0
@.str = [27 x i8] c"usage %s -s hostname port\0A\00"
@.str.1 = [3 x i8] c"-s\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str.2 = [21 x i8] c"ERROR opening socket\00"
@.str.3 = [21 x i8] c"ERROR, no such host\0A\00"
@.str.4 = [17 x i8] c"ERROR connecting\00"
@.str.5 = [8 x i8] c"Please \00"
@.str.6 = [62 x i8] c"\0AGive the address from which you would like to get your html\0A\00"
@.str.7 = [44 x i8] c"with GET or GETNEW(for new copy) in front \0A\00"
@.str.8 = [59 x i8] c"or write EXIT+ press enter to terminate the proxy client:\0A\00"
@.str.9 = [9 x i8] c"bye bye\0A\00"
@.str.10 = [24 x i8] c"ERROR writing to socket\00"
@.str.11 = [3 x i8] c"%d\00"
@.str.12 = [26 x i8] c"ERROR reading from socket\00"
@.str.13 = [73 x i8] c"\0A Please, give the name of file which you want to save your the html: \0A\00"
@.str.14 = [6 x i8] c".html\00"
@.str.15 = [2 x i8] c"w\00"
@.str.16 = [27 x i8] c"cant open file or Bad name\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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [5 x i8]
%14 = alloca [256 x i8]
%15 = alloca i8*
%16 = alloca i64
%17 = alloca [4000000 x i8]
%18 = alloca [256 x i8]
%19 = alloca %struct.sockaddr_in
%20 = alloca %struct.hostent*
%21 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%22 = bitcast [5 x i8]* %13 to i8*
%23 = load i32, i32* @BUFSIZ
%24 = add nsw i32 %23, 1
%25 = zext i32 %24 to i64
%26 = call i8* @llvm.stacksave()
store i8* %26, i8** %15
%27 = alloca i8, i64 %25
store i64 %25, i64* %16
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%29 = call i32 @bzero(i8* %28, i32 256)
%30 = load i32, i32* %4
%31 = icmp slt i32 %30, 4
br i1 %31, label %32, label %39
32: ; preds = %2
%33 = load i32, i32* @stderr
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 0
%36 = load i8*, i8** %35
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %36)
%38 = call i32 @exit(i32 0)
unreachable
39: ; preds = %2
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = call i64 @strcmp(i8* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%44 = icmp ne i64 %43, 0
br i1 %44, label %45, label %52
45: ; preds = %39
%46 = load i32, i32* @stderr
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 0
%49 = load i8*, i8** %48
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %49)
%51 = call i32 @exit(i32 0)
unreachable
52: ; preds = %39
br label %53
53: ; preds = %52
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 3
%56 = load i8*, i8** %55
%57 = call i32 @atoi(i8* %56)
store i32 %57, i32* %8
br label %58
58: ; preds = %227, %53
br label %59
59: ; preds = %58
store i32 0, i32* %12
%60 = load i32, i32* @AF_INET
%61 = load i32, i32* @SOCK_STREAM
%62 = load i32, i32* @IPPROTO_TCP
%63 = call i32 @socket(i32 %60, i32 %61, i32 %62)
store i32 %63, i32* %6
%64 = load i32, i32* %6
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %59
%67 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %68
68: ; preds = %66, %59
%69 = load i8**, i8*** %5
%70 = getelementptr inbounds i8*, i8** %69, i64 2
%71 = load i8*, i8** %70
%72 = call %struct.hostent* @gethostbyname(i8* %71)
store %struct.hostent* %72, %struct.hostent** %20
%73 = load %struct.hostent*, %struct.hostent** %20
%74 = icmp eq %struct.hostent* %73, null
br i1 %74, label %75, label %79
75: ; preds = %68
%76 = load i32, i32* @stderr
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%78 = call i32 @exit(i32 0)
unreachable
79: ; preds = %68
%80 = bitcast %struct.sockaddr_in* %19 to i8*
%81 = call i32 @bzero(i8* %80, i32 12)
%82 = load i32, i32* @AF_INET
%83 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %19, i32 0, i32 2
store i32 %82, i32* %83
%84 = load %struct.hostent*, %struct.hostent** %20
%85 = getelementptr inbounds %struct.hostent, %struct.hostent* %84, i32 0, i32 1
%86 = load i64, i64* %85
%87 = inttoptr i64 %86 to i8*
%88 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %19, i32 0, i32 1
%89 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %88, i32 0, i32 0
%90 = bitcast i32* %89 to i8*
%91 = load %struct.hostent*, %struct.hostent** %20
%92 = getelementptr inbounds %struct.hostent, %struct.hostent* %91, i32 0, i32 0
%93 = load i32, i32* %92
%94 = call i32 @bcopy(i8* %87, i8* %90, i32 %93)
%95 = load i32, i32* %8
%96 = call i32 @htons(i32 %95)
%97 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %19, i32 0, i32 0
store i32 %96, i32* %97
%98 = load i32, i32* %6
%99 = bitcast %struct.sockaddr_in* %19 to %struct.sockaddr*
%100 = call i64 @connect(i32 %98, %struct.sockaddr* %99, i32 12)
%101 = icmp slt i64 %100, 0
br i1 %101, label %102, label %104
102: ; preds = %79
%103 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %104
104: ; preds = %102, %79
%105 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%106 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%107 = call i32 @bzero(i8* %106, i32 256)
%108 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.6, i64 0, i64 0))
%109 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0))
%110 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.8, i64 0, i64 0))
%111 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%112 = call i32 @gets(i8* %111)
store i32 0, i32* %10
store i32 0, i32* %9
br label %113
113: ; preds = %132, %104
%114 = load i32, i32* %9
%115 = icmp sle i32 %114, 3
br i1 %115, label %116, label %135
116: ; preds = %113
%117 = load i32, i32* %9
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 %118
%120 = load i8, i8* %119
%121 = sext i8 %120 to i32
%122 = load i32, i32* %9
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 %123
%125 = load i8, i8* %124
%126 = sext i8 %125 to i32
%127 = icmp eq i32 %121, %126
br i1 %127, label %128, label %131
128: ; preds = %116
%129 = load i32, i32* %10
%130 = add nsw i32 %129, 1
store i32 %130, i32* %10
br label %131
131: ; preds = %128, %116
br label %132
132: ; preds = %131
%133 = load i32, i32* %9
%134 = add nsw i32 %133, 1
store i32 %134, i32* %9
br label %113
135: ; preds = %113
%136 = load i32, i32* %10
%137 = icmp eq i32 %136, 4
br i1 %137, label %138, label %146
138: ; preds = %135
%139 = load i32, i32* %6
%140 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%141 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%142 = call i32 @strlen(i8* %141)
%143 = call i32 @write(i32 %139, i8* %140, i32 %142)
store i32 %143, i32* %7
%144 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
%145 = call i32 @exit(i32 0)
unreachable
146: ; preds = %135
%147 = load i32, i32* %6
%148 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%149 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%150 = call i32 @strlen(i8* %149)
%151 = call i32 @write(i32 %147, i8* %148, i32 %150)
store i32 %151, i32* %7
%152 = load i32, i32* %7
%153 = icmp slt i32 %152, 0
br i1 %153, label %154, label %156
154: ; preds = %146
%155 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
br label %156
156: ; preds = %154, %146
%157 = getelementptr inbounds [4000000 x i8], [4000000 x i8]* %17, i64 0, i64 0
%158 = call i32 @bzero(i8* %157, i32 4000000)
%159 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%160 = call i32 @bzero(i8* %159, i32 256)
%161 = load i32, i32* %6
%162 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%163 = call i32 @read(i32 %161, i8* %162, i32 255)
store i32 %163, i32* %7
%164 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%165 = call i32 @sscanf(i8* %164, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32* %12)
store i32 0, i32* %9
%166 = load i32, i32* @BUFSIZ
%167 = add nsw i32 %166, 1
%168 = call i32 @memset(i8* %27, i32 0, i32 %167)
br label %169
169: ; preds = %203, %156
br label %170
170: ; preds = %169
store i32 0, i32* %7
%171 = load i32, i32* %6
%172 = load i32, i32* @BUFSIZ
%173 = call i32 @read(i32 %171, i8* %27, i32 %172)
store i32 %173, i32* %7
store i32 0, i32* %11
br label %174
174: ; preds = %188, %170
%175 = load i32, i32* %11
%176 = call i32 @strlen(i8* %27)
%177 = icmp slt i32 %175, %176
br i1 %177, label %178, label %191
178: ; preds = %174
%179 = load i32, i32* %11
%180 = sext i32 %179 to i64
%181 = getelementptr inbounds i8, i8* %27, i64 %180
%182 = load i8, i8* %181
%183 = load i32, i32* %9
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds [4000000 x i8], [4000000 x i8]* %17, i64 0, i64 %184
store i8 %182, i8* %185
%186 = load i32, i32* %9
%187 = add nsw i32 %186, 1
store i32 %187, i32* %9
br label %188
188: ; preds = %178
%189 = load i32, i32* %11
%190 = add nsw i32 %189, 1
store i32 %190, i32* %11
br label %174
191: ; preds = %174
%192 = load i32, i32* %7
%193 = call i32 @memset(i8* %27, i32 0, i32 %192)
%194 = load i32, i32* %7
%195 = load i32, i32* %12
%196 = sub nsw i32 %195, %194
store i32 %196, i32* %12
%197 = load i32, i32* %7
%198 = icmp sle i32 %197, 0
br i1 %198, label %202, label %199
199: ; preds = %191
%200 = load i32, i32* %12
%201 = icmp sle i32 %200, 0
br i1 %201, label %202, label %203
202: ; preds = %199, %191
br label %204
203: ; preds = %199
br label %169
204: ; preds = %202
%205 = load i32, i32* %9
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds [4000000 x i8], [4000000 x i8]* %17, i64 0, i64 %206
store i8 0, i8* %207
%208 = load i32, i32* %7
%209 = icmp slt i32 %208, 0
br i1 %209, label %210, label %212
210: ; preds = %204
%211 = call i32 @error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0))
br label %212
212: ; preds = %210, %204
%213 = call i32 @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.13, i64 0, i64 0))
%214 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%215 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%216 = call i32 @strlen(i8* %215)
%217 = call i32 @bzero(i8* %214, i32 %216)
%218 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%219 = call i32 @gets(i8* %218)
%220 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%221 = call i32 @strcat(i8* %220, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0))
%222 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%223 = call i32* @fopen(i8* %222, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
store i32* %223, i32** %21
%224 = icmp eq i32* %223, null
br i1 %224, label %225, label %227
225: ; preds = %212
%226 = call i32 @error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.16, i64 0, i64 0))
br label %227
227: ; preds = %225, %212
%228 = getelementptr inbounds [4000000 x i8], [4000000 x i8]* %17, i64 0, i64 0
%229 = getelementptr inbounds [4000000 x i8], [4000000 x i8]* %17, i64 0, i64 0
%230 = call i32 @strlen(i8* %229)
%231 = load i32*, i32** %21
%232 = call i32 @fwrite(i8* %228, i32 1, i32 %230, i32* %231)
%233 = load i32*, i32** %21
%234 = call i32 @fclose(i32* %233)
%235 = load i32, i32* %6
%236 = call i32 @close(i32 %235)
br label %58
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
%struct.hostent = type { i32, i64 }
@BUFSIZ = global i32 0
@stderr = global i32 0
@.str = [27 x i8] c"usage %s -s hostname port\0A\00"
@.str.1 = [3 x i8] c"-s\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str.2 = [21 x i8] c"ERROR opening socket\00"
@.str.3 = [21 x i8] c"ERROR, no such host\0A\00"
@.str.4 = [17 x i8] c"ERROR connecting\00"
@.str.5 = [8 x i8] c"Please \00"
@.str.10 = [24 x i8] c"ERROR writing to socket\00"
@.str.11 = [3 x i8] c"%d\00"
@.str.12 = [26 x i8] c"ERROR reading from socket\00"
@.str.14 = [6 x i8] c".html\00"
@.str.15 = [2 x i8] c"w\00"
@.str.16 = [27 x i8] c"cant open file or Bad name\00"
@str = [61 x i8] c"\0AGive the address from which you would like to get your html\00"
@str.17 = [43 x i8] c"with GET or GETNEW(for new copy) in front \00"
@str.18 = [58 x i8] c"or write EXIT+ press enter to terminate the proxy client:\00"
@str.19 = [72 x i8] c"\0A Please, give the name of file which you want to save your the html: \00"
@str.20 = [8 x i8] c"bye bye\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [256 x i8]
%5 = alloca [4000000 x i8]
%6 = alloca [256 x i8]
%7 = alloca %struct.sockaddr_in
%8 = bitcast i32* %3 to i8*
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%10 = load i32, i32* @BUFSIZ
%11 = add nsw i32 %10, 1
%12 = zext i32 %11 to i64
%13 = alloca i8, i64 %12
%14 = getelementptr inbounds [4000000 x i8], [4000000 x i8]* %5, i64 0, i64 0
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%16 = bitcast %struct.sockaddr_in* %7 to i8*
%17 = call i32 @bzero(i8* %15, i32 256)
%18 = icmp slt i32 %0, 4
br i1 %18, label %19, label %24
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %1
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = tail call i32 @exit(i32 0)
unreachable
24: ; preds = %2
%25 = getelementptr inbounds i8*, i8** %1, i64 1
%26 = load i8*, i8** %25
%27 = tail call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %34, label %29
29: ; preds = %24
%30 = load i32, i32* @stderr
%31 = load i8*, i8** %1
%32 = tail call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %31)
%33 = tail call i32 @exit(i32 0)
unreachable
34: ; preds = %24
%35 = getelementptr inbounds i8*, i8** %1, i64 3
%36 = load i8*, i8** %35
%37 = tail call i32 @atoi(i8* %36)
%38 = getelementptr inbounds i8*, i8** %1, i64 2
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i64 0, i32 2
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i64 0, i32 1, i32 0
%41 = bitcast i32* %40 to i8*
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i64 0, i32 0
%43 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%44 = bitcast [256 x i8]* %4 to i32*
br label %45
45: ; preds = %145, %34
store i32 0, i32* %3
%46 = load i32, i32* @AF_INET
%47 = load i32, i32* @SOCK_STREAM
%48 = load i32, i32* @IPPROTO_TCP
%49 = call i32 @socket(i32 %46, i32 %47, i32 %48)
%50 = icmp slt i32 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %45
%52 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %53
53: ; preds = %51, %45
%54 = load i8*, i8** %38
%55 = call %struct.hostent* @gethostbyname(i8* %54)
%56 = icmp eq %struct.hostent* %55, null
br i1 %56, label %57, label %61
57: ; preds = %53
%58 = load i32, i32* @stderr
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%60 = call i32 @exit(i32 0)
unreachable
61: ; preds = %53
%62 = call i32 @bzero(i8* %16, i32 12)
%63 = load i32, i32* @AF_INET
store i32 %63, i32* %39
%64 = getelementptr inbounds %struct.hostent, %struct.hostent* %55, i64 0, i32 1
%65 = load i64, i64* %64
%66 = inttoptr i64 %65 to i8*
%67 = getelementptr inbounds %struct.hostent, %struct.hostent* %55, i64 0, i32 0
%68 = load i32, i32* %67
%69 = call i32 @htons(i32 %37)
store i32 %69, i32* %42
%70 = call i64 @connect(i32 %49, %struct.sockaddr* %43, i32 12)
%71 = icmp slt i64 %70, 0
br i1 %71, label %72, label %74
72: ; preds = %61
%73 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %74
74: ; preds = %72, %61
%75 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%76 = call i32 @bzero(i8* %9, i32 256)
%77 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str, i64 0, i64 0))
%78 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.17, i64 0, i64 0))
%79 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str.18, i64 0, i64 0))
%80 = call i32 @gets(i8* %9)
%81 = load i32, i32* %44
%82 = icmp eq i32 %81, 1414092869
%83 = call i32 @strlen(i8* %9)
%84 = call i32 @write(i32 %49, i8* %9, i32 %83)
br i1 %82, label %85, label %88
85: ; preds = %74
%86 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.20, i64 0, i64 0))
%87 = call i32 @exit(i32 0)
unreachable
88: ; preds = %74
%89 = icmp slt i32 %84, 0
br i1 %89, label %90, label %92
90: ; preds = %88
%91 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
br label %92
92: ; preds = %90, %88
%93 = call i32 @bzero(i8* %14, i32 4000000)
%94 = call i32 @bzero(i8* %9, i32 256)
%95 = call i32 @read(i32 %49, i8* %9, i32 255)
%96 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32* %3)
%97 = load i32, i32* @BUFSIZ
%98 = add nsw i32 %97, 1
%99 = call i32 @memset(i8* %13, i32 0, i32 %98)
br label %100
100: ; preds = %121, %92
%101 = phi i32 [ 0, %92 ], [ %122, %121 ]
%102 = load i32, i32* @BUFSIZ
%103 = call i32 @read(i32 %49, i8* %13, i32 %102)
%104 = call i32 @strlen(i8* %13)
%105 = icmp sgt i32 %104, 0
br i1 %105, label %106, label %121
106: ; preds = %100
%107 = sext i32 %101 to i64
br label %108
108: ; preds = %106, %108
%109 = phi i64 [ 0, %106 ], [ %115, %108 ]
%110 = phi i64 [ %107, %106 ], [ %114, %108 ]
%111 = getelementptr inbounds i8, i8* %13, i64 %109
%112 = load i8, i8* %111
%113 = getelementptr inbounds [4000000 x i8], [4000000 x i8]* %5, i64 0, i64 %110
store i8 %112, i8* %113
%114 = add nsw i64 %110, 1
%115 = add nuw nsw i64 %109, 1
%116 = call i32 @strlen(i8* %13)
%117 = sext i32 %116 to i64
%118 = icmp slt i64 %115, %117
br i1 %118, label %108, label %119
119: ; preds = %108
%120 = trunc i64 %114 to i32
br label %121
121: ; preds = %119, %100
%122 = phi i32 [ %101, %100 ], [ %120, %119 ]
%123 = call i32 @memset(i8* %13, i32 0, i32 %103)
%124 = load i32, i32* %3
%125 = sub nsw i32 %124, %103
store i32 %125, i32* %3
%126 = icmp slt i32 %103, 1
%127 = icmp slt i32 %125, 1
%128 = select i1 %126, i1 true, i1 %127
br i1 %128, label %129, label %100
129: ; preds = %121
%130 = sext i32 %122 to i64
%131 = getelementptr inbounds [4000000 x i8], [4000000 x i8]* %5, i64 0, i64 %130
store i8 0, i8* %131
%132 = icmp slt i32 %103, 0
br i1 %132, label %133, label %135
133: ; preds = %129
%134 = call i32 @error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0))
br label %135
135: ; preds = %133, %129
%136 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str.19, i64 0, i64 0))
%137 = call i32 @strlen(i8* %15)
%138 = call i32 @bzero(i8* %15, i32 %137)
%139 = call i32 @gets(i8* %15)
%140 = call i32 @strcat(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0))
%141 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
%142 = icmp eq i32* %141, null
br i1 %142, label %143, label %145
143: ; preds = %135
%144 = call i32 @error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.16, i64 0, i64 0))
br label %145
145: ; preds = %143, %135
%146 = call i32 @strlen(i8* %14)
%147 = call i32 @fwrite(i8* %14, i32 1, i32 %146, i32* %141)
%148 = call i32 @fclose(i32* %141)
%149 = call i32 @close(i32 %49)
br label %45
}