// File: /workspace/github_cpp_makefile_star2_O2/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, %r14
callq 0x2090
movq %rax, %r15
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x2120
movq %rbx, 0x8(%rsp)
movq %rax, (%rbx)
testl %r15d, %r15d
je 0x4392
movq %rax, %r12
movl $0x1, 0x8(%rax)
xorl %eax, %eax
testl %r15d, %r15d
cmovlel %eax, %r15d
pushq $0x1
popq %rcx
movabsq $0x8204500082045, %rdx  # imm = 0x8204500082045
cmpq %rax, %r15
je 0x427b
movzbl (%r14,%rax), %esi
cmpl $0x2c, %esi
jne 0x425c
incl %ecx
movl %ecx, 0x8(%r12)
jmp 0x4276
testl %ebp, %ebp
je 0x4276
addl $-0x41, %esi
cmpl $0x33, %esi
ja 0x43a1
btq %rsi, %rdx
jae 0x43a1
incq %rax
jmp 0x4244
movslq %ecx, %r13
pushq $0x4
popq %rsi
movq %r13, %rdi
callq 0x2120
movq %rax, (%r12)
pushq $0x8
popq %rsi
movq %r13, %rdi
callq 0x2120
movq %rax, 0x10(%r12)
xorl %ebp, %ebp
xorl %ebx, %ebx
xorl %eax, %eax
movl %ebx, %r13d
movslq %eax, %r12
cmpq %rbp, %r15
je 0x4337
cmpb $0x2c, (%r14,%rbp)
je 0x42be
incq %rbp
jmp 0x42a3
movl %ebp, %eax
subl %r12d, %eax
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
movq %rcx, 0x10(%rsp)
movq (%rcx), %rcx
movl %eax, (%rcx,%r13,4)
incl %eax
movslq %eax, %rdi
callq 0x2280
movq 0x10(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq %rax, (%rcx,%r13,8)
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rcx
movq 0x10(%rax), %rax
movq (%rax,%r13,8), %rdi
addq %r14, %r12
movslq (%rcx,%r13,4), %rdx
movq %r12, %rsi
callq 0x2160
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rcx
movq 0x10(%rax), %rax
movq (%rax,%r13,8), %rax
movslq (%rcx,%r13,4), %rcx
movb $0x0, (%rax,%rcx)
incq %rbp
incl %ebx
movl %ebp, %eax
jmp 0x42a3
subl %r12d, %r15d
movq 0x8(%rsp), %rbp
movq (%rbp), %rbx
movq (%rbx), %rax
movl %r15d, (%rax,%r13,4)
incl %r15d
movslq %r15d, %rdi
callq 0x2280
movq 0x10(%rbx), %rcx
movq %rax, (%rcx,%r13,8)
movq (%rbp), %rax
movq (%rax), %rcx
movq 0x10(%rax), %rax
movq (%rax,%r13,8), %rdi
addq %r12, %r14
movslq (%rcx,%r13,4), %rdx
movq %r14, %rsi
callq 0x2160
movq (%rbp), %rax
movq (%rax), %rcx
movq 0x10(%rax), %rax
movq (%rax,%r13,8), %rax
movslq (%rcx,%r13,4), %rcx
movb $0x0, (%rax,%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
andl $0x0, 0x8(%r12)
jmp 0x4392