#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 */

/* Variables and functions */
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ sendHTTPRequest(char **, char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char const *);
char *getHypertext(const char *url) {
  int foundcolon = 0;
  int foundslash = 0;
  char *url_hostname = (char *)malloc(sizeof(char) * strlen(url));
  char *url_object = (char *)malloc(sizeof(char) * strlen(url));
  char *tempstring = (char *)malloc(sizeof(char) * strlen(url));
  strcpy(tempstring, "\0");
  strcpy(url_object, "\0");
  strcpy(url_hostname, "\0");
  for (unsigned int i = 0, j = 0; i < strlen(url); i++) {
    if (url[i] == ':' && !foundcolon && !foundslash) {
      foundcolon = 1;
      j = i + 1;
      while (url[i + 1] == '/') {
        i++;
        j++;
      }
      continue;
    }
    if (url[i] == '/' && !foundslash) {
      foundcolon = 1;
      j = i + 1;
      foundslash = 1;
      strcpy(url_hostname, tempstring);
      continue;
    }
    tempstring[i - j] = url[i];
    tempstring[i - j + 1] = '\0';
  }
  if (foundslash) {
    strcpy(url_object, tempstring);
  } else {
    strcpy(url_hostname, tempstring);
  }
  free(tempstring);
  if (strcmp(url_object, "\0")) {
    strcat(url_object, "\0");
  }
  char *get_request = (char *)malloc(strlen(url_object) + strlen(url_hostname) +
                                     strlen(url_object) + 25);
  strcpy(get_request, "GET /");
  strcat(get_request, url_object);
  strcat(get_request, " HTTP/1.1\r\nHost: ");
  strcat(get_request, url_hostname);
  strcat(get_request, "\r\n\r\n");
  char *reply;
  char *html = (char *)malloc(200000 * sizeof(char));
  if (!sendHTTPRequest(&reply, url_hostname, get_request)) {
    strcpy(html, "<failed>");
  } else {
    for (int i = 0, j = 0; reply[i] != '\0'; i++) {
      if (!j && reply[i] == '\r' && reply[i + 1] == '\n' &&
          reply[i + 2] == '\r') {
        i += 3;
        j = i + 1;
      } else {
        html[i - j] = reply[i];
        html[i - j + 1] = '\0';
      }
    }
  }
  free(url_object);
  free(url_hostname);
  free(get_request);
  free(reply);
  return html;
}


x86 assembly (clang, -O0):
<getHypertext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe1d(%rip),%rsi
call   1050 <strcpy@plt>
mov    -0x20(%rbp),%rdi
lea    0xe0d(%rip),%rsi
call   1050 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xdfd(%rip),%rsi
call   1050 <strcpy@plt>
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
cmp    %ecx,%eax
jae    1320 <getHypertext+0x1b0>
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3a,%eax
jne    129f <getHypertext+0x12f>
cmpl   $0x0,-0xc(%rbp)
jne    129f <getHypertext+0x12f>
cmpl   $0x0,-0x10(%rbp)
jne    129f <getHypertext+0x12f>
movl   $0x1,-0xc(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    129a <getHypertext+0x12a>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    126a <getHypertext+0xfa>
jmp    1312 <getHypertext+0x1a2>
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    12e6 <getHypertext+0x176>
cmpl   $0x0,-0x10(%rbp)
jne    12e6 <getHypertext+0x176>
movl   $0x1,-0xc(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <strcpy@plt>
jmp    1312 <getHypertext+0x1a2>
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    (%rax,%rcx,1),%dl
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    -0x30(%rbp),%ecx
mov    %ecx,%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    -0x30(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
movb   $0x0,(%rax,%rcx,1)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1216 <getHypertext+0xa6>
cmpl   $0x0,-0x10(%rbp)
je     133c <getHypertext+0x1cc>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <strcpy@plt>
jmp    1349 <getHypertext+0x1d9>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <strcpy@plt>
mov    -0x28(%rbp),%rdi
call   1040 <free@plt>
mov    -0x20(%rbp),%rdi
lea    0xca3(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     137c <getHypertext+0x20c>
mov    -0x20(%rbp),%rdi
lea    0xc89(%rip),%rsi
call   1090 <strcat@plt>
mov    -0x20(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x58(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x58(%rbp),%edi
add    %eax,%edi
add    $0x19,%edi
call   1080 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
lea    0xc42(%rip),%rsi
call   1050 <strcpy@plt>
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1090 <strcat@plt>
mov    -0x38(%rbp),%rdi
lea    0xc2b(%rip),%rsi
call   1090 <strcat@plt>
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1090 <strcat@plt>
mov    -0x38(%rbp),%rdi
lea    0xc20(%rip),%rsi
call   1090 <strcat@plt>
mov    $0x30d40,%edi
call   1080 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x38(%rbp),%rdx
lea    -0x40(%rbp),%rdi
call   1030 <sendHTTPRequest@plt>
cmp    $0x0,%eax
jne    143c <getHypertext+0x2cc>
mov    -0x48(%rbp),%rdi
lea    0xbed(%rip),%rsi
call   1050 <strcpy@plt>
jmp    1510 <getHypertext+0x3a0>
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x40(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     150b <getHypertext+0x39b>
cmpl   $0x0,-0x50(%rbp)
jne    14c9 <getHypertext+0x359>
mov    -0x40(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xd,%eax
jne    14c9 <getHypertext+0x359>
mov    -0x40(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    14c9 <getHypertext+0x359>
mov    -0x40(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xd,%eax
jne    14c9 <getHypertext+0x359>
mov    -0x4c(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    14f8 <getHypertext+0x388>
mov    -0x40(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x48(%rbp),%rax
mov    -0x4c(%rbp),%ecx
sub    -0x50(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x48(%rbp),%rax
mov    -0x4c(%rbp),%ecx
sub    -0x50(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    14fd <getHypertext+0x38d>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    144a <getHypertext+0x2da>
jmp    1510 <getHypertext+0x3a0>
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
mov    -0x18(%rbp),%rdi
call   1040 <free@plt>
mov    -0x38(%rbp),%rdi
call   1040 <free@plt>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
mov    -0x48(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getHypertext>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
call   1060 <strlen@plt>
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,%r12
lea    0xe45(%rip),%r13
mov    %rax,%rdi
mov    %r13,%rsi
call   1050 <strcpy@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1050 <strcpy@plt>
mov    %rbp,(%rsp)
mov    %rbp,%rdi
mov    %r13,%rsi
call   1050 <strcpy@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
je     12a6 <getHypertext+0x136>
mov    %r15,0x10(%rsp)
xor    %r14d,%r14d
xor    %r13d,%r13d
xor    %r15d,%r15d
xor    %ebp,%ebp
jmp    1230 <getHypertext+0xc0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebp,%ecx
sub    %r15d,%ecx
mov    %al,(%r12,%rcx,1)
add    $0x1,%ecx
movb   $0x0,(%r12,%rcx,1)
add    $0x1,%ebp
mov    %rbx,%rdi
call   1060 <strlen@plt>
cmp    %eax,%ebp
jae    1299 <getHypertext+0x129>
mov    %ebp,%eax
mov    (%rbx,%rax,1),%al
cmp    $0x3a,%al
jne    1270 <getHypertext+0x100>
test   %r14d,%r14d
jne    1270 <getHypertext+0x100>
test   %r13d,%r13d
jne    1270 <getHypertext+0x100>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebp
cmpb   $0x2f,(%rbx,%rbp,1)
je     1250 <getHypertext+0xe0>
mov    $0x1,%r14d
xor    %r13d,%r13d
mov    %ebp,%r15d
jmp    1224 <getHypertext+0xb4>
nopw   0x0(%rax,%rax,1)
cmp    $0x2f,%al
jne    1210 <getHypertext+0xa0>
test   %r13d,%r13d
jne    1210 <getHypertext+0xa0>
add    $0x1,%ebp
mov    (%rsp),%rdi
mov    %r12,%rsi
call   1050 <strcpy@plt>
mov    $0x1,%r13d
mov    %ebp,%r15d
mov    $0x1,%r14d
jmp    1224 <getHypertext+0xb4>
mov    0x10(%rsp),%r15
mov    %r15,%rdi
test   %r13d,%r13d
jne    12aa <getHypertext+0x13a>
mov    (%rsp),%rdi
mov    %r12,%rsi
call   1050 <strcpy@plt>
mov    %r12,%rdi
call   1040 <free@plt>
lea    0xd3f(%rip),%rsi
mov    %r15,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     12dd <getHypertext+0x16d>
lea    0xd2b(%rip),%rsi
mov    %r15,%rdi
call   1090 <strcat@plt>
mov    %r15,%rdi
call   1060 <strlen@plt>
mov    %eax,%ebp
mov    (%rsp),%r14
mov    %r14,%rdi
call   1060 <strlen@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1060 <strlen@plt>
add    %ebp,%ebx
lea    (%rax,%rbx,1),%edi
add    $0x19,%edi
call   1080 <malloc@plt>
mov    %rax,%r12
lea    0xcee(%rip),%rsi
mov    %rax,%rdi
call   1050 <strcpy@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1090 <strcat@plt>
lea    0xcda(%rip),%rsi
mov    %r12,%rdi
call   1090 <strcat@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1090 <strcat@plt>
lea    0xcd2(%rip),%rsi
mov    %r12,%rdi
call   1090 <strcat@plt>
mov    $0x30d40,%edi
call   1080 <malloc@plt>
mov    %rax,%rbp
lea    0x8(%rsp),%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1030 <sendHTTPRequest@plt>
test   %eax,%eax
je     13d8 <getHypertext+0x268>
mov    0x8(%rsp),%rax
mov    (%rax),%bl
test   %bl,%bl
je     13e7 <getHypertext+0x277>
xor    %ecx,%ecx
xor    %edx,%edx
jmp    13b4 <getHypertext+0x244>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %edx,%eax
sub    %ecx,%eax
cltq
mov    %bl,0x0(%rbp,%rax,1)
movb   $0x0,0x1(%rbp,%rax,1)
mov    0x8(%rsp),%rax
movslq %edx,%rdx
movzbl 0x1(%rax,%rdx,1),%ebx
add    $0x1,%rdx
test   %bl,%bl
je     13e7 <getHypertext+0x277>
test   %ecx,%ecx
jne    1390 <getHypertext+0x220>
cmp    $0xd,%bl
jne    1390 <getHypertext+0x220>
movslq %edx,%rsi
cmpb   $0xa,0x1(%rsi,%rax,1)
jne    1390 <getHypertext+0x220>
cmpb   $0xd,0x2(%rsi,%rax,1)
jne    1390 <getHypertext+0x220>
mov    %edx,%ecx
add    $0x3,%edx
add    $0x4,%ecx
jmp    13a4 <getHypertext+0x234>
lea    0xc40(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strcpy@plt>
mov    %r15,%rdi
call   1040 <free@plt>
mov    (%rsp),%rdi
call   1040 <free@plt>
mov    %r12,%rdi
call   1040 <free@plt>
mov    0x8(%rsp),%rdi
call   1040 <free@plt>
mov    %rbp,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] zeroinitializer
@.str.1 = [6 x i8] c"GET /\00"
@.str.2 = [18 x i8] c" HTTP/1.1\0D\0AHost: \00"
@.str.3 = [5 x i8] c"\0D\0A\0D\0A\00"
@.str.4 = [9 x i8] c"<failed>\00"
define i8* @getHypertext(i8* %0) {
%2 = alloca i8*
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @strlen(i8* %0)
%7 = tail call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i32 @strlen(i8* %0)
%10 = tail call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i8*
%12 = tail call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = tail call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = tail call i32 @strlen(i8* %0)
%16 = icmp eq i32 %15, 0
br i1 %16, label %60, label %19
17: ; preds = %53
%18 = icmp eq i32 %56, 0
br i1 %18, label %60, label %61
19: ; preds = %1, %53
%20 = phi i32 [ %57, %53 ], [ 0, %1 ]
%21 = phi i32 [ %56, %53 ], [ 0, %1 ]
%22 = phi i32 [ %55, %53 ], [ 0, %1 ]
%23 = phi i32 [ %54, %53 ], [ 0, %1 ]
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %0, i64 %24
%26 = load i8, i8* %25
%27 = icmp ne i8 %26, 58
%28 = icmp ne i32 %20, 0
%29 = select i1 %27, i1 true, i1 %28
%30 = icmp ne i32 %21, 0
%31 = select i1 %29, i1 true, i1 %30
br i1 %31, label %39, label %32
32: ; preds = %19, %32
%33 = phi i32 [ %34, %32 ], [ %23, %19 ]
%34 = add i32 %33, 1
%35 = zext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %0, i64 %35
%37 = load i8, i8* %36
%38 = icmp eq i8 %37, 47
br i1 %38, label %32, label %53
39: ; preds = %19
%40 = icmp ne i8 %26, 47
%41 = select i1 %40, i1 true, i1 %30
br i1 %41, label %45, label %42
42: ; preds = %39
%43 = add nuw i32 %23, 1
%44 = tail call i32 @strcpy(i8* %5, i8* %11)
br label %53
45: ; preds = %39
%46 = sub i32 %23, %22
%47 = zext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %11, i64 %47
store i8 %26, i8* %48
%49 = add i32 %46, 1
%50 = zext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %11, i64 %50
store i8 0, i8* %51
%52 = add nuw i32 %23, 1
br label %53
53: ; preds = %32, %45, %42
%54 = phi i32 [ %52, %45 ], [ %43, %42 ], [ %34, %32 ]
%55 = phi i32 [ %22, %45 ], [ %43, %42 ], [ %34, %32 ]
%56 = phi i32 [ %21, %45 ], [ 1, %42 ], [ 0, %32 ]
%57 = phi i32 [ %20, %45 ], [ 1, %42 ], [ 1, %32 ]
%58 = tail call i32 @strlen(i8* %0)
%59 = icmp ult i32 %54, %58
br i1 %59, label %19, label %17
60: ; preds = %1, %17
br label %61
61: ; preds = %17, %60
%62 = phi i8* [ %5, %60 ], [ %8, %17 ]
%63 = tail call i32 @strcpy(i8* %62, i8* %11)
%64 = tail call i32 @free(i8* %11)
%65 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%66 = icmp eq i64 %65, 0
br i1 %66, label %69, label %67
67: ; preds = %61
%68 = tail call i32 @strcat(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %69
69: ; preds = %67, %61
%70 = tail call i32 @strlen(i8* %8)
%71 = tail call i32 @strlen(i8* %5)
%72 = tail call i32 @strlen(i8* %8)
%73 = add i32 %70, 25
%74 = add i32 %73, %71
%75 = add i32 %74, %72
%76 = tail call i64 @malloc(i32 %75)
%77 = inttoptr i64 %76 to i8*
%78 = tail call i32 @strcpy(i8* %77, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%79 = tail call i32 @strcat(i8* %77, i8* %8)
%80 = tail call i32 @strcat(i8* %77, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%81 = tail call i32 @strcat(i8* %77, i8* %5)
%82 = tail call i32 @strcat(i8* %77, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%83 = bitcast i8** %2 to i8*
%84 = tail call i64 @malloc(i32 200000)
%85 = inttoptr i64 %84 to i8*
%86 = call i32 @sendHTTPRequest(i8** %2, i8* %5, i8* %77)
%87 = icmp eq i32 %86, 0
br i1 %87, label %92, label %88
88: ; preds = %69
%89 = load i8*, i8** %2
%90 = load i8, i8* %89
%91 = icmp eq i8 %90, 0
br i1 %91, label %134, label %94
92: ; preds = %69
%93 = call i32 @strcpy(i8* %85, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %134
94: ; preds = %88, %125
%95 = phi i8* [ %126, %125 ], [ %89, %88 ]
%96 = phi i8 [ %132, %125 ], [ %90, %88 ]
%97 = phi i32 [ %128, %125 ], [ 0, %88 ]
%98 = phi i32 [ %129, %125 ], [ 0, %88 ]
%99 = icmp eq i32 %97, 0
%100 = icmp eq i8 %96, 13
%101 = select i1 %99, i1 %100, i1 false
br i1 %101, label %102, label %117
102: ; preds = %94
%103 = add nsw i32 %98, 1
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds i8, i8* %95, i64 %104
%106 = load i8, i8* %105
%107 = icmp eq i8 %106, 10
br i1 %107, label %108, label %117
108: ; preds = %102
%109 = add nsw i32 %98, 2
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i8, i8* %95, i64 %110
%112 = load i8, i8* %111
%113 = icmp eq i8 %112, 13
br i1 %113, label %114, label %117
114: ; preds = %108
%115 = add nsw i32 %98, 3
%116 = add nsw i32 %98, 4
br label %125
117: ; preds = %108, %102, %94
%118 = sub nsw i32 %98, %97
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds i8, i8* %85, i64 %119
store i8 %96, i8* %120
%121 = add nsw i32 %118, 1
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i8, i8* %85, i64 %122
store i8 0, i8* %123
%124 = load i8*, i8** %2
br label %125
125: ; preds = %114, %117
%126 = phi i8* [ %124, %117 ], [ %95, %114 ]
%127 = phi i32 [ %98, %117 ], [ %115, %114 ]
%128 = phi i32 [ %97, %117 ], [ %116, %114 ]
%129 = add nsw i32 %127, 1
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i8, i8* %126, i64 %130
%132 = load i8, i8* %131
%133 = icmp eq i8 %132, 0
br i1 %133, label %134, label %94
134: ; preds = %125, %88, %92
%135 = call i32 @free(i8* %8)
%136 = call i32 @free(i8* %5)
%137 = call i32 @free(i8* %77)
%138 = load i8*, i8** %2
%139 = call i32 @free(i8* %138)
ret i8* %85
}