// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/net/protocols/protocol.cpp
// Function: smooth::Net::Protocols::Protocol::DownloadToBuffer(smooth::Buffer<unsigned char>&)
S::Int S::Net::Protocols::Protocol::DownloadToBuffer(Buffer<UnsignedByte> &destination)
{
	Math::RandomSeed();

	S::File	 downloadFile = S::System::System::GetTempDirectory().Append("download-").Append(Number((Int64) Math::Random() & 0x7FFFFFFF).ToHexString()).Append(".temp");
	Bool	 error = DownloadToFile(downloadFile);

	if (error) return Error();

	InStream	 in(STREAM_FILE, downloadFile, IS_READ);
	Int		 size = in.Size();

	destination.Resize(size);

	for (Int p = 0; p < size; p += 1024) in.InputData(destination + p, Math::Min(1024, size - p));

	in.Close();

	downloadFile.Delete();

	return Success();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2b0, %rsp            # imm = 0x2B0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x258(%rbp)
callq 0x59a50
leaq -0x60(%rbp), %rdi
callq 0x5c7d0
leaq 0xa01a3(%rip), %rsi     # 0x1a5d96
leaq -0x78(%rbp), %rdi
callq 0x5c1f0
jmp 0x105bfe
leaq -0x60(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x5a710
movq %rax, -0x260(%rbp)
jmp 0x105c14
callq 0x5a2b0
movl %eax, -0x264(%rbp)
jmp 0x105c21
movl -0x264(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %esi
leaq -0xb0(%rbp), %rdi
callq 0x5dd30
jmp 0x105c3c
leaq -0xa0(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5bf10
jmp 0x105c56
movq -0x260(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x5a710
movq %rax, -0x270(%rbp)
jmp 0x105c72
leaq 0x9ffc3(%rip), %rsi     # 0x1a5c3c
leaq -0xc8(%rbp), %rdi
callq 0x5c1f0
jmp 0x105c87
movq -0x270(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x5a710
movq %rax, -0x278(%rbp)
jmp 0x105ca3
leaq -0xe0(%rbp), %rdi
xorl %esi, %esi
callq 0x5da90
jmp 0x105cb3
movq -0x278(%rbp), %rsi
leaq -0x48(%rbp), %rdi
leaq -0xe0(%rbp), %rdx
callq 0x5acf0
jmp 0x105ccc
leaq -0xe0(%rbp), %rdi
callq 0x5df00
leaq -0xc8(%rbp), %rdi
callq 0x5df00
leaq -0xa0(%rbp), %rdi
callq 0x5df00
leaq -0xb0(%rbp), %rdi
callq 0x5d990
leaq -0x78(%rbp), %rdi
callq 0x5df00
leaq -0x60(%rbp), %rdi
callq 0x5df00
leaq -0x100(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x5dc70
jmp 0x105d20
movq -0x258(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
leaq -0x100(%rbp), %rsi
callq *%rax
movl %eax, -0x27c(%rbp)
jmp 0x105d3f
movl -0x27c(%rbp), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x27d(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x5df00
movb -0x27d(%rbp), %al
andb $0x1, %al
movb %al, -0xe1(%rbp)
testb $0x1, -0xe1(%rbp)
je 0x105ec5
leaq -0x110(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5a9c0
jmp 0x105d8b
leaq -0x110(%rbp), %rdi
callq 0x59680
movl %eax, -0x284(%rbp)
jmp 0x105d9f
movl -0x284(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x5b5b0
movl $0x1, -0x114(%rbp)
jmp 0x10608f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x105e63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x105e5a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x105e4e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x105e42
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x105e36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x5df00
leaq -0xc8(%rbp), %rdi
callq 0x5df00
leaq -0xa0(%rbp), %rdi
callq 0x5df00
leaq -0xb0(%rbp), %rdi
callq 0x5d990
leaq -0x78(%rbp), %rdi
callq 0x5df00
leaq -0x60(%rbp), %rdi
callq 0x5df00
jmp 0x1060ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x1060a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x5df00
jmp 0x1060a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x5b5b0
jmp 0x1060a4
leaq -0x238(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x5dc70
jmp 0x105ed7
leaq -0x220(%rbp), %rdi
movl $0x3, %esi
leaq -0x238(%rbp), %rdx
movl $0x2, %ecx
callq 0x5d200
jmp 0x105ef6
leaq -0x238(%rbp), %rdi
callq 0x5df00
leaq -0x220(%rbp), %rdi
callq 0x5a580
movq %rax, -0x290(%rbp)
jmp 0x105f17
movq -0x290(%rbp), %rax
movl %eax, -0x23c(%rbp)
movq -0x18(%rbp), %rdi
movl -0x23c(%rbp), %esi
callq 0x72e00
jmp 0x105f35
movl $0x0, -0x240(%rbp)
movl -0x240(%rbp), %eax
cmpl -0x23c(%rbp), %eax
jge 0x105ffe
movq -0x18(%rbp), %rdi
callq 0x71100
movq %rax, -0x298(%rbp)
jmp 0x105f63
movq -0x298(%rbp), %rcx
movslq -0x240(%rbp), %rdx
movl %edx, %eax
addq %rdx, %rcx
movq %rcx, -0x2a8(%rbp)
movl -0x23c(%rbp), %esi
subl %eax, %esi
movl $0x400, %edi            # imm = 0x400
callq 0x5ce90
movl %eax, -0x29c(%rbp)
jmp 0x105f97
movl -0x29c(%rbp), %edx
movq -0x2a8(%rbp), %rsi
leaq -0x220(%rbp), %rdi
callq 0x5b510
jmp 0x105fb2
jmp 0x105fb4
movl -0x240(%rbp), %eax
addl $0x400, %eax            # imm = 0x400
movl %eax, -0x240(%rbp)
jmp 0x105f3f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x5df00
jmp 0x1060a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x106081
leaq -0x220(%rbp), %rdi
callq 0x59400
jmp 0x10600c
leaq -0x48(%rbp), %rdi
callq 0x5c760
jmp 0x106017
leaq -0x250(%rbp), %rdi
callq 0x5ca80
jmp 0x106025
leaq -0x250(%rbp), %rdi
callq 0x59680
movl %eax, -0x2ac(%rbp)
jmp 0x106039
movl -0x2ac(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x5a410
movl $0x1, -0x114(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x59710
jmp 0x10608f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x5a410
leaq -0x220(%rbp), %rdi
callq 0x59710
jmp 0x1060a4
leaq -0x48(%rbp), %rdi
callq 0x5de78
movl -0x4(%rbp), %eax
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0x5de78
movq -0x80(%rbp), %rdi
callq 0x5b6b0
nopw %cs:(%rax,%rax)