LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/cloudinary[P]fuif/encoding/../maniac/rac.h
// Function: RacInput<RacConfig24, FileIO>::get(unsigned long)
bool inline get(rac_t chance) {
        assert(chance >= 0);
        assert(chance < range);
        if (low >= range-chance) {
            low -= range-chance;
            range = chance;
            input();
            return true;
        } else {
            range -= chance;
            input();
            return false;
        }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movq 0x10(%rdi), %r15
subq %rsi, %r14
movq %r15, %rax
subq %r14, %rax
jb 0x1c555
movq %rax, 0x10(%rbx)
movq %rsi, 0x8(%rbx)
cmpq $0x10000, %rsi          # imm = 0x10000
ja 0x1c547
shlq $0x8, %rax
movq %rax, 0x10(%rbx)
shlq $0x8, %rsi
movq %rsi, 0x8(%rbx)
movq (%rbx), %rax
movq (%rax), %rdi
callq 0x34c0
cltq
orq %rax, 0x10(%rbx)
movq 0x8(%rbx), %rax
cmpq $0x10001, %rax          # imm = 0x10001
jb 0x1c595
jmp 0x1c5b3
movq %r14, 0x8(%rbx)
cmpq $0x10000, %r14          # imm = 0x10000
ja 0x1c589
movq %r15, %rax
shlq $0x8, %rax
movq %rax, 0x10(%rbx)
movq %r14, %rax
shlq $0x8, %rax
movq %rax, 0x8(%rbx)
movq (%rbx), %rax
movq (%rax), %rdi
callq 0x34c0
cltq
orq %rax, 0x10(%rbx)
movq 0x8(%rbx), %rax
cmpq $0x10000, %rax          # imm = 0x10000
ja 0x1c5b3
shlq $0x8, 0x10(%rbx)
shlq $0x8, %rax
movq %rax, 0x8(%rbx)
movq (%rbx), %rax
movq (%rax), %rdi
callq 0x34c0
cltq
orq %rax, 0x10(%rbx)
cmpq %r14, %r15
setae %al
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/cloudinary[P]fuif/io.cpp
// Function: v_printf(int, char const*, ...)
void v_printf(const int v, const char *format, ...) {
    if (verbosity < v) return;
    va_list args;
    va_start(args, format);
    vfprintf(my_stdout, format, args);
    fflush(my_stdout);
    va_end(args);
}

// Assembly:
subq $0xd8, %rsp
testb %al, %al
je 0x1d118
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
cmpl %edi, 0x131f6(%rip)     # 0x30328
jl 0x1d171
leaq 0x20(%rsp), %rax
movq %rsp, %rdx
movq %rax, 0x10(%rdx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rdx)
movq 0x155d8(%rip), %rdi     # 0x32738
callq 0x33d0
movq 0x155cc(%rip), %rdi     # 0x32738
callq 0x3360
addq $0xd8, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O1/cloudinary[P]fuif/io.cpp
// Function: v_printf_tty(int, char const*, ...)
void v_printf_tty(const int v, const char *format, ...) {
    if (verbosity < v) return;
#ifdef _WIN32
    if(!_isatty(_fileno(my_stdout))) return;
#else
    if(!isatty(fileno(my_stdout))) return;
#endif
    va_list args;
    va_start(args, format);
    vfprintf(my_stdout, format, args);
    fflush(my_stdout);
    va_end(args);
}

// Assembly:
pushq %rbx
subq $0xd0, %rsp
testb %al, %al
je 0x1d1bc
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
cmpl %edi, 0x13152(%rip)     # 0x30328
jl 0x1d232
movq %rsi, %rbx
movq 0x15556(%rip), %rdi     # 0x32738
callq 0x32f0
movl %eax, %edi
callq 0x3580
testl %eax, %eax
je 0x1d232
leaq 0x20(%rsp), %rax
movq %rsp, %rdx
movq %rax, 0x10(%rdx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rdx)
movq 0x1551a(%rip), %rdi     # 0x32738
movq %rbx, %rsi
callq 0x33d0
movq 0x1550b(%rip), %rdi     # 0x32738
callq 0x3360
addq $0xd0, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/cloudinary[P]fuif/./import/read_gif.h
// Function: render_frame_rect(gd_GIF*, unsigned char*)
static void
render_frame_rect(gd_GIF *gif, uint8_t *buffer)
{
    int i, j, k;
    uint8_t index, *color;
    i = gif->fy * gif->width + gif->fx;
    for (j = 0; j < gif->fh; j++) {
        for (k = 0; k < gif->fw; k++) {
            index = gif->frame[(gif->fy + j) * gif->width + gif->fx + k];
            color = &gif->palette->colors[index*3];
            if (!gif->gce.transparency || index != gif->gce.tindex) {
                memcpy(&buffer[(i+k)*4], color, 3);
                buffer[(i+k)*4+3] = 255; // opaque
            }
        }
        i += gif->width;
    }
}

// Assembly:
cmpw $0x0, 0x656(%rdi)
je 0x1e356
movzwl 0x10(%rdi), %eax
movzwl 0x652(%rdi), %ecx
imull %eax, %ecx
movzwl 0x650(%rdi), %eax
addl %ecx, %eax
xorl %ecx, %ecx
cmpw $0x0, 0x654(%rdi)
je 0x1e33e
movl %eax, %edx
leaq (%rsi,%rdx,4), %rdx
xorl %r8d, %r8d
movzwl 0x652(%rdi), %r9d
movzwl 0x10(%rdi), %r10d
movzwl 0x650(%rdi), %r11d
addq %rcx, %r9
imulq %r10, %r9
addq %r11, %r9
addq 0x668(%rdi), %r9
movzbl (%r8,%r9), %r9d
movq 0x28(%rdi), %r10
cmpl $0x0, 0x20(%rdi)
je 0x1e30b
cmpb 0x1a(%rdi), %r9b
je 0x1e32e
leaq (%r9,%r9,2), %r9
addq %r10, %r9
addq $0x4, %r9
movb 0x2(%r9), %r10b
movb %r10b, 0x2(%rdx,%r8,4)
movzwl (%r9), %r9d
movw %r9w, (%rdx,%r8,4)
movb $-0x1, 0x3(%rdx,%r8,4)
incq %r8
movzwl 0x654(%rdi), %r9d
cmpq %r9, %r8
jb 0x1e2d0
movzwl 0x10(%rdi), %edx
addl %edx, %eax
incq %rcx
movzwl 0x656(%rdi), %edx
cmpl %edx, %ecx
jb 0x1e2bd
retq
// File: /workspace/github_cpp_makefile_star2_O1/cloudinary[P]fuif/./import/read_pam.h
// Function: read_pnm_int(_IO_FILE*, char*, char**)
unsigned int read_pnm_int(FILE *fp, char* buf, char** t) {
    long result = strtol(*t,t,10);
    if (result == 0) {
        // no valid int found here, try next line
        do {
          *t = fgets(buf, PPMREADBUFLEN, fp);
          if ( *t == NULL ) {return false;}
        } while ( strncmp(buf, "#", 1) == 0 || strncmp(buf, "\n", 1) == 0);
        result = strtol(*t,t,10);
        if (result == 0) { e_printf("Invalid PNM file.\n"); fclose(fp); }
    }
    return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movq (%rdx), %rdi
movq %rdx, %rsi
movl $0xa, %edx
callq 0x33f0
testq %rax, %rax
je 0x1f302
movq %rax, %r14
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r12, %rdi
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdx
callq 0x34e0
movq %rax, (%r15)
xorl %r14d, %r14d
testq %rax, %rax
je 0x1f2f3
movzbl (%r12), %ecx
cmpl $0x23, %ecx
je 0x1f32c
cmpl $0xa, %ecx
jne 0x1f341
movq %r12, %rdi
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdx
callq 0x34e0
movq %rax, (%r15)
jmp 0x1f318
movq %rax, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x33f0
testq %rax, %rax
jne 0x1f2f0
leaq 0x7e93(%rip), %rdi      # 0x271f0
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x3796
movq %rbx, %rdi
callq 0x32a0
jmp 0x1f2f3
// File: /workspace/github_cpp_makefile_star2_O1/cloudinary[P]fuif/fuif.cpp
// Function: file_exists(char const*)
bool file_exists(const char * filename){
        FILE * file = fopen(filename, "rb");
        if (!file) return false;
        fclose(file);
        return true;
}

// Assembly:
pushq %rbx
leaq 0x5653(%rip), %rsi      # 0x26a71
callq 0x3370
movq %rax, %rbx
testq %rax, %rax
je 0x21433
movq %rbx, %rdi
callq 0x32a0
testq %rbx, %rbx
setne %al
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/cloudinary[P]fuif/./import/read_gif.h
// Function: get_key(gd_GIF*, int, unsigned char*, unsigned char*, unsigned char*)
static uint16_t
get_key(gd_GIF *gif, int key_size, uint8_t *sub_len, uint8_t *shift, uint8_t *byte)
{
    int bits_read;
    int rpad;
    int frag_size;
    uint16_t key;

    key = 0;
    for (bits_read = 0; bits_read < key_size; bits_read += frag_size) {
        rpad = (*shift + bits_read) % 8;
        if (rpad == 0) {
            /* Update byte. */
            if (*sub_len == 0)
                read(gif->fd, sub_len, 1); /* Must be nonzero! */
            read(gif->fd, byte, 1);
            (*sub_len)--;
        }
        frag_size = MIN(key_size - bits_read, 8 - rpad);
        key |= ((uint16_t) ((*byte) >> rpad)) << bits_read;
    }
    /* Clear extra bits to the left. */
    key &= (1 << key_size) - 1;
    *shift = (*shift + key_size) % 8;
    return key;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r12
movl %esi, %r14d
movq %rdi, 0x10(%rsp)
xorl %r13d, %r13d
testl %esi, %esi
jle 0x23f3a
movq %r8, %r9
movq %rdx, %r15
xorl %ebp, %ebp
movq %r8, 0x8(%rsp)
movzbl (%r12), %eax
movl %r13d, %ebx
addl %eax, %ebx
leal 0x7(%r13,%rax), %eax
cmovnsl %ebx, %eax
andl $-0x8, %eax
subl %eax, %ebx
jne 0x23f0c
cmpb $0x0, (%r15)
jne 0x23ef0
movq 0x10(%rsp), %rax
movl (%rax), %edi
movl $0x1, %edx
movq %r15, %rsi
callq 0x3420
movq 0x8(%rsp), %r9
movq 0x10(%rsp), %rax
movl (%rax), %edi
movl $0x1, %edx
movq %r9, %rsi
callq 0x3420
movq 0x8(%rsp), %r9
decb (%r15)
movl %r14d, %eax
subl %r13d, %eax
movl $0x8, %esi
subl %ebx, %esi
cmpl %esi, %eax
cmovll %eax, %esi
movzbl (%r9), %eax
movl %ebx, %ecx
shrl %cl, %eax
movl %r13d, %ecx
shll %cl, %eax
orl %eax, %ebp
addl %r13d, %esi
movl %esi, %r13d
cmpl %r14d, %esi
jl 0x23eb8
jmp 0x23f3c
xorl %ebp, %ebp
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %r14d, %ecx
shll %cl, %eax
notl %eax
andl %eax, %ebp
movzbl (%r12), %eax
leal (%rax,%r14), %ecx
addl $0x7, %ecx
addl %r14d, %eax
cmovnsl %eax, %ecx
andl $0xf8, %ecx
subl %ecx, %eax
movb %al, (%r12)
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/demo/demo.cpp
// Function: print_verifier_state(APVerifier&)
void print_verifier_state(APVerifier& v)
{
    printf(" Status(%s): %s\n", tag_name(v.getTag()), GetErrorString(v.getError()));
    if (v.getError() != APVerifier::AP_SUCCESS) 
    {
        return;
    }

    print_time_value(" token timestamp ... :", v.getTimestamp());
    /*
    size_t i, nItems = v.getItemCount();
    for (i = 0; i < nItems; i++)
    {
        printf(" %d - [%s]\n", (int)i, v.getItem(i).c_str());
    }
    printf("\n public key (verifier): %s\n", v.getPublicKey().c_str());
    */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl 0x24(%rdi), %edi
callq 0x4044db
movq %rax, %r14
movl 0x20(%rbx), %edi
callq 0x404458
leaq 0x175c07(%rip), %rdi    # 0x57a181
movq %r14, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x4d07c0
cmpl $0x0, 0x20(%rbx)
je 0x404592
popq %rbx
popq %r14
popq %rbp
retq
movq 0x28(%rbx), %rsi
leaq 0x175bf5(%rip), %rdi    # 0x57a192
popq %rbx
popq %r14
popq %rbp
jmp 0x40447f
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/client/APKeyDerivation.cpp
// Function: APDigest::finish(void*, unsigned long)
size_t APDigest::finish(void* digest, size_t size)
{
    SHA512_Final(m_Digest, &m_Ctx);
    if (size > DIGEST_SIZE) 
        size = DIGEST_SIZE;

    memcpy(digest, &m_Digest[0], size);
    return size;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %rsi
leaq 0xd8(%rdi), %r15
movq %r15, %rdi
callq 0x4083c0
cmpq $0x40, %rbx
movl $0x40, %r12d
cmovbq %rbx, %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x401110
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/client/APKeyDerivation.cpp
// Function: APDigest::kdf(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&, unsigned char*, unsigned long)
void APDigest::kdf(
    const std::string& userid,
    const std::string& password,
    const std::string& domain,
    uint8_t* dk, size_t dkLen)
{
#ifdef USE_PASSWORD_HASH
    // Replace password with its hash to be able to convert hashed
    // passwords automatically

    // Here we are assuming passwords are haded with sha512
    APDigest passwordHash(password.c_str(), password.length());

    // Use combination of userid & domain as salt

    APDigest saltHash;
    saltHash.update(userid.c_str(), userid.length());
    saltHash.update(&kdf_separator, 1);
    saltHash.update(domain.c_str(), domain.length());
    saltHash.finish();

    APDigest::pbkdf2(
        passwordHash.digest(), APDigest::DIGEST_SIZE, 
        saltHash.digest(), APDigest::DIGEST_SIZE,
        APDigest::KDF_ITERATIONS,
        dk, dkLen);
#else
    std::string salt = userid + AP_KDF_SEP + domain;
    APDigest::pbkdf2(
        password.c_str(), password.length(), 
        salt.c_str(), salt.length(),
        APDigest::KDF_ITERATIONS,
        dk, dkLen);
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %r14
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
leaq 0x38(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rdi), %rsi
movq 0x8(%rdi), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %r13
movq %r13, %rdi
callq 0x405866
movq 0x8(%r13), %rsi
movl $0x1, %ecx
movq %r13, %rdi
xorl %edx, %edx
movl $0x26, %r8d
callq 0x4784a0
movq (%r12), %rsi
movq 0x8(%r12), %rdx
leaq 0x28(%rsp), %rdi
callq 0x4791d0
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x405cfa
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x405d02
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x405d31
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40ad30
movq (%r15), %rdi
movq 0x8(%r15), %rsi
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rcx
movq %r14, (%rsp)
movl $0x64, %r8d
movq %rbx, %r9
callq 0x405db2
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x405d6b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40ad30
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x405daa
movq 0x18(%rsp), %rsi
jmp 0x405da2
jmp 0x405d90
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x405daa
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40ad30
movq %rbx, %rdi
callq 0x4a9c80
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/client/APKeyDerivation.cpp
// Function: APDigest::pbkdf2(void const*, unsigned long, void const*, unsigned long, unsigned int, unsigned char*, unsigned long)
void APDigest::pbkdf2(
    const void *password, size_t passwordLen,
    const void *salt,     size_t saltLen,
    uint32_t iterations,
    uint8_t* dk,          size_t dkLen)
{
    uint8_t *saltBlock = new uint8_t[saltLen + 4];
    uint32_t blockNumber = 1;
    memcpy (saltBlock, salt, saltLen);
    while (dkLen >= DIGEST_SIZE)
    {
        PRF((const uint8_t*)password, passwordLen, 
            saltBlock, saltLen,
            iterations, blockNumber++, dk, DIGEST_SIZE);
        dk += DIGEST_SIZE;
        dkLen -= DIGEST_SIZE;
    }

    if (dkLen > 0)
    {
        PRF((const uint8_t*)password, passwordLen, 
            saltBlock, saltLen,
            iterations, blockNumber, dk, dkLen);
    }
    delete [] saltBlock;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %rbx
movl %r8d, 0xc(%rsp)
movq %rcx, %r13
movq %rdx, %rbp
movq %rsi, %r14
movq %rdi, 0x10(%rsp)
movq 0x60(%rsp), %r12
leaq 0x4(%rcx), %rdi
callq 0x40bc20
movq %rax, %r15
movq %rax, %rdi
movq %rbp, %rsi
movq %r13, 0x18(%rsp)
movq %r13, %rdx
callq 0x401110
movl $0x1, %ebp
cmpq $0x40, %r12
movq %r14, 0x20(%rsp)
jb 0x405e50
movl $0x1, %r9d
movq 0x18(%rsp), %r13
movq 0x10(%rsp), %r14
leal 0x1(%r9), %ebp
movq %r14, %rdi
movq 0x20(%rsp), %rsi
movq %r15, %rdx
movq %r13, %rcx
movl 0xc(%rsp), %r8d
pushq $0x40
pushq %rbx
callq 0x405e97
addq $0x10, %rsp
addq $0x40, %rbx
addq $-0x40, %r12
movl %ebp, %r9d
cmpq $0x3f, %r12
ja 0x405e1a
jmp 0x405e5a
movq 0x18(%rsp), %r13
movq 0x10(%rsp), %r14
testq %r12, %r12
movl 0xc(%rsp), %r8d
movq 0x20(%rsp), %rsi
je 0x405e81
movq %r14, %rdi
movq %r15, %rdx
movq %r13, %rcx
movl %ebp, %r9d
pushq %r12
pushq %rbx
callq 0x405e97
addq $0x10, %rsp
movq %r15, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x40ad40
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/client/APKeyDerivation.cpp
// Function: PRF(unsigned char const*, unsigned long, unsigned char*, unsigned long, unsigned int, unsigned int, unsigned char*, unsigned long)
static void PRF(
   const uint8_t *password, size_t passwordLen,
   uint8_t *saltBlock, size_t saltLen,
   uint32_t iterations,
   uint32_t blockNumber,
   uint8_t *dk, size_t dkLen)   // dkLen <= APDigest::DIGEST_SIZE
{
    uint8_t mac[APDigest::DIGEST_SIZE];
    /* saltBlock = [ Salt || INT (blockNumber)]. */
    saltBlock[saltLen + 0] = (uint8_t)(blockNumber >> 24);
    saltBlock[saltLen + 1] = (uint8_t)(blockNumber >> 16);
    saltBlock[saltLen + 2] = (uint8_t)(blockNumber >> 8);
    saltBlock[saltLen + 3] = (uint8_t)(blockNumber);

    APDigest::hmac (
        password, passwordLen, 
        saltBlock, saltLen + 4, 
        mac, sizeof(mac));
    memcpy (dk, mac, dkLen);

    while (--iterations > 0)
    {
        APDigest::hmac (
            password, passwordLen, 
            mac, APDigest::DIGEST_SIZE, 
            mac, APDigest::DIGEST_SIZE);
        for (uint32_t i = 0; i < dkLen; i++) dk[i] ^= mac[i];
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r8d, %ebx
movq %rsi, %r14
movq %rdi, %r15
movq 0x88(%rsp), %r12
movq 0x80(%rsp), %r13
bswapl %r9d
movl %r9d, (%rdx,%rcx)
addq $0x4, %rcx
movq %rsp, %rbp
movl $0x40, %r9d
movq %rbp, %r8
callq 0x405a4c
movq %r13, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x401110
decl %ebx
je 0x405f28
movq %rsp, %rbp
movl $0x40, %ecx
movl $0x40, %r9d
movq %r15, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %rbp, %r8
callq 0x405a4c
testq %r12, %r12
je 0x405f24
xorl %eax, %eax
movb (%rsp,%rax), %cl
xorb %cl, (%r13,%rax)
incq %rax
movl %eax, %ecx
cmpq %r12, %rcx
jb 0x405f12
decl %ebx
jne 0x405eef
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/client/APUser.cpp
// Function: APUser::createToken(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&)
const std::string APUser::createToken(
    const std::string& tag, 
    const std::string& payload)
{
    std::ostringstream s;
    s << tag << AP_SEP << std::hex << uint64_t(time(0)) << AP_SEP << payload << AP_SEP;

    std::string p = s.str();
    return p + m_private_key.signMessage(p);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x48(%rsp), %r13
movq %r13, %rdi
callq 0x46fe80
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %r13, %rdi
callq 0x467730
leaq 0x8(%rsp), %rsi
movb $0x2e, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x467730
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%r12,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r12,%rax)
xorl %edi, %edi
callq 0x52dae0
movq %r12, %rdi
movq %rax, %rsi
callq 0x468030
leaq 0x8(%rsp), %rsi
movb $0x2e, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x467730
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rax, %rdi
callq 0x467730
leaq 0x8(%rsp), %rsi
movb $0x2e, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x467730
leaq 0x50(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x46d870
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %r14, %rsi
callq 0x4067b0
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %r8
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x478b50
leaq 0x10(%rbx), %rdx
movq %rdx, (%rbx)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x406053
movq %rsi, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0x406059
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x40608b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40ad30
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4060a6
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40ad30
movq $0x5e7bb8, %rsi         # imm = 0x5E7BB8
leaq 0x48(%rsp), %rdi
callq 0x470730
leaq 0xb8(%rsp), %rdi
callq 0x44af00
movq %rbx, %rax
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4060fb
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40ad30
jmp 0x4060fb
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x40611d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40ad30
jmp 0x40611d
jmp 0x40611a
movq %rax, %rbx
movq $0x5e7bb8, %rsi         # imm = 0x5E7BB8
leaq 0x48(%rsp), %rdi
callq 0x470730
leaq 0xb8(%rsp), %rdi
callq 0x44af00
movq %rbx, %rdi
callq 0x4a9c80
nop
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/client/APUser.cpp
// Function: APUser::registerNewUser(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
const std::string APUser::registerNewUser(
    const std::string& pw_reset_info)
{
    std::ostringstream payload;
    payload << AP_DEFAULT_ALGO << AP_SEP << getPublicKey();
    if (!pw_reset_info.empty())
        payload << AP_SEP << B64Encode(
            pw_reset_info.c_str(), pw_reset_info.length());
    return createToken(AP_TAG_NEW_USER, payload.str());
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x48(%rsp), %r12
movq %r12, %rdi
callq 0x46fe80
leaq 0x1745e1(%rip), %rsi    # 0x57a760
movl $0x5, %edx
movq %r12, %rdi
callq 0x467730
leaq 0x8(%rsp), %rsi
movb $0x2e, (%rsi)
leaq 0x48(%rsp), %rdi
movl $0x1, %edx
callq 0x467730
movq %rax, %r12
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x406798
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0x467730
leaq 0x18(%rsp), %r13
movq -0x10(%r13), %rdi
cmpq %r13, %rdi
je 0x4061e0
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40ad30
cmpq $0x0, 0x8(%r15)
je 0x40623b
leaq 0x8(%rsp), %rsi
movb $0x2e, (%rsi)
leaq 0x48(%rsp), %rdi
movl $0x1, %edx
callq 0x467730
movq %rax, %r12
movq (%r15), %rsi
movq 0x8(%r15), %rdx
leaq 0x8(%rsp), %rdi
callq 0x409c00
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0x467730
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x40623b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40ad30
leaq 0x8(%rsp), %rdi
movq %r13, (%rdi)
leaq 0x19b87d(%rip), %rsi    # 0x5a1ac7
leaq 0x19b878(%rip), %rdx    # 0x5a1ac9
callq 0x40549e
leaq 0x50(%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0x46d870
leaq 0x8(%rsp), %rdx
leaq 0x28(%rsp), %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x405f44
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x406295
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40ad30
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x4062ac
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40ad30
movq $0x5e7bb8, %rsi         # imm = 0x5E7BB8
leaq 0x48(%rsp), %rdi
callq 0x470730
leaq 0xb8(%rsp), %rdi
callq 0x44af00
movq %rbx, %rax
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x406302
jmp 0x406335
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x406305
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40ad30
jmp 0x406305
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
jne 0x406324
jmp 0x406338
jmp 0x406335
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x406338
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40ad30
jmp 0x406338
jmp 0x406335
movq %rax, %rbx
movq $0x5e7bb8, %rsi         # imm = 0x5E7BB8
leaq 0x48(%rsp), %rdi
callq 0x470730
leaq 0xb8(%rsp), %rdi
callq 0x44af00
movq %rbx, %rdi
callq 0x4a9c80
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/client/APUser.cpp
// Function: APUser::changePassword[abi:cxx11](APUser const&)
const std::string APUser::changePassword(
    const APUser& new_key)
{
    std::string payload = new_key.getPublicKey();
    std::string token = createToken(AP_TAG_CHANGE_PASSWORD, payload);
    m_private_key = new_key.m_private_key;
    return token;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x28(%rsp), %rdi
movq %rdx, %rsi
callq 0x406798
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x174241(%rip), %rsi    # 0x57a769
leaq 0x17423c(%rip), %rdx    # 0x57a76b
leaq 0x8(%rsp), %rdi
callq 0x40549e
leaq 0x8(%rsp), %rdx
leaq 0x28(%rsp), %rcx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x405f44
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x406565
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40ad30
movq %r15, %rdi
movq %r14, %rsi
callq 0x4067ee
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x40658b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40ad30
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
movq (%rbx), %rdi
addq $0x10, %rbx
cmpq %rbx, %rdi
je 0x4065cd
movq (%rbx), %rsi
jmp 0x4065c0
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x4065cd
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x40ad30
jmp 0x4065cd
movq %rax, %r14
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4065e8
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x40ad30
movq %r14, %rdi
callq 0x4a9c80
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/client/APPrivateKey.cpp
// Function: APPrivateKey::signMessage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
std::string APPrivateKey::signMessage(const std::string& msg)
{
    unsigned char sig[SignatureSize];
    ed25519_SignMessage (sig, m_Key, &edp_signature_blinding,
        (const unsigned char*)msg.c_str(), msg.length());

    return B64Encode(sig, sizeof(sig));
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq (%rdx), %rcx
movq 0x8(%rdx), %r8
leaq 0x1e4a50(%rip), %rdx    # 0x5eb218
movq %rsp, %r14
movq %r14, %rdi
callq 0x4077df
movl $0x40, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x409c00
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/server/APVerifier.cpp
// Function: hex_string_to_u64(char const*, unsigned long&)
const char* hex_string_to_u64(const char* p, uint64_t& val)
{
    val = 0;
    do
    {
        int d = get_hex_digit(*p);
        if (d < 0) break;

        p++;
        val = (val << 4) + d;
    } while(1);
    return p;
}

// Assembly:
movq %rdi, %rax
movq $0x0, (%rsi)
xorl %ecx, %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movsbl (%rax), %edi
leal -0x30(%rdi), %r8d
cmpb $0x9, %r8b
ja 0x4068ee
addl $-0x30, %edi
jmp 0x40690b
leal -0x41(%rdi), %r8d
cmpb $0x5, %r8b
ja 0x4068fd
addl $-0x37, %edi
jmp 0x40690b
leal -0x61(%rdi), %r8d
addl $-0x57, %edi
cmpb $0x6, %r8b
cmovael %edx, %edi
testl %edi, %edi
js 0x40691f
incq %rax
shlq $0x4, %rcx
movl %edi, %r8d
addq %r8, %rcx
movq %rcx, (%rsi)
testl %edi, %edi
jns 0x4068dc
retq
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/server/APVerifier.cpp
// Function: APVerifier::ValidateToken(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long)
int APVerifier::ValidateToken(
    const std::string& token,
    size_t key_index)
{
    unsigned char sig[64];

    do
    {
        m_error = SplitToken(token);
        if (m_error != AP_SUCCESS) break;

        size_t nItems = m_items.size();

        // Last item is the signature in base64 format
        std::string& signature = m_items[nItems-1];
        if (B64Decode(signature, sig, sizeof(sig)) != sizeof(sig))
        {
            m_error = AP_E_B64_ITEM;
            break;
        }

        // If self-sined, key_index points to the public key
        if (key_index > 0)
        {
            if (key_index < 2 || key_index >= (nItems - 1))
            {
                m_error = AP_E_PARAMETER;
                break;
            }
            if (setKey(m_items[key_index]) != AP_SUCCESS) break;
        }

        m_error = m_public_key.verifySignature(
            (const unsigned char*)token.c_str(), 
            token.length() - signature.length(), 
            &sig[0]) ? 
            AP_SUCCESS : AP_E_SIGNATURE;

    } while(0);
    return m_error;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
callq 0x406924
movl %eax, 0x20(%rbx)
testl %eax, %eax
jne 0x406b51
movq 0x38(%rbx), %rax
movq 0x40(%rbx), %r13
subq %rax, %r13
sarq $0x5, %r13
decq %r13
movq %r13, %r12
shlq $0x5, %r12
addq %rax, %r12
movq %rsp, %rsi
movl $0x40, %edx
movq %r12, %rdi
callq 0x409d2a
movl $0xfffffff6, %ecx       # imm = 0xFFFFFFF6
cmpq $0x40, %rax
jne 0x406b4e
testq %r15, %r15
je 0x406b2d
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq $0x1, %r15
je 0x406b4e
cmpq %r15, %r13
jbe 0x406b4e
shlq $0x5, %r15
addq 0x38(%rbx), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x40686a
testl %eax, %eax
jne 0x406b51
movq (%r14), %rsi
movq 0x8(%r14), %rdx
subq 0x8(%r12), %rdx
movq %rsp, %rcx
movq %rbx, %rdi
callq 0x407066
movzbl %al, %eax
leal -0x8(,%rax,8), %ecx
movl %ecx, 0x20(%rbx)
movl 0x20(%rbx), %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/server/APVerifier.cpp
// Function: APVerifier::parseUserRegistrationToken(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool APVerifier::parseUserRegistrationToken(
    const std::string& token)
{
    m_error = SplitToken(token);
    if (m_error == AP_SUCCESS)
    {
        if (m_items.size() < 4)
            m_error = AP_E_FORMAT;
        else if (m_tag != AP_NEW_USER)
            m_error = AP_E_TOKEN;
        else if (m_items[2] != AP_DEFAULT_ALGO)
            m_error = AP_E_ALGO;
        else
            setKey(m_items[3]);
    }
    m_token_expiration_time = 0;
    return isValid();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x406924
movl %eax, 0x20(%rbx)
testl %eax, %eax
jne 0x406c11
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rax
subq %rdi, %rax
cmpq $0x7f, %rax
ja 0x406bd2
movl $0xfffffffe, 0x20(%rbx) # imm = 0xFFFFFFFE
jmp 0x406c11
cmpl $0x6e75, 0x24(%rbx)     # imm = 0x6E75
jne 0x406bf8
addq $0x40, %rdi
leaq 0x173b7a(%rip), %rsi    # 0x57a760
callq 0x479d70
testl %eax, %eax
je 0x406c01
movl $0xfffffffd, 0x20(%rbx) # imm = 0xFFFFFFFD
jmp 0x406c11
movl $0xfffffffc, 0x20(%rbx) # imm = 0xFFFFFFFC
jmp 0x406c11
movq 0x38(%rbx), %rsi
addq $0x60, %rsi
movq %rbx, %rdi
callq 0x40686a
movq $0x0, 0x30(%rbx)
cmpl $0x0, 0x20(%rbx)
setns %al
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/server/APVerifier.cpp
// Function: APVerifier::parseUserLoginToken(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool APVerifier::parseUserLoginToken(const std::string& token)
{
    do
    {
        if (ValidateToken(token) != AP_SUCCESS) break;

        if (m_tag != AP_USER_LOGIN)
        {
            m_error = AP_E_TOKEN;
            break;
        }

        // item(2) is token duration (in hex)
        uint64_t duration = 0;
        const char* p = hex_string_to_u64(m_items[2].c_str(), duration);
        if (*p != '\0' || duration > APV_MAX_LOGIN_DURATION)
        {
            m_error = AP_E_TIMESTAMP;
            break;
        }

        m_token_expiration_time = (uint64_t)time(NULL) + duration;

    } while(0);
    return isValid();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %edx, %edx
callq 0x406aa4
testl %eax, %eax
jne 0x406c91
cmpl $0x6c69, 0x24(%rbx)     # imm = 0x6C69
jne 0x406c7a
movq %rsp, %r14
movq $0x0, (%r14)
movq 0x38(%rbx), %rax
movq 0x40(%rax), %rdi
movq %r14, %rsi
callq 0x4068cb
cmpb $0x0, (%rax)
setne %al
movq (%r14), %r14
cmpq $0xe11, %r14            # imm = 0xE11
setae %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x406c83
movl $0xfffffffb, 0x20(%rbx) # imm = 0xFFFFFFFB
jmp 0x406c91
movl $0xfffffffc, 0x20(%rbx) # imm = 0xFFFFFFFC
jmp 0x406c91
xorl %edi, %edi
callq 0x52dae0
addq %r14, %rax
movq %rax, 0x30(%rbx)
cmpl $0x0, 0x20(%rbx)
setns %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/server/APVerifier.cpp
// Function: APVerifier::parseChangePasswordToken(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool APVerifier::parseChangePasswordToken(const std::string& token)
{
    if (ValidateToken(token) == AP_SUCCESS)
    {
        if (m_tag == AP_CHANGE_PASSWORD)
            setKey(getItem(2)); // Change public key
        else
            m_error = AP_E_TOKEN;
    }
    return isValid();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
xorl %edx, %edx
callq 0x406aa4
testl %eax, %eax
jne 0x406ce7
cmpl $0x6370, 0x24(%rbx)     # imm = 0x6370
jne 0x406ce0
movq 0x38(%rbx), %rax
movq 0x40(%rbx), %rcx
subq %rax, %rcx
addq $0x40, %rax
cmpq $0x41, %rcx
leaq 0x1e6aee(%rip), %rsi    # 0x5ed7c0
cmovaeq %rax, %rsi
movq %rbx, %rdi
callq 0x40686a
jmp 0x406ce7
movl $0xfffffffc, 0x20(%rbx) # imm = 0xFFFFFFFC
cmpl $0x0, 0x20(%rbx)
setns %al
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/common/curve25519/ed25519_sign.c
// Function: edp_AddBasePoint
void edp_AddBasePoint(Ext_POINT *p)
{
    U_WORD a[K_WORDS], b[K_WORDS], c[K_WORDS], d[K_WORDS], e[K_WORDS];

    ecp_SubReduce(a, p->y, p->x);           /* A = (Y1-X1)*(Y2-X2) */
    ecp_MulReduce(a, a, _w_base_folding8[1].YmX);
    ecp_AddReduce(b, p->y, p->x);           /* B = (Y1+X1)*(Y2+X2) */
    ecp_MulReduce(b, b, _w_base_folding8[1].YpX);
    ecp_MulReduce(c, p->t, _w_base_folding8[1].T2d); /* C = T1*2d*T2 */
    ecp_AddReduce(d, p->z, p->z);           /* D = 2*Z1 */
    ecp_SubReduce(e, b, a);                 /* E = B-A */
    ecp_AddReduce(b, b, a);                 /* H = B+A */
    ecp_SubReduce(a, d, c);                 /* F = D-C */
    ecp_AddReduce(d, d, c);                 /* G = D+C */

    ecp_MulReduce(p->x, e, a);              /* E*F */
    ecp_MulReduce(p->y, b, d);              /* H*G */
    ecp_MulReduce(p->t, e, b);              /* E*H */
    ecp_MulReduce(p->z, d, a);              /* G*F */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %r15
leaq 0x20(%rdi), %r14
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %r14, (%rsp)
movq %r15, %rdx
callq 0x409ff8
leaq 0x173793(%rip), %rdx    # 0x57a850
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x40a2f0
leaq 0x70(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x409f38
leaq 0x17374e(%rip), %rdx    # 0x57a830
movq %r12, %rdi
movq %r12, %rsi
callq 0x40a2f0
leaq 0x60(%r15), %rsi
movq %rsi, 0x8(%rsp)
leaq 0x173773(%rip), %rdx    # 0x57a870
leaq 0x50(%rsp), %r14
movq %r14, %rdi
callq 0x40a2f0
leaq 0x40(%r15), %rbp
leaq 0x30(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
movq %rbp, %rdx
callq 0x409f38
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x409ff8
movq %r12, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x409f38
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x409ff8
movq %r13, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x409f38
movq %r15, %rdi
leaq 0x10(%rsp), %r15
movq %r15, %rsi
movq %rbx, %rdx
callq 0x40a2f0
movq (%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x40a2f0
movq 0x8(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x40a2f0
movq %rbp, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x40a2f0
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/common/curve25519/ed25519_sign.c
// Function: edp_AddAffinePoint
void edp_AddAffinePoint(Ext_POINT *p, const PA_POINT *q)
{
    U_WORD a[K_WORDS], b[K_WORDS], c[K_WORDS], d[K_WORDS], e[K_WORDS];
    ecp_SubReduce(a, p->y, p->x);           /* A = (Y1-X1)*(Y2-X2) */
    ecp_MulReduce(a, a, q->YmX);
    ecp_AddReduce(b, p->y, p->x);           /* B = (Y1+X1)*(Y2+X2) */
    ecp_MulReduce(b, b, q->YpX);
    ecp_MulReduce(c, p->t, q->T2d);         /* C = T1*2d*T2 */
    ecp_AddReduce(d, p->z, p->z);           /* D = Z1*2*Z2 (Z2=1)*/
    ecp_SubReduce(e, b, a);                 /* E = B-A */
    ecp_AddReduce(b, b, a);                 /* H = B+A */
    ecp_SubReduce(a, d, c);                 /* F = D-C */
    ecp_AddReduce(d, d, c);                 /* G = D+C */

    ecp_MulReduce(p->x, e, a);              /* E*F */
    ecp_MulReduce(p->y, b, d);              /* H*G */
    ecp_MulReduce(p->t, e, b);              /* E*H */
    ecp_MulReduce(p->z, d, a);              /* G*F */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %r13
movq %rdi, %r15
leaq 0x20(%rdi), %r14
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %r14, (%rsp)
movq %r15, %rdx
callq 0x409ff8
leaq 0x20(%r13), %rdx
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x40a2f0
leaq 0x70(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x409f38
movq %r12, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x40a2f0
leaq 0x60(%r15), %rsi
movq %rsi, 0x8(%rsp)
addq $0x40, %r13
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %r13, %rdx
callq 0x40a2f0
leaq 0x40(%r15), %rbp
leaq 0x30(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
movq %rbp, %rdx
callq 0x409f38
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x409ff8
movq %r12, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x409f38
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x409ff8
movq %r13, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x409f38
movq %r15, %rdi
leaq 0x10(%rsp), %r15
movq %r15, %rsi
movq %rbx, %rdx
callq 0x40a2f0
movq (%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x40a2f0
movq 0x8(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x40a2f0
movq %rbp, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x40a2f0
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/common/curve25519/ed25519_sign.c
// Function: edp_DoublePoint
void edp_DoublePoint(Ext_POINT *p)
{
    U_WORD a[K_WORDS], b[K_WORDS], c[K_WORDS], d[K_WORDS], e[K_WORDS];

    ecp_SqrReduce(a, p->x);         /* A = X1^2 */
    ecp_SqrReduce(b, p->y);         /* B = Y1^2 */
    ecp_SqrReduce(c, p->z);         /* C = 2*Z1^2 */
    ecp_AddReduce(c, c, c);
    ecp_SubReduce(d, _w_maxP, a);   /* D = -A */

    ecp_SubReduce(a, d, b);         /* H = D-B */
    ecp_AddReduce(d, d, b);         /* G = D+B */
    ecp_SubReduce(b, d, c);         /* F = G-C */
    ecp_AddReduce(e, p->x, p->y);   /* E = (X1+Y1)^2-A-B = (X1+Y1)^2+H */
    ecp_SqrReduce(e, e);
    ecp_AddReduce(e, e, a);

    ecp_MulReduce(p->x, e, b);      /* E*F */
    ecp_MulReduce(p->y, a, d);      /* H*G */
    ecp_MulReduce(p->z, d, b);      /* G*F */
    ecp_MulReduce(p->t, e, a);      /* E*H */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %r14
leaq 0x90(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x40a578
leaq 0x20(%r14), %r12
leaq 0x70(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x40a578
leaq 0x40(%r14), %rsi
movq %rsi, 0x8(%rsp)
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
callq 0x40a578
movq %rbx, %rdi
movq %rbx, %rsi
movq %rbx, %rdx
callq 0x409f38
movq $0x580bf0, %rsi         # imm = 0x580BF0
leaq 0x30(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rdx
callq 0x409ff8
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x409ff8
movq %rbp, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x409f38
movq %r15, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x409ff8
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x409f38
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x40a578
movq %rbx, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x409f38
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x40a2f0
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x40a2f0
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x40a2f0
addq $0x60, %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x40a2f0
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/common/curve25519/ed25519_sign.c
// Function: edp_BasePointMult
void edp_BasePointMult(
    OUT Ext_POINT *S, 
    IN const U_WORD *sk, 
    IN const U_WORD *R)
{
    int i = 1;
    U8 cut[32];
    const PA_POINT *p0;

    ecp_8Folds(cut, sk);

    p0 = &_w_base_folding8[cut[0]];

    ecp_SubReduce(S->x, p0->YpX, p0->YmX);  /* 2x */
    ecp_AddReduce(S->y, p0->YpX, p0->YmX);  /* 2y */
    ecp_MulReduce(S->t, p0->T2d, _w_di);    /* 2xy */

    /* Randomize starting point */

    ecp_AddReduce(S->z, R, R);              /* Z = 2R */
    ecp_MulReduce(S->x, S->x, R);           /* X = 2xR */
    ecp_MulReduce(S->t, S->t, R);           /* T = 2xyR */
    ecp_MulReduce(S->y, S->y, R);           /* Y = 2yR */

    do 
    {
        edp_DoublePoint(S);
        edp_AddAffinePoint(S, &_w_base_folding8[cut[i]]);
    } while (i++ < 31);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r14
movq %rdi, %rbx
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x40acf2
movzbl (%r15), %eax
leaq (%rax,%rax,2), %r15
shll $0x5, %r15d
leaq 0x1733ae(%rip), %rbp    # 0x57a7d0
leaq (%r15,%rbp), %r12
leaq (%r15,%rbp), %r13
addq $0x20, %r13
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x409ff8
leaq 0x20(%rbx), %rdi
movq %rdi, 0x8(%rsp)
movq %r12, %rsi
movq %r13, %rdx
callq 0x409f38
leaq 0x60(%rbx), %r12
leaq (%r15,%rbp), %rsi
addq $0x40, %rsi
leaq 0x17334d(%rip), %rdx    # 0x57a7b0
movq %r12, %rdi
callq 0x40a2f0
leaq 0x40(%rbx), %rdi
movq %r14, %rsi
movq %r14, %rdx
callq 0x409f38
movq %rbx, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x40a2f0
movq %r12, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x40a2f0
movq 0x8(%rsp), %rdi
movq %rdi, %rsi
movq %r14, %rdx
callq 0x40a2f0
movl $0x1, %r14d
movq %rbx, %rdi
callq 0x4072d2
movzbl 0x10(%rsp,%r14), %eax
leaq (%rax,%rax,2), %rsi
shll $0x5, %esi
addq %rbp, %rsi
movq %rbx, %rdi
callq 0x4071ad
incq %r14
cmpq $0x20, %r14
jne 0x4074ac
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/common/curve25519/ed25519_sign.c
// Function: edp_BasePointMultiply
void edp_BasePointMultiply(
    OUT Affine_POINT *R, 
    IN const U_WORD *sk, 
    IN const void *blinding)
{
    Ext_POINT S;
    U_WORD t[K_WORDS];

    if (blinding)
    {
        eco_AddReduce(t, sk, ((EDP_BLINDING_CTX*)blinding)->bl);
        edp_BasePointMult(&S, t, ((EDP_BLINDING_CTX*)blinding)->zr);
        edp_AddPoint(&S, &S, &((EDP_BLINDING_CTX*)blinding)->BP);
    }
    else
    {
        edp_BasePointMult(&S, sk, edp_custom_blinding.zr);
    }

    ecp_Inverse(S.z, S.z);
    ecp_MulMod(R->x, S.x, S.z);
    ecp_MulMod(R->y, S.y, S.z);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
testq %rdx, %rdx
je 0x407533
movq %rdx, %r14
leaq 0x80(%rsp), %r15
movq %r15, %rdi
callq 0x40aae3
leaq 0x20(%r14), %rdx
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x4073ee
addq $0x40, %r14
movq %r12, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x407cb6
jmp 0x407546
movq $0x5eb2d8, %rdx         # imm = 0x5EB2D8
addq $0x20, %rdx
movq %rsp, %rdi
callq 0x4073ee
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movq %r14, %rsi
callq 0x40a63f
movq %rsp, %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x40a62d
addq $0x20, %rbx
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x40a62d
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/common/curve25519/ed25519_sign.c
// Function: edp_ExtPoint2PE
void edp_ExtPoint2PE(PE_POINT *r, const Ext_POINT *p)
{
    ecp_AddReduce(r->YpX, p->y, p->x);
    ecp_SubReduce(r->YmX, p->y, p->x);
    ecp_MulReduce(r->T2d, p->t, _w_2d);
    ecp_AddReduce(r->Z2, p->z, p->z);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x20(%rsi), %r15
movq %r15, %rsi
movq %rbx, %rdx
callq 0x409f38
leaq 0x20(%r14), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x409ff8
leaq 0x40(%r14), %rdi
leaq 0x60(%rbx), %rsi
leaq 0x1731d1(%rip), %rdx    # 0x57a790
callq 0x40a2f0
addq $0x60, %r14
addq $0x40, %rbx
movq %r14, %rdi
movq %rbx, %rsi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x409f38
// File: /workspace/github_cpp_makefile_star2_O1/msotoodeh[P]asymmetric-passwords/common/curve25519/ed25519_sign.c
// Function: ed25519_Blinding_Init
void *ed25519_Blinding_Init(
    void *context,                      /* IO: null or ptr blinding context */
    const unsigned char *seed,          /* IN: [size bytes] random blinding seed */
    size_t size)                        /* IN: size of blinding seed */
{
    struct {
        Ext_POINT T;
        U_WORD t[K_WORDS];
        SHA512_CTX H;
        U8 digest[SHA512_DIGEST_LENGTH];
    } d;

    EDP_BLINDING_CTX *ctx = (EDP_BLINDING_CTX*)context;

    if (ctx == 0)
    {
        ctx = (EDP_BLINDING_CTX*)mem_alloc(sizeof(EDP_BLINDING_CTX));
        if (ctx == 0) return 0;
    }

    /* Use edp_custom_blinding to protect generation of the new blinder */

    SHA512_Init(&d.H);
    SHA512_Update(&d.H, edp_custom_blinding.zr, 32);
    SHA512_Update(&d.H, seed, size);
    SHA512_Final(d.digest, &d.H);

    ecp_BytesToWords(ctx->zr, d.digest+32);
    ecp_BytesToWords(d.t, d.digest);
    eco_Mod(d.t);
    ecp_Sub(ctx->bl, _w_BPO, d.t);

    eco_AddReduce(d.t, d.t, edp_custom_blinding.bl);
    edp_BasePointMult(&d.T, d.t, edp_custom_blinding.zr);
    edp_AddPoint(&d.T, &d.T, &edp_custom_blinding.BP);

    edp_ExtPoint2PE(&ctx->BP, &d.T);

    /* clear potentially sensitive data */
    mem_clear (&d, sizeof(d));

    return ctx;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
testq %rdi, %rdi
jne 0x407614
movl $0xc0, %edi
callq 0x4e6a50
movq %rax, %rbx
testq %rax, %rax
je 0x407703
leaq 0xa0(%rsp), %rbp
movq %rbp, %rdi
callq 0x408338
movq $0x5eb2d8, %r14         # imm = 0x5EB2D8
leaq 0x20(%r14), %r15
movl $0x20, %edx
movq %rbp, %rdi
movq %r15, %rsi
callq 0x409b13
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x409b13
leaq 0x178(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
callq 0x4083c0
leaq 0x20(%rbx), %rdi
leaq 0x198(%rsp), %rsi
callq 0x40abdd
leaq 0x80(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x40abdd
movq %r13, %rdi
callq 0x40aaa3
movq $0x580c10, %rsi         # imm = 0x580C10
addq $0x20, %rsi
movq %rbx, %rdi
movq %r13, %rdx
callq 0x409e0d
movq %r13, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x40aae3
movq %rsp, %r12
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x4073ee
addq $0x40, %r14
movq %r12, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x407cb6
leaq 0x40(%rbx), %rdi
movq %r12, %rsi
callq 0x407587
movl $0x1b8, %edx            # imm = 0x1B8
movq %r12, %rdi
xorl %esi, %esi
callq 0x401060
movq %rbx, %rax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
jmp 0x4076ee