// File: /workspace/github_cpp_makefile_star2_O3/lega911[P]ijson/src/exception.cpp
// Function: get_traceback(Buffer&)
void get_traceback(Buffer &r) {
        void *addr[32];
        char **names;

        int n = backtrace(addr, 32);
        names = backtrace_symbols(addr, n);
        if(!names) return;

        size_t funcsize = 256;
        char *func = (char*)malloc(funcsize);

        Buffer bname(256);
        for(int i = 1; i<n; i++) {
            Slice line(names[i]);
            Slice file = line.split_left('(');
            Slice _name = line.split_left('+');
            line = line.split_left(')');
            bname.set(_name);
            bname.add("\0", 1);

            int status;
	        char* ret = abi::__cxa_demangle(bname.ptr(), func, &funcsize, &status);
            if(status == 0) {
                func = ret;
                r.add(file);
                r.add(": ");
                r.add(func);
                r.add(" +");
                r.add(line);
            } else {
                r.add((char*)names[i]);
            }
            r.add("\n");
        }
        r.add("\0", 1);
        free(func);
        free(names);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rdi, %r15
leaq -0x180(%rbp), %rbx
movq %rbx, %rdi
movl $0x20, %esi
callq 0x8400
movl %eax, %r14d
movq %rbx, %rdi
movl %eax, %esi
callq 0x8410
movq %rax, -0x48(%rbp)
testq %rax, %rax
je 0xcf52
movq %r15, -0x30(%rbp)
movq $0x100, -0x78(%rbp)     # imm = 0x100
movl $0x100, %edi            # imm = 0x100
callq 0x83b0
movq %rax, %r15
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %rdi
movaps %xmm0, (%rdi)
movl $0x100, %esi            # imm = 0x100
callq 0xc596
cmpl $0x2, %r14d
jl 0xcf16
movl %r14d, %eax
movq %rax, -0x68(%rbp)
movl $0x1, %r12d
leaq -0x58(%rbp), %rbx
movq -0x48(%rbp), %rax
movq (%rax,%r12,8), %rdi
movl $0x0, -0x50(%rbp)
movq %rdi, -0x58(%rbp)
callq 0x8130
movl %eax, -0x50(%rbp)
movq %rbx, %rdi
movl $0x28, %esi
callq 0xd34e
movq %rax, -0x70(%rbp)
movl %edx, -0x5c(%rbp)
movq %rbx, %r14
movq %rbx, %rdi
movl $0x2b, %esi
callq 0xd34e
movq %rax, %r13
movl %edx, %ebx
movq %r14, %rdi
movl $0x29, %esi
callq 0xd34e
movq %rax, -0x58(%rbp)
movl %edx, -0x50(%rbp)
movl $0x0, -0x38(%rbp)
leaq -0x40(%rbp), %rdi
movq %r13, %rsi
movl %ebx, %edx
callq 0xc102
movl -0x38(%rbp), %esi
incl %esi
leaq -0x40(%rbp), %rdi
callq 0xc596
movq -0x40(%rbp), %rax
movslq -0x38(%rbp), %rcx
movb $0x0, (%rax,%rcx)
incl -0x38(%rbp)
movq -0x40(%rbp), %rdi
movq %r15, %rsi
leaq -0x78(%rbp), %rdx
leaq -0x60(%rbp), %rcx
callq 0x8280
movq %r14, %rbx
cmpl $0x0, -0x60(%rbp)
je 0xcea5
movq -0x48(%rbp), %rax
movq (%rax,%r12,8), %rsi
movq -0x30(%rbp), %rdi
callq 0xc44c
movq %r15, %r13
jmp 0xcef4
movq %rax, %r13
movq -0x30(%rbp), %rdi
movq -0x70(%rbp), %rsi
movl -0x5c(%rbp), %edx
callq 0xc102
movq -0x30(%rbp), %rdi
leaq 0xb550(%rip), %rsi      # 0x18413
callq 0xc44c
movq -0x30(%rbp), %rdi
movq %r13, %rsi
callq 0xc44c
movq -0x30(%rbp), %rdi
leaq 0xac3c(%rip), %rsi      # 0x17b1b
callq 0xc44c
movq -0x58(%rbp), %rsi
movl -0x50(%rbp), %edx
movq -0x30(%rbp), %rdi
callq 0xc102
movq -0x30(%rbp), %rdi
leaq 0xa7a0(%rip), %rsi      # 0x1769f
callq 0xc44c
incq %r12
movq %r13, %r15
cmpq %r12, -0x68(%rbp)
jne 0xcde8
jmp 0xcf19
movq %r15, %r13
movq -0x30(%rbp), %rbx
movl 0x8(%rbx), %esi
incl %esi
movq %rbx, %rdi
callq 0xc596
movq (%rbx), %rax
movslq 0x8(%rbx), %rcx
movb $0x0, (%rax,%rcx)
incl 0x8(%rbx)
movq %r13, %rdi
callq 0x8370
movq -0x48(%rbp), %rdi
callq 0x8370
leaq -0x40(%rbp), %rdi
callq 0xc56a
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xcf6c
jmp 0xcf6c
jmp 0xcf6c
jmp 0xcf6c
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0xc56a
movq %rbx, %rdi
callq 0x84a0