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

/* Forward declarations */

/* Type definitions */
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef scalar_t__ ssize_t;
typedef int /*<<< orphan*/ request;
typedef int /*<<< orphan*/ address;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fdopen(int, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
int getline(char **, size_t *, int /*<<< orphan*/ *);
int /*<<< orphan*/ htons(int);
scalar_t__ inet_pton(int /*<<< orphan*/, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
char *strchr(char const *, char);
scalar_t__ strcmp(char *, char *);
int strlen(char const *);
scalar_t__ strncmp(char const *, char const *, int);
int /*<<< orphan*/ strncpy(char *, char const *, int);
int /*<<< orphan*/ *strstr(char *, char *);
int strtol(char const *, char **, int);
scalar_t__ write(int, char *, scalar_t__);
int main(int argc, char **argv) {
  if (argc != 2) {
    fprintf(stderr, "Usage: %s url_to_download\n", argv[0]);
    return 127;
  }
  const char *url = argv[1];
  const char *url_prefix = "http://";
  if (strncmp(url_prefix, url, strlen(url_prefix)) == 0)
    url += strlen(url_prefix);
  struct sockaddr_in address;
  memset(&address, 0, sizeof(address));
  address.sin_family = AF_INET;
  const char *path = strchr(url, '/');
  if (path == NULL) {
    fprintf(stderr, "Invalid URL\n");
    return 127;
  }
  if (strlen(path) > 32768) {
    fprintf(stderr, "URL too long\n");
    return 127;
  }
  const char *end = path;
  const char *port = strchr(url, ':');
  int prt = 80;
  if (port != NULL && port < path) {
    char *e;
    prt = strtol(port, &e, 10);
    if (e != path) {
      fprintf(stderr, "Invalid URL\n");
      return 127;
    }
    end = port;
  }
  address.sin_port = htons(prt);
  int ip_length = end - url;
  if (ip_length >= 1023) {
    fprintf(stderr, "Invalid IP specified\n");
    return 127;
  }
  char ip[1024];
  strncpy(ip, url, ip_length);
  ip[ip_length] = 0;
  if (inet_pton(AF_INET, ip, &address.sin_addr) == 0) {
    fprintf(stderr, "inet_pton: Error reading IP from %s\n", ip);
    return 127;
  }
  int sock = socket(AF_INET, SOCK_STREAM, 0);
  if (sock == -1) {
    perror("socket");
    return 126;
  }
  if (connect(sock, (struct sockaddr *)&address, sizeof(address)) == -1) {
    perror("connect");
    return 126;
  }
  char request[65536] = {};
  snprintf(request, sizeof(request), "GET %s HTTP/1.0\r\n\r\n", path);
  ssize_t pos = 0;
  ssize_t limit = strlen(request);
  do {
    ssize_t ret = write(sock, request + pos, limit - pos);
    if (ret == -1) {
      perror("write");
      return 126;
    }
    pos += ret;
  } while (pos < limit);
  int nread;
  size_t len = 0;
  char *line = NULL;
  int firstline = 1;
  int body = 0;
  int error = 0;
  FILE *sock_file = fdopen(sock, "r");
  if (sock_file == NULL) {
    perror("fdopen");
    return 126;
  }
  while ((nread = getline(&line, &len, sock_file)) != -1) {
    if (body) {
      fprintf(error ? stderr : stdout, "%s", line);
      continue;
    }
    if (firstline) {
      if (strstr(line, "200") == NULL) {
        error = 1;
      } else {
        error = 0;
      }
      firstline = 0;
      continue;
    }
    if (strcmp(line, "\r\n") == 0) {
      body = 1;
    }
  }
  free(line);
  fclose(sock_file);
  return error;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x104d0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     128d <main+0x4d>
mov    0x2d6e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd86(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
movl   $0x7f,-0x4(%rbp)
jmp    17ad <main+0x56d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
lea    0xd7b(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x104c8(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x104c0(%rbp)
mov    -0x20(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0x104c8(%rbp),%rdi
mov    -0x104c0(%rbp),%rsi
mov    %eax,%edx
call   1050 <strncmp@plt>
cmp    $0x0,%rax
jne    12fb <main+0xbb>
mov    -0x20(%rbp),%rdi
call   1080 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10c0 <memset@plt>
mov    0x2cd6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x2f,%esi
call   10a0 <strchr@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1357 <main+0x117>
mov    0x2c9d(%rip),%rax
mov    (%rax),%edi
lea    0xcdf(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
movl   $0x7f,-0x4(%rbp)
jmp    17ad <main+0x56d>
mov    -0x38(%rbp),%rdi
call   1080 <strlen@plt>
cmp    $0x8000,%eax
jle    138e <main+0x14e>
mov    0x2c66(%rip),%rax
mov    (%rax),%edi
lea    0xcb5(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
movl   $0x7f,-0x4(%rbp)
jmp    17ad <main+0x56d>
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x3a,%esi
call   10a0 <strchr@plt>
mov    %rax,-0x48(%rbp)
movl   $0x50,-0x4c(%rbp)
cmpq   $0x0,-0x48(%rbp)
je     1416 <main+0x1d6>
mov    -0x48(%rbp),%rax
cmp    -0x38(%rbp),%rax
jae    1416 <main+0x1d6>
mov    -0x48(%rbp),%rdi
lea    -0x58(%rbp),%rsi
mov    $0xa,%edx
call   10f0 <strtol@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x58(%rbp),%rax
cmp    -0x38(%rbp),%rax
je     140e <main+0x1ce>
mov    0x2be6(%rip),%rax
mov    (%rax),%edi
lea    0xc28(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
movl   $0x7f,-0x4(%rbp)
jmp    17ad <main+0x56d>
mov    -0x48(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x4c(%rbp),%edi
call   1090 <htons@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x5c(%rbp)
cmpl   $0x3ff,-0x5c(%rbp)
jl     145f <main+0x21f>
mov    0x2b95(%rip),%rax
mov    (%rax),%edi
lea    0xbf2(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
movl   $0x7f,-0x4(%rbp)
jmp    17ad <main+0x56d>
lea    -0x460(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x5c(%rbp),%edx
call   1040 <strncpy@plt>
movslq -0x5c(%rbp),%rax
movb   $0x0,-0x460(%rbp,%rax,1)
mov    0x2b63(%rip),%rax
mov    (%rax),%edi
lea    -0x460(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1100 <inet_pton@plt>
cmp    $0x0,%rax
jne    14cb <main+0x28b>
mov    0x2b30(%rip),%rax
mov    (%rax),%edi
lea    -0x460(%rbp),%rdx
lea    0xb9c(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
movl   $0x7f,-0x4(%rbp)
jmp    17ad <main+0x56d>
mov    0x2b16(%rip),%rax
mov    (%rax),%edi
mov    0x2af5(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1160 <socket@plt>
mov    %eax,-0x464(%rbp)
cmpl   $0xffffffff,-0x464(%rbp)
jne    150f <main+0x2cf>
lea    0xb7b(%rip),%rdi
call   1120 <perror@plt>
movl   $0x7e,-0x4(%rbp)
jmp    17ad <main+0x56d>
mov    -0x464(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0xc,%edx
call   1140 <connect@plt>
cmp    $0xffffffff,%eax
jne    1544 <main+0x304>
lea    0xb4d(%rip),%rdi
call   1120 <perror@plt>
movl   $0x7e,-0x4(%rbp)
jmp    17ad <main+0x56d>
lea    -0x10470(%rbp),%rdi
xor    %esi,%esi
mov    $0x10000,%edx
call   10c0 <memset@plt>
lea    -0x10470(%rbp),%rdi
mov    -0x38(%rbp),%rcx
mov    $0x10000,%esi
lea    0xb1a(%rip),%rdx
call   10b0 <snprintf@plt>
movq   $0x0,-0x10478(%rbp)
lea    -0x10470(%rbp),%rdi
call   1080 <strlen@plt>
cltq
mov    %rax,-0x10480(%rbp)
mov    -0x464(%rbp),%edi
lea    -0x10470(%rbp),%rsi
add    -0x10478(%rbp),%rsi
mov    -0x10480(%rbp),%rdx
sub    -0x10478(%rbp),%rdx
call   1060 <write@plt>
mov    %rax,-0x10488(%rbp)
cmpq   $0xffffffffffffffff,-0x10488(%rbp)
ff
jne    15e7 <main+0x3a7>
lea    0xac6(%rip),%rdi
call   1120 <perror@plt>
movl   $0x7e,-0x4(%rbp)
jmp    17ad <main+0x56d>
mov    -0x10488(%rbp),%rax
add    -0x10478(%rbp),%rax
mov    %rax,-0x10478(%rbp)
mov    -0x10478(%rbp),%rax
cmp    -0x10480(%rbp),%rax
jl     1593 <main+0x353>
movq   $0x0,-0x10498(%rbp)
movq   $0x0,-0x104a0(%rbp)
movl   $0x1,-0x104a4(%rbp)
movl   $0x0,-0x104a8(%rbp)
movl   $0x0,-0x104ac(%rbp)
mov    -0x464(%rbp),%edi
lea    0xa51(%rip),%rsi
call   1110 <fdopen@plt>
mov    %rax,-0x104b8(%rbp)
cmpq   $0x0,-0x104b8(%rbp)
jne    1683 <main+0x443>
lea    0xa32(%rip),%rdi
call   1120 <perror@plt>
movl   $0x7e,-0x4(%rbp)
jmp    17ad <main+0x56d>
jmp    1688 <main+0x448>
mov    -0x104b8(%rbp),%rdx
lea    -0x104a0(%rbp),%rdi
lea    -0x10498(%rbp),%rsi
call   1130 <getline@plt>
mov    %eax,-0x1048c(%rbp)
cmp    $0xffffffff,%eax
je     178c <main+0x54c>
cmpl   $0x0,-0x104a8(%rbp)
je     170e <main+0x4ce>
cmpl   $0x0,-0x104ac(%rbp)
je     16df <main+0x49f>
mov    0x2906(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x104cc(%rbp)
jmp    16ee <main+0x4ae>
mov    0x28e2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x104cc(%rbp)
mov    -0x104cc(%rbp),%edi
mov    -0x104a0(%rbp),%rdx
lea    0x9a9(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
jmp    1688 <main+0x448>
cmpl   $0x0,-0x104a4(%rbp)
je     1760 <main+0x520>
mov    -0x104a0(%rbp),%rdi
lea    0x985(%rip),%rsi
call   1150 <strstr@plt>
cmp    $0x0,%rax
jne    1747 <main+0x507>
movl   $0x1,-0x104ac(%rbp)
jmp    1751 <main+0x511>
movl   $0x0,-0x104ac(%rbp)
movl   $0x0,-0x104a4(%rbp)
jmp    1688 <main+0x448>
mov    -0x104a0(%rbp),%rdi
lea    0x92b(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
jne    1787 <main+0x547>
movl   $0x1,-0x104a8(%rbp)
jmp    1688 <main+0x448>
mov    -0x104a0(%rbp),%rdi
call   1030 <free@plt>
mov    -0x104b8(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x104ac(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x104d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10438,%rsp
cmp    $0x2,%edi
jne    12ea <main+0xaa>
mov    0x8(%rsi),%rbx
lea    0xdb6(%rip),%rbp
mov    %rbp,%rdi
call   1080 <strlen@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1050 <strncmp@plt>
test   %rax,%rax
jne    1290 <main+0x50>
lea    0xd95(%rip),%rdi
call   1080 <strlen@plt>
cltq
add    %rax,%rbx
lea    0x18(%rsp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10c0 <memset@plt>
mov    0x2d40(%rip),%r12
mov    (%r12),%eax
mov    %eax,0x20(%rsp)
mov    %rbx,%rdi
mov    $0x2f,%esi
call   10a0 <strchr@plt>
test   %rax,%rax
je     1347 <main+0x107>
mov    %rax,%r14
mov    %rax,%rdi
call   1080 <strlen@plt>
cmp    $0x8001,%eax
jl     1306 <main+0xc6>
mov    0x2cf9(%rip),%rax
mov    (%rax),%edi
lea    0xd48(%rip),%rsi
jmp    1357 <main+0x117>
mov    0x2ce7(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xd03(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
jmp    135e <main+0x11e>
mov    %rbx,%rdi
mov    $0x3a,%esi
call   10a0 <strchr@plt>
mov    $0x50,%edi
test   %rax,%rax
je     1377 <main+0x137>
mov    %rax,%r15
mov    %r14,%rbp
cmp    %r14,%rax
jae    1381 <main+0x141>
lea    0x430(%rsp),%rsi
mov    %r15,%rdi
mov    $0xa,%edx
call   10f0 <strtol@plt>
cmp    %r14,0x430(%rsp)
je     137c <main+0x13c>
mov    0x2c8a(%rip),%rax
mov    (%rax),%edi
lea    0xccc(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    $0x7f,%ebx
mov    %ebx,%eax
add    $0x10438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r14,%rbp
jmp    1381 <main+0x141>
mov    %eax,%edi
mov    %r15,%rbp
call   1090 <htons@plt>
mov    %eax,0x1c(%rsp)
sub    %rbx,%rbp
cmp    $0x3ff,%ebp
jl     13a7 <main+0x167>
mov    0x2c3c(%rip),%rax
mov    (%rax),%edi
lea    0xc99(%rip),%rsi
jmp    1357 <main+0x117>
lea    0x30(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <strncpy@plt>
movslq %ebp,%rax
movb   $0x0,0x30(%rsp,%rax,1)
mov    (%r12),%edi
lea    0x18(%rsp),%rdx
mov    %r15,%rsi
call   1100 <inet_pton@plt>
test   %rax,%rax
je     15b3 <main+0x373>
mov    (%r12),%edi
mov    0x2bea(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1160 <socket@plt>
cmp    $0xffffffff,%eax
je     15e6 <main+0x3a6>
mov    %eax,%r12d
lea    0x18(%rsp),%rsi
mov    %eax,%edi
mov    $0xc,%edx
call   1140 <connect@plt>
cmp    $0xffffffff,%eax
je     15ef <main+0x3af>
lea    0x430(%rsp),%r15
xor    %ebp,%ebp
mov    $0x10000,%edx
mov    %r15,%rdi
xor    %esi,%esi
call   10c0 <memset@plt>
lea    0xc53(%rip),%rdx
mov    %r15,%rdi
mov    $0x10000,%esi
mov    %r14,%rcx
call   10b0 <snprintf@plt>
mov    %r15,%rdi
call   1080 <strlen@plt>
movslq %eax,%rbx
lea    (%rsp,%rbp,1),%rsi
add    $0x430,%rsi
mov    %rbx,%rdx
sub    %rbp,%rdx
mov    %r12d,%edi
call   1060 <write@plt>
cmp    $0xffffffffffffffff,%rax
je     15f8 <main+0x3b8>
add    %rax,%rbp
cmp    %rbx,%rbp
jl     1450 <main+0x210>
movq   $0x0,0x28(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xc0e(%rip),%rsi
mov    %r12d,%edi
call   1110 <fdopen@plt>
test   %rax,%rax
je     1601 <main+0x3c1>
mov    %rax,%r14
lea    0x10(%rsp),%rdi
lea    0x28(%rsp),%rsi
mov    %rax,%rdx
call   1130 <getline@plt>
cmp    $0xffffffff,%eax
je     15cd <main+0x38d>
movl   $0x1,0xc(%rsp)
lea    0x10(%rsp),%r12
lea    0x28(%rsp),%r13
lea    0xbcf(%rip),%rbp
xor    %ebx,%ebx
xor    %r15d,%r15d
test   %r15d,%r15d
jne    1523 <main+0x2e3>
jmp    1537 <main+0x2f7>
nopl   0x0(%rax,%rax,1)
mov    (%rax),%edi
mov    0x10(%rsp),%rdx
mov    %rbp,%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
call   1130 <getline@plt>
mov    $0x1,%r15d
cmp    $0xffffffff,%eax
je     15cf <main+0x38f>
test   %r15d,%r15d
je     1537 <main+0x2f7>
mov    0x2aae(%rip),%rax
test   %ebx,%ebx
jne    14f0 <main+0x2b0>
mov    0x2a93(%rip),%rax
jmp    14f0 <main+0x2b0>
mov    0x10(%rsp),%rdi
cmpl   $0x0,0xc(%rsp)
jne    1576 <main+0x336>
lea    0xb4f(%rip),%rsi
call   10d0 <strcmp@plt>
xor    %r15d,%r15d
test   %rax,%rax
sete   %r15b
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
call   1130 <getline@plt>
movl   $0x0,0xc(%rsp)
cmp    $0xffffffff,%eax
jne    151e <main+0x2de>
jmp    15cf <main+0x38f>
lea    0xb31(%rip),%rsi
call   1150 <strstr@plt>
xor    %ebx,%ebx
test   %rax,%rax
sete   %bl
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
call   1130 <getline@plt>
movl   $0x0,0xc(%rsp)
cmp    $0xffffffff,%eax
je     15cf <main+0x38f>
xor    %r15d,%r15d
test   %r15d,%r15d
jne    1523 <main+0x2e3>
jmp    1537 <main+0x2f7>
mov    0x2a1e(%rip),%rax
mov    (%rax),%edi
lea    0xa91(%rip),%rsi
lea    0x30(%rsp),%rdx
jmp    12fd <main+0xbd>
xor    %ebx,%ebx
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1070 <fclose@plt>
jmp    1363 <main+0x123>
lea    0xa8c(%rip),%rdi
jmp    1608 <main+0x3c8>
lea    0xa8a(%rip),%rdi
jmp    1608 <main+0x3c8>
lea    0xa9d(%rip),%rdi
jmp    1608 <main+0x3c8>
lea    0xa9c(%rip),%rdi
call   1120 <perror@plt>
mov    $0x7e,%ebx
jmp    1363 <main+0x123>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [27 x i8] c"Usage: %s url_to_download\0A\00"
@.str.1 = [8 x i8] c"http://\00"
@AF_INET = global i32 0
@.str.2 = [13 x i8] c"Invalid URL\0A\00"
@.str.3 = [14 x i8] c"URL too long\0A\00"
@.str.4 = [22 x i8] c"Invalid IP specified\0A\00"
@.str.5 = [37 x i8] c"inet_pton: Error reading IP from %s\0A\00"
@SOCK_STREAM = global i32 0
@.str.6 = [7 x i8] c"socket\00"
@.str.7 = [8 x i8] c"connect\00"
@.str.8 = [20 x i8] c"GET %s HTTP/1.0\0D\0A\0D\0A\00"
@.str.9 = [6 x i8] c"write\00"
@.str.10 = [2 x i8] c"r\00"
@.str.11 = [7 x i8] c"fdopen\00"
@stdout = global i32 0
@.str.12 = [3 x i8] c"%s\00"
@.str.13 = [4 x i8] c"200\00"
@.str.14 = [3 x i8] c"\0D\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca %struct.sockaddr_in
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i32
%15 = alloca [1024 x i8]
%16 = alloca i32
%17 = alloca [65536 x i8]
%18 = alloca i64
%19 = alloca i64
%20 = alloca i64
%21 = alloca i32
%22 = alloca i64
%23 = alloca i8*
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%28 = load i32, i32* %4
%29 = icmp ne i32 %28, 2
br i1 %29, label %30, label %36
30: ; preds = %2
%31 = load i32, i32* @stderr
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %34)
store i32 127, i32* %3
br label %215
36: ; preds = %2
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
store i8* %39, i8** %6
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %7
%40 = load i8*, i8** %7
%41 = load i8*, i8** %6
%42 = load i8*, i8** %7
%43 = call i32 @strlen(i8* %42)
%44 = call i64 @strncmp(i8* %40, i8* %41, i32 %43)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %52
46: ; preds = %36
%47 = load i8*, i8** %7
%48 = call i32 @strlen(i8* %47)
%49 = load i8*, i8** %6
%50 = sext i32 %48 to i64
%51 = getelementptr inbounds i8, i8* %49, i64 %50
store i8* %51, i8** %6
br label %52
52: ; preds = %46, %36
%53 = call i32 @memset(%struct.sockaddr_in* %8, i32 0, i32 12)
%54 = load i32, i32* @AF_INET
%55 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i32 %54, i32* %55
%56 = load i8*, i8** %6
%57 = call i8* @strchr(i8* %56, i8 signext 47)
store i8* %57, i8** %9
%58 = load i8*, i8** %9
%59 = icmp eq i8* %58, null
br i1 %59, label %60, label %63
60: ; preds = %52
%61 = load i32, i32* @stderr
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i32 127, i32* %3
br label %215
63: ; preds = %52
%64 = load i8*, i8** %9
%65 = call i32 @strlen(i8* %64)
%66 = icmp sgt i32 %65, 32768
br i1 %66, label %67, label %70
67: ; preds = %63
%68 = load i32, i32* @stderr
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
store i32 127, i32* %3
br label %215
70: ; preds = %63
%71 = load i8*, i8** %9
store i8* %71, i8** %10
%72 = load i8*, i8** %6
%73 = call i8* @strchr(i8* %72, i8 signext 58)
store i8* %73, i8** %11
store i32 80, i32* %12
%74 = load i8*, i8** %11
%75 = icmp ne i8* %74, null
br i1 %75, label %76, label %91
76: ; preds = %70
%77 = load i8*, i8** %11
%78 = load i8*, i8** %9
%79 = icmp ult i8* %77, %78
br i1 %79, label %80, label %91
80: ; preds = %76
%81 = load i8*, i8** %11
%82 = call i32 @strtol(i8* %81, i8** %13, i32 10)
store i32 %82, i32* %12
%83 = load i8*, i8** %13
%84 = load i8*, i8** %9
%85 = icmp ne i8* %83, %84
br i1 %85, label %86, label %89
86: ; preds = %80
%87 = load i32, i32* @stderr
%88 = call i32 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i32 127, i32* %3
br label %215
89: ; preds = %80
%90 = load i8*, i8** %11
store i8* %90, i8** %10
br label %91
91: ; preds = %89, %76, %70
%92 = load i32, i32* %12
%93 = call i32 @htons(i32 %92)
%94 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
store i32 %93, i32* %94
%95 = load i8*, i8** %10
%96 = load i8*, i8** %6
%97 = ptrtoint i8* %95 to i64
%98 = ptrtoint i8* %96 to i64
%99 = sub i64 %97, %98
%100 = trunc i64 %99 to i32
store i32 %100, i32* %14
%101 = load i32, i32* %14
%102 = icmp sge i32 %101, 1023
br i1 %102, label %103, label %106
103: ; preds = %91
%104 = load i32, i32* @stderr
%105 = call i32 (i32, i8*, ...) @fprintf(i32 %104, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
store i32 127, i32* %3
br label %215
106: ; preds = %91
%107 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%108 = load i8*, i8** %6
%109 = load i32, i32* %14
%110 = call i32 @strncpy(i8* %107, i8* %108, i32 %109)
%111 = load i32, i32* %14
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 %112
store i8 0, i8* %113
%114 = load i32, i32* @AF_INET
%115 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%116 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
%117 = call i64 @inet_pton(i32 %114, i8* %115, i32* %116)
%118 = icmp eq i64 %117, 0
br i1 %118, label %119, label %123
119: ; preds = %106
%120 = load i32, i32* @stderr
%121 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%122 = call i32 (i32, i8*, ...) @fprintf(i32 %120, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i8* %121)
store i32 127, i32* %3
br label %215
123: ; preds = %106
%124 = load i32, i32* @AF_INET
%125 = load i32, i32* @SOCK_STREAM
%126 = call i32 @socket(i32 %124, i32 %125, i32 0)
store i32 %126, i32* %16
%127 = load i32, i32* %16
%128 = icmp eq i32 %127, -1
br i1 %128, label %129, label %131
129: ; preds = %123
%130 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
store i32 126, i32* %3
br label %215
131: ; preds = %123
%132 = load i32, i32* %16
%133 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%134 = call i32 @connect(i32 %132, %struct.sockaddr* %133, i32 12)
%135 = icmp eq i32 %134, -1
br i1 %135, label %136, label %138
136: ; preds = %131
%137 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
store i32 126, i32* %3
br label %215
138: ; preds = %131
%139 = bitcast [65536 x i8]* %17 to i8*
%140 = getelementptr inbounds [65536 x i8], [65536 x i8]* %17, i64 0, i64 0
%141 = load i8*, i8** %9
%142 = call i32 @snprintf(i8* %140, i32 65536, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %141)
store i64 0, i64* %18
%143 = getelementptr inbounds [65536 x i8], [65536 x i8]* %17, i64 0, i64 0
%144 = call i32 @strlen(i8* %143)
%145 = sext i32 %144 to i64
store i64 %145, i64* %19
br label %146
146: ; preds = %163, %138
%147 = load i32, i32* %16
%148 = getelementptr inbounds [65536 x i8], [65536 x i8]* %17, i64 0, i64 0
%149 = load i64, i64* %18
%150 = getelementptr inbounds i8, i8* %148, i64 %149
%151 = load i64, i64* %19
%152 = load i64, i64* %18
%153 = sub nsw i64 %151, %152
%154 = call i64 @write(i32 %147, i8* %150, i64 %153)
store i64 %154, i64* %20
%155 = load i64, i64* %20
%156 = icmp eq i64 %155, -1
br i1 %156, label %157, label %159
157: ; preds = %146
%158 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
store i32 126, i32* %3
br label %215
159: ; preds = %146
%160 = load i64, i64* %20
%161 = load i64, i64* %18
%162 = add nsw i64 %161, %160
store i64 %162, i64* %18
br label %163
163: ; preds = %159
%164 = load i64, i64* %18
%165 = load i64, i64* %19
%166 = icmp slt i64 %164, %165
br i1 %166, label %146, label %167
167: ; preds = %163
store i64 0, i64* %22
store i8* null, i8** %23
store i32 1, i32* %24
store i32 0, i32* %25
store i32 0, i32* %26
%168 = load i32, i32* %16
%169 = call i32* @fdopen(i32 %168, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i32* %169, i32** %27
%170 = load i32*, i32** %27
%171 = icmp eq i32* %170, null
br i1 %171, label %172, label %174
172: ; preds = %167
%173 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
store i32 126, i32* %3
br label %215
174: ; preds = %167
br label %175
175: ; preds = %208, %202, %189, %174
%176 = load i32*, i32** %27
%177 = call i32 @getline(i8** %23, i64* %22, i32* %176)
store i32 %177, i32* %21
%178 = icmp ne i32 %177, -1
br i1 %178, label %179, label %209
179: ; preds = %175
%180 = load i32, i32* %25
%181 = icmp ne i32 %180, 0
br i1 %181, label %182, label %193
182: ; preds = %179
%183 = load i32, i32* %26
%184 = icmp ne i32 %183, 0
br i1 %184, label %185, label %187
185: ; preds = %182
%186 = load i32, i32* @stderr
br label %189
187: ; preds = %182
%188 = load i32, i32* @stdout
br label %189
189: ; preds = %187, %185
%190 = phi i32 [ %186, %185 ], [ %188, %187 ]
%191 = load i8*, i8** %23
%192 = call i32 (i32, i8*, ...) @fprintf(i32 %190, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %191)
br label %175
193: ; preds = %179
%194 = load i32, i32* %24
%195 = icmp ne i32 %194, 0
br i1 %195, label %196, label %203
196: ; preds = %193
%197 = load i8*, i8** %23
%198 = call i32* @strstr(i8* %197, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0))
%199 = icmp eq i32* %198, null
br i1 %199, label %200, label %201
200: ; preds = %196
store i32 1, i32* %26
br label %202
201: ; preds = %196
store i32 0, i32* %26
br label %202
202: ; preds = %201, %200
store i32 0, i32* %24
br label %175
203: ; preds = %193
%204 = load i8*, i8** %23
%205 = call i64 @strcmp(i8* %204, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0))
%206 = icmp eq i64 %205, 0
br i1 %206, label %207, label %208
207: ; preds = %203
store i32 1, i32* %25
br label %208
208: ; preds = %207, %203
br label %175
209: ; preds = %175
%210 = load i8*, i8** %23
%211 = call i32 @free(i8* %210)
%212 = load i32*, i32** %27
%213 = call i32 @fclose(i32* %212)
%214 = load i32, i32* %26
store i32 %214, i32* %3
br label %215
215: ; preds = %209, %172, %157, %136, %129, %119, %103, %86, %67, %60, %30
%216 = load i32, i32* %3
ret i32 %216
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [27 x i8] c"Usage: %s url_to_download\0A\00"
@.str.1 = [8 x i8] c"http://\00"
@AF_INET = global i32 0
@.str.2 = [13 x i8] c"Invalid URL\0A\00"
@.str.3 = [14 x i8] c"URL too long\0A\00"
@.str.4 = [22 x i8] c"Invalid IP specified\0A\00"
@.str.5 = [37 x i8] c"inet_pton: Error reading IP from %s\0A\00"
@SOCK_STREAM = global i32 0
@.str.6 = [7 x i8] c"socket\00"
@.str.7 = [8 x i8] c"connect\00"
@.str.8 = [20 x i8] c"GET %s HTTP/1.0\0D\0A\0D\0A\00"
@.str.9 = [6 x i8] c"write\00"
@.str.10 = [2 x i8] c"r\00"
@.str.11 = [7 x i8] c"fdopen\00"
@stdout = global i32 0
@.str.12 = [3 x i8] c"%s\00"
@.str.13 = [4 x i8] c"200\00"
@.str.14 = [3 x i8] c"\0D\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca i8*
%5 = alloca [1024 x i8]
%6 = alloca [65536 x i8]
%7 = alloca i64
%8 = alloca i8*
%9 = icmp eq i32 %0, 2
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %1
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %166
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%18 = tail call i64 @strncmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %16, i32 %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %14
%21 = tail call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %16, i64 %22
br label %24
24: ; preds = %20, %14
%25 = phi i8* [ %23, %20 ], [ %16, %14 ]
%26 = bitcast %struct.sockaddr_in* %3 to i8*
%27 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%28 = load i32, i32* @AF_INET
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %28, i32* %29
%30 = call i8* @strchr(i8* dereferenceable(1) %25, i8 signext 47)
%31 = icmp eq i8* %30, null
br i1 %31, label %32, label %35
32: ; preds = %24
%33 = load i32, i32* @stderr
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %164
35: ; preds = %24
%36 = call i32 @strlen(i8* %30)
%37 = icmp sgt i32 %36, 32768
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = load i32, i32* @stderr
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %164
41: ; preds = %35
%42 = call i8* @strchr(i8* dereferenceable(1) %25, i8 signext 58)
%43 = icmp ne i8* %42, null
%44 = icmp ult i8* %42, %30
%45 = select i1 %43, i1 %44, i1 false
br i1 %45, label %46, label %55
46: ; preds = %41
%47 = bitcast i8** %4 to i8*
%48 = call i32 @strtol(i8* %42, i8** %4, i32 10)
%49 = load i8*, i8** %4
%50 = icmp eq i8* %49, %30
br i1 %50, label %51, label %52
51: ; preds = %46
br label %55
52: ; preds = %46
%53 = load i32, i32* @stderr
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %164
55: ; preds = %51, %41
%56 = phi i32 [ 80, %41 ], [ %48, %51 ]
%57 = phi i8* [ %30, %41 ], [ %42, %51 ]
%58 = call i32 @htons(i32 %56)
%59 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %58, i32* %59
%60 = ptrtoint i8* %57 to i64
%61 = ptrtoint i8* %25 to i64
%62 = sub i64 %60, %61
%63 = trunc i64 %62 to i32
%64 = icmp sgt i32 %63, 1022
br i1 %64, label %65, label %68
65: ; preds = %55
%66 = load i32, i32* @stderr
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %164
68: ; preds = %55
%69 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%70 = call i32 @strncpy(i8* %69, i8* %25, i32 %63)
%71 = shl i64 %62, 32
%72 = ashr exact i64 %71, 32
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 %72
store i8 0, i8* %73
%74 = load i32, i32* @AF_INET
%75 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
%76 = call i64 @inet_pton(i32 %74, i8* %69, i32* %75)
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %81
78: ; preds = %68
%79 = load i32, i32* @stderr
%80 = call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i8* %69)
br label %162
81: ; preds = %68
%82 = load i32, i32* @AF_INET
%83 = load i32, i32* @SOCK_STREAM
%84 = call i32 @socket(i32 %82, i32 %83, i32 0)
%85 = icmp eq i32 %84, -1
br i1 %85, label %86, label %88
86: ; preds = %81
%87 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
br label %162
88: ; preds = %81
%89 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%90 = call i32 @connect(i32 %84, %struct.sockaddr* %89, i32 12)
%91 = icmp eq i32 %90, -1
br i1 %91, label %92, label %94
92: ; preds = %88
%93 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
br label %162
94: ; preds = %88
%95 = getelementptr inbounds [65536 x i8], [65536 x i8]* %6, i64 0, i64 0
%96 = call i32 @snprintf(i8* %95, i32 65536, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %30)
%97 = call i32 @strlen(i8* %95)
%98 = sext i32 %97 to i64
br label %99
99: ; preds = %107, %94
%100 = phi i64 [ 0, %94 ], [ %108, %107 ]
%101 = getelementptr inbounds [65536 x i8], [65536 x i8]* %6, i64 0, i64 %100
%102 = sub nsw i64 %98, %100
%103 = call i64 @write(i32 %84, i8* %101, i64 %102)
%104 = icmp eq i64 %103, -1
br i1 %104, label %105, label %107
105: ; preds = %99
%106 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
br label %160
107: ; preds = %99
%108 = add nsw i64 %103, %100
%109 = icmp slt i64 %108, %98
br i1 %109, label %99, label %110
110: ; preds = %107
%111 = bitcast i64* %7 to i8*
store i64 0, i64* %7
%112 = bitcast i8** %8 to i8*
store i8* null, i8** %8
%113 = call i32* @fdopen(i32 %84, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%114 = icmp eq i32* %113, null
br i1 %114, label %118, label %115
115: ; preds = %110
%116 = call i32 @getline(i8** %8, i64* %7, i32* %113)
%117 = icmp eq i32 %116, -1
br i1 %117, label %153, label %140
118: ; preds = %110
%119 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
br label %158
120: ; preds = %144, %123
%121 = phi i32 [ %145, %144 ], [ 1, %123 ]
%122 = icmp eq i32 %121, 0
br i1 %122, label %131, label %123
123: ; preds = %120
%124 = load i32, i32* @stderr
%125 = load i32, i32* @stdout
%126 = select i1 %143, i32 %125, i32 %124
%127 = load i8*, i8** %8
%128 = call i32 (i32, i8*, ...) @fprintf(i32 %126, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %127)
%129 = call i32 @getline(i8** %8, i64* %7, i32* %113)
%130 = icmp eq i32 %129, -1
br i1 %130, label %153, label %120
131: ; preds = %120
%132 = icmp eq i32 %146, 0
%133 = load i8*, i8** %8
br i1 %132, label %147, label %134
134: ; preds = %131
%135 = call i32* @strstr(i8* dereferenceable(1) %133, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0))
%136 = icmp eq i32* %135, null
%137 = zext i1 %136 to i32
%138 = call i32 @getline(i8** %8, i64* %7, i32* %113)
%139 = icmp eq i32 %138, -1
br i1 %139, label %153, label %140
140: ; preds = %115, %134
%141 = phi i32 [ %137, %134 ], [ 0, %115 ]
%142 = phi i32 [ 0, %134 ], [ 1, %115 ]
%143 = icmp eq i32 %141, 0
br label %144
144: ; preds = %140, %147
%145 = phi i32 [ 0, %140 ], [ %150, %147 ]
%146 = phi i32 [ %142, %140 ], [ 0, %147 ]
br label %120
147: ; preds = %131
%148 = call i64 @strcmp(i8* %133, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0))
%149 = icmp eq i64 %148, 0
%150 = zext i1 %149 to i32
%151 = call i32 @getline(i8** %8, i64* %7, i32* %113)
%152 = icmp eq i32 %151, -1
br i1 %152, label %153, label %144
153: ; preds = %134, %147, %123, %115
%154 = phi i32 [ 0, %115 ], [ %141, %123 ], [ %141, %147 ], [ %137, %134 ]
%155 = load i8*, i8** %8
%156 = call i32 @free(i8* %155)
%157 = call i32 @fclose(i32* %113)
br label %158
158: ; preds = %153, %118
%159 = phi i32 [ 126, %118 ], [ %154, %153 ]
br label %160
160: ; preds = %105, %158
%161 = phi i32 [ %159, %158 ], [ 126, %105 ]
br label %162
162: ; preds = %86, %92, %160, %78
%163 = phi i32 [ 127, %78 ], [ 126, %86 ], [ 126, %92 ], [ %161, %160 ]
br label %164
164: ; preds = %52, %162, %65, %38, %32
%165 = phi i32 [ 127, %32 ], [ 127, %38 ], [ 127, %52 ], [ 127, %65 ], [ %163, %162 ]
br label %166
166: ; preds = %164, %10
%167 = phi i32 [ 127, %10 ], [ %165, %164 ]
ret i32 %167
}