// File: /workspace/github_cpp_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rsi, %r14
movq %rdi, %rbx
addq $0x60, %rsi
leaq 0x11d98(%rip), %rax     # 0x35243
movq %rax, 0x20(%rsp)
leaq 0x11d99(%rip), %rax     # 0x35250
movq %rax, 0x28(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0xdeee(%rip), %rcx      # 0x313c4
leaq 0xc0(%rsp), %r15
movq %r15, %rdi
movq %rcx, %rdx
callq 0x2574b
movq (%r15), %rcx
movq 0x8(%r15), %rax
leaq (%rcx,%rax), %rdx
testq %rax, %rax
je 0x235b8
decq %rax
leaq 0x11d4a(%rip), %rsi     # 0x35251
movq %rcx, %r8
xorl %edi, %edi
movb (%r8,%rdi), %r9b
cmpb (%rdi,%rsi), %r9b
jne 0x2352e
leaq 0x1(%rdi), %r9
cmpq %rdi, %rax
je 0x23528
cmpq $0x2, %rdi
movq %r9, %rdi
jne 0x2350c
leaq (%r8,%r9), %r15
jmp 0x23535
leaq (%r8,%rdi), %r15
movq %rdi, %r9
cmpq $0x3, %r9
je 0x23548
incq %r8
decq %rax
cmpq %rdx, %r8
jne 0x2350a
jmp 0x235b8
cmpq %r15, %r8
je 0x235b8
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
subq %rcx, %r8
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x63b0
leaq 0x20(%rsp), %rdi
movq 0x8(%rdi), %rsi
leaq 0xde3e(%rip), %rcx      # 0x313c4
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x63b0
leaq 0x20(%rsp), %rdi
movq 0x8(%rdi), %rsi
movq 0xc0(%rsp), %r8
addq 0xc8(%rsp), %r8
subq %r15, %r8
xorl %edx, %edx
movq %r15, %rcx
callq 0x63b0
jmp 0x235ce
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x20(%rsp), %rdi
movq %rcx, %rsi
callq 0xc5fa
leaq 0xc0(%rsp), %rdi
leaq 0x20(%rsp), %r15
movq %r15, %rsi
callq 0x6410
movq (%r15), %rdi
leaq 0x30(%rsp), %rbp
cmpq %rbp, %rdi
je 0x235fd
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6340
leaq 0xe73d(%rip), %r12      # 0x31d41
leaq 0x60(%rsp), %rsi
movq %r12, (%rsi)
leaq 0xe72f(%rip), %r13      # 0x31d42
movq %r13, 0x8(%rsi)
leaq 0xf8(%rsp), %rdi
callq 0x24216
leaq 0x20(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
leaq 0xf8(%rsp), %rdx
callq 0x24026
leaq 0xc0(%rsp), %rdi
leaq 0x20(%rsp), %r15
movq %r15, %rsi
callq 0x6410
movq (%r15), %rdi
cmpq %rbp, %rdi
je 0x23668
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6340
cmpq $0x11, 0x108(%rsp)
jb 0x23685
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0x23685
callq 0x6440
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movq $0x0, 0x90(%rsp)
leaq 0x20(%rsp), %rsi
movq %r12, (%rsi)
movq %r13, 0x8(%rsi)
leaq 0xe0(%rsp), %rdi
callq 0x24216
leaq 0x80(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
movl $0x1, %ecx
callq 0x23db7
cmpq $0x11, 0xf0(%rsp)
jb 0x236f4
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x236f4
callq 0x6440
leaq 0x11aaf(%rip), %rsi     # 0x351aa
leaq 0xc0(%rsp), %rdi
callq 0x60d0
testl %eax, %eax
jne 0x2377a
leaq 0x60(%rsp), %rdi
leaq 0x80(%rsp), %rsi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x22f12
movq 0x90(%rsp), %rax
leaq 0x60(%rsp), %r15
movaps (%r15), %xmm0
movq 0x10(%r15), %rcx
movq %rcx, 0x90(%rsp)
movaps 0x80(%rsp), %xmm1
movaps %xmm0, 0x80(%rsp)
leaq 0x20(%rsp), %rdi
movaps %xmm1, (%rdi)
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
movq $0x0, 0x10(%r15)
callq 0xd4b2
movq %r15, %rdi
callq 0xd4b2
leaq 0x70(%rsp), %rbp
movq %rbp, -0x10(%rbp)
xorl %eax, %eax
movq %rax, -0x8(%rbp)
movb %al, (%rbp)
leaq 0xb0(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rax, -0x8(%r12)
movb %al, (%r12)
leaq 0x80(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
callq 0x22f9c
movq 0x68(%rsp), %rdx
testq %rdx, %rdx
je 0x238cc
movq 0x60(%rsp), %rsi
xorl %eax, %eax
cmpb $0x2f, (%rsi,%rax)
je 0x237e4
incq %rax
cmpq %rax, %rdx
jne 0x237d1
jmp 0x238cc
xorl %eax, %eax
testb %al, %al
jne 0x238cc
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
cmpl $0x3f, %edx
jg 0x238cc
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x61d0
leaq 0x110(%rsp), %rdx
movq $0x0, (%rdx)
leaq 0xe1af(%rip), %rsi      # 0x319e0
movq %r15, %rdi
callq 0x6660
movq %rax, 0x18(%rsp)
movq %r15, %rdi
callq 0x6160
decl %eax
cltq
cmpb $0x5c, 0x20(%rsp,%rax)
jne 0x23865
addq %rsp, %rax
addq $0x20, %rax
movb $0x0, (%rax)
cmpb $0x5c, -0x1(%rax)
leaq -0x1(%rax), %rax
je 0x23858
leaq 0x60(%rsp), %rax
movq 0x8(%rax), %r13
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x6160
leaq 0x60(%rsp), %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %r15, %rcx
movq %rax, %r8
callq 0x6550
cmpq $0x0, 0x18(%rsp)
je 0x238cc
movq 0x110(%rsp), %r15
leaq 0xa0(%rsp), %rax
movq 0x8(%rax), %r13
movq %r15, %rdi
callq 0x6160
leaq 0xa0(%rsp), %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %r15, %rcx
movq %rax, %r8
callq 0x6550
leaq 0x11982(%rip), %rax     # 0x35255
movq %rax, 0x110(%rsp)
leaq 0x11974(%rip), %rax     # 0x35256
movq %rax, 0x118(%rsp)
movq 0xa0(%rsp), %rcx
movq 0xa8(%rsp), %rdx
leaq (%rcx,%rdx), %rax
testq %rdx, %rdx
je 0x23910
cmpb $0x5f, (%rcx)
je 0x23915
incq %rcx
decq %rdx
jne 0x23903
movq %rax, %rcx
jmp 0x23919
leaq 0x1(%rcx), %rax
leaq 0x128(%rsp), %r8
movq %rcx, (%r8)
movq %rax, 0x8(%r8)
movq 0x120(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x110(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0xf660(%rip), %rdx      # 0x32fa8
leaq 0xf65a(%rip), %rcx      # 0x32fa9
leaq 0x20(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x255cc
leaq 0xa0(%rsp), %rdi
leaq 0x20(%rsp), %r15
movq %r15, %rsi
callq 0x6410
movq (%r15), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x23990
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6340
leaq 0x10(%rbx), %r13
movq %r13, (%rbx)
movq 0x60(%r14), %rsi
movq 0x68(%r14), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0xc5fa
leaq 0x20(%rbx), %r15
leaq 0x30(%rbx), %r14
movq %r14, 0x20(%rbx)
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0xc5fa
leaq 0x40(%rbx), %rdi
leaq 0x50(%rbx), %rax
movq %rax, 0x40(%rbx)
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
addq %rsi, %rdx
callq 0xc5fa
movq 0xa0(%rsp), %rdi
cmpq %r12, %rdi
je 0x23a0c
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x6340
movq 0x60(%rsp), %rdi
cmpq %rbp, %rdi
je 0x23a23
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x6340
leaq 0x80(%rsp), %rdi
callq 0xd4b2
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x23a51
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x6340
movq %rbx, %rax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x23b27
jmp 0x23af5
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x23b6d
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6340
jmp 0x23b6d
jmp 0x23b20
movq %rax, 0x18(%rsp)
movq (%r15), %rdi
cmpq %r14, %rdi
je 0x23ab9
movq (%r14), %rsi
incq %rsi
callq 0x6340
jmp 0x23ab9
movq %rax, 0x18(%rsp)
movq (%rbx), %rdi
cmpq %r13, %rdi
je 0x23b2c
movq (%r13), %rsi
incq %rsi
callq 0x6340
jmp 0x23b2c
jmp 0x23b27
movq %rax, 0x18(%rsp)
cmpq $0x11, 0xf0(%rsp)
jb 0x23b60
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x23b60
callq 0x6440
jmp 0x23b60
movq %rax, 0x18(%rsp)
jmp 0x23b60
movq %rax, 0x18(%rsp)
cmpq $0x11, 0x108(%rsp)
jb 0x23b6d
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0x23b6d
callq 0x6440
jmp 0x23b6d
movq %rax, 0x18(%rsp)
jmp 0x23b6d
movq %rax, 0x18(%rsp)
movq 0xa0(%rsp), %rdi
cmpq %r12, %rdi
je 0x23b49
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x6340
movq 0x60(%rsp), %rdi
cmpq %rbp, %rdi
je 0x23b60
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x6340
leaq 0x80(%rsp), %rdi
callq 0xd4b2
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x23b8e
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x6340
movq 0x18(%rsp), %rdi
callq 0x6630