// File: travisdowns[P]avx-turbo/cpuid.cpp
// Function: get_brand_string[abi:cxx11]()
std::string get_brand_string() {
    auto check = cpuid(0x80000000);
    if (check.eax < 0x80000004) {
        return std::string("unkown (eax =") + std::to_string(check.eax) +")";
    }
    std::string ret;
    for (uint32_t eax : {0x80000002, 0x80000003, 0x80000004}) {
        char buf[17];
        auto fourchars = cpuid(eax);
        memcpy(buf +  0, &fourchars.eax, 4);
        memcpy(buf +  4, &fourchars.ebx, 4);
        memcpy(buf +  8, &fourchars.ecx, 4);
        memcpy(buf + 12, &fourchars.edx, 4);
        buf[16] = '\0';
        ret += buf;
    }
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x110(%rbp)
movq %rdi, %rax
movq %rax, -0x108(%rbp)
movq %rdi, -0x8(%rbp)
movl $0x80000000, %edi       # imm = 0x80000000
callq 0x36530
movq %rax, -0x18(%rbp)
movq %rdx, -0x10(%rbp)
cmpl $0x80000004, -0x18(%rbp) # imm = 0x80000004
jae 0x36876
leaq -0x59(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x77c0
movq -0x118(%rbp), %rdx
leaq 0xb70d(%rip), %rsi      # 0x41eaa
leaq -0x58(%rbp), %rdi
callq 0x7630
jmp 0x367a8
movl -0x18(%rbp), %esi
leaq -0x90(%rbp), %rdi
callq 0x36b00
jmp 0x367b9
leaq -0x38(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq 0x24700
jmp 0x367cf
movq -0x110(%rbp), %rdi
leaq 0xaccc(%rip), %rdx      # 0x414a9
leaq -0x38(%rbp), %rsi
callq 0x11470
jmp 0x367e8
leaq -0x38(%rbp), %rdi
callq 0x7290
leaq -0x90(%rbp), %rdi
callq 0x7290
leaq -0x58(%rbp), %rdi
callq 0x7290
leaq -0x59(%rbp), %rdi
callq 0x74d0
jmp 0x369cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x36868
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x3685f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x36853
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x7290
leaq -0x90(%rbp), %rdi
callq 0x7290
leaq -0x58(%rbp), %rdi
callq 0x7290
leaq -0x59(%rbp), %rdi
callq 0x74d0
jmp 0x369dd
movq -0x110(%rbp), %rdi
movb $0x0, -0x91(%rbp)
callq 0x7650
movl $0x80000002, -0xbc(%rbp) # imm = 0x80000002
movl $0x80000003, -0xb8(%rbp) # imm = 0x80000003
movl $0x80000004, -0xb4(%rbp) # imm = 0x80000004
leaq -0xbc(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq $0x3, -0xa8(%rbp)
leaq -0xb0(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rdi
callq 0x36be0
movq %rax, -0xc8(%rbp)
movq -0xa0(%rbp), %rdi
callq 0x36c00
movq %rax, -0xd0(%rbp)
movq -0xc8(%rbp), %rax
cmpq -0xd0(%rbp), %rax
je 0x369af
movq -0xc8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xd4(%rbp)
movl -0xd4(%rbp), %edi
callq 0x36530
movq -0x110(%rbp), %rdi
movq %rax, -0x100(%rbp)
movq %rdx, -0xf8(%rbp)
movl -0x100(%rbp), %eax
movl %eax, -0xf0(%rbp)
movl -0xfc(%rbp), %eax
movl %eax, -0xec(%rbp)
movl -0xf8(%rbp), %eax
movl %eax, -0xe8(%rbp)
movl -0xf4(%rbp), %eax
movl %eax, -0xe4(%rbp)
movb $0x0, -0xe0(%rbp)
leaq -0xf0(%rbp), %rsi
callq 0x7450
jmp 0x3697c
jmp 0x3697e
movq -0xc8(%rbp), %rax
addq $0x4, %rax
movq %rax, -0xc8(%rbp)
jmp 0x368f4
movq -0x110(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
callq 0x7290
jmp 0x369dd
movb $0x1, -0x91(%rbp)
testb $0x1, -0x91(%rbp)
jne 0x369cb
movq -0x110(%rbp), %rdi
callq 0x7290
jmp 0x369cd
movq -0x108(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x77b0
nopw %cs:(%rax,%rax)