// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/CommandLines.cpp
// Function: get_hic_enzymes(char*, enzyme**, int)
void get_hic_enzymes(char *argv, enzyme** x, int check_name)
{
    int i, k, pre_i, len = strlen(argv);
    (*x) = (enzyme*)calloc(1, sizeof(enzyme));
    if(len == 0)
    {
        (*x)->n = 0; (*x)->l = NULL; (*x)->a = NULL;
        return;
    }


    (*x)->n = 1;
    for (i = pre_i = 0; i < len; i++)
    {
        if(argv[i] == ',')
        {
            (*x)->n++;
            continue;
        } 
        
        if(check_name)
        {
            if(argv[i] != 'A' && argv[i] != 'C' && argv[i] != 'G' && argv[i] != 'T' &&
                argv[i] != 'a' && argv[i] != 'c' && argv[i] != 'g' && argv[i] != 't' && 
                argv[i] != 'N' && argv[i] != 'n')
            {
                (*x)->n = 0;
                (*x)->l = NULL;
                (*x)->a = NULL;
                return;
            }
        }
        
    }
    (*x)->l = (int*)calloc((*x)->n, sizeof(int));
    (*x)->a = (char**)calloc((*x)->n, sizeof(char*));

    for (i = pre_i = k = 0; i < len; i++)
    {
        if(argv[i] == ',')
        {
            (*x)->l[k] = i - pre_i;
            (*x)->a[k] = (char*)malloc(sizeof(char)*((*x)->l[k]+1));
            memcpy((*x)->a[k], argv + pre_i, (*x)->l[k]);
            (*x)->a[k][(*x)->l[k]] = '\0';
            pre_i = i + 1;
            k++;
        }
    }

    (*x)->l[k] = i - pre_i;
    (*x)->a[k] = (char*)malloc(sizeof(char)*((*x)->l[k]+1));
    memcpy((*x)->a[k], argv + pre_i, (*x)->l[k]);
    (*x)->a[k][(*x)->l[k]] = '\0';
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
callq 0x2090
movq %rax, %r15
movl $0x1, %r13d
movl $0x1, %edi
movl $0x18, %esi
callq 0x2120
movq %rax, (%rbx)
testl %r15d, %r15d
je 0x305d4
movq %rax, %r12
movl $0x1, 0x8(%rax)
jle 0x3049e
movl %r15d, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl $0x1, %ecx
xorl %edx, %edx
movabsq $0x8204500082045, %rsi  # imm = 0x8204500082045
movq 0x8(%rsp), %r8
movzbl (%r8,%rdx), %edi
cmpl $0x2c, %edi
jne 0x30479
incl %ecx
movl %ecx, 0x8(%r12)
jmp 0x30493
testl %ebp, %ebp
je 0x30493
addl $-0x41, %edi
cmpl $0x33, %edi
ja 0x305e3
btq %rdi, %rsi
jae 0x305e3
incq %rdx
cmpq %rdx, %rax
jne 0x30466
movslq %ecx, %r13
movl $0x4, %esi
movq %r13, %rdi
callq 0x2120
movq %rax, %rbp
movq %rax, (%r12)
movl $0x8, %esi
movq %r13, %rdi
callq 0x2120
movq %rax, 0x10(%r12)
testl %r15d, %r15d
jle 0x3057a
movq %r15, 0x10(%rsp)
movl %r15d, %r14d
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
xorl %ebp, %ebp
xorl %r12d, %r12d
xorl %r15d, %r15d
movq 0x8(%rsp), %r13
cmpb $0x2c, (%r13,%rbp)
jne 0x3055e
movl %ebp, %eax
subl %r12d, %eax
movq %rbx, %r13
movq (%rbx), %rbx
movq (%rbx), %rcx
movslq %r15d, %r15
movl %eax, (%rcx,%r15,4)
incl %eax
movslq %eax, %rdi
callq 0x2280
movq 0x10(%rbx), %rcx
movq %r13, %rbx
movq 0x8(%rsp), %r13
movq %rax, (%rcx,%r15,8)
movq (%rbx), %rax
movq (%rax), %rcx
movq 0x10(%rax), %rax
movq (%rax,%r15,8), %rdi
movslq %r12d, %rsi
addq %r13, %rsi
movslq (%rcx,%r15,4), %rdx
callq 0x2160
movq (%rbx), %rax
movq (%rax), %rcx
movq 0x10(%rax), %rax
movq (%rax,%r15,8), %rax
movslq (%rcx,%r15,4), %rcx
movb $0x0, (%rax,%rcx)
incq %rbp
incl %r15d
movl %ebp, %r12d
jmp 0x30561
incq %rbp
cmpq %r14, %rbp
jne 0x304e9
movq (%rbx), %rax
movq (%rax), %rbp
movq 0x10(%rax), %r13
movslq %r15d, %r15
movq 0x10(%rsp), %rax
jmp 0x30585
movq %rax, %r13
xorl %r15d, %r15d
xorl %r12d, %r12d
xorl %eax, %eax
subl %r12d, %eax
movl %eax, (%rbp,%r15,4)
incl %eax
movslq %eax, %rdi
callq 0x2280
movq %rax, (%r13,%r15,8)
movq (%rbx), %rax
movq (%rax), %rcx
movq 0x10(%rax), %rax
movq (%rax,%r15,8), %rdi
movslq %r12d, %rax
movq 0x8(%rsp), %rsi
addq %rax, %rsi
movslq (%rcx,%r15,4), %rdx
callq 0x2160
movq (%rbx), %rax
movq (%rax), %rcx
movq 0x10(%rax), %rax
movq (%rax,%r15,8), %rax
movslq (%rcx,%r15,4), %rcx
movb $0x0, (%rax,%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x0, 0x8(%r12)
jmp 0x305d4