// File: ryuichiueda[P]GlueLang/src/Environment.cc
// Function: Environment::removeFiles()
void Environment::removeFiles(void)
{
	/*
	for(auto le : m_local_env){
		le.second->removeFiles(true);
	}
	*/

	for(auto d : m_data){
		string *f = d.second->getFileName();
		if(f == NULL)
			continue;

		if(m_tmpdir + "/" != f->substr(0,m_tmpdir.size() + 1))
			continue;

		//if(f->substr(m_tmpdir.size()+1,6) != "local." && m_is_local)
		//	continue;

		remove(f->c_str());
		if(m_v_opt)
			cerr << "+ pid " << getpid() << " file " << f << " deleted" << endl;
	}
	

//	if(!local){
		struct stat buf;
		while(stat(m_tmpdir.c_str(), &buf) == 0){
			if(remove(m_tmpdir.c_str()) != 0){
				cerr << "cannot remove tmpdir" << endl;
				sleep(1);
			}
		}
//	}

	if(Element::m_signal != 0)
		kill(0,Element::m_signal);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x138(%rbp)
addq $0x68, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf510
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf540
movq %rax, -0x20(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0xf570
testb $0x1, %al
jne 0xee52
jmp 0xf064
leaq -0x18(%rbp), %rdi
callq 0xf5a0
movq %rax, %rsi
leaq -0x48(%rbp), %rdi
callq 0xf5c0
movq -0x28(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movq %rax, -0x140(%rbp)
jmp 0xee7d
movq -0x140(%rbp), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0xeeac
movl $0x3, -0x60(%rbp)
jmp 0xf032
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xf056
movq -0x138(%rbp), %rsi
addq $0xc0, %rsi
leaq 0xe6f9(%rip), %rdx      # 0x1d5ba
leaq -0x80(%rbp), %rdi
callq 0x79f0
jmp 0xeecc
movq -0x138(%rbp), %rdi
movq -0x50(%rbp), %rax
movq %rax, -0x148(%rbp)
addq $0xc0, %rdi
callq 0x62c0
movq -0x148(%rbp), %rsi
movq %rax, %rcx
incq %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0xa0(%rbp), %rdi
callq 0x6440
jmp 0xef09
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0xfbd0
movb %al, -0x149(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x6280
leaq -0x80(%rbp), %rdi
callq 0x6280
movb -0x149(%rbp), %al
testb $0x1, %al
jne 0xef40
jmp 0xef66
movl $0x3, -0x60(%rbp)
jmp 0xf032
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x6280
jmp 0xf056
movq -0x50(%rbp), %rdi
callq 0x6190
movq %rax, %rdi
callq 0x6730
movq -0x138(%rbp), %rax
testb $0x1, 0xe0(%rax)
je 0xf02b
movq 0x1a056(%rip), %rdi     # 0x28fe8
leaq 0xe2da(%rip), %rsi      # 0x1d273
callq 0x6410
movq %rax, -0x158(%rbp)
jmp 0xefa7
callq 0x6600
movq -0x158(%rbp), %rdi
movl %eax, %esi
callq 0x66f0
movq %rax, -0x160(%rbp)
jmp 0xefc3
movq -0x160(%rbp), %rdi
leaq 0xe2a9(%rip), %rsi      # 0x1d27a
callq 0x6410
movq %rax, -0x168(%rbp)
jmp 0xefdf
movq -0x168(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x6320
movq %rax, -0x170(%rbp)
jmp 0xeff8
movq -0x170(%rbp), %rdi
leaq 0xe468(%rip), %rsi      # 0x1d46e
callq 0x6410
movq %rax, -0x178(%rbp)
jmp 0xf014
movq -0x178(%rbp), %rdi
movq 0x19f86(%rip), %rsi     # 0x28fa8
callq 0x6460
jmp 0xf029
jmp 0xf02b
movl $0x0, -0x60(%rbp)
leaq -0x48(%rbp), %rdi
callq 0xf600
movl -0x60(%rbp), %eax
testl %eax, %eax
je 0xf046
jmp 0xf044
jmp 0xf048
jmp 0xf048
leaq -0x18(%rbp), %rdi
callq 0xf620
jmp 0xee3c
leaq -0x48(%rbp), %rdi
callq 0xf600
jmp 0xf100
jmp 0xf066
movq -0x138(%rbp), %rdi
addq $0xc0, %rdi
callq 0x6190
movq %rax, %rdi
leaq -0x130(%rbp), %rsi
callq 0x63b0
cmpl $0x0, %eax
jne 0xf0db
movq -0x138(%rbp), %rdi
addq $0xc0, %rdi
callq 0x6190
movq %rax, %rdi
callq 0x6730
cmpl $0x0, %eax
je 0xf0d9
movq 0x19f34(%rip), %rdi     # 0x28fe8
leaq 0xe3bc(%rip), %rsi      # 0x1d477
callq 0x6410
movq %rax, %rdi
movq 0x19ede(%rip), %rsi     # 0x28fa8
callq 0x6460
movl $0x1, %edi
callq 0x6300
jmp 0xf066
leaq 0x1a37e(%rip), %rax     # 0x29460
cmpl $0x0, (%rax)
je 0xf0f7
leaq 0x1a372(%rip), %rax     # 0x29460
movl (%rax), %esi
xorl %edi, %edi
callq 0x65d0
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x6700
nopl (%rax)