// File: /workspace/github_cpp_makefile_star2_O2/cooljacket[P]Dormitory-distribution/CSVReader/CSVReader.cpp
// Function: CSVReader::line_to_cells(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, CSVContainerAdapter*)
void CSVReader::line_to_cells(const string& line, CSVContainerAdapter* adapter) {
	bool half_cell = false, have_comma = false;
	int now = -1, left = 0, len = line.length();
	string cell;

	while (++now <= len) {
		have_comma = have_comma || (line[now] == cell_delimiter);
		if (now == len || (have_comma && !half_cell)) {
			adapter->addToRow(cell);
			cell.clear();
			left = now + 1;
			have_comma = false;
			continue;
		}

		if (line[now] == DOUBLE_QUOTS) {
			if (!half_cell)
				half_cell = true;
			else if (now < len-1 && line[now+1] != DOUBLE_QUOTS) {
				++now;
				adapter->addToRow(cell);
				cell.clear();
				left = now + 1;
				have_comma = false;
				half_cell = false;
			} else {
				cell.push_back(line[now++]);
			}
			continue;
		}

		cell.push_back(line[now]);
	}
	adapter->addToRowDone();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, -0x48(%rbp)
movq 0x8(%rdi), %rcx
leaq -0x58(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rsi, %r14
movb $0x0, (%rax)
movslq %ecx, %rax
decl %ecx
movq %rcx, -0x70(%rbp)
pushq $0x1
popq %rcx
movq %rax, -0x80(%rbp)
subl %eax, %ecx
pushq $-0x1
popq %rdx
xorl %ebx, %ebx
movq $0x0, -0x30(%rbp)
movq %rcx, -0x38(%rbp)
movq %rdx, -0x78(%rbp)
movslq %edx, %r13
movl %r13d, %eax
movq %rax, -0x40(%rbp)
leaq (%rcx,%rax), %r12
xorl %r15d, %r15d
leaq (%r15,%r13), %rax
cmpq -0x80(%rbp), %rax
jge 0x7853
leaq (%r12,%r15), %rax
testb $0x1, %bl
je 0x7773
testl %eax, %eax
setne %al
andb -0x30(%rbp), %al
cmpb $0x1, %al
jne 0x77ae
movq -0x48(%rbp), %rax
movq (%rax), %rax
leaq (%rax,%r13), %rcx
movb 0x1(%r15,%rcx), %cl
movb $0x1, %bl
jmp 0x779b
testl %eax, %eax
je 0x77ae
movq -0x48(%rbp), %rax
movq (%rax), %rax
leaq (%rax,%r13), %rcx
movb 0x1(%r15,%rcx), %cl
cmpb 0x7a73(%rip), %cl       # 0xf200
sete %bl
setne %dl
orb -0x30(%rbp), %dl
testb $0x1, %dl
je 0x77ae
cmpb $0x22, %cl
je 0x77d0
movsbl %cl, %esi
leaq -0x68(%rbp), %rdi
callq 0x21b0
jmp 0x77c8
movq (%r14), %rax
movq %r14, %rdi
leaq -0x68(%rbp), %rsi
callq *(%rax)
andq $0x0, -0x60(%rbp)
movq -0x68(%rbp), %rax
movb $0x0, (%rax)
xorl %ebx, %ebx
incq %r15
jmp 0x773c
testb $0x1, -0x30(%rbp)
je 0x780f
movq -0x40(%rbp), %rdx
leaq (%rdx,%r15), %rcx
incq %rcx
leaq (%rdx,%r15), %r12
addq $0x2, %r12
cmpl %ecx, -0x70(%rbp)
jle 0x77f7
movslq %r12d, %rcx
cmpb $0x22, (%rax,%rcx)
jne 0x781a
leaq -0x68(%rbp), %rdi
pushq $0x22
popq %rsi
callq 0x21b0
movq -0x38(%rbp), %rcx
movq %r12, %rdx
jmp 0x7727
movq -0x78(%rbp), %rdx
addl %r15d, %edx
incl %edx
jmp 0x7840
movq (%r14), %rax
movq %r14, %rdi
leaq -0x68(%rbp), %rsi
callq *(%rax)
andq $0x0, -0x60(%rbp)
movq -0x40(%rbp), %rax
leaq (%rax,%r15), %rdx
addq $0x2, %rdx
movq -0x68(%rbp), %rax
movb $0x0, (%rax)
xorl %ebx, %ebx
movq -0x30(%rbp), %rax
xorb $0x1, %al
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rcx
jmp 0x7727
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
leaq -0x68(%rbp), %rdi
callq 0x20e0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x787a
jmp 0x787a
jmp 0x787a
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x20e0
movq %rbx, %rdi
callq 0x2350