// File: /workspace/github_cpp_makefile_star2_O2/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 $0x208, %rsp            # imm = 0x208
movq %rdi, %rbx
leaq -0x98(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
xorl %eax, %eax
movb %al, (%rcx)
leaq -0x78(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
leaq -0x158(%rbp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rcx)
movb %al, (%rdx)
leaq -0x138(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
leaq -0x118(%rbp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rcx)
movb %al, (%rdx)
leaq -0xf8(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
leaq -0xd8(%rbp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rcx)
movb %al, (%rdx)
leaq -0xb8(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb %al, (%rcx)
pushq $0x18
popq %rdi
callq 0x2030
movq %rax, %r14
xorl %r12d, %r12d
pushq $0x8
popq %r15
cmpq $0x3, %r12
je 0xa225
movq %r15, %rdi
callq 0x2030
movq %rax, (%r14,%r12,8)
incq %r12
jmp 0xa20e
leaq -0xa8(%rbp), %rsi
movq %rbx, %rdi
callq 0x2060
leaq -0xa8(%rbp), %r15
cmpq $0x0, -0xa0(%rbp)
jne 0xa252
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2060
jmp 0xa23b
leaq 0x51c2(%rip), %rsi      # 0xf41b
leaq -0xa8(%rbp), %rdi
callq 0xb6d5
testb %al, %al
je 0xa500
leaq -0x88(%rbp), %rsi
movq %rbx, %rdi
callq 0x2240
leaq 0x51cd(%rip), %rsi      # 0xf450
leaq -0x88(%rbp), %rdi
callq 0xb6e5
testb %al, %al
jne 0xa57d
leaq -0x228(%rbp), %r13
leaq -0x208(%rbp), %r12
movq %rbx, -0x38(%rbp)
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rbx,%rax)
jne 0xa500
movq %rbx, %rdi
leaq -0x88(%rbp), %rsi
callq 0x2240
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xa2f3
leaq -0x88(%rbp), %rdi
leaq 0x51a4(%rip), %rsi      # 0xf48a
callq 0xb6d5
testb %al, %al
jne 0xa500
movq -0x88(%rbp), %rdi
callq 0x22d0
movl %eax, %r15d
movq %rbx, %rdi
leaq -0x68(%rbp), %rsi
callq 0x2150
movq %rax, %rdi
leaq -0x60(%rbp), %rsi
callq 0x2150
movq %rax, %rdi
leaq -0x58(%rbp), %rsi
callq 0x2150
movq %rax, %rdi
leaq -0x50(%rbp), %rsi
callq 0x2150
movq %rax, %rdi
leaq -0x48(%rbp), %rsi
callq 0x2150
movq %rax, %rdi
leaq -0x40(%rbp), %rsi
callq 0x2150
movq %rbx, %rdi
leaq -0x30(%rbp), %rsi
callq 0x2140
movq %rbx, %rdi
leaq -0x168(%rbp), %rsi
callq 0x2240
movq %rax, %rdi
leaq -0x148(%rbp), %rsi
callq 0x2240
movq %rax, %rdi
leaq -0x128(%rbp), %rsi
callq 0x2240
movq %rax, %rdi
leaq -0x108(%rbp), %rsi
callq 0x2240
movq %rax, %rdi
leaq -0xe8(%rbp), %rsi
callq 0x2240
movq %rax, %rdi
leaq -0xc8(%rbp), %rsi
callq 0x2240
leaq -0x1e8(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x2270
movl %r15d, -0x2c(%rbp)
movq %r12, %r15
movq %r13, %r12
leaq -0x1e8(%rbp), %r13
movq %r13, %rdi
callq 0x9da8
movq (%r14), %rcx
movl %eax, (%rcx)
movq %r13, %rdi
movq %r12, %r13
movq %r15, %r12
movq -0x38(%rbp), %rbx
callq 0x2100
movq %r13, %rdi
leaq -0x148(%rbp), %rsi
callq 0x2270
movq %r13, %rdi
callq 0x9da8
movq (%r14), %rcx
movl %eax, 0x4(%rcx)
movq %r13, %rdi
callq 0x2100
movq %r12, %rdi
leaq -0x128(%rbp), %rsi
callq 0x2270
movq %r12, %rdi
callq 0x9da8
movq 0x8(%r14), %rcx
movl %eax, (%rcx)
movq %r12, %rdi
callq 0x2100
leaq -0x1c8(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x2270
leaq -0x1c8(%rbp), %r15
movq %r15, %rdi
callq 0x9da8
movq 0x8(%r14), %rcx
movl %eax, 0x4(%rcx)
movq %r15, %rdi
callq 0x2100
leaq -0x1a8(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x2270
leaq -0x1a8(%rbp), %r15
movq %r15, %rdi
callq 0x9da8
movq 0x10(%r14), %rcx
movl %eax, (%rcx)
movq %r15, %rdi
callq 0x2100
leaq -0x188(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x2270
leaq -0x188(%rbp), %r15
movq %r15, %rdi
callq 0x9da8
movq 0x10(%r14), %rcx
movl %eax, 0x4(%rcx)
movq %r15, %rdi
callq 0x2100
movsd -0x68(%rbp), %xmm0
movsd -0x60(%rbp), %xmm1
movsd -0x58(%rbp), %xmm2
movsd -0x50(%rbp), %xmm3
movsd -0x48(%rbp), %xmm4
movsd -0x40(%rbp), %xmm5
movl -0x30(%rbp), %esi
movl -0x2c(%rbp), %edi
movq %r14, %rdx
callq 0x2fb8
jmp 0xa2a9
movq %r14, %rdi
callq 0x2250
leaq -0xc8(%rbp), %rdi
callq 0x2100
leaq -0xe8(%rbp), %rdi
callq 0x2100
leaq -0x108(%rbp), %rdi
callq 0x2100
leaq -0x128(%rbp), %rdi
callq 0x2100
leaq -0x148(%rbp), %rdi
callq 0x2100
leaq -0x168(%rbp), %rdi
callq 0x2100
leaq -0x88(%rbp), %rdi
callq 0x2100
leaq -0xa8(%rbp), %rdi
callq 0x2100
movl -0x2c(%rbp), %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8a6c(%rip), %rdi      # 0x12ff0
leaq 0x4ec7(%rip), %rsi      # 0xf452
callq 0x21d0
movq %rax, %rdi
callq 0x2110
pushq $0x1
popq %rdi
callq 0x2220
jmp 0xa5a6
jmp 0xa5a6
jmp 0xa5a6
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
callq 0x2100
leaq -0xe8(%rbp), %rdi
callq 0x2100
leaq -0x108(%rbp), %rdi
callq 0x2100
leaq -0x128(%rbp), %rdi
callq 0x2100
leaq -0x148(%rbp), %rdi
callq 0x2100
leaq -0x168(%rbp), %rdi
callq 0x2100
leaq -0x88(%rbp), %rdi
callq 0x2100
leaq -0xa8(%rbp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x2320