// File: ryuichiueda[P]GlueLang/src/ExecForEach.cc
// Function: ExecForEach::parse()
bool ExecForEach::parse(void)
{
	m_feeder->getPos(&m_start_line, &m_start_char);

	string scr;
	bool scr_exist = m_feeder->forEachBlock(&scr);
	if(!scr_exist){
		m_feeder->setPos(m_start_line, m_start_char);
		return false;
	}

	m_name = "unnamed" + to_string(m_start_line);

	//create a file
	string tmpdir = m_env->m_tmpdir + "/" + m_name;
	ofstream ofs(tmpdir.c_str());
	ofs << scr;

	auto *p = new DataProc();
	p->setFileName(&tmpdir);
	m_env->setData(m_scopes.back(),&m_name,p);
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdx
movq %rdx, -0x2e8(%rbp)
movq 0x8(%rdx), %rdi
movq %rdx, %rsi
addq $0x30, %rsi
addq $0x34, %rdx
callq 0x17610
leaq -0x30(%rbp), %rdi
movq %rdi, -0x2e0(%rbp)
callq 0x65a0
movq -0x2e8(%rbp), %rax
movq -0x2e0(%rbp), %rsi
movq 0x8(%rax), %rdi
callq 0x18100
movb %al, -0x2d1(%rbp)
jmp 0x13afd
movb -0x2d1(%rbp), %al
andb $0x1, %al
movb %al, -0x31(%rbp)
testb $0x1, -0x31(%rbp)
jne 0x13b47
movq -0x2e8(%rbp), %rax
movq 0x8(%rax), %rdi
movl 0x30(%rax), %esi
movl 0x34(%rax), %edx
callq 0x16c90
jmp 0x13b26
movb $0x0, -0x1(%rbp)
movl $0x1, -0x48(%rbp)
jmp 0x13d6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x13d85
movq -0x2e8(%rbp), %rax
movl 0x30(%rax), %esi
leaq -0x88(%rbp), %rdi
callq 0xa480
jmp 0x13b5f
leaq 0x9963(%rip), %rsi      # 0x1d4c9
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rdx
callq 0xbf30
jmp 0x13b78
movq -0x2e8(%rbp), %rdi
addq $0xb0, %rdi
leaq -0x68(%rbp), %rsi
movq %rsi, -0x2f0(%rbp)
callq 0x6520
movq -0x2f0(%rbp), %rdi
callq 0x6280
leaq -0x88(%rbp), %rdi
callq 0x6280
movq -0x2e8(%rbp), %rax
movq 0x10(%rax), %rsi
addq $0xc0, %rsi
leaq 0x99f3(%rip), %rdx      # 0x1d5ba
leaq -0xc8(%rbp), %rdi
callq 0x79f0
jmp 0x13bd5
movq -0x2e8(%rbp), %rdx
addq $0xb0, %rdx
leaq -0xa8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x8720
jmp 0x13bf8
leaq -0xc8(%rbp), %rdi
callq 0x6280
leaq -0xa8(%rbp), %rdi
callq 0x6190
movq %rax, %rsi
leaq -0x2c8(%rbp), %rdi
movl $0x10, %edx
callq 0x6490
jmp 0x13c26
leaq -0x2c8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x63a0
jmp 0x13c38
movl $0x68, %edi
callq 0x6420
movq %rax, -0x2f8(%rbp)
jmp 0x13c4b
movq -0x2f8(%rbp), %rdi
callq 0x96f0
jmp 0x13c59
movq -0x2f8(%rbp), %rax
movq %rax, -0x2d0(%rbp)
movq -0x2d0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x97c0
jmp 0x13c7c
movq -0x2e8(%rbp), %rdi
movq 0x10(%rdi), %rax
movq %rax, -0x300(%rbp)
addq $0x48, %rdi
callq 0xa5a0
movq -0x2e8(%rbp), %rdx
movq -0x300(%rbp), %rdi
movl (%rax), %esi
addq $0xb0, %rdx
movq -0x2d0(%rbp), %rcx
callq 0xf250
jmp 0x13cbc
movb $0x1, -0x1(%rbp)
movl $0x1, -0x48(%rbp)
leaq -0x2c8(%rbp), %rdi
callq 0x6610
leaq -0xa8(%rbp), %rdi
callq 0x6280
jmp 0x13d6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x6280
jmp 0x13d85
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x6280
jmp 0x13d85
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x13d60
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x13d54
movq -0x2f8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movl $0x68, %esi
callq 0x6430
leaq -0x2c8(%rbp), %rdi
callq 0x6610
leaq -0xa8(%rbp), %rdi
callq 0x6280
jmp 0x13d85
leaq -0x30(%rbp), %rdi
callq 0x6280
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x6280
movq -0x40(%rbp), %rdi
callq 0x6700
nopw (%rax,%rax)