LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: qian-jiahong[P]uvncrep017-ws/openbsd_stringfuncs.cpp
// Function: strlcat(char*, char const*, unsigned long)
size_t strlcat(char *dst, const char *src, size_t siz)
{
	char *d = dst;
	const char *s = src;
	size_t n = siz;
	size_t dlen;

	/* Find the end of dst and adjust bytes left but don't go past end */
	while (n-- != 0 && *d != '\0')
		d++;
	dlen = d - dst;
	n = siz - dlen;

	if (n == 0)
		return(dlen + strlen(s));
	while (*s != '\0') {
		if (n != 1) {
			*d++ = *s;
			n--;
		}
		s++;
	}
	*d = '\0';

	return(dlen + (s - src));	/* count does not include NUL */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rcx
movq %rcx, %rax
addq $-0x1, %rax
movq %rax, -0x38(%rbp)
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0x41(%rbp)
je 0x7606
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x760f
jmp 0x761d
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x75dc
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
subq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x7660
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
callq 0x20e0
movq %rax, %rcx
movq -0x50(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x76c3
jmp 0x7662
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x76a6
cmpq $0x1, -0x38(%rbp)
je 0x7698
movq -0x30(%rbp), %rax
movb (%rax), %cl
movq -0x28(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movb %cl, (%rax)
movq -0x38(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x7662
movq -0x28(%rbp), %rax
movb $0x0, (%rax)
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %rdx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)
// File: qian-jiahong[P]uvncrep017-ws/openbsd_stringfuncs.cpp
// Function: strlcpy(char*, char const*, unsigned long)
size_t strlcpy(char *dst, const char *src, size_t siz)
{
	char *d = dst;
	const char *s = src;
	size_t n = siz;

	/* Copy as many bytes as will fit */
	if (n != 0 && --n != 0) {
		do {
			if ((*d++ = *s++) == 0)
				break;
		} while (--n != 0);
	}

	/* Not enough room in dst, add NUL and traverse rest of src */
	if (n == 0) {
		if (siz != 0)
			*d = '\0';		/* NUL-terminate dst */
		while (*s++)
			;
	}

	return(s - src - 1);	/* count does not include NUL */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x7755
movq -0x30(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0x7755
jmp 0x7713
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb (%rax), %al
movq -0x20(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %al, (%rcx)
movsbl %al, %eax
cmpl $0x0, %eax
jne 0x773f
jmp 0x7753
jmp 0x7741
movq -0x30(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x7713
jmp 0x7755
cmpq $0x0, -0x30(%rbp)
jne 0x7784
cmpq $0x0, -0x18(%rbp)
je 0x776a
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
jmp 0x776c
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
cmpb $0x0, (%rax)
je 0x7782
jmp 0x776c
jmp 0x7784
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
subq $0x1, %rax
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: qian-jiahong[P]uvncrep017-ws/iniparser.cpp
// Function: iniparser_getnsec
int iniparser_getnsec(dictionary * d)
{
    int i ;
    int nsec ;

    if (d==NULL) return -1 ;
    nsec=0 ;
    for (i=0 ; i<d->size ; i++) {
        if (d->key[i]==NULL)
            continue ;
        if (strchr(d->key[i], ':')==NULL) {
            nsec ++ ;
        }
    }
    return nsec ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x77bc
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7827
movl $0x0, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x7821
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x14(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x77eb
jmp 0x7816
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movl $0x3a, %esi
callq 0x20c0
cmpq $0x0, %rax
jne 0x7814
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x7816
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x77ca
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
// File: qian-jiahong[P]uvncrep017-ws/iniparser.cpp
// Function: iniparser_getsecname
char * iniparser_getsecname(dictionary * d, int n)
{
    int i ;
    int foundsec ;

    if (d==NULL || n<0) return NULL ;
    foundsec=0 ;
    for (i=0 ; i<d->size ; i++) {
        if (d->key[i]==NULL)
            continue ;
        if (strchr(d->key[i], ':')==NULL) {
            foundsec++ ;
            if (foundsec>n)
                break ;
        }
    }
    if (foundsec<=n) {
        return NULL ;
    }
    return d->key[i] ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x784c
cmpl $0x0, -0x14(%rbp)
jge 0x7859
movq $0x0, -0x8(%rbp)
jmp 0x78f0
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x78ca
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x18(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x7888
jmp 0x78bf
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movl $0x3a, %esi
callq 0x20c0
cmpq $0x0, %rax
jne 0x78bd
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jle 0x78bb
jmp 0x78ca
jmp 0x78bd
jmp 0x78bf
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x7867
movl -0x1c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jg 0x78dc
movq $0x0, -0x8(%rbp)
jmp 0x78f0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/iniparser.cpp
// Function: dictionary_dump(_dictionary_*, _IO_FILE*)
static void dictionary_dump(dictionary *d, FILE *f)
{
    int i;

    if (d==NULL || f==NULL) return;

    for (i=0; i<d->size; i++) {
        if (d->key[i] == NULL)
            continue ;
        if (d->val[i] != NULL) {
            fprintf(f, "[%s]=[%s]\n", d->key[i], d->val[i]);
        } else {
            fprintf(f, "[%s]=UNDEF\n", d->key[i]);
        }
    }

    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x794e
cmpq $0x0, -0x10(%rbp)
jne 0x7953
jmp 0x79fa
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x79f8
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x14(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x797f
jmp 0x79ea
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x14(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x79c6
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
leaq 0x49a1(%rip), %rsi      # 0xc35e
movb $0x0, %al
callq 0x22d0
jmp 0x79e8
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x4988(%rip), %rsi      # 0xc369
movb $0x0, %al
callq 0x22d0
jmp 0x79ea
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x795a
jmp 0x79fa
addq $0x20, %rsp
popq %rbp
retq
// File: qian-jiahong[P]uvncrep017-ws/iniparser.cpp
// Function: iniparser_getstring
char * iniparser_getstring(dictionary * d, char * key, char * def)
{
    char * lc_key ;
    char * sval ;

    if (d==NULL || key==NULL)
        return def ;

    lc_key = strdup(strlwc(key));
    sval = dictionary_get(d, lc_key, def);
    free(lc_key);
    return sval ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x7ca2
cmpq $0x0, -0x18(%rbp)
jne 0x7cac
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x7ce7
movq -0x18(%rbp), %rdi
callq 0x7d00
movq %rax, %rdi
callq 0x2350
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x7db0
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
callq 0x2260
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/iniparser.cpp
// Function: strlwc(char*)
static char * strlwc(char * s)
{
    static char l[ASCIILINESZ+1];
    int i ;

    if (s==NULL) return NULL ;
    memset(l, 0, ASCIILINESZ+1);
    i=0 ;
    while (s[i] && i<ASCIILINESZ) {
        l[i] = (char)tolower((int)s[i]);
        i++ ;
    }
    l[ASCIILINESZ]=(char)0;
    return l ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x7d20
movq $0x0, -0x8(%rbp)
jmp 0x7da1
leaq 0xfc09(%rip), %rdi      # 0x17930
xorl %esi, %esi
movl $0x401, %edx            # imm = 0x401
callq 0x2120
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rcx
movslq -0x14(%rbp), %rdx
xorl %eax, %eax
cmpb $0x0, (%rcx,%rdx)
movb %al, -0x15(%rbp)
je 0x7d5a
cmpl $0x400, -0x14(%rbp)     # imm = 0x400
setl %al
movb %al, -0x15(%rbp)
movb -0x15(%rbp), %al
testb $0x1, %al
jne 0x7d63
jmp 0x7d8f
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movsbl (%rax,%rcx), %edi
callq 0x22e0
movb %al, %dl
movslq -0x14(%rbp), %rcx
leaq 0xfbaf(%rip), %rax      # 0x17930
movb %dl, (%rax,%rcx)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x7d3a
movb $0x0, 0xff9a(%rip)      # 0x17d30
leaq 0xfb93(%rip), %rax      # 0x17930
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/iniparser.cpp
// Function: dictionary_get(_dictionary_*, char*, char*)
static char * dictionary_get(dictionary * d, char * key, char * def)
{
    unsigned    hash ;
    int         i ;

    hash = dictionary_hash(key);
    for (i=0 ; i<d->size ; i++) {
        if (d->key==NULL)
            continue ;
        /* Compare hash */
        if (hash==d->hash[i]) {
            /* Compare string, to avoid hash collisions */
            if (!strcmp(key, d->key[i])) {
                return d->val[i] ;
            }
        }
    }
    return def ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x8a20
movl %eax, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x7e47
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x7df0
jmp 0x7e3c
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
movslq -0x28(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x7e3a
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x22b0
cmpl $0x0, %eax
jne 0x7e38
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x8(%rbp)
jmp 0x7e4f
jmp 0x7e3a
jmp 0x7e3c
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x7dd7
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: qian-jiahong[P]uvncrep017-ws/iniparser.cpp
// Function: iniparser_getboolean
int iniparser_getboolean(dictionary * d, char * key, int notfound)
{
    char    *   c ;
    int         ret ;

    c = iniparser_getstring(d, key, INI_INVALID_KEY);
    if (c==INI_INVALID_KEY) return notfound ;
    if (c[0]=='y' || c[0]=='Y' || c[0]=='1' || c[0]=='t' || c[0]=='T') {
        ret = 1 ;
    } else if (c[0]=='n' || c[0]=='N' || c[0]=='0' || c[0]=='f' || c[0]=='F') {
        ret = 0 ;
    } else {
        ret = notfound ;
    }
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq $-0x1, %rdx
callq 0x7c80
movq %rax, -0x28(%rbp)
movq $-0x1, %rax
cmpq %rax, -0x28(%rbp)
jne 0x7f63
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x7ffb
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x79, %eax
je 0x7f9f
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x59, %eax
je 0x7f9f
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x31, %eax
je 0x7f9f
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x74, %eax
je 0x7f9f
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x54, %eax
jne 0x7fa8
movl $0x1, -0x2c(%rbp)
jmp 0x7ff5
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x6e, %eax
je 0x7fe4
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x4e, %eax
je 0x7fe4
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
je 0x7fe4
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x66, %eax
je 0x7fe4
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x46, %eax
jne 0x7fed
movl $0x0, -0x2c(%rbp)
jmp 0x7ff3
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x7ff5
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/iniparser.cpp
// Function: iniparser_find_entry
int iniparser_find_entry(
    dictionary  *   ini,
    char        *   entry
)
{
    int found=0 ;
    if (iniparser_getstring(ini, entry, INI_INVALID_KEY)!=INI_INVALID_KEY) {
        found = 1 ;
    }
    return found ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq $-0x1, %rdx
callq 0x7c80
movq $-0x1, %rcx
cmpq %rcx, %rax
je 0x804e
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/iniparser.cpp
// Function: dictionary_unset(_dictionary_*, char*)
static void dictionary_unset(dictionary * d, char * key)
{
    unsigned    hash ;
    int         i ;

    hash = dictionary_hash(key);
    for (i=0 ; i<d->size ; i++) {
        if (d->key[i]==NULL)
            continue ;
        /* Compare hash */
        if (hash==d->hash[i]) {
            /* Compare string, to avoid hash collisions */
            if (!strcmp(key, d->key[i])) {
                /* Found key */
                break ;
            }
        }
    }
    if (i>=d->size)
        /* Key not found */
        return ;

    free(d->key[i]);
    d->key[i] = NULL ;
    if (d->val[i]!=NULL) {
        free(d->val[i]);
        d->val[i] = NULL ;
    }
    d->hash[i] = 0 ;
    d->n -- ;
    return ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8a20
movl %eax, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x83b7
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x18(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x8374
jmp 0x83ac
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
movslq -0x18(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x83aa
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x22b0
cmpl $0x0, %eax
jne 0x83a8
jmp 0x83b7
jmp 0x83aa
jmp 0x83ac
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x8353
movl -0x18(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jl 0x83c8
jmp 0x844b
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2260
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x18(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x18(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x842d
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2260
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x18(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x18(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movq -0x8(%rbp), %rax
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/iniparser.cpp
// Function: dictionary_new(int)
static dictionary * dictionary_new(int size)
{
    dictionary *d ;

    /* If no size was specified, allocate space for DICTMINSZ */
    if (size<DICTMINSZ) size=DICTMINSZ ;

    d = (dictionary *)calloc(1, sizeof(dictionary));
    d->size = size ;
    d->val  = (char **)calloc(size, sizeof(char*));
    d->key  = (char **)calloc(size, sizeof(char*));
    d->hash = (unsigned int *)calloc(size, sizeof(unsigned));

    return d;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
cmpl $0x80, -0x4(%rbp)
jge 0x871b
movl $0x80, -0x4(%rbp)
movl $0x1, %edi
movl $0x20, %esi
callq 0x2160
movq %rax, -0x10(%rbp)
movl -0x4(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4(%rax)
movslq -0x4(%rbp), %rdi
movl $0x8, %esi
callq 0x2160
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movslq -0x4(%rbp), %rdi
movl $0x8, %esi
callq 0x2160
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movslq -0x4(%rbp), %rdi
movl $0x4, %esi
callq 0x2160
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: qian-jiahong[P]uvncrep017-ws/iniparser.cpp
// Function: strskp(char*)
static char * strskp(char * s)
{
    char * skip = s;
    if (s==NULL) return NULL ;
    while (isspace((int)*skip) && *skip) skip++;
    return skip ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x87b5
movq $0x0, -0x8(%rbp)
jmp 0x87fb
jmp 0x87b7
movq -0x18(%rbp), %rax
movsbl (%rax), %edi
callq 0x2050
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x19(%rbp)
je 0x87dc
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
setne %al
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %al
testb $0x1, %al
jne 0x87e5
jmp 0x87f3
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x87b7
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/iniparser.cpp
// Function: iniparser_add_entry(_dictionary_*, char*, char*, char*)
static void iniparser_add_entry(
    dictionary * d,
    char * sec,
    char * key,
    char * val)
{
    char longkey[2*ASCIILINESZ+1];

    /* Make a key as section:keyword */
    if (key!=NULL) {
        snprintf(longkey, 2*ASCIILINESZ+1, "%s:%s", sec, key);
    } else {
        strlcpy(longkey, sec, 2*ASCIILINESZ+1);
    }

    /* Add (key,val) to dictionary */
    dictionary_set(d, longkey, val);
    return ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x830, %rsp            # imm = 0x830
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x8856
leaq -0x830(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %r8
movl $0x801, %esi            # imm = 0x801
leaq 0x3b28(%rip), %rdx      # 0xc375
movb $0x0, %al
callq 0x2320
jmp 0x886b
leaq -0x830(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x801, %edx            # imm = 0x801
callq 0x76d0
movq -0x8(%rbp), %rdi
leaq -0x830(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x80a0
addq $0x830, %rsp            # imm = 0x830
popq %rbp
retq
nopl (%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/iniparser.cpp
// Function: strcrop(char*)
static char * strcrop(char * s)
{
    static char l[ASCIILINESZ+1];
    char * last ;

    if (s==NULL) return NULL ;
    memset(l, 0, ASCIILINESZ+1);
    strlcpy(l, s, ASCIILINESZ+1);
    last = l + strlen(l);
    while (last > l) {
        if (!isspace((int)*(last-1)))
            break ;
        last -- ;
    }
    *last = (char)0;
    return l ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x88b0
movq $0x0, -0x8(%rbp)
jmp 0x8936
leaq 0xf489(%rip), %rdi      # 0x17d40
xorl %esi, %esi
movl $0x401, %edx            # imm = 0x401
callq 0x2120
movq -0x10(%rbp), %rsi
leaq 0xf472(%rip), %rdi      # 0x17d40
movl $0x401, %edx            # imm = 0x401
callq 0x76d0
leaq 0xf461(%rip), %rdi      # 0x17d40
callq 0x20e0
movq %rax, %rcx
leaq 0xf452(%rip), %rax      # 0x17d40
addq %rcx, %rax
movq %rax, -0x18(%rbp)
leaq 0xf444(%rip), %rax      # 0x17d40
cmpq %rax, -0x18(%rbp)
jbe 0x8924
movq -0x18(%rbp), %rax
movsbl -0x1(%rax), %edi
callq 0x2050
cmpl $0x0, %eax
jne 0x8916
jmp 0x8924
movq -0x18(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x88f5
movq -0x18(%rbp), %rax
movb $0x0, (%rax)
leaq 0xf40e(%rip), %rax      # 0x17d40
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
// File: qian-jiahong[P]uvncrep017-ws/iniparser.cpp
// Function: dictionary_del(_dictionary_*)
static void dictionary_del(dictionary * d)
{
    int     i ;

    if (d==NULL) return ;
    for (i=0 ; i<d->size ; i++) {
        if (d->key[i]!=NULL)
            free(d->key[i]);
        if (d->val[i]!=NULL)
            free(d->val[i]);
    }
    free(d->val);
    free(d->key);
    free(d->hash);
    free(d);

    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x8978
jmp 0x8a18
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x89e8
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x89b3
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2260
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x89db
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2260
jmp 0x89dd
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x897f
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2260
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2260
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x2260
movq -0x8(%rbp), %rdi
callq 0x2260
addq $0x10, %rsp
popq %rbp
retq
nop
// File: qian-jiahong[P]uvncrep017-ws/iniparser.cpp
// Function: dictionary_hash(char*)
static unsigned dictionary_hash(char * key)
{
    int         len ;
    unsigned    hash ;
    int         i ;

    len = strlen(key);
    for (hash=0, i=0 ; i<len ; i++) {
        hash += (unsigned)key[i] ;
        hash += (hash<<10);
        hash ^= (hash>>6) ;
    }
    hash += (hash <<3);
    hash ^= (hash >>11);
    hash += (hash <<15);
    return hash ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x20e0
movl %eax, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x8a83
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
movsbl (%rax,%rcx), %eax
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
shll $0xa, %eax
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
shrl $0x6, %eax
xorl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x8a46
movl -0x10(%rbp), %eax
shll $0x3, %eax
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
shrl $0xb, %eax
xorl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
shll $0xf, %eax
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
// File: qian-jiahong[P]uvncrep017-ws/iniparser.cpp
// Function: mem_double(void*, int)
static void * mem_double(void * ptr, int size)
{
    void *newptr;

    newptr = calloc(2*size, 1);
    memcpy(newptr, ptr, size);
    free(ptr);
    return newptr ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl -0xc(%rbp), %eax
shll %eax
movslq %eax, %rdi
movl $0x1, %esi
callq 0x2160
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rsi
movslq -0xc(%rbp), %rdx
callq 0x21b0
movq -0x8(%rbp), %rdi
callq 0x2260
movq -0x18(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeaterutil.cpp
// Function: getAddrPartsFromString(char*)
addrParts getAddrPartsFromString(char *ipString)
{
    addrParts addr; 
    char tmpBuf[MY_TMP_BUF_LEN + 1];
    int ipVal[4] = {255,255,255,255};
    char *p;
    char *start;
    long value;
    int ii;
    
    strlcpy(tmpBuf, ipString, MY_TMP_BUF_LEN + 1);
    strlcat(tmpBuf, ".", MY_TMP_BUF_LEN + 1);
    start = tmpBuf;
    
    for(ii = 0; ii < 4; ii++) {
        p = strchr(start, '.');
        if (p != NULL) {
            *p = '\0';
            
            value = strtol(start, NULL, 10);
            
            if ((value < 0) || (value > 255)) 
                ipVal[ii] = 255;
            else
                ipVal[ii] = value;

            start = p;
            start++;
        }
        else {
            ipVal[ii] = 255;
        }
    }
    
    addr.a = ipVal[0];
    addr.b = ipVal[1];
    addr.c = ipVal[2];
    addr.d = ipVal[3];
    
    return addr;    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x18(%rbp)
movq 0x35da(%rip), %rax      # 0xc530
movq %rax, -0x130(%rbp)
movq 0x35d4(%rip), %rax      # 0xc538
movq %rax, -0x128(%rbp)
leaq -0x120(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x76d0
leaq -0x120(%rbp), %rdi
leaq 0x35b2(%rip), %rsi      # 0xc540
movl $0x100, %edx            # imm = 0x100
callq 0x75b0
leaq -0x120(%rbp), %rax
movq %rax, -0x140(%rbp)
movl $0x0, -0x14c(%rbp)
cmpl $0x4, -0x14c(%rbp)
jge 0x9095
movq -0x140(%rbp), %rdi
movl $0x2e, %esi
callq 0x20c0
movq %rax, -0x138(%rbp)
cmpq $0x0, -0x138(%rbp)
je 0x906d
movq -0x138(%rbp), %rax
movb $0x0, (%rax)
movq -0x140(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x22c0
movq %rax, -0x148(%rbp)
cmpq $0x0, -0x148(%rbp)
jl 0x9020
cmpq $0xff, -0x148(%rbp)
jle 0x9034
movslq -0x14c(%rbp), %rax
movl $0xff, -0x130(%rbp,%rax,4)
jmp 0x904b
movq -0x148(%rbp), %rax
movl %eax, %ecx
movslq -0x14c(%rbp), %rax
movl %ecx, -0x130(%rbp,%rax,4)
movq -0x138(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x140(%rbp)
jmp 0x907f
movslq -0x14c(%rbp), %rax
movl $0xff, -0x130(%rbp,%rax,4)
jmp 0x9081
movl -0x14c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14c(%rbp)
jmp 0x8fb0
movl -0x130(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x12c(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x128(%rbp), %eax
movl %eax, -0x8(%rbp)
movl -0x124(%rbp), %eax
movl %eax, -0x4(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rdx
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nopw (%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeaterevents.cpp
// Function: sendRepeaterEvent(repeaterEvent)
bool sendRepeaterEvent(repeaterEvent ev)
{
    if (!isFifoFull()) {
        //Add timestamp
        ev.timeStamp = time(NULL);
        
        eventFifo[fifoHeadInd] = ev;
        
        fifoHeadInd = advanceFifoIndex(fifoHeadInd);
        
        itemsInFifo++;
        
        return true;
    }
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
callq 0x91b0
testb $0x1, %al
jne 0x919f
xorl %eax, %eax
movl %eax, %edi
callq 0x21e0
movq -0x10(%rbp), %rsi
movq %rax, 0x8(%rsi)
movslq 0xf19f(%rip), %rax      # 0x18300
leaq 0xf1a8(%rip), %rdi      # 0x18310
imulq $0x78, %rax, %rax
addq %rax, %rdi
movl $0x78, %edx
callq 0x21b0
movl 0xf181(%rip), %edi      # 0x18300
callq 0x91d0
movl %eax, 0xf176(%rip)      # 0x18300
movl 0xf178(%rip), %eax      # 0x18308
addl $0x1, %eax
movl %eax, 0xf16f(%rip)      # 0x18308
movb $0x1, -0x1(%rbp)
jmp 0x91a3
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x10, %rsp
popq %rbp
retq
nop
// File: qian-jiahong[P]uvncrep017-ws/repeaterevents.cpp
// Function: advanceFifoIndex(int)
static int advanceFifoIndex(int index)
{
    if (index < (MAX_FIFO_EVENTS-1)) 
        index++;
    else
        index = 0;
    
    return index;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x4(%rbp)
cmpl $0x1f3, -0x4(%rbp)      # imm = 0x1F3
jge 0x91eb
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x91f2
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw (%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeaterevents.cpp
// Function: handleRepeaterEvents()
void handleRepeaterEvents(void)
{
    pid_t pid;
    
    if (0 == eventProc) {
        //Event posting process is not running, create one if events in fifo
        if (!isFifoEmpty()) {
            //fork doEvent
            pid = fork();
            if (-1 == pid) {
                //fork failed. This is so unfair. Exit and blame Linus ;-)
                fatal(LEVEL_0, "handleRepeaterEvents(): fork() failed. Linus, this is *so* unfair\n");
            }
            else if (0 == pid) {
                //child code
                debug(LEVEL_3, "handleRepeaterEvents(): in child process, starting doEventWork()\n");
                exit(doEventWork());
            }
            else {
                //parent code
                //Store child pid to variable eventProc so we can
                //properly clean up after child has exited
                eventProc = pid;
                
                //Clean parent process' fifo
                clearFifo();
            }
        }
    }
    else {
        //Event-sending process is running, check if run has ended
        cleanUpAfterEventProc();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
xorl %eax, %eax
cmpl 0x1db60(%rip), %eax     # 0x26d70
jne 0x927b
callq 0x9290
testb $0x1, %al
jne 0x9279
callq 0x2080
movl %eax, -0x4(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl -0x4(%rbp), %eax
jne 0x9241
xorl %eax, %eax
movl %eax, %edi
leaq 0x330a(%rip), %rsi      # 0xc542
movb $0x0, %al
callq 0x2610
jmp 0x9277
xorl %eax, %eax
cmpl -0x4(%rbp), %eax
jne 0x9267
movl $0x3, %edi
leaq 0x3331(%rip), %rsi      # 0xc585
movb $0x0, %al
callq 0x2480
callq 0x92b0
movl %eax, %edi
callq 0x2270
movl -0x4(%rbp), %eax
movl %eax, 0x1db00(%rip)     # 0x26d70
callq 0x90d0
jmp 0x9277
jmp 0x9279
jmp 0x9280
callq 0x9750
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: qian-jiahong[P]uvncrep017-ws/repeaterevents.cpp
// Function: cleanUpAfterEventProc()
static void cleanUpAfterEventProc(void)
{
    pid_t pid;
    
    if (eventProc != 0) {
        pid = waitpid(eventProc, NULL, WNOHANG);
        if (pid > 0) {
            debug(LEVEL_3, "cleanUpAfterEventProc(): Removing event posting process (pid=%d)\n", pid);
            eventProc = 0;
        }
    } 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
cmpl $0x0, 0x1d611(%rip)     # 0x26d70
je 0x97a0
movl 0x1d609(%rip), %edi     # 0x26d70
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0x2190
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jle 0x979e
movl -0x4(%rbp), %edx
movl $0x3, %edi
leaq 0x305e(%rip), %rsi      # 0xc7eb
movb $0x0, %al
callq 0x2480
movl $0x0, 0x1d5d2(%rip)     # 0x26d70
jmp 0x97a0
addq $0x10, %rsp
popq %rbp
retq
// File: iZhangHui[P]CppPrimer/CH03_StringsVectorsAndArrays/examples/string_io2.cc
// Function: main
int main()
{
	string s1, s2;

	cin >> s1 >> s2; // read first input into s1, second into s2
	cout << s1 << s2 << endl; // write both strings

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl $0x0, -0x4(%rbp)
leaq -0x28(%rbp), %rdi
movq %rdi, -0x68(%rbp)
callq 0x1080
leaq -0x48(%rbp), %rdi
callq 0x1080
movq -0x68(%rbp), %rsi
movq 0x2dbd(%rip), %rdi      # 0x3fe0
callq 0x1070
movq %rax, -0x60(%rbp)
jmp 0x122e
movq -0x60(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x1070
jmp 0x123d
movq 0x2d8c(%rip), %rdi      # 0x3fd0
leaq -0x28(%rbp), %rsi
callq 0x1050
movq %rax, -0x70(%rbp)
jmp 0x1253
movq -0x70(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x1050
movq %rax, -0x78(%rbp)
jmp 0x1266
movq -0x78(%rbp), %rdi
movq 0x2d4f(%rip), %rsi      # 0x3fc0
callq 0x1060
jmp 0x1278
movl $0x0, -0x4(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x1030
leaq -0x28(%rbp), %rdi
callq 0x1030
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x1030
leaq -0x28(%rbp), %rdi
callq 0x1030
movq -0x50(%rbp), %rdi
callq 0x10a0
// File: zhengwangsun[P]pas2c/main.cpp
// Function: main
int main()
{
	lexAnalysis(); 
      
    bool t=GrammarAnalysis();

	cout<<"语法分析结果:";
	if(t)
	  cout<<"Success!"<<endl;
	else 
	  cout<<"Failed!"<<endl;
	  
	semantics();
	cout<<"语义翻译结束!"<<endl; 
    print();
	cout<<"翻译结果写入到out.c成功!"<<endl;  
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x4(%rbp)
callq 0x8b20
callq 0x17f10
andb $0x1, %al
movb %al, -0x5(%rbp)
movq 0x1d933(%rip), %rdi     # 0x25fc8
leaq 0x159f0(%rip), %rsi     # 0x1e08c
callq 0x3280
testb $0x1, -0x5(%rbp)
je 0x86cb
movq 0x1d91a(%rip), %rdi     # 0x25fc8
leaq 0x159eb(%rip), %rsi     # 0x1e0a0
callq 0x3280
movq %rax, %rdi
movq 0x1d8ec(%rip), %rsi     # 0x25fb0
callq 0x32b0
jmp 0x86ed
movq 0x1d8f6(%rip), %rdi     # 0x25fc8
leaq 0x159d0(%rip), %rsi     # 0x1e0a9
callq 0x3280
movq %rax, %rdi
movq 0x1d8c8(%rip), %rsi     # 0x25fb0
callq 0x32b0
callq 0xc9e0
movq 0x1d8cf(%rip), %rdi     # 0x25fc8
leaq 0x159b1(%rip), %rsi     # 0x1e0b1
callq 0x3280
movq %rax, %rdi
movq 0x1d8a1(%rip), %rsi     # 0x25fb0
callq 0x32b0
callq 0x85b0
movq 0x1d8a8(%rip), %rdi     # 0x25fc8
leaq 0x1599e(%rip), %rsi     # 0x1e0c5
callq 0x3280
movq %rax, %rdi
movq 0x1d87a(%rip), %rsi     # 0x25fb0
callq 0x32b0
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: zhengwangsun[P]pas2c/lex.cpp
// Function: judgeKeyword(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int judgeKeyword(string str)
{
	//注意大小写不敏感,将所有的都转化为小写 
	transform(str.begin(),str.end(),str.begin(), ::tolower);
	for(int i=0;i<24;i++)
	   if(str==keyword[i])
	      return i;   
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x40(%rbp)
movq %rdi, -0x10(%rbp)
callq 0x3240
movq -0x40(%rbp), %rdi
movq %rax, -0x18(%rbp)
callq 0x3150
movq -0x40(%rbp), %rdi
movq %rax, -0x20(%rbp)
callq 0x3240
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq 0x1b32a(%rip), %rcx     # 0x25fd0
callq 0xc7c0
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
cmpl $0x18, -0x34(%rbp)
jge 0xacf2
movq -0x40(%rbp), %rdi
movslq -0x34(%rbp), %rax
leaq 0x1b8e5(%rip), %rsi     # 0x265b0
shlq $0x5, %rax
addq %rax, %rsi
callq 0xc840
testb $0x1, %al
jne 0xacdd
jmp 0xace5
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xacf9
jmp 0xace7
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xacb6
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: zhengwangsun[P]pas2c/semantics.cpp
// Function: semantics()
void semantics()
{
    if(lookahead(0) == 1)
    {
        currentTable = "main";
        //子节点program_head是根节点program的第0个子节点，
        //在child数组中下标为0,实参为该子节点在树中node的下标
        program_head(tree.node[0].child[0]);
        
        //子节点program_body 是根节点program的第1子节点，在child数组中下标为1
        program_body(tree.node[0].child[1]);
    }
    else
        cout<<"semantics error"<<endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorl %edi, %edi
callq 0xca50
cmpl $0x1, %eax
jne 0xca23
leaq 0xb2f81(%rip), %rdi     # 0xbf978
leaq 0x11abc(%rip), %rsi     # 0x1e4ba
callq 0x3380
leaq 0xb972e(%rip), %rax     # 0xc6138
movl 0xc(%rax), %edi
callq 0xcac0
leaq 0xb971f(%rip), %rax     # 0xc6138
movl 0x10(%rax), %edi
callq 0xcb30
jmp 0xca45
movq 0x1959e(%rip), %rdi     # 0x25fc8
leaq 0x11a8e(%rip), %rsi     # 0x1e4bf
callq 0x3280
movq %rax, %rdi
movq 0x19570(%rip), %rsi     # 0x25fb0
callq 0x32b0
popq %rbp
retq
nopw (%rax,%rax)
// File: zhengwangsun[P]pas2c/semantics.cpp
// Function: program_body(int)
void program_body(int k)
{
	TreeNode tNode= tree.node[k];
    if (lookahead(k) == 5)//5是declarations
    {
        declarations(tree.node[k].child[0]);

        subprogram_declarations(tree.node[k].child[1]);
        
        code[currentLine++].append("int main()\n");
		code[currentLine++].append("{\n");
		
        compound_statement(tree.node[k].child[2]);
        code[currentLine++].append("return 0;\n");
        code[currentLine++].append("}\n");
        
    }
    else
        cout<<"program_body error!"<<endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movl %edi, -0x4(%rbp)
movslq -0x4(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb95e8(%rip), %rax     # 0xc6138
leaq 0x8(%rax,%rcx), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x14920
movl -0x4(%rbp), %edi
callq 0xca50
movl %eax, -0xc0(%rbp)
jmp 0xcb71
movl -0xc0(%rbp), %eax
cmpl $0x5, %eax
jne 0xccad
movslq -0x4(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb95a6(%rip), %rax     # 0xc6138
movl 0xc(%rax,%rcx), %edi
callq 0xe6d0
jmp 0xcb9d
movslq -0x4(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb9589(%rip), %rax     # 0xc6138
movl 0x10(%rax,%rcx), %edi
callq 0xe800
jmp 0xcbba
movslq 0xb3a5f(%rip), %rax     # 0xc0620
movl %eax, %ecx
incl %ecx
movl %ecx, 0xb3a55(%rip)     # 0xc0620
shlq $0x5, %rax
leaq 0xb2dca(%rip), %rdi     # 0xbf9a0
addq %rax, %rdi
leaq 0x119d4(%rip), %rsi     # 0x1e5b4
callq 0x3490
jmp 0xcbe7
movslq 0xb3a32(%rip), %rax     # 0xc0620
movl %eax, %ecx
incl %ecx
movl %ecx, 0xb3a28(%rip)     # 0xc0620
shlq $0x5, %rax
leaq 0xb2d9d(%rip), %rdi     # 0xbf9a0
addq %rax, %rdi
leaq 0x11a05(%rip), %rsi     # 0x1e612
callq 0x3490
jmp 0xcc14
movslq -0x4(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb9512(%rip), %rax     # 0xc6138
movl 0x14(%rax,%rcx), %edi
callq 0xe870
jmp 0xcc31
movslq 0xb39e8(%rip), %rax     # 0xc0620
movl %eax, %ecx
incl %ecx
movl %ecx, 0xb39de(%rip)     # 0xc0620
shlq $0x5, %rax
leaq 0xb2d53(%rip), %rdi     # 0xbf9a0
addq %rax, %rdi
leaq 0x11969(%rip), %rsi     # 0x1e5c0
callq 0x3490
jmp 0xcc5e
movslq 0xb39bb(%rip), %rax     # 0xc0620
movl %eax, %ecx
incl %ecx
movl %ecx, 0xb39b1(%rip)     # 0xc0620
shlq $0x5, %rax
leaq 0xb2d26(%rip), %rdi     # 0xbf9a0
addq %rax, %rdi
leaq 0x11947(%rip), %rsi     # 0x1e5cb
callq 0x3490
jmp 0xcc8b
jmp 0xcce0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x14a90
jmp 0xccf5
movq 0x19314(%rip), %rdi     # 0x25fc8
leaq 0x11913(%rip), %rsi     # 0x1e5ce
callq 0x3280
movq %rax, -0xc8(%rbp)
jmp 0xccc9
movq -0xc8(%rbp), %rdi
movq 0x192d9(%rip), %rsi     # 0x25fb0
callq 0x32b0
jmp 0xccde
jmp 0xcce0
leaq -0xb0(%rbp), %rdi
callq 0x14a90
addq $0xd0, %rsp
popq %rbp
retq
movq -0xb8(%rbp), %rdi
callq 0x3450
nopw %cs:(%rax,%rax)
// File: zhengwangsun[P]pas2c/semantics.cpp
// Function: enterMain(int, int)
void enterMain(int position, int type)//将新id添加到主符号表
{
    if (isDefined(position) == 1) {
        cout<<"double defined when enterMain"<<endl;
    }
    else
    {
        //新建一个Tuple
        Tuple newTuple;
        
        //初始化Tuple
        newTuple.name = tree.node[position].value;
        newTuple.type = type;
        newTuple.demension = demension;

        newTuple.declareRow = tree.node[position].row;

        if (isArray == 1)
        {
            newTuple.isArray = 1;
            demension = 0;//目前只用在数组判断了
        }
        
        mainTable.push_back(newTuple);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl -0x4(%rbp), %edi
callq 0xda80
cmpl $0x1, %eax
jne 0xd272
movq 0x18d76(%rip), %rdi     # 0x25fc8
leaq 0x11a41(%rip), %rsi     # 0x1ec9a
callq 0x3280
movq %rax, %rdi
movq 0x18d48(%rip), %rsi     # 0x25fb0
callq 0x32b0
jmp 0xd323
leaq -0x58(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x14ef0
movq -0x70(%rbp), %rdi
movslq -0x4(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb8ea3(%rip), %rax     # 0xc6138
leaq 0x88(%rax,%rcx), %rsi
callq 0x3030
jmp 0xd2a4
movl -0x8(%rbp), %eax
movl %eax, -0x38(%rbp)
movl 0xb26ec(%rip), %eax     # 0xbf99c
movl %eax, -0x34(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0xb8e7a(%rip), %rax     # 0xc6138
addq $0x8, %rax
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movl 0xa4(%rax), %eax
movl %eax, -0x30(%rbp)
cmpl $0x1, 0xb26bc(%rip)     # 0xbf998
jne 0xd308
movl $0x1, -0x10(%rbp)
movl $0x0, 0xb26ad(%rip)     # 0xbf99c
jmp 0xd308
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x14f90
jmp 0xd329
leaq 0xb2621(%rip), %rdi     # 0xbf930
leaq -0x58(%rbp), %rsi
callq 0x14f20
jmp 0xd31a
leaq -0x58(%rbp), %rdi
callq 0x14f90
addq $0x70, %rsp
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x3450
nopw %cs:(%rax,%rax)
// File: zhengwangsun[P]pas2c/semantics.cpp
// Function: addReadType(int)
void addReadType(int type)
{
	switch(type)
	{
		case 1: //int 
			code[currentLine].append("scanf(\"%d\",&" );
			break;
		case 2: //real 
			code[currentLine].append("scanf(\"%f\",&" );
			break;
		default:
			break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x8(%rbp)
subl $0x1, %eax
je 0xe5e2
jmp 0xe5d8
movl -0x8(%rbp), %eax
subl $0x2, %eax
je 0xe605
jmp 0xe628
movslq 0xb2037(%rip), %rax     # 0xc0620
leaq 0xb13b0(%rip), %rdi     # 0xbf9a0
shlq $0x5, %rax
addq %rax, %rdi
leaq 0xff57(%rip), %rsi      # 0x1e555
callq 0x3490
jmp 0xe62a
movslq 0xb2014(%rip), %rax     # 0xc0620
leaq 0xb138d(%rip), %rdi     # 0xbf9a0
shlq $0x5, %rax
addq %rax, %rdi
leaq 0xff41(%rip), %rsi      # 0x1e562
callq 0x3490
jmp 0xe62a
jmp 0xe62a
addq $0x10, %rsp
popq %rbp
retq
// File: zhengwangsun[P]pas2c/semantics.cpp
// Function: appendIDType(int)
void appendIDType(int type)
{
	switch (type)
	{
		case 1: //int 
			code[currentLine].append("int ");
			break;
		case 2: //real 
			code[currentLine].append("float ");
			break;
		case 3: //boolean 
			code[currentLine].append("boolean ");
			break;
		default:
			break;
	}	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x8(%rbp)
subl $0x1, %eax
je 0xe65c
jmp 0xe648
movl -0x8(%rbp), %eax
subl $0x2, %eax
je 0xe67f
jmp 0xe652
movl -0x8(%rbp), %eax
subl $0x3, %eax
je 0xe6a2
jmp 0xe6c5
movslq 0xb1fbd(%rip), %rax     # 0xc0620
leaq 0xb1336(%rip), %rdi     # 0xbf9a0
shlq $0x5, %rax
addq %rax, %rdi
leaq 0xfec8(%rip), %rsi      # 0x1e540
callq 0x3490
jmp 0xe6c7
movslq 0xb1f9a(%rip), %rax     # 0xc0620
leaq 0xb1313(%rip), %rdi     # 0xbf9a0
shlq $0x5, %rax
addq %rax, %rdi
leaq 0xfeaa(%rip), %rsi      # 0x1e545
callq 0x3490
jmp 0xe6c7
movslq 0xb1f77(%rip), %rax     # 0xc0620
leaq 0xb12f0(%rip), %rdi     # 0xbf9a0
shlq $0x5, %rax
addq %rax, %rdi
leaq 0xfe8e(%rip), %rsi      # 0x1e54c
callq 0x3490
jmp 0xe6c7
jmp 0xe6c7
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: zhengwangsun[P]pas2c/semantics.cpp
// Function: declarations(int)
void declarations(int k)
{
	TreeNode tNode= tree.node[k]; 
	TreeNode childNode;
	
    if (lookahead(k) == 107)//107是var
    {
        declaration(tree.node[k].child[1]);
    }
    else if (lookahead(k) == 106)//e
    {}
    else
        cout<<"declarations error!"<<endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movl %edi, -0x4(%rbp)
movslq -0x4(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb7a48(%rip), %rax     # 0xc6138
leaq 0x8(%rax,%rcx), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x14920
leaq -0x158(%rbp), %rdi
callq 0x149d0
movl -0x4(%rbp), %edi
callq 0xca50
movl %eax, -0x168(%rbp)
jmp 0xe71d
movl -0x168(%rbp), %eax
cmpl $0x6b, %eax
jne 0xe773
movslq -0x4(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb79fe(%rip), %rax     # 0xc6138
movl 0x10(%rax,%rcx), %edi
callq 0xe9c0
jmp 0xe745
jmp 0xe7c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x160(%rbp)
movl %eax, -0x164(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x14a90
leaq -0xb0(%rbp), %rdi
callq 0x14a90
jmp 0xe7e6
movl -0x4(%rbp), %edi
callq 0xca50
movl %eax, -0x16c(%rbp)
jmp 0xe783
movl -0x16c(%rbp), %eax
cmpl $0x6a, %eax
jne 0xe790
jmp 0xe7c3
movq 0x17831(%rip), %rdi     # 0x25fc8
leaq 0xfea3(%rip), %rsi      # 0x1e641
callq 0x3280
movq %rax, -0x178(%rbp)
jmp 0xe7ac
movq -0x178(%rbp), %rdi
movq 0x177f6(%rip), %rsi     # 0x25fb0
callq 0x32b0
jmp 0xe7c1
jmp 0xe7c3
jmp 0xe7c5
leaq -0x158(%rbp), %rdi
callq 0x14a90
leaq -0xb0(%rbp), %rdi
callq 0x14a90
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
movq -0x160(%rbp), %rdi
callq 0x3450
nopw %cs:(%rax,%rax)
// File: zhengwangsun[P]pas2c/semantics.cpp
// Function: compound_statement(int)
void compound_statement(int k)
{
	TreeNode tNode= tree.node[k];
    if(lookahead(k) == 121)//121是begin
    {
    	code[currentLine].append("\n");
		currentLine++;
        optional_statements(tree.node[k].child[1]);
        code[currentLine].append("\n");
		currentLine++;
    }
    else
        cout<<"compound_statement error!"<<endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movl %edi, -0x4(%rbp)
movslq -0x4(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb78a8(%rip), %rax     # 0xc6138
leaq 0x8(%rax,%rcx), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x14920
movl -0x4(%rbp), %edi
callq 0xca50
movl %eax, -0xc0(%rbp)
jmp 0xe8b1
movl -0xc0(%rbp), %eax
cmpl $0x79, %eax
jne 0xe962
movslq 0xb1d59(%rip), %rax     # 0xc0620
shlq $0x5, %rax
leaq 0xb10ce(%rip), %rdi     # 0xbf9a0
addq %rax, %rdi
leaq 0xfce2(%rip), %rsi      # 0x1e5be
callq 0x3490
jmp 0xe8e3
movl 0xb1d37(%rip), %eax     # 0xc0620
incl %eax
movl %eax, 0xb1d2f(%rip)     # 0xc0620
movslq -0x4(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb7835(%rip), %rax     # 0xc6138
movl 0x10(%rax,%rcx), %edi
callq 0x102e0
jmp 0xe90e
movslq 0xb1d0b(%rip), %rax     # 0xc0620
shlq $0x5, %rax
leaq 0xb1080(%rip), %rdi     # 0xbf9a0
addq %rax, %rdi
leaq 0xfc94(%rip), %rsi      # 0x1e5be
callq 0x3490
jmp 0xe931
movl 0xb1ce9(%rip), %eax     # 0xc0620
addl $0x1, %eax
movl %eax, 0xb1ce0(%rip)     # 0xc0620
jmp 0xe995
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x14a90
jmp 0xe9aa
movq 0x1765f(%rip), %rdi     # 0x25fc8
leaq 0xfdc5(%rip), %rsi      # 0x1e735
callq 0x3280
movq %rax, -0xc8(%rbp)
jmp 0xe97e
movq -0xc8(%rbp), %rdi
movq 0x17624(%rip), %rsi     # 0x25fb0
callq 0x32b0
jmp 0xe993
jmp 0xe995
leaq -0xb0(%rbp), %rdi
callq 0x14a90
addq $0xd0, %rsp
popq %rbp
retq
movq -0xb8(%rbp), %rdi
callq 0x3450
nopw %cs:(%rax,%rax)