// File: /workspace/github_cpp_makefile_star2_O2/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 %r12
pushq %rbx
subq $0x120, %rsp            # imm = 0x120
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x174e51(%rip), %rdi    # 0x5793ff
callq 0x4d7170
leaq -0x138(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x405ad8
movq (%rbx), %rsi
leaq 0x174bd4(%rip), %rdi    # 0x5791a9
xorl %eax, %eax
callq 0x4d0020
movq (%r12), %rsi
leaq 0x174bdd(%rip), %rdi    # 0x5791c4
xorl %eax, %eax
callq 0x4d0020
movq (%r15), %rsi
leaq 0x174be7(%rip), %rdi    # 0x5791df
xorl %eax, %eax
callq 0x4d0020
leaq -0x70(%rbp), %rdi
movq %r14, %rsi
callq 0x405c0a
leaq -0x70(%rbp), %r14
movq (%r14), %rsi
leaq 0x174be1(%rip), %rdi    # 0x5791fa
xorl %eax, %eax
callq 0x4d0020
movq %r14, %rdi
callq 0x477260
leaq 0x174be6(%rip), %rsi    # 0x579215
leaq -0x70(%rbp), %rdi
leaq -0xd8(%rbp), %rdx
callq 0x405048
leaq -0x90(%rbp), %rdi
leaq -0x138(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0x405c18
leaq -0x70(%rbp), %rdi
callq 0x477260
leaq 0x174dd8(%rip), %rdi    # 0x57943e
callq 0x4d7170
movq -0x90(%rbp), %rsi
leaq 0x174ba9(%rip), %rdi    # 0x579222
xorl %eax, %eax
callq 0x4d0020
leaq 0x174ef5(%rip), %rdi    # 0x57957c
callq 0x4d7170
leaq -0x70(%rbp), %rdi
callq 0x4060dc
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x4063f8
testb %al, %al
je 0x404796
movq (%rbx), %rsi
leaq 0x174b77(%rip), %rdi    # 0x57922e
xorl %eax, %eax
callq 0x4d0020
leaq -0xd8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x406164
leaq -0xd8(%rbp), %r14
movq (%r14), %rsi
leaq 0x174b1b(%rip), %rdi    # 0x5791fa
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x4d0020
movq %r14, %rdi
callq 0x477260
leaq -0xc0(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %r15b, (%rax)
leaq -0xa0(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %r15b, (%rax)
leaq -0x70(%rbp), %rdi
pushq $0x2
popq %rsi
callq 0x4063b2
leaq -0xd0(%rbp), %rdi
movq %rax, %rsi
callq 0x476e90
leaq -0xf8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x406164
leaq -0xb0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x476e90
leaq -0xf8(%rbp), %rdi
callq 0x477260
movq -0x48(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq 0x1e801d(%rip), %rdi    # 0x5ec790
movq %rbx, %rsi
callq 0x405084
leaq -0xd8(%rbp), %rsi
movq %rax, %rdi
callq 0x4050ee
leaq -0xd8(%rbp), %rdi
callq 0x405126
leaq -0x70(%rbp), %rbx
movq %rbx, %rdi
callq 0x40453c
movq %rbx, %rdi
callq 0x406100
leaq -0x90(%rbp), %rdi
callq 0x477260
leaq -0x138(%rbp), %rdi
callq 0x405ade
addq $0x120, %rsp            # imm = 0x120
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0xf8(%rbp), %rdi
callq 0x477260
jmp 0x404804
jmp 0x404801
jmp 0x4047e7
movq %rax, %rbx
jmp 0x404810
movq %rax, %rbx
jmp 0x404819
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
jmp 0x404820
jmp 0x4047fc
movq %rax, %rbx
jmp 0x404825
movq %rax, %rbx
leaq -0xd8(%rbp), %rdi
callq 0x405126
leaq -0x70(%rbp), %rdi
callq 0x406100
leaq -0x90(%rbp), %rdi
callq 0x477260
leaq -0x138(%rbp), %rdi
callq 0x405ade
movq %rbx, %rdi
callq 0x4a94e0