// File: /workspace/github_cpp_makefile_star2_O2/BUSEC[P]RPKI_Downgrade_Detector/cli.cpp
// Function: readScanROAFile(std::vector<ROA*, std::allocator<ROA*>>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*)
int readScanROAFile(vector<ROA*>* ROAs, string* filepath){

	ifstream f;
	f.open(*filepath);
	if ( f.is_open() ) {
		string line;

		while( getline(f, line) ){
			string path;
			string datetime;
			int as = 0;

			istringstream iss(line);
			int i = 0;
			do {
	
				if ( i == 0 ) iss>>path;
				if ( i == 1 ) iss>>datetime;
				if ( i == 2 ) iss>>as;

				if ( i > 2 ) {
					string prefix;
					iss>>prefix;

					// Ignore ipv6 prefixes (ipv6 prefixes contain ':' )
					// and
					// Ignore empty strings
					if ( prefix.find(":") == std::string::npos && prefix != "") {
						string formatStr = "%d.%d.%d.%d/%d-%d";
						int ip1, ip2, ip3, ip4, prefixlen, maxlen;

						sscanf(prefix.c_str(), formatStr.c_str(), &ip1, &ip2, &ip3, &ip4, &prefixlen, &maxlen);

						ROA* roa = new ROA(as, IPPrefix(IPAddr(ip1,ip2,ip3,ip4), prefixlen), maxlen, path );
						ROAs->push_back(roa);
					}
				}

				i++;
			} while(iss);
			assert(i > 3); // Something is wrong if we didn't read in atleast for tokens from this line (bad format)

		}
		f.close();
	} else return 0;
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x488, %rsp            # imm = 0x488
movq %rsi, %rbx
movq %rdi, 0x58(%rsp)
leaq 0x100(%rsp), %r14
movq %r14, %rdi
callq 0x2280
pushq $0x8
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x21f0
leaq 0x178(%rsp), %rdi
callq 0x2070
xorl %ebx, %ebx
testb %al, %al
je 0x36bb
leaq 0xb0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x48(%rsp), %rbx
leaq 0xa0(%rsp), %r14
leaq 0x308(%rsp), %r12
leaq 0x80(%rsp), %r15
leaq 0xc(%rsp), %rbp
leaq 0x100(%rsp), %rdi
movq %r14, %rsi
callq 0x2050
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x369e
leaq 0x70(%rsp), %rax
movq %rax, 0x60(%rsp)
andq $0x0, 0x68(%rsp)
xorl %ecx, %ecx
movb %cl, 0x70(%rsp)
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
andq $0x0, 0x88(%rsp)
movb %cl, 0x90(%rsp)
andl $0x0, 0xc(%rsp)
movq %r12, %rdi
movq %r14, %rsi
pushq $0x8
popq %rdx
callq 0x2330
xorl %r13d, %r13d
cmpl $0x2, %r13d
je 0x34da
movq %r15, %rsi
cmpl $0x1, %r13d
je 0x34d0
testl %r13d, %r13d
jne 0x34ec
leaq 0x60(%rsp), %rsi
movq %r12, %rdi
callq 0x22a0
jmp 0x34e5
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2160
xorl %eax, %eax
jmp 0x3656
movq %rbx, 0x38(%rsp)
andq $0x0, 0x40(%rsp)
movb $0x0, 0x48(%rsp)
movq %r12, %rdi
leaq 0x38(%rsp), %r14
movq %r14, %rsi
callq 0x22a0
movq %r14, %rdi
leaq 0x3bac(%rip), %rsi      # 0x70c2
xorl %edx, %edx
callq 0x2380
cmpq $-0x1, %rax
jne 0x364c
movq %r14, %rdi
leaq 0x3de6(%rip), %rsi      # 0x7317
callq 0x47aa
testb %al, %al
je 0x364c
leaq 0xc0(%rsp), %rdi
leaq 0x3b93(%rip), %rsi      # 0x70e0
leaq 0x28(%rsp), %rdx
callq 0x47b4
movq 0x38(%rsp), %rdi
movq 0xc0(%rsp), %rsi
leaq 0x24(%rsp), %rdx
leaq 0x20(%rsp), %rcx
leaq 0x1c(%rsp), %r8
leaq 0x18(%rsp), %r9
xorl %eax, %eax
leaq 0x10(%rsp), %r10
pushq %r10
leaq 0x1c(%rsp), %r10
pushq %r10
callq 0x2220
popq %rcx
popq %rdx
pushq $0x30
popq %rdi
callq 0x2240
movq %rax, %rbp
movl 0x24(%rsp), %eax
movl 0x20(%rsp), %ecx
movl 0x1c(%rsp), %edx
movzbl 0x18(%rsp), %esi
shll $0x18, %eax
movzbl %cl, %ecx
shll $0x10, %ecx
orl %eax, %ecx
shll $0x8, %edx
movzwl %dx, %eax
orl %ecx, %eax
orl %esi, %eax
movl 0x14(%rsp), %edx
movl %edx, %ecx
negb %cl
shrl %cl, %eax
shll %cl, %eax
testl %edx, %edx
cmovel %edx, %eax
movl 0xc(%rsp), %ebx
movl %eax, 0x30(%rsp)
movl %edx, 0x34(%rsp)
movl 0x10(%rsp), %r14d
leaq 0xe0(%rsp), %r15
movq %r15, %rdi
leaq 0x60(%rsp), %rsi
callq 0x22c0
movq %rbp, %rdi
movl %ebx, %esi
leaq 0x30(%rsp), %rdx
movl %r14d, %ecx
movq %r15, %r8
callq 0x47f0
movq %r15, %rdi
callq 0x20e0
movq %rbp, 0x28(%rsp)
movq 0x58(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x40f8
leaq 0xc0(%rsp), %rdi
callq 0x20e0
leaq 0x48(%rsp), %rbx
leaq 0x80(%rsp), %r15
leaq 0xc(%rsp), %rbp
leaq 0x38(%rsp), %r14
movq %r14, %rdi
callq 0x20e0
movb $0x1, %al
movq 0x308(%rsp), %rcx
movq -0x18(%rcx), %rcx
incl %r13d
testb $0x5, 0x328(%rsp,%rcx)
je 0x34b7
testb %al, %al
je 0x36dc
movq %r12, %rdi
callq 0x20f0
movq %r15, %rdi
callq 0x20e0
leaq 0x60(%rsp), %rdi
callq 0x20e0
leaq 0xa0(%rsp), %r14
jmp 0x3449
leaq 0x100(%rsp), %rdi
callq 0x2060
leaq 0xa0(%rsp), %rdi
callq 0x20e0
pushq $0x1
popq %rbx
leaq 0x100(%rsp), %rdi
callq 0x2080
movl %ebx, %eax
addq $0x488, %rsp            # imm = 0x488
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3a0f(%rip), %rdi      # 0x70f2
leaq 0x3a0e(%rip), %rsi      # 0x70f8
leaq 0x3a0f(%rip), %rcx      # 0x7100
pushq $0x39
popq %rdx
callq 0x2170
jmp 0x3708
movq %rax, %rbx
jmp 0x3786
movq %rax, %rbx
jmp 0x3762
movq %rax, %rbx
jmp 0x3779
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
callq 0x20e0
jmp 0x3724
jmp 0x3743
movq %rax, %rbx
pushq $0x30
popq %rsi
movq %rbp, %rdi
callq 0x2250
jmp 0x3734
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x20e0
jmp 0x3746
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x20e0
jmp 0x3755
movq %rax, %rbx
leaq 0x308(%rsp), %rdi
callq 0x20f0
leaq 0x80(%rsp), %rdi
callq 0x20e0
leaq 0x60(%rsp), %rdi
callq 0x20e0
leaq 0xa0(%rsp), %rdi
callq 0x20e0
leaq 0x100(%rsp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2350