// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/demo/demo.cpp
// Function: demoRegisterNewUser(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void demoRegisterNewUser(
    const std::string& userid,
    const std::string& password,
    const std::string& domain)
{
    printf("\n-- CLIENT ---- REGISTER NEW USER ----------------------------\n");
    APUser user(userid, password, domain);
    printf(" user id ........... : %s\n", userid.c_str());
    printf(" password .......... : %s\n", password.c_str());
    printf(" domain ............ : %s\n", domain.c_str());
    printf(" public key ........ : %s\n", user.getPublicKey().c_str());

    std::string reg_token = user.registerNewUser("888-555-1234");
    printf(" token layout ...... : nu.timestamp.algo.public_key.pw_reset_info.signature\n");
    printf(" token: %s\n", reg_token.c_str());

    printf("\n~~ SERVER ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
    APVerifier verifier = APVerifier();
    if (verifier.parseUserRegistrationToken(reg_token))
    {
        printf(" new user id ....... : %s\n", userid.c_str());
        printf(" public key ........ : %s\n", verifier.getPublicKey().c_str());

        // save new user record (if not exists already)
        //if (user_info_records.find((userid) == user_info_records.end())
        {
            user_info_record ui;
            ui.algo = verifier.getItem(2);
            ui.publicKey = verifier.getPublicKey();
            ui.last_access_time = verifier.getTimestamp();
            user_info_records[userid] = ui;
        }
    }
    print_verifier_state(verifier);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x175e35(%rip), %rdi    # 0x57a3ff
callq 0x4d7910
leaq -0x140(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x405f38
movq (%rbx), %rsi
leaq 0x175bb8(%rip), %rdi    # 0x57a1a9
xorl %eax, %eax
callq 0x4d07c0
movq (%r12), %rsi
leaq 0x175bc1(%rip), %rdi    # 0x57a1c4
xorl %eax, %eax
callq 0x4d07c0
movq (%r15), %rsi
leaq 0x175bcb(%rip), %rdi    # 0x57a1df
xorl %eax, %eax
callq 0x4d07c0
leaq -0x98(%rbp), %rdi
movq %r14, %rsi
callq 0x406144
leaq -0x88(%rbp), %r14
movq -0x10(%r14), %rsi
leaq 0x175bbe(%rip), %rdi    # 0x57a1fa
xorl %eax, %eax
callq 0x4d07c0
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
je 0x40465b
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x40ad30
leaq -0x98(%rbp), %rdi
movq %r14, (%rdi)
leaq 0x175ba9(%rip), %rsi    # 0x57a215
leaq 0x175bae(%rip), %rdx    # 0x57a221
callq 0x40549e
leaq -0x48(%rbp), %rdi
leaq -0x140(%rbp), %rsi
leaq -0x98(%rbp), %rdx
callq 0x406152
movq -0x98(%rbp), %rdi
cmpq %r14, %rdi
je 0x4046aa
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x40ad30
leaq 0x175d8d(%rip), %rdi    # 0x57a43e
callq 0x4d7910
movq -0x48(%rbp), %rsi
leaq 0x175b61(%rip), %rdi    # 0x57a222
xorl %eax, %eax
callq 0x4d07c0
leaq 0x175ead(%rip), %rdi    # 0x57a57c
callq 0x4d7910
leaq -0x98(%rbp), %rdi
callq 0x406818
leaq -0x98(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x406ba8
testb %al, %al
je 0x40485a
movq (%rbx), %rsi
leaq 0x175b2c(%rip), %rdi    # 0x57a22e
xorl %eax, %eax
callq 0x4d07c0
leaq -0xe0(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x4068aa
leaq -0xd0(%rbp), %r14
movq -0x10(%r14), %rsi
leaq 0x175acc(%rip), %rdi    # 0x57a1fa
xorl %eax, %eax
callq 0x4d07c0
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
je 0x40474d
movq -0xd0(%rbp), %rsi
incq %rsi
callq 0x40ad30
leaq -0xc8(%rbp), %r12
movq %r12, -0x10(%r12)
xorl %eax, %eax
movq %rax, -0x8(%r12)
movb %al, (%r12)
leaq -0xa8(%rbp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb %al, (%r13)
leaq -0x98(%rbp), %rdi
movl $0x2, %esi
callq 0x406b62
leaq -0xd8(%rbp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x477790
leaq -0x100(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x4068aa
leaq -0xb8(%rbp), %r15
leaq -0x100(%rbp), %rsi
movq %r15, %rdi
callq 0x477790
leaq -0xf0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4047e2
movq -0xf0(%rbp), %rsi
incq %rsi
callq 0x40ad30
movq -0x70(%rbp), %rax
movq %rax, -0xe0(%rbp)
leaq 0x1e8f9c(%rip), %rdi    # 0x5ed790
movq %rbx, %rsi
callq 0x405302
movq %rax, %rbx
movq -0xe0(%rbp), %rax
movq %rax, (%rbx)
leaq 0x8(%rbx), %rdi
movq %r14, %rsi
callq 0x477790
addq $0x28, %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x477790
movq -0xb8(%rbp), %rdi
cmpq %r13, %rdi
je 0x40483f
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x40ad30
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x40485a
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x40ad30
leaq -0x98(%rbp), %rbx
movq %rbx, %rdi
callq 0x404556
movq %rbx, %rdi
callq 0x40683c
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x40488a
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x40ad30
leaq -0x140(%rbp), %rdi
callq 0x405f3e
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0xf0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4048fc
movq -0xf0(%rbp), %rsi
incq %rsi
callq 0x40ad30
jmp 0x4048fc
jmp 0x4048f9
jmp 0x4048d0
movq %rax, %rbx
jmp 0x404908
movq %rax, %rbx
jmp 0x404914
movq %rax, %rbx
movq -0x98(%rbp), %rdi
cmpq %r14, %rdi
je 0x40492d
movq -0x88(%rbp), %rsi
jmp 0x404925
jmp 0x4048f4
movq %rax, %rbx
jmp 0x40492d
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
callq 0x405382
leaq -0x98(%rbp), %rdi
callq 0x40683c
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x40492d
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x40ad30
leaq -0x140(%rbp), %rdi
callq 0x405f3e
movq %rbx, %rdi
callq 0x4a9c80