// File: ryuichiueda[P]GlueLang/src/main.cc
// Function: main
int main(int argc, char const* argv[])
{
	if(setpgid(0,0) != 0)
		exit(1);

	if(argc <= 1)
		usage();

///////////////////////////////////////////
// set signals
//////////////////////////////////////////
	struct sigaction sig;
	memset(&sig,'\0',sizeof(sig));

	sig.sa_handler = sig_int;
	sigaction(SIGINT,&sig,NULL);
	sig.sa_handler = sig_hup;
	sigaction(SIGHUP,&sig,NULL);
	sig.sa_handler = sig_term;
	sigaction(SIGTERM,&sig,NULL);

///////////////////////////////////////////
// initialization of top level objects 
//////////////////////////////////////////
	int script_pos = scriptPos(argc,argv);

	ifstream ifs(argv[script_pos]);
	Environment env(argc,argv,script_pos);

	if(!setFlags(argc,argv,&env))
		exit(1);//flags are invalid.

	// create the feeder
	Feeder feeder(&ifs);
	// set tmpdir
	string tmp_k = "tmpdir";
	string tmp_v = "/tmp/";
	env.setImportPath(&tmp_k,&tmp_v);
	Script s(&feeder,&env,NULL);

//////////////////////////////////////////
//execution
//////////////////////////////////////////
	s.parse();
	s.exec(NULL,NULL);
	//do not write something here because
	//a subshell cannot execute this part.
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x520, %rsp            # imm = 0x520
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
xorl %esi, %esi
movl %esi, %edi
callq 0x66a0
cmpl $0x0, %eax
je 0x1bcb1
movl $0x1, %edi
callq 0x64f0
cmpl $0x1, -0x8(%rbp)
jg 0x1bcbc
callq 0x1c020
xorps %xmm0, %xmm0
movaps %xmm0, -0x500(%rbp)
movaps %xmm0, -0x30(%rbp)
movaps %xmm0, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
movaps %xmm0, -0x60(%rbp)
movaps %xmm0, -0x70(%rbp)
movaps %xmm0, -0x80(%rbp)
movaps %xmm0, -0x90(%rbp)
movaps %xmm0, -0xa0(%rbp)
movaps %xmm0, -0xb0(%rbp)
movq $0x0, -0x20(%rbp)
leaq 0x34e(%rip), %rax       # 0x1c050
movq %rax, -0xb0(%rbp)
xorl %eax, %eax
movl %eax, %edx
movq %rdx, -0x4e8(%rbp)
movl $0x2, %edi
leaq -0xb0(%rbp), %rsi
movq %rsi, -0x4f0(%rbp)
callq 0x6540
movq -0x4f0(%rbp), %rsi
movq -0x4e8(%rbp), %rdx
leaq 0x32f(%rip), %rax       # 0x1c070
movq %rax, -0xb0(%rbp)
movl $0x1, %edi
callq 0x6540
movq -0x4f0(%rbp), %rsi
movq -0x4e8(%rbp), %rdx
leaq 0x329(%rip), %rax       # 0x1c090
movq %rax, -0xb0(%rbp)
movl $0xf, %edi
callq 0x6540
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x1c0b0
movl %eax, -0xb4(%rbp)
movq -0x10(%rbp), %rax
movslq -0xb4(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x2c0(%rbp), %rdi
movl $0x8, %edx
callq 0x6740
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
movl -0xb4(%rbp), %ecx
leaq -0x3b0(%rbp), %rdi
callq 0xdd60
jmp 0x1bdc5
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq -0x3b0(%rbp), %rdx
callq 0x1c220
movb %al, -0x501(%rbp)
jmp 0x1bde0
movb -0x501(%rbp), %al
testb $0x1, %al
jne 0x1be24
jmp 0x1bdec
movl $0x1, %edi
callq 0x64f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x3b8(%rbp)
movl %eax, -0x3bc(%rbp)
jmp 0x1c004
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x3b8(%rbp)
movl %eax, -0x3bc(%rbp)
jmp 0x1bff8
leaq -0x408(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x15fe0
jmp 0x1be39
leaq -0x429(%rbp), %rdi
movq %rdi, -0x510(%rbp)
callq 0x6710
movq -0x510(%rbp), %rdx
leaq 0x15d3(%rip), %rsi      # 0x1d42d
leaq -0x428(%rbp), %rdi
callq 0x7940
jmp 0x1be68
leaq -0x429(%rbp), %rdi
callq 0x6480
leaq -0x451(%rbp), %rdi
movq %rdi, -0x518(%rbp)
callq 0x6710
movq -0x518(%rbp), %rdx
leaq 0x19e9(%rip), %rsi      # 0x1d87e
leaq -0x450(%rbp), %rdi
callq 0x7940
jmp 0x1bea3
leaq -0x451(%rbp), %rdi
callq 0x6480
leaq -0x3b0(%rbp), %rdi
leaq -0x428(%rbp), %rsi
leaq -0x450(%rbp), %rdx
callq 0xe580
jmp 0x1becb
xorl %eax, %eax
movl %eax, %ecx
leaq -0x4e0(%rbp), %rdi
leaq -0x408(%rbp), %rsi
leaq -0x3b0(%rbp), %rdx
callq 0x1ad80
jmp 0x1beeb
leaq -0x4e0(%rbp), %rdi
callq 0x1aeb0
jmp 0x1bef9
xorl %eax, %eax
movl %eax, %edx
leaq -0x4e0(%rbp), %rdi
movq %rdx, %rsi
callq 0x1b4c0
jmp 0x1bf0e
leaq -0x4e0(%rbp), %rdi
callq 0x1add0
leaq -0x450(%rbp), %rdi
callq 0x6280
leaq -0x428(%rbp), %rdi
callq 0x6280
leaq -0x408(%rbp), %rdi
callq 0x160f0
leaq -0x3b0(%rbp), %rdi
callq 0xe020
leaq -0x2c0(%rbp), %rdi
callq 0x6100
movl -0x4(%rbp), %eax
addq $0x520, %rsp            # imm = 0x520
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x3b8(%rbp)
movl %eax, -0x3bc(%rbp)
leaq -0x429(%rbp), %rdi
callq 0x6480
jmp 0x1bfec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x3b8(%rbp)
movl %eax, -0x3bc(%rbp)
leaq -0x451(%rbp), %rdi
callq 0x6480
jmp 0x1bfe0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x3b8(%rbp)
movl %eax, -0x3bc(%rbp)
jmp 0x1bfd4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x3b8(%rbp)
movl %eax, -0x3bc(%rbp)
leaq -0x4e0(%rbp), %rdi
callq 0x1add0
leaq -0x450(%rbp), %rdi
callq 0x6280
leaq -0x428(%rbp), %rdi
callq 0x6280
leaq -0x408(%rbp), %rdi
callq 0x160f0
leaq -0x3b0(%rbp), %rdi
callq 0xe020
leaq -0x2c0(%rbp), %rdi
callq 0x6100
movq -0x3b8(%rbp), %rdi
callq 0x6700
nopl (%rax)