// File: /workspace/github_cpp_makefile_star2_O2/yayuntian[P]user_agent/operatingSystem.cpp
// Function: getOSInfo(UserAgent&)
OSInfo getOSInfo(UserAgent& p) {

    string os = replace_first_copy(p.os, "like Mac OS X", "");
    os = replace_first_copy(os, "CPU", "");
    os = trim_copy_if(os, is_any_of(" "));

    vector<string> osSplit;
    split(osSplit, os, is_any_of(" "));

    if (os == "Windows XP x64 Edition") {
        osSplit = split_v(osSplit, 0, 1);
    }

    string name, version;
    osName(osSplit, name, version);

    if (contains(name, "/")) {
        int s = name.size();
        char buf[64] = {0,};
        if (s < 64) {
            strncpy(buf, name.c_str(), name.size());
            char *ver = NULL;
            char *ptr = strtok_r(buf, "/", &ver);
            remove_rchar(buf);
            name = buf;
            if (ptr) {
                version = ver;
            }
        }
    }
    version = replace_all_copy(version, "_", ".");

    return OSInfo {
        .FUllName = p.os,
        .Name = name,
        .Version = version
    };
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
addq $0x60, %r14
leaq 0x10ab9(%rip), %rdx     # 0x2f223
leaq 0xcc53(%rip), %r15      # 0x2b3c4
leaq 0x60(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x1ef0d
leaq 0x10aa6(%rip), %rdx     # 0x2f231
leaq 0x80(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rcx
callq 0x1ef6a
leaq 0x60(%rsp), %rdi
leaq 0x80(%rsp), %r15
movq %r15, %rsi
callq 0x7400
movq %r15, %rdi
callq 0x7748
leaq 0xd5a7(%rip), %rsi      # 0x2bd69
leaq 0xe0(%rsp), %rdi
callq 0x1ecf8
leaq 0x80(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
callq 0x1efc7
leaq 0x60(%rsp), %rdi
leaq 0x80(%rsp), %r15
movq %r15, %rsi
callq 0x7400
movq %r15, %rdi
callq 0x7748
leaq 0xe0(%rsp), %rdi
callq 0x1ed24
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
andq $0x0, 0x10(%rsp)
leaq 0xd542(%rip), %rsi      # 0x2bd69
leaq 0xc8(%rsp), %rdi
callq 0x1ecf8
movq %rsp, %rdi
leaq 0x60(%rsp), %rsi
leaq 0xc8(%rsp), %rdx
pushq $0x1
popq %rcx
callq 0x1ec74
leaq 0xc8(%rsp), %rdi
callq 0x1ed24
leaq 0x1092a(%rip), %rsi     # 0x2f18a
leaq 0x60(%rsp), %rdi
callq 0xb1d5
testb %al, %al
je 0x1e89e
leaq 0x80(%rsp), %rdi
movq %rsp, %rsi
pushq $0x1
popq %rcx
xorl %edx, %edx
callq 0x1e47e
movq %rsp, %rdi
leaq 0x80(%rsp), %r12
movq %r12, %rsi
callq 0x205a8
movq %r12, %rdi
callq 0xb230
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
movq %rsp, %rdi
leaq 0x18(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x1e505
leaq 0xd12f(%rip), %rsi      # 0x2ba08
leaq 0x18(%rsp), %rdi
callq 0x20909
testb %al, %al
je 0x1e983
movq 0x20(%rsp), %rdx
xorps %xmm0, %xmm0
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
cmpl $0x3f, %edx
jg 0x1e983
movq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x71d0
leaq 0x38(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0xd0d3(%rip), %rsi      # 0x2ba08
movq %r15, %rdi
callq 0x7680
movq %rax, %r12
movq %r15, %rdi
callq 0x7150
cltq
addq %r15, %rax
decq %rax
cmpb $0x5c, (%rax)
jne 0x1e95d
movb $0x0, (%rax)
decq %rax
jmp 0x1e950
leaq 0x18(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x7700
testq %r12, %r12
je 0x1e983
movq 0x38(%rsp), %rsi
leaq 0x40(%rsp), %rdi
callq 0x7700
leaq 0x108ab(%rip), %rdx     # 0x2f235
leaq 0xe5f4(%rip), %rcx      # 0x2cf85
leaq 0x80(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x1f07d
leaq 0x40(%rsp), %rdi
leaq 0x80(%rsp), %r15
movq %r15, %rsi
callq 0x7400
movq %r15, %rdi
callq 0x7748
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7490
leaq 0x20(%rbx), %r15
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x7490
leaq 0x40(%rbx), %rdi
leaq 0x40(%rsp), %rsi
callq 0x7490
leaq 0x40(%rsp), %rdi
callq 0x7748
leaq 0x18(%rsp), %rdi
callq 0x7748
movq %rsp, %rdi
callq 0xb230
leaq 0x60(%rsp), %rdi
callq 0x7748
movq %rbx, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x1ea72
jmp 0x1ea54
movq %rax, %r14
movq %r15, %rdi
callq 0x7748
jmp 0x1ea36
movq %rax, %r14
movq %rbx, %rdi
callq 0x7748
jmp 0x1ea75
jmp 0x1ea72
movq %rax, %r14
leaq 0xc8(%rsp), %rdi
callq 0x1ed24
jmp 0x1ea89
movq %rax, %r14
jmp 0x1ea89
movq %rax, %r14
leaq 0xe0(%rsp), %rdi
callq 0x1ed24
jmp 0x1ea91
jmp 0x1ea6d
movq %rax, %r14
jmp 0x1ea91
movq %rax, %r14
leaq 0x40(%rsp), %rdi
callq 0x7748
leaq 0x18(%rsp), %rdi
callq 0x7748
movq %rsp, %rdi
callq 0xb230
leaq 0x60(%rsp), %rdi
callq 0x7748
movq %r14, %rdi
callq 0x7640