// File: /workspace/github_cpp_makefile_star2_O3/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 %rsi, -0x40(%rbp)
movq %rdi, -0x70(%rbp)
movq 0x8(%rdi), %rcx
leaq -0x58(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq %rcx, -0x38(%rbp)
testl %ecx, %ecx
js 0x861d
movq -0x38(%rbp), %rax
leal -0x1(%rax), %ecx
movl %ecx, -0x44(%rbp)
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, -0x78(%rbp)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl $0x0, -0x2c(%rbp)
xorl %r14d, %r14d
movslq %eax, %r12
movq -0x38(%rbp), %rcx
cmpl %ecx, %r12d
movl %ecx, %r13d
cmovgl %r12d, %r13d
incl %r13d
movl %eax, %r15d
testb $0x1, %r14b
je 0x8549
cmpq %r12, -0x78(%rbp)
setne %al
andb -0x2c(%rbp), %al
cmpb $0x1, %al
jne 0x8582
movq -0x70(%rbp), %rax
movq (%rax), %rax
movb (%rax,%r12), %cl
movb $0x1, %r14b
jmp 0x856f
cmpq %r12, -0x78(%rbp)
je 0x8582
movq -0x70(%rbp), %rax
movq (%rax), %rax
movb (%rax,%r12), %cl
cmpb 0x6ca0(%rip), %cl       # 0xf200
sete %r14b
setne %dl
orb -0x2c(%rbp), %dl
testb $0x1, %dl
je 0x8582
cmpb $0x22, %cl
je 0x85b6
movsbl %cl, %esi
leaq -0x68(%rbp), %rdi
callq 0x21d0
jmp 0x85a1
movq -0x40(%rbp), %rdi
movq (%rdi), %rax
leaq -0x68(%rbp), %rsi
callq *(%rax)
movq $0x0, -0x60(%rbp)
movq -0x68(%rbp), %rax
movb $0x0, (%rax)
xorl %r14d, %r14d
incq %r12
leal 0x1(%r15), %eax
movl %r15d, %ebx
cmpl %eax, %r13d
jne 0x8522
jmp 0x861d
testb $0x1, -0x2c(%rbp)
je 0x85df
movslq %ebx, %rbx
addq $0x2, %rbx
cmpl %r15d, -0x44(%rbp)
jle 0x85cf
cmpb $0x22, (%rax,%rbx)
jne 0x85f5
leaq -0x68(%rbp), %rdi
movl $0x22, %esi
callq 0x21d0
jmp 0x85e7
movl %r15d, %ebx
movb $0x1, %al
movl %eax, -0x2c(%rbp)
leal 0x1(%rbx), %eax
cmpl -0x38(%rbp), %ebx
jl 0x850e
jmp 0x861d
movq -0x40(%rbp), %rdi
movq (%rdi), %rax
leaq -0x68(%rbp), %rsi
callq *(%rax)
movq $0x0, -0x60(%rbp)
movq -0x68(%rbp), %rax
movb $0x0, (%rax)
xorl %r14d, %r14d
movl $0x0, -0x2c(%rbp)
jmp 0x85e7
movq -0x40(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x8640
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2230
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8653
jmp 0x8653
movq %rax, %rbx
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x866f
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2230
movq %rbx, %rdi
callq 0x2370
nop