// File: /workspace/github_cpp_makefile_star2_O1/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 0x860f
movq -0x38(%rbp), %rax
leal -0x1(%rax), %ecx
movl %ecx, -0x44(%rbp)
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, -0x78(%rbp)
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
xorl %eax, %eax
movl $0x0, -0x2c(%rbp)
xorl %r15d, %r15d
movslq %eax, %r14
movq -0x38(%rbp), %rcx
cmpl %ecx, %r14d
movl %ecx, %ebx
cmovgl %r14d, %ebx
incl %ebx
movl %r15d, %ecx
movl %r12d, %r13d
movl %eax, %r12d
movb $0x1, %r15b
testb $0x1, %cl
jne 0x853f
movq -0x70(%rbp), %rax
movq (%rax), %rax
movb (%rax,%r14), %al
cmpb 0x6cc5(%rip), %al       # 0xf200
sete %r15b
cmpq %r14, -0x78(%rbp)
je 0x856e
movl %r15d, %eax
xorb $0x1, %al
orb -0x2c(%rbp), %al
testb $0x1, %al
je 0x856e
movq -0x70(%rbp), %rax
movq (%rax), %rcx
movb (%rcx,%r14), %al
cmpb $0x22, %al
je 0x85a1
movsbl %al, %esi
leaq -0x68(%rbp), %rdi
callq 0x21d0
jmp 0x858d
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 %r15d, %r15d
incq %r14
leal 0x1(%r12), %eax
movl %r15d, %ecx
movl %r12d, %r13d
cmpl %eax, %ebx
jne 0x851f
jmp 0x860f
testb $0x1, -0x2c(%rbp)
je 0x85cd
cmpl %r12d, -0x44(%rbp)
jle 0x85b8
movslq %r13d, %r12
cmpb $0x22, 0x2(%rcx,%r12)
jne 0x85e3
movsbl %al, %esi
leaq -0x68(%rbp), %rdi
callq 0x21d0
addl $0x2, %r13d
movl %r13d, %r12d
jmp 0x85d2
movb $0x1, %al
movl %eax, -0x2c(%rbp)
leal 0x1(%r12), %eax
cmpl -0x38(%rbp), %r12d
jl 0x8507
jmp 0x860f
movq -0x40(%rbp), %rdi
movq (%rdi), %rax
leaq -0x68(%rbp), %rsi
callq *(%rax)
addq $0x2, %r12
movq $0x0, -0x60(%rbp)
movq -0x68(%rbp), %rax
movb $0x0, (%rax)
xorl %r15d, %r15d
movl $0x0, -0x2c(%rbp)
jmp 0x85d2
movq -0x40(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x8632
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 0x8645
jmp 0x8645
movq %rax, %rbx
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x8661
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2230
movq %rbx, %rdi
callq 0x2370
nop