LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]spiped/liball/../lib/util/graceful_shutdown.c
// Function: graceful_shutdown
static int
graceful_shutdown(void * cookie)
{

	(void)cookie; /* UNUSED */

	/* This timer has expired. */
	timer_cookie = NULL;

	/* Use the callback function, or schedule another check in 1 second. */
	if (should_shutdown) {
		if (begin_shutdown(caller_cookie) != 0) {
			warn0("Failed to begin shutdown");
			goto err0;
		}

		/* Restore original SIGTERM handler. */
		if (signal(SIGTERM, sighandler_sigterm_orig) == SIG_ERR)
			warnp("Failed to restore original SIGTERM handler");
	} else {
		if ((timer_cookie = events_timer_register_double(
		    graceful_shutdown, NULL, 1.0)) == NULL) {
			warnp("Failed to register the graceful shutdown timer");
			goto err0;
		}
	}

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq $0x0, 0x1dbc1(%rip) # 0x28858
cmpl $0x0, 0x1dbc2(%rip)     # 0x28860
je 0xacd4
movq 0x1dba1(%rip), %rdi     # 0x28848
callq *0x1db93(%rip)          # 0x28840
testl %eax, %eax
je 0xad1f
leaq 0x7647(%rip), %rdi      # 0x122ff
xorl %eax, %eax
callq 0x8e37
callq 0x3480
movl $0x0, (%rax)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0xad81
leaq -0x53(%rip), %rdi       # 0xac88
xorl %ebx, %ebx
movsd 0x69ab(%rip), %xmm0     # 0x11690
xorl %esi, %esi
callq 0x6628
movq %rax, 0x1db65(%rip)     # 0x28858
testq %rax, %rax
jne 0xad81
callq 0x3480
cmpl $0x0, (%rax)
je 0xad5e
movq %rax, %rbx
leaq 0x754f(%rip), %rdi      # 0x1225f
xorl %eax, %eax
callq 0x8d18
movl $0x0, (%rbx)
jmp 0xacca
movq 0x1db2a(%rip), %rsi     # 0x28850
movl $0xf, %edi
callq 0x3050
xorl %ebx, %ebx
cmpq $-0x1, %rax
jne 0xad81
callq 0x3480
cmpl $0x0, (%rax)
je 0xad71
movq %rax, %r14
leaq 0x75cc(%rip), %rdi      # 0x12318
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x8d18
movl $0x0, (%r14)
jmp 0xad81
leaq 0x74fa(%rip), %rdi      # 0x1225f
xorl %eax, %eax
callq 0x8e37
jmp 0xacca
leaq 0x75a0(%rip), %rdi      # 0x12318
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x8e37
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]spiped/liball/../lib/util/graceful_shutdown.c
// Function: graceful_shutdown_manual
void
graceful_shutdown_manual(void)
{

	/* Sanity check: we must be initialized. */
	assert(begin_shutdown != NULL);
	assert(caller_cookie != NULL);

	/* Stop the timer. */
	if (timer_cookie != NULL) {
		events_timer_cancel(timer_cookie);
		timer_cookie = NULL;
	}

	/* Shut down. */
	should_shutdown = 1;
	graceful_shutdown(NULL);
}

// Assembly:
pushq %rax
cmpq $0x0, 0x1daac(%rip)     # 0x28840
je 0xadcc
cmpq $0x0, 0x1daaa(%rip)     # 0x28848
je 0xadeb
movq 0x1dab1(%rip), %rdi     # 0x28858
testq %rdi, %rdi
je 0xadbc
callq 0x665d
movq $0x0, 0x1da9c(%rip) # 0x28858
movl $0x1, 0x1da9a(%rip)     # 0x28860
popq %rax
jmp 0xac88
leaq 0x74bb(%rip), %rdi      # 0x1228e
leaq 0x74cb(%rip), %rsi      # 0x122a5
leaq 0x74e4(%rip), %rcx      # 0x122c5
movl $0x7d, %edx
callq 0x3150
leaq 0x74f7(%rip), %rdi      # 0x122e9
leaq 0x74ac(%rip), %rsi      # 0x122a5
leaq 0x74c5(%rip), %rcx      # 0x122c5
movl $0x7e, %edx
callq 0x3150
nop
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/md5.c
// Function: md5_starts
void md5_starts( md5_context *ctx )
{
    ctx->total[0] = 0;
    ctx->total[1] = 0;

    ctx->state[0] = 0x67452301;
    ctx->state[1] = 0xEFCDAB89;
    ctx->state[2] = 0x98BADCFE;
    ctx->state[3] = 0x10325476;
}

// Assembly:
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x67452301, 0x10(%rdi) # imm = 0x67452301
movl $0x98badcfe, %eax       # imm = 0x98BADCFE
leaq 0x5712ce8b(%rax), %rcx
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
movq $0x10325476, 0x28(%rdi) # imm = 0x10325476
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/md5.c
// Function: md5_update
void md5_update( md5_context *ctx, const unsigned char *input, int ilen )
{
    int fill;
    unsigned long left;

    if( ilen <= 0 )
        return;

    left = ctx->total[0] & 0x3F;
    fill = 64 - left;

    ctx->total[0] += ilen;
    ctx->total[0] &= 0xFFFFFFFF;

    if( ctx->total[0] < (unsigned long) ilen )
        ctx->total[1]++;

    if( left && ilen >= fill )
    {
        memcpy( (void *) (ctx->buffer + left),
                (void *) input, fill );
        md5_process( ctx, ctx->buffer );
        input += fill;
        ilen  -= fill;
        left = 0;
    }

    while( ilen >= 64 )
    {
        md5_process( ctx, input );
        input += 64;
        ilen  -= 64;
    }

    if( ilen > 0 )
    {
        memcpy( (void *) (ctx->buffer + left),
                (void *) input, ilen );
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testl %edx, %edx
jle 0x2886
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rax
movl %eax, %r12d
andl $0x3f, %r12d
movl %edx, %ecx
addl %edx, %eax
movq %rax, (%rdi)
cmpq %rcx, %rax
jae 0x27fa
incq 0x8(%r14)
testq %r12, %r12
je 0x283e
movl $0x40, %eax
subl %r12d, %eax
movl %r15d, %ebp
subl %eax, %ebp
jl 0x2841
leaq 0x30(%r14), %r15
leaq (%r14,%r12), %rdi
addq $0x30, %rdi
movl %eax, %r12d
movq %rbx, %rsi
movq %r12, %rdx
callq 0x21c0
movq %r14, %rdi
movq %r15, %rsi
callq 0x288f
addq %r12, %rbx
xorl %r12d, %r12d
movl %ebp, %r15d
jmp 0x2841
xorl %r12d, %r12d
cmpl $0x40, %r15d
jl 0x2865
movq %r14, %rdi
movq %rbx, %rsi
callq 0x288f
addq $0x40, %rbx
leal -0x40(%r15), %eax
cmpl $0x7f, %r15d
movl %eax, %r15d
jg 0x2847
jmp 0x2868
movl %r15d, %eax
testl %eax, %eax
jle 0x2886
leaq (%r14,%r12), %rdi
addq $0x30, %rdi
movl %eax, %edx
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x21c0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/md5.c
// Function: md5_finish
void md5_finish( md5_context *ctx, unsigned char output[16] )
{
    unsigned long last, padn;
    unsigned long high, low;
    unsigned char msglen[8];

    high = ( ctx->total[0] >> 29 )
         | ( ctx->total[1] <<  3 );
    low  = ( ctx->total[0] <<  3 );

    PUT_ULONG_LE( low,  msglen, 0 );
    PUT_ULONG_LE( high, msglen, 4 );

    last = ctx->total[0] & 0x3F;
    padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );

    md5_update( ctx, (unsigned char *) md5_padding, padn );
    md5_update( ctx, msglen, 8 );

    PUT_ULONG_LE( ctx->state[0], output,  0 );
    PUT_ULONG_LE( ctx->state[1], output,  4 );
    PUT_ULONG_LE( ctx->state[2], output,  8 );
    PUT_ULONG_LE( ctx->state[3], output, 12 );
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
movq %rax, %rdx
shrq $0x1d, %rdx
shlq $0x3, %rcx
orq %rdx, %rcx
leal (,%rax,8), %edx
leaq 0x8(%rsp), %r15
movb %dl, (%r15)
movl %eax, %edx
shrl $0x5, %edx
movb %dl, 0x1(%r15)
movl %eax, %edx
shrl $0xd, %edx
movb %dl, 0x2(%r15)
movl %eax, %edx
shrl $0x15, %edx
movb %dl, 0x3(%r15)
movb %cl, 0x4(%r15)
movb %ch, 0xd(%rsp)
movl %ecx, %edx
shrl $0x10, %edx
movb %dl, 0x6(%r15)
shrl $0x18, %ecx
movb %cl, 0x7(%r15)
andl $0x3f, %eax
xorl %edx, %edx
cmpq $0x38, %rax
setae %dl
shll $0x6, %edx
orl $0x38, %edx
subl %eax, %edx
leaq 0x4de3(%rip), %rsi      # 0x8300
callq 0x27c7
movq %r14, %rdi
movq %r15, %rsi
movl $0x8, %edx
callq 0x27c7
movb 0x10(%r14), %al
movb %al, (%rbx)
movb 0x11(%r14), %al
movb %al, 0x1(%rbx)
movb 0x12(%r14), %al
movb %al, 0x2(%rbx)
movb 0x13(%r14), %al
movb %al, 0x3(%rbx)
movb 0x18(%r14), %al
movb %al, 0x4(%rbx)
movb 0x19(%r14), %al
movb %al, 0x5(%rbx)
movb 0x1a(%r14), %al
movb %al, 0x6(%rbx)
movb 0x1b(%r14), %al
movb %al, 0x7(%rbx)
movb 0x20(%r14), %al
movb %al, 0x8(%rbx)
movb 0x21(%r14), %al
movb %al, 0x9(%rbx)
movb 0x22(%r14), %al
movb %al, 0xa(%rbx)
movb 0x23(%r14), %al
movb %al, 0xb(%rbx)
movb 0x28(%r14), %al
movb %al, 0xc(%rbx)
movb 0x29(%r14), %al
movb %al, 0xd(%rbx)
movb 0x2a(%r14), %al
movb %al, 0xe(%rbx)
movb 0x2b(%r14), %al
movb %al, 0xf(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/md5.c
// Function: md5
void md5( const unsigned char *input, int ilen, unsigned char output[16] )
{
    md5_context ctx;

    md5_starts( &ctx );
    md5_update( &ctx, input, ilen );
    md5_finish( &ctx, output );

    memset( &ctx, 0, sizeof( md5_context ) );
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xf8, %rsp
movq %rdx, %rbx
movl %esi, %edx
movq %rdi, %rsi
xorps %xmm0, %xmm0
movq %rsp, %r14
movaps %xmm0, (%r14)
movq $0x67452301, 0x10(%r14) # imm = 0x67452301
movl $0x98badcfe, %eax       # imm = 0x98BADCFE
leaq 0x5712ce8b(%rax), %rcx
movq %rcx, 0x18(%r14)
movq %rax, 0x20(%r14)
movq $0x10325476, 0x28(%r14) # imm = 0x10325476
movq %r14, %rdi
callq 0x27c7
movq %r14, %rdi
movq %rbx, %rsi
callq 0x349c
movl $0xf0, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x2130
addq $0xf8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/md5.c
// Function: md5_file
int md5_file( const char *path, unsigned char output[16] )
{
    FILE *f;
    size_t n;
    md5_context ctx;
    unsigned char buf[1024];

    if( ( f = fopen( path, "rb" ) ) == NULL )
        return( 1 );

    md5_starts( &ctx );

    while( ( n = fread( buf, 1, sizeof( buf ), f ) ) > 0 )
        md5_update( &ctx, buf, (int) n );

    md5_finish( &ctx, output );

    memset( &ctx, 0, sizeof( md5_context ) );

    if( ferror( f ) != 0 )
    {
        fclose( f );
        return( 2 );
    }

    fclose( f );
    return( 0 );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x4f0, %rsp            # imm = 0x4F0
movq %rsi, %r14
leaq 0x4cbf(%rip), %rsi      # 0x82f0
callq 0x2240
testq %rax, %rax
je 0x36fb
movq %rax, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x67452301, 0x10(%rsp) # imm = 0x67452301
movl $0x98badcfe, %eax       # imm = 0x98BADCFE
leaq 0x5712ce8b(%rax), %rcx
movq %rcx, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movq $0x10325476, 0x28(%rsp) # imm = 0x10325476
leaq 0xf0(%rsp), %rdi
movl $0x1, %esi
movl $0x400, %edx            # imm = 0x400
movq %rbx, %rcx
callq 0x2090
testq %rax, %rax
je 0x36c2
movq %rsp, %r15
leaq 0xf0(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x27c7
movl $0x1, %esi
movl $0x400, %edx            # imm = 0x400
movq %r12, %rdi
movq %rbx, %rcx
callq 0x2090
testq %rax, %rax
jne 0x369b
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x349c
movl $0xf0, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x2130
movq %rbx, %rdi
callq 0x2080
xorl %ebp, %ebp
testl %eax, %eax
setne %bpl
movq %rbx, %rdi
callq 0x20e0
addl %ebp, %ebp
jmp 0x3700
movl $0x1, %ebp
movl %ebp, %eax
addq $0x4f0, %rsp            # imm = 0x4F0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/md5.c
// Function: md5_hmac_starts
void md5_hmac_starts( md5_context *ctx, const unsigned char *key, int keylen )
{
    int i;
    unsigned char sum[16];

    if( keylen > 64 )
    {
        md5( key, keylen, sum );
        keylen = 16;
        key = sum;
    }

    memset( ctx->ipad, 0x36, 64 );
    memset( ctx->opad, 0x5C, 64 );

    for( i = 0; i < keylen; i++ )
    {
        ctx->ipad[i] = (unsigned char)( ctx->ipad[i] ^ key[i] );
        ctx->opad[i] = (unsigned char)( ctx->opad[i] ^ key[i] );
    }

    md5_starts( ctx );
    md5_update( ctx, ctx->ipad, 64 );

    memset( sum, 0, sizeof( sum ) );
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
cmpl $0x41, %edx
jl 0x3739
movq %rsp, %r14
movq %rsi, %rdi
movl %edx, %esi
movq %r14, %rdx
callq 0x35ab
movl $0x10, %edx
movq %r14, %rsi
leaq 0x70(%rbx), %rax
movaps 0x4b8c(%rip), %xmm0     # 0x82d0
movups %xmm0, 0xa0(%rbx)
movups %xmm0, 0x90(%rbx)
movups %xmm0, 0x80(%rbx)
movups %xmm0, 0x70(%rbx)
movaps 0x4b7c(%rip), %xmm0     # 0x82e0
movups %xmm0, 0xb0(%rbx)
movups %xmm0, 0xc0(%rbx)
movups %xmm0, 0xd0(%rbx)
movups %xmm0, 0xe0(%rbx)
testl %edx, %edx
jle 0x37a8
leaq 0xb0(%rbx), %rcx
movl %edx, %edx
xorl %edi, %edi
movb (%rsi,%rdi), %r8b
xorb %r8b, -0x40(%rcx,%rdi)
movb (%rsi,%rdi), %r8b
xorb %r8b, (%rcx,%rdi)
incq %rdi
cmpq %rdi, %rdx
jne 0x378f
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x67452301, 0x10(%rbx) # imm = 0x67452301
movl $0x98badcfe, %ecx       # imm = 0x98BADCFE
leaq 0x5712ce8b(%rcx), %rdx
movq %rdx, 0x18(%rbx)
movq %rcx, 0x20(%rbx)
movq $0x10325476, 0x28(%rbx) # imm = 0x10325476
movq %rbx, %rdi
movq %rax, %rsi
movl $0x40, %edx
callq 0x27c7
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/md5.c
// Function: md5_hmac_finish
void md5_hmac_finish( md5_context *ctx, unsigned char output[16] )
{
    unsigned char tmpbuf[16];

    md5_finish( ctx, tmpbuf );
    md5_starts( ctx );
    md5_update( ctx, ctx->opad, 64 );
    md5_update( ctx, tmpbuf, 16 );
    md5_finish( ctx, output );

    memset( tmpbuf, 0, sizeof( tmpbuf ) );
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsp, %r15
movq %r15, %rsi
callq 0x349c
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq $0x67452301, 0x10(%r14) # imm = 0x67452301
movl $0x98badcfe, %eax       # imm = 0x98BADCFE
leaq 0x5712ce8b(%rax), %rcx
movq %rcx, 0x18(%r14)
movq %rax, 0x20(%r14)
movq $0x10325476, 0x28(%r14) # imm = 0x10325476
leaq 0xb0(%r14), %rsi
movq %r14, %rdi
movl $0x40, %edx
callq 0x27c7
movq %r14, %rdi
movq %r15, %rsi
movl $0x10, %edx
callq 0x27c7
movq %r14, %rdi
movq %rbx, %rsi
callq 0x349c
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/md5.c
// Function: md5_hmac
void md5_hmac( const unsigned char *key, int keylen,
               const unsigned char *input, int ilen,
               unsigned char output[16] )
{
    md5_context ctx;

    md5_hmac_starts( &ctx, key, keylen );
    md5_hmac_update( &ctx, input, ilen );
    md5_hmac_finish( &ctx, output );

    memset( &ctx, 0, sizeof( md5_context ) );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xf8, %rsp
movq %r8, %rbx
movl %ecx, %ebp
movq %rdx, %r14
movl %esi, %edx
movq %rdi, %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x3712
movq %r15, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x27c7
movq %r15, %rdi
movq %rbx, %rsi
callq 0x37ef
movl $0xf0, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x2130
addq $0xf8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/cjson.c
// Function: cJSON_PrintPreallocated
cJSON_bool cJSON_PrintPreallocated(cJSON *item, char *buf, const int len, const cJSON_bool fmt)
{
    printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } };

    if (len < 0)
    {
        return false;
    }

    p.buffer = (unsigned char*)buf;
    p.length = (size_t)len;
    p.offset = 0;
    p.noalloc = true;
    p.format = fmt;
    p.hooks = global_hooks;

    return print_value(item, &p);
}

// Assembly:
subq $0x48, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
testl %edx, %edx
js 0x46d9
movq %rsp, %rax
movq %rsi, (%rax)
movl %edx, %edx
movq %rdx, 0x8(%rax)
movq $0x0, 0x10(%rax)
movl $0x1, 0x20(%rax)
movl %ecx, 0x24(%rax)
movups 0xbac0(%rip), %xmm0     # 0x10180
movups %xmm0, 0x28(%rax)
movq 0xbac5(%rip), %rcx      # 0x10190
movq %rcx, 0x38(%rax)
movq %rax, %rsi
callq 0x4185
jmp 0x46db
xorl %eax, %eax
addq $0x48, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/cjson.c
// Function: cJSON_AddItemToObject
void cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item)
{
    /* call cJSON_AddItemToObjectCS for code reuse */
    cJSON_AddItemToObjectCS(object, (char*)cJSON_strdup((const unsigned char*)string, &global_hooks), item);
    /* remove cJSON_StringIsConst flag */
    item->type &= ~cJSON_StringIsConst;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r14
testq %rsi, %rsi
je 0x4877
movq %rsi, %r12
movq %rsi, %rdi
callq 0x20f0
movq %rax, %r13
incq %r13
movq %r13, %rdi
callq *0xb921(%rip)           # 0x10180
testq %rax, %rax
je 0x4877
movq %rax, %r15
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x21c0
jmp 0x487a
xorl %r15d, %r15d
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x4896
andb $-0x3, 0x19(%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/cjson.c
// Function: cJSON_AddItemToObjectCS
void cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item)
{
    if (!item)
    {
        return;
    }
    if (!(item->type & cJSON_StringIsConst) && item->string)
    {
        global_hooks.deallocate(item->string);
    }
    item->string = (char*)string;
    item->type |= cJSON_StringIsConst;
    cJSON_AddItemToArray(object, item);
}

// Assembly:
testq %rdx, %rdx
je 0x48f1
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
testb $0x2, 0x19(%rdx)
jne 0x48be
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x48be
callq *0xb8ca(%rip)           # 0x10188
movq %r15, 0x38(%rbx)
orb $0x2, 0x19(%rbx)
testq %r14, %r14
je 0x48ec
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x48e8
movq %rax, %rcx
movq (%rax), %rax
testq %rax, %rax
jne 0x48d4
movq %rbx, (%rcx)
movq %rcx, 0x8(%rbx)
jmp 0x48ec
movq %rbx, 0x10(%r14)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/cjson.c
// Function: cJSON_InsertItemInArray
void cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem)
{
    cJSON *after_inserted = NULL;

    if (which < 0)
    {
        return;
    }

    after_inserted = get_array_item(array, (size_t)which);
    if (after_inserted == NULL)
    {
        cJSON_AddItemToArray(array, newitem);
        return;
    }

    newitem->next = after_inserted;
    newitem->prev = after_inserted->prev;
    after_inserted->prev = newitem;
    if (after_inserted == array->child)
    {
        array->child = newitem;
    }
    else
    {
        newitem->prev->next = newitem;
    }
}

// Assembly:
testl %esi, %esi
js 0x4b56
testq %rdi, %rdi
je 0x4b22
movl %esi, %ecx
leaq 0x10(%rdi), %rax
movq (%rax), %rax
addq $-0x1, %rcx
setb %sil
testq %rax, %rax
je 0x4b24
testb %sil, %sil
jne 0x4b0b
jmp 0x4b24
xorl %eax, %eax
testq %rax, %rax
je 0x4b46
movq %rax, (%rdx)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rdx)
movq %rdx, 0x8(%rax)
cmpq 0x10(%rdi), %rax
je 0x4b73
movq 0x8(%rdx), %rax
movq %rdx, (%rax)
retq
testq %rdi, %rdi
sete %al
testq %rdx, %rdx
sete %cl
orb %al, %cl
je 0x4b57
retq
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0x4b73
movq %rax, %rcx
movq (%rax), %rax
testq %rax, %rax
jne 0x4b60
movq %rdx, (%rcx)
movq %rcx, 0x8(%rdx)
retq
movq %rdx, 0x10(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/cjson.c
// Function: cJSON_CreateNull
cJSON* cJSON_CreateNull(void)
{
    cJSON *item = cJSON_New_Item(&global_hooks);
    if(item)
    {
        item->type = cJSON_NULL;
    }

    return item;
}

// Assembly:
pushq %rax
movl $0x40, %edi
callq *0xb51e(%rip)           # 0x10180
testq %rax, %rax
je 0x4c80
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, (%rax)
movl $0x4, 0x18(%rax)
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/cjson.c
// Function: cJSON_CreateTrue
cJSON* cJSON_CreateTrue(void)
{
    cJSON *item = cJSON_New_Item(&global_hooks);
    if(item)
    {
        item->type = cJSON_True;
    }

    return item;
}

// Assembly:
pushq %rax
movl $0x40, %edi
callq *0xb4f2(%rip)           # 0x10180
testq %rax, %rax
je 0x4cac
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, (%rax)
movl $0x2, 0x18(%rax)
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/cjson.c
// Function: cJSON_CreateFalse
cJSON* cJSON_CreateFalse(void)
{
    cJSON *item = cJSON_New_Item(&global_hooks);
    if(item)
    {
        item->type = cJSON_False;
    }

    return item;
}

// Assembly:
pushq %rax
movl $0x40, %edi
callq *0xb4c6(%rip)           # 0x10180
testq %rax, %rax
je 0x4cd8
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, (%rax)
movl $0x1, 0x18(%rax)
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/cjson.c
// Function: cJSON_CreateNumber
cJSON* cJSON_CreateNumber(double num)
{
    cJSON *item = cJSON_New_Item(&global_hooks);
    if(item)
    {
        item->type = cJSON_Number;
        item->valuedouble = num;

        item->valueint = (int64_t)num;
    }

    return item;
}

// Assembly:
pushq %rax
movsd %xmm0, (%rsp)
movl $0x40, %edi
callq *0xb460(%rip)           # 0x10180
testq %rax, %rax
je 0x4d56
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax)
movupd %xmm0, 0x30(%rax)
movupd %xmm0, 0x20(%rax)
movupd %xmm0, (%rax)
movl $0x8, 0x18(%rax)
movsd (%rsp), %xmm0
movsd %xmm0, 0x30(%rax)
cvttsd2si %xmm0, %rcx
movq %rcx, 0x28(%rax)
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/cjson.c
// Function: cJSON_CreateRaw
cJSON* cJSON_CreateRaw(const char *raw)
{
    cJSON *item = cJSON_New_Item(&global_hooks);
    if(item)
    {
        item->type = cJSON_Raw;
        item->valuestring = (char*)cJSON_strdup((const unsigned char*)raw, &global_hooks);
        if(!item->valuestring)
        {
            cJSON_Delete(item);
            return NULL;
        }
    }

    return item;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x40, %edi
callq *0xb382(%rip)           # 0x10180
movq %rax, %rbx
testq %rax, %rax
je 0x4e69
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, (%rbx)
movl $0x80, 0x18(%rbx)
testq %r14, %r14
je 0x4e53
movq %r14, %rdi
callq 0x20f0
movq %rax, %r12
incq %r12
movq %r12, %rdi
callq *0xb345(%rip)           # 0x10180
testq %rax, %rax
je 0x4e53
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x21c0
jmp 0x4e56
xorl %r15d, %r15d
movq %r15, 0x20(%rbx)
testq %r15, %r15
jne 0x4e69
movq %rbx, %rdi
callq 0x39b5
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/cjson.c
// Function: cJSON_CreateArray
cJSON* cJSON_CreateArray(void)
{
    cJSON *item = cJSON_New_Item(&global_hooks);
    if(item)
    {
        item->type=cJSON_Array;
    }

    return item;
}

// Assembly:
pushq %rax
movl $0x40, %edi
callq *0xb2fc(%rip)           # 0x10180
testq %rax, %rax
je 0x4ea2
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, (%rax)
movl $0x20, 0x18(%rax)
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/cjson.c
// Function: cJSON_CreateObject
cJSON* cJSON_CreateObject(void)
{
    cJSON *item = cJSON_New_Item(&global_hooks);
    if (item)
    {
        item->type = cJSON_Object;
    }

    return item;
}

// Assembly:
pushq %rax
movl $0x40, %edi
callq *0xb2d0(%rip)           # 0x10180
testq %rax, %rax
je 0x4ece
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, (%rax)
movl $0x40, 0x18(%rax)
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/cjson.c
// Function: cJSON_CreateIntArray
cJSON* cJSON_CreateIntArray(const int *numbers, int count)
{
    size_t i = 0;
    cJSON *n = NULL;
    cJSON *p = NULL;
    cJSON *a = NULL;

    if (count < 0)
    {
        return NULL;
    }

    a = cJSON_CreateArray();
    for(i = 0; a && (i < (size_t)count); i++)
    {
        n = cJSON_CreateNumber(numbers[i]);
        if (!n)
        {
            cJSON_Delete(a);
            return NULL;
        }
        if(!i)
        {
            a->child = n;
        }
        else
        {
            suffix_object(p, n);
        }
        p = n;
    }

    return a;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testl %esi, %esi
js 0x4fa5
movl %esi, %ebp
movq %rdi, %r14
movl $0x40, %edi
callq *0xb28d(%rip)           # 0x10180
movq %rax, %rbx
testq %rax, %rax
je 0x4f19
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rbx)
movupd %xmm0, 0x30(%rbx)
movupd %xmm0, 0x20(%rbx)
movupd %xmm0, (%rbx)
movl $0x20, 0x18(%rbx)
testq %rbx, %rbx
sete %al
testl %ebp, %ebp
sete %cl
orb %al, %cl
jne 0x4fa7
movl %ebp, %r15d
movl $0x1, %r12d
xorl %r13d, %r13d
movslq -0x4(%r14,%r12,4), %rbp
movl $0x40, %edi
callq *0xb23c(%rip)           # 0x10180
testq %rax, %rax
je 0x4f9d
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
xorps %xmm1, %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm1, 0x30(%rax)
movups %xmm1, 0x20(%rax)
movups %xmm1, (%rax)
movl $0x8, 0x18(%rax)
movsd %xmm0, 0x30(%rax)
movq %rbp, 0x28(%rax)
cmpq $0x1, %r12
jne 0x4f7e
movq %rax, 0x10(%rbx)
jmp 0x4f86
movq %rax, (%r13)
movq %r13, 0x8(%rax)
testq %rbx, %rbx
je 0x4fa7
leaq 0x1(%r12), %rcx
movq %rax, %r13
cmpq %r15, %r12
movq %rcx, %r12
jb 0x4f34
jmp 0x4fa7
movq %rbx, %rdi
callq 0x39b5
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/cjson.c
// Function: cJSON_CreateFloatArray
cJSON* cJSON_CreateFloatArray(const float *numbers, int count)
{
    size_t i = 0;
    cJSON *n = NULL;
    cJSON *p = NULL;
    cJSON *a = NULL;

    if (count < 0)
    {
        return NULL;
    }

    a = cJSON_CreateArray();

    for(i = 0; a && (i < (size_t)count); i++)
    {
        n = cJSON_CreateNumber((double)numbers[i]);
        if(!n)
        {
            cJSON_Delete(a);
            return NULL;
        }
        if(!i)
        {
            a->child = n;
        }
        else
        {
            suffix_object(p, n);
        }
        p = n;
    }

    return a;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testl %esi, %esi
js 0x50a0
movl %esi, %ebp
movq %rdi, %r14
movl $0x40, %edi
callq *0xb1a4(%rip)           # 0x10180
movq %rax, %rbx
testq %rax, %rax
je 0x4ffd
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, (%rbx)
movl $0x20, 0x18(%rbx)
testq %rbx, %rbx
sete %al
testl %ebp, %ebp
sete %cl
orb %al, %cl
jne 0x50a2
movl %ebp, %r15d
movl $0x1, %r12d
xorl %r13d, %r13d
movss -0x4(%r14,%r12,4), %xmm0
movss %xmm0, 0x4(%rsp)
movl $0x40, %edi
callq *0xb14c(%rip)           # 0x10180
testq %rax, %rax
je 0x5098
movss 0x4(%rsp), %xmm2
xorps %xmm0, %xmm0
cvtss2sd %xmm2, %xmm0
xorps %xmm1, %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm1, 0x30(%rax)
movups %xmm1, 0x20(%rax)
movups %xmm1, (%rax)
movl $0x8, 0x18(%rax)
movsd %xmm0, 0x30(%rax)
cvttss2si %xmm2, %rcx
movq %rcx, 0x28(%rax)
cmpq $0x1, %r12
jne 0x5079
movq %rax, 0x10(%rbx)
jmp 0x5081
movq %rax, (%r13)
movq %r13, 0x8(%rax)
testq %rbx, %rbx
je 0x50a2
leaq 0x1(%r12), %rcx
movq %rax, %r13
cmpq %r15, %r12
movq %rcx, %r12
jb 0x501c
jmp 0x50a2
movq %rbx, %rdi
callq 0x39b5
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/cjson.c
// Function: cJSON_CreateDoubleArray
cJSON* cJSON_CreateDoubleArray(const double *numbers, int count)
{
    size_t i = 0;
    cJSON *n = NULL;
    cJSON *p = NULL;
    cJSON *a = NULL;

    if (count < 0)
    {
        return NULL;
    }

    a = cJSON_CreateArray();

    for(i = 0;a && (i < (size_t)count); i++)
    {
        n = cJSON_CreateNumber(numbers[i]);
        if(!n)
        {
            cJSON_Delete(a);
            return NULL;
        }
        if(!i)
        {
            a->child = n;
        }
        else
        {
            suffix_object(p, n);
        }
        p = n;
    }

    return a;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testl %esi, %esi
js 0x5197
movl %esi, %ebp
movq %rdi, %r14
movl $0x40, %edi
callq *0xb0a9(%rip)           # 0x10180
movq %rax, %rbx
testq %rax, %rax
je 0x50fd
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rbx)
movupd %xmm0, 0x30(%rbx)
movupd %xmm0, 0x20(%rbx)
movupd %xmm0, (%rbx)
movl $0x20, 0x18(%rbx)
testq %rbx, %rbx
sete %al
testl %ebp, %ebp
sete %cl
orb %al, %cl
jne 0x5199
movl %ebp, %r15d
movl $0x1, %r12d
xorl %r13d, %r13d
movsd -0x8(%r14,%r12,8), %xmm0
movsd %xmm0, (%rsp)
movl $0x40, %edi
callq *0xb04d(%rip)           # 0x10180
testq %rax, %rax
je 0x518f
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, (%rax)
movl $0x8, 0x18(%rax)
movsd (%rsp), %xmm0
movsd %xmm0, 0x30(%rax)
cvttsd2si %xmm0, %rcx
movq %rcx, 0x28(%rax)
cmpq $0x1, %r12
jne 0x5170
movq %rax, 0x10(%rbx)
jmp 0x5178
movq %rax, (%r13)
movq %r13, 0x8(%rax)
testq %rbx, %rbx
je 0x5199
leaq 0x1(%r12), %rcx
movq %rax, %r13
cmpq %r15, %r12
movq %rcx, %r12
jb 0x511c
jmp 0x5199
movq %rbx, %rdi
callq 0x39b5
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/cjson.c
// Function: cJSON_CreateStringArray
cJSON* cJSON_CreateStringArray(const char **strings, int count)
{
    size_t i = 0;
    cJSON *n = NULL;
    cJSON *p = NULL;
    cJSON *a = NULL;

    if (count < 0)
    {
        return NULL;
    }

    a = cJSON_CreateArray();

    for (i = 0; a && (i < (size_t)count); i++)
    {
        n = cJSON_CreateString(strings[i]);
        if(!n)
        {
            cJSON_Delete(a);
            return NULL;
        }
        if(!i)
        {
            a->child = n;
        }
        else
        {
            suffix_object(p,n);
        }
        p = n;
    }

    return a;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testl %esi, %esi
js 0x524c
movl %esi, %ebp
movq %rdi, %r14
movl $0x40, %edi
callq *0xafb2(%rip)           # 0x10180
movq %rax, %rbx
testq %rax, %rax
je 0x51ef
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, (%rbx)
movl $0x20, 0x18(%rbx)
testq %rbx, %rbx
sete %al
testl %ebp, %ebp
sete %cl
orb %al, %cl
jne 0x524e
movl %ebp, %r15d
movl $0x1, %r12d
xorl %r13d, %r13d
movq -0x8(%r14,%r12,8), %rdi
callq 0x4d58
testq %rax, %rax
je 0x5244
cmpq $0x1, %r12
jne 0x5225
movq %rax, 0x10(%rbx)
jmp 0x522d
movq %rax, (%r13)
movq %r13, 0x8(%rax)
testq %rbx, %rbx
je 0x524e
leaq 0x1(%r12), %rcx
movq %rax, %r13
cmpq %r15, %r12
movq %rcx, %r12
jb 0x520a
jmp 0x524e
movq %rbx, %rdi
callq 0x39b5
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/util.c
// Function: udp_listen
int udp_listen( char* ip, int port )
{
/* ip ��ʾ�������ĸ�ip �ϣ�����ΪNULL,��ʾ����������ip �ϣ�
������Ϊnull,��������ָ��ip��ַ��: 
�������óɹ����� socket fd, ���򷵻� -1  */

    int fd;
    struct sockaddr_in addr;

    fd = socket( AF_INET, SOCK_DGRAM, 0 );
    if( fd == -1 )
    {
        return -1;
    }

    int reuse=1;
    setsockopt( fd, SOL_SOCKET, SO_REUSEADDR, (char*)&reuse, sizeof(reuse) );
    
    addr.sin_family = AF_INET;
    addr.sin_port   = htons( port );

    if(ip == NULL || ip[0] == '*' )
    {
        addr.sin_addr.s_addr = INADDR_ANY;
        if( bind( fd, (struct sockaddr*)&addr, sizeof(addr) ) == -1 )
        {
            close( fd );
            return -1;
        }
    }
    else /*����ip  */
    {
        addr.sin_addr.s_addr = inet_addr(ip);
        if( bind( fd, (struct sockaddr*)&addr, sizeof(addr) ) == -1 )
        {
            close( fd );
            return -1;
        }
    }

    return fd;

}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %esi, %ebp
movq %rdi, %r14
movl $0x2, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x22d0
cmpl $-0x1, %eax
je 0x5ed5
movl %eax, %ebx
leaq 0xc(%rsp), %rcx
movl $0x1, (%rcx)
movl %eax, %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x20b0
movw $0x2, 0x10(%rsp)
rolw $0x8, %bp
movw %bp, 0x12(%rsp)
testq %r14, %r14
je 0x5e9f
cmpb $0x2a, (%r14)
jne 0x5ead
leaq 0x10(%rsp), %rsi
movl $0x0, 0x4(%rsi)
jmp 0x5ebd
movq %r14, %rdi
callq 0x2170
leaq 0x10(%rsp), %rsi
movl %eax, 0x4(%rsi)
movl %ebx, %edi
movl $0x10, %edx
callq 0x2220
cmpl $-0x1, %eax
jne 0x5eda
movl %ebx, %edi
callq 0x2150
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/util.c
// Function: udp_send
int udp_send( int fd, char* ip, int port, char* msg, int len )
{
    struct sockaddr_in addr;
    addr.sin_family = AF_INET;
    addr.sin_port   = htons( port );
    addr.sin_addr.s_addr = inet_addr(ip);
    
    return sendto( fd, msg, len, 0, (struct sockaddr*)&addr, sizeof(addr) );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %r8d, %ebx
movq %rcx, %r14
movl %edi, %ebp
leaq 0x8(%rsp), %r15
movw $0x2, (%r15)
rolw $0x8, %dx
movw %dx, 0x2(%r15)
movq %rsi, %rdi
callq 0x2170
movl %eax, 0x4(%r15)
movslq %ebx, %rdx
movl %ebp, %edi
movq %r14, %rsi
xorl %ecx, %ecx
movq %r15, %r8
movl $0x10, %r9d
callq 0x2140
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/util.c
// Function: udp_recv
int udp_recv( int fd, char* buf, int size, char* ip, int* port )
{
    struct sockaddr_in addr;
    socklen_t len;
    int rc;
    
    len = sizeof(addr);
    
    rc = recvfrom( fd, buf, size, 0, (struct sockaddr *)&addr, &len );
    if( rc > 0 )
    {
        *port=ntohs(addr.sin_port);
        sprintf(ip,"%s",inet_ntoa(addr.sin_addr));
    }
    
    return rc;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %r8, %r14
movq %rcx, %rbx
leaq 0xc(%rsp), %r9
movl $0x10, (%r9)
movslq %edx, %rdx
leaq 0x10(%rsp), %r8
xorl %ecx, %ecx
callq 0x2200
movq %rax, %r15
testl %r15d, %r15d
jle 0x5f8f
movzwl 0x12(%rsp), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, (%r14)
movl 0x14(%rsp), %edi
callq 0x20d0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2060
movl %r15d, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/util.c
// Function: resolve_host_ip
int resolve_host_ip( const char* host, char* ip )
{
    struct hostent* ent;
    char* addr;
    unsigned char b1,b2,b3,b4;

     ent = gethostbyname( host );
    if( ent == NULL )
        return -1;
    addr = *ent->h_addr_list;
    if( !addr )
        return -1;
    b1 = addr[0];
    b2 = addr[1];
    b3 = addr[2];
    b4 = addr[3];

    sprintf( ip, "%d.%d.%d.%d", b1, b2, b3, b4 );
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
callq 0x21a0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x5fe2
movq 0x18(%rax), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x5fe2
movzbl (%rax), %edx
movzbl 0x1(%rax), %ecx
movzbl 0x2(%rax), %r8d
movzbl 0x3(%rax), %r9d
leaq 0x23f6(%rip), %rsi      # 0x83cc
xorl %ebx, %ebx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2270
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/util.c
// Function: write_log
int write_log( const char* fmt, ... )
{
    FILE* f;
    time_t t;
    struct tm* tm;
    va_list  ap;
    //struct timeval tmv;

    f = fopen( log_file, "a" );
    if( f == NULL )
        return -1;
    
    t = time( 0 );
    //gettimeofday( &tmv, NULL );
    
    tm = localtime( &t );
    
    if( *fmt )
    {
        va_start( ap, fmt );
        //fprintf(f,"[%02d-%02d %02d:%02d:%02d.%03d]  ",tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tmv.tv_usec / 1000 );
        fprintf( f, "[%02d-%02d %02d:%02d:%02d]  ", tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec );
        vfprintf( f, fmt, ap);
        fprintf( f, "\n" );
        va_end( ap );
    }
    
    fclose( f );
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rdi, %rbx
movq %rsi, 0x38(%rsp)
movq %rdx, 0x40(%rsp)
movq %rcx, 0x48(%rsp)
movq %r8, 0x50(%rsp)
movq %r9, 0x58(%rsp)
testb %al, %al
je 0x6054
movaps %xmm0, 0x60(%rsp)
movaps %xmm1, 0x70(%rsp)
movaps %xmm2, 0x80(%rsp)
movaps %xmm3, 0x90(%rsp)
movaps %xmm4, 0xa0(%rsp)
movaps %xmm5, 0xb0(%rsp)
movaps %xmm6, 0xc0(%rsp)
movaps %xmm7, 0xd0(%rsp)
leaq 0xa175(%rip), %rdi      # 0x101d0
leaq 0x2376(%rip), %rsi      # 0x83d8
callq 0x2240
testq %rax, %rax
je 0x6104
movq %rax, %r15
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x21d0
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
callq 0x2030
cmpb $0x0, (%rbx)
je 0x60fa
leaq 0x30(%rsp), %rcx
leaq 0x10(%rsp), %r12
movq %rcx, 0x10(%r12)
leaq 0x110(%rsp), %rcx
movq %rcx, 0x8(%r12)
movabsq $0x3000000008, %rcx     # imm = 0x3000000008
movq %rcx, (%r12)
movl 0x10(%rax), %edx
incl %edx
movl 0xc(%rax), %ecx
movl 0x8(%rax), %r8d
movl (%rax), %esi
movl 0x4(%rax), %r9d
movl %esi, (%rsp)
leaq 0x2305(%rip), %rsi      # 0x83da
movq %r15, %rdi
xorl %eax, %eax
callq 0x21b0
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x2250
movl $0xa, %edi
movq %r15, %rsi
callq 0x2160
movq %r15, %rdi
callq 0x20e0
jmp 0x610a
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/util.c
// Function: hex2asc
int hex2asc( char* hex, int len, char* buf, int buflen )
{
    char bits[] = "0123456789abcdef";
    
    unsigned char u;
    int i;

    if( buflen < len * 2 )
        return -1;
    buf[len*2]=0;
    
    for( i = 0; i < len; i++ )
    {
        u = hex[i];
        
        buf[i*2+0] = bits[ u >> 4 ];
        buf[i*2+1] = bits[ u & 0x0f ];
    }
    
    return 0;
    
}

// Assembly:
movslq %esi, %r8
addq %r8, %r8
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %r8d
jg 0x6413
movb $0x0, (%rdx,%r8)
testl %esi, %esi
jle 0x6414
movl %esi, %ecx
xorl %eax, %eax
leaq 0x2139(%rip), %rsi      # 0x8520
xorl %r8d, %r8d
movzbl (%rdi,%r8), %r9d
movl %r9d, %r10d
shrl $0x4, %r10d
movb (%r10,%rsi), %r10b
movb %r10b, (%rdx,%r8,2)
andl $0xf, %r9d
movb (%r9,%rsi), %r9b
movb %r9b, 0x1(%rdx,%r8,2)
incq %r8
cmpq %r8, %rcx
jne 0x63ea
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/util.c
// Function: strlower
char *strlower( char *s )
{
    int i, len = strlen(s);
    for( i = 0; i < len; i++ ){
        s[i] = ( s[i] >= 'A' && s[i] <= 'Z' ? s[i] +32 : s[i] );
    }
    return s;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x20f0
testl %eax, %eax
jle 0x644c
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %ecx, %ecx
movzbl (%rbx,%rcx), %edx
leal -0x41(%rdx), %esi
leal 0x20(%rdx), %edi
cmpb $0x1a, %sil
movzbl %dil, %esi
cmovael %edx, %esi
movb %sil, (%rbx,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x642b
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/util.c
// Function: change_process_user
int change_process_user( char* user )
{
    struct passwd *pw;
    
    pw = getpwnam( user );
    if( !pw )
        return -1;
        
    if( setgid(pw->pw_gid ) )
        return -1;    
    
    if( setuid( pw->pw_uid ) )
        return -1;

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
callq 0x2190
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x6482
movq %rax, %r14
movl 0x14(%rax), %edi
callq 0x2230
testl %eax, %eax
jne 0x6482
movl 0x10(%r14), %edi
callq 0x2290
xorl %ebx, %ebx
negl %eax
sbbl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/util.c
// Function: crypto_derive_key
int crypto_derive_key(const char *pass, unsigned char *key, int key_len)
{
    int datal;
    datal = strlen((const char *)pass);
    md5_context ctx;



    unsigned char md_buf[16];
    int addmd;
    unsigned int i, j, mds;

    mds = 16;


    for (j = 0, addmd = 0; j < key_len; addmd++) {
        md5_starts(&ctx);
        if (addmd) {
            md5_update(&ctx, md_buf, mds);
        }
        md5_update(&ctx, (unsigned char *)pass, datal);
        md5_finish(&ctx, &(md_buf[0]));

        for (i = 0; i < mds; i++, j++) {
            if (j >= key_len)
                break;
            key[j] = md_buf[i];
        }
    }


    return key_len;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movl %edx, %ebx
movq %rsi, 0x10(%rsp)
movq %rdi, %r14
callq 0x20f0
movl %ebx, %ecx
movq %rax, 0x18(%rsp)
testl %ebx, %ebx
je 0x6584
movl %ecx, %r12d
xorl %r15d, %r15d
leaq 0x38(%rsp), %rbx
leaq 0x20(%rsp), %r13
xorl %ebp, %ebp
movq %r14, 0x8(%rsp)
movl %ecx, 0x4(%rsp)
movq %rbx, %rdi
callq 0x279c
testl %r15d, %r15d
je 0x64f3
movq %rbx, %rdi
movq %r13, %rsi
movl $0x10, %edx
callq 0x27c7
movq %rbx, %rdi
movq %r14, %rsi
movq 0x18(%rsp), %rdx
callq 0x27c7
movq %rbx, %rdi
movq %r13, %rsi
callq 0x349c
movl 0x4(%rsp), %ecx
cmpl %ecx, %ebp
jae 0x6574
movl %ebp, %r14d
movq 0x10(%rsp), %rax
leaq (%rax,%r14), %rdi
notl %ebp
addl %ecx, %ebp
cmpl $0xf, %ebp
movl $0xf, %eax
cmovael %eax, %ebp
incl %ebp
movq %r13, %rsi
movq %rbp, %rdx
callq 0x21c0
xorl %ecx, %ecx
leaq 0x1(%rcx), %rax
cmpq $0xe, %rcx
ja 0x6559
leaq (%rcx,%r14), %rdx
incq %rdx
movq %rax, %rcx
cmpq %r12, %rdx
jb 0x6540
addl %eax, %r14d
movl %r14d, %ebp
movq 0x8(%rsp), %r14
leaq 0x20(%rsp), %r13
leaq 0x38(%rsp), %rbx
movl 0x4(%rsp), %ecx
jmp 0x6579
leaq 0x38(%rsp), %rbx
incl %r15d
cmpl %ecx, %ebp
jb 0x64d6
movl %ecx, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/util.c
// Function: pack_update_pkg
int pack_update_pkg( char* passwd, char* buf, char* msg, int msglen )
{
    aes_context ctx;
    
    upd_pack_hdr *hdr;
    char tmp[1024];
    unsigned char aes_key[32];
    unsigned char iv[16];
    unsigned int  checksum;
    unsigned int  timestamp;
    int offset = 0;
    int left = msglen + sizeof(upd_pack_hdr);
    int proc_len;
    
    int iv_off = 0;
    
    hdr = (upd_pack_hdr*)buf;
    
    crypto_derive_key( passwd, aes_key, 32 );
    md5( (unsigned char*)passwd, strlen( passwd ), iv );
    
    timestamp = time( NULL );
    hdr->time_stamp = htonl( timestamp );
    hdr->checksum   = 0;
    hdr->rnd        = rand();

    memcpy( buf + sizeof(upd_pack_hdr), msg, msglen );
    
    checksum = crc32( 0, buf, sizeof(upd_pack_hdr) + msglen );
    hdr->checksum = htonl( checksum );
    aes_setkey_enc( &ctx, aes_key, 256 );
    
    while( left )
    {
        proc_len = left > sizeof(tmp) ? sizeof(tmp) : left;
        
        aes_crypt_cfb128( &ctx, AES_ENCRYPT, proc_len, &iv_off, iv, (unsigned char*)buf + offset, (unsigned char*)tmp );
        memcpy( buf + offset, tmp, proc_len );
        
        left -= proc_len;
        offset += proc_len;
    }
    
    
    return 0;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x678, %rsp            # imm = 0x678
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r15
movslq %ecx, %r13
leaq 0xc(%r13), %r14
xorl %ebp, %ebp
movl %ebp, 0xc(%rsp)
leaq 0x20(%rsp), %rsi
movl $0x20, %edx
callq 0x648c
movq %r15, %rdi
callq 0x20f0
leaq 0x10(%rsp), %rdx
movq %r15, %rdi
movl %eax, %esi
callq 0x35ab
xorl %edi, %edi
callq 0x21d0
bswapl %eax
movl %eax, 0x8(%rbx)
movl %ebp, 0x4(%rbx)
callq 0x22b0
movl %eax, (%rbx)
leaq 0xc(%rbx), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x21c0
xorl %edi, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x75ec
bswapl %eax
movl %eax, 0x4(%rbx)
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x67ec
testl %r14d, %r14d
je 0x668e
leaq 0x270(%rsp), %r15
movl $0x400, %eax            # imm = 0x400
cmpl %eax, %r14d
movl $0x400, %r12d           # imm = 0x400
cmovbl %r14d, %r12d
movl %ebp, %r13d
addq %rbx, %r13
movq %r15, (%rsp)
leaq 0x40(%rsp), %rdi
movl $0x1, %esi
movl %r12d, %edx
leaq 0xc(%rsp), %rcx
leaq 0x10(%rsp), %r8
movq %r13, %r9
callq 0x751b
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x21c0
addl %r12d, %ebp
subl %r12d, %r14d
jne 0x663d
xorl %eax, %eax
addq $0x678, %rsp            # imm = 0x678
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/aes.c
// Function: aes_crypt_cbc
int aes_crypt_cbc( aes_context *ctx,
                    int mode,
                    int length,
                    unsigned char iv[16],
                    const unsigned char *input,
                    unsigned char *output )
{
    int i;
    unsigned char temp[16];

    if( length % 16 )
        return( ERR_AES_INVALID_INPUT_LENGTH );



    if( mode == AES_DECRYPT )
    {
        while( length > 0 )
        {
            memcpy( temp, input, 16 );
            aes_crypt_ecb( ctx, mode, input, output );

            for( i = 0; i < 16; i++ )
                output[i] = (unsigned char)( output[i] ^ iv[i] );

            memcpy( iv, temp, 16 );

            input  += 16;
            output += 16;
            length -= 16;
        }
    }
    else
    {
        while( length > 0 )
        {
            for( i = 0; i < 16; i++ )
                output[i] = (unsigned char)( input[i] ^ iv[i] );

            aes_crypt_ecb( ctx, mode, output, output );
            memcpy( iv, output, 16 );

            input  += 16;
            output += 16;
            length -= 16;
        }
    }

    return( 0 );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r13d
movl $0xfffff7f0, %eax       # imm = 0xFFFFF7F0
testb $0xf, %r13b
jne 0x750c
movq %r9, %rbx
movq %r8, %r14
movq %rcx, %r15
movl %esi, %ebp
movq %rdi, %r12
testl %esi, %esi
je 0x74be
testl %r13d, %r13d
jle 0x750a
xorl %eax, %eax
movb (%r15,%rax), %cl
xorb (%r14,%rax), %cl
movb %cl, (%rbx,%rax)
incq %rax
cmpq $0x10, %rax
jne 0x747c
movq %r12, %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq %rbx, %rcx
callq 0x6c68
movups (%rbx), %xmm0
movups %xmm0, (%r15)
addq $0x10, %r14
addq $0x10, %rbx
leal -0x10(%r13), %eax
cmpl $0x10, %r13d
movl %eax, %r13d
jg 0x747a
jmp 0x750a
testl %r13d, %r13d
jle 0x750a
movups (%r14), %xmm0
movaps %xmm0, (%rsp)
movq %r12, %rdi
movl %ebp, %esi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x6c68
xorl %eax, %eax
movb (%r15,%rax), %cl
xorb %cl, (%rbx,%rax)
incq %rax
cmpq $0x10, %rax
jne 0x74dd
movaps (%rsp), %xmm0
movups %xmm0, (%r15)
addq $0x10, %r14
addq $0x10, %rbx
leal -0x10(%r13), %eax
cmpl $0x10, %r13d
movl %eax, %r13d
jg 0x74c3
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq