LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/parser.c
// Function: parse_file
void
parse_file(char *file_name) {

	char line[256];
	char** tokens = NULL;
	size_t token_cnt = 0;

	FILE *fptr = fopen(file_name, "r");
	
	if (!fptr) {
	
		printf("Error : Could not open log file %s, errno = %d\n",
				file_name, errno);
		return;
	}

	memset(line, 0, sizeof(line));

	cmd_recording_enabled = false;
	reset_serialize_buffer(tlv_buff);

	while (fgets(line, sizeof(line) - 1, fptr)) {

		printf("Executing : %s", line);
	
		tokens = tokenizer(line, ' ', &token_cnt);		

		reset_serialize_buffer(tlv_buff);
		build_tlv_buffer(tokens, token_cnt);
		re_init_tokens(MAX_CMD_TREE_DEPTH);

		if (is_user_in_cmd_mode())
			restore_checkpoint_serialize_buffer(tlv_buff);
		else
			reset_serialize_buffer(tlv_buff);

		memset(line, 0, sizeof(line));
	}
	
	fclose(fptr);
	place_console(1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, %r14
andq $0x0, 0x8(%rsp)
leaq 0x3914(%rip), %rsi      # 0x759c
callq 0x1200
testq %rax, %rax
je 0x3d73
movq %rax, %rbx
leaq 0x10(%rsp), %r14
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
xorl %esi, %esi
callq 0x1100
movb $0x1, 0xda00(%rip)      # 0x116b4
leaq 0xa7a5(%rip), %rbp      # 0xe460
movq (%rbp), %rdi
callq 0x45de
leaq 0x8(%rsp), %r12
pushq $0x10
popq %r13
movq %r14, %rdi
movl $0xff, %esi
movq %rbx, %rdx
callq 0x1130
testq %rax, %rax
je 0x3d51
leaq 0x3e38(%rip), %rdi      # 0x7b21
movq %r14, %rsi
xorl %eax, %eax
callq 0x10e0
movq %r14, %rdi
pushq $0x20
popq %rsi
movq %r12, %rdx
callq 0x46c6
movq %rax, %r15
movq (%rbp), %rdi
callq 0x45de
movq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x36f4
movl %r13d, %edi
callq 0x4627
xorl %eax, %eax
callq 0x1c2c
movq (%rbp), %rdi
testl %eax, %eax
je 0x3d38
callq 0x4024
jmp 0x3d3d
callq 0x45de
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
xorl %esi, %esi
callq 0x1100
jmp 0x3ccd
movq %rbx, %rdi
callq 0x1090
pushq $0x1
popq %rdi
callq 0x30f0
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1050
movl (%rax), %edx
leaq 0x3d70(%rip), %rdi      # 0x7af1
movq %r14, %rsi
xorl %eax, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10e0
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/serialize.c
// Function: init_serialized_buffer
void 
init_serialized_buffer(ser_buff_t **b){
    (*b) = (ser_buff_t *)calloc(1, sizeof(ser_buff_t));
    (*b)->b = calloc(1, SERIALIZE_BUFFER_DEFAULT_SIZE);
    (*b)->size = SERIALIZE_BUFFER_DEFAULT_SIZE;
    (*b)->next = 0;
    (*b)->checkpoint = 0;
    return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
pushq $0x1
popq %r14
pushq $0x18
popq %rsi
movq %r14, %rdi
callq 0x1140
movq %rax, %r15
movq %rax, (%rbx)
movl $0x200, %esi            # imm = 0x200
movq %r14, %rdi
callq 0x1140
movq %rax, (%r15)
movl $0x200, 0x8(%r15)       # imm = 0x200
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/serialize.c
// Function: init_serialized_buffer_of_defined_size
void
init_serialized_buffer_of_defined_size(ser_buff_t **b, int size){
    (*b) = (ser_buff_t *)calloc(1, sizeof(ser_buff_t));
    (*b)->b = calloc(1, size);
    (*b)->size = size;
    (*b)->next = 0;
    (*b)->checkpoint = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
pushq $0x1
popq %r15
pushq $0x18
popq %rsi
movq %r15, %rdi
callq 0x1140
movq %rax, %r12
movq %rax, (%r14)
movslq %ebx, %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1140
movq %rax, (%r12)
movl %ebx, 0x8(%r12)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/serialize.c
// Function: serialize_buffer_skip
void
serialize_buffer_skip(ser_buff_t *b, int size){
	int available_size = b->size - b->next;

	if(available_size >= size){
		b->next += size;
		return;
	}

	while(available_size < size){
		b->size = b->size * 2;
		available_size = b->size - b->next;
	}	

	b->b = realloc(b->b, b->size);	
	b->next += size;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movl 0x8(%rdi), %ecx
movl 0xc(%rdi), %eax
movl %ecx, %edx
subl %eax, %edx
cmpl %esi, %edx
jge 0x4018
cmpl %ebp, %edx
jge 0x4007
addl %ecx, %ecx
movl %ecx, 0x8(%rbx)
movl %ecx, %edx
subl %eax, %edx
jmp 0x3ff8
movq (%rbx), %rdi
movslq %ecx, %rsi
callq 0x11e0
movq %rax, (%rbx)
movl 0xc(%rbx), %eax
addl %ebp, %eax
movl %eax, 0xc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/serialize.c
// Function: serialize_int
void serialize_int(ser_buff_t *b, int data){
    if (b == NULL) assert(0);
    ser_buff_t *buff = (ser_buff_t *)(b);
    int available_size = buff->size - buff->next;
    char isResize = 0;

    while(available_size < sizeof(int)){
        buff->size = buff->size * 2;
        available_size = buff->size - buff->next;
        isResize = 1;
    }

    if(isResize == 0){
        memcpy((char *)buff->b + buff->next, &data, sizeof(int));
        buff->next += sizeof(int);
        return;
    }

    // resize of the buffer
    buff->b = realloc(buff->b, buff->size); 
    memcpy((char *)buff->b + buff->next, &data, sizeof(int));
    buff->next += sizeof(int);
    return;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x40d3
movl %esi, %ebp
movq %rdi, %rbx
movl 0x8(%rdi), %eax
movslq 0xc(%rdi), %rcx
movb $0x1, %dl
movl %eax, %esi
subl %ecx, %esi
cmpl $0x3, %esi
ja 0x40a4
addl %eax, %eax
movl %eax, 0x8(%rbx)
xorl %edx, %edx
jmp 0x4092
movq (%rbx), %rdi
testb $0x1, %dl
je 0x40b4
movl %ebp, (%rdi,%rcx)
movl 0xc(%rbx), %ecx
jmp 0x40c6
movslq %eax, %rsi
callq 0x11e0
movq %rax, (%rbx)
movslq 0xc(%rbx), %rcx
movl %ebp, (%rax,%rcx)
addl $0x4, %ecx
movl %ecx, 0xc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x3227(%rip), %rdi      # 0x7301
leaq 0x3c2a(%rip), %rsi      # 0x7d0b
leaq 0x3c9a(%rip), %rcx      # 0x7d82
pushq $0x5b
popq %rdx
callq 0x10f0
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/serialize.c
// Function: serialize_int8
void serialize_int8(ser_buff_t *b, char data){
    if (b == NULL) assert(0);
    ser_buff_t *buff = (ser_buff_t *)(b);
    int available_size = buff->size - buff->next;
    char isResize = 0;

    while(available_size < sizeof(char)){
        buff->size = buff->size * 2;
        available_size = buff->size - buff->next;
        isResize = 1;
    }

    if(isResize == 0){
        memcpy((char *)buff->b + buff->next, &data, sizeof(char));
        buff->next += sizeof(char);
        return;
    }

    // resize of the buffer
    buff->b = realloc(buff->b, buff->size); 
    memcpy((char *)buff->b + buff->next, &data, sizeof(char));
    buff->next += sizeof(char);
    return;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x4148
movl %esi, %ebp
movq %rdi, %rbx
movl 0x8(%rdi), %ecx
movslq 0xc(%rdi), %rax
leal (%rax,%rax), %edx
movb $0x1, %sil
cmpl %eax, %ecx
jne 0x4117
movl %edx, 0x8(%rbx)
xorl %esi, %esi
movl %edx, %ecx
jmp 0x410a
movq (%rbx), %rdi
testb $0x1, %sil
je 0x4129
movb %bpl, (%rdi,%rax)
movl 0xc(%rbx), %ecx
jmp 0x413c
movslq %ecx, %rsi
callq 0x11e0
movq %rax, (%rbx)
movslq 0xc(%rbx), %rcx
movb %bpl, (%rax,%rcx)
incl %ecx
movl %ecx, 0xc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x31b2(%rip), %rdi      # 0x7301
leaq 0x3bb5(%rip), %rsi      # 0x7d0b
leaq 0x3c4b(%rip), %rcx      # 0x7da8
pushq $0x75
popq %rdx
callq 0x10f0
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/serialize.c
// Function: serialize_uint32
void serialize_uint32(ser_buff_t *b, unsigned int data){
    if (b == NULL) assert(0);
    ser_buff_t *buff = (ser_buff_t *)(b);
    int available_size = buff->size - buff->next;
    char isResize = 0;

    while(available_size < sizeof(unsigned int)){
        buff->size = buff->size * 2;
        available_size = buff->size - buff->next;
        isResize = 1;
    }

    if(isResize == 0){
        memcpy((char *)buff->b + buff->next, &data, sizeof(unsigned int));
        buff->next += sizeof(unsigned int);
        return;
    }

    // resize of the buffer
    buff->b = realloc(buff->b, buff->size); 
    memcpy((char *)buff->b + buff->next, &data, sizeof(unsigned int));
    buff->next += sizeof(unsigned int);
    return;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x42a9
movl %esi, %ebp
movq %rdi, %rbx
movl 0x8(%rdi), %eax
movslq 0xc(%rdi), %rcx
movb $0x1, %dl
movl %eax, %esi
subl %ecx, %esi
cmpl $0x3, %esi
ja 0x427a
addl %eax, %eax
movl %eax, 0x8(%rbx)
xorl %edx, %edx
jmp 0x4268
movq (%rbx), %rdi
testb $0x1, %dl
je 0x428a
movl %ebp, (%rdi,%rcx)
movl 0xc(%rbx), %ecx
jmp 0x429c
movslq %eax, %rsi
callq 0x11e0
movq %rax, (%rbx)
movslq 0xc(%rbx), %rcx
movl %ebp, (%rax,%rcx)
addl $0x4, %ecx
movl %ecx, 0xc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x3051(%rip), %rdi      # 0x7301
leaq 0x3a54(%rip), %rsi      # 0x7d0b
leaq 0x3b63(%rip), %rcx      # 0x7e21
movl $0xc1, %edx
callq 0x10f0
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/serialize.c
// Function: serialize_float
void serialize_float(ser_buff_t *b, float data){
    if (b == NULL) assert(0);
    ser_buff_t *buff = (ser_buff_t *)(b);
    int available_size = buff->size - buff->next;
    char isResize = 0;

    while(available_size < sizeof(float)){
        buff->size = buff->size * 2;
        available_size = buff->size - buff->next;
        isResize = 1;
    }

    if(isResize == 0){
        memcpy((char *)buff->b + buff->next, &data, sizeof(float));
        buff->next += sizeof(float);
        return;
    }

    // resize of the buffer
    buff->b = realloc(buff->b, buff->size); 
    memcpy((char *)buff->b + buff->next, &data, sizeof(float));
    buff->next += sizeof(float);
    return;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
testq %rdi, %rdi
je 0x432e
movq %rdi, %rbx
movl 0x8(%rdi), %eax
movslq 0xc(%rdi), %rcx
movb $0x1, %dl
movl %eax, %esi
subl %ecx, %esi
cmpl $0x3, %esi
ja 0x42f0
addl %eax, %eax
movl %eax, 0x8(%rbx)
xorl %edx, %edx
jmp 0x42de
movq (%rbx), %rdi
testb $0x1, %dl
je 0x4302
movss %xmm0, (%rdi,%rcx)
movl 0xc(%rbx), %ecx
jmp 0x4322
movslq %eax, %rsi
movss %xmm0, 0xc(%rsp)
callq 0x11e0
movq %rax, (%rbx)
movslq 0xc(%rbx), %rcx
movss 0xc(%rsp), %xmm0
movss %xmm0, (%rax,%rcx)
addl $0x4, %ecx
movl %ecx, 0xc(%rbx)
addq $0x10, %rsp
popq %rbx
retq
leaq 0x2fcc(%rip), %rdi      # 0x7301
leaq 0x39cf(%rip), %rsi      # 0x7d0b
leaq 0x3b10(%rip), %rcx      # 0x7e53
movl $0xdc, %edx
callq 0x10f0
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/serialize.c
// Function: serialize_double
void serialize_double(ser_buff_t *b, double data){
    if (b == NULL) assert(0);
    ser_buff_t *buff = (ser_buff_t *)(b);
    int available_size = buff->size - buff->next;
    char isResize = 0;

    while(available_size < sizeof(double)){
        buff->size = buff->size * 2;
        available_size = buff->size - buff->next;
        isResize = 1;
    }

    if(isResize == 0){
        memcpy((char *)buff->b + buff->next, &data, sizeof(double));
        buff->next += sizeof(double);
        return;
    }

    // resize of the buffer
    buff->b = realloc(buff->b, buff->size); 
    memcpy((char *)buff->b + buff->next, &data, sizeof(double));
    buff->next += sizeof(double);
    return;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
testq %rdi, %rdi
je 0x43b3
movq %rdi, %rbx
movl 0x8(%rdi), %eax
movslq 0xc(%rdi), %rcx
movb $0x1, %dl
movl %eax, %esi
subl %ecx, %esi
cmpl $0x7, %esi
ja 0x4375
addl %eax, %eax
movl %eax, 0x8(%rbx)
xorl %edx, %edx
jmp 0x4363
movq (%rbx), %rdi
testb $0x1, %dl
je 0x4387
movsd %xmm0, (%rdi,%rcx)
movl 0xc(%rbx), %ecx
jmp 0x43a7
movslq %eax, %rsi
movsd %xmm0, 0x8(%rsp)
callq 0x11e0
movq %rax, (%rbx)
movslq 0xc(%rbx), %rcx
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rax,%rcx)
addl $0x8, %ecx
movl %ecx, 0xc(%rbx)
addq $0x10, %rsp
popq %rbx
retq
leaq 0x2f47(%rip), %rdi      # 0x7301
leaq 0x394a(%rip), %rsi      # 0x7d0b
leaq 0x3ab5(%rip), %rcx      # 0x7e7d
movl $0xf7, %edx
callq 0x10f0
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/serialize.c
// Function: serialize_string
void serialize_string(ser_buff_t *b, char *data, int nbytes){
    if (b == NULL) assert(0);
    ser_buff_t *buff = (ser_buff_t *)(b);
    int available_size = buff->size - buff->next;
    char isResize = 0;

    while(available_size < nbytes){
        buff->size = buff->size * 2;
        available_size = buff->size - buff->next;
        isResize = 1;
    }

    if(isResize == 0){
        memcpy((char *)buff->b + buff->next, data, nbytes);
        buff->next += nbytes;
        return;
    }

    // resize of the buffer
    buff->b = realloc(buff->b, buff->size); 
    memcpy((char *)buff->b + buff->next, data, nbytes);
    buff->next += nbytes;
    return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x4451
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
movl 0x8(%rdi), %ecx
movslq 0xc(%rdi), %rax
movb $0x1, %dl
movl %ecx, %esi
subl %eax, %esi
cmpl %ebx, %esi
jge 0x4402
addl %ecx, %ecx
movl %ecx, 0x8(%r14)
xorl %edx, %edx
jmp 0x43f0
movq (%r14), %rdi
testb $0x1, %dl
je 0x441e
addq %rax, %rdi
movslq %ebx, %rdx
movq %r15, %rsi
callq 0x1190
movl 0xc(%r14), %r12d
jmp 0x443e
movslq %ecx, %rsi
callq 0x11e0
movq %rax, (%r14)
movslq 0xc(%r14), %r12
movq %r12, %rdi
addq %rax, %rdi
movslq %ebx, %rdx
movq %r15, %rsi
callq 0x1190
addl %ebx, %r12d
movl %r12d, 0xc(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x2ea9(%rip), %rdi      # 0x7301
leaq 0x38ac(%rip), %rsi      # 0x7d0b
leaq 0x3a43(%rip), %rcx      # 0x7ea9
movl $0x110, %edx            # imm = 0x110
callq 0x10f0
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/serialize.c
// Function: truncate_serialize_buffer
void truncate_serialize_buffer(ser_buff_t **b){
	ser_buff_t *clone = NULL;

	if((*b)->next == (*b)->size){
		return;
	}
	init_serialized_buffer_of_defined_size(&clone, (*b)->next);
	memcpy(clone->b, (*b)->b, (*b)->next);
	clone->next = clone->size;
	free_serialize_buffer(*b);
	*b = clone;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
andq $0x0, (%rsp)
movq (%rdi), %rax
movl 0xc(%rax), %esi
cmpl 0x8(%rax), %esi
je 0x44ba
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rdi
callq 0x3f5f
movq (%r14), %r14
movq (%r14), %rdi
movq (%rbx), %rax
movq (%rax), %rsi
movslq 0xc(%rax), %rdx
callq 0x1190
movl 0x8(%r14), %eax
movl %eax, 0xc(%r14)
movq (%rbx), %rdi
callq 0x3fac
movq %r14, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/serialize.c
// Function: print_buffer_details
void print_buffer_details(ser_buff_t *b, const char *fn, int lineno){
#if 1
    printf("%s():%d : starting address = %p\n", fn, lineno, b);
    printf("size = %d\n", b->size);
    printf("next = %d\n", b->next);
#endif
    return;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x3a0d(%rip), %rdi      # 0x7eda
movq %rbx, %rcx
xorl %eax, %eax
callq 0x10e0
movl 0x8(%rbx), %esi
leaq 0x3a1a(%rip), %rdi      # 0x7efb
xorl %eax, %eax
callq 0x10e0
movl 0xc(%rbx), %esi
leaq 0x3a14(%rip), %rdi      # 0x7f06
xorl %eax, %eax
popq %rbx
jmp 0x10e0
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/serialize.c
// Function: de_serialize_string
void 
de_serialize_string(char *dest, ser_buff_t *b, int size){
	if(!b || !b->b) assert(0);
	if(!size) assert(0);;
	if((b->size - b->next)< size) assert(0);	 
	memcpy(dest, b->b + b->next, size);
	b->next += size;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x4539
movq %rsi, %r14
movq (%rsi), %rsi
testq %rsi, %rsi
je 0x4539
movl %edx, %ebx
testl %edx, %edx
je 0x4558
movl 0x8(%r14), %ecx
movslq 0xc(%r14), %rax
subl %eax, %ecx
cmpl %ebx, %ecx
jl 0x4577
addq %rax, %rsi
movslq %ebx, %rdx
callq 0x1190
addl %ebx, 0xc(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x2dc1(%rip), %rdi      # 0x7301
leaq 0x37c4(%rip), %rsi      # 0x7d0b
leaq 0x39c3(%rip), %rcx      # 0x7f11
movl $0x143, %edx            # imm = 0x143
callq 0x10f0
leaq 0x2da2(%rip), %rdi      # 0x7301
leaq 0x37a5(%rip), %rsi      # 0x7d0b
leaq 0x39a4(%rip), %rcx      # 0x7f11
movl $0x144, %edx            # imm = 0x144
callq 0x10f0
leaq 0x2d83(%rip), %rdi      # 0x7301
leaq 0x3786(%rip), %rsi      # 0x7d0b
leaq 0x3985(%rip), %rcx      # 0x7f11
movl $0x145, %edx            # imm = 0x145
callq 0x10f0
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/serialize.c
// Function: copy_in_serialized_buffer_by_offset
void copy_in_serialized_buffer_by_offset(ser_buff_t *b, int size, char *value, int offset){
	if((b->size - b->next) < size){
		printf("%s(): Error : Insufficient buffer space\n", __FUNCTION__);
		return;
	}
	
	if(offset > b->size){
		printf("%s(): Error : Attemt to write outside buffer boundaries\n", __FUNCTION__);
		return;
	}
	
	memcpy(b->b + offset, value, size);
}

// Assembly:
movl 0x8(%rdi), %eax
movl %eax, %r8d
subl 0xc(%rdi), %r8d
cmpl %esi, %r8d
jge 0x45ae
leaq 0x3999(%rip), %rdi      # 0x7f45
jmp 0x45b9
cmpl %ecx, %eax
jge 0x45c7
leaq 0x39d9(%rip), %rdi      # 0x7f92
leaq 0x39ae(%rip), %rsi      # 0x7f6e
xorl %eax, %eax
jmp 0x10e0
movslq %ecx, %rax
addq (%rdi), %rax
movslq %esi, %rcx
movq %rax, %rdi
movq %rdx, %rsi
movq %rcx, %rdx
jmp 0x1190
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/string_util.c
// Function: tokenizer
char** tokenizer(char* _a_str, const char a_delim, size_t *token_cnt){
   
    char *token = NULL;
    int i = 0;
    char delim[2];
    memset(a_str, 0, CONS_INPUT_BUFFER_SIZE);
    strncpy(a_str, _a_str, strlen(_a_str));
    a_str[strlen(_a_str)] = '\0';

    string_space_trim(a_str);

    if(strlen(a_str) < 1){
        *token_cnt = 0;
        return NULL;
    }

    delim[0] = a_delim;
    delim[1] = '\0';

    token = strtok(a_str, delim);
    if(token){
        untokenize(i);
        strncpy(tokens[i], token, strlen(token));
        i++;
    }
    else{
        *token_cnt = 0;
        return NULL;
    }
    
    /* walk through other tokens */
    while( token != NULL ) 
    {
        token = strtok(NULL, delim);
        if(token){
            untokenize(i);
            strncpy(tokens[i], token, strlen(token));
            i++;
            if(i == MAX_CMD_TREE_DEPTH + 1){
                //printf("Warning : Max token limit (= %d) support exceeded\n", MAX_CMD_TREE_DEPTH);
                re_init_tokens(MAX_CMD_TREE_DEPTH);
                *token_cnt = 0;
                return &tokens[0];
            }
        }
    } 
    *token_cnt = i;
    return &tokens[0];
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r14
leaq 0xd0c0(%rip), %r15      # 0x117a0
xorl %ebx, %ebx
movl $0x800, %edx            # imm = 0x800
movq %r15, %rdi
xorl %esi, %esi
callq 0x1100
movq %r14, %rdi
callq 0x10c0
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x1060
movq %r14, %rdi
callq 0x10c0
movb $0x0, (%rax,%r15)
movq %r15, %rdi
callq 0x4809
cmpb $0x0, 0xd07d(%rip)      # 0x117a0
je 0x47f0
leaq 0x6(%rsp), %rsi
movb %bpl, (%rsi)
movb $0x0, 0x1(%rsi)
leaq 0xd064(%rip), %rdi      # 0x117a0
callq 0x1210
testq %rax, %rax
je 0x47ee
movq %rax, %r14
movq %r12, %rbp
movq 0xcfc9(%rip), %rax      # 0x11720
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq 0xcfb0(%rip), %r15      # 0x11720
movq %r14, %rdi
callq 0x10c0
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x1060
pushq $0x1
popq %rbx
leaq 0x6(%rsp), %r15
leaq 0xcf8b(%rip), %r14      # 0x11720
xorl %edi, %edi
movq %r15, %rsi
callq 0x1210
testq %rax, %rax
je 0x47e9
movq %rax, %r12
movq (%r14,%rbx,8), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq (%r14,%rbx,8), %r13
movq %r12, %rdi
callq 0x10c0
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x1060
incq %rbx
cmpl $0x11, %ebx
jne 0x4795
pushq $0x10
popq %rdi
callq 0x4627
xorl %ebx, %ebx
movq %rbp, %r12
jmp 0x47f3
xorl %ebx, %ebx
xorl %r14d, %r14d
movq %rbx, (%r12)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/string_util.c
// Function: string_space_trim
void
string_space_trim(char *string){

    if(!string)
        return;

    char* ptr = string;
    int len = strlen(ptr);

    if(!len){
        return;
    }

    if(!isspace(ptr[0]) && !isspace(ptr[len-1])){
        return;
    }

    while(len-1 > 0 && isspace(ptr[len-1])){
        ptr[--len] = 0;
    }

    while(*ptr && isspace(*ptr)){
        ++ptr, --len;
    }

    memmove(string, ptr, len + 1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x4849
movq %rdi, %rbx
callq 0x10c0
movq %rax, %r14
testl %r14d, %r14d
je 0x4849
callq 0x12a0
movq (%rax), %rcx
movsbq (%rbx), %rdx
testb $0x20, 0x1(%rcx,%rdx,2)
jne 0x4851
movl %r14d, %edx
decl %edx
movslq %edx, %rdx
movsbq (%rbx,%rdx), %rdx
testb $0x20, 0x1(%rcx,%rdx,2)
jne 0x4851
addq $0x8, %rsp
popq %rbx
popq %r14
retq
cmpl $0x2, %r14d
jl 0x4874
movq (%rax), %rcx
movl %r14d, %edx
movsbq -0x1(%rbx,%rdx), %rdx
testb $0x20, 0x1(%rcx,%rdx,2)
je 0x4874
decl %r14d
movb $0x0, (%rbx,%r14)
jmp 0x4851
pushq $-0x1
popq %rcx
movq %rbx, %rsi
movsbq (%rsi), %rdx
testq %rdx, %rdx
je 0x4894
movq (%rax), %rdi
testb $0x20, 0x1(%rdi,%rdx,2)
je 0x4894
incq %rsi
incl %ecx
jmp 0x487a
subl %ecx, %r14d
movslq %r14d, %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x11f0
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/string_util.c
// Function: print_tokens
void
print_tokens(unsigned int index){
    
    unsigned int i = 0;
    for ( ; i < index; i++)
    {
        if(tokens[i] == NULL)
            break;

        printf("%s ", tokens[i]);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %r14d
shlq $0x3, %r14
leaq 0xce61(%rip), %r15      # 0x11720
leaq 0x3745(%rip), %rbx      # 0x800b
xorl %r12d, %r12d
cmpq %r12, %r14
je 0x48e7
movq (%r12,%r15), %rsi
testq %rsi, %rsi
je 0x48e7
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10e0
addq $0x8, %r12
jmp 0x48c9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/string_util.c
// Function: replaceSubstring
void replaceSubstring(char string[], char sub[], char new_str[])
{
    int stringLen, subLen, newLen;
    int i = 0, j, k;
    int flag = 0, start, end;
    stringLen = strlen(string);
    subLen = strlen(sub);
    newLen = strlen(new_str);

    for (i = 0; i < stringLen; i++)
    {
        flag = 0;
        start = i;
        for (j = 0; string[i] == sub[j]; j++, i++)
            if (j == subLen - 1)
                flag = 1;
        end = i;
        if (flag == 0)
            i -= j;
        else
        {
            for (j = start; j < end; j++)
            {
                for (k = start; k < stringLen; k++)
                    string[k] = string[k + 1];
                stringLen--;
                i--;
            }

            for (j = start; j < start + newLen; j++)
            {
                for (k = stringLen; k >= j; k--)
                    string[k + 1] = string[k];
                string[j] = new_str[j - start];
                stringLen++;
                i++;
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq 0x10c0
movq %rax, %r12
movq %r14, %rdi
callq 0x10c0
movq %rax, %r13
movq %rbx, %rdi
callq 0x10c0
movq %rax, (%rsp)
decl %r13d
leaq 0x1(%r15), %rax
xorl %r9d, %r9d
pushq $0x1
popq %rdx
cmpl %r12d, %r9d
jge 0x49f1
movslq %r9d, %rsi
leaq (%r15,%rsi), %r10
xorl %edi, %edi
xorl %r8d, %r8d
movb (%r10,%rdi), %r11b
cmpb (%r14,%rdi), %r11b
jne 0x495e
cmpq %rdi, %r13
cmovel %edx, %r8d
incq %rdi
jmp 0x4948
movl %r9d, %r10d
addq %rdi, %r10
testl %r8d, %r8d
je 0x49e1
movslq %r12d, %r12
leaq (%rax,%r12), %r8
movl %r9d, %r11d
movl %r10d, %edi
movq %rsi, %rbp
cmpl %r10d, %r11d
jl 0x498c
jmp 0x499e
movb 0x1(%r15,%rbp), %cl
movb %cl, (%r15,%rbp)
incq %rbp
cmpq %r12, %rbp
jl 0x4980
decq %r12
decl %edi
incl %r11d
decq %r8
jmp 0x4976
addl (%rsp), %r9d
movslq %r9d, %r9
movq %rsi, %r10
cmpq %r9, %r10
jge 0x49e7
xorl %r11d, %r11d
leaq (%r12,%r11), %rcx
cmpq %r10, %rcx
jl 0x49c7
movb -0x1(%r8,%r11), %cl
movb %cl, (%r8,%r11)
decq %r11
jmp 0x49b0
movq %r10, %rcx
subq %rsi, %rcx
movb (%rbx,%rcx), %cl
movb %cl, (%r15,%r10)
incq %r12
incl %edi
incq %r10
incq %r8
jmp 0x49a8
subl %edi, %r10d
movl %r10d, %edi
incl %edi
movl %edi, %r9d
jmp 0x4933
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/string_util.c
// Function: grep
int
grep (char string[], int string_size, char pattern[]) {

    int rc = 0;
    char *token;

    if (!string_size) return 0;
    
    char *temp_buff = (char *)calloc(1, string_size);
    
    memcpy(temp_buff, string, string_size);
    memset (string, 0, string_size);

    token = strtok(temp_buff, "\n");

    while (token) {

        if (pattern_match(token, strlen(token), pattern)) {

            rc += sprintf(string + rc, "%s\n", token);
        }
        token = strtok(NULL, "\n");
    }
    free(temp_buff);
    return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testl %esi, %esi
je 0x4ac4
movq %rdx, %rbx
movq %rdi, %r14
movslq %esi, %r12
pushq $0x1
popq %rdi
movq %r12, %rsi
callq 0x1140
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x1190
movq %r14, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x1100
leaq 0x3d60(%rip), %r13      # 0x87c7
movq %r15, %rdi
xorl %r12d, %r12d
movq %r13, %rsi
callq 0x1210
testq %rax, %rax
je 0x4aba
movq %rax, %rbp
movq %rax, %rdi
callq 0x10c0
movq %rbp, %rdi
movl %eax, %esi
movq %rbx, %rdx
callq 0x4a00
movl $0x0, %edi
testb %al, %al
je 0x4a6d
movslq %r12d, %r12
leaq (%r14,%r12), %rdi
leaq 0x2fa1(%rip), %rsi      # 0x7a4a
movq %rbp, %rdx
xorl %eax, %eax
callq 0x1250
addl %eax, %r12d
xorl %edi, %edi
jmp 0x4a6d
movq %r15, %rdi
callq 0x1030
jmp 0x4ac7
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/string_util.c
// Function: string_fetch_integer
uint64_t
string_fetch_integer(char *string, int string_size, int index) {

    int count = 0;
    char *token;

    if (!string_size) return 0;

    char *temp_buff = (char *)calloc(1, string_size);
    memcpy(temp_buff, string, string_size);
    
    token = strtok(temp_buff, " ");

    while (token) {

        if (!is_number(token)) {
            token = strtok(NULL, " ");
            continue;
        }

        count++;
        if (index == count) {
            free(temp_buff);
            return atoi(token);
        }
        
        token = strtok(NULL, " ");
    }
    free(temp_buff);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
xorl %ebx, %ebx
testl %esi, %esi
je 0x4b6c
movl %edx, %ebp
movq %rdi, %r15
movslq %esi, %r12
pushq $0x1
popq %rdi
movq %r12, %rsi
callq 0x1140
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1190
leaq 0x2e7e(%rip), %r15      # 0x7994
movq %r14, %rdi
movq %r15, %rsi
callq 0x1210
testq %rax, %rax
je 0x4b62
movq %rax, %r12
movq %rax, %rcx
movb (%rcx), %al
leal -0x30(%rax), %edx
incq %rcx
cmpb $0xa, %dl
jb 0x4b2c
movl $0x0, %edi
testb %al, %al
jne 0x4b19
incl %ebx
movl $0x0, %edi
cmpl %ebp, %ebx
jne 0x4b19
movq %r14, %rdi
callq 0x1030
movq %r12, %rdi
callq 0x1220
movslq %eax, %rbx
jmp 0x4b6c
movq %r14, %rdi
callq 0x1030
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/clistd.c
// Function: boolean_validation_handler
CLI_VAL_RC
boolean_validation_handler(leaf_t *leaf, char *value_passed){

    if((strncmp(value_passed, "true", strlen("true")) == 0) || 
            (strncmp(value_passed, "false", strlen("false")) ==0))
        return VALIDATION_SUCCESS;

    return VALIDATION_FAILED;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
leaq 0x347d(%rip), %rsi      # 0x800f
pushq $0x4
popq %rdx
movq %rbx, %rdi
callq 0x1070
testl %eax, %eax
je 0x4bbd
leaq 0x346c(%rip), %rsi      # 0x8014
pushq $0x5
popq %rdx
movq %rbx, %rdi
callq 0x1070
movl %eax, %ecx
xorl %eax, %eax
negl %ecx
sbbl %eax, %eax
jmp 0x4bbf
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/clistd.c
// Function: enable_disable_validation_handler
int
enable_disable_validation_handler(char *value_passed){

     if((strncmp(value_passed, "enable", strlen("enable")) == 0) || 
            (strncmp(value_passed, "disable", strlen("disable")) ==0))
        return VALIDATION_SUCCESS;

    return VALIDATION_FAILED;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x28fe(%rip), %rsi      # 0x74ca
pushq $0x6
popq %rdx
callq 0x1070
testl %eax, %eax
je 0x4bf4
leaq 0x28fb(%rip), %rsi      # 0x74da
pushq $0x7
popq %rdx
movq %rbx, %rdi
callq 0x1070
movl %eax, %ecx
xorl %eax, %eax
negl %ecx
sbbl %eax, %eax
jmp 0x4bf6
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/clistd.c
// Function: config_console_name_handler
int
config_console_name_handler(param_t *param, ser_buff_t *b, op_mode enable_or_disable){

    tlv_struct_t *tlv = NULL;

    TLV_LOOP_BEGIN(b, tlv){
        if(enable_or_disable == CONFIG_ENABLE)
            set_device_name(tlv->value);
        else{
            if(strncmp(tlv->value, console_name, strlen(tlv->value)) == 0)
                set_device_name(DEFAULT_DEVICE_NAME);
            else
                printf("Error : Incorrect device name\n");
        }
    }TLV_LOOP_END;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x4c90
movl %edx, %ebx
movq (%rsi), %r14
movq %rsi, %rdi
callq 0x3fde
cltq
pushq $0x64
popq %rcx
xorl %edx, %edx
divq %rcx
movq %rax, %r15
decl %r15d
addq $0x24, %r14
leaq 0xb1cc(%rip), %r12      # 0xfe00
leaq 0x27ca(%rip), %r13      # 0x7405
leaq 0x388d(%rip), %rbp      # 0x84cf
subl $0x1, %r15d
jb 0x4c7f
movq %r14, %rdi
cmpl $0x1, %ebx
je 0x4c74
callq 0x10c0
movq %r14, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x1070
testl %eax, %eax
je 0x4c71
movq %rbp, %rdi
callq 0x1080
jmp 0x4c79
movq %r13, %rdi
callq 0x27f7
addq $0x64, %r14
jmp 0x4c42
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x26f3(%rip), %rdi      # 0x738a
leaq 0x337c(%rip), %rsi      # 0x801a
leaq 0x337e(%rip), %rcx      # 0x8023
movl $0x8d, %edx
callq 0x10f0
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/clistd.c
// Function: repeat_last_command
int
repeat_last_command(param_t *param, ser_buff_t *b, op_mode enable_or_disable){
    static char new_line_consume[2];
    char *last_cmd = get_last_command();
    printf("prev : %s", last_cmd);
    scanf("%c", new_line_consume);;
    parse_input_cmd(last_cmd, strlen(last_cmd), NULL);
    return 0;
}

// Assembly:
pushq %rbx
xorl %eax, %eax
callq 0x3117
movq %rax, %rbx
leaq 0x33a4(%rip), %rdi      # 0x8065
movq %rax, %rsi
xorl %eax, %eax
callq 0x10e0
leaq 0x339d(%rip), %rdi      # 0x806f
leaq 0xd2f7(%rip), %rsi      # 0x11fd0
xorl %eax, %eax
callq 0x1230
movq %rbx, %rdi
callq 0x10c0
movq %rbx, %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x3348
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/clistd.c
// Function: mode_enter_callback
int
mode_enter_callback(param_t *param, ser_buff_t *b, op_mode enable_or_disable){
 
    if(param == libcli_get_root()){
        printf(ANSI_COLOR_YELLOW "Info : Mode not supported at root level\n" ANSI_COLOR_RESET);
        return 0;   
    }
    set_cmd_tree_cursor(param);
    build_mode_console_name(param);
    
    if(IS_APPLICATION_CALLBACK_HANDLER_REGISTERED(param))
        INVOKE_APPLICATION_CALLBACK_HANDLER(param, b, enable_or_disable);

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
callq 0x1abc
cmpq %r15, %rax
je 0x4d34
movq %r15, %rdi
callq 0x1bf7
movq %r15, %rdi
callq 0x2ced
movq 0x10(%r15), %rax
testq %rax, %rax
je 0x4d42
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq *%rax
jmp 0x4d42
leaq 0x3337(%rip), %rdi      # 0x8072
xorl %eax, %eax
callq 0x10e0
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/clistd.c
// Function: display_sub_options_callback
int
display_sub_options_callback(param_t *param, ser_buff_t *b, op_mode enable_or_disable){
    
    int i = 0;
    tlv_struct_t dummy;

    if(IS_APPLICATION_CALLBACK_HANDLER_REGISTERED(param))
        printf("<Enter>\n");

    for(i = CHILDREN_START_INDEX; i <= CHILDREN_END_INDEX; i++){
        if(param->options[i]){

            if(IS_PARAM_HIDDEN(param->options[i]))
                continue;

            if(IS_PARAM_CMD(param->options[i]) || IS_PARAM_NO_CMD(param->options[i])){
                printf(ANSI_COLOR_MAGENTA "nxt cmd  -> %-31s   |   %s\n" ANSI_COLOR_RESET, GET_CMD_NAME(param->options[i]), GET_PARAM_HELP_STRING(param->options[i]));
                continue;
            }
            printf(ANSI_COLOR_CYAN "nxt leaf -> %-32s  |   %s\n" ANSI_COLOR_RESET, GET_LEAF_TYPE_STR(param->options[i]), GET_PARAM_HELP_STRING(param->options[i]));
            continue;
        }
        break;
    }

    /*Means param is a leaf*/
    if(param->disp_callback){

        /*Add a dummy TLV to compensate for the cmd code TLV*/
        memset(&dummy, 0, sizeof(tlv_struct_t));
        collect_tlv(b, &dummy);
        printf(ANSI_COLOR_YELLOW "possible values :\n");
        param->disp_callback(param, b);
        printf(ANSI_COLOR_RESET);
    }
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rsi, %r14
movq %rdi, %rbx
cmpq $0x0, 0x10(%rdi)
je 0x4d70
leaq 0x3782(%rip), %rdi      # 0x84ed
callq 0x1080
pushq $0xf
popq %r13
leaq 0x3329(%rip), %r15      # 0x80a4
leaq 0x3347(%rip), %r12      # 0x80c9
cmpq $0x1c, %r13
je 0x4dd1
movq (%rbx,%r13,8), %rdx
testq %rdx, %rdx
je 0x4dd1
cmpb $0x1, 0x18(%rdx)
je 0x4dcc
testl $0xfffffffd, (%rdx)     # imm = 0xFFFFFFFD
jne 0x4dac
movq 0x8(%rdx), %rsi
addq $0x19, %rdx
movq %r15, %rdi
jmp 0x4dc5
movq 0x8(%rdx), %rax
movl (%rax), %edi
callq 0x1c6d
movq (%rbx,%r13,8), %rdx
addq $0x19, %rdx
movq %r12, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x10e0
incq %r13
jmp 0x4d82
cmpq $0x0, 0xe8(%rbx)
je 0x4e2d
xorps %xmm0, %xmm0
movq %rsp, %rsi
movaps %xmm0, 0x50(%rsi)
movaps %xmm0, 0x40(%rsi)
movaps %xmm0, 0x30(%rsi)
movaps %xmm0, 0x20(%rsi)
movaps %xmm0, 0x10(%rsi)
movaps %xmm0, (%rsi)
andl $0x0, 0x60(%rsi)
pushq $0x64
popq %rdx
movq %r14, %rdi
callq 0x43d2
leaq 0x36e7(%rip), %rdi      # 0x84f5
callq 0x1080
movq %rbx, %rdi
movq %r14, %rsi
callq *0xe8(%rbx)
leaq 0x2daf(%rip), %rdi      # 0x7bd5
xorl %eax, %eax
callq 0x10e0
xorl %eax, %eax
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/clistd.c
// Function: display_cmd_expansion_callback
int
display_cmd_expansion_callback(param_t *param, ser_buff_t *b, op_mode enable_or_disable){

    re_init_tokens(MAX_CMD_TREE_DEPTH);
    unsigned int index = 0;

    dump_all_commands(param, index);
    return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
pushq $0x10
popq %rdi
callq 0x4627
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4e57
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/clistd.c
// Function: dump_all_commands
static void
dump_all_commands(param_t *root, unsigned int index){

        if(!root)
            return;

        if(IS_PARAM_NO_CMD(root))
            return;

        if(IS_PARAM_CMD(root)){
            untokenize(index);
            tokenize(GET_CMD_NAME(root), strlen(GET_CMD_NAME(root)), index);
        }
        else if(IS_PARAM_LEAF(root)){
            untokenize(index);
            memset(temp, 0, sizeof(temp));
            sprintf(temp, "<%s>", GET_LEAF_ID(root));
            tokenize(temp, strlen(GET_LEAF_ID(root)) + 2, index);
        }

        unsigned int i = CHILDREN_START_INDEX;

        for( ; i <= CHILDREN_END_INDEX; i++)
            dump_all_commands(root->options[i], index+1);
        
        if(IS_APPLICATION_CALLBACK_HANDLER_REGISTERED(root)){
            print_tokens(index + 1);
            printf("\n");
        }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x4f22
movq %rdi, %r14
movl (%rdi), %eax
cmpl $0x2, %eax
je 0x4f22
movl %esi, %ebx
cmpl $0x1, %eax
je 0x4e98
testl %eax, %eax
jne 0x4eeb
movl %ebx, %edi
callq 0x4698
movq 0x8(%r14), %r15
movq %r15, %rdi
callq 0x10c0
movq %r15, %rdi
movl %eax, %esi
jmp 0x4ee4
movl %ebx, %edi
callq 0x4698
xorps %xmm0, %xmm0
leaq 0xd0f7(%rip), %r15      # 0x11fa0
andw $0x0, 0x20(%r15)
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
movq 0x8(%r14), %rdx
addq $0x50, %rdx
leaq 0x3603(%rip), %rsi      # 0x84ca
movq %r15, %rdi
xorl %eax, %eax
callq 0x1250
movq 0x8(%r14), %rdi
addq $0x50, %rdi
callq 0x10c0
leal 0x2(%rax), %esi
movq %r15, %rdi
movl %ebx, %edx
callq 0x465b
incl %ebx
xorl %r15d, %r15d
cmpq $0xd, %r15
je 0x4f07
movq 0x78(%r14,%r15,8), %rdi
movl %ebx, %esi
callq 0x4e57
incq %r15
jmp 0x4ef0
cmpq $0x0, 0x10(%r14)
je 0x4f22
movl %ebx, %edi
callq 0x48a9
pushq $0xa
popq %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x1040
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/clistd.c
// Function: record_command
void
record_command(char *hist_file, char *cons_input_buffer, unsigned int cmd_len){

    assert(hist_file || cons_input_buffer || !cmd_len);
    
    static unsigned int cmd_counter = 0;
    
    if(cmd_counter == MAX_SAVED_CMDS){
        return;
    }
    FILE *f = fopen(CMD_HIST_RECORD_FILE, "a");
    fwrite(cons_input_buffer, cmd_len, 1, f);
    fwrite("\n", 1, 1, f);
    cmd_counter++;
    fclose(f);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
orq %rsi, %rdi
setne %al
testl %edx, %edx
sete %cl
orb %al, %cl
je 0x5116
cmpl $0x1e, 0xd319(%rip)     # 0x123e0
jne 0x50ce
popq %rbx
popq %r14
popq %rbp
retq
movl %edx, %ebp
movq %rsi, %rbx
leaq 0x29fe(%rip), %rdi      # 0x7ad8
leaq 0x2489(%rip), %rsi      # 0x756a
callq 0x1200
movq %rax, %r14
movl %ebp, %esi
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %rax, %rcx
callq 0x1270
pushq $0xa
popq %rdi
movq %r14, %rsi
callq 0x1120
incl 0xd2d6(%rip)            # 0x123e0
movq %r14, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x1090
leaq 0x3013(%rip), %rdi      # 0x8130
leaq 0x2ef6(%rip), %rsi      # 0x801a
leaq 0x3030(%rip), %rcx      # 0x815b
movl $0x11e, %edx            # imm = 0x11E
callq 0x10f0
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/clistd.c
// Function: config_mode_enter_handler
int
config_mode_enter_handler(param_t *param, ser_buff_t *b, op_mode enable_or_disable){

    set_cmd_tree_cursor(param);
    build_mode_console_name(param);
    mark_checkpoint_serialize_buffer(b);
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x1bf7
movq %r14, %rdi
callq 0x2ced
movq %rbx, %rdi
callq 0x404e
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/clistd.c
// Function: supportsave_handler
int
supportsave_handler(param_t *param, ser_buff_t *b, op_mode enable_or_disable){

    switch(enable_or_disable){
        case CONFIG_ENABLE:
            //signal(SIGTERM, terminate_signal_handler);/*When process is killed*/
            //signal(SIGSEGV, terminate_signal_handler);/*When process access illegal memory*/
            //signal(SIGABRT, terminate_signal_handler);/*when process abort itself*/
            break;
        case CONFIG_DISABLE:
            signal(SIGTERM, SIG_DFL);/*When process is killed*/
            signal(SIGSEGV, SIG_DFL);/*When process access illegal memory*/
            signal(SIGABRT, SIG_DFL);/*when process abort itself*/
            break;
        default:
            assert(0);
    }
    return 0;
}

// Assembly:
pushq %rax
cmpl $0x1, %edx
je 0x51e1
testl %edx, %edx
jne 0x51e5
pushq $0xf
popq %rdi
xorl %esi, %esi
callq 0x1160
pushq $0xb
popq %rdi
xorl %esi, %esi
callq 0x1160
pushq $0x6
popq %rdi
xorl %esi, %esi
callq 0x1160
xorl %eax, %eax
popq %rcx
retq
leaq 0x2115(%rip), %rdi      # 0x7301
leaq 0x2e27(%rip), %rsi      # 0x801a
leaq 0x2f93(%rip), %rcx      # 0x818d
movl $0x17a, %edx            # imm = 0x17A
callq 0x10f0
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/clistd.c
// Function: show_help_handler
int
show_help_handler(param_t *param, ser_buff_t *b, op_mode enable_or_disable){

    printf("Welcome to Help Wizard\n");
    printf("========================\n");
    printf("1. Use '%s' Character after the command to enter command mode\n", MODE_CHARACTER);
    printf("2. Use '%s' Character after the command to see possible follow up suboptions\n", SUBOPTIONS_CHARACTER);
    printf("3. Use '%s' from within the config branch to directly trigger operational commands\n", DO);
    printf("4. Use '%s' Character after the command to see possible complete command completions\n", CMD_EXPANSION_CHARACTER);
    printf("5. Built-in commands:\n");
    printf("    a. %s - clear screen\n", CLEAR_SCR_STRING);
    printf("    b. %s - jump to top of cmd tree\n", GOTO_TOP_STRING);
    printf("    c. %s - jump one level up of command tree\n", GOTO_ONE_LVL_UP_STRING);
    printf("    d. config [%s] console name <console name> - set/unset new console name\n", NEGATE_CHARACTER);
    printf("    e. config [%s] supportsave enable - enable/disable supportsave facility\n", NEGATE_CHARACTER);
    printf("    f. debug show cmdtree - Show entire command tree\n");
    printf("    g. show history - show history of commands triggered\n");
    printf("    h. repeat - repeat the last command\n");
	printf(ANSI_COLOR_YELLOW "                      Author : Abhishek Sagar, Juniper Networks\n" ANSI_COLOR_RESET);
	printf(ANSI_COLOR_YELLOW "                      Visit : www.csepracticals.com for more courses and projects\n" ANSI_COLOR_RESET);
    return 0;
}

// Assembly:
pushq %rbx
leaq 0x3374(%rip), %rdi      # 0x8594
callq 0x1080
leaq 0x337f(%rip), %rdi      # 0x85ab
callq 0x1080
leaq 0x2f8f(%rip), %rdi      # 0x81c7
leaq 0x21d3(%rip), %rsi      # 0x7412
xorl %eax, %eax
callq 0x10e0
leaq 0x2fb9(%rip), %rdi      # 0x8206
leaq 0x21cb(%rip), %rsi      # 0x741f
xorl %eax, %eax
callq 0x10e0
leaq 0x2ff2(%rip), %rdi      # 0x8254
leaq 0x303f(%rip), %rsi      # 0x82a8
xorl %eax, %eax
callq 0x10e0
leaq 0x3034(%rip), %rdi      # 0x82ab
leaq 0x23d1(%rip), %rsi      # 0x764f
xorl %eax, %eax
callq 0x10e0
leaq 0x3338(%rip), %rdi      # 0x85c4
callq 0x1080
leaq 0x3069(%rip), %rdi      # 0x8301
leaq 0x239c(%rip), %rsi      # 0x763b
xorl %eax, %eax
callq 0x10e0
leaq 0x306e(%rip), %rdi      # 0x831b
leaq 0x23af(%rip), %rsi      # 0x7663
xorl %eax, %eax
callq 0x10e0
leaq 0x307e(%rip), %rdi      # 0x8340
leaq 0x2383(%rip), %rsi      # 0x764c
xorl %eax, %eax
callq 0x10e0
leaq 0x3098(%rip), %rdi      # 0x836f
leaq 0x2314(%rip), %rbx      # 0x75f2
movq %rbx, %rsi
xorl %eax, %eax
callq 0x10e0
leaq 0x30cd(%rip), %rdi      # 0x83bc
movq %rbx, %rsi
xorl %eax, %eax
callq 0x10e0
leaq 0x32da(%rip), %rdi      # 0x85da
callq 0x1080
leaq 0x3303(%rip), %rdi      # 0x860f
callq 0x1080
leaq 0x3330(%rip), %rdi      # 0x8648
callq 0x1080
leaq 0x30e5(%rip), %rdi      # 0x8409
xorl %eax, %eax
callq 0x10e0
leaq 0x3121(%rip), %rdi      # 0x8453
xorl %eax, %eax
callq 0x10e0
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/clistd.c
// Function: show_resgistered_cmd_handler
int
show_resgistered_cmd_handler(param_t *param, ser_buff_t *b, op_mode enable_or_disable){
    
    /*Implement DFS and dump all complete commands*/
    re_init_tokens(MAX_CMD_TREE_DEPTH);

    param_t *root = libcli_get_root();
    
    unsigned int index = 0;
    dump_all_commands(root, index);
    return 0;
}

// Assembly:
pushq %rax
pushq $0x10
popq %rdi
callq 0x4627
callq 0x1abc
movq %rax, %rdi
xorl %esi, %esi
callq 0x4e57
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/clistd.c
// Function: show_extension_param_handler
int
show_extension_param_handler(param_t *param, ser_buff_t *b, op_mode enable_or_disable){

    tlv_struct_t tlv;
    memset(&tlv, 0, sizeof(tlv_struct_t));

    if(param == libcli_get_show_brief_extension_param()){
        put_value_in_tlv((&tlv), SHOW_EXTENSION_PARAM_BRIEF);
        tlv.leaf_type = INVALID;
        strncpy(tlv.leaf_id, SHOW_EXTENSION_PARAM, strlen("SHOW_EXTENSION_PARAM"));
        collect_tlv(b, &tlv);
    }
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x58(%rsp)
movups %xmm0, 0x4c(%rsp)
movups %xmm0, 0x3c(%rsp)
movups %xmm0, 0x2c(%rsp)
movups %xmm0, 0x1c(%rsp)
callq 0x1b04
cmpq %r14, %rax
jne 0x53d1
movabsq $0x4952425f574f4853, %rax # imm = 0x4952425F574F4853
leaq 0x4(%rsp), %rsi
movq %rax, 0x24(%rsi)
movw $0x4645, 0x2c(%rsi)     # imm = 0x4645
movl $0x6, (%rsi)
movups 0x32b2(%rip), %xmm0     # 0x8670
movups %xmm0, 0x4(%rsi)
andl $0x0, 0x14(%rsi)
pushq $0x64
popq %rdx
movq %rbx, %rdi
callq 0x43d2
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/ut/utinfra/ut_parser.c
// Function: ut_parser_init
void
ut_parser_init ( ) {

    struct mq_attr attr;

    ut_log_file = fopen("CommandParser/ut/utinfra/ut_log_file.txt", "w");
    assert(ut_log_file);

    attr.mq_flags = 0;
    attr.mq_maxmsg = MAX_MESSAGES;
    attr.mq_msgsize = MAX_MSG_SIZE;
    attr.mq_curmsgs = 0;

    if ((UT_PARSER_MSG_Q_FD = mq_open("/ut_parser_msg_q",
                                      O_RDWR | O_CREAT,
                                      QUEUE_PERMISSIONS, &attr)) == -1) {

        printf("UT Parser mq_open failed, errno = %d\n", errno);
        exit(1);
    }

    mq_wait_time.tv_sec = 3;
    mq_wait_time.tv_nsec = 0;
}

// Assembly:
subq $0x48, %rsp
leaq 0x3285(%rip), %rdi      # 0x86a0
leaq 0x202e(%rip), %rsi      # 0x7450
callq 0x1200
movq %rax, 0xcfc2(%rip)      # 0x123f0
testq %rax, %rax
je 0x548a
leaq 0x8(%rsp), %rcx
andq $0x0, (%rcx)
movq $0x1, 0x8(%rcx)
movq $0x800, 0x10(%rcx)      # imm = 0x800
andq $0x0, 0x18(%rcx)
leaq 0x32aa(%rip), %rdi      # 0x8702
pushq $0x42
popq %rsi
movl $0x1b0, %edx            # imm = 0x1B0
xorl %eax, %eax
callq 0x11a0
movl %eax, 0xcf8b(%rip)      # 0x123f8
cmpl $-0x1, %eax
je 0x54a7
movq $0x3, 0xcf83(%rip) # 0x12400
andq $0x0, 0xcf83(%rip)      # 0x12408
addq $0x48, %rsp
retq
leaq 0x3238(%rip), %rdi      # 0x86c9
leaq 0x323d(%rip), %rsi      # 0x86d5
leaq 0x324d(%rip), %rcx      # 0x86ec
pushq $0x30
popq %rdx
callq 0x10f0
callq 0x1050
movl (%rax), %esi
leaq 0x325e(%rip), %rdi      # 0x8713
xorl %eax, %eax
callq 0x10e0
pushq $0x1
popq %rdi
callq 0x1260
// File: /workspace/github_c_makefile_star2_O2/sachinites[P]CommandParser/ut/utinfra/ut_parser.c
// Function: tc_append_result
static void
tc_append_result(glthread_t *head, uint16_t step_no, bool pass, bool match) {

    tc_result_t *res = (tc_result_t *)calloc(1, sizeof(tc_result_t));
    res->step_no = step_no;
    res->pass = pass;
    res->pattern_match = match;
    init_glthread(&res->glue);
    glthread_add_last(head, &res->glue);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebx
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x1140
movw %r14w, (%rax)
movb %bpl, 0x2(%rax)
movb %bl, 0x3(%rax)
leaq 0x8(%rax), %rbx
movq %rbx, %rdi
callq 0x67b0
movq %r15, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x683c