#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*/ exit(int /*<<< orphan*/);
char *getHypertext(char *);
int /*<<< orphan*/ printf(char *, ...);
int sendHTTPRequest(char **, char *, char *);
scalar_t__ strcmp(char *, char *);
int main() {
  int status;
  char *reply;
  status = sendHTTPRequest(
      &reply, "208.80.154.224",
      "GET /wiki/Main_Page http/1.1\r\nHost: en.wikipedia.org\r\n\r\n");
  printf("Connection Status(wikipedia):\t%s\n", status ? "OK" : "Failed");
  if (!status)
    exit(0);
  reply = getHypertext("http://127.0.0.1/osir"
                       "/client-interface/echo.php?arg=OK");
  printf("Connection Status(OSIR):\t%s\n", reply);
  if (strcmp(reply, "OK"))
    exit(0);
  printf("\nServer Unit Test Results:\n");
  reply = getHypertext("http://127.0.0.1/osir"
                       "/client-interface/test.php?no_html");
  printf("%s", reply);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
lea    0xe96(%rip),%rsi
lea    0xe9e(%rip),%rdx
call   1030 <sendHTTPRequest@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
lea    0xee7(%rip),%rsi
lea    0xf1b(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    11b0 <main+0x60>
xor    %edi,%edi
call   1070 <exit@plt>
lea    0xeba(%rip),%rdi
call   1060 <getHypertext@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xec8(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11f3 <main+0xa3>
xor    %edi,%edi
call   1070 <exit@plt>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed9(%rip),%rdi
call   1060 <getHypertext@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xefd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xe84(%rip),%rsi
lea    0xe8c(%rip),%rdx
lea    0x8(%rsp),%rdi
call   1030 <sendHTTPRequest@plt>
mov    %eax,%ebx
test   %eax,%eax
lea    0xed2(%rip),%rax
lea    0xf06(%rip),%rsi
cmove  %rax,%rsi
lea    0xe9e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
test   %ebx,%ebx
je     122d <main+0xbd>
lea    0xeb5(%rip),%rdi
call   1080 <getHypertext@plt>
mov    %rax,0x8(%rsp)
lea    0xedb(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rsp),%rdi
lea    0xec2(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    122d <main+0xbd>
lea    0xf0c(%rip),%rdi
call   1050 <puts@plt>
lea    0xec5(%rip),%rdi
call   1080 <getHypertext@plt>
mov    %rax,0x8(%rsp)
lea    0xeec(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"208.80.154.224\00"
@.str.1 = [57 x i8] c"GET /wiki/Main_Page http/1.1\0D\0AHost: en.wikipedia.org\0D\0A\0D\0A\00"
@.str.2 = [34 x i8] c"Connection Status(wikipedia):\09%s\0A\00"
@.str.3 = [3 x i8] c"OK\00"
@.str.4 = [7 x i8] c"Failed\00"
@.str.5 = [55 x i8] c"http://127.0.0.1/osir/client-interface/echo.php?arg=OK\00"
@.str.6 = [29 x i8] c"Connection Status(OSIR):\09%s\0A\00"
@.str.7 = [28 x i8] c"\0AServer Unit Test Results:\0A\00"
@.str.8 = [56 x i8] c"http://127.0.0.1/osir/client-interface/test.php?no_html\00"
@.str.9 = [3 x i8] c"%s\00"
@.str.10 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i32 @sendHTTPRequest(i8** %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %0
%13 = call i32 @exit(i32 0)
unreachable
14: ; preds = %0
%15 = call i8* @getHypertext(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
store i8* %15, i8** %3
%16 = load i8*, i8** %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %16)
%18 = load i8*, i8** %3
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %14
%22 = call i32 @exit(i32 0)
unreachable
23: ; preds = %14
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%25 = call i8* @getHypertext(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.8, i64 0, i64 0))
store i8* %25, i8** %3
%26 = load i8*, i8** %3
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"208.80.154.224\00"
@.str.1 = [57 x i8] c"GET /wiki/Main_Page http/1.1\0D\0AHost: en.wikipedia.org\0D\0A\0D\0A\00"
@.str.2 = [34 x i8] c"Connection Status(wikipedia):\09%s\0A\00"
@.str.3 = [3 x i8] c"OK\00"
@.str.4 = [7 x i8] c"Failed\00"
@.str.5 = [55 x i8] c"http://127.0.0.1/osir/client-interface/echo.php?arg=OK\00"
@.str.6 = [29 x i8] c"Connection Status(OSIR):\09%s\0A\00"
@.str.8 = [56 x i8] c"http://127.0.0.1/osir/client-interface/test.php?no_html\00"
@.str.9 = [3 x i8] c"%s\00"
@str = [27 x i8] c"\0AServer Unit Test Results:\00"
define i32 @main() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
%3 = call i32 @sendHTTPRequest(i8** %1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %5)
br i1 %4, label %7, label %9
7: ; preds = %0
%8 = call i32 @exit(i32 0)
unreachable
9: ; preds = %0
%10 = call i8* @getHypertext(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
store i8* %10, i8** %1
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %10)
%12 = load i8*, i8** %1
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %9
%16 = call i32 @exit(i32 0)
unreachable
17: ; preds = %9
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%19 = call i8* @getHypertext(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.8, i64 0, i64 0))
store i8* %19, i8** %1
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %19)
%21 = call i32 @putchar(i32 10)
ret i32 0
}