// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./src/helper.cpp
// Function: cc_smart_shorten(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, int)
string cc_smart_shorten(string& s, int limiter){
    //s = s.substr(0, limiter * 2);
    int nl_pos = s.find_first_of("<");
    s = s.substr(0, nl_pos);
    if(s.size() <= limiter) return s;

    string ret = s.substr(0, limiter);
    if(nl_pos <= limiter) return ret;

    for(int i = limiter; i < s.size(); ++i){
        if(i < s.size() - 3){
            if(s[i] == -17 && s[i+1] == -68 && s[i+2] == -116) break;
            if(s[i] == -29 && s[i+1] == -128 && s[i+2] == -126) break;
            if(s[i] == ',' || s[i] == '.') break;
        }
        ret += s[i];
    }

    return ret;
}

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0x60(%rsp)
movq %rdi, %rax
movq %rax, 0x68(%rsp)
movq %rdi, 0xc0(%rsp)
movq %rsi, 0xb8(%rsp)
movl %edx, 0xb4(%rsp)
movq 0xb8(%rsp), %rdi
leaq 0xb2072(%rip), %rsi     # 0xc3b9c
xorl %eax, %eax
movl %eax, %edx
callq 0xd870
movl %eax, 0xb0(%rsp)
movq 0xb8(%rsp), %rsi
movslq 0xb0(%rsp), %rcx
leaq 0x90(%rsp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0xdca0
movq 0xb8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0xd6f0
leaq 0x90(%rsp), %rdi
callq 0xdf50
movq 0xb8(%rsp), %rdi
callq 0xd410
movslq 0xb4(%rsp), %rcx
cmpq %rcx, %rax
ja 0x11bae
movq 0x60(%rsp), %rdi
movq 0xb8(%rsp), %rsi
callq 0xd1b0
jmp 0x11e5a
movq 0x60(%rsp), %rdi
movb $0x0, 0x8f(%rsp)
movq 0xb8(%rsp), %rsi
movslq 0xb4(%rsp), %rcx
xorl %eax, %eax
movl %eax, %edx
callq 0xdca0
movl 0xb0(%rsp), %eax
cmpl 0xb4(%rsp), %eax
jg 0x11bfc
movb $0x1, 0x8f(%rsp)
movl $0x1, 0x88(%rsp)
jmp 0x11e44
movl 0xb4(%rsp), %eax
movl %eax, 0x84(%rsp)
movslq 0x84(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0xb8(%rsp), %rdi
callq 0xd410
movq %rax, %rcx
movq 0x58(%rsp), %rax
cmpq %rcx, %rax
jae 0x11e31
movslq 0x84(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0xb8(%rsp), %rdi
callq 0xd410
movq %rax, %rcx
movq 0x50(%rsp), %rax
subq $0x3, %rcx
cmpq %rcx, %rax
jae 0x11de9
movq 0xb8(%rsp), %rdi
movslq 0x84(%rsp), %rsi
callq 0xde40
movq %rax, 0x48(%rsp)
jmp 0x11c80
movq 0x48(%rsp), %rax
movsbl (%rax), %eax
cmpl $-0x11, %eax
jne 0x11d0a
movq 0xb8(%rsp), %rdi
movl 0x84(%rsp), %eax
incl %eax
movslq %eax, %rsi
callq 0xde40
movq %rax, 0x40(%rsp)
jmp 0x11cad
movq 0x40(%rsp), %rax
movsbl (%rax), %eax
cmpl $-0x44, %eax
jne 0x11d0a
movq 0xb8(%rsp), %rdi
movl 0x84(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rsi
callq 0xde40
movq %rax, 0x38(%rsp)
jmp 0x11cdb
movq 0x38(%rsp), %rax
movsbl (%rax), %eax
cmpl $-0x74, %eax
jne 0x11d0a
jmp 0x11e31
movq 0x60(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
callq 0xdf50
jmp 0x11e67
movq 0xb8(%rsp), %rdi
movslq 0x84(%rsp), %rsi
callq 0xde40
movq %rax, 0x30(%rsp)
jmp 0x11d26
movq 0x30(%rsp), %rax
movsbl (%rax), %eax
cmpl $-0x1d, %eax
jne 0x11d93
movq 0xb8(%rsp), %rdi
movl 0x84(%rsp), %eax
incl %eax
movslq %eax, %rsi
callq 0xde40
movq %rax, 0x28(%rsp)
jmp 0x11d53
movq 0x28(%rsp), %rax
movsbl (%rax), %eax
cmpl $-0x80, %eax
jne 0x11d93
movq 0xb8(%rsp), %rdi
movl 0x84(%rsp), %eax
addl $0x2, %eax
movslq %eax, %rsi
callq 0xde40
movq %rax, 0x20(%rsp)
jmp 0x11d81
movq 0x20(%rsp), %rax
movsbl (%rax), %eax
cmpl $-0x7e, %eax
jne 0x11d93
jmp 0x11e31
movq 0xb8(%rsp), %rdi
movslq 0x84(%rsp), %rsi
callq 0xde40
movq %rax, 0x18(%rsp)
jmp 0x11daf
movq 0x18(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
je 0x11de5
movq 0xb8(%rsp), %rdi
movslq 0x84(%rsp), %rsi
callq 0xde40
movq %rax, 0x10(%rsp)
jmp 0x11dd8
movq 0x10(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
jne 0x11de7
jmp 0x11e31
jmp 0x11de9
movq 0xb8(%rsp), %rdi
movslq 0x84(%rsp), %rsi
callq 0xde40
movq %rax, 0x8(%rsp)
jmp 0x11e05
movq 0x60(%rsp), %rdi
movq 0x8(%rsp), %rax
movsbl (%rax), %esi
callq 0xd910
jmp 0x11e19
jmp 0x11e1b
movl 0x84(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x84(%rsp)
jmp 0x11c0a
movb $0x1, 0x8f(%rsp)
movl $0x1, 0x88(%rsp)
testb $0x1, 0x8f(%rsp)
jne 0x11e58
movq 0x60(%rsp), %rdi
callq 0xdf50
jmp 0x11e5a
movq 0x68(%rsp), %rax
addq $0xc8, %rsp
retq
movq 0x78(%rsp), %rdi
callq 0xd8a0
nopw %cs:(%rax,%rax)