// File: /workspace/github_c_makefile_star2_O2/enzo1982[P]smooth/classes/net/protocols/http.cpp
// Function: smooth::Net::Protocols::httpProgress(void*, double, double, double, double)
int S::Net::Protocols::httpProgress(void *data, double dlTotal, double dlNow, double ulTotal, double ulNow)
{
	HTTP	*http = (HTTP *) data;

	if (ulNow > 0 && http->ulStart == 0) http->ulStart = System::System::Clock() - 1;
	if (dlNow > 0 && http->dlStart == 0) http->dlStart = System::System::Clock() - 1;

	if (http->dlStart == 0)
	{
		if (ulTotal > 0) http->uploadProgress.Emit(Math::Round(1000.0 * ulNow / ulTotal));
		if (ulNow   > 0) http->uploadSpeed.Emit(String::FromInt(Math::Round((ulNow / 1024) / (Float(System::System::Clock() - http->ulStart) / 1000))).Append(" kB/s"));
	}
	else
	{
		if (dlTotal > 0) http->downloadProgress.Emit(Math::Round(1000.0 * dlNow / dlTotal));
		if (dlNow   > 0) http->downloadSpeed.Emit(String::FromInt(Math::Round((dlNow / 1024) / (Float(System::System::Clock() - http->dlStart) / 1000))).Append(" kB/s"));
	}

	return 0;
}

// Assembly:
pushq %rbx
subq $0x50, %rsp
movq %rdi, %rbx
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm3
jbe 0xa9a94
cmpq $0x0, 0x260(%rbx)
jne 0xa9a94
movsd %xmm3, (%rsp)
movsd %xmm1, 0x8(%rsp)
movsd %xmm2, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
callq 0x582b0
xorpd %xmm4, %xmm4
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm2
movsd 0x8(%rsp), %xmm1
movsd (%rsp), %xmm3
decq %rax
movq %rax, 0x260(%rbx)
ucomisd %xmm4, %xmm1
movq 0x268(%rbx), %rax
jbe 0xa9ae3
testq %rax, %rax
jne 0xa9aec
movsd %xmm3, (%rsp)
movsd %xmm1, 0x8(%rsp)
movsd %xmm2, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
callq 0x582b0
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm2
movsd 0x8(%rsp), %xmm1
movsd (%rsp), %xmm3
decq %rax
movq %rax, 0x268(%rbx)
testq %rax, %rax
je 0xa9bdb
xorpd %xmm3, %xmm3
ucomisd %xmm3, %xmm0
jbe 0xa9b39
movsd 0x585d2(%rip), %xmm2    # 0x1020d0
mulsd %xmm1, %xmm2
divsd %xmm0, %xmm2
xorl %eax, %eax
ucomisd %xmm2, %xmm3
leaq 0x60(%rbx), %rdi
seta %al
leaq 0x39c96(%rip), %rcx     # 0xe37b0
addsd (%rcx,%rax,8), %xmm2
cvttsd2si %xmm2, %rsi
movsd %xmm1, 0x8(%rsp)
callq 0x72596
xorpd %xmm3, %xmm3
movsd 0x8(%rsp), %xmm1
ucomisd %xmm3, %xmm1
jbe 0xa9cd5
mulsd 0x585fd(%rip), %xmm1    # 0x102148
movsd %xmm1, 0x8(%rsp)
callq 0x582b0
subq 0x268(%rbx), %rax
movq %rax, %xmm0
punpckldq 0x58576(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x5857e(%rip), %xmm0    # 0x1020f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd 0x5854a(%rip), %xmm1    # 0x1020d0
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
addsd 0x397e8(%rip), %xmm0    # 0xe3380
cvttsd2si %xmm0, %rsi
leaq 0x38(%rsp), %rdi
callq 0x57e80
leaq 0x58572(%rip), %rsi     # 0x102120
leaq 0x20(%rsp), %rdi
callq 0x58c40
leaq 0x38(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x573e0
subq $-0x80, %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x75b8e
jmp 0xa9cc1
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm2
jbe 0xa9c26
movsd 0x584e3(%rip), %xmm0    # 0x1020d0
mulsd %xmm3, %xmm0
divsd %xmm2, %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm1
leaq 0x20(%rbx), %rdi
seta %al
leaq 0x39ba7(%rip), %rcx     # 0xe37b0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rsi
movsd %xmm3, (%rsp)
callq 0x72596
xorpd %xmm1, %xmm1
movsd (%rsp), %xmm3
ucomisd %xmm1, %xmm3
jbe 0xa9cd5
mulsd 0x58510(%rip), %xmm3    # 0x102148
movsd %xmm3, (%rsp)
callq 0x582b0
subq 0x260(%rbx), %rax
movq %rax, %xmm0
punpckldq 0x5848a(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x58492(%rip), %xmm0    # 0x1020f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd 0x5845e(%rip), %xmm1    # 0x1020d0
movsd (%rsp), %xmm0
divsd %xmm1, %xmm0
addsd 0x396fd(%rip), %xmm0    # 0xe3380
cvttsd2si %xmm0, %rsi
leaq 0x38(%rsp), %rdi
callq 0x57e80
leaq 0x58487(%rip), %rsi     # 0x102120
leaq 0x20(%rsp), %rdi
callq 0x58c40
leaq 0x38(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x573e0
addq $0x40, %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x75b8e
leaq 0x20(%rsp), %rdi
callq 0x5a588
leaq 0x38(%rsp), %rdi
callq 0x5a588
xorl %eax, %eax
addq $0x50, %rsp
popq %rbx
retq
jmp 0xa9ce1
jmp 0xa9ce6
movq %rax, %rbx
jmp 0xa9cf3
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x5a588
leaq 0x38(%rsp), %rdi
callq 0x5a588
movq %rbx, %rdi
callq 0x58260
nop