// File: nilnilnil[P]autocomplete/src/main.cpp
// Function: callback(mg_event, mg_connection*, mg_request_info const*)
static void*
callback(enum mg_event event,
         struct mg_connection *conn,
         const struct mg_request_info *request_info) {
    if (event == MG_NEW_REQUEST) {
        std::string request_uri = request_info->uri;
        if (request_uri == "/face/suggest/") {
            return handle_suggest(event, conn, request_info);
        }
        else if (request_uri == "/face/import/") {
            return handle_import(event, conn, request_info);
        }
        else if (request_uri == "/face/export/") {
            return handle_export(event, conn, request_info);
        }
        else if (request_uri == "/face/stats/") {
            return handle_stats(event, conn, request_info);
        }
        else {
            return handle_invalid_request(event, conn, request_info);
        }
    }
    else {
        return NULL;
    }
}

// Assembly:
subq $0xb8, %rsp
movl %edi, 0xac(%rsp)
movq %rsi, 0xa0(%rsp)
movq %rdx, 0x98(%rsp)
cmpl $0x0, 0xac(%rsp)
jne 0xc10f
movq 0x98(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x50(%rsp)
leaq 0x77(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x5a50
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
leaq 0x78(%rsp), %rdi
callq 0xddd0
jmp 0xbf12
leaq 0x77(%rsp), %rdi
callq 0x55e0
leaq 0x1667a(%rip), %rsi     # 0x2259d
leaq 0x78(%rsp), %rdi
callq 0xe990
movb %al, 0x4f(%rsp)
jmp 0xbf33
movb 0x4f(%rsp), %al
testb $0x1, %al
jne 0xbf3d
jmp 0xbfb4
movl 0xac(%rsp), %edi
movq 0xa0(%rsp), %rsi
movq 0x98(%rsp), %rdx
callq 0xc140
movq %rax, 0x40(%rsp)
jmp 0xbf60
movq 0x40(%rsp), %rax
movq %rax, 0xb0(%rsp)
movl $0x1, 0x60(%rsp)
jmp 0xc103
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x68(%rsp)
movl %eax, 0x64(%rsp)
leaq 0x77(%rsp), %rdi
callq 0x55e0
jmp 0xc12b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x68(%rsp)
movl %eax, 0x64(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x5320
jmp 0xc12b
leaq 0x165f1(%rip), %rsi     # 0x225ac
leaq 0x78(%rsp), %rdi
callq 0xe990
movb %al, 0x3f(%rsp)
jmp 0xbfcb
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0xbfd5
jmp 0xc012
movl 0xac(%rsp), %edi
movq 0xa0(%rsp), %rsi
movq 0x98(%rsp), %rdx
callq 0xc8d0
movq %rax, 0x30(%rsp)
jmp 0xbff8
movq 0x30(%rsp), %rax
movq %rax, 0xb0(%rsp)
movl $0x1, 0x60(%rsp)
jmp 0xc103
leaq 0x165a1(%rip), %rsi     # 0x225ba
leaq 0x78(%rsp), %rdi
callq 0xe990
movb %al, 0x2f(%rsp)
jmp 0xc029
movb 0x2f(%rsp), %al
testb $0x1, %al
jne 0xc033
jmp 0xc070
movl 0xac(%rsp), %edi
movq 0xa0(%rsp), %rsi
movq 0x98(%rsp), %rdx
callq 0xcdb0
movq %rax, 0x20(%rsp)
jmp 0xc056
movq 0x20(%rsp), %rax
movq %rax, 0xb0(%rsp)
movl $0x1, 0x60(%rsp)
jmp 0xc103
leaq 0x16551(%rip), %rsi     # 0x225c8
leaq 0x78(%rsp), %rdi
callq 0xe990
movb %al, 0x1f(%rsp)
jmp 0xc087
movb 0x1f(%rsp), %al
testb $0x1, %al
jne 0xc091
jmp 0xc0cb
movl 0xac(%rsp), %edi
movq 0xa0(%rsp), %rsi
movq 0x98(%rsp), %rdx
callq 0xd190
movq %rax, 0x10(%rsp)
jmp 0xc0b4
movq 0x10(%rsp), %rax
movq %rax, 0xb0(%rsp)
movl $0x1, 0x60(%rsp)
jmp 0xc103
movl 0xac(%rsp), %edi
movq 0xa0(%rsp), %rsi
movq 0x98(%rsp), %rdx
callq 0xd2d0
movq %rax, 0x8(%rsp)
jmp 0xc0ee
movq 0x8(%rsp), %rax
movq %rax, 0xb0(%rsp)
movl $0x1, 0x60(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x5320
jmp 0xc11b
movq $0x0, 0xb0(%rsp)
movq 0xb0(%rsp), %rax
addq $0xb8, %rsp
retq
movq 0x68(%rsp), %rdi
callq 0x5a40
nopw %cs:(%rax,%rax)