#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 */
typedef int /*<<< orphan*/ target;
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
  TYPE_1__ sin_addr;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  scalar_t__ *h_addr_list;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int BUFSIZ;
int INET_ADDRSTRLEN;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ SOCK_STREAM;
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ free(char *);
struct hostent *gethostbyname(char const *);
int /*<<< orphan*/ htons(int const);
int /*<<< orphan*/ *inet_ntop(int /*<<< orphan*/, void *, char *, int);
int /*<<< orphan*/ inet_pton(int /*<<< orphan*/, char *, void *);
char *malloc(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char const *,
                            char const *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sscanf(char *, char *, unsigned int *);
int strlen(char *);
int /*<<< orphan*/ usage();
int main(int argc, const char **argv) {
  if (argc < 3 || argc > 3) {
    usage();
    return 1;
  }
  char ip[INET_ADDRSTRLEN];
  char *head;
  FILE *fp;
  struct hostent *hent;
  const char *domainname = argv[1];
  const char *USERAGENT = "Brutehttp 0.5";
  const int PORT = 80;
  head = malloc(2048);
  fp = fopen(argv[2], "r");
  hent = gethostbyname(domainname);
  if (inet_ntop(AF_INET, (void *)hent->h_addr_list[0], ip, INET_ADDRSTRLEN) ==
      NULL) {
    perror("Can't resolve host");
    return 1;
  }
  struct sockaddr_in target;
  inet_pton(AF_INET, ip, (void *)(&(target.sin_addr.s_addr)));
  target.sin_family = AF_INET;
  target.sin_port = htons(PORT);
  char page[71];
  char buf[BUFSIZ];
  int sock_tcp;
  unsigned int rescode;
  printf("---------------------------------------------------------------------"
         "-----------\n");
  printf("| Directories & Files Names                                          "
         "   |Status|\n");
  printf("---------------------------------------------------------------------"
         "-----------\n");
  while (fgets(page, 70, fp) != NULL) {
    if ((sock_tcp = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
      perror("Could not create socket TCP");
      return 1;
    }
    if (page[strlen(page) - 1] == '\n')
      page[strlen(page) - 1] = '\0';
    printf("\r%-70s", page);
    snprintf(head, 2048,
             "HEAD /%s HTTP/1.1\r\nUser-Agent: %s\r\nHost: %s\r\nAccept: "
             "*/*\r\nConnection: close\r\n\r\n",
             page, USERAGENT, domainname);
    if (connect(sock_tcp, (struct sockaddr *)&target, sizeof(target)) < 0) {
      perror("Could not connect");
      return 1;
    }
    send(sock_tcp, head, strlen(head), 0);
    recv(sock_tcp, buf, BUFSIZ, 0);
    sscanf(buf, "HTTP/1.%*[^ ] %3u[^ ]", &rescode);
    if (rescode != 404)
      printf("\r| %-70s| %d |\n", page, rescode);
  }
  printf("\r-------------------------------------------------------------------"
         "------------\n");
  free(head);
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     125d <main+0x2d>
cmpl   $0x3,-0x8(%rbp)
jle    1270 <main+0x40>
mov    $0x0,%al
call   1110 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    15bf <main+0x38f>
mov    0x2d49(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xc8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x40(%rbp)
lea    0xd4e(%rip),%rax
mov    %rax,-0x48(%rbp)
movl   $0x50,-0x4c(%rbp)
mov    $0x800,%edi
call   10f0 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd34(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x40(%rbp),%rdi
call   10d0 <gethostbyname@plt>
mov    -0xc8(%rbp),%rdx
mov    %rax,-0x38(%rbp)
mov    0x2cea(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rsi
mov    0x2caf(%rip),%rax
mov    (%rax),%ecx
call   1030 <inet_ntop@plt>
cmp    $0x0,%rax
jne    1341 <main+0x111>
lea    0xce7(%rip),%rdi
call   1130 <perror@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x50(%rbp)
jmp    15b8 <main+0x388>
mov    -0xc8(%rbp),%rsi
mov    0x2c99(%rip),%rax
mov    %rax,-0xd8(%rbp)
mov    (%rax),%edi
lea    -0x58(%rbp),%rdx
call   10e0 <inet_pton@plt>
mov    -0xd8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    $0x50,%edi
call   1080 <htons@plt>
mov    %eax,-0x60(%rbp)
mov    0x2c47(%rip),%rax
mov    (%rax),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xd0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xb8(%rbp)
lea    0xc77(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
lea    0xcbb(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
lea    0xc5b(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    $0x46,%esi
call   10c0 <fgets@plt>
cmp    $0x0,%rax
je     158a <main+0x35a>
mov    0x2bf3(%rip),%rax
mov    (%rax),%edi
mov    0x2bd2(%rip),%rax
mov    (%rax),%esi
mov    0x2bd9(%rip),%rax
mov    (%rax),%edx
call   1150 <socket@plt>
mov    %eax,-0xbc(%rbp)
cmp    $0x0,%eax
jge    143c <main+0x20c>
lea    0xca3(%rip),%rdi
call   1130 <perror@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x50(%rbp)
jmp    15b8 <main+0x388>
lea    -0xb0(%rbp),%rdi
call   1070 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0xb0(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    1477 <main+0x247>
lea    -0xb0(%rbp),%rdi
call   1070 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0xb0(%rbp,%rax,1)
lea    -0xb0(%rbp),%rsi
lea    0xc5e(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    -0x28(%rbp),%rdi
lea    -0xb0(%rbp),%rcx
mov    -0x48(%rbp),%r8
mov    -0x40(%rbp),%r9
mov    $0x800,%esi
lea    0xc3f(%rip),%rdx
call   10b0 <snprintf@plt>
mov    -0xbc(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    $0xc,%edx
call   1140 <connect@plt>
cmp    $0x0,%rax
jge    14ed <main+0x2bd>
lea    0xc65(%rip),%rdi
call   1130 <perror@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x50(%rbp)
jmp    15b8 <main+0x388>
mov    -0xbc(%rbp),%eax
mov    %eax,-0xe4(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0xe0(%rbp)
mov    -0x28(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0xe4(%rbp),%edi
mov    -0xe0(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1090 <send@plt>
mov    -0xd0(%rbp),%rsi
mov    -0xbc(%rbp),%edi
mov    0x2a91(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
call   1050 <recv@plt>
mov    -0xd0(%rbp),%rdi
lea    0xbfe(%rip),%rsi
lea    -0xc0(%rbp),%rdx
call   1100 <sscanf@plt>
cmpl   $0x194,-0xc0(%rbp)
je     1585 <main+0x355>
lea    -0xb0(%rbp),%rsi
mov    -0xc0(%rbp),%edx
lea    0xbe4(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    13cf <main+0x19f>
lea    0xbe1(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1040 <free@plt>
mov    -0x30(%rbp),%rdi
call   1060 <fclose@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x50(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
cmp    $0x3,%edi
jne    14b0 <main+0x270>
mov    %rsi,%r14
mov    %rsp,-0x58(%rbp)
mov    0x2d55(%rip),%r13
mov    0x0(%r13),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    0x8(%rsi),%r12
mov    $0x800,%edi
call   1100 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    0x10(%r14),%rdi
lea    0xd71(%rip),%rsi
call   1130 <fopen@plt>
mov    %rax,%r14
mov    %r12,-0x68(%rbp)
mov    %r12,%rdi
call   10e0 <gethostbyname@plt>
mov    0x2d30(%rip),%r15
mov    (%r15),%edi
mov    (%rax),%rax
mov    (%rax),%rsi
mov    0x0(%r13),%ecx
mov    %rbx,%rdx
call   1030 <inet_ntop@plt>
test   %rax,%rax
je     14cb <main+0x28b>
mov    (%r15),%edi
lea    -0x48(%rbp),%rdx
mov    %rbx,%rsi
call   10f0 <inet_pton@plt>
mov    (%r15),%eax
mov    %eax,-0x4c(%rbp)
mov    $0x50,%edi
call   1090 <htons@plt>
mov    %eax,-0x50(%rbp)
mov    0x2cc9(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x60(%rbp)
mov    %rcx,%rsp
mov    %r14,-0x38(%rbp)
lea    0xdfe(%rip),%r14
mov    %r14,%rdi
call   1060 <puts@plt>
lea    0xd9e(%rip),%rdi
call   1060 <puts@plt>
mov    %r14,%rdi
mov    -0x38(%rbp),%rbx
call   1060 <puts@plt>
lea    -0xb0(%rbp),%r12
mov    %r12,%rdi
mov    $0x46,%esi
mov    %rbx,%rdx
call   10d0 <fgets@plt>
test   %rax,%rax
jne    13ac <main+0x16c>
lea    0xe0c(%rip),%rdi
call   1060 <puts@plt>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
mov    %rbx,%rdi
call   1070 <fclose@plt>
xor    %eax,%eax
mov    -0x58(%rbp),%rsp
jmp    14bc <main+0x27c>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12,%rdi
mov    $0x46,%esi
mov    -0x38(%rbp),%rbx
mov    %rbx,%rdx
call   10d0 <fgets@plt>
test   %rax,%rax
mov    %r13,%r15
je     135d <main+0x11d>
mov    %r15,%r13
mov    (%r15),%edi
mov    0x2c17(%rip),%rax
mov    (%rax),%esi
mov    0x2c1e(%rip),%rax
mov    (%rax),%edx
call   1160 <socket@plt>
test   %eax,%eax
js     14d4 <main+0x294>
mov    %eax,%r14d
mov    %r12,%rdi
call   1080 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%r12,1)
jne    13f6 <main+0x1b6>
mov    %r12,%rdi
call   1080 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r12,1)
lea    0xc42(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    -0x40(%rbp),%rbx
mov    %rbx,%rdi
mov    $0x800,%esi
lea    0xc2c(%rip),%rdx
mov    %r12,%rcx
lea    0xbdc(%rip),%r8
mov    -0x68(%rbp),%r9
call   10c0 <snprintf@plt>
mov    %r14d,%edi
lea    -0x50(%rbp),%rsi
mov    $0xc,%edx
call   1150 <connect@plt>
test   %rax,%rax
js     14dd <main+0x29d>
mov    %rbx,%rdi
call   1080 <strlen@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   10a0 <send@plt>
mov    0x2b63(%rip),%rax
mov    (%rax),%edx
mov    %r14d,%edi
mov    -0x60(%rbp),%rbx
mov    %rbx,%rsi
xor    %ecx,%ecx
call   1050 <recv@plt>
mov    %rbx,%rdi
lea    0xc26(%rip),%rsi
lea    -0x2c(%rbp),%rdx
call   1110 <sscanf@plt>
mov    -0x2c(%rbp),%edx
cmp    $0x194,%edx
je     1390 <main+0x150>
lea    0xc1d(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10b0 <printf@plt>
jmp    1390 <main+0x150>
xor    %eax,%eax
call   1120 <usage@plt>
mov    $0x1,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb3e(%rip),%rdi
jmp    14e4 <main+0x2a4>
lea    0xb48(%rip),%rdi
jmp    14e4 <main+0x2a4>
lea    0xbb2(%rip),%rdi
call   1140 <perror@plt>
mov    $0x1,%eax
jmp    137c <main+0x13c>

LLVM IR (-O0):
%struct.hostent = type { i64* }
%struct.sockaddr_in = type { i32, i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@INET_ADDRSTRLEN = global i32 0
@.str = [14 x i8] c"Brutehttp 0.5\00"
@.str.1 = [2 x i8] c"r\00"
@AF_INET = global i32 0
@.str.2 = [19 x i8] c"Can't resolve host\00"
@BUFSIZ = global i32 0
@.str.3 = [82 x i8] c"--------------------------------------------------------------------------------\0A\00"
@.str.4 = [82 x i8] c"| Directories & Files Names |Status|\0A\00"
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str.5 = [28 x i8] c"Could not create socket TCP\00"
@.str.6 = [7 x i8] c"\0D%-70s\00"
@.str.7 = [80 x i8] c"HEAD /%s HTTP/1.1\0D\0AUser-Agent: %s\0D\0AHost: %s\0D\0AAccept: */*\0D\0AConnection: close\0D\0A\0D\0A\00"
@.str.8 = [18 x i8] c"Could not connect\00"
@.str.9 = [22 x i8] c"HTTP/1.%*[^ ] %3u[^ ]\00"
@.str.10 = [16 x i8] c"\0D| %-70s| %d |\0A\00"
@.str.11 = [82 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 i64
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca %struct.hostent*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca %struct.sockaddr_in
%16 = alloca [71 x i8]
%17 = alloca i64
%18 = alloca i32
%19 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 3
br i1 %21, label %25, label %22
22: ; preds = %2
%23 = load i32, i32* %4
%24 = icmp sgt i32 %23, 3
br i1 %24, label %25, label %27
25: ; preds = %22, %2
%26 = call i32 (...) @usage()
store i32 1, i32* %3
br label %137
27: ; preds = %22
%28 = load i32, i32* @INET_ADDRSTRLEN
%29 = zext i32 %28 to i64
%30 = call i8* @llvm.stacksave()
store i8* %30, i8** %6
%31 = alloca i8, i64 %29
store i64 %29, i64* %7
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
store i8* %34, i8** %11
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %12
store i32 80, i32* %13
%35 = call i8* @malloc(i32 2048)
store i8* %35, i8** %8
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i32* @fopen(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %39, i32** %9
%40 = load i8*, i8** %11
%41 = call %struct.hostent* @gethostbyname(i8* %40)
store %struct.hostent* %41, %struct.hostent** %10
%42 = load i32, i32* @AF_INET
%43 = load %struct.hostent*, %struct.hostent** %10
%44 = getelementptr inbounds %struct.hostent, %struct.hostent* %43, i32 0, i32 0
%45 = load i64*, i64** %44
%46 = getelementptr inbounds i64, i64* %45, i64 0
%47 = load i64, i64* %46
%48 = inttoptr i64 %47 to i8*
%49 = load i32, i32* @INET_ADDRSTRLEN
%50 = call i32* @inet_ntop(i32 %42, i8* %48, i8* %31, i32 %49)
%51 = icmp eq i32* %50, null
br i1 %51, label %52, label %54
52: ; preds = %27
%53 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
store i32 1, i32* %14
br label %135
54: ; preds = %27
%55 = load i32, i32* @AF_INET
%56 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %15, i32 0, i32 2
%57 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %56, i32 0, i32 0
%58 = bitcast i32* %57 to i8*
%59 = call i32 @inet_pton(i32 %55, i8* %31, i8* %58)
%60 = load i32, i32* @AF_INET
%61 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %15, i32 0, i32 1
store i32 %60, i32* %61
%62 = call i32 @htons(i32 80)
%63 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %15, i32 0, i32 0
store i32 %62, i32* %63
%64 = load i32, i32* @BUFSIZ
%65 = zext i32 %64 to i64
%66 = alloca i8, i64 %65
store i64 %65, i64* %17
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.3, i64 0, i64 0))
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.4, i64 0, i64 0))
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.3, i64 0, i64 0))
br label %70
70: ; preds = %128, %54
%71 = getelementptr inbounds [71 x i8], [71 x i8]* %16, i64 0, i64 0
%72 = load i32*, i32** %9
%73 = call i32* @fgets(i8* %71, i32 70, i32* %72)
%74 = icmp ne i32* %73, null
br i1 %74, label %75, label %129
75: ; preds = %70
%76 = load i32, i32* @AF_INET
%77 = load i32, i32* @SOCK_STREAM
%78 = load i32, i32* @IPPROTO_TCP
%79 = call i32 @socket(i32 %76, i32 %77, i32 %78)
store i32 %79, i32* %18
%80 = icmp slt i32 %79, 0
br i1 %80, label %81, label %83
81: ; preds = %75
%82 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
store i32 1, i32* %14
br label %135
83: ; preds = %75
%84 = getelementptr inbounds [71 x i8], [71 x i8]* %16, i64 0, i64 0
%85 = call i32 @strlen(i8* %84)
%86 = sub nsw i32 %85, 1
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [71 x i8], [71 x i8]* %16, i64 0, i64 %87
%89 = load i8, i8* %88
%90 = sext i8 %89 to i32
%91 = icmp eq i32 %90, 10
br i1 %91, label %92, label %98
92: ; preds = %83
%93 = getelementptr inbounds [71 x i8], [71 x i8]* %16, i64 0, i64 0
%94 = call i32 @strlen(i8* %93)
%95 = sub nsw i32 %94, 1
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [71 x i8], [71 x i8]* %16, i64 0, i64 %96
store i8 0, i8* %97
br label %98
98: ; preds = %92, %83
%99 = getelementptr inbounds [71 x i8], [71 x i8]* %16, i64 0, i64 0
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %99)
%101 = load i8*, i8** %8
%102 = getelementptr inbounds [71 x i8], [71 x i8]* %16, i64 0, i64 0
%103 = load i8*, i8** %12
%104 = load i8*, i8** %11
%105 = call i32 @snprintf(i8* %101, i32 2048, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.7, i64 0, i64 0), i8* %102, i8* %103, i8* %104)
%106 = load i32, i32* %18
%107 = bitcast %struct.sockaddr_in* %15 to %struct.sockaddr*
%108 = call i64 @connect(i32 %106, %struct.sockaddr* %107, i32 12)
%109 = icmp slt i64 %108, 0
br i1 %109, label %110, label %112
110: ; preds = %98
%111 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %3
store i32 1, i32* %14
br label %135
112: ; preds = %98
%113 = load i32, i32* %18
%114 = load i8*, i8** %8
%115 = load i8*, i8** %8
%116 = call i32 @strlen(i8* %115)
%117 = call i32 @send(i32 %113, i8* %114, i32 %116, i32 0)
%118 = load i32, i32* %18
%119 = load i32, i32* @BUFSIZ
%120 = call i32 @recv(i32 %118, i8* %66, i32 %119, i32 0)
%121 = call i32 @sscanf(i8* %66, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i32* %19)
%122 = load i32, i32* %19
%123 = icmp ne i32 %122, 404
br i1 %123, label %124, label %128
124: ; preds = %112
%125 = getelementptr inbounds [71 x i8], [71 x i8]* %16, i64 0, i64 0
%126 = load i32, i32* %19
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8* %125, i32 %126)
br label %128
128: ; preds = %124, %112
br label %70
129: ; preds = %70
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.11, i64 0, i64 0))
%131 = load i8*, i8** %8
%132 = call i32 @free(i8* %131)
%133 = load i32*, i32** %9
%134 = call i32 @fclose(i32* %133)
store i32 0, i32* %3
store i32 1, i32* %14
br label %135
135: ; preds = %129, %110, %81, %52
%136 = load i8*, i8** %6
br label %137
137: ; preds = %135, %25
%138 = load i32, i32* %3
ret i32 %138
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i64* }
%struct.sockaddr = type { i32 }
@INET_ADDRSTRLEN = global i32 0
@.str = [14 x i8] c"Brutehttp 0.5\00"
@.str.1 = [2 x i8] c"r\00"
@AF_INET = global i32 0
@.str.2 = [19 x i8] c"Can't resolve host\00"
@BUFSIZ = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str.5 = [28 x i8] c"Could not create socket TCP\00"
@.str.6 = [7 x i8] c"\0D%-70s\00"
@.str.7 = [80 x i8] c"HEAD /%s HTTP/1.1\0D\0AUser-Agent: %s\0D\0AHost: %s\0D\0AAccept: */*\0D\0AConnection: close\0D\0A\0D\0A\00"
@.str.8 = [18 x i8] c"Could not connect\00"
@.str.9 = [22 x i8] c"HTTP/1.%*[^ ] %3u[^ ]\00"
@.str.10 = [16 x i8] c"\0D| %-70s| %d |\0A\00"
@str.12 = [81 x i8] c"| Directories & Files Names |Status|\00"
@str.13 = [81 x i8] c"--------------------------------------------------------------------------------\00"
@str.14 = [81 x i8] c"\0D-------------------------------------------------------------------------------\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [71 x i8]
%5 = alloca i32
%6 = icmp eq i32 %0, 3
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 (...) @usage()
br label %101
9: ; preds = %2
%10 = load i32, i32* @INET_ADDRSTRLEN
%11 = zext i32 %10 to i64
%12 = tail call i8* @llvm.stacksave()
%13 = alloca i8, i64 %11
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call dereferenceable_or_null(2048) i8* @malloc(i32 2048)
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = load i8*, i8** %17
%19 = tail call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = tail call %struct.hostent* @gethostbyname(i8* %15)
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.hostent, %struct.hostent* %20, i64 0, i32 0
%23 = load i64*, i64** %22
%24 = load i64, i64* %23
%25 = inttoptr i64 %24 to i8*
%26 = load i32, i32* @INET_ADDRSTRLEN
%27 = call i32* @inet_ntop(i32 %21, i8* %25, i8* %13, i32 %26)
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %31
29: ; preds = %9
%30 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %99
31: ; preds = %9
%32 = bitcast %struct.sockaddr_in* %3 to i8*
%33 = load i32, i32* @AF_INET
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2, i32 0
%35 = bitcast i32* %34 to i8*
%36 = call i32 @inet_pton(i32 %33, i8* %13, i8* %35)
%37 = load i32, i32* @AF_INET
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %37, i32* %38
%39 = call i32 @htons(i32 80)
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %39, i32* %40
%41 = getelementptr inbounds [71 x i8], [71 x i8]* %4, i64 0, i64 0
%42 = load i32, i32* @BUFSIZ
%43 = zext i32 %42 to i64
%44 = alloca i8, i64 %43
%45 = bitcast i32* %5 to i8*
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str.13, i64 0, i64 0))
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str.12, i64 0, i64 0))
%48 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str.13, i64 0, i64 0))
%49 = call i32* @fgets(i8* %41, i32 70, i32* %19)
%50 = icmp eq i32* %49, null
br i1 %50, label %93, label %51
51: ; preds = %31
%52 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
br label %53
53: ; preds = %51, %90
%54 = load i32, i32* @AF_INET
%55 = load i32, i32* @SOCK_STREAM
%56 = load i32, i32* @IPPROTO_TCP
%57 = call i32 @socket(i32 %54, i32 %55, i32 %56)
%58 = icmp slt i32 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %53
%60 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
br label %97
61: ; preds = %53
%62 = call i32 @strlen(i8* %41)
%63 = add nsw i32 %62, -1
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [71 x i8], [71 x i8]* %4, i64 0, i64 %64
%66 = load i8, i8* %65
%67 = icmp eq i8 %66, 10
br i1 %67, label %68, label %73
68: ; preds = %61
%69 = call i32 @strlen(i8* %41)
%70 = add nsw i32 %69, -1
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [71 x i8], [71 x i8]* %4, i64 0, i64 %71
store i8 0, i8* %72
br label %73
73: ; preds = %68, %61
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %41)
%75 = call i32 @snprintf(i8* %16, i32 2048, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.7, i64 0, i64 0), i8* %41, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %15)
%76 = call i64 @connect(i32 %57, %struct.sockaddr* %52, i32 12)
%77 = icmp slt i64 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %73
%79 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
br label %97
80: ; preds = %73
%81 = call i32 @strlen(i8* %16)
%82 = call i32 @send(i32 %57, i8* %16, i32 %81, i32 0)
%83 = load i32, i32* @BUFSIZ
%84 = call i32 @recv(i32 %57, i8* %44, i32 %83, i32 0)
%85 = call i32 @sscanf(i8* %44, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0), i32* %5)
%86 = load i32, i32* %5
%87 = icmp eq i32 %86, 404
br i1 %87, label %90, label %88
88: ; preds = %80
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8* %41, i32 %86)
br label %90
90: ; preds = %88, %80
%91 = call i32* @fgets(i8* %41, i32 70, i32* %19)
%92 = icmp eq i32* %91, null
br i1 %92, label %93, label %53
93: ; preds = %90, %31
%94 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str.14, i64 0, i64 0))
%95 = call i32 @free(i8* %16)
%96 = call i32 @fclose(i32* %19)
br label %97
97: ; preds = %93, %78, %59
%98 = phi i32 [ 1, %59 ], [ 1, %78 ], [ 0, %93 ]
br label %99
99: ; preds = %97, %29
%100 = phi i32 [ 1, %29 ], [ %98, %97 ]
br label %101
101: ; preds = %99, %7
%102 = phi i32 [ 1, %7 ], [ %100, %99 ]
ret i32 %102
}