// File: 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
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
movb $0x0, -0x12(%rbp)
movl $0xffffffff, -0x18(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x33d0
movl %eax, -0x20(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x33a0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
cmpl -0x20(%rbp), %eax
jg 0x1764a
movb $0x1, %al
testb $0x1, -0x12(%rbp)
movb %al, -0x4d(%rbp)
jne 0x17517
movq -0x8(%rbp), %rdi
movslq -0x18(%rbp), %rsi
callq 0x32f0
movsbl (%rax), %eax
movsbl 0x12d79(%rip), %ecx     # 0x2a288
cmpl %ecx, %eax
sete %al
movb %al, -0x4d(%rbp)
movb -0x4d(%rbp), %al
andb $0x1, %al
movb %al, -0x12(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x20(%rbp), %eax
je 0x17533
testb $0x1, -0x12(%rbp)
je 0x1757a
testb $0x1, -0x11(%rbp)
jne 0x1757a
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq (%rax), %rax
leaq -0x40(%rbp), %rsi
callq *%rax
jmp 0x17545
leaq -0x40(%rbp), %rdi
callq 0x3370
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movb $0x0, -0x12(%rbp)
jmp 0x174db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x3180
jmp 0x17668
movq -0x8(%rbp), %rdi
movslq -0x18(%rbp), %rsi
callq 0x32f0
movsbl (%rax), %eax
cmpl $0x22, %eax
jne 0x1762a
testb $0x1, -0x11(%rbp)
jne 0x175a2
movb $0x1, -0x11(%rbp)
jmp 0x17625
movl -0x18(%rbp), %eax
movl -0x20(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x175ff
movq -0x8(%rbp), %rdi
movl -0x18(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x32f0
movsbl (%rax), %eax
cmpl $0x22, %eax
je 0x175ff
movl -0x18(%rbp), %eax
incl %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq (%rax), %rax
leaq -0x40(%rbp), %rsi
callq *%rax
jmp 0x175e3
leaq -0x40(%rbp), %rdi
callq 0x3370
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movb $0x0, -0x12(%rbp)
movb $0x0, -0x11(%rbp)
jmp 0x17623
movq -0x8(%rbp), %rdi
movslq -0x18(%rbp), %rsi
movl %esi, %eax
incl %eax
movl %eax, -0x18(%rbp)
callq 0x32f0
movsbl (%rax), %esi
leaq -0x40(%rbp), %rdi
callq 0x3220
jmp 0x17621
jmp 0x17623
jmp 0x17625
jmp 0x174db
movq -0x8(%rbp), %rdi
movslq -0x18(%rbp), %rsi
callq 0x32f0
movsbl (%rax), %esi
leaq -0x40(%rbp), %rdi
callq 0x3220
jmp 0x17645
jmp 0x174db
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq 0x8(%rax), %rax
callq *%rax
jmp 0x17659
leaq -0x40(%rbp), %rdi
callq 0x3180
addq $0x50, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x3440
nopw %cs:(%rax,%rax)