// File: ben-strasser[P]latex-checker/latex-checker.cpp
// Function: main
int main(){

	int line_num = 1;
	try{
		stack<Tag>s;

		
		auto skip_spaces = [&]{
			while(isspace(cin.peek())){
				if(cin.peek() == '\n'){
					++line_num;
				}
				cin.ignore();
			}
		};

		auto read_word = []{
			string word;
			while(isalnum(cin.peek()) || cin.peek() == '*')
				word += cin.get();
			return word;
		};

		auto check_close_tag = [&](string close_tag){
			if(s.empty()){
				if(close_tag == "}")
					throw string("} has no corresponding {");
				else if(close_tag == "]")
					throw string("\\] has no corresponding \\[");
				else 
					throw string("\"\\end{"+close_tag+"}\" has no corresponding \"\\begin{"+close_tag+"}\"");
			} else {
				auto x = s.top();
				s.pop();

				string wanted_close_tag = x.tag;
				if(wanted_close_tag == "{")
					wanted_close_tag = "}";
				if(wanted_close_tag == "[")
					wanted_close_tag = "]";


				if(close_tag != wanted_close_tag){
					ostringstream out;
					out << "on line "<<x.line_num << " a ";
					if(x.tag == "{")
						out << '{';
					else if(x.tag == "[")
						out << "\\[";
					else if(x.tag == "$")
						out << "$";
					else if(x.tag == "$$")
						out << "$$";
					else
						out << "\"\\begin{"<<x.tag << "}\"";
					out << " was opened but has not yet been closed. The ";
					if(close_tag == "}")
						out << '}';
					else if(close_tag == "]")
						out << "\\]";
					else if(close_tag == "$")
						out << "$";
					else if(close_tag == "$$")
						out << "$$";
					else
						out << "\"\\end{"<<close_tag << "}\"";
					out << " does not fit.";

					int unclosed = 1;
					while(!s.empty()){
						x = s.top();
						s.pop();

						wanted_close_tag = x.tag;
						if(wanted_close_tag == "{")
							wanted_close_tag = "}";
						if(wanted_close_tag == "[")
							wanted_close_tag = "]";
					
						if(close_tag == wanted_close_tag){
							out << " A matching ";
							if(x.tag == "{")
								out << '{';
							else if(x.tag == "[")
								out << "\\[";
							else if(x.tag == "$")
								out << "$";
							else if(x.tag == "$$")
								out << "$$";
							else
								out << "\"\\begin{"<<x.tag << "}\"";
							out << " was opened on line "<<x.line_num <<" but ";
							if(unclosed == 1)
								out << "one parenthesis";
							else
								out << unclosed << " parentheses";
							out << " must be closed first.";
							throw string(out.str());
						}else
							++unclosed;
					}
					out << " No matching tag was open.";
					throw string(out.str());
				}
			}
		};

		char c;
		while(c = cin.get(), cin){
			if(c == '%'){
				while(c = cin.get(), cin)
					if(c == '\n')
						break;
				++line_num;
			} else if(c == '\n'){
				++line_num;
			} else if(c == '{'){
				s.push(Tag{line_num, "{"});
			} else if(c == '}'){
				check_close_tag("}");
			} else if(c == '$'){
				string tag = "$";
				if(cin.peek() == '$'){
					cin.ignore();
					tag = "$$";
				}
				if(!s.empty() && s.top().tag == tag)
					check_close_tag(tag);
				else
					s.push(Tag{line_num, tag});
			} else if(c == '\\'){
				if(cin.peek() == '['){
					cin.ignore();
					s.push(Tag{line_num, "["});
				}else if(cin.peek() == ']'){
					cin.ignore();
					check_close_tag("]");
				}else{
					string cmd = read_word();
					if(cmd == "begin"){
						skip_spaces();
						if(cin.get() != '{')
							throw ("\"\\begin\" must be followed by an {");
						string tag = read_word();
						if(cin.get() != '}')
							throw ("\"\\begin{"+tag+"\" must be followed by an }");
						s.push(Tag{line_num, tag});
					}else if(cmd == "end"){
						skip_spaces();
						if(cin.get() != '{')
							throw ("\"\\begin\" must be followed by an {");
						string tag = read_word();
						if(cin.get() != '}')
							throw ("\"\\begin{"+tag+"\" must be followed by an }");
						check_close_tag(tag);
					}else if(cmd == ""){
						// next character is escaped. For example \{. This is not parenthesis that we should check for.
						c = cin.get();
						if(c == '\n')
							++line_num;
					}else if(is_begin_variation(cmd)){
						cout << "Warning in line "<<line_num<<": You wrote \""<< cmd << "{\". Did you mean \"begin{\"?" << endl;
					}else if(is_end_variation(cmd)){
						cout << "Warning in line "<<line_num<<": You wrote \""<< cmd << "{\". Did you mean \"end{\"?" << endl;
					}
				}
			}
		}

		if(!s.empty()){
			ostringstream out;
			out << "not all parentheses were closed, still open are :";
			while(!s.empty()){
				out << '\n';
				auto x = s.top();
				s.pop();
				if(x.tag == "[" || x.tag == "{")
					out << x.tag;
				else
					out << "\"\\begin{"<<x.tag<<"}\"";
				out << " opened on line "<<x.line_num;
			}
			throw string(out.str());
		}
	}catch(string&msg){
		cout << "Error in line "<<line_num<<": " << msg << endl;
		return 1;
	}catch(exception&err){
		cerr << "Exception: "<<err.what() << endl;
		return 2;
	}
	return 0;
}

// Assembly:
subq $0x5c8, %rsp            # imm = 0x5C8
movl $0x0, 0x5c4(%rsp)
movl $0x1, 0x5c0(%rsp)
leaq 0x570(%rsp), %rdi
callq 0x4ce0
jmp 0x2ccc
leaq 0x5c0(%rsp), %rax
movq %rax, 0x558(%rsp)
leaq 0x570(%rsp), %rax
movq %rax, 0x548(%rsp)
movq 0x72e5(%rip), %rdi      # 0x9fd8
callq 0x2230
movl %eax, 0x174(%rsp)
jmp 0x2d01
movl 0x174(%rsp), %eax
movb %al, 0x547(%rsp)
movq 0x72c2(%rip), %rdi      # 0x9fd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2240
movb %al, 0x173(%rsp)
jmp 0x2d2e
movb 0x173(%rsp), %al
testb $0x1, %al
jne 0x2d3e
jmp 0x3ad3
movsbl 0x547(%rsp), %eax
cmpl $0x25, %eax
jne 0x2dfc
jmp 0x2d51
movq 0x7280(%rip), %rdi      # 0x9fd8
callq 0x2230
movl %eax, 0x16c(%rsp)
jmp 0x2d66
movl 0x16c(%rsp), %eax
movb %al, 0x547(%rsp)
movq 0x725d(%rip), %rdi      # 0x9fd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2240
movb %al, 0x16b(%rsp)
jmp 0x2d93
movb 0x16b(%rsp), %al
testb $0x1, %al
jne 0x2da0
jmp 0x2de6
movsbl 0x547(%rsp), %eax
cmpl $0xa, %eax
jne 0x2de1
jmp 0x2de6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
jmp 0x3d41
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
jmp 0x3d34
jmp 0x2d51
movl 0x5c0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c0(%rsp)
jmp 0x3ace
movsbl 0x547(%rsp), %eax
cmpl $0xa, %eax
jne 0x2e1f
movl 0x5c0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c0(%rsp)
jmp 0x3acc
movsbl 0x547(%rsp), %eax
cmpl $0x7b, %eax
jne 0x2f00
movl 0x5c0(%rsp), %eax
movl %eax, 0x518(%rsp)
leaq 0x520(%rsp), %rax
movq %rax, 0x158(%rsp)
leaq 0x517(%rsp), %rdi
movq %rdi, 0x160(%rsp)
callq 0x2330
movq 0x158(%rsp), %rdi
movq 0x160(%rsp), %rdx
leaq 0x42cb(%rip), %rsi      # 0x7145
callq 0x2280
jmp 0x2e81
leaq 0x570(%rsp), %rdi
leaq 0x518(%rsp), %rsi
callq 0x4d10
jmp 0x2e98
leaq 0x518(%rsp), %rdi
callq 0x4d40
leaq 0x517(%rsp), %rdi
callq 0x2210
jmp 0x3aca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
jmp 0x2eee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
leaq 0x518(%rsp), %rdi
callq 0x4d40
leaq 0x517(%rsp), %rdi
callq 0x2210
jmp 0x3d34
movsbl 0x547(%rsp), %eax
cmpl $0x7d, %eax
jne 0x2fc3
leaq 0x4ef(%rsp), %rdi
movq %rdi, 0x150(%rsp)
callq 0x2330
movq 0x150(%rsp), %rdx
leaq 0x4150(%rip), %rsi      # 0x7085
leaq 0x4f0(%rsp), %rdi
callq 0x2280
jmp 0x2f44
leaq 0x548(%rsp), %rdi
leaq 0x4f0(%rsp), %rsi
callq 0x3ef0
jmp 0x2f5b
leaq 0x4f0(%rsp), %rdi
callq 0x2378
leaq 0x4ef(%rsp), %rdi
callq 0x2210
jmp 0x3ac8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
jmp 0x2fb1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
leaq 0x4f0(%rsp), %rdi
callq 0x2378
leaq 0x4ef(%rsp), %rdi
callq 0x2210
jmp 0x3d34
movsbl 0x547(%rsp), %eax
cmpl $0x24, %eax
jne 0x31ef
leaq 0x4c7(%rsp), %rdi
movq %rdi, 0x148(%rsp)
callq 0x2330
movq 0x148(%rsp), %rdx
leaq 0x404a(%rip), %rsi      # 0x7042
leaq 0x4c8(%rsp), %rdi
callq 0x2280
jmp 0x3007
leaq 0x4c7(%rsp), %rdi
callq 0x2210
movq 0x6fbd(%rip), %rdi      # 0x9fd8
callq 0x20a0
movl %eax, 0x144(%rsp)
jmp 0x3029
movl 0x144(%rsp), %eax
cmpl $0x24, %eax
jne 0x309a
movq 0x6f9c(%rip), %rdi      # 0x9fd8
callq 0x2340
jmp 0x3043
leaq 0x3ff7(%rip), %rsi      # 0x7041
leaq 0x4c8(%rsp), %rdi
callq 0x2270
jmp 0x3059
jmp 0x309a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
leaq 0x4c7(%rsp), %rdi
callq 0x2210
jmp 0x3d34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
jmp 0x31dd
leaq 0x570(%rsp), %rdi
callq 0x4d60
movb %al, 0x143(%rsp)
jmp 0x30b0
movb 0x143(%rsp), %al
testb $0x1, %al
jne 0x315d
jmp 0x30c1
leaq 0x570(%rsp), %rdi
callq 0x4e20
movq %rax, 0x138(%rsp)
jmp 0x30d8
movq 0x138(%rsp), %rdi
addq $0x8, %rdi
leaq 0x4c8(%rsp), %rsi
callq 0x4d80
testb $0x1, %al
jne 0x30f7
jmp 0x315d
leaq 0x4a0(%rsp), %rdi
leaq 0x4c8(%rsp), %rsi
callq 0x20d0
jmp 0x310e
leaq 0x548(%rsp), %rdi
leaq 0x4a0(%rsp), %rsi
callq 0x3ef0
jmp 0x3125
leaq 0x4a0(%rsp), %rdi
callq 0x2378
jmp 0x31cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
leaq 0x4a0(%rsp), %rdi
callq 0x2378
jmp 0x31dd
movl 0x5c0(%rsp), %eax
movl %eax, 0x478(%rsp)
leaq 0x480(%rsp), %rdi
leaq 0x4c8(%rsp), %rsi
callq 0x20d0
jmp 0x3182
leaq 0x570(%rsp), %rdi
leaq 0x478(%rsp), %rsi
callq 0x4d10
jmp 0x3199
leaq 0x478(%rsp), %rdi
callq 0x4d40
jmp 0x31cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
leaq 0x478(%rsp), %rdi
callq 0x4d40
jmp 0x31dd
leaq 0x4c8(%rsp), %rdi
callq 0x2378
jmp 0x3ac6
leaq 0x4c8(%rsp), %rdi
callq 0x2378
jmp 0x3d34
movsbl 0x547(%rsp), %eax
cmpl $0x5c, %eax
jne 0x3ac4
movq 0x6dd1(%rip), %rdi      # 0x9fd8
callq 0x20a0
movl %eax, 0x134(%rsp)
jmp 0x3215
movl 0x134(%rsp), %eax
cmpl $0x5b, %eax
jne 0x3303
movq 0x6dac(%rip), %rdi      # 0x9fd8
callq 0x2340
jmp 0x3233
movl 0x5c0(%rsp), %eax
movl %eax, 0x450(%rsp)
leaq 0x458(%rsp), %rax
movq %rax, 0x120(%rsp)
leaq 0x44f(%rsp), %rdi
movq %rdi, 0x128(%rsp)
callq 0x2330
movq 0x120(%rsp), %rdi
movq 0x128(%rsp), %rdx
leaq 0x3ee3(%rip), %rsi      # 0x7160
callq 0x2280
jmp 0x3284
leaq 0x570(%rsp), %rdi
leaq 0x450(%rsp), %rsi
callq 0x4d10
jmp 0x329b
leaq 0x450(%rsp), %rdi
callq 0x4d40
leaq 0x44f(%rsp), %rdi
callq 0x2210
jmp 0x3ac2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
jmp 0x32f1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
leaq 0x450(%rsp), %rdi
callq 0x4d40
leaq 0x44f(%rsp), %rdi
callq 0x2210
jmp 0x3d34
movq 0x6cce(%rip), %rdi      # 0x9fd8
callq 0x20a0
movl %eax, 0x11c(%rsp)
jmp 0x3318
movl 0x11c(%rsp), %eax
cmpl $0x5d, %eax
jne 0x33e8
movq 0x6ca9(%rip), %rdi      # 0x9fd8
callq 0x2340
jmp 0x3336
leaq 0x427(%rsp), %rdi
movq %rdi, 0x110(%rsp)
callq 0x2330
movq 0x110(%rsp), %rdx
leaq 0x3e63(%rip), %rsi      # 0x71bd
leaq 0x428(%rsp), %rdi
callq 0x2280
jmp 0x3369
leaq 0x548(%rsp), %rdi
leaq 0x428(%rsp), %rsi
callq 0x3ef0
jmp 0x3380
leaq 0x428(%rsp), %rdi
callq 0x2378
leaq 0x427(%rsp), %rdi
callq 0x2210
jmp 0x3ac0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
jmp 0x33d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
leaq 0x428(%rsp), %rdi
callq 0x2378
leaq 0x427(%rsp), %rdi
callq 0x2210
jmp 0x3d34
leaq 0x400(%rsp), %rdi
leaq 0x557(%rsp), %rsi
callq 0x4af0
jmp 0x33ff
leaq 0x3c3e(%rip), %rsi      # 0x7044
leaq 0x400(%rsp), %rdi
callq 0x4e30
movb %al, 0x10f(%rsp)
jmp 0x341c
movb 0x10f(%rsp), %al
testb $0x1, %al
jne 0x342c
jmp 0x3654
leaq 0x558(%rsp), %rdi
callq 0x4bd0
jmp 0x343b
movq 0x6b96(%rip), %rdi      # 0x9fd8
callq 0x2230
movl %eax, 0x108(%rsp)
jmp 0x3450
movl 0x108(%rsp), %eax
cmpl $0x7b, %eax
je 0x34a1
movl $0x8, %edi
callq 0x2100
movq %rax, %rdi
leaq 0x3bda(%rip), %rax      # 0x704a
movq %rax, (%rdi)
movq 0x6b36(%rip), %rsi      # 0x9fb0
xorl %eax, %eax
movl %eax, %edx
callq 0x22f0
jmp 0x3eec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
jmp 0x3aae
leaq 0x3e0(%rsp), %rdi
leaq 0x557(%rsp), %rsi
callq 0x4af0
jmp 0x34b8
movq 0x6b19(%rip), %rdi      # 0x9fd8
callq 0x2230
movl %eax, 0x104(%rsp)
jmp 0x34cd
movl 0x104(%rsp), %eax
cmpl $0x7d, %eax
je 0x35c6
movb $0x1, 0x3bf(%rsp)
movl $0x20, %edi
callq 0x2100
movq %rax, 0xf8(%rsp)
leaq 0x3c83(%rip), %rsi      # 0x7181
leaq 0x3c0(%rsp), %rdi
leaq 0x3e0(%rsp), %rdx
callq 0x4eb0
jmp 0x3515
movq 0xf8(%rsp), %rdi
leaq 0x3b48(%rip), %rdx      # 0x706c
leaq 0x3c0(%rsp), %rsi
callq 0x4e60
jmp 0x3533
movq 0xf8(%rsp), %rdi
movb $0x0, 0x3bf(%rsp)
leaq 0x6836(%rip), %rsi      # 0x9d80
movq 0x6a67(%rip), %rdx      # 0x9fb8
callq 0x22f0
jmp 0x3eec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
jmp 0x3642
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
jmp 0x35ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
leaq 0x3c0(%rsp), %rdi
callq 0x2378
testb $0x1, 0x3bf(%rsp)
jne 0x35b7
jmp 0x35c4
movq 0xf8(%rsp), %rdi
callq 0x2170
jmp 0x3642
movl 0x5c0(%rsp), %eax
movl %eax, 0x390(%rsp)
leaq 0x398(%rsp), %rdi
leaq 0x3e0(%rsp), %rsi
callq 0x20d0
jmp 0x35eb
leaq 0x570(%rsp), %rdi
leaq 0x390(%rsp), %rsi
callq 0x4d10
jmp 0x3602
leaq 0x390(%rsp), %rdi
callq 0x4d40
leaq 0x3e0(%rsp), %rdi
callq 0x2378
jmp 0x3a9f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
leaq 0x390(%rsp), %rdi
callq 0x4d40
leaq 0x3e0(%rsp), %rdi
callq 0x2378
jmp 0x3aae
leaq 0x3a2c(%rip), %rsi      # 0x7087
leaq 0x400(%rsp), %rdi
callq 0x4e30
movb %al, 0xf7(%rsp)
jmp 0x3671
movb 0xf7(%rsp), %al
testb $0x1, %al
jne 0x3681
jmp 0x3882
leaq 0x558(%rsp), %rdi
callq 0x4bd0
jmp 0x3690
movq 0x6941(%rip), %rdi      # 0x9fd8
callq 0x2230
movl %eax, 0xf0(%rsp)
jmp 0x36a5
movl 0xf0(%rsp), %eax
cmpl $0x7b, %eax
je 0x36dd
movl $0x8, %edi
callq 0x2100
movq %rax, %rdi
leaq 0x3985(%rip), %rax      # 0x704a
movq %rax, (%rdi)
movq 0x68e1(%rip), %rsi      # 0x9fb0
xorl %eax, %eax
movl %eax, %edx
callq 0x22f0
jmp 0x3eec
leaq 0x370(%rsp), %rdi
leaq 0x557(%rsp), %rsi
callq 0x4af0
jmp 0x36f4
movq 0x68dd(%rip), %rdi      # 0x9fd8
callq 0x2230
movl %eax, 0xec(%rsp)
jmp 0x3709
movl 0xec(%rsp), %eax
cmpl $0x7d, %eax
je 0x3802
movb $0x1, 0x34f(%rsp)
movl $0x20, %edi
callq 0x2100
movq %rax, 0xe0(%rsp)
leaq 0x3a47(%rip), %rsi      # 0x7181
leaq 0x350(%rsp), %rdi
leaq 0x370(%rsp), %rdx
callq 0x4eb0
jmp 0x3751
movq 0xe0(%rsp), %rdi
leaq 0x390c(%rip), %rdx      # 0x706c
leaq 0x350(%rsp), %rsi
callq 0x4e60
jmp 0x376f
movq 0xe0(%rsp), %rdi
movb $0x0, 0x34f(%rsp)
leaq 0x65fa(%rip), %rsi      # 0x9d80
movq 0x682b(%rip), %rdx      # 0x9fb8
callq 0x22f0
jmp 0x3eec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
jmp 0x3870
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
jmp 0x37e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
leaq 0x350(%rsp), %rdi
callq 0x2378
testb $0x1, 0x34f(%rsp)
jne 0x37f3
jmp 0x3800
movq 0xe0(%rsp), %rdi
callq 0x2170
jmp 0x3870
leaq 0x328(%rsp), %rdi
leaq 0x370(%rsp), %rsi
callq 0x20d0
jmp 0x3819
leaq 0x548(%rsp), %rdi
leaq 0x328(%rsp), %rsi
callq 0x3ef0
jmp 0x3830
leaq 0x328(%rsp), %rdi
callq 0x2378
leaq 0x370(%rsp), %rdi
callq 0x2378
jmp 0x3a9d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
leaq 0x328(%rsp), %rdi
callq 0x2378
leaq 0x370(%rsp), %rdi
callq 0x2378
jmp 0x3aae
leaq 0x3895(%rip), %rsi      # 0x711e
leaq 0x400(%rsp), %rdi
callq 0x4e30
movb %al, 0xdf(%rsp)
jmp 0x389f
movb 0xdf(%rsp), %al
testb $0x1, %al
jne 0x38ac
jmp 0x38f2
movq 0x6725(%rip), %rdi      # 0x9fd8
callq 0x2230
movl %eax, 0xd8(%rsp)
jmp 0x38c1
movl 0xd8(%rsp), %eax
movb %al, 0x547(%rsp)
movsbl 0x547(%rsp), %eax
cmpl $0xa, %eax
jne 0x38ed
movl 0x5c0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c0(%rsp)
jmp 0x3a9b
leaq 0x400(%rsp), %rdi
callq 0x2be0
movb %al, 0xd7(%rsp)
jmp 0x3908
movb 0xd7(%rsp), %al
testb $0x1, %al
jne 0x3918
jmp 0x39c9
movq 0x66a9(%rip), %rdi      # 0x9fc8
leaq 0x3765(%rip), %rsi      # 0x708b
callq 0x21c0
movq %rax, 0xc8(%rsp)
jmp 0x3935
movq 0xc8(%rsp), %rdi
movl 0x5c0(%rsp), %esi
callq 0x2310
movq %rax, 0xc0(%rsp)
jmp 0x3953
movq 0xc0(%rsp), %rdi
leaq 0x373a(%rip), %rsi      # 0x709c
callq 0x21c0
movq %rax, 0xb8(%rsp)
jmp 0x3971
movq 0xb8(%rsp), %rdi
leaq 0x400(%rsp), %rsi
callq 0x21a0
movq %rax, 0xb0(%rsp)
jmp 0x3990
movq 0xb0(%rsp), %rdi
leaq 0x370b(%rip), %rsi      # 0x70aa
callq 0x21c0
movq %rax, 0xa8(%rsp)
jmp 0x39ae
movq 0xa8(%rsp), %rdi
movq 0x65eb(%rip), %rsi      # 0x9fa8
callq 0x2200
jmp 0x39c4
jmp 0x3a99
leaq 0x400(%rsp), %rdi
callq 0x2c40
movb %al, 0xa7(%rsp)
jmp 0x39df
movb 0xa7(%rsp), %al
testb $0x1, %al
jne 0x39ef
jmp 0x3a97
movq 0x65d2(%rip), %rdi      # 0x9fc8
leaq 0x368e(%rip), %rsi      # 0x708b
callq 0x21c0
movq %rax, 0x98(%rsp)
jmp 0x3a0c
movq 0x98(%rsp), %rdi
movl 0x5c0(%rsp), %esi
callq 0x2310
movq %rax, 0x90(%rsp)
jmp 0x3a2a
movq 0x90(%rsp), %rdi
leaq 0x3663(%rip), %rsi      # 0x709c
callq 0x21c0
movq %rax, 0x88(%rsp)
jmp 0x3a48
movq 0x88(%rsp), %rdi
leaq 0x400(%rsp), %rsi
callq 0x21a0
movq %rax, 0x80(%rsp)
jmp 0x3a67
movq 0x80(%rsp), %rdi
leaq 0x364f(%rip), %rsi      # 0x70c5
callq 0x21c0
movq %rax, 0x78(%rsp)
jmp 0x3a82
movq 0x78(%rsp), %rdi
movq 0x651a(%rip), %rsi      # 0x9fa8
callq 0x2200
jmp 0x3a95
jmp 0x3a97
jmp 0x3a99
jmp 0x3a9b
jmp 0x3a9d
jmp 0x3a9f
leaq 0x400(%rsp), %rdi
callq 0x2378
jmp 0x3ac0
leaq 0x400(%rsp), %rdi
callq 0x2378
jmp 0x3d34
jmp 0x3ac2
jmp 0x3ac4
jmp 0x3ac6
jmp 0x3ac8
jmp 0x3aca
jmp 0x3acc
jmp 0x3ace
jmp 0x2cec
leaq 0x570(%rsp), %rdi
callq 0x4d60
movb %al, 0x77(%rsp)
jmp 0x3ae6
movb 0x77(%rsp), %al
testb $0x1, %al
jne 0x3d22
jmp 0x3af4
leaq 0x1b0(%rsp), %rdi
callq 0x2260
jmp 0x3b03
leaq 0x35d4(%rip), %rsi      # 0x70de
leaq 0x1b0(%rsp), %rdi
callq 0x21c0
jmp 0x3b19
jmp 0x3b1b
leaq 0x570(%rsp), %rdi
callq 0x4d60
movb %al, 0x76(%rsp)
jmp 0x3b2e
movb 0x76(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3b3d
jmp 0x3cb4
leaq 0x1b0(%rsp), %rdi
movl $0xa, %esi
callq 0x2220
jmp 0x3b51
leaq 0x570(%rsp), %rdi
callq 0x4e20
movq %rax, 0x68(%rsp)
jmp 0x3b65
movq 0x68(%rsp), %rsi
leaq 0x188(%rsp), %rdi
callq 0x4fe0
jmp 0x3b79
leaq 0x570(%rsp), %rdi
callq 0x5020
jmp 0x3b88
leaq 0x190(%rsp), %rdi
leaq 0x35c9(%rip), %rsi      # 0x7160
callq 0x4e30
movb %al, 0x67(%rsp)
jmp 0x3ba2
movb 0x67(%rsp), %al
testb $0x1, %al
jne 0x3bd0
jmp 0x3bac
leaq 0x190(%rsp), %rdi
leaq 0x358a(%rip), %rsi      # 0x7145
callq 0x4e30
movb %al, 0x66(%rsp)
jmp 0x3bc6
movb 0x66(%rsp), %al
testb $0x1, %al
jne 0x3bd0
jmp 0x3c2b
leaq 0x190(%rsp), %rsi
leaq 0x1b0(%rsp), %rdi
callq 0x21a0
jmp 0x3be7
jmp 0x3c74
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
jmp 0x3d13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
leaq 0x188(%rsp), %rdi
callq 0x4d40
jmp 0x3d13
leaq 0x354f(%rip), %rsi      # 0x7181
leaq 0x1b0(%rsp), %rdi
callq 0x21c0
movq %rax, 0x58(%rsp)
jmp 0x3c46
movq 0x58(%rsp), %rdi
leaq 0x190(%rsp), %rsi
callq 0x21a0
movq %rax, 0x50(%rsp)
jmp 0x3c5f
movq 0x50(%rsp), %rdi
leaq 0x34a5(%rip), %rsi      # 0x7110
callq 0x21c0
jmp 0x3c72
jmp 0x3c74
leaq 0x3564(%rip), %rsi      # 0x71df
leaq 0x1b0(%rsp), %rdi
callq 0x21c0
movq %rax, 0x48(%rsp)
jmp 0x3c8f
movq 0x48(%rsp), %rdi
movl 0x188(%rsp), %esi
callq 0x2310
jmp 0x3ca2
leaq 0x188(%rsp), %rdi
callq 0x4d40
jmp 0x3b1b
movl $0x20, %edi
callq 0x2100
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x40(%rsp)
leaq 0x1b0(%rsp), %rsi
callq 0x21e0
jmp 0x3cd8
movq 0x40(%rsp), %rdi
leaq 0x609c(%rip), %rsi      # 0x9d80
movq 0x62cd(%rip), %rdx      # 0x9fb8
callq 0x22f0
jmp 0x3eec
movq 0x40(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
callq 0x2170
leaq 0x1b0(%rsp), %rdi
callq 0x2060
jmp 0x3d34
leaq 0x570(%rsp), %rdi
callq 0x5030
jmp 0x3ebd
leaq 0x570(%rsp), %rdi
callq 0x5030
movl 0x564(%rsp), %eax
movl %eax, 0x3c(%rsp)
movl $0x2, %ecx
cmpl %ecx, %eax
jne 0x3df9
movq 0x568(%rsp), %rdi
callq 0x20c0
movq %rax, 0x178(%rsp)
movq 0x6253(%rip), %rdi      # 0x9fc8
leaq 0x33a3(%rip), %rsi      # 0x711f
callq 0x21c0
movq %rax, 0x30(%rsp)
jmp 0x3d88
movq 0x30(%rsp), %rdi
movl 0x5c0(%rsp), %esi
callq 0x2310
movq %rax, 0x28(%rsp)
jmp 0x3da0
movq 0x28(%rsp), %rdi
leaq 0x3370(%rip), %rsi      # 0x711c
callq 0x21c0
movq %rax, 0x20(%rsp)
jmp 0x3db8
movq 0x20(%rsp), %rdi
movq 0x178(%rsp), %rsi
callq 0x21a0
movq %rax, 0x18(%rsp)
jmp 0x3dd1
movq 0x18(%rsp), %rdi
movq 0x61cb(%rip), %rsi      # 0x9fa8
callq 0x2200
jmp 0x3de4
movl $0x1, 0x5c4(%rsp)
callq 0x22e0
jmp 0x3ec8
movl 0x3c(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x3ed7
movq 0x568(%rsp), %rdi
callq 0x20c0
movq %rax, 0x180(%rsp)
movq 0x61ca(%rip), %rdi      # 0x9ff0
leaq 0x32e6(%rip), %rsi      # 0x7113
callq 0x21c0
movq %rax, 0x10(%rsp)
jmp 0x3e39
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x21c0
movq %rax, 0x8(%rsp)
jmp 0x3e5e
movq 0x8(%rsp), %rdi
movq 0x613e(%rip), %rsi      # 0x9fa8
callq 0x2200
jmp 0x3e71
movl $0x2, 0x5c4(%rsp)
callq 0x22e0
jmp 0x3ec8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
callq 0x22e0
jmp 0x3e9e
jmp 0x3ed7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x568(%rsp)
movl %eax, 0x564(%rsp)
callq 0x22e0
jmp 0x3ebb
jmp 0x3ed7
movl $0x0, 0x5c4(%rsp)
movl 0x5c4(%rsp), %eax
addq $0x5c8, %rsp            # imm = 0x5C8
retq
movq 0x568(%rsp), %rdi
callq 0x2320
movq %rax, %rdi
callq 0x5040
nopl (%rax)