// File: /workspace/github_cpp_makefile_star2_O3/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 $0x128, %rsp            # imm = 0x128
movq %rdi, %rbx
leaq 0x10(%rdi), %r13
movq %r13, (%rdi)
leaq 0x26e36(%rip), %rsi     # 0x28060
leaq 0x26e37(%rip), %rdx     # 0x28068
callq 0xa834
xorl %ecx, %ecx
movl $0x1, %eax
xchgq %rbx, %rsi
cpuid
xchgq %rbx, %rsi
movl %ecx, %ebp
movl %ecx, %eax
notl %eax
movb $0x1, %r14b
testl $0x18000000, %eax       # imm = 0x18000000
jne 0x1262
xorl %ecx, %ecx
xgetbv
notl %eax
testb $0x6, %al
setne %r14b
btl $0x13, %ebp
jae 0x1353
movl $0x7, %eax
xorl %ecx, %ecx
xchgq %rbx, %r15
cpuid
xchgq %rbx, %r15
btl $0x1d, %r15d
jb 0x130e
leaq 0x1622f(%rip), %rax     # 0x174bc
movq %rax, 0x29de4(%rip)     # 0x2b078
leaq 0x3ac(%rip), %rax       # 0x1647
movq %rax, 0x29dde(%rip)     # 0x2b080
movq 0x8(%rbx), %rdx
leaq 0x26dcd(%rip), %rcx     # 0x2807a
movl $0xa, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1090
leaq 0x16e48(%rip), %rax     # 0x1810c
movq %rax, 0x29dd5(%rip)     # 0x2b0a0
leaq 0x26db3(%rip), %rsi     # 0x28085
movq %rbx, %rdi
callq 0x10c0
btl $0x1c, %ebp
setae %al
testb $0x20, %r15b
sete %cl
orb %al, %cl
orb %cl, %r14b
jne 0x1353
leaq 0x95d6(%rip), %rax      # 0xa8cc
movq %rax, 0x29dab(%rip)     # 0x2b0a8
leaq 0x26d8e(%rip), %rsi     # 0x28092
movq %rbx, %rdi
callq 0x10c0
jmp 0x1353
leaq 0x14daf(%rip), %rax     # 0x160c4
movq %rax, 0x29d5c(%rip)     # 0x2b078
leaq 0x1ce(%rip), %rax       # 0x14f1
movq %rax, 0x29d56(%rip)     # 0x2b080
leaq 0x15141(%rip), %rax     # 0x16472
movq %rax, 0x29d60(%rip)     # 0x2b098
movq 0x8(%rbx), %rdx
leaq 0x26d26(%rip), %rcx     # 0x28069
movl $0x10, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1090
leaq 0x27086(%rip), %rbp     # 0x283e0
xorl %r14d, %r14d
leaq 0x26ded(%rip), %r15     # 0x28151
leaq 0x20(%rsp), %r12
movaps 0x27320(%rip), %xmm0    # 0x28690
movaps %xmm0, 0x30(%rsp)
movaps 0x27304(%rip), %xmm0    # 0x28680
movaps %xmm0, 0x20(%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq *0x29ce8(%rip)          # 0x2b078
movdqu (%rbp), %xmm0
movdqu 0x10(%rbp), %xmm1
pcmpeqb 0x30(%rsp), %xmm1
pcmpeqb 0x20(%rsp), %xmm0
pand %xmm1, %xmm0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0x14b8
incq %r14
addq $0x20, %rbp
cmpq $0x9, %r14
jne 0x1369
leaq 0x26d84(%rip), %rsi     # 0x28151
movq %rsp, %rdi
callq *0x29caa(%rip)          # 0x2b080
movdqa (%rsp), %xmm0
movdqa 0x10(%rsp), %xmm1
pcmpeqb 0x26c37(%rip), %xmm1    # 0x28020
pcmpeqb 0x26c3f(%rip), %xmm0    # 0x28030
pand %xmm1, %xmm0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0x14b8
cmpq $0x0, 0x29c8c(%rip)     # 0x2b098
je 0x1439
leaq 0x26d3c(%rip), %rsi     # 0x28151
leaq 0x20(%rsp), %rdi
callq 0x16472
leaq 0x270da(%rip), %rsi     # 0x28500
leaq 0x20(%rsp), %rdi
movl $0x40, %edx
callq 0x1080
testl %eax, %eax
jne 0x14b8
cmpq $0x0, 0x29c5f(%rip)     # 0x2b0a0
je 0x146e
leaq 0x26d07(%rip), %rsi     # 0x28151
leaq 0x20(%rsp), %rdi
callq 0x1810c
leaq 0x270a5(%rip), %rsi     # 0x28500
leaq 0x20(%rsp), %rdi
movl $0x80, %edx
callq 0x1080
testl %eax, %eax
jne 0x14b8
cmpq $0x0, 0x29c32(%rip)     # 0x2b0a8
je 0x14a3
leaq 0x26cd2(%rip), %rsi     # 0x28151
leaq 0x20(%rsp), %rdi
callq 0xa8cc
leaq 0x27070(%rip), %rsi     # 0x28500
leaq 0x20(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
callq 0x1080
testl %eax, %eax
jne 0x14b8
movq %rbx, %rax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x26bdf(%rip), %rdi     # 0x2809e
leaq 0x26be3(%rip), %rsi     # 0x280a9
leaq 0x26bee(%rip), %rcx     # 0x280bb
movl $0x272, %edx            # imm = 0x272
callq 0x1040
jmp 0x14d9
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r13, %rdi
je 0x14e9
callq 0x1070
movq %r14, %rdi
callq 0x10a0