// File: /workspace/github_cpp_makefile_star2_O2/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 0x24e25(%rip), %rsi     # 0x26040
leaq 0x20(%rsp), %rdx
callq 0x1040
pushq $0x1
popq %rax
xorl %ecx, %ecx
xchgq %rbx, %rsi
cpuid
xchgq %rbx, %rsi
movl %ecx, %ebp
movl %ecx, %eax
notl %eax
movb $0x1, %r14b
testl $0x18000000, %eax       # imm = 0x18000000
jne 0x124f
xorl %ecx, %ecx
xgetbv
notl %eax
testb $0x6, %al
setne %r14b
btl $0x13, %ebp
jae 0x1322
pushq $0x7
popq %rax
xorl %ecx, %ecx
xchgq %rbx, %r15
cpuid
xchgq %rbx, %r15
btl $0x1d, %r15d
jb 0x12e9
leaq 0x14324(%rip), %rax     # 0x15598
movq %rax, 0x29dfd(%rip)     # 0x2b078
leaq 0x377(%rip), %rax       # 0x15f9
movq %rax, 0x29df7(%rip)     # 0x2b080
leaq 0x24dca(%rip), %rsi     # 0x2605a
movq %rbx, %rdi
callq 0x10c0
leaq 0x14f49(%rip), %rax     # 0x161e8
movq %rax, 0x29dfa(%rip)     # 0x2b0a0
leaq 0x24db8(%rip), %rsi     # 0x26065
movq %rbx, %rdi
callq 0x10b0
btl $0x1c, %ebp
setae %al
testb $0x20, %r15b
sete %cl
orb %al, %cl
orb %cl, %r14b
jne 0x1322
leaq 0x76c3(%rip), %rax      # 0x8994
movq %rax, 0x29dd0(%rip)     # 0x2b0a8
leaq 0x24d93(%rip), %rsi     # 0x26072
movq %rbx, %rdi
callq 0x10b0
jmp 0x1322
leaq 0x12ecc(%rip), %rax     # 0x141bc
movq %rax, 0x29d81(%rip)     # 0x2b078
leaq 0x1a3(%rip), %rax       # 0x14a1
movq %rax, 0x29d7b(%rip)     # 0x2b080
leaq 0x13241(%rip), %rax     # 0x1454d
movq %rax, 0x29d85(%rip)     # 0x2b098
leaq 0x24d2f(%rip), %rsi     # 0x26049
movq %rbx, %rdi
callq 0x10c0
leaq 0x25067(%rip), %r14     # 0x26390
leaq 0x40(%rsp), %r15
xorl %r12d, %r12d
leaq 0x24dc9(%rip), %r13     # 0x26101
leaq 0x20(%rsp), %rbp
cmpq $0x9, %r12
je 0x13a2
movaps 0x252f6(%rip), %xmm0    # 0x26640
movaps %xmm0, 0x30(%rsp)
movaps 0x252da(%rip), %xmm0    # 0x26630
movaps %xmm0, 0x20(%rsp)
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq *0x29d0e(%rip)          # 0x2b078
movq %rbp, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x892a
incq %r12
addq $0x20, %r14
testb %al, %al
jne 0x133d
leaq 0x24cf4(%rip), %rdi     # 0x2607e
leaq 0x24cf8(%rip), %rsi     # 0x26089
leaq 0x24d03(%rip), %rcx     # 0x2609b
movl $0x272, %edx            # imm = 0x272
callq 0x1070
leaq 0x24d58(%rip), %rsi     # 0x26101
movq %rsp, %rdi
callq *0x29cce(%rip)          # 0x2b080
leaq 0x20(%rsp), %rsi
leaq 0x250f2(%rip), %rdx     # 0x264b0
movq %rsp, %rdi
callq 0x8970
testb %al, %al
je 0x1383
cmpq $0x0, 0x29cc6(%rip)     # 0x2b098
je 0x13ff
leaq 0x24d26(%rip), %rsi     # 0x26101
leaq 0x20(%rsp), %rdi
callq 0x1454d
leaq 0x60(%rsp), %rsi
leaq 0x250bf(%rip), %rdx     # 0x264b0
leaq 0x20(%rsp), %rdi
callq 0x8970
testb %al, %al
je 0x1383
cmpq $0x0, 0x29c99(%rip)     # 0x2b0a0
je 0x143b
leaq 0x24cf1(%rip), %rsi     # 0x26101
leaq 0x20(%rsp), %rdi
callq 0x161e8
leaq 0xa0(%rsp), %rsi
leaq 0x25087(%rip), %rdx     # 0x264b0
leaq 0x20(%rsp), %rdi
callq 0x8970
testb %al, %al
je 0x1383
cmpq $0x0, 0x29c65(%rip)     # 0x2b0a8
je 0x1477
leaq 0x24cb5(%rip), %rsi     # 0x26101
leaq 0x20(%rsp), %rdi
callq 0x8994
leaq 0x120(%rsp), %rsi
leaq 0x2504b(%rip), %rdx     # 0x264b0
leaq 0x20(%rsp), %rdi
callq 0x8970
testb %al, %al
je 0x1383
movq %rbx, %rax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x148e
movq %rax, %r14
movq %rbx, %rdi
callq 0x1060
movq %r14, %rdi
callq 0x10a0