// File: /workspace/github_c_makefile_star2_O0/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_mgr_init_opt
void mg_mgr_init_opt(struct mg_mgr *m, void *user_data,
                     struct mg_mgr_init_opts opts) {
  memset(m, 0, sizeof(*m));
#if MG_ENABLE_BROADCAST
  m->ctl[0] = m->ctl[1] = INVALID_SOCKET;
#endif
  m->user_data = user_data;

#ifdef _WIN32
  {
    WSADATA data;
    WSAStartup(MAKEWORD(2, 2), &data);
  }
#elif defined(__unix__)
  /* Ignore SIGPIPE signal, so if client cancels the request, it
   * won't kill the whole process. */
  signal(SIGPIPE, SIG_IGN);
#endif

#if MG_ENABLE_SSL
  {
    static int init_done;
    if (!init_done) {
      mg_ssl_if_init();
      init_done++;
    }
  }
#endif
  {
    int i;
    if (opts.num_ifaces == 0) {
      opts.num_ifaces = mg_num_ifaces;
      opts.ifaces = mg_ifaces;
    }
    if (opts.main_iface != NULL) {
      opts.ifaces[MG_MAIN_IFACE] = opts.main_iface;
    }
    m->num_ifaces = opts.num_ifaces;
    m->ifaces =
        (struct mg_iface **) MG_MALLOC(sizeof(*m->ifaces) * opts.num_ifaces);
    for (i = 0; i < mg_num_ifaces; i++) {
      m->ifaces[i] = mg_if_create_iface(opts.ifaces[i], m);
      m->ifaces[i]->vtable->init(m->ifaces[i]);
    }
  }
  if (opts.nameserver != NULL) {
    m->nameserver = strdup(opts.nameserver);
  }
  DBG(("=================================="));
  DBG(("init mgr=%p", m));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
movl $0x38, %edx
callq 0x3260
movq -0x8(%rbp), %rax
movl $0xffffffff, 0x14(%rax) # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rax
movl $0xffffffff, 0x10(%rax) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x18(%rax)
movl $0xd, %edi
movl $0x1, %esi
callq 0x33c0
movq -0x20(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0xad6b
movq -0x20(%rbp), %rax
movl 0x1c643(%rip), %ecx     # 0x273a0
movl %ecx, 0x8(%rax)
leaq 0x1c649(%rip), %rcx     # 0x273b0
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0xad83
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq 0x10(%rax), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x8(%rbp), %rcx
movl %edx, 0x20(%rcx)
movslq 0x8(%rax), %rdi
shlq $0x3, %rdi
callq 0x3420
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl 0x1c5e7(%rip), %eax     # 0x273a0
jge 0xae1b
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x8(%rbp), %rsi
callq 0xaeb0
movq %rax, %rdx
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x14(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movslq -0x14(%rbp), %rdx
movq (%rcx,%rdx,8), %rdi
callq *%rax
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xadb0
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0xae3e
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x3640
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x30(%rax)
jmp 0xae40
movl $0x4, %edi
leaq 0x1477a(%rip), %rsi     # 0x1f5c6
leaq 0x146f7(%rip), %rdx     # 0x1f54a
callq 0x4650
cmpl $0x0, %eax
je 0xae6b
leaq 0x14772(%rip), %rdi     # 0x1f5d6
movb $0x0, %al
callq 0x47a0
jmp 0xae6d
jmp 0xae6f
movl $0x4, %edi
leaq 0x1474b(%rip), %rsi     # 0x1f5c6
leaq 0x146c8(%rip), %rdx     # 0x1f54a
callq 0x4650
cmpl $0x0, %eax
je 0xae9e
movq -0x8(%rbp), %rsi
leaq 0x14762(%rip), %rdi     # 0x1f5f9
movb $0x0, %al
callq 0x47a0
jmp 0xaea0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)