// File: /workspace/github_cpp_makefile_star2_O1/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 0x5c2c
movq $0x0, 0x8(%rsp)
movq 0x48(%rbx), %rdi
movq %rdi, 0x8(%rsp)
cmpq 0x50(%rbx), %rdi
je 0x6310
leaq 0x60(%rbx), %r14
movl $0x1, %ebp
leaq 0x1ee94(%rip), %r15     # 0x250df
leaq 0x90(%rsp), %r12
leaq 0x1f731(%rip), %r13     # 0x2598b
movq %r15, %rsi
callq 0x40f0
testl %eax, %eax
je 0x62c1
movq 0x8(%rsp), %rdi
leaq 0x1ee74(%rip), %rsi     # 0x250e6
callq 0x40f0
testl %eax, %eax
jne 0x6351
movq 0x8(%rsp), %rdi
addq $0x20, %rdi
movq %rdi, 0x8(%rsp)
xorl %esi, %esi
movl $0xa, %edx
callq 0x244f4
movl %eax, 0x24(%rbx)
cmpl $0x11, %eax
jae 0x63d9
movq 0x8(%rsp), %rdi
addq $0x20, %rdi
movq %rdi, 0x8(%rsp)
movq %r13, %rsi
callq 0x40f0
testl %eax, %eax
je 0x62f8
jmp 0x6330
movq %r12, %rdi
callq 0xb20c
movl %ebp, 0x90(%rsp)
addq $0x20, 0x8(%rsp)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
callq 0xc6b0
movq %r14, %rdi
movq %r12, %rsi
callq 0x6ad2
incl %ebp
movq %r12, %rdi
callq 0xb924
movq 0x8(%rsp), %rdi
addq $0x20, %rdi
movq %rdi, 0x8(%rsp)
cmpq 0x50(%rbx), %rdi
jne 0x625a
movq 0x60(%rbx), %rax
cmpq 0x68(%rbx), %rax
je 0x640b
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 0x1edce(%rip), %rsi     # 0x25112
movq %rax, %rdi
callq 0x4170
jmp 0x63f5
movl $0x30, %edi
callq 0x41d0
movq %rax, %r14
leaq 0x80(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1edba(%rip), %rsi     # 0x2512b
leaq 0x1edd4(%rip), %rdx     # 0x2514c
leaq 0x70(%rsp), %rdi
callq 0x578e
movq 0x8(%rsp), %rax
leaq 0x60(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x50(%rsp), %rdi
callq 0x6bac
movb $0x1, %bpl
leaq 0x70(%rsp), %rsi
leaq 0x50(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x6542
xorl %ebp, %ebp
leaq 0x2b93b(%rip), %rsi     # 0x31d00
leaq 0x590(%rip), %rdx       # 0x695c
movq %r14, %rdi
callq 0x4750
jmp 0x6486
movl $0x10, %edi
callq 0x41d0
movq %rax, %r14
leaq 0x1ed01(%rip), %rsi     # 0x250ee
movq %rax, %rdi
callq 0x4170
movq 0x2bbf4(%rip), %rsi     # 0x31ff0
movq 0x2bba5(%rip), %rdx     # 0x31fa8
movq %r14, %rdi
callq 0x4750
movl $0x30, %edi
callq 0x41d0
movq %rax, %r14
leaq 0x40(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1ed25(%rip), %rsi     # 0x2514d
leaq 0x1ed32(%rip), %rdx     # 0x25161
leaq 0x30(%rsp), %rdi
callq 0x578e
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1f62e(%rip), %rdx     # 0x25a78
leaq 0x10(%rsp), %rdi
movq %rdx, %rsi
callq 0x578e
movb $0x1, %bpl
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x6542
xorl %ebp, %ebp
leaq 0x2b889(%rip), %rsi     # 0x31d00
leaq 0x4de(%rip), %rdx       # 0x695c
movq %r14, %rdi
callq 0x4750
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x64a8
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0x64a8
movq %rax, %rbx
movb $0x1, %bpl
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x6501
movq 0x40(%rsp), %rsi
jmp 0x64ef
jmp 0x64fb
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x64dd
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0x64dd
movq %rax, %rbx
movb $0x1, %bpl
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x6501
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x4460
jmp 0x6501
jmp 0x6508
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
jne 0x650b
jmp 0x6525
movq %rax, %rbx
movq %r14, %rdi
callq 0x4300
jmp 0x6525
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0xb924
movq %rbx, %rdi
callq 0x4780
nop