// File: /workspace/github_cpp_makefile_star2_O3/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 0x6d50
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 0x20d96
movq 0x58(%rsp), %rbx
testl %eax, %eax
je 0x5fb8
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 0x4690
movq %r15, 0x10(%rsp)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x6c2a
movq %r13, %rdi
leaq 0x1f4bc(%rip), %rsi     # 0x2520d
callq 0x4840
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x88(%rsp), %rdi
callq 0x4100
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x5d84
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4470
movl $0x2, %ecx
movq %rbp, %rdi
leaq 0x1f313(%rip), %rsi     # 0x250a6
xorl %edx, %edx
callq 0x4730
cmpq $-0x1, %rax
je 0x5f9d
movq %rax, %r15
movq 0x38(%rsp), %rax
cmpb $0x23, (%rax,%r15)
je 0x5f9d
movl $0x2, %ecx
movq %rbp, %rdi
leaq 0x1f2e0(%rip), %rsi     # 0x250a6
movq %r15, %rdx
callq 0x4660
movq %rax, %rbx
movq %rax, %rcx
subq %r15, %rcx
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x4490
movq %r14, %rdi
movq %r13, %rsi
callq 0x4570
movq 0x10(%rsp), %rdi
movq %r12, %r15
cmpq %r12, %rdi
je 0x5e0a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4470
movq %r14, %rdi
leaq 0x1f295(%rip), %rsi     # 0x250a9
callq 0x40f0
testl %eax, %eax
je 0x5e5c
movq %r14, %rdi
leaq 0x1f284(%rip), %rsi     # 0x250ab
callq 0x40f0
testl %eax, %eax
jne 0x5eba
movq 0x100(%rsp), %rax
cmpq 0xe0(%rsp), %rax
je 0x6093
movq 0x108(%rsp), %rdi
cmpq %rdi, %rax
je 0x5e73
decq %rax
jmp 0x5eb2
movb $0x1, 0x10(%rsp)
leaq 0xd0(%rsp), %rdi
movq %r13, %rsi
callq 0x6ec8
jmp 0x5eba
movl $0x200, %esi            # imm = 0x200
callq 0x4470
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 0x24700
testb %al, %al
je 0x5eee
movq 0x40(%rsp), %rdx
movl $0x2, %ecx
movq %rbp, %rdi
leaq 0x1f1cc(%rip), %rsi     # 0x250a6
callq 0x46f0
movq 0x38(%rsp), %rcx
cmpb $0x3b, (%rcx,%rax)
jne 0x6017
movq 0x68(%rsp), %rdx
decq %rdx
movq %r14, %rdi
movl $0x3b, %esi
callq 0x4590
cmpq $-0x1, %rax
je 0x5f6c
movq 0x68(%rsp), %rsi
decq %rsi
movl $0x1, %edx
movq %r14, %rdi
callq 0x40b0
movq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x6b0a
movq %r15, 0x10(%rsp)
movq %r13, %rdi
leaq 0x1fa51(%rip), %rsi     # 0x2598b
leaq 0x1fa4b(%rip), %rdx     # 0x2598c
callq 0x579e
movq 0x30(%rsp), %rdi
movq %r13, %rsi
callq 0x7322
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x5f79
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x5f79
movq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x6b0a
movl $0x2, %ecx
movq %rbp, %rdi
leaq 0x1f11e(%rip), %rsi     # 0x250a6
movq %rbx, %rdx
callq 0x4730
movq %rax, %r15
cmpq $-0x1, %rax
jne 0x5da7
incl 0xc(%rsp)
movq 0x58(%rsp), %rdi
callq 0x4550
movq 0x80(%rsp), %rbx
jmp 0x5cf0
movq %rbx, %rdi
callq 0x4550
leaq 0xd0(%rsp), %rdi
callq 0x6bd2
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x5fe9
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x6005
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4470
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 0x1f092(%rip), %rsi     # 0x250c9
leaq 0x1f0a0(%rip), %rdx     # 0x250de
leaq 0x90(%rsp), %rdi
callq 0x579e
leaq 0x128(%rsp), %rdi
movl 0xc(%rsp), %esi
callq 0x6a8a
movb $0x1, %bpl
leaq 0x90(%rsp), %rsi
leaq 0x128(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x65b0
xorl %ebp, %ebp
leaq 0x2bc7e(%rip), %rsi     # 0x31d00
leaq 0x93f(%rip), %rdx       # 0x69c8
movq %r14, %rdi
callq 0x4760
jmp 0x610d
movl $0x30, %edi
callq 0x41d0
movq %rax, %r14
leaq 0xc0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1effa(%rip), %rsi     # 0x250ad
leaq 0x1f00e(%rip), %rdx     # 0x250c8
leaq 0xb0(%rsp), %rdi
callq 0x579e
leaq 0x148(%rsp), %rdi
movl 0xc(%rsp), %esi
callq 0x6a8a
movb $0x1, %bpl
leaq 0xb0(%rsp), %rsi
leaq 0x148(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x65b0
xorl %ebp, %ebp
leaq 0x2bc02(%rip), %rsi     # 0x31d00
leaq 0x8c3(%rip), %rdx       # 0x69c8
movq %r14, %rdi
callq 0x4760
movq %rax, %rbx
jmp 0x6224
movq %rax, %rbx
leaq 0x158(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6139
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0xb0(%rsp), %rdi
cmpq %r15, %rdi
je 0x61ba
movq 0xc0(%rsp), %rsi
jmp 0x61b2
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
cmpq %r15, %rdi
je 0x61e8
movq 0xc0(%rsp), %rsi
jmp 0x61d9
jmp 0x6214
jmp 0x61f4
jmp 0x61f4
jmp 0x61e5
movq %rax, %rbx
leaq 0x138(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x619d
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x90(%rsp), %rdi
cmpq %r15, %rdi
je 0x61ba
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x4470
testb %bpl, %bpl
jne 0x61e8
jmp 0x6217
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %r15, %rdi
je 0x61e8
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x61e8
jmp 0x6214
movq %rax, %rbx
movq %r14, %rdi
callq 0x4310
jmp 0x6217
jmp 0x6214
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x6217
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x6217
jmp 0x6214
jmp 0x6214
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x6bd2
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x6240
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x625c
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4790