// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/lib/net.c
// Function: urlFromNetParsedUrl
char *urlFromNetParsedUrl(struct netParsedUrl *npu)
/* Build URL from netParsedUrl structure */
{
struct dyString *dy = newDyString(512);

dyStringAppend(dy, npu->protocol);
dyStringAppend(dy, "://");
if (npu->user[0] != 0)
    {
    char *encUser = cgiEncode(npu->user);
    dyStringAppend(dy, encUser);
    freeMem(encUser);
    if (npu->password[0] != 0)
	{
	dyStringAppend(dy, ":");
	char *encPassword = cgiEncode(npu->password);
	dyStringAppend(dy, encPassword);
	freeMem(encPassword);
	}
    dyStringAppend(dy, "@");
    }
dyStringAppend(dy, npu->host);
/* do not include port if it is the default */
if (!(
 (sameString(npu->protocol, "ftp"  ) && sameString("21", npu->port)) ||
 (sameString(npu->protocol, "http" ) && sameString("80", npu->port)) ||
 (sameString(npu->protocol, "https") && sameString("443",npu->port))
    ))
    {
    dyStringAppend(dy, ":");
    dyStringAppend(dy, npu->port);
    }
dyStringAppend(dy, npu->file);
if (npu->byteRangeStart != -1)
    {
    dyStringPrintf(dy, ";byterange=%lld-", (long long)npu->byteRangeStart);
    if (npu->byteRangeEnd != -1)
	dyStringPrintf(dy, "%lld", (long long)npu->byteRangeEnd);
    }

/* Clean up and return handle. */
return dyStringCannibalize(&dy);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
movl $0x200, %edi            # imm = 0x200
callq 0x21bcc
movq %rax, %rbx
movq %rax, 0x8(%rsp)
movq %rax, %rdi
movq %r14, %rsi
callq 0x21dda
leaq 0x5694e(%rip), %rsi     # 0x805bc
movq %rbx, %rdi
callq 0x21dda
cmpb $0x0, 0x10(%r14)
je 0x29ce9
leaq 0x10(%r14), %rdi
callq 0x3eba3
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
callq 0x21dda
movq %r15, %rdi
callq 0x28c2d
cmpb $0x0, 0x810(%r14)
je 0x29cda
leaq 0x810(%r14), %r15
leaq 0x5f99d(%rip), %rsi     # 0x89651
movq %rbx, %rdi
callq 0x21dda
movq %r15, %rdi
callq 0x3eba3
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
callq 0x21dda
movq %r15, %rdi
callq 0x28c2d
leaq 0x571ff(%rip), %rsi     # 0x80ee0
movq %rbx, %rdi
callq 0x21dda
leaq 0x1010(%r14), %rsi
movq %rbx, %rdi
callq 0x21dda
leaq 0x5a23e(%rip), %rsi     # 0x83f3d
movq %r14, %rdi
callq 0x6a50
testl %eax, %eax
jne 0x29d37
movzbl 0x1810(%r14), %eax
subl $0x32, %eax
jne 0x29d2d
movzbl 0x1811(%r14), %eax
subl $0x31, %eax
jne 0x29d2d
movzbl 0x1812(%r14), %eax
negl %eax
testl %eax, %eax
je 0x29dba
leaq 0x57154(%rip), %rsi     # 0x80e92
movq %r14, %rdi
callq 0x6a50
testl %eax, %eax
jne 0x29d72
movzbl 0x1810(%r14), %eax
subl $0x38, %eax
jne 0x29d6c
movzbl 0x1811(%r14), %eax
subl $0x30, %eax
jne 0x29d6c
movzbl 0x1812(%r14), %eax
negl %eax
testl %eax, %eax
je 0x29dba
leaq 0x5711e(%rip), %rsi     # 0x80e97
movq %r14, %rdi
callq 0x6a50
testl %eax, %eax
jne 0x29d9c
leaq 0x1810(%r14), %rsi
leaq 0x5712d(%rip), %rdi     # 0x80ec0
callq 0x6a50
testl %eax, %eax
je 0x29dba
leaq 0x5f8ae(%rip), %rsi     # 0x89651
movq %rbx, %rdi
callq 0x21dda
leaq 0x1810(%r14), %rsi
movq %rbx, %rdi
callq 0x21dda
leaq 0x1820(%r14), %rsi
movq %rbx, %rdi
callq 0x21dda
movq 0x2820(%r14), %rdx
cmpq $-0x1, %rdx
je 0x29e05
leaq 0x5a278(%rip), %rsi     # 0x84055
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21ec7
movq 0x2828(%r14), %rdx
cmpq $-0x1, %rdx
je 0x29e05
leaq 0x55679(%rip), %rsi     # 0x7f474
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21ec7
leaq 0x8(%rsp), %rdi
callq 0x21c26
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq