// File: /workspace/github_c_makefile_star2_O0/uhlin[P]enhanced-duc/source/main.c
// Function: send_update_request
static int
send_update_request(const char *which_host, const char *to_ip)
{
	bool	 ok = true;
	char	*agent = NULL;
	char	*auth = NULL;
	char	*s, *host, *unp;
	char	 buf[500] = { '\0' };

	s = host = unp = NULL;

	if (strings_match(to_ip, "WAN_address")) {
		s = strdup_printf("GET %s?hostname=%s HTTP/1.0", UPDATE_SCRIPT,
		    which_host);
	} else {
		s = strdup_printf("GET %s?hostname=%s&myip=%s HTTP/1.0",
		    UPDATE_SCRIPT, which_host, to_ip);
	}

	host = strdup_printf("Host: %s", setting("sp_hostname"));
	unp = strdup_printf("%s:%s", setting("username"), setting("password"));

	if (b64_encode((uint8_t *) unp, strlen(unp), buf, sizeof buf) < 0) {
		log_warn(EMSGSIZE, "send_update_request: b64_encode");
		ok = false;
		goto err;
	}

	auth = strdup_printf("Authorization: Basic %s", buf);
	agent = strdup_printf("User-Agent: %s/%s %s", g_programName,
	    g_programVersion, g_maintainerEmail);

	log_debug("sending http get request");

	if (net_send("%s\r\n%s\r\n%s\r\n%s", s, host, auth, agent) != 0)
		ok = false;

  err:
	free_not_null(s);
	free_not_null(host);
	free_not_null(unp);
	free_not_null(auth);
	free_not_null(agent);
	return (ok ? 0 : -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x250, %rsp            # imm = 0x250
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x1, -0x11(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
leaq -0x240(%rbp), %rdi
xorl %esi, %esi
movl $0x1f4, %edx            # imm = 0x1F4
callq 0x4210
movq $0x0, -0x40(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x5097(%rip), %rsi      # 0xbed4
callq 0x6db0
testb $0x1, %al
jne 0x6e48
jmp 0x6e67
movq -0x8(%rbp), %rdx
leaq 0x508d(%rip), %rdi      # 0xbee0
leaq 0x50a2(%rip), %rsi      # 0xbefc
movb $0x0, %al
callq 0xa540
movq %rax, -0x30(%rbp)
jmp 0x6e88
movq -0x8(%rbp), %rdx
movq -0x10(%rbp), %rcx
leaq 0x5092(%rip), %rdi      # 0xbf08
leaq 0x507f(%rip), %rsi      # 0xbefc
movb $0x0, %al
callq 0xa540
movq %rax, -0x30(%rbp)
leaq 0x50a6(%rip), %rdi      # 0xbf35
callq 0x9060
movq %rax, %rsi
leaq 0x508e(%rip), %rdi      # 0xbf2c
movb $0x0, %al
callq 0xa540
movq %rax, -0x38(%rbp)
leaq 0x5097(%rip), %rdi      # 0xbf47
callq 0x9060
movq %rax, -0x250(%rbp)
leaq 0x5a5d(%rip), %rdi      # 0xc920
callq 0x9060
movq -0x250(%rbp), %rsi
movq %rax, %rdx
leaq 0x5068(%rip), %rdi      # 0xbf41
movb $0x0, %al
callq 0xa540
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x248(%rbp)
movq -0x40(%rbp), %rdi
callq 0x41b0
movq -0x248(%rbp), %rdi
movq %rax, %rsi
leaq -0x240(%rbp), %rdx
movl $0x1f4, %ecx            # imm = 0x1F4
callq 0x4f80
cmpl $0x0, %eax
jge 0x6f31
movl $0x5a, %edi
leaq 0x502c(%rip), %rsi      # 0xbf50
movb $0x0, %al
callq 0x6300
movb $0x0, -0x11(%rbp)
jmp 0x6fb0
leaq -0x240(%rbp), %rsi
leaq 0x5031(%rip), %rdi      # 0xbf70
movb $0x0, %al
callq 0xa540
movq %rax, -0x28(%rbp)
leaq 0x57a5(%rip), %rdi      # 0xc6f6
leaq 0x4668(%rip), %rsi      # 0xb5c0
leaq 0x466e(%rip), %rdx      # 0xb5cd
leaq 0x467a(%rip), %rcx      # 0xb5e0
movb $0x0, %al
callq 0xa540
movq %rax, -0x20(%rbp)
leaq 0x5010(%rip), %rdi      # 0xbf88
movb $0x0, %al
callq 0x6170
leaq 0x9512(%rip), %rax      # 0x10498
movq (%rax), %r9
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %r8
leaq 0x5001(%rip), %rdi      # 0xbfa1
movb $0x0, %al
callq *%r9
cmpl $0x0, %eax
je 0x6fae
movb $0x0, -0x11(%rbp)
jmp 0x6fb0
movq -0x30(%rbp), %rdi
callq 0x7350
movq -0x38(%rbp), %rdi
callq 0x7350
movq -0x40(%rbp), %rdi
callq 0x7350
movq -0x28(%rbp), %rdi
callq 0x7350
movq -0x20(%rbp), %rdi
callq 0x7350
movb -0x11(%rbp), %dl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
addq $0x250, %rsp            # imm = 0x250
popq %rbp
retq
nopw %cs:(%rax,%rax)