// File: /workspace/github_cpp_makefile_star2_O1/solaldunckel[P]webserv/srcs/Config/Config.cpp
// Function: Config::tokenize()
void Config::tokenize() {
  std::string line, tmp;
  std::string::size_type first, last;
  std::stack<bool> brackets;

  int line_idx = 1;
  char *line_c;

  while (get_next_line(fd_, &line_c)) {
    line = line_c;
    file_content_ += line + "\n";
    last = 0;
    while ((first = line.find_first_not_of(" \t", last)) != std::string::npos) {
      if (line[first] == '#')
        break;
      last = line.find_first_of(" \t", first);
      tmp = line.substr(first, last - first);
      if (tmp == "{")
        brackets.push(true);
      else if (tmp == "}") {
        if (brackets.empty())
          throw webserv_exception("extra closing '}' on line %", 0, ft::to_string(line_idx));
        brackets.pop();
      }
      if (isValidDirective(tmp) && line[line.find_last_not_of(" \t", line.length())] != ';')
        throw webserv_exception("missing ';' on line %", 0, ft::to_string(line_idx));
      if (tmp.find(';', tmp.length() - 1) != std::string::npos) {
        tmp.erase(tmp.length() - 1, 1);
        tokens_.push_back(tmp);
        tokens_.push_back(";");
      }
      else
        tokens_.push_back(tmp);
    }
    line_idx++;
    free(line_c);
  }
  free(line_c);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rdi, %rbx
leaq 0x48(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x70(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
xorps %xmm0, %xmm0
leaq 0xd0(%rsp), %rdi
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
xorl %esi, %esi
callq 0x6cce
leaq 0x20(%rsp), %r12
leaq 0x28(%rbx), %rax
movq %rax, 0x88(%rsp)
leaq 0x48(%rbx), %rax
movq %rax, 0x30(%rsp)
movl $0x1, 0xc(%rsp)
leaq 0x38(%rsp), %rbp
leaq 0x10(%rsp), %r13
leaq 0x60(%rsp), %r14
movq %rbx, 0x80(%rsp)
movl 0x20(%rbx), %edi
leaq 0x58(%rsp), %rsi
callq 0x20dfc
movq 0x58(%rsp), %rbx
testl %eax, %eax
je 0x5f86
movq 0x40(%rsp), %r15
movq %rbx, %rdi
callq 0x4190
movq %rbp, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %r15
movq %rbx, %rcx
movq %rax, %r8
callq 0x4680
movq %r15, 0x10(%rsp)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x6bac
movq %r13, %rdi
leaq 0x1f4ee(%rip), %rsi     # 0x2520d
callq 0x4830
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x88(%rsp), %rdi
callq 0x4100
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x5d52
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4460
movl $0x2, %ecx
movq %rbp, %rdi
leaq 0x1f345(%rip), %rsi     # 0x250a6
xorl %edx, %edx
callq 0x4720
cmpq $-0x1, %rax
je 0x5f6b
movq %rax, %r15
movq 0x38(%rsp), %rax
cmpb $0x23, (%rax,%r15)
je 0x5f6b
movl $0x2, %ecx
movq %rbp, %rdi
leaq 0x1f312(%rip), %rsi     # 0x250a6
movq %r15, %rdx
callq 0x4650
movq %rax, %rbx
movq %rax, %rcx
subq %r15, %rcx
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x4480
movq %r14, %rdi
movq %r13, %rsi
callq 0x4560
movq 0x10(%rsp), %rdi
movq %r12, %r15
cmpq %r12, %rdi
je 0x5dd8
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4460
movq %r14, %rdi
leaq 0x1f2c7(%rip), %rsi     # 0x250a9
callq 0x40f0
testl %eax, %eax
je 0x5e2a
movq %r14, %rdi
leaq 0x1f2b6(%rip), %rsi     # 0x250ab
callq 0x40f0
testl %eax, %eax
jne 0x5e88
movq 0x100(%rsp), %rax
cmpq 0xe0(%rsp), %rax
je 0x6061
movq 0x108(%rsp), %rdi
cmpq %rdi, %rax
je 0x5e41
decq %rax
jmp 0x5e80
movb $0x1, 0x10(%rsp)
leaq 0xd0(%rsp), %rdi
movq %r13, %rsi
callq 0x6e46
jmp 0x5e88
movl $0x200, %esi            # imm = 0x200
callq 0x4460
movq 0x118(%rsp), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x118(%rsp)
movq -0x8(%rax), %rax
movq %rax, 0x108(%rsp)
leaq 0x200(%rax), %rcx
movq %rcx, 0x110(%rsp)
addq $0x1ff, %rax            # imm = 0x1FF
movq %rax, 0x100(%rsp)
movq %r14, %rdi
callq 0x24780
testb %al, %al
je 0x5ebc
movq 0x40(%rsp), %rdx
movl $0x2, %ecx
movq %rbp, %rdi
leaq 0x1f1fe(%rip), %rsi     # 0x250a6
callq 0x46e0
movq 0x38(%rsp), %rcx
cmpb $0x3b, (%rcx,%rax)
jne 0x5fe5
movq 0x68(%rsp), %rdx
decq %rdx
movq %r14, %rdi
movl $0x3b, %esi
callq 0x4580
cmpq $-0x1, %rax
je 0x5f3a
movq 0x68(%rsp), %rsi
decq %rsi
movl $0x1, %edx
movq %r14, %rdi
callq 0x40b0
movq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x6a94
movq %r15, 0x10(%rsp)
movq %r13, %rdi
leaq 0x1fa83(%rip), %rsi     # 0x2598b
leaq 0x1fa7d(%rip), %rdx     # 0x2598c
callq 0x578e
movq 0x30(%rsp), %rdi
movq %r13, %rsi
callq 0x72d8
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x5f47
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0x5f47
movq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x6a94
movl $0x2, %ecx
movq %rbp, %rdi
leaq 0x1f150(%rip), %rsi     # 0x250a6
movq %rbx, %rdx
callq 0x4720
movq %rax, %r15
cmpq $-0x1, %rax
jne 0x5d75
incl 0xc(%rsp)
movq 0x58(%rsp), %rdi
callq 0x4540
movq 0x80(%rsp), %rbx
jmp 0x5cbe
movq %rbx, %rdi
callq 0x4540
leaq 0xd0(%rsp), %rdi
callq 0x6b5c
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x5fb7
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4460
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x5fd3
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4460
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x30, %edi
callq 0x41d0
movq %rax, %r14
leaq 0xa0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1f0c4(%rip), %rsi     # 0x250c9
leaq 0x1f0d2(%rip), %rdx     # 0x250de
leaq 0x90(%rsp), %rdi
callq 0x578e
leaq 0x128(%rsp), %rdi
movl 0xc(%rsp), %esi
callq 0x6a15
movb $0x1, %bpl
leaq 0x90(%rsp), %rsi
leaq 0x128(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x6542
xorl %ebp, %ebp
leaq 0x2bcb0(%rip), %rsi     # 0x31d00
leaq 0x905(%rip), %rdx       # 0x695c
movq %r14, %rdi
callq 0x4750
jmp 0x60db
movl $0x30, %edi
callq 0x41d0
movq %rax, %r14
leaq 0xc0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1f02c(%rip), %rsi     # 0x250ad
leaq 0x1f040(%rip), %rdx     # 0x250c8
leaq 0xb0(%rsp), %rdi
callq 0x578e
leaq 0x148(%rsp), %rdi
movl 0xc(%rsp), %esi
callq 0x6a15
movb $0x1, %bpl
leaq 0xb0(%rsp), %rsi
leaq 0x148(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x6542
xorl %ebp, %ebp
leaq 0x2bc34(%rip), %rsi     # 0x31d00
leaq 0x889(%rip), %rdx       # 0x695c
movq %r14, %rdi
callq 0x4750
movq %rax, %rbx
jmp 0x61c5
movq %rax, %rbx
leaq 0x158(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x610f
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0x610f
movq %rax, %rbx
movb $0x1, %bpl
movq 0xb0(%rsp), %rdi
cmpq %r15, %rdi
je 0x6184
movq 0xc0(%rsp), %rsi
jmp 0x6172
jmp 0x61b5
jmp 0x6195
jmp 0x6195
jmp 0x617e
movq %rax, %rbx
leaq 0x138(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x615d
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0x615d
movq %rax, %rbx
movb $0x1, %bpl
movq 0x90(%rsp), %rdi
cmpq %r15, %rdi
je 0x6184
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0x6184
jmp 0x61b5
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x61b8
movq %r14, %rdi
callq 0x4300
jmp 0x61b8
jmp 0x61b5
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x61b8
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0x61b8
jmp 0x61b5
jmp 0x61b5
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x6b5c
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x61e1
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4460
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x61fd
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4460
movq %rbx, %rdi
callq 0x4780
nop