// File: jasmeet13n[P]HTTP-Proxy-Server-Client/client.cpp
// Function: get_http_request(char*)
char *get_http_request(char *url){
	int len = strlen(url);
	char *output = (char *)malloc((len+50)*sizeof(char));
	int i=0, k=4;
	output[0]='G';output[1]='E';output[2]='T';output[3]=' ';
	if(len>7){
		if(url[0]=='h' && url[1]=='t' && url[2]=='t' && url[3]=='p' && url[4]==':' && url[5]=='/' && url[6]=='/')
			i = 7;
	}
	int tmp = i;								// Seperate the URL into file name and host name
	while(i<len && url[tmp]!='/')
		tmp++;
	output[k++]='/';
	tmp++;
	while(tmp<len)
		output[k++]=url[tmp++];
	output[k++]=' ';output[k++]='H';output[k++]='T';output[k++]='T';output[k++]='P';output[k++]='/';
	output[k++]='1';output[k++]='.';output[k++]='0';output[k++]='\r';output[k++]='\n';
	output[k++]='H';output[k++]='o';output[k++]='s';output[k++]='t';output[k++]=':';output[k++]=' ';
	while(i<len && url[i]!='/')
		output[k++] = url[i++];
	output[k++]='\r';output[k++]='\n';output[k++]='\r';output[k++]='\n';output[k]='\0';
	return output;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x20a0
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
addl $0x32, %eax
movslq %eax, %rdi
shlq $0x0, %rdi
callq 0x2200
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x4, -0x20(%rbp)
movq -0x18(%rbp), %rax
movb $0x47, (%rax)
movq -0x18(%rbp), %rax
movb $0x45, 0x1(%rax)
movq -0x18(%rbp), %rax
movb $0x54, 0x2(%rax)
movq -0x18(%rbp), %rax
movb $0x20, 0x3(%rax)
cmpl $0x7, -0xc(%rbp)
jle 0x25f4
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x68, %eax
jne 0x25f2
movq -0x8(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x74, %eax
jne 0x25f2
movq -0x8(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x74, %eax
jne 0x25f2
movq -0x8(%rbp), %rax
movsbl 0x3(%rax), %eax
cmpl $0x70, %eax
jne 0x25f2
movq -0x8(%rbp), %rax
movsbl 0x4(%rax), %eax
cmpl $0x3a, %eax
jne 0x25f2
movq -0x8(%rbp), %rax
movsbl 0x5(%rax), %eax
cmpl $0x2f, %eax
jne 0x25f2
movq -0x8(%rbp), %rax
movsbl 0x6(%rax), %eax
cmpl $0x2f, %eax
jne 0x25f2
movl $0x7, -0x1c(%rbp)
jmp 0x25f4
movl -0x1c(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %ecx
xorl %eax, %eax
cmpl -0xc(%rbp), %ecx
movb %al, -0x25(%rbp)
jge 0x261c
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2f, %eax
setne %al
movb %al, -0x25(%rbp)
movb -0x25(%rbp), %al
testb $0x1, %al
jne 0x2625
jmp 0x2630
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x25fa
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0x2f, (%rax,%rcx)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x2683
movq -0x8(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x24(%rbp)
movslq %ecx, %rcx
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x264f
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0x20, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0x48, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0x54, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0x54, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0x50, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0x2f, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0x31, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0x2e, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0x30, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0xd, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0xa, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0x48, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0x6f, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0x73, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0x74, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0x3a, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0x20, (%rax,%rcx)
movl -0x1c(%rbp), %ecx
xorl %eax, %eax
cmpl -0xc(%rbp), %ecx
movb %al, -0x26(%rbp)
jge 0x281b
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2f, %eax
setne %al
movb %al, -0x26(%rbp)
movb -0x26(%rbp), %al
testb $0x1, %al
jne 0x2824
jmp 0x2850
movq -0x8(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x27f9
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0xd, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0xa, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0xd, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movb $0xa, (%rax,%rcx)
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x18(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nop