// File: /workspace/github_cpp_makefile_star2_O1/theuni[P]libutreexo/crypto/sha256.cpp
// Function: SHA256AutoDetect[abi:cxx11]()
std::string SHA256AutoDetect()
{
    std::string ret = "standard";
#if defined(USE_ASM) && defined(HAVE_GETCPUID)
    bool have_sse4 = false;
    bool have_xsave = false;
    bool have_avx = false;
    bool have_avx2 = false;
    bool have_shani = false;
    bool enabled_avx = false;

    (void)AVXEnabled;
    (void)have_sse4;
    (void)have_avx;
    (void)have_xsave;
    (void)have_avx2;
    (void)have_shani;
    (void)enabled_avx;

    uint32_t eax, ebx, ecx, edx;
    GetCPUID(1, 0, eax, ebx, ecx, edx);
    have_sse4 = (ecx >> 19) & 1;
    have_xsave = (ecx >> 27) & 1;
    have_avx = (ecx >> 28) & 1;
    if (have_xsave && have_avx) {
        enabled_avx = AVXEnabled();
    }
    if (have_sse4) {
        GetCPUID(7, 0, eax, ebx, ecx, edx);
        have_avx2 = (ebx >> 5) & 1;
        have_shani = (ebx >> 29) & 1;
    }

#if defined(ENABLE_SHANI) && !defined(BUILD_BITCOIN_INTERNAL)
    if (have_shani) {
        Transform = sha256_shani::Transform;
        TransformD64 = TransformD64Wrapper<sha256_shani::Transform>;
        TransformD64_2way = sha256d64_shani::Transform_2way;
        ret = "shani(1way,2way)";
        have_sse4 = false; // Disable SSE4/AVX2;
        have_avx2 = false;
    }
#endif

    if (have_sse4) {
#if defined(__x86_64__) || defined(__amd64__)
        Transform = sha256_sse4::Transform;
        TransformD64 = TransformD64Wrapper<sha256_sse4::Transform>;
        ret = "sse4(1way)";
#endif
#if defined(ENABLE_SSE41) && !defined(BUILD_BITCOIN_INTERNAL)
        TransformD64_4way = sha256d64_sse41::Transform_4way;
        ret += ",sse41(4way)";
#endif
    }

#if defined(ENABLE_AVX2) && !defined(BUILD_BITCOIN_INTERNAL)
    if (have_avx2 && have_avx && enabled_avx) {
        TransformD64_8way = sha256d64_avx2::Transform_8way;
        ret += ",avx2(8way)";
    }
#endif
#endif

    assert(SelfTest());
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, 0x8(%rsp)
movq %rax, (%rdi)
leaq 0x26e31(%rip), %rsi     # 0x28060
leaq 0x26e32(%rip), %rdx     # 0x28068
callq 0xa86c
xorl %ecx, %ecx
movl $0x1, %eax
xchgq %rbx, %rsi
cpuid
xchgq %rbx, %rsi
movl %ecx, %ebp
movl %ecx, %r15d
shrl $0x13, %r15d
movl %ecx, %eax
notl %eax
movb $0x1, %r14b
testl $0x18000000, %eax       # imm = 0x18000000
jne 0x126e
xorl %ecx, %ecx
xgetbv
notl %eax
testb $0x6, %al
setne %r14b
andl $0x1, %r15d
xorl %r12d, %r12d
btl $0x13, %ebp
movl $0x0, %esi
jae 0x129c
movl $0x7, %eax
xorl %ecx, %ecx
xchgq %rbx, %rsi
cpuid
xchgq %rbx, %rsi
movl %esi, %r12d
shrb $0x5, %r12b
shrl $0x1d, %esi
andl $0x1, %esi
testb %sil, %sil
je 0x12ec
leaq 0x14d3c(%rip), %rax     # 0x15fe4
movq %rax, 0x29dc9(%rip)     # 0x2b078
leaq 0x27d(%rip), %rax       # 0x1533
movq %rax, 0x29dc3(%rip)     # 0x2b080
leaq 0x150ce(%rip), %rax     # 0x16392
movq %rax, 0x29dcd(%rip)     # 0x2b098
movq 0x8(%rbx), %rdx
xorl %r15d, %r15d
leaq 0x26d90(%rip), %rcx     # 0x28069
movl $0x10, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1090
xorl %r12d, %r12d
testb %r15b, %r15b
je 0x1345
leaq 0x160e4(%rip), %rax     # 0x173dc
movq %rax, 0x29d79(%rip)     # 0x2b078
leaq 0x37e(%rip), %rax       # 0x1684
movq %rax, 0x29d73(%rip)     # 0x2b080
movq 0x8(%rbx), %rdx
leaq 0x26d62(%rip), %rcx     # 0x2807a
movl $0xa, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1090
leaq 0x16cfd(%rip), %rax     # 0x1802c
movq %rax, 0x29d6a(%rip)     # 0x2b0a0
leaq 0x26d48(%rip), %rsi     # 0x28085
movq %rbx, %rdi
callq 0x10c0
btl $0x1c, %ebp
setae %al
notb %r12b
orb %r12b, %r14b
orb %al, %r14b
testb $0x1, %r14b
jne 0x1378
leaq 0x959a(%rip), %rax      # 0xa8fc
movq %rax, 0x29d3f(%rip)     # 0x2b0a8
leaq 0x26d22(%rip), %rsi     # 0x28092
movq %rbx, %rdi
callq 0x10c0
leaq 0x27061(%rip), %rbp     # 0x283e0
xorl %r13d, %r13d
leaq 0x26dc8(%rip), %r14     # 0x28151
leaq 0x30(%rsp), %r15
xorl %r12d, %r12d
movaps 0x272f8(%rip), %xmm0    # 0x28690
movaps %xmm0, 0x40(%rsp)
movaps 0x272dc(%rip), %xmm0    # 0x28680
movaps %xmm0, 0x30(%rsp)
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq *0x29cc0(%rip)          # 0x2b078
movdqu (%rbp), %xmm0
movdqu 0x10(%rbp), %xmm1
pcmpeqb 0x40(%rsp), %xmm1
pcmpeqb 0x30(%rsp), %xmm0
pand %xmm1, %xmm0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0x13f9
cmpq $0x8, %r12
leaq 0x1(%r12), %rax
setae %r13b
addq $0x20, %rbp
movq %rax, %r12
cmpq $0x9, %rax
jne 0x1391
jmp 0x1403
testb $0x1, %r13b
je 0x14f8
leaq 0x26d47(%rip), %rsi     # 0x28151
leaq 0x10(%rsp), %rdi
callq *0x29c6b(%rip)          # 0x2b080
movdqa 0x10(%rsp), %xmm0
movdqa 0x20(%rsp), %xmm1
pcmpeqb 0x26bf7(%rip), %xmm1    # 0x28020
pcmpeqb 0x26bff(%rip), %xmm0    # 0x28030
pand %xmm1, %xmm0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0x14f8
cmpq $0x0, 0x29c4c(%rip)     # 0x2b098
je 0x1479
leaq 0x26cfc(%rip), %rsi     # 0x28151
leaq 0x30(%rsp), %rdi
callq 0x16392
leaq 0x2709a(%rip), %rsi     # 0x28500
leaq 0x30(%rsp), %rdi
movl $0x40, %edx
callq 0x1080
testl %eax, %eax
jne 0x14f8
cmpq $0x0, 0x29c1f(%rip)     # 0x2b0a0
je 0x14ae
leaq 0x26cc7(%rip), %rsi     # 0x28151
leaq 0x30(%rsp), %rdi
callq 0x1802c
leaq 0x27065(%rip), %rsi     # 0x28500
leaq 0x30(%rsp), %rdi
movl $0x80, %edx
callq 0x1080
testl %eax, %eax
jne 0x14f8
cmpq $0x0, 0x29bf2(%rip)     # 0x2b0a8
je 0x14e3
leaq 0x26c92(%rip), %rsi     # 0x28151
leaq 0x30(%rsp), %rdi
callq 0xa8fc
leaq 0x27030(%rip), %rsi     # 0x28500
leaq 0x30(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
callq 0x1080
testl %eax, %eax
jne 0x14f8
movq %rbx, %rax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x26b9f(%rip), %rdi     # 0x2809e
leaq 0x26ba3(%rip), %rsi     # 0x280a9
leaq 0x26bae(%rip), %rcx     # 0x280bb
movl $0x272, %edx            # imm = 0x272
callq 0x1040
jmp 0x1519
movq %rax, %r14
movq (%rbx), %rdi
cmpq 0x8(%rsp), %rdi
je 0x152b
callq 0x1070
movq %r14, %rdi
callq 0x10a0