// File: ryuichiueda[P]GlueLang/src/Environment.cc
// Function: Environment::Environment(int, char const**, int)
Environment::Environment(int argc, char const* argv[],int script_pos)
{
	// set cwd (this directory is never changed)
	char tmp[MAXPATHLEN];
	if (getcwd(tmp,sizeof(tmp)) == NULL){
		cerr << "Initizalization error" << endl;
		perror ("getcwd");
		exit(5);
	}

	m_dir = tmp;	
	m_pid = getpid();
	m_ppid = getppid();

	//set arguments 
	for(int i=script_pos;i<argc;i++)
		m_args.push_back(argv[i]);

	m_v_opt = false;
	m_level = 0;
	//m_job_counter = 0;
	//m_is_local = false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10b0, %rsp           # imm = 0x10B0
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x1068(%rbp)
callq 0xf3e0
movq -0x1068(%rbp), %rdi
addq $0x18, %rdi
movq %rdi, -0x1088(%rbp)
callq 0xf400
movq -0x1068(%rbp), %rdi
addq $0x48, %rdi
movq %rdi, -0x1080(%rbp)
callq 0x65a0
movq -0x1068(%rbp), %rdi
addq $0x68, %rdi
movq %rdi, -0x1078(%rbp)
callq 0xf420
movq -0x1068(%rbp), %rdi
addq $0xa0, %rdi
movq %rdi, -0x1070(%rbp)
callq 0x65a0
movq -0x1068(%rbp), %rdi
addq $0xc0, %rdi
movq %rdi, -0x1060(%rbp)
callq 0x65a0
leaq -0x1020(%rbp), %rdi
movl $0x1000, %esi           # imm = 0x1000
callq 0x6210
cmpq $0x0, %rax
jne 0xde79
movq 0x1b1c8(%rip), %rdi     # 0x28fe8
leaq 0xf5da(%rip), %rsi      # 0x1d401
callq 0x6410
movq %rax, -0x1090(%rbp)
jmp 0xde35
movq -0x1090(%rbp), %rdi
movq 0x1b165(%rip), %rsi     # 0x28fa8
callq 0x6460
jmp 0xde4a
leaq 0xf5c6(%rip), %rdi      # 0x1d417
callq 0x6360
jmp 0xde58
movl $0x5, %edi
callq 0x64f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1028(%rbp)
movl %eax, -0x102c(%rbp)
jmp 0xdfc7
movq -0x1068(%rbp), %rdi
addq $0x48, %rdi
leaq -0x1020(%rbp), %rsi
callq 0x6580
jmp 0xde92
callq 0x6600
movl %eax, %ecx
movq -0x1068(%rbp), %rax
movl %ecx, 0xe4(%rax)
callq 0x65b0
movl %eax, %ecx
movq -0x1068(%rbp), %rax
movl %ecx, 0xe8(%rax)
movl -0x1c(%rbp), %eax
movl %eax, -0x1030(%rbp)
movl -0x1030(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xdfa6
movq -0x1068(%rbp), %rax
movq %rax, -0x10a8(%rbp)
movq -0x18(%rbp), %rax
movslq -0x1030(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x10a0(%rbp)
leaq -0x1051(%rbp), %rdi
movq %rdi, -0x1098(%rbp)
callq 0x6710
movq -0x10a0(%rbp), %rsi
movq -0x1098(%rbp), %rdx
leaq -0x1050(%rbp), %rdi
callq 0x7940
jmp 0xdf25
movq -0x10a8(%rbp), %rdi
leaq -0x1050(%rbp), %rsi
callq 0xf440
jmp 0xdf3a
leaq -0x1050(%rbp), %rdi
callq 0x6280
leaq -0x1051(%rbp), %rdi
callq 0x6480
movl -0x1030(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1030(%rbp)
jmp 0xdec3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1028(%rbp)
movl %eax, -0x102c(%rbp)
jmp 0xdf98
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1028(%rbp)
movl %eax, -0x102c(%rbp)
leaq -0x1050(%rbp), %rdi
callq 0x6280
leaq -0x1051(%rbp), %rdi
callq 0x6480
jmp 0xdfc7
movq -0x1068(%rbp), %rax
movb $0x0, 0xe0(%rax)
movl $0x0, 0x9c(%rax)
addq $0x10b0, %rsp           # imm = 0x10B0
popq %rbp
retq
movq -0x1060(%rbp), %rdi
callq 0x6280
movq -0x1070(%rbp), %rdi
callq 0x6280
movq -0x1078(%rbp), %rdi
callq 0xf470
movq -0x1080(%rbp), %rdi
callq 0x6280
movq -0x1088(%rbp), %rdi
callq 0xf490
movq -0x1068(%rbp), %rdi
callq 0xf4b0
movq -0x1028(%rbp), %rdi
callq 0x6700
nopl (%rax,%rax)