// File: /workspace/github_cpp_makefile_star2_O3/solaldunckel[P]webserv/srcs/Config/Config.cpp
// Function: Config::parse()
void Config::parse() {
  tokenize();
  int i = 1;
  std::vector<std::string>::iterator it;

  for (it = tokens_.begin(); it != tokens_.end(); ++it) {
    if (*it == "server") {
      ServerConfig serv;

      serv.id_ = i++;
      serv.server(++it);
      servers_.push_back(serv);
    }
    else if (*it == "workers") {
      workers_ = ft::stoi(*(++it));
      if (workers_ > 16 || workers_ < 0)
        throw std::runtime_error("workers must be between [0-16]range");
      if (*++it != ";")
        throw std::runtime_error("missing ';' in 'workers'");
    }
    else
      throw webserv_exception("invalid directive % in main block", 0, *it);
  }
  if (servers_.empty())
    throw webserv_exception("missing server block");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdi, %rbx
callq 0x5c5e
movq 0x48(%rbx), %rdi
movq %rdi, 0x8(%rsp)
cmpq 0x50(%rbx), %rdi
je 0x6365
leaq 0x60(%rbx), %r14
movl $0x1, %ebp
leaq 0x1ee3f(%rip), %r15     # 0x250df
leaq 0x90(%rsp), %r12
leaq 0x1f6dc(%rip), %r13     # 0x2598b
movq %r15, %rsi
callq 0x40f0
testl %eax, %eax
je 0x6316
movq 0x8(%rsp), %rdi
leaq 0x1ee1f(%rip), %rsi     # 0x250e6
callq 0x40f0
testl %eax, %eax
jne 0x63a6
movq 0x8(%rsp), %rdi
addq $0x20, %rdi
movq %rdi, 0x8(%rsp)
xorl %esi, %esi
movl $0xa, %edx
callq 0x24471
movl %eax, 0x24(%rbx)
cmpl $0x11, %eax
jae 0x642e
movq 0x8(%rsp), %rdi
addq $0x20, %rdi
movq %rdi, 0x8(%rsp)
movq %r13, %rsi
callq 0x40f0
testl %eax, %eax
je 0x634d
jmp 0x6385
movq %r12, %rdi
callq 0xb26c
movl %ebp, 0x90(%rsp)
addq $0x20, 0x8(%rsp)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
callq 0xc70e
movq %r14, %rdi
movq %r12, %rsi
callq 0x6b48
incl %ebp
movq %r12, %rdi
callq 0xb984
movq 0x8(%rsp), %rdi
addq $0x20, %rdi
movq %rdi, 0x8(%rsp)
cmpq 0x50(%rbx), %rdi
jne 0x62af
movq 0x60(%rbx), %rax
cmpq 0x68(%rbx), %rax
je 0x6460
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x41d0
movq %rax, %r14
leaq 0x1ed79(%rip), %rsi     # 0x25112
movq %rax, %rdi
callq 0x4170
jmp 0x644a
movl $0x30, %edi
callq 0x41d0
movq %rax, %r14
leaq 0x40(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1ed68(%rip), %rsi     # 0x2512b
leaq 0x1ed82(%rip), %rdx     # 0x2514c
leaq 0x30(%rsp), %rdi
callq 0x579e
movq 0x8(%rsp), %rax
leaq 0x80(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x70(%rsp), %rdi
callq 0x6c2a
movb $0x1, %bpl
leaq 0x30(%rsp), %rsi
leaq 0x70(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x65b0
xorl %ebp, %ebp
leaq 0x2b8e6(%rip), %rsi     # 0x31d00
leaq 0x5a7(%rip), %rdx       # 0x69c8
movq %r14, %rdi
callq 0x4760
jmp 0x64db
movl $0x10, %edi
callq 0x41d0
movq %rax, %r14
leaq 0x1ecac(%rip), %rsi     # 0x250ee
movq %rax, %rdi
callq 0x4170
movq 0x2bb9f(%rip), %rsi     # 0x31ff0
movq 0x2bb50(%rip), %rdx     # 0x31fa8
movq %r14, %rdi
callq 0x4760
movl $0x30, %edi
callq 0x41d0
movq %rax, %r14
leaq 0x20(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1ecd0(%rip), %rsi     # 0x2514d
leaq 0x1ecdd(%rip), %rdx     # 0x25161
leaq 0x10(%rsp), %rdi
callq 0x579e
leaq 0x60(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1f5d9(%rip), %rdx     # 0x25a78
leaq 0x50(%rsp), %rdi
movq %rdx, %rsi
callq 0x579e
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
leaq 0x50(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x65b0
xorl %ebp, %ebp
leaq 0x2b834(%rip), %rsi     # 0x31d00
leaq 0x4f5(%rip), %rdx       # 0x69c8
movq %r14, %rdi
callq 0x4760
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x64f5
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x6550
movq 0x20(%rsp), %rsi
jmp 0x6548
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x657a
movq 0x20(%rsp), %rsi
jmp 0x6569
jmp 0x6577
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r12, %rdi
je 0x6539
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x4470
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x6550
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x4470
testb %bpl, %bpl
jne 0x657a
jmp 0x6594
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x657a
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x4470
jmp 0x657a
jmp 0x6577
jmp 0x6577
movq %rax, %rbx
movq %r14, %rdi
callq 0x4310
jmp 0x6594
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0xb984
movq %rbx, %rdi
callq 0x4790