// File: /workspace/github_c_makefile_star2_O1/Cotix[P]cReddit/libreddit/token.c
// Function: redditParseEscCodesGeneric
static void *redditParseEscCodesGeneric (const void *text, int len, int wide)
{
    struct charParser parser;

    if (len == 0)
        return NULL;

    parser.wide = wide;
    parser.text = text;
    parser.cur = 0;
    parser.offset = 0;

    if (wide)
        parser.new_text = rmalloc((len + 1) * sizeof(wchar_t));
    else
        parser.new_text = rmalloc((len + 1) * sizeof(char));

    for (parser.cur = 0; parser.cur < len; parser.cur++)
        parseChar(&parser);

    if (wide)
        ((wchar_t*)(parser.new_text))[parser.offset] = L'\0';
    else
        ((char*)(parser.new_text))[parser.offset] = '\0';

    return parser.new_text;
}

// Assembly:
testl %esi, %esi
je 0x4fc1
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r15
movslq %esi, %rax
leaq 0x1(%rax), %rcx
testl %edx, %edx
leaq 0x4(,%rax,4), %rdi
cmoveq %rcx, %rdi
callq 0x3538
movq %rax, %rdx
xorl %r13d, %r13d
testl %ebp, %ebp
jle 0x4fb3
movdqa 0x14f9(%rip), %xmm0     # 0x6340
punpcklbw %xmm0, %xmm0    # xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
punpcklwd %xmm0, %xmm0    # xmm0 = xmm0[0,0,1,1,2,2,3,3]
movdqa %xmm0, 0x20(%rsp)
pshufd $0xf5, 0x1522(%rip), %xmm0 # xmm0 = mem[1,1,3,3]
movdqa %xmm0, 0x10(%rsp)
xorl %r12d, %r12d
movq %r15, 0x8(%rsp)
movslq %r13d, %rax
movsbl (%r15,%rax), %edi
cmpl $0x5c, %edi
jne 0x4eb0
movzbl 0x1(%r15,%rax), %ecx
incq %rax
cmpl $0x22, %ecx
je 0x4f80
cmpl $0x75, %ecx
je 0x4ee3
cmpl $0x6e, %ecx
jne 0x4fa3
movslq %r12d, %rcx
testl %ebx, %ebx
je 0x4f9c
movl $0xa, (%rdx,%rcx,4)
jmp 0x4fa0
movslq %r12d, %r14
testl %ebx, %ebx
je 0x4eda
movl %ebp, %r15d
movl %ebx, %ebp
movq %rdx, %rbx
callq 0x21d0
movq %rbx, %rdx
movl %ebp, %ebx
movl %r15d, %ebp
movq 0x8(%rsp), %r15
movl %eax, (%rdx,%r14,4)
jmp 0x4f78
movb %dil, (%rdx,%r14)
jmp 0x4f78
testl %ebx, %ebx
je 0x4f90
movd 0x1(%r15,%rax), %xmm0
punpcklbw %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7]
punpcklbw %xmm0, %xmm0    # xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
punpcklwd %xmm0, %xmm0    # xmm0 = xmm0[0,0,1,1,2,2,3,3]
movdqa 0x20(%rsp), %xmm2
pcmpgtb %xmm0, %xmm2
punpcklwd %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
psrad $0x18, %xmm0
movdqa %xmm0, %xmm1
paddd 0x1433(%rip), %xmm1     # 0x6350
pand 0x143b(%rip), %xmm0     # 0x6360
paddd 0x1443(%rip), %xmm0     # 0x6370
pand %xmm2, %xmm1
pandn %xmm0, %xmm2
por %xmm1, %xmm2
pshufd $0xf5, %xmm2, %xmm0     # xmm0 = xmm2[1,1,3,3]
pmuludq 0x143a(%rip), %xmm2     # 0x6380
pshufd $0xe8, %xmm2, %xmm1     # xmm1 = xmm2[0,2,2,3]
pmuludq 0x10(%rsp), %xmm0
pshufd $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3]
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
pshufd $0xee, %xmm1, %xmm0     # xmm0 = xmm1[2,3,2,3]
por %xmm1, %xmm0
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
por %xmm0, %xmm1
addl $0x5, %r13d
movslq %r12d, %rax
movd %xmm1, (%rdx,%rax,4)
incl %r12d
movl %r13d, %eax
jmp 0x4fa3
movslq %r12d, %rcx
testl %ebx, %ebx
je 0x4f96
movl $0x22, (%rdx,%rcx,4)
jmp 0x4fa0
addl $0x5, %r13d
jmp 0x4f7b
movb $0x22, (%rdx,%rcx)
jmp 0x4fa0
movb $0xa, (%rdx,%rcx)
incl %r12d
incl %eax
movl %eax, %r13d
cmpl %ebp, %eax
jl 0x4e6c
movslq %r12d, %r13
testl %ebx, %ebx
je 0x4fc5
movl $0x0, (%rdx,%r13,4)
jmp 0x4fca
xorl %edx, %edx
jmp 0x4fd8
movb $0x0, (%rdx,%r13)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
movq %rdx, %rax
retq