// File: /workspace/github_cpp_makefile_star2_O3/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 0xb4de
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %edx
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x2380
leaq -0x50(%rbp), %r15
cmpq $0x0, -0x48(%rbp)
jne 0xb547
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2380
jmp 0xb51c
leaq 0x5ecd(%rip), %rsi      # 0x1141b
leaq -0x50(%rbp), %rdi
callq 0x20a0
testl %eax, %eax
jne 0xb922
leaq -0x90(%rbp), %rsi
movq %rbx, %rdi
callq 0x2280
leaq 0x5efb(%rip), %rsi      # 0x11470
leaq -0x90(%rbp), %rdi
callq 0x20a0
testl %eax, %eax
jne 0xba37
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rbx,%rax)
jne 0xb922
leaq -0x220(%rbp), %r13
leaq -0x200(%rbp), %r12
movq %rbx, %rdi
leaq -0x90(%rbp), %rsi
callq 0x2280
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xb5e1
leaq -0x90(%rbp), %rdi
leaq 0x5ed6(%rip), %rsi      # 0x114aa
callq 0x20a0
testl %eax, %eax
je 0xb922
movq -0x90(%rbp), %rdi
callq 0x2300
movl %eax, %r15d
movq %rbx, %rdi
leaq -0x160(%rbp), %rsi
callq 0x2150
movq %rax, %rdi
leaq -0x158(%rbp), %rsi
callq 0x2150
movq %rax, %rdi
leaq -0x150(%rbp), %rsi
callq 0x2150
movq %rax, %rdi
leaq -0x148(%rbp), %rsi
callq 0x2150
movq %rax, %rdi
leaq -0x140(%rbp), %rsi
callq 0x2150
movq %rax, %rdi
leaq -0x138(%rbp), %rsi
callq 0x2150
movq %rbx, %rdi
leaq -0x2c(%rbp), %rsi
callq 0x2140
movq %rbx, %rdi
leaq -0x130(%rbp), %rsi
callq 0x2280
movq %rax, %rdi
leaq -0x110(%rbp), %rsi
callq 0x2280
movq %rax, %rdi
leaq -0xf0(%rbp), %rsi
callq 0x2280
movq %rax, %rdi
leaq -0xd0(%rbp), %rsi
callq 0x2280
movq %rax, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x2280
movq %rax, %rdi
leaq -0x70(%rbp), %rsi
callq 0x2280
leaq -0x1d0(%rbp), %rax
movq %rax, -0x1e0(%rbp)
movq -0x130(%rbp), %rsi
movq -0x128(%rbp), %rdx
addq %rsi, %rdx
leaq -0x1e0(%rbp), %rdi
callq 0x39ba
leaq -0x1e0(%rbp), %rdi
callq 0xaed8
movq (%r14), %rcx
movl %eax, (%rcx)
movq -0x1e0(%rbp), %rdi
leaq -0x1d0(%rbp), %rax
cmpq %rax, %rdi
je 0xb70b
movq -0x1d0(%rbp), %rsi
incq %rsi
callq 0x2210
leaq -0x1b0(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movq -0x110(%rbp), %rsi
movq -0x108(%rbp), %rdx
addq %rsi, %rdx
leaq -0x1c0(%rbp), %rdi
callq 0x39ba
leaq -0x1c0(%rbp), %rdi
callq 0xaed8
movq (%r14), %rcx
movl %eax, 0x4(%rcx)
movq -0x1c0(%rbp), %rdi
leaq -0x1b0(%rbp), %rax
cmpq %rax, %rdi
je 0xb76a
movq -0x1b0(%rbp), %rsi
incq %rsi
callq 0x2210
leaq -0x190(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq -0xf0(%rbp), %rsi
movq -0xe8(%rbp), %rdx
addq %rsi, %rdx
leaq -0x1a0(%rbp), %rdi
callq 0x39ba
leaq -0x1a0(%rbp), %rdi
callq 0xaed8
movq 0x8(%r14), %rcx
movl %eax, (%rcx)
movq -0x1a0(%rbp), %rdi
leaq -0x190(%rbp), %rax
cmpq %rax, %rdi
je 0xb7c9
movq -0x190(%rbp), %rsi
incq %rsi
callq 0x2210
leaq -0x170(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0xd0(%rbp), %rsi
movq -0xc8(%rbp), %rdx
addq %rsi, %rdx
leaq -0x180(%rbp), %rdi
callq 0x39ba
leaq -0x180(%rbp), %rdi
callq 0xaed8
movq 0x8(%r14), %rcx
movl %eax, 0x4(%rcx)
movq -0x180(%rbp), %rdi
leaq -0x170(%rbp), %rax
cmpq %rax, %rdi
je 0xb829
movq -0x170(%rbp), %rsi
incq %rsi
callq 0x2210
leaq -0x210(%rbp), %rax
movq %rax, -0x220(%rbp)
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x39ba
movq %r13, %rdi
callq 0xaed8
movq 0x10(%r14), %rcx
movl %eax, (%rcx)
movq -0x220(%rbp), %rdi
leaq -0x210(%rbp), %rax
cmpq %rax, %rdi
je 0xb880
movq -0x210(%rbp), %rsi
incq %rsi
callq 0x2210
leaq -0x1f0(%rbp), %rax
movq %rax, -0x200(%rbp)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x39ba
movq %r12, %rdi
callq 0xaed8
movq 0x10(%r14), %rcx
movl %eax, 0x4(%rcx)
movq -0x200(%rbp), %rdi
leaq -0x1f0(%rbp), %rax
cmpq %rax, %rdi
je 0xb8d2
movq -0x1f0(%rbp), %rsi
incq %rsi
callq 0x2210
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 0x3168
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rbx,%rax)
je 0xb5a9
movq %r14, %rdi
callq 0x2290
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xb943
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
leaq -0x40(%rbp), %rbx
je 0xb969
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0xb98b
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0xb9ad
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0xb9cf
movq -0x100(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x130(%rbp), %rdi
leaq -0x120(%rbp), %rax
cmpq %rax, %rdi
je 0xb9f1
movq -0x120(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0xba0d
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0xba22
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2210
movl %r15d, %eax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x95b2(%rip), %rdi      # 0x14ff0
leaq 0x5a2d(%rip), %rsi      # 0x11472
movl $0x1b, %edx
callq 0x2240
movq 0x959a(%rip), %rdi      # 0x14ff0
callq 0x2100
movl $0x1, %edi
callq 0x2260
jmp 0xba6b
jmp 0xba6b
jmp 0xba6b
movq %rax, %rbx
leaq -0x40(%rbp), %r14
leaq -0x60(%rbp), %rax
movq -0x70(%rbp), %rdi
cmpq %rax, %rdi
je 0xba8b
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0xbaad
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0xbacf
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0xbaf1
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0xbb13
movq -0x100(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x130(%rbp), %rdi
leaq -0x120(%rbp), %rax
cmpq %rax, %rdi
je 0xbb35
movq -0x120(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0xbb51
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0xbb66
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2350