// File: /workspace/github_cpp_makefile_star2_O2/wangyufei95[P]watchdog_linux/./maile.h
// Function: CAutoMail::send_mail()
bool CAutoMail::send_mail()
{
	m_str_src_mail_p;
	m_str_pwd_p;
	m_str_dst_mail_p;
	
	base64(m_str_src_mail_p, STR_BASE_FILE);
	base64(m_str_pwd_p, STR_BASE_FILE);
	base64(m_str_dst_mail_p, STR_BASE_FILE);
	

	char buf_send[BUF_LEN] = {0};
	char buf_recv[BUF_LEN] = {0};
	char buf_time[BUF_LEN] = {0};

	ofstream ofs(STR_LOG_FILE);
	wchar_t _buf_info[BUF_LEN] = {0};
	char buf[BUF_LEN] = {0};
	
	wifstream ifs(STR_BASE_FILE);
	ifs.getline(_buf_info,sizeof(_buf_info));
	m_str_src_mail_c = _buf_info;
	memset(_buf_info, 0, sizeof(_buf_info));
	ifs.getline(_buf_info,sizeof( _buf_info));
	m_str_pwd_c = _buf_info;
	memset(_buf_info, 0, sizeof( _buf_info));
	ifs.getline(_buf_info,sizeof(_buf_info));
	m_str_dst_mail_c = _buf_info;
	ifs.close();
	
	int reval = connect(m_socket_server, (struct sockaddr*)&m_sockaddr_server, sizeof(struct sockaddr));
	// connect to mail server
	if (reval != 0)
	{
		ERROR_NUMBER = CONNECT_SERVER_FAILED;
		uninit();
		return false;
	}

	recv(m_socket_server, buf, sizeof(buf), 0); // get welcome message from server
	memset (buf_time, 0, sizeof(buf_time));
	get_time(buf_time);
	ofs << buf_time << ": " << buf;
	
	send_mail_head(ofs);
	send_mail_data(ofs);
	
	ofs.close();
	cout << "send completed." << endl;
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xa68, %rsp            # imm = 0xA68
movq %rdi, %rbx
leaq 0x8(%rdi), %rsi
leaq -0x78(%rbp), %r14
movq %r14, %rdi
callq 0x3330
movq 0x5978(%rip), %rdx      # 0xa378
movq %r14, %rsi
callq 0x4116
leaq -0x78(%rbp), %rdi
callq 0x3050
leaq 0x88(%rbx), %rsi
leaq -0x58(%rbp), %r14
movq %r14, %rdi
callq 0x3330
movq 0x594d(%rip), %rdx      # 0xa378
movq %r14, %rsi
callq 0x4116
leaq -0x58(%rbp), %rdi
callq 0x3050
leaq 0x48(%rbx), %rsi
leaq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x3330
movq 0x5925(%rip), %rdx      # 0xa378
movq %r14, %rsi
callq 0x4116
leaq -0x38(%rbp), %rdi
callq 0x3050
leaq -0x680(%rbp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x31f0
movq 0x5902(%rip), %rsi      # 0xa380
leaq -0x278(%rbp), %rdi
pushq $0x10
popq %rdx
callq 0x33e0
leaq -0xa80(%rbp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x31f0
leaq -0x580(%rbp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x31f0
movq 0x58be(%rip), %rsi      # 0xa378
leaq -0x480(%rbp), %rdi
pushq $0x8
popq %rdx
callq 0x32d0
leaq -0x480(%rbp), %rdi
leaq -0xa80(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x3360
leaq 0x28(%rbx), %rdi
leaq -0xa80(%rbp), %rsi
callq 0x3390
leaq -0xa80(%rbp), %r14
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x31f0
leaq -0x480(%rbp), %rdi
movl $0x400, %edx            # imm = 0x400
movq %r14, %rsi
callq 0x3360
leaq 0xa8(%rbx), %rdi
leaq -0xa80(%rbp), %rsi
callq 0x3390
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x31f0
leaq -0x480(%rbp), %rdi
movl $0x400, %edx            # imm = 0x400
movq %r14, %rsi
callq 0x3360
leaq 0x68(%rbx), %rdi
leaq -0xa80(%rbp), %rsi
callq 0x3390
leaq -0x480(%rbp), %rdi
callq 0x3060
movl 0x32c(%rbx), %edi
leaq 0x330(%rbx), %rsi
pushq $0x10
popq %rdx
callq 0x32f0
movl %eax, %r14d
testl %eax, %eax
je 0x4ba0
movl $0x13, 0x57fd(%rip)     # 0xa390
movq %rbx, %rdi
callq 0x407c
jmp 0x4c49
movl 0x32c(%rbx), %edi
leaq -0x580(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
xorl %ecx, %ecx
callq 0x30d0
leaq -0x680(%rbp), %r15
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r15, %rsi
callq 0x4212
leaq -0x278(%rbp), %rdi
movq %r15, %rsi
callq 0x33a0
leaq 0x296a(%rip), %rsi      # 0x7557
movq %rax, %rdi
callq 0x33a0
leaq -0x580(%rbp), %rsi
movq %rax, %rdi
callq 0x33a0
leaq -0x278(%rbp), %rsi
movq %rbx, %rdi
callq 0x426e
leaq -0x278(%rbp), %rsi
movq %rbx, %rdi
callq 0x453c
leaq -0x278(%rbp), %rdi
callq 0x34e0
movq 0x538b(%rip), %rdi      # 0x9fc0
leaq 0x2556(%rip), %rsi      # 0x7192
callq 0x33a0
movq %rax, %rdi
callq 0x3190
testl %r14d, %r14d
sete %bl
leaq -0x480(%rbp), %rdi
callq 0x32a0
leaq -0x278(%rbp), %rdi
callq 0x3530
movl %ebx, %eax
addq $0xa68, %rsp            # imm = 0xA68
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x4cad
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
jmp 0x4c95
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
jmp 0x4c95
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x3050
jmp 0x4cb9
jmp 0x4c9e
movq %rax, %rbx
leaq -0x480(%rbp), %rdi
callq 0x32a0
leaq -0x278(%rbp), %rdi
callq 0x3530
movq %rbx, %rdi
callq 0x3600