// File: /workspace/github_cpp_makefile_star2_O1/suhasjains[P]AMR-Solver/src/input.cpp
// Function: std::read_blocks(std::basic_ifstream<char, std::char_traits<char>>&)
int read_blocks(ifstream& file) {
	
	string line, str;

	int blocknumber, level;	
	double xmin, xmax, ymin, ymax, zmin, zmax;
	string eastbc, westbc, northbc, southbc, topbc, bottombc;
	myOctree::NodeBc east_bc, west_bc, north_bc, south_bc, top_bc, bottom_bc;
	
	myOctree::NodeBc **bc;
	bc = new myOctree::NodeBc* [3];
	for(int i = 0; i < 3; i++)
     		bc[i] = new myOctree::NodeBc [2];	

	//skips line if line is empty
	getline(file,line);
	while(line.empty()) {
		getline(file, line);
	}


	if(line=="blocks") {


		file >> str;
		if(str != "{") {
			cerr << "Expected an opening bracket" <<endl;				
			exit(1);	
		}
		
		while(file) {
			if(file >> str && str == "}") break;
			else	blocknumber = atoi(str.c_str());

			//file >> blocknumber;
			file >> xmin >> xmax >> ymin >> ymax >> zmin >> zmax;
			file >> level;
			file >> eastbc >> westbc >> northbc >> southbc >> topbc >> bottombc;
						
			bc[myOctree::XDIR][myOctree::RIGHT] = string_to_NodeBc(eastbc);		
			bc[myOctree::XDIR][myOctree::LEFT] = string_to_NodeBc(westbc);		
			bc[myOctree::YDIR][myOctree::RIGHT] = string_to_NodeBc(northbc);		
			bc[myOctree::YDIR][myOctree::LEFT] = string_to_NodeBc(southbc);		
			bc[myOctree::ZDIR][myOctree::RIGHT] = string_to_NodeBc(topbc);		
			bc[myOctree::ZDIR][myOctree::LEFT] = string_to_NodeBc(bottombc);		

			//cerr << blocknumber << xmin << xmax << ymin << ymax << zmin << zmax << endl;

			myOctree::create_node(blocknumber, xmin, xmax, ymin, ymax, zmin, zmax, level, bc);

		}

	}
	
	delete [] bc;

	return blocknumber;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq %rdi, %rbx
leaq -0x40(%rbp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x80(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x120(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x100(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0xe0(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0xc0(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0xa0(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x60(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
movl $0x18, %edi
callq 0x2030
movq %rax, %r14
xorl %r15d, %r15d
movl $0x8, %edi
callq 0x2030
movq %rax, (%r14,%r15,8)
incq %r15
cmpq $0x3, %r15
jne 0xb4da
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %edx
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x2370
leaq -0x50(%rbp), %r15
cmpq $0x0, -0x48(%rbp)
jne 0xb543
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2370
jmp 0xb518
leaq 0x5ed1(%rip), %rsi      # 0x1141b
leaq -0x50(%rbp), %rdi
callq 0x20a0
testl %eax, %eax
jne 0xb91e
leaq -0x90(%rbp), %rsi
movq %rbx, %rdi
callq 0x2270
leaq 0x5ed1(%rip), %rsi      # 0x11442
leaq -0x90(%rbp), %rdi
callq 0x20a0
testl %eax, %eax
jne 0xba33
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rbx,%rax)
jne 0xb91e
leaq -0x220(%rbp), %r13
leaq -0x200(%rbp), %r12
movq %rbx, %rdi
leaq -0x90(%rbp), %rsi
callq 0x2270
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xb5dd
leaq -0x90(%rbp), %rdi
leaq 0x5eac(%rip), %rsi      # 0x1147c
callq 0x20a0
testl %eax, %eax
je 0xb91e
movq -0x90(%rbp), %rdi
callq 0x22f0
movl %eax, %r15d
movq %rbx, %rdi
leaq -0x160(%rbp), %rsi
callq 0x2140
movq %rax, %rdi
leaq -0x158(%rbp), %rsi
callq 0x2140
movq %rax, %rdi
leaq -0x150(%rbp), %rsi
callq 0x2140
movq %rax, %rdi
leaq -0x148(%rbp), %rsi
callq 0x2140
movq %rax, %rdi
leaq -0x140(%rbp), %rsi
callq 0x2140
movq %rax, %rdi
leaq -0x138(%rbp), %rsi
callq 0x2140
movq %rbx, %rdi
leaq -0x2c(%rbp), %rsi
callq 0x2130
movq %rbx, %rdi
leaq -0x130(%rbp), %rsi
callq 0x2270
movq %rax, %rdi
leaq -0x110(%rbp), %rsi
callq 0x2270
movq %rax, %rdi
leaq -0xf0(%rbp), %rsi
callq 0x2270
movq %rax, %rdi
leaq -0xd0(%rbp), %rsi
callq 0x2270
movq %rax, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x2270
movq %rax, %rdi
leaq -0x70(%rbp), %rsi
callq 0x2270
leaq -0x1d0(%rbp), %rax
movq %rax, -0x1e0(%rbp)
movq -0x130(%rbp), %rsi
movq -0x128(%rbp), %rdx
addq %rsi, %rdx
leaq -0x1e0(%rbp), %rdi
callq 0x391e
leaq -0x1e0(%rbp), %rdi
callq 0xaed4
movq (%r14), %rcx
movl %eax, (%rcx)
movq -0x1e0(%rbp), %rdi
leaq -0x1d0(%rbp), %rax
cmpq %rax, %rdi
je 0xb707
movq -0x1d0(%rbp), %rsi
incq %rsi
callq 0x2200
leaq -0x1b0(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movq -0x110(%rbp), %rsi
movq -0x108(%rbp), %rdx
addq %rsi, %rdx
leaq -0x1c0(%rbp), %rdi
callq 0x391e
leaq -0x1c0(%rbp), %rdi
callq 0xaed4
movq (%r14), %rcx
movl %eax, 0x4(%rcx)
movq -0x1c0(%rbp), %rdi
leaq -0x1b0(%rbp), %rax
cmpq %rax, %rdi
je 0xb766
movq -0x1b0(%rbp), %rsi
incq %rsi
callq 0x2200
leaq -0x190(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq -0xf0(%rbp), %rsi
movq -0xe8(%rbp), %rdx
addq %rsi, %rdx
leaq -0x1a0(%rbp), %rdi
callq 0x391e
leaq -0x1a0(%rbp), %rdi
callq 0xaed4
movq 0x8(%r14), %rcx
movl %eax, (%rcx)
movq -0x1a0(%rbp), %rdi
leaq -0x190(%rbp), %rax
cmpq %rax, %rdi
je 0xb7c5
movq -0x190(%rbp), %rsi
incq %rsi
callq 0x2200
leaq -0x170(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0xd0(%rbp), %rsi
movq -0xc8(%rbp), %rdx
addq %rsi, %rdx
leaq -0x180(%rbp), %rdi
callq 0x391e
leaq -0x180(%rbp), %rdi
callq 0xaed4
movq 0x8(%r14), %rcx
movl %eax, 0x4(%rcx)
movq -0x180(%rbp), %rdi
leaq -0x170(%rbp), %rax
cmpq %rax, %rdi
je 0xb825
movq -0x170(%rbp), %rsi
incq %rsi
callq 0x2200
leaq -0x210(%rbp), %rax
movq %rax, -0x220(%rbp)
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x391e
movq %r13, %rdi
callq 0xaed4
movq 0x10(%r14), %rcx
movl %eax, (%rcx)
movq -0x220(%rbp), %rdi
leaq -0x210(%rbp), %rax
cmpq %rax, %rdi
je 0xb87c
movq -0x210(%rbp), %rsi
incq %rsi
callq 0x2200
leaq -0x1f0(%rbp), %rax
movq %rax, -0x200(%rbp)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x391e
movq %r12, %rdi
callq 0xaed4
movq 0x10(%r14), %rcx
movl %eax, 0x4(%rcx)
movq -0x200(%rbp), %rdi
leaq -0x1f0(%rbp), %rax
cmpq %rax, %rdi
je 0xb8ce
movq -0x1f0(%rbp), %rsi
incq %rsi
callq 0x2200
movsd -0x160(%rbp), %xmm0
movsd -0x158(%rbp), %xmm1
movsd -0x150(%rbp), %xmm2
movsd -0x148(%rbp), %xmm3
movsd -0x140(%rbp), %xmm4
movsd -0x138(%rbp), %xmm5
movl -0x2c(%rbp), %esi
movl %r15d, %edi
movq %r14, %rdx
callq 0x315b
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rbx,%rax)
je 0xb5a5
movq %r14, %rdi
callq 0x2280
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xb93f
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2200
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
leaq -0x40(%rbp), %rbx
je 0xb965
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2200
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0xb987
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2200
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0xb9a9
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x2200
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0xb9cb
movq -0x100(%rbp), %rsi
incq %rsi
callq 0x2200
movq -0x130(%rbp), %rdi
leaq -0x120(%rbp), %rax
cmpq %rax, %rdi
je 0xb9ed
movq -0x120(%rbp), %rsi
incq %rsi
callq 0x2200
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0xba09
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2200
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0xba1e
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2200
movl %r15d, %eax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x95b6(%rip), %rdi      # 0x14ff0
leaq 0x5a03(%rip), %rsi      # 0x11444
movl $0x1b, %edx
callq 0x2230
movq 0x959e(%rip), %rdi      # 0x14ff0
callq 0x2100
movl $0x1, %edi
callq 0x2250
jmp 0xba67
jmp 0xba67
jmp 0xba67
movq %rax, %rbx
leaq -0x40(%rbp), %r14
leaq -0x60(%rbp), %rax
movq -0x70(%rbp), %rdi
cmpq %rax, %rdi
je 0xba87
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2200
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0xbaa9
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2200
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0xbacb
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2200
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0xbaed
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x2200
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0xbb0f
movq -0x100(%rbp), %rsi
incq %rsi
callq 0x2200
movq -0x130(%rbp), %rdi
leaq -0x120(%rbp), %rax
cmpq %rax, %rdi
je 0xbb31
movq -0x120(%rbp), %rsi
incq %rsi
callq 0x2200
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0xbb4d
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2200
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0xbb62
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2340