// File: /workspace/github_cpp_makefile_star2_O1/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 %r12
pushq %rbx
subq $0xa70, %rsp            # imm = 0xA70
movq %rdi, %rbx
leaq -0x70(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rax
leaq (%rsi,%rax,4), %rdx
leaq -0x80(%rbp), %r14
movq %r14, %rdi
callq 0x6f9a
movq 0x64b0(%rip), %rdx      # 0xb398
movq %r14, %rsi
callq 0x4484
movq -0x80(%rbp), %rdi
cmpq %r15, %rdi
je 0x4efe
callq 0x3370
leaq -0x50(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0x88(%rbx), %rsi
movq 0x90(%rbx), %rax
leaq (%rsi,%rax,4), %rdx
leaq -0x60(%rbp), %r14
movq %r14, %rdi
callq 0x6f9a
movq 0x646d(%rip), %rdx      # 0xb398
movq %r14, %rsi
callq 0x4484
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
je 0x4f41
callq 0x3370
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0x48(%rbx), %rsi
movq 0x50(%rbx), %rax
leaq (%rsi,%rax,4), %rdx
leaq -0x40(%rbp), %r14
movq %r14, %rdi
callq 0x6f9a
movq 0x6430(%rip), %rdx      # 0xb398
movq %r14, %rsi
callq 0x4484
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x4f7e
callq 0x3370
leaq -0x690(%rbp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x31d0
movq 0x6408(%rip), %rsi      # 0xb3a0
leaq -0x280(%rbp), %rdi
movl $0x10, %edx
callq 0x3400
leaq -0xa90(%rbp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x31d0
leaq -0x590(%rbp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x31d0
movq 0x63c2(%rip), %rsi      # 0xb398
leaq -0x488(%rbp), %rdi
movl $0x8, %edx
callq 0x32c0
leaq -0x488(%rbp), %rdi
leaq -0xa90(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x3360
leaq 0x28(%rbx), %r14
movq 0x30(%rbx), %r15
leaq -0xa90(%rbp), %r12
movq %r12, %rdi
callq 0x3310
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %rcx
movq %rax, %r8
callq 0x3660
leaq -0xa90(%rbp), %r14
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x31d0
leaq -0x488(%rbp), %rdi
movl $0x400, %edx            # imm = 0x400
movq %r14, %rsi
callq 0x3360
leaq 0xa8(%rbx), %r14
movq 0xb0(%rbx), %r15
movq %r12, %rdi
callq 0x3310
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %rcx
movq %rax, %r8
callq 0x3660
leaq -0xa90(%rbp), %r14
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x31d0
leaq -0x488(%rbp), %rdi
movl $0x400, %edx            # imm = 0x400
movq %r14, %rsi
callq 0x3360
leaq 0x68(%rbx), %r14
movq 0x70(%rbx), %r15
movq %r12, %rdi
callq 0x3310
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %rcx
movq %rax, %r8
callq 0x3660
leaq -0x488(%rbp), %rdi
callq 0x3060
movl 0x32c(%rbx), %edi
leaq 0x330(%rbx), %rsi
movl $0x10, %edx
callq 0x32e0
movl %eax, %r14d
testl %eax, %eax
je 0x510a
movl $0x13, 0x62b3(%rip)     # 0xb3b0
movq %rbx, %rdi
callq 0x43e8
jmp 0x5204
movl 0x32c(%rbx), %edi
leaq -0x590(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
xorl %ecx, %ecx
callq 0x30c0
leaq -0x690(%rbp), %r15
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
xorl %esi, %esi
callq 0x31d0
movq %r15, %rsi
callq 0x45de
movq %r15, %rdi
callq 0x3150
leaq -0x280(%rbp), %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x3420
leaq 0x33e9(%rip), %rsi      # 0x854b
leaq -0x280(%rbp), %rdi
movl $0x2, %edx
callq 0x3420
leaq -0x590(%rbp), %r15
movq %r15, %rdi
callq 0x3150
leaq -0x280(%rbp), %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x3420
leaq -0x280(%rbp), %rsi
movq %rbx, %rdi
callq 0x4638
leaq -0x280(%rbp), %rsi
movq %rbx, %rdi
callq 0x4974
leaq -0x280(%rbp), %rdi
callq 0x3500
movq 0x5df3(%rip), %rbx      # 0xafb8
leaq 0x2fba(%rip), %rsi      # 0x8186
movl $0xf, %edx
movq %rbx, %rdi
callq 0x3420
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3380
movsbl %al, %esi
movq 0x5dc1(%rip), %rdi      # 0xafb8
callq 0x3030
movq %rax, %rdi
callq 0x3220
testl %r14d, %r14d
sete %bl
leaq -0x488(%rbp), %rdi
callq 0x3290
movq 0x5d93(%rip), %rax      # 0xafb0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x278(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x280(%rbp,%rcx)
callq 0x3300
leaq -0x188(%rbp), %rdi
callq 0x30d0
movl %ebx, %eax
addq $0xa70, %rsp            # imm = 0xA70
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x5299
movq %rax, %rbx
movq -0x40(%rbp), %rdi
jmp 0x527c
movq %rax, %rbx
movq -0x60(%rbp), %rdi
jmp 0x527c
movq %rax, %rbx
movq -0x80(%rbp), %rdi
cmpq %r15, %rdi
je 0x52a5
callq 0x3370
jmp 0x52a5
jmp 0x528a
movq %rax, %rbx
leaq -0x488(%rbp), %rdi
callq 0x3290
leaq -0x280(%rbp), %rdi
callq 0x3560
movq %rbx, %rdi
callq 0x3630