#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 hostent {
  int /*<<< orphan*/ h_length;
  scalar_t__ h_addr;
};
typedef int /*<<< orphan*/ host_addr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int atoi(char);
int /*<<< orphan*/ bcopy(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ bzero(char *, int);
scalar_t__ connect(int, struct sockaddr_in *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int read(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, char *, ...);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strlen(char *);
int write(int, char *, int /*<<< orphan*/);
void startProxy(int newsockfd) {
  int n;
  char methode[10];
  char path[100];
  char version[10];
  char host_ad[100];
  char temp[100];
  int sockfd1;
  char buffer[5000];
  bzero(buffer, 5000);
  n = read(newsockfd, buffer, 4999);
  if (n < 0) {
    perror("ERROR reading from socket");
    exit(1);
  }
  int http_portno = 80;
  sscanf(buffer, "%s %s %s", methode, path, version);
  if ((strcmp(methode, "GET") == 0) &&
      ((strcmp(version, "HTTP/1.1")) || (strcmp(version, "HTTP/1.0")))) {
    char null[100];
    sscanf(path, "http://%s", temp);
    int i, j;
    for (i = 0; (i < 100) && (temp[i] != '/') && (temp[i] != ':'); ++i) {
      host_ad[i] = temp[i];
    }
    if (temp[i] == ':') {
      host_ad[i] = '\0';
      http_portno = atoi(host_ad[i + 1]);
    } else {
      host_ad[i] = '\0';
    }
    bzero(path, 100);
    while ((temp[i] != '/') && (temp[i] != '\0')) {
      i++;
    }
    for (j = 0; (i < 100) && (temp[i] != '\0'); ++i, j++) {
      path[j] = temp[i];
    }
    struct sockaddr_in host_addr;
    struct hostent *server;
    sockfd1 = socket(AF_INET, SOCK_STREAM, 0);
    if (sockfd1 < 0) {
      perror("ERROR opening socket");
      exit(1);
    }
    server = gethostbyname(host_ad);
    if (server == NULL) {
      fprintf(stderr, "ERROR, no such host\n");
      exit(0);
    }
    bzero((char *)&host_addr, sizeof(host_addr));
    host_addr.sin_family = AF_INET;
    bcopy((char *)server->h_addr, (char *)&host_addr.sin_addr.s_addr,
          server->h_length);
    host_addr.sin_port = htons(http_portno);
    if (connect(sockfd1, &host_addr, sizeof(host_addr)) < 0) {
      perror("ERROR connecting");
      exit(1);
    }
    bzero(buffer, 5000);
    sprintf(buffer, "GET %s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n",
            path, host_ad);
    printf("%s\n", buffer);
    n = write(sockfd1, buffer, strlen(buffer));
    if (n < 0) {
      perror("ERROR writing to socket");
      exit(1);
    }
    bzero(buffer, 5000);
    do {
      n = read(sockfd1, buffer, 4999);
      if (n < 0) {
        exit(0);
      }
      n = write(newsockfd, buffer, strlen(buffer));
      bzero(buffer, 5000);
    } while (n > 0);
  } else {
    bzero(buffer, 5000);
    sprintf(buffer, "400 BAD REQUEST");
    n = write(newsockfd, buffer, strlen(buffer));
    bzero(buffer, 5000);
  }
}


x86 assembly (clang, -O0):
<startProxy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x15c0,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x14f0(%rbp),%rdi
mov    $0x1388,%esi
call   10e0 <bzero@plt>
mov    -0x4(%rbp),%edi
lea    -0x14f0(%rbp),%rsi
mov    $0x1387,%edx
call   1070 <read@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1266 <startProxy+0x56>
lea    0xda9(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
movl   $0x50,-0x14f4(%rbp)
lea    -0x14f0(%rbp),%rdi
lea    -0x12(%rbp),%rdx
lea    -0x80(%rbp),%rcx
lea    -0x8a(%rbp),%r8
lea    0xd8d(%rip),%rsi
mov    $0x0,%al
call   10b0 <sscanf@plt>
lea    -0x12(%rbp),%rdi
lea    0xd84(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1732 <startProxy+0x522>
lea    -0x8a(%rbp),%rdi
lea    0xd6b(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    12e8 <startProxy+0xd8>
lea    -0x8a(%rbp),%rdi
lea    0xd57(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     1732 <startProxy+0x522>
lea    -0x80(%rbp),%rdi
lea    -0x160(%rbp),%rdx
lea    0xd3f(%rip),%rsi
mov    $0x0,%al
call   10b0 <sscanf@plt>
movl   $0x0,-0x1564(%rbp)
xor    %eax,%eax
cmpl   $0x64,-0x1564(%rbp)
mov    %al,-0x1581(%rbp)
jge    135b <startProxy+0x14b>
movslq -0x1564(%rbp),%rax
movsbl -0x160(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x2f,%ecx
mov    %al,-0x1581(%rbp)
je     135b <startProxy+0x14b>
movslq -0x1564(%rbp),%rax
movsbl -0x160(%rbp,%rax,1),%eax
ff
cmp    $0x3a,%eax
setne  %al
mov    %al,-0x1581(%rbp)
mov    -0x1581(%rbp),%al
test   $0x1,%al
jne    136e <startProxy+0x15e>
jmp    139e <startProxy+0x18e>
movslq -0x1564(%rbp),%rax
mov    -0x160(%rbp,%rax,1),%cl
movslq -0x1564(%rbp),%rax
mov    %cl,-0xf0(%rbp,%rax,1)
mov    -0x1564(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1564(%rbp)
jmp    130b <startProxy+0xfb>
movslq -0x1564(%rbp),%rax
movsbl -0x160(%rbp,%rax,1),%eax
ff
cmp    $0x3a,%eax
jne    13e8 <startProxy+0x1d8>
movslq -0x1564(%rbp),%rax
movb   $0x0,-0xf0(%rbp,%rax,1)
mov    -0x1564(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0xf0(%rbp,%rax,1),%edi
ff
call   10f0 <atoi@plt>
mov    %eax,-0x14f4(%rbp)
jmp    13f7 <startProxy+0x1e7>
movslq -0x1564(%rbp),%rax
movb   $0x0,-0xf0(%rbp,%rax,1)
lea    -0x80(%rbp),%rdi
mov    $0x64,%esi
call   10e0 <bzero@plt>
movslq -0x1564(%rbp),%rax
movsbl -0x160(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x2f,%ecx
mov    %al,-0x1582(%rbp)
je     1440 <startProxy+0x230>
movslq -0x1564(%rbp),%rax
movsbl -0x160(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1582(%rbp)
mov    -0x1582(%rbp),%al
test   $0x1,%al
jne    1453 <startProxy+0x243>
jmp    1467 <startProxy+0x257>
mov    -0x1564(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1564(%rbp)
jmp    1405 <startProxy+0x1f5>
movl   $0x0,-0x1568(%rbp)
xor    %eax,%eax
cmpl   $0x64,-0x1564(%rbp)
mov    %al,-0x1583(%rbp)
jge    14a1 <startProxy+0x291>
movslq -0x1564(%rbp),%rax
movsbl -0x160(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1583(%rbp)
mov    -0x1583(%rbp),%al
test   $0x1,%al
jne    14b4 <startProxy+0x2a4>
jmp    14f0 <startProxy+0x2e0>
movslq -0x1564(%rbp),%rax
mov    -0x160(%rbp,%rax,1),%cl
movslq -0x1568(%rbp),%rax
mov    %cl,-0x80(%rbp,%rax,1)
mov    -0x1564(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1564(%rbp)
mov    -0x1568(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1568(%rbp)
jmp    1471 <startProxy+0x261>
mov    0x2af1(%rip),%rax
mov    (%rax),%edi
mov    0x2ad0(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0x164(%rbp)
cmpl   $0x0,-0x164(%rbp)
jge    1532 <startProxy+0x322>
lea    0xb20(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0xf0(%rbp),%rdi
call   1090 <gethostbyname@plt>
mov    %rax,-0x1580(%rbp)
cmpq   $0x0,-0x1580(%rbp)
jne    156f <startProxy+0x35f>
mov    0x2a7e(%rip),%rax
mov    (%rax),%edi
lea    0xaf5(%rip),%rsi
call   10a0 <fprintf@plt>
xor    %edi,%edi
call   1110 <exit@plt>
lea    -0x1578(%rbp),%rdi
mov    $0xc,%esi
call   10e0 <bzero@plt>
mov    0x2a61(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1570(%rbp)
mov    -0x1580(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x1578(%rbp),%rsi
add    $0x4,%rsi
mov    -0x1580(%rbp),%rax
mov    (%rax),%edx
call   10c0 <bcopy@plt>
mov    -0x14f4(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0x1578(%rbp)
mov    -0x164(%rbp),%edi
lea    -0x1578(%rbp),%rsi
mov    $0xc,%edx
call   1120 <connect@plt>
cmp    $0x0,%rax
jge    15fb <startProxy+0x3eb>
lea    0xa81(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x14f0(%rbp),%rdi
mov    $0x1388,%esi
call   10e0 <bzero@plt>
lea    -0x14f0(%rbp),%rdi
lea    -0x80(%rbp),%rdx
lea    -0xf0(%rbp),%rcx
lea    0xa59(%rip),%rsi
mov    $0x0,%al
call   1100 <sprintf@plt>
lea    -0x14f0(%rbp),%rsi
lea    0xa75(%rip),%rdi
call   1060 <printf@plt>
mov    -0x164(%rbp),%eax
mov    %eax,-0x1594(%rbp)
lea    -0x14f0(%rbp),%rax
mov    %rax,-0x1590(%rbp)
lea    -0x14f0(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1594(%rbp),%edi
mov    -0x1590(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    169c <startProxy+0x48c>
lea    0xa26(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x14f0(%rbp),%rdi
mov    $0x1388,%esi
call   10e0 <bzero@plt>
mov    -0x164(%rbp),%edi
lea    -0x14f0(%rbp),%rsi
mov    $0x1387,%edx
call   1070 <read@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    16d8 <startProxy+0x4c8>
xor    %edi,%edi
call   1110 <exit@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x15a4(%rbp)
lea    -0x14f0(%rbp),%rax
mov    %rax,-0x15a0(%rbp)
lea    -0x14f0(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x15a4(%rbp),%edi
mov    -0x15a0(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,-0x8(%rbp)
lea    -0x14f0(%rbp),%rdi
mov    $0x1388,%esi
call   10e0 <bzero@plt>
cmpl   $0x0,-0x8(%rbp)
jg     16ad <startProxy+0x49d>
jmp    17a3 <startProxy+0x593>
lea    -0x14f0(%rbp),%rdi
mov    $0x1388,%esi
call   10e0 <bzero@plt>
lea    -0x14f0(%rbp),%rdi
lea    0x97a(%rip),%rsi
mov    $0x0,%al
call   1100 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x15b4(%rbp)
lea    -0x14f0(%rbp),%rax
mov    %rax,-0x15b0(%rbp)
lea    -0x14f0(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x15b4(%rbp),%edi
mov    -0x15b0(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,-0x8(%rbp)
lea    -0x14f0(%rbp),%rdi
mov    $0x1388,%esi
call   10e0 <bzero@plt>
add    $0x15c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<startProxy>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x14f8,%rsp
mov    %edi,%r15d
lea    0x170(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1388,%esi
call   10e0 <bzero@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x1387,%edx
call   1070 <read@plt>
test   %eax,%eax
js     158e <startProxy+0x37e>
lea    0xdc2(%rip),%rsi
lea    0x170(%rsp),%rdi
lea    0x16(%rsp),%rbx
lea    0x100(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    %rbx,%rdx
xor    %eax,%eax
call   10b0 <sscanf@plt>
lea    0xda0(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     12ce <startProxy+0xbe>
lea    0x170(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1388,%esi
call   10e0 <bzero@plt>
movups 0xe1f(%rip),%xmm0
movaps %xmm0,0x170(%rsp)
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
jmp    157c <startProxy+0x36c>
lea    0xd52(%rip),%rsi
lea    0xc(%rsp),%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    12fa <startProxy+0xea>
lea    0xd45(%rip),%rsi
lea    0xc(%rsp),%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1290 <startProxy+0x80>
lea    0xd38(%rip),%rsi
lea    0x100(%rsp),%rdi
lea    0x20(%rsp),%rdx
xor    %eax,%eax
call   10b0 <sscanf@plt>
mov    $0x4,%eax
movzbl 0x1c(%rsp,%rax,1),%ecx
cmp    $0x2f,%cl
je     1399 <startProxy+0x189>
cmp    $0x3a,%cl
je     1399 <startProxy+0x189>
mov    %cl,0x8c(%rsp,%rax,1)
movzbl 0x1d(%rsp,%rax,1),%ecx
cmp    $0x2f,%cl
je     139f <startProxy+0x18f>
cmp    $0x3a,%cl
je     139f <startProxy+0x18f>
mov    %cl,0x8d(%rsp,%rax,1)
movzbl 0x1e(%rsp,%rax,1),%ecx
cmp    $0x2f,%cl
je     13a5 <startProxy+0x195>
cmp    $0x3a,%cl
je     13a5 <startProxy+0x195>
mov    %cl,0x8e(%rsp,%rax,1)
movzbl 0x1f(%rsp,%rax,1),%ecx
cmp    $0x2f,%cl
je     13ab <startProxy+0x19b>
cmp    $0x3a,%cl
je     13ab <startProxy+0x19b>
mov    %cl,0x8f(%rsp,%rax,1)
movzbl 0x20(%rsp,%rax,1),%ecx
cmp    $0x2f,%cl
je     13af <startProxy+0x19f>
cmp    $0x3a,%cl
je     13af <startProxy+0x19f>
mov    %cl,0x90(%rsp,%rax,1)
add    $0x5,%rax
cmp    $0x68,%rax
jne    131a <startProxy+0x10a>
mov    $0x64,%eax
jmp    13af <startProxy+0x19f>
add    $0xfffffffffffffffc,%rax
jmp    13af <startProxy+0x19f>
add    $0xfffffffffffffffd,%rax
jmp    13af <startProxy+0x19f>
add    $0xfffffffffffffffe,%rax
jmp    13af <startProxy+0x19f>
add    $0xffffffffffffffff,%rax
mov    %eax,%ebx
cmpb   $0x3a,0x20(%rsp,%rbx,1)
movb   $0x0,0x90(%rsp,%rbx,1)
mov    $0x50,%r14d
jne    13db <startProxy+0x1cb>
lea    0x90(%rsp),%rax
movsbl 0x1(%rbx,%rax,1),%edi
call   10f0 <atoi@plt>
mov    %eax,%r14d
lea    0x100(%rsp),%rdi
mov    $0x64,%esi
call   10e0 <bzero@plt>
nopl   (%rax)
movzbl 0x20(%rsp,%rbx,1),%eax
test   %al,%al
je     1403 <startProxy+0x1f3>
cmp    $0x2f,%al
je     1403 <startProxy+0x1f3>
add    $0x1,%rbx
jmp    13f0 <startProxy+0x1e0>
cmp    $0x63,%ebx
ja     1438 <startProxy+0x228>
mov    $0x64,%ecx
sub    %rbx,%rcx
mov    %ebx,%eax
add    %rsp,%rax
add    $0x20,%rax
mov    %ecx,%ecx
xor    %edx,%edx
nopl   (%rax)
movzbl (%rax,%rdx,1),%ebx
test   %bl,%bl
je     1438 <startProxy+0x228>
mov    %bl,0x100(%rsp,%rdx,1)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1420 <startProxy+0x210>
mov    0x2ba9(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2b87(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
test   %eax,%eax
js     1597 <startProxy+0x387>
mov    %eax,%r13d
lea    0x90(%rsp),%rdi
call   1090 <gethostbyname@plt>
test   %rax,%rax
je     15a0 <startProxy+0x390>
mov    %rax,%rbx
mov    %rsp,%r12
mov    %r12,%rdi
mov    $0xc,%esi
call   10e0 <bzero@plt>
mov    0x0(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    0x8(%rbx),%rsi
lea    0x4(%rsp),%rdi
mov    (%rbx),%edx
call   10c0 <memmove@plt>
mov    %r14d,%edi
call   1050 <htons@plt>
mov    %eax,(%rsp)
mov    %r13d,%edi
mov    %r12,%rsi
mov    $0xc,%edx
call   1120 <connect@plt>
test   %rax,%rax
js     15bc <startProxy+0x3ac>
lea    0x170(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1388,%esi
call   10e0 <bzero@plt>
lea    0xba1(%rip),%rsi
lea    0x100(%rsp),%rdx
lea    0x90(%rsp),%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   1100 <sprintf@plt>
lea    0xbb1(%rip),%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
test   %eax,%eax
js     15c5 <startProxy+0x3b5>
lea    0x170(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1388,%esi
call   10e0 <bzero@plt>
nopl   0x0(%rax,%rax,1)
mov    %r13d,%edi
mov    %rbx,%rsi
mov    $0x1387,%edx
call   1070 <read@plt>
test   %eax,%eax
js     15b5 <startProxy+0x3a5>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x1388,%esi
call   10e0 <bzero@plt>
test   %ebp,%ebp
jg     1540 <startProxy+0x330>
add    $0x14f8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xa6b(%rip),%rdi
jmp    15cc <startProxy+0x3bc>
lea    0xaa5(%rip),%rdi
jmp    15cc <startProxy+0x3bc>
mov    0x2a31(%rip),%rax
mov    (%rax),%edi
lea    0xaa8(%rip),%rsi
call   10a0 <fprintf@plt>
xor    %edi,%edi
call   1110 <exit@plt>
lea    0xaaa(%rip),%rdi
jmp    15cc <startProxy+0x3bc>
lea    0xae7(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i64 }
@.str = [26 x i8] c"ERROR reading from socket\00"
@.str.1 = [9 x i8] c"%s %s %s\00"
@.str.2 = [4 x i8] c"GET\00"
@.str.3 = [9 x i8] c"HTTP/1.1\00"
@.str.4 = [9 x i8] c"HTTP/1.0\00"
@.str.5 = [10 x i8] c"http://%s\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.6 = [21 x i8] c"ERROR opening socket\00"
@stderr = global i32 0
@.str.7 = [21 x i8] c"ERROR, no such host\0A\00"
@.str.8 = [17 x i8] c"ERROR connecting\00"
@.str.9 = [49 x i8] c"GET %s HTTP/1.1\0D\0AHost: %s\0D\0AConnection: close\0D\0A\0D\0A\00"
@.str.10 = [4 x i8] c"%s\0A\00"
@.str.11 = [24 x i8] c"ERROR writing to socket\00"
@.str.12 = [16 x i8] c"400 BAD REQUEST\00"
define void @startProxy(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i8]
%5 = alloca [100 x i8]
%6 = alloca [10 x i8]
%7 = alloca [100 x i8]
%8 = alloca [100 x i8]
%9 = alloca i32
%10 = alloca [5000 x i8]
%11 = alloca i32
%12 = alloca [100 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca %struct.sockaddr_in
%16 = alloca %struct.hostent*
store i32 %0, i32* %2
%17 = getelementptr inbounds [5000 x i8], [5000 x i8]* %10, i64 0, i64 0
%18 = call i32 @bzero(i8* %17, i32 5000)
%19 = load i32, i32* %2
%20 = getelementptr inbounds [5000 x i8], [5000 x i8]* %10, i64 0, i64 0
%21 = call i32 @read(i32 %19, i8* %20, i32 4999)
store i32 %21, i32* %3
%22 = load i32, i32* %3
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %1
%25 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %1
store i32 80, i32* %11
%28 = getelementptr inbounds [5000 x i8], [5000 x i8]* %10, i64 0, i64 0
%29 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%31 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%32 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %28, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %29, i8* %30, i8* %31)
%33 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%34 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %232
36: ; preds = %27
%37 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp ne i64 %38, 0
br i1 %39, label %44, label %40
40: ; preds = %36
%41 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %232
44: ; preds = %40, %36
%45 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%46 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%47 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %45, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %46)
store i32 0, i32* %13
br label %48
48: ; preds = %75, %44
%49 = load i32, i32* %13
%50 = icmp slt i32 %49, 100
br i1 %50, label %51, label %65
51: ; preds = %48
%52 = load i32, i32* %13
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp ne i32 %56, 47
br i1 %57, label %58, label %65
58: ; preds = %51
%59 = load i32, i32* %13
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 %60
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = icmp ne i32 %63, 58
br label %65
65: ; preds = %58, %51, %48
%66 = phi i1 [ false, %51 ], [ false, %48 ], [ %64, %58 ]
br i1 %66, label %67, label %78
67: ; preds = %65
%68 = load i32, i32* %13
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 %69
%71 = load i8, i8* %70
%72 = load i32, i32* %13
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 %73
store i8 %71, i8* %74
br label %75
75: ; preds = %67
%76 = load i32, i32* %13
%77 = add nsw i32 %76, 1
store i32 %77, i32* %13
br label %48
78: ; preds = %65
%79 = load i32, i32* %13
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 %80
%82 = load i8, i8* %81
%83 = sext i8 %82 to i32
%84 = icmp eq i32 %83, 58
br i1 %84, label %85, label %95
85: ; preds = %78
%86 = load i32, i32* %13
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 %87
store i8 0, i8* %88
%89 = load i32, i32* %13
%90 = add nsw i32 %89, 1
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 %91
%93 = load i8, i8* %92
%94 = call i32 @atoi(i8 signext %93)
store i32 %94, i32* %11
br label %99
95: ; preds = %78
%96 = load i32, i32* %13
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 %97
store i8 0, i8* %98
br label %99
99: ; preds = %95, %85
%100 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%101 = call i32 @bzero(i8* %100, i32 100)
br label %102
102: ; preds = %118, %99
%103 = load i32, i32* %13
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 %104
%106 = load i8, i8* %105
%107 = sext i8 %106 to i32
%108 = icmp ne i32 %107, 47
br i1 %108, label %109, label %116
109: ; preds = %102
%110 = load i32, i32* %13
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 %111
%113 = load i8, i8* %112
%114 = sext i8 %113 to i32
%115 = icmp ne i32 %114, 0
br label %116
116: ; preds = %109, %102
%117 = phi i1 [ false, %102 ], [ %115, %109 ]
br i1 %117, label %118, label %121
118: ; preds = %116
%119 = load i32, i32* %13
%120 = add nsw i32 %119, 1
store i32 %120, i32* %13
br label %102
121: ; preds = %116
store i32 0, i32* %14
br label %122
122: ; preds = %142, %121
%123 = load i32, i32* %13
%124 = icmp slt i32 %123, 100
br i1 %124, label %125, label %132
125: ; preds = %122
%126 = load i32, i32* %13
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 %127
%129 = load i8, i8* %128
%130 = sext i8 %129 to i32
%131 = icmp ne i32 %130, 0
br label %132
132: ; preds = %125, %122
%133 = phi i1 [ false, %122 ], [ %131, %125 ]
br i1 %133, label %134, label %147
134: ; preds = %132
%135 = load i32, i32* %13
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 %136
%138 = load i8, i8* %137
%139 = load i32, i32* %14
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %140
store i8 %138, i8* %141
br label %142
142: ; preds = %134
%143 = load i32, i32* %13
%144 = add nsw i32 %143, 1
store i32 %144, i32* %13
%145 = load i32, i32* %14
%146 = add nsw i32 %145, 1
store i32 %146, i32* %14
br label %122
147: ; preds = %132
%148 = load i32, i32* @AF_INET
%149 = load i32, i32* @SOCK_STREAM
%150 = call i32 @socket(i32 %148, i32 %149, i32 0)
store i32 %150, i32* %9
%151 = load i32, i32* %9
%152 = icmp slt i32 %151, 0
br i1 %152, label %153, label %156
153: ; preds = %147
%154 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
%155 = call i32 @exit(i32 1)
unreachable
156: ; preds = %147
%157 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%158 = call %struct.hostent* @gethostbyname(i8* %157)
store %struct.hostent* %158, %struct.hostent** %16
%159 = load %struct.hostent*, %struct.hostent** %16
%160 = icmp eq %struct.hostent* %159, null
br i1 %160, label %161, label %165
161: ; preds = %156
%162 = load i32, i32* @stderr
%163 = call i32 @fprintf(i32 %162, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%164 = call i32 @exit(i32 0)
unreachable
165: ; preds = %156
%166 = bitcast %struct.sockaddr_in* %15 to i8*
%167 = call i32 @bzero(i8* %166, i32 12)
%168 = load i32, i32* @AF_INET
%169 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %15, i32 0, i32 2
store i32 %168, i32* %169
%170 = load %struct.hostent*, %struct.hostent** %16
%171 = getelementptr inbounds %struct.hostent, %struct.hostent* %170, i32 0, i32 1
%172 = load i64, i64* %171
%173 = inttoptr i64 %172 to i8*
%174 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %15, i32 0, i32 1
%175 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %174, i32 0, i32 0
%176 = bitcast i32* %175 to i8*
%177 = load %struct.hostent*, %struct.hostent** %16
%178 = getelementptr inbounds %struct.hostent, %struct.hostent* %177, i32 0, i32 0
%179 = load i32, i32* %178
%180 = call i32 @bcopy(i8* %173, i8* %176, i32 %179)
%181 = load i32, i32* %11
%182 = call i32 @htons(i32 %181)
%183 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %15, i32 0, i32 0
store i32 %182, i32* %183
%184 = load i32, i32* %9
%185 = call i64 @connect(i32 %184, %struct.sockaddr_in* %15, i32 12)
%186 = icmp slt i64 %185, 0
br i1 %186, label %187, label %190
187: ; preds = %165
%188 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%189 = call i32 @exit(i32 1)
unreachable
190: ; preds = %165
%191 = getelementptr inbounds [5000 x i8], [5000 x i8]* %10, i64 0, i64 0
%192 = call i32 @bzero(i8* %191, i32 5000)
%193 = getelementptr inbounds [5000 x i8], [5000 x i8]* %10, i64 0, i64 0
%194 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%195 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%196 = call i32 (i8*, i8*, ...) @sprintf(i8* %193, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.9, i64 0, i64 0), i8* %194, i8* %195)
%197 = getelementptr inbounds [5000 x i8], [5000 x i8]* %10, i64 0, i64 0
%198 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* %197)
%199 = load i32, i32* %9
%200 = getelementptr inbounds [5000 x i8], [5000 x i8]* %10, i64 0, i64 0
%201 = getelementptr inbounds [5000 x i8], [5000 x i8]* %10, i64 0, i64 0
%202 = call i32 @strlen(i8* %201)
%203 = call i32 @write(i32 %199, i8* %200, i32 %202)
store i32 %203, i32* %3
%204 = load i32, i32* %3
%205 = icmp slt i32 %204, 0
br i1 %205, label %206, label %209
206: ; preds = %190
%207 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0))
%208 = call i32 @exit(i32 1)
unreachable
209: ; preds = %190
%210 = getelementptr inbounds [5000 x i8], [5000 x i8]* %10, i64 0, i64 0
%211 = call i32 @bzero(i8* %210, i32 5000)
br label %212
212: ; preds = %228, %209
%213 = load i32, i32* %9
%214 = getelementptr inbounds [5000 x i8], [5000 x i8]* %10, i64 0, i64 0
%215 = call i32 @read(i32 %213, i8* %214, i32 4999)
store i32 %215, i32* %3
%216 = load i32, i32* %3
%217 = icmp slt i32 %216, 0
br i1 %217, label %218, label %220
218: ; preds = %212
%219 = call i32 @exit(i32 0)
unreachable
220: ; preds = %212
%221 = load i32, i32* %2
%222 = getelementptr inbounds [5000 x i8], [5000 x i8]* %10, i64 0, i64 0
%223 = getelementptr inbounds [5000 x i8], [5000 x i8]* %10, i64 0, i64 0
%224 = call i32 @strlen(i8* %223)
%225 = call i32 @write(i32 %221, i8* %222, i32 %224)
store i32 %225, i32* %3
%226 = getelementptr inbounds [5000 x i8], [5000 x i8]* %10, i64 0, i64 0
%227 = call i32 @bzero(i8* %226, i32 5000)
br label %228
228: ; preds = %220
%229 = load i32, i32* %3
%230 = icmp sgt i32 %229, 0
br i1 %230, label %212, label %231
231: ; preds = %228
br label %244
232: ; preds = %40, %27
%233 = getelementptr inbounds [5000 x i8], [5000 x i8]* %10, i64 0, i64 0
%234 = call i32 @bzero(i8* %233, i32 5000)
%235 = getelementptr inbounds [5000 x i8], [5000 x i8]* %10, i64 0, i64 0
%236 = call i32 (i8*, i8*, ...) @sprintf(i8* %235, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0))
%237 = load i32, i32* %2
%238 = getelementptr inbounds [5000 x i8], [5000 x i8]* %10, i64 0, i64 0
%239 = getelementptr inbounds [5000 x i8], [5000 x i8]* %10, i64 0, i64 0
%240 = call i32 @strlen(i8* %239)
%241 = call i32 @write(i32 %237, i8* %238, i32 %240)
store i32 %241, i32* %3
%242 = getelementptr inbounds [5000 x i8], [5000 x i8]* %10, i64 0, i64 0
%243 = call i32 @bzero(i8* %242, i32 5000)
br label %244
244: ; preds = %232, %231
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i64 }
@.str = [26 x i8] c"ERROR reading from socket\00"
@.str.1 = [9 x i8] c"%s %s %s\00"
@.str.2 = [4 x i8] c"GET\00"
@.str.3 = [9 x i8] c"HTTP/1.1\00"
@.str.4 = [9 x i8] c"HTTP/1.0\00"
@.str.5 = [10 x i8] c"http://%s\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.6 = [21 x i8] c"ERROR opening socket\00"
@stderr = global i32 0
@.str.7 = [21 x i8] c"ERROR, no such host\0A\00"
@.str.8 = [17 x i8] c"ERROR connecting\00"
@.str.9 = [49 x i8] c"GET %s HTTP/1.1\0D\0AHost: %s\0D\0AConnection: close\0D\0A\0D\0A\00"
@.str.10 = [4 x i8] c"%s\0A\00"
@.str.11 = [24 x i8] c"ERROR writing to socket\00"
@.str.12 = [16 x i8] c"400 BAD REQUEST\00"
define void @startProxy(i32 %0) {
%2 = alloca [10 x i8]
%3 = alloca [100 x i8]
%4 = alloca [10 x i8]
%5 = alloca [100 x i8]
%6 = alloca [100 x i8]
%7 = alloca [5000 x i8]
%8 = alloca %struct.sockaddr_in
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%14 = getelementptr inbounds [5000 x i8], [5000 x i8]* %7, i64 0, i64 0
%15 = call i32 @bzero(i8* %14, i32 5000)
%16 = call i32 @read(i32 %0, i8* %14, i32 4999)
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %1
%19 = tail call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%20 = tail call i32 @exit(i32 1)
unreachable
21: ; preds = %1
%22 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* %10, i8* %11)
%23 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %161
25: ; preds = %21
%26 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %161, label %31
31: ; preds = %28, %25
%32 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %13)
br label %33
33: ; preds = %57, %31
%34 = phi i64 [ 0, %31 ], [ %59, %57 ]
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 %34
%36 = load i8, i8* %35
switch i8 %36, label %37 [
i8 47, label %61
i8 58, label %61
]
37: ; preds = %33
%38 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %34
store i8 %36, i8* %38
%39 = add nuw nsw i64 %34, 1
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 %39
%41 = load i8, i8* %40
switch i8 %41, label %42 [
i8 47, label %61
i8 58, label %61
]
42: ; preds = %37
%43 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %39
store i8 %41, i8* %43
%44 = add nuw nsw i64 %34, 2
%45 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 %44
%46 = load i8, i8* %45
switch i8 %46, label %47 [
i8 47, label %61
i8 58, label %61
]
47: ; preds = %42
%48 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %44
store i8 %46, i8* %48
%49 = add nuw nsw i64 %34, 3
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 %49
%51 = load i8, i8* %50
switch i8 %51, label %52 [
i8 47, label %61
i8 58, label %61
]
52: ; preds = %47
%53 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %49
store i8 %51, i8* %53
%54 = add nuw nsw i64 %34, 4
%55 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 %54
%56 = load i8, i8* %55
switch i8 %56, label %57 [
i8 47, label %61
i8 58, label %61
]
57: ; preds = %52
%58 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %54
store i8 %56, i8* %58
%59 = add nuw nsw i64 %34, 5
%60 = icmp eq i64 %59, 100
br i1 %60, label %64, label %33
61: ; preds = %52, %52, %47, %47, %42, %42, %37, %37, %33, %33
%62 = phi i64 [ %34, %33 ], [ %34, %33 ], [ %39, %37 ], [ %39, %37 ], [ %44, %42 ], [ %44, %42 ], [ %49, %47 ], [ %49, %47 ], [ %54, %52 ], [ %54, %52 ]
%63 = trunc i64 %62 to i32
br label %64
64: ; preds = %57, %61
%65 = phi i32 [ %63, %61 ], [ 100, %57 ]
%66 = zext i32 %65 to i64
%67 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 %66
%68 = load i8, i8* %67
%69 = icmp eq i8 %68, 58
%70 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %66
store i8 0, i8* %70
br i1 %69, label %71, label %77
71: ; preds = %64
%72 = add nuw nsw i32 %65, 1
%73 = zext i32 %72 to i64
%74 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %73
%75 = load i8, i8* %74
%76 = call i32 @atoi(i8 signext %75)
br label %77
77: ; preds = %64, %71
%78 = phi i32 [ %76, %71 ], [ 80, %64 ]
%79 = call i32 @bzero(i8* %10, i32 100)
br label %80
80: ; preds = %84, %77
%81 = phi i64 [ %85, %84 ], [ %66, %77 ]
%82 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 %81
%83 = load i8, i8* %82
switch i8 %83, label %84 [
i8 47, label %86
i8 0, label %86
]
84: ; preds = %80
%85 = add nuw i64 %81, 1
br label %80
86: ; preds = %80, %80
%87 = trunc i64 %81 to i32
%88 = icmp ult i32 %87, 100
br i1 %88, label %89, label %104
89: ; preds = %86
%90 = and i64 %81, 4294967295
%91 = sub i64 100, %81
%92 = and i64 %91, 4294967295
br label %93
93: ; preds = %89, %99
%94 = phi i64 [ %90, %89 ], [ %101, %99 ]
%95 = phi i64 [ 0, %89 ], [ %102, %99 ]
%96 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 %94
%97 = load i8, i8* %96
%98 = icmp eq i8 %97, 0
br i1 %98, label %104, label %99
99: ; preds = %93
%100 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %95
store i8 %97, i8* %100
%101 = add nuw nsw i64 %94, 1
%102 = add nuw nsw i64 %95, 1
%103 = icmp eq i64 %102, %92
br i1 %103, label %104, label %93
104: ; preds = %93, %99, %86
%105 = bitcast %struct.sockaddr_in* %8 to i8*
%106 = load i32, i32* @AF_INET
%107 = load i32, i32* @SOCK_STREAM
%108 = call i32 @socket(i32 %106, i32 %107, i32 0)
%109 = icmp slt i32 %108, 0
br i1 %109, label %110, label %113
110: ; preds = %104
%111 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
%112 = call i32 @exit(i32 1)
unreachable
113: ; preds = %104
%114 = call %struct.hostent* @gethostbyname(i8* %12)
%115 = icmp eq %struct.hostent* %114, null
br i1 %115, label %116, label %120
116: ; preds = %113
%117 = load i32, i32* @stderr
%118 = call i32 @fprintf(i32 %117, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%119 = call i32 @exit(i32 0)
unreachable
120: ; preds = %113
%121 = call i32 @bzero(i8* %105, i32 12)
%122 = load i32, i32* @AF_INET
%123 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i64 0, i32 2
store i32 %122, i32* %123
%124 = getelementptr inbounds %struct.hostent, %struct.hostent* %114, i64 0, i32 1
%125 = load i64, i64* %124
%126 = inttoptr i64 %125 to i8*
%127 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i64 0, i32 1, i32 0
%128 = bitcast i32* %127 to i8*
%129 = getelementptr inbounds %struct.hostent, %struct.hostent* %114, i64 0, i32 0
%130 = load i32, i32* %129
%131 = call i32 @htons(i32 %78)
%132 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i64 0, i32 0
store i32 %131, i32* %132
%133 = call i64 @connect(i32 %108, %struct.sockaddr_in* %8, i32 12)
%134 = icmp slt i64 %133, 0
br i1 %134, label %135, label %138
135: ; preds = %120
%136 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%137 = call i32 @exit(i32 1)
unreachable
138: ; preds = %120
%139 = call i32 @bzero(i8* %14, i32 5000)
%140 = call i32 (i8*, i8*, ...) @sprintf(i8* %14, i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.9, i64 0, i64 0), i8* %10, i8* %12)
%141 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* %14)
%142 = call i32 @strlen(i8* %14)
%143 = call i32 @write(i32 %108, i8* %14, i32 %142)
%144 = icmp slt i32 %143, 0
br i1 %144, label %145, label %148
145: ; preds = %138
%146 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0))
%147 = call i32 @exit(i32 1)
unreachable
148: ; preds = %138
%149 = call i32 @bzero(i8* %14, i32 5000)
br label %150
150: ; preds = %155, %148
%151 = call i32 @read(i32 %108, i8* %14, i32 4999)
%152 = icmp slt i32 %151, 0
br i1 %152, label %153, label %155
153: ; preds = %150
%154 = call i32 @exit(i32 0)
unreachable
155: ; preds = %150
%156 = call i32 @strlen(i8* %14)
%157 = call i32 @write(i32 %0, i8* %14, i32 %156)
%158 = call i32 @bzero(i8* %14, i32 5000)
%159 = icmp sgt i32 %157, 0
br i1 %159, label %150, label %160
160: ; preds = %155
br label %165
161: ; preds = %28, %21
%162 = call i32 @bzero(i8* %14, i32 5000)
%163 = call i32 @strlen(i8* %14)
%164 = call i32 @write(i32 %0, i8* %14, i32 %163)
br label %165
165: ; preds = %161, %160
ret void
}