LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/log.c
// Function: log_initialize_file
int log_initialize_file(int file_lvl,
        char* file_path, char* prefix, int buf_size,
        int sw_time, int sw_size)
{
    if(!file_path || !prefix || buf_size <= 0) {
        return LOG_FAIL;
    }

    memset(&_file_log_ctx, 0, sizeof(_file_log_ctx));

    strncpy(_file_log_ctx.path, file_path, sizeof(_file_log_ctx.path) - 1);
    if(_file_log_ctx.path[strlen(_file_log_ctx.path) - 1] == '/') {
        _file_log_ctx.path[strlen(_file_log_ctx.path) - 1] = 0;
    }
    strncpy(_file_log_ctx.prefix, prefix, sizeof(_file_log_ctx.prefix) - 1);
    _file_log_ctx.buf_size = buf_size;
    _file_log_ctx.switch_size = sw_size;
    _file_log_ctx.switch_time = sw_time;
    _file_log_ctx.buf = malloc(sizeof(char)*buf_size);
    if(!_file_log_ctx.buf) {
        return LOG_FAIL;
    }
    memset(_file_log_ctx.buf, 0, sizeof(char)*buf_size);

    return log_reg_callback(file_lvl,
            log_file_init_callback_fun,
            log_file_log_callback_fun,
            log_file_uninit_callback_fun,
            log_file_flush_callback_fun,
            0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r15d
testq %rsi, %rsi
sete %al
testq %rdx, %rdx
sete %cl
orb %al, %cl
testl %r15d, %r15d
setle %al
orb %cl, %al
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jne 0x4bac
movq %rdx, %rbx
movq %rsi, %r12
movl %r9d, -0x30(%rbp)
movl %r8d, -0x34(%rbp)
movl %edi, -0x2c(%rbp)
leaq 0x7734(%rip), %r13      # 0xc230
movl $0x338, %edx            # imm = 0x338
movq %r13, %rdi
xorl %esi, %esi
callq 0x21a0
movl $0xff, %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x2070
movq %r13, %rdi
callq 0x2130
cmpb $0x2f, -0x1(%rax,%r13)
jne 0x4b31
movb $0x0, -0x1(%rax,%r13)
leaq 0x77f8(%rip), %rdi      # 0xc330
movl $0xff, %edx
movq %rbx, %rsi
callq 0x2070
movl %r15d, 0x7a0c(%rip)     # 0xc558
movl -0x30(%rbp), %eax
movl %eax, 0x79f3(%rip)      # 0xc548
movl -0x34(%rbp), %eax
movl %eax, 0x79e6(%rip)      # 0xc544
movl %r15d, %ebx
movq %rbx, %rdi
callq 0x22a0
movq %rax, 0x79e0(%rip)      # 0xc550
testq %rax, %rax
je 0x4bac
xorl %r14d, %r14d
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x21a0
leaq 0x4e(%rip), %rsi        # 0x4bda
leaq 0x2ae(%rip), %rdx       # 0x4e41
leaq 0x369(%rip), %rcx       # 0x4f03
leaq 0x49d(%rip), %r8        # 0x503e
movl -0x2c(%rbp), %edi
xorl %r9d, %r9d
callq 0x42cb
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/log.c
// Function: log_file_log_callback_fun
int log_file_log_callback_fun(const char* log, int len, void* args)
{
    FILE* fp = _file_log_ctx.fp;
    if (fp == NULL ) {
        return LOG_FAIL;
    }

    if(log_file_switch(args) != LOG_SUCCESS) {
        return LOG_FAIL;
    }

    int m_size = len;

    if (m_size > (_file_log_ctx.buf_size - _file_log_ctx.w_pos)) {
        if (_file_log_ctx.w_pos > 0) {
            _file_log_ctx.w_size += fwrite(_file_log_ctx.buf, 1,
                    _file_log_ctx.w_pos, _file_log_ctx.fp);
            _file_log_ctx.w_pos = 0;
        }
        _file_log_ctx.w_size += fwrite(log, 1, m_size, _file_log_ctx.fp);
    } else {
        memcpy(_file_log_ctx.buf + _file_log_ctx.w_pos, log, m_size);
        _file_log_ctx.w_pos += m_size;
        _file_log_ctx.w_size += m_size;
    }
    return LOG_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
cmpq $0x0, 0x76df(%rip)      # 0xc538
je 0x4ef5
movl %esi, %ebx
movq %rdi, %r14
callq 0x50b3
testl %eax, %eax
jne 0x4ef5
movl 0x76e1(%rip), %eax      # 0xc558
movl 0x76e3(%rip), %edx      # 0xc560
subl %edx, %eax
cmpl %ebx, %eax
jge 0x4ecb
testl %edx, %edx
jle 0x4eaf
movq 0x76c2(%rip), %rdi      # 0xc550
movq 0x76a3(%rip), %rcx      # 0xc538
movl $0x1, %esi
callq 0x2350
addl %eax, 0x76b7(%rip)      # 0xc55c
movl $0x0, 0x76b1(%rip)      # 0xc560
movslq %ebx, %rdx
movq 0x767f(%rip), %rcx      # 0xc538
movl $0x1, %esi
movq %r14, %rdi
callq 0x2350
movq %rax, %rbx
jmp 0x4ee6
movslq %edx, %rdi
addq 0x767b(%rip), %rdi      # 0xc550
movslq %ebx, %rdx
movq %r14, %rsi
callq 0x2250
addl %ebx, 0x767a(%rip)      # 0xc560
addl 0x7670(%rip), %ebx      # 0xc55c
movl %ebx, 0x766a(%rip)      # 0xc55c
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/log.c
// Function: log_file_uninit_callback_fun
int log_file_uninit_callback_fun(void* args)
{
    FILE* fp = _file_log_ctx.fp;
    char* buf = _file_log_ctx.buf;
    if(fp) {
        if(log_file_switch(args) != LOG_SUCCESS) {
            return LOG_FAIL;
        }

        if(_file_log_ctx.buf && _file_log_ctx.w_pos > 0) {
            fwrite(_file_log_ctx.buf, 1,
                    _file_log_ctx.w_pos, _file_log_ctx.fp);
        }

        fclose(fp);

        char old_path[LOG_DEFAULT_MAX_PATH] = {0};
        char new_path[LOG_DEFAULT_MAX_PATH] = {0};

        snprintf(old_path, LOG_DEFAULT_MAX_PATH, "%s/%s.tmp",
                _file_log_ctx.path, _file_log_ctx.name);

        snprintf(new_path, LOG_DEFAULT_MAX_PATH, "%s/%s.log",
                        _file_log_ctx.path, _file_log_ctx.name);

        if(rename(old_path, new_path) != 0) {
            fprintf(stderr, "rename %s - > %s failed: %s\n", old_path, new_path, strerror(errno));
        }
    }
    if(buf) {
        free(buf);
    }
    memset(&_file_log_ctx, 0, sizeof(_file_log_ctx.buf));

    return LOG_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq 0x761a(%rip), %r14      # 0xc538
movq 0x762b(%rip), %rbx      # 0xc550
testq %r14, %r14
je 0x4ffd
callq 0x50b3
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x5017
movq 0x7607(%rip), %rdi      # 0xc550
testq %rdi, %rdi
setne %cl
movl 0x760b(%rip), %eax      # 0xc560
testl %eax, %eax
setg %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x4f74
movl %eax, %edx
movq 0x75ce(%rip), %rcx      # 0xc538
movl $0x1, %esi
callq 0x2350
movq %r14, %rdi
callq 0x2110
leaq -0x230(%rbp), %r14
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
xorl %esi, %esi
callq 0x21a0
leaq -0x130(%rbp), %r15
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
xorl %esi, %esi
callq 0x21a0
leaq 0x3257(%rip), %rdx      # 0x8206
leaq 0x727a(%rip), %r12      # 0xc230
leaq 0x7473(%rip), %r13      # 0xc430
movl $0x100, %esi            # imm = 0x100
movq %r14, %rdi
movq %r12, %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x2170
leaq 0x3237(%rip), %rdx      # 0x8210
movl $0x100, %esi            # imm = 0x100
movq %r15, %rdi
movq %r12, %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x2170
movq %r14, %rdi
movq %r15, %rsi
callq 0x2310
testl %eax, %eax
jne 0x5029
testq %rbx, %rbx
je 0x500a
movq %rbx, %rdi
callq 0x2030
movq $0x0, 0x721b(%rip) # 0xc230
xorl %eax, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x230(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x24da
jmp 0x4ffd
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/log.c
// Function: log_file_flush_callback_fun
int log_file_flush_callback_fun(void* args)
{
    FILE* fp = _file_log_ctx.fp;
    if(fp) {
        if(log_file_switch(args) != LOG_SUCCESS) {
            return LOG_FAIL;
        }
        if(_file_log_ctx.buf && _file_log_ctx.w_pos > 0) {
            _file_log_ctx.w_size += fwrite(_file_log_ctx.buf, 1,
                    _file_log_ctx.w_pos, _file_log_ctx.fp);
            _file_log_ctx.w_pos = 0;

            fflush(fp);
        }
    }
    return LOG_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x74ed(%rip), %rbx      # 0xc538
testq %rbx, %rbx
je 0x50aa
callq 0x50b3
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x50ac
movq 0x74e9(%rip), %rdi      # 0xc550
testq %rdi, %rdi
setne %cl
movl 0x74ed(%rip), %eax      # 0xc560
testl %eax, %eax
setg %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x50aa
movl %eax, %edx
movq 0x74b0(%rip), %rcx      # 0xc538
movl $0x1, %esi
callq 0x2350
addl %eax, 0x74c4(%rip)      # 0xc55c
movl $0x0, 0x74be(%rip)      # 0xc560
movq %rbx, %rdi
callq 0x22b0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/log.c
// Function: log_file_switch
static int log_file_switch(void* args)
{
    int sw_log = 0;

    if (_file_log_ctx.switch_time > 0) {
        struct timeval tv = { 0 };
        gettimeofday(&tv, NULL );
        struct tm* tm = localtime(&tv.tv_sec);

        if(tm->tm_mday != _file_log_ctx.sw_day) {
            int seconds = tm->tm_hour * 3600 + tm->tm_min * 60 + tm->tm_sec;
            if (seconds >= _file_log_ctx.switch_time) {
                sw_log = 1;
                _file_log_ctx.sw_day = tm->tm_mday;
            }
        }
    }
    if (!sw_log) {
        if (_file_log_ctx.switch_size > 0
                && _file_log_ctx.w_size >= _file_log_ctx.switch_size) {
            sw_log = 1;
        }
    }
    if (sw_log) {

        if (log_file_init_callback_fun(&_file_log_ctx) != LOG_SUCCESS) {
            return LOG_FAIL;
        }
    }

    return LOG_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
cmpl $0x0, 0x747f(%rip)      # 0xc544
jle 0x5116
xorps %xmm0, %xmm0
leaq -0x20(%rbp), %rbx
movaps %xmm0, (%rbx)
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2190
movq %rbx, %rdi
callq 0x2050
movl 0xc(%rax), %ecx
cmpl 0x7441(%rip), %ecx      # 0xc530
je 0x5119
imull $0xe10, 0x8(%rax), %edx # imm = 0xE10
imull $0x3c, 0x4(%rax), %esi
addl %edx, %esi
addl (%rax), %esi
cmpl 0x743e(%rip), %esi      # 0xc544
jl 0x5119
movl %ecx, 0x7422(%rip)      # 0xc530
movl $0x1, %r14d
jmp 0x5119
xorl %r14d, %r14d
movl 0x7429(%rip), %eax      # 0xc548
xorl %ecx, %ecx
cmpl %eax, 0x7435(%rip)      # 0xc55c
setge %cl
testl %eax, %eax
cmovlel %r14d, %ecx
testl %r14d, %r14d
cmovnel %r14d, %ecx
testl %ecx, %ecx
je 0x514b
callq 0x4bda
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x514d
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/util.c
// Function: set_signal
sigfunc* set_signal(int signo, sigfunc* func, int interupt)
{
    struct sigaction act, oact;
    act.sa_handler = func;
    sigemptyset(&act.sa_mask);
    act.sa_flags = 0;

    if (!interupt){
        act.sa_flags |= SA_RESTART;
    }
    if (sigaction(signo, &act, &oact) < 0) {
        return SIG_ERR ;
    }
    return oact.sa_handler;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movl %edx, %ebx
movl %edi, %r14d
leaq -0x140(%rbp), %r15
movq %rsi, -0x8(%r15)
movq %r15, %rdi
callq 0x2230
xorl %eax, %eax
testl %ebx, %ebx
sete %al
shll $0x1c, %eax
movl %eax, 0x80(%r15)
leaq -0x148(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
movl %r14d, %edi
callq 0x20c0
movl %eax, %ecx
movq $-0x1, %rax
testl %ecx, %ecx
js 0x51bb
movq -0xb0(%rbp), %rax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/util.c
// Function: make_daemon
int make_daemon()
{
    if (fork() > 0) {
        exit(0);
    }
    setsid();
    if (fork() > 0) {
        exit(0);
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
callq 0x23a0
testl %eax, %eax
jg 0x51e8
callq 0x21d0
callq 0x23a0
testl %eax, %eax
jg 0x51e8
xorl %eax, %eax
popq %rbp
retq
xorl %edi, %edi
callq 0x2340
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/util.c
// Function: is_prog_running
int is_prog_running(const char* name)
{
    if(name == NULL || name[0] == 0) return -1;

    char file[MAX_PATH_LEN] = { 0 };
    snprintf(file, MAX_PATH_LEN - 1, "/tmp/%s.running", name);

    umask(0111);

    int fd = open(file, O_RDWR | O_CREAT | O_SYNC, 0666);
    if (fd < 0) {
        return -1;
    }

    struct flock lck = {0};
    lck.l_type = F_WRLCK;
    lck.l_whence = SEEK_SET;
    lck.l_start = sizeof(pid_t);

    int len = 0;
    pid_t pid = -1;

    if(fcntl(fd, F_SETLK, &lck) < 0){
        len = read(fd, &pid, sizeof(pid_t));
        if(len != sizeof(pid_t)) {
            printf("read pid failed. error: %s\n", strerror(errno));
            close(fd);
            return -1;
        }
        close(fd);
        return 1;
    }

    pid = getpid();

    lseek(fd, 0, SEEK_SET);
    len = write(fd, &pid, sizeof(pid_t));
    if(len != sizeof(pid_t)){
        lck.l_type = F_UNLCK;
        fcntl(fd, F_SETLK, &lck);
        close(fd);
        return -1;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x535a
movq %rdi, %rbx
cmpb $0x0, (%rdi)
je 0x535a
leaq -0x140(%rbp), %r14
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
xorl %esi, %esi
callq 0x21a0
leaq 0x2ff5(%rip), %rdx      # 0x8250
movl $0xff, %esi
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2170
movl $0x49, %edi
callq 0x2240
movq %r14, %rdi
movl $0x101042, %esi         # imm = 0x101042
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x22f0
testl %eax, %eax
js 0x530d
movl %eax, %ebx
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x10(%rdx)
movl $0x1, (%rdx)
movq $0x4, 0x8(%rdx)
movl $0xffffffff, -0x1c(%rbp) # imm = 0xFFFFFFFF
xorl %r14d, %r14d
movl %eax, %edi
movl $0x6, %esi
xorl %eax, %eax
callq 0x20e0
testl %eax, %eax
js 0x5315
callq 0x2100
leaq -0x1c(%rbp), %r15
movl %eax, (%r15)
movl %ebx, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2180
movl $0x4, %edx
movl %ebx, %edi
movq %r15, %rsi
callq 0x20f0
cmpl $0x4, %eax
je 0x535a
leaq -0x40(%rbp), %rdx
movw $0x2, (%rdx)
movl %ebx, %edi
movl $0x6, %esi
xorl %eax, %eax
callq 0x20e0
jmp 0x534d
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x535a
leaq -0x1c(%rbp), %rsi
movl $0x4, %edx
movl %ebx, %edi
callq 0x21e0
movl $0x1, %r14d
cmpl $0x4, %eax
je 0x5353
callq 0x2060
movl (%rax), %edi
callq 0x2370
leaq 0x2f1d(%rip), %rdi      # 0x8260
movq %rax, %rsi
xorl %eax, %eax
callq 0x2160
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %ebx, %edi
callq 0x21c0
movl %r14d, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/util.c
// Function: runas
int runas(const char* user)
{
    struct passwd* passwd = getpwuid(getuid());

    if(strcmp(passwd->pw_name, user) == 0) {
        return 0;
    }

    passwd = getpwnam(user);
    if(passwd == NULL) {
        return -1;
    }

/*    struct group* group = getgrnam(grp);
    if(group == NULL) {
        return -1;
    }*/

    if(setuid(passwd->pw_uid) != 0) {
        fprintf(stderr, "setuid failed,: %s\n", strerror(errno));
        return -1;
    }
/*    if(setgid(group->gr_gid) != 0){
        fprintf(stderr, "setgid failed: %s\n", strerror(errno));
        return -1;
    }*/

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
callq 0x2140
movl %eax, %edi
callq 0x2120
movq (%rax), %rdi
movq %r14, %rsi
callq 0x2200
xorl %ebx, %ebx
testl %eax, %eax
je 0x53b5
movq %r14, %rdi
callq 0x2210
testq %rax, %rax
je 0x53b0
movl 0x10(%rax), %edi
callq 0x2360
testl %eax, %eax
je 0x53b5
callq 0x2525
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/util.c
// Function: write_pid_file
int write_pid_file(const char* file)
{
    FILE* fp = fopen(file, "w");
    if(fp == NULL){
        return -1;
    }

    fprintf(fp, "%d", getpid());

    fclose(fp);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x2ec6(%rip), %rsi      # 0x8290
callq 0x2300
testq %rax, %rax
je 0x53fc
movq %rax, %rbx
callq 0x2100
leaq 0x2e67(%rip), %rsi      # 0x824a
xorl %r14d, %r14d
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2220
movq %rbx, %rdi
callq 0x2110
jmp 0x5402
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/util.c
// Function: read_pid_file
int read_pid_file(pid_t* pid, const char* file)
{
    FILE* fp = fopen(file, "r");
    if(fp == NULL){
        return -1;
    }

    fscanf(fp, "%d", pid);

    fclose(fp);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x2d39(%rip), %rsi      # 0x815a
movq %rax, %rdi
callq 0x2300
testq %rax, %rax
je 0x5452
movq %rax, %r15
leaq 0x2e12(%rip), %rsi      # 0x824a
xorl %r14d, %r14d
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x20a0
movq %r15, %rdi
callq 0x2110
jmp 0x5458
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/util.c
// Function: get_1970_sec_0_am
time_t get_1970_sec_0_am()
{
    time_t now = get_1970_sec();
    struct tm now_tm = {0};

    localtime_r(&now, &now_tm);

    now_tm.tm_hour = 0;
    now_tm.tm_min = 0;
    now_tm.tm_sec = 0;

    return mktime(&now_tm) + SEC_1900_1970;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x2270
leaq -0x18(%rbp), %rdi
movq %rax, (%rdi)
leaq -0x50(%rbp), %rbx
movq %r14, 0x30(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rbx)
movaps %xmm0, 0x10(%rbx)
movaps %xmm0, (%rbx)
movq %rbx, %rsi
callq 0x2080
movl $0x0, 0x8(%rbx)
movq %r14, (%rbx)
movq %rbx, %rdi
callq 0x22d0
movl $0x83aa7e80, %ecx       # imm = 0x83AA7E80
addq %rcx, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/util.c
// Function: sec_1970_to_datetime
int sec_1970_to_datetime(time_t sec, const char* fmt, char* datetime, int len)
{
    if(datetime == NULL)
        return -1;

    memset(datetime, 0, len);

    struct tm rst;
    localtime_r(&sec, &rst);
    snprintf(datetime, len, fmt, rst.tm_year + 1900, rst.tm_mon + 1,
            rst.tm_mday, rst.tm_hour, rst.tm_min, rst.tm_sec);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, -0x30(%rbp)
testq %rdx, %rdx
je 0x568c
movq %rdx, %r15
movq %rsi, %r14
movslq %ecx, %r12
xorl %ebx, %ebx
movq %rdx, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x21a0
leaq -0x30(%rbp), %rdi
leaq -0x68(%rbp), %r13
movq %r13, %rsi
callq 0x2080
movl $0x76c, %ecx            # imm = 0x76C
addl 0x14(%r13), %ecx
movl 0x10(%r13), %r8d
incl %r8d
movl 0xc(%r13), %r9d
movl 0x8(%r13), %r10d
movl (%r13), %r11d
movl 0x4(%r13), %r13d
subq $0x8, %rsp
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
pushq %r11
pushq %r13
pushq %r10
callq 0x2170
addq $0x20, %rsp
jmp 0x5691
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/util.c
// Function: sec_1970_to_date
int sec_1970_to_date(time_t sec, const char* fmt, char* time, int len)
{
    if(time == NULL) return -1;

    memset(time, 0, len);

    struct tm rst;
    localtime_r(&sec, &rst);
    snprintf(time, len, fmt,  rst.tm_year + 1900, rst.tm_mon + 1,
            rst.tm_mday);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, -0x30(%rbp)
testq %rdx, %rdx
je 0x570a
movq %rdx, %r15
movq %rsi, %r14
movslq %ecx, %r12
xorl %ebx, %ebx
movq %rdx, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x21a0
leaq -0x30(%rbp), %rdi
leaq -0x68(%rbp), %r13
movq %r13, %rsi
callq 0x2080
movl $0x76c, %ecx            # imm = 0x76C
addl 0x14(%r13), %ecx
movl 0xc(%r13), %r9d
movl 0x10(%r13), %r8d
incl %r8d
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2170
jmp 0x570f
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/util.c
// Function: sec_1970_to_time
int sec_1970_to_time(time_t sec, const char* fmt, char* time, int len)
{
    if(time == NULL) return -1;

    memset(time, 0, len);

    struct tm rst;
    localtime_r(&sec, &rst);
    snprintf(time, len, fmt,  rst.tm_hour, rst.tm_min, rst.tm_sec);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, -0x30(%rbp)
testq %rdx, %rdx
je 0x5780
movq %rdx, %r15
movq %rsi, %r14
movslq %ecx, %r12
xorl %ebx, %ebx
movq %rdx, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x21a0
leaq -0x30(%rbp), %rdi
leaq -0x68(%rbp), %r13
movq %r13, %rsi
callq 0x2080
movl 0x8(%r13), %ecx
movl (%r13), %r9d
movl 0x4(%r13), %r8d
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2170
jmp 0x5785
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/util.c
// Function: sec_1970_to_numeric
int sec_1970_to_numeric(time_t s,
        int* year, int* mon, int* day,
        int* hour, int* min, int* sec)
{
    if(!year || !mon || !day ||
            !hour || !min || !sec){
        return -1;
    }

    struct tm rst;
    localtime_r(&s, &rst);
    *year = rst.tm_year + 1900;
    *mon = rst.tm_mon + 1;
    *day = rst.tm_mday;

    *hour = rst.tm_hour;
    *min = rst.tm_min;
    *sec = rst.tm_sec;

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %r15
movq %rdx, %r12
movq %rdi, -0x38(%rbp)
testq %rsi, %rsi
sete %al
testq %rdx, %rdx
sete %cl
orb %al, %cl
testq %r15, %r15
sete %al
testq %r8, %r8
sete %dl
orb %al, %dl
orb %cl, %dl
testq %r9, %r9
sete %cl
orb %dl, %cl
cmpq $0x0, 0x10(%rbp)
sete %dl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
orb %cl, %dl
jne 0x5836
movq %r8, %r14
movq %rsi, %r13
leaq -0x38(%rbp), %rdi
leaq -0x70(%rbp), %rbx
movq %rbx, %rsi
movq %r9, -0x30(%rbp)
callq 0x2080
movl $0x76c, %eax            # imm = 0x76C
addl 0x14(%rbx), %eax
movl %eax, (%r13)
movl 0x10(%rbx), %eax
incl %eax
movl %eax, (%r12)
movl 0xc(%rbx), %eax
movl %eax, (%r15)
movl 0x8(%rbx), %eax
movl %eax, (%r14)
movl 0x4(%rbx), %eax
movq -0x30(%rbp), %rcx
movl %eax, (%rcx)
movl (%rbx), %eax
movq 0x10(%rbp), %rcx
movl %eax, (%rcx)
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/util.c
// Function: split
int split(const char* text, char needle, char** dest, int size, int num)
{
    if (!text || text[0] == 0 || !dest || size <= 0 || num <= 0) {
        return -1;
    }
    const char* orig = text;
    const char* tmp = text;

    int cur_num = 0;
    while ((tmp = strchr(tmp, needle)) != NULL) {
        int len = tmp - orig;

        if (len >= size) {
            return -1;
        }
        if (cur_num >= num) {
            return -1;
        }

        memcpy((char*)dest + size*cur_num, orig, len);
        *((char*)dest + size*cur_num + len) = 0;

        cur_num++;
        tmp++;
        orig = tmp;
    }
    if(orig != NULL){
        strcpy((char*)dest + size*cur_num, orig);
        cur_num ++ ;
    }
    if(cur_num == 0){
        strcpy((char*)dest, text);
        cur_num++;
    }
    return cur_num;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, -0x30(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x5a6b
movl %r8d, %r13d
testl %r8d, %r8d
jle 0x5a6b
movl %ecx, %r15d
testl %ecx, %ecx
jle 0x5a6b
cmpq $0x0, -0x30(%rbp)
je 0x5a6b
cmpb $0x0, (%rdi)
je 0x5a6b
movsbl %sil, %eax
movl %eax, -0x3c(%rbp)
xorl %r12d, %r12d
movq %rdi, %rsi
movq %rdi, -0x48(%rbp)
movq %rdi, %r14
movl %r13d, -0x34(%rbp)
movq %rsi, %rbx
movq %r14, %rdi
movl -0x3c(%rbp), %esi
callq 0x2150
testq %rax, %rax
je 0x5a36
movq %rax, %r14
movq %rbx, %rsi
subq %rbx, %rax
cmpl %r15d, %eax
setl %cl
cmpl %r13d, %r12d
setl %bl
andb %cl, %bl
cmpb $0x1, %bl
jne 0x5a2b
movl %r12d, %ecx
imull %r15d, %ecx
movslq %ecx, %r13
addq -0x30(%rbp), %r13
movl %r12d, -0x38(%rbp)
movl %r15d, %r12d
movslq %eax, %r15
movq %r13, %rdi
movq %r15, %rdx
callq 0x2250
movb $0x0, (%r15,%r13)
movl -0x34(%rbp), %r13d
movl %r12d, %r15d
movl -0x38(%rbp), %r12d
incl %r12d
incq %r14
movq %r14, %rsi
testb %bl, %bl
jne 0x59c0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x5a6b
testq %rbx, %rbx
je 0x5a51
movq %rbx, %rsi
imull %r12d, %r15d
movslq %r15d, %rdi
addq -0x30(%rbp), %rdi
callq 0x2090
incl %r12d
movq -0x48(%rbp), %rsi
movl %r12d, %eax
testl %r12d, %r12d
jne 0x5a6b
movq -0x30(%rbp), %rdi
callq 0x2090
movl $0x1, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/util.c
// Function: trim_left
const char* trim_left(const char* text, const char* needle, char* dest, int size)
{
    if(!text || text[0] == 0 ||
            !needle || needle[0] == 0 ||
            !dest || size <= 0){
        return NULL;
    }

    memset(dest, 0, size);

    int count = 0;
    int match = 0;
    while (*(text + count) != 0) {
        if (NULL != strchr(needle, *(text + count))) {
            ++match;
        } else {
            break;
        }
        ++count;
    }
    count = strlen(text + match);
    if (count >= size) {
        return NULL;
    }
    strncpy(dest, text + match, size);

    return dest;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x5b29
movq %rsi, %r13
testq %rsi, %rsi
je 0x5b29
movq %rdi, %r14
cmpb $0x0, (%rdi)
je 0x5b29
movl %ecx, %r15d
testl %ecx, %ecx
jle 0x5b29
movq %rdx, %rbx
testq %rdx, %rdx
je 0x5b29
cmpb $0x0, (%r13)
je 0x5b29
movl %r15d, %edx
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %esi, %esi
movq %rdx, -0x30(%rbp)
callq 0x21a0
movb (%r14), %al
testb %al, %al
je 0x5afc
xorl %r12d, %r12d
movsbl %al, %esi
movq %r13, %rdi
callq 0x2150
testq %rax, %rax
je 0x5af9
movb 0x1(%r14,%r12), %al
incq %r12
testb %al, %al
jne 0x5add
movl %r12d, %r12d
addq %r12, %r14
movq %r14, %rdi
callq 0x2130
cmpl %r15d, %eax
jge 0x5b29
movq %rbx, %rdi
movq %r14, %rsi
movq -0x30(%rbp), %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2070
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/util.c
// Function: trim_right
const char* trim_right(const char* text, const char* needle, char* dest, int size)
{
    if(!text || text[0] == 0 ||
            !needle || needle[0] == 0 ||
            !dest || size <= 0){
        return NULL;
    }

    memset(dest, 0, size);

    int len = strlen(text);

    const char *p = text + len - 1;

    while (p >= text) {
        if (strchr(needle, *p) != NULL) {
            --p;
            --len;
        } else {
            break;
        }

    }
    if(len >= size) {
        return NULL;
    }
    strncpy(dest, text, len);

    return dest;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x5be0
movq %rsi, %r12
testq %rsi, %rsi
je 0x5be0
movq %rdi, %r14
cmpb $0x0, (%rdi)
je 0x5be0
movl %ecx, %r15d
testl %ecx, %ecx
jle 0x5be0
movq %rdx, %rax
testq %rdx, %rdx
je 0x5be0
cmpb $0x0, (%r12)
je 0x5be0
movl %r15d, %edx
movq %rax, -0x30(%rbp)
movq %rax, %rdi
xorl %esi, %esi
callq 0x21a0
movq %r14, %rdi
callq 0x2130
movq %rax, %r13
movslq %r13d, %rax
leaq (%r14,%rax), %rbx
decq %rbx
cmpq %r14, %rbx
jb 0x5bbe
movsbl (%rbx), %esi
movq %r12, %rdi
callq 0x2150
testq %rax, %rax
je 0x5bbe
decl %r13d
decq %rbx
jmp 0x5ba1
cmpl %r15d, %r13d
movq -0x30(%rbp), %rdi
jge 0x5be0
movslq %r13d, %rdx
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2070
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/util.c
// Function: trim
const char* trim(const char* text, const char* needle, char* dest, int size)
{
    char tmp[size];
    memset(tmp, 0, size);

    if(trim_left(text, needle, tmp, size) == NULL) {
        return NULL;
    }

    if(trim_right(tmp, needle, dest, size) == NULL) {
        return NULL;
    }
    return dest;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r14d
movq %rdx, -0x38(%rbp)
movq %rsi, %rbx
movq %rdi, -0x30(%rbp)
movl %ecx, %eax
movq %rsp, %r12
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
movslq %ecx, %r15
xorl %r13d, %r13d
movq %r12, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x21a0
movq -0x30(%rbp), %rdi
movq %rbx, -0x30(%rbp)
movq %rbx, %rsi
movq %r12, %rdx
movl %r15d, %ecx
callq 0x5a7a
testq %rax, %rax
je 0x5c6e
movq %r12, %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %r13
movq %r13, %rdx
movl %r14d, %ecx
callq 0x5b3a
testq %rax, %rax
cmoveq %rax, %r13
movq %r13, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/mysch.c
// Function: reg_sign
int reg_sign()
{
    REGISTER_SIGNAL(SIGTERM, sigterm, 0);//Kill信号
    REGISTER_SIGNAL(SIGINT, sigterm, 0);//终端CTRL-C信号
    REGISTER_SIGNAL(SIGUSR1, sigusr1, 0);//SIGUSR1信号
    REGISTER_SIGNAL(SIGUSR2, sigusr2, 0);//SIGUSR2信号
    REGISTER_SIGNAL(SIGHUP, SIG_IGN, 0);//忽略SIGHUP信号
    REGISTER_SIGNAL(SIGCHLD, sigchild, 0);//子进程退出
    REGISTER_SIGNAL(SIGPIPE, SIG_IGN, 0);//忽略SIGPIPE信号
    REGISTER_SIGNAL(SIGALRM, SIG_IGN, 0);//忽略SIGALRM信号

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x11f(%rip), %rsi       # 0x5dad
movl $0xf, %ebx
movl $0xf, %edi
xorl %edx, %edx
callq 0x5158
cmpq $-0x1, %rax
je 0x5d80
leaq 0xfd(%rip), %rsi        # 0x5dad
movl $0x2, %ebx
movl $0x2, %edi
xorl %edx, %edx
callq 0x5158
cmpq $-0x1, %rax
je 0x5d80
leaq 0xe8(%rip), %rsi        # 0x5dba
movl $0xa, %ebx
movl $0xa, %edi
xorl %edx, %edx
callq 0x5158
cmpq $-0x1, %rax
je 0x5d80
leaq 0xd3(%rip), %rsi        # 0x5dc7
movl $0xc, %ebx
movl $0xc, %edi
xorl %edx, %edx
callq 0x5158
cmpq $-0x1, %rax
je 0x5d80
movl $0x1, %ebx
movl $0x1, %esi
movl $0x1, %edi
xorl %edx, %edx
callq 0x5158
cmpq $-0x1, %rax
je 0x5d80
leaq 0xa6(%rip), %rsi        # 0x5dd4
movl $0x11, %ebx
movl $0x11, %edi
xorl %edx, %edx
callq 0x5158
cmpq $-0x1, %rax
je 0x5d80
movl $0xd, %ebx
xorl %r14d, %r14d
movl $0x1, %esi
movl $0xd, %edi
xorl %edx, %edx
callq 0x5158
cmpq $-0x1, %rax
je 0x5d80
movl $0xe, %ebx
movl $0x1, %esi
movl $0xe, %edi
xorl %edx, %edx
callq 0x5158
cmpq $-0x1, %rax
jne 0x5da5
callq 0x2060
movl (%rax), %edi
callq 0x2370
leaq 0x251d(%rip), %rdi      # 0x82b0
movl %ebx, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2160
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/mysch.c
// Function: uninit_context
void uninit_context(sch_info_t* info)
{
    if(info->progq) {
        list_iter* it = list_get_iterator(info->progq, AL_START_HEAD);
        list_node* n = NULL;
        while((n = list_next(it)) != NULL) {
            prog_t* p = list_node_value(n);
            if(p->cond) {
                list_release(p->cond, AL_FREE);
            }
        }

        list_release_iterator(it);
        list_release(info->progq, AL_FREE);
    }
    if(info->waitq) {
        dict_release(info->waitq);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x248(%rdi), %rdi
testq %rdi, %rdi
je 0x5e6c
xorl %esi, %esi
callq 0x3670
movq %rax, %r14
movq %rax, %rdi
callq 0x36d6
testq %rax, %rax
je 0x5e56
movq 0x10(%rax), %rax
movq 0xa58(%rax), %rdi
testq %rdi, %rdi
je 0x5e51
xorl %esi, %esi
callq 0x347b
movq %r14, %rdi
jmp 0x5e30
movq %r14, %rdi
callq 0x36a5
movq 0x248(%rbx), %rdi
xorl %esi, %esi
callq 0x347b
movq 0x250(%rbx), %rdi
testq %rdi, %rdi
je 0x5e81
popq %rbx
popq %r14
popq %rbp
jmp 0x2f4a
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/mysch.c
// Function: usage
void usage()
{
    printf("./myshc [-c config] [-h]\n");
    printf("--simple program scheduler\n\n");
    printf("  -c config    load configuration file.\n");
    printf("  -e           don't run as daemon process.\n");
    printf("  -t           test configuration file.\n");
    printf("  -h           show this help message.\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x1c06(%rip), %rdi      # 0x882b
callq 0x20b0
leaq 0x1c13(%rip), %rdi      # 0x8844
callq 0x20b0
leaq 0x1c23(%rip), %rdi      # 0x8860
callq 0x20b0
leaq 0x1c3f(%rip), %rdi      # 0x8888
callq 0x20b0
leaq 0x1c5f(%rip), %rdi      # 0x88b4
callq 0x20b0
leaq 0x1c7b(%rip), %rdi      # 0x88dc
popq %rbp
jmp 0x20b0
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/mysch.c
// Function: judge_condition
int judge_condition(prog_t* prog)
{
    if(prog->flag <= 0 || !prog->cond) {
        return 1;
    }

    struct timeval tv = {0};
    gettimeofday(&tv, NULL);
    struct tm* tm = localtime(&tv.tv_sec);

    int wday = tm->tm_wday;
    if(wday == 0) {
        wday = 7; // 星期天
    }
    int sec = tm->tm_hour * 3600 + tm->tm_min * 60 + tm->tm_sec;

    list_iter* it = list_get_iterator(prog->cond, AL_START_HEAD);
    list_node* node = NULL;
    while((node = list_next(it)) != NULL) {
        cond_t* c = list_node_value(node);

        if(c->day[wday] == 1) {
        	if(prog->flag == FORK_PERIOD) {
        		int diff = time(NULL) - prog->time;
        		if(diff > c->start) {
        			list_release_iterator(it);
        			return 1;
        		}
        	}
            if(sec >= c->start && sec <= c->end) {
                list_release_iterator(it);
                return 1;
            }
        }
    }

    list_release_iterator(it);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl $0x1, %r15d
cmpl $0x0, 0xa50(%rdi)
jle 0x6d69
movq %rdi, %rbx
cmpq $0x0, 0xa58(%rdi)
je 0x6d69
xorps %xmm0, %xmm0
leaq -0x50(%rbp), %r14
movaps %xmm0, (%r14)
xorl %r15d, %r15d
movq %r14, %rdi
xorl %esi, %esi
callq 0x2190
movq %r14, %rdi
callq 0x2050
movl 0x18(%rax), %r12d
movslq 0x8(%rax), %rcx
movq %rcx, -0x30(%rbp)
movslq 0x4(%rax), %r13
movslq (%rax), %rax
movq %rax, -0x38(%rbp)
movq 0xa58(%rbx), %rdi
xorl %esi, %esi
callq 0x3670
movq %rax, %r14
movq %rax, %rdi
callq 0x36d6
testq %rax, %rax
je 0x6d61
imulq $0x3c, %r13, %rcx
imulq $0xe10, -0x30(%rbp), %r15 # imm = 0xE10
addq %rcx, %r15
addq -0x38(%rbp), %r15
testl %r12d, %r12d
movl $0x7, %ecx
cmovnel %r12d, %ecx
movslq %ecx, %r12
movq 0x10(%rax), %r13
cmpb $0x1, (%r13,%r12)
jne 0x6d49
cmpl $0x2, 0xa50(%rbx)
jne 0x6d3d
xorl %edi, %edi
callq 0x2270
subl 0xa68(%rbx), %eax
cltq
cmpq 0x8(%r13), %rax
jg 0x6d5b
cmpq %r15, 0x8(%r13)
jg 0x6d49
cmpq %r15, 0x10(%r13)
jge 0x6d5b
movq %r14, %rdi
callq 0x36d6
testq %rax, %rax
jne 0x6d13
xorl %r15d, %r15d
jmp 0x6d61
movl $0x1, %r15d
movq %r14, %rdi
callq 0x36a5
movl %r15d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/mysch.c
// Function: handle_sigchild
void handle_sigchild()
{
    pid_t pid;
    int status = 0;
    while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
        prog_t** pp = (prog_t**)dict_fetch_value(g_info.waitq,
                &pid, sizeof(pid));
        prog_t* p = *pp;

        p->status = status;
        p->time = time(NULL);

        if(dict_delete(g_info.waitq, &pid, sizeof(pid))!= DICT_OK) {
            LOG_ERROR("dict_delete failed. pid = %d\n", pid);
        }
    }
    g_chld = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
leaq -0x28(%rbp), %rsi
movl $0x0, (%rsi)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x1, %edx
callq 0x22e0
movl %eax, -0x24(%rbp)
testl %eax, %eax
jle 0x6e28
leaq -0x24(%rbp), %rbx
leaq -0x28(%rbp), %r14
leaq 0x17da(%rip), %r15      # 0x8593
movq 0x59f8(%rip), %rdi      # 0xc7b8
movq %rbx, %rsi
movl $0x4, %edx
callq 0x2f73
movq (%rax), %r12
movl -0x28(%rbp), %eax
movl %eax, 0xa60(%r12)
xorl %edi, %edi
callq 0x2270
movq %rax, 0xa68(%r12)
movq 0x59c7(%rip), %rdi      # 0xc7b8
movq %rbx, %rsi
movl $0x4, %edx
callq 0x2d60
testl %eax, %eax
je 0x6e0f
movl -0x24(%rbp), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x4838
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %r14, %rsi
movl $0x1, %edx
callq 0x22e0
movl %eax, -0x24(%rbp)
testl %eax, %eax
jg 0x6db9
movb $0x0, 0x5991(%rip)      # 0xc7c0
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/mysch.c
// Function: handle_sigusr1
void handle_sigusr1()
{
    int ret = 0;

    ret = load_conf(&g_info, LOAD_CONF_RELOAD);
    if(ret != 0) {
        LOG_ERROR("reload config failed. exiting...\n");
    }else{
        LOG_INFO("prepare for restart program. killing...\n");
    }

    clean_proccess(1);

    g_usr1 = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x5721(%rip), %rdi      # 0xc568
movl $0x1, %esi
callq 0x5e86
testl %eax, %eax
je 0x6e65
leaq 0x1755(%rip), %rdi      # 0x85b1
xorl %eax, %eax
callq 0x4838
jmp 0x6e73
leaq 0x1767(%rip), %rdi      # 0x85d3
xorl %eax, %eax
callq 0x46e4
movl $0x1, %edi
callq 0x6e86
movb $0x0, 0x5940(%rip)      # 0xc7c4
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/mysch.c
// Function: clean_proccess
void clean_proccess(int killflag)
{
    dict_iterator* it = dict_get_iterator(g_info.waitq);
    dict_entry* de = NULL;
    while((de = dict_next(it)) != NULL) {
        pid_t* p = (pid_t*) dict_get_entry_key(de);
        if (killflag) {
            LOG_INFO("killing %d\n", *p);
            kill(*p, SIGTERM);
            waitpid(*p, NULL, 0);
            LOG_INFO("%d killed\n", *p);
        }else{
            prog_t* prog = *(prog_t**)dict_get_entry_val(de);
            LOG_INFO("program %s continue running even i die, pid: %d\n",
                    prog->cmd, *p);
        }

        dict_delete(g_info.waitq, p, sizeof(*p));
    }

    dict_release_iterator(it);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
movq 0x591b(%rip), %rdi      # 0xc7b8
callq 0x2f8b
movq %rax, %r14
movq %rax, %rdi
callq 0x2ffd
testq %rax, %rax
je 0x6f42
leaq 0x173f(%rip), %r12      # 0x85fc
leaq 0x1744(%rip), %r13      # 0x8608
movq 0x8(%rax), %r15
testl %ebx, %ebx
je 0x6f01
movl (%r15), %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x46e4
movl (%r15), %edi
movl $0xf, %esi
callq 0x2260
movl (%r15), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x22e0
movl (%r15), %esi
movq %r13, %rdi
xorl %eax, %eax
callq 0x46e4
jmp 0x6f21
movq 0x10(%rax), %rax
movq (%rax), %rsi
movl $0x10c, %eax            # imm = 0x10C
addq %rax, %rsi
movl (%r15), %edx
leaq 0x16f9(%rip), %rdi      # 0x8613
xorl %eax, %eax
callq 0x46e4
movq 0x5890(%rip), %rdi      # 0xc7b8
movq %r15, %rsi
movl $0x4, %edx
callq 0x2d60
movq %r14, %rdi
callq 0x2ffd
testq %rax, %rax
jne 0x6ec4
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x307e
// File: /workspace/github_c_makefile_star2_O1/buf1024[P]mysch/mysch.c
// Function: update_pid
int update_pid(prog_t* prog)
{
    int ret = 0;
    if(!prog->update_pid && prog->has_pid_file) {
        if (prog->pid_file[0] != 0) {
            pid_t pid;
            if (read_pid_file(&pid, prog->pid_file) == 0) {
                if (kill(pid, 0) == 0) {
                    LOG_INFO("update pid from %d to %d\n", prog->pid, pid);

                    prog->pid = pid;
                    prog->update_pid = 1;

                    // 新进程信息

                    pid_t* dp = (pid_t*)malloc(sizeof(dp));
                    prog_t** dpp = (prog_t**)malloc(sizeof(dpp));

                    *dp = pid;
                    *dpp = prog;

                    dict_add(g_info.waitq, dp, sizeof(*dp), dpp, sizeof(*dpp));
                }
            } else {
                LOG_WARN("read_pid_file failed, pidfile = %s, error  = %s\n",
                        prog->pid_file, strerror(errno));
                ret = -1;
            }
        }
    }
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
xorl %ebx, %ebx
cmpl $0x0, 0x4(%rdi)
je 0x7166
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %r14
cmpl $0x0, 0x8(%rdi)
je 0x7157
cmpb $0x0, 0xc(%r14)
je 0x7157
leaq 0xc(%r14), %rbx
leaq -0x24(%rbp), %rdi
movq %rbx, %rsi
callq 0x540a
testl %eax, %eax
je 0x71b1
callq 0x2060
movl (%rax), %edi
callq 0x2370
leaq 0x152f(%rip), %rdi      # 0x86cc
movq %rbx, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x478e
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x7157
movl -0x24(%rbp), %edi
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x2260
testl %eax, %eax
jne 0x7157
movl (%r14), %esi
movl -0x24(%rbp), %edx
leaq 0x14e4(%rip), %rdi      # 0x86b2
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x46e4
movl -0x24(%rbp), %r12d
movl %r12d, (%r14)
movl $0x1, 0x4(%r14)
movl $0x8, %edi
callq 0x22a0
movq %rax, %r15
movl $0x8, %edi
callq 0x22a0
movl %r12d, (%r15)
movq %r14, (%rax)
movq 0x55ae(%rip), %rdi      # 0xc7b8
movq %r15, %rsi
movl $0x4, %edx
movq %rax, %rcx
movl $0x8, %r8d
callq 0x2a3a
jmp 0x7157
// File: /workspace/github_c_makefile_star2_O1/mflatt[P]gc-demo/common/tree.c
// Function: main
int main(int argc, char **argv)
{
  /* create one tree without intermediate garbage: */
  struct node *init_n = make_tree(10);
  PUSH_STACK_POINTER(init_n);

  /* create a larger tree with lots of intermediate garbage: */
  create_garbage = 1;
  struct node *n = NULL;
  PUSH_STACK_POINTER(n);
  SET_NODE(n, make_tree(16));

  /* check the trees: */
  printf("%d\n", count(n) + count(init_n));
  
  destroy_tree(n);
  destroy_tree(init_n);

  UNSET_NODE(n);
  UNSET_NODE(init_n);

  POP_STACK_POINTER(n);
  POP_STACK_POINTER(init_n);

  printf("Peak memory use: %ld\n", peak_mem_use);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl $0xa, %edi
callq 0x11d4
movq %rax, %rbx
movb $0x1, 0x2ed0(%rip)      # 0x4044
movl $0x10, %edi
callq 0x11d4
movq %rax, %r14
movq %rax, %rdi
callq 0x1226
movl %eax, %ebp
movq %rbx, %rdi
callq 0x1226
addl %eax, %ebp
leaq 0xe68(%rip), %rdi       # 0x2004
movl %ebp, %esi
xorl %eax, %eax
callq 0x1040
movq %r14, %rdi
callq 0x1250
movq %rbx, %rdi
callq 0x1250
leaq 0x2e94(%rip), %rax      # 0x4050
movq (%rax), %rsi
leaq 0xe42(%rip), %rdi       # 0x2008
xorl %eax, %eax
callq 0x1040
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mflatt[P]gc-demo/common/tree.c
// Function: destroy_tree
static void destroy_tree(struct node *n)
{
#if MANUAL_DEALLOCATE
  if (n != NULL) {
    destroy_tree(n->left);
    destroy_tree(n->right);
    deallocate(n);
  }
#endif
}

// Assembly:
testq %rdi, %rdi
je 0x1273
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x1250
movq 0x8(%rbx), %rdi
callq 0x1250
movq %rbx, %rdi
popq %rbx
jmp 0x12b6
retq
// File: /workspace/github_c_makefile_star2_O1/mflatt[P]gc-demo/common/mem.c
// Function: raw_malloc
void *raw_malloc(size_t s)
{
  mem_use += s;
  if (mem_use > peak_mem_use)
    peak_mem_use = mem_use;
  return malloc(s);
}

// Assembly:
movq 0x2dcd(%rip), %rax      # 0x4048
addq %rdi, %rax
movq %rax, 0x2dc3(%rip)      # 0x4048
cmpq 0x2dc4(%rip), %rax      # 0x4050
jbe 0x1050
movq %rax, 0x2db7(%rip)      # 0x4050
jmp 0x1050
// File: /workspace/github_c_makefile_star2_O1/mincebert[P]maketzx/maketzx.c
// Function: itoa
int itoa (int n, char *buff, int base)
{ int i,l;   // this only works with base <= 10, but who cares...
  l=sizeof(buff);
  for(i=0;i<l;i++)
     { buff[l-1-i]='0'+n%base;
       n/=base;
     }
  return 0;
}

// Assembly:
movl %edx, %ecx
movl %edi, %eax
movl $0x8, %edi
cltd
idivl %ecx
addb $0x30, %dl
movb %dl, -0x1(%rsi,%rdi)
decq %rdi
jne 0x1295
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/mincebert[P]maketzx/maketzx.c
// Function: strupr
char *strupr(char *s)
{ int i,l;
  l=strlen(s);
  for(i=0;i<l;i++) if((s[i]>='a')&&(s[i]<='z')) s[i]-=32;
  return s;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x10a0
testl %eax, %eax
jle 0x12d5
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %ecx, %ecx
movb (%rbx,%rcx), %dl
leal -0x61(%rdx), %esi
cmpb $0x19, %sil
ja 0x12cd
addb $-0x20, %dl
movb %dl, (%rbx,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x12bb
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/mincebert[P]maketzx/maketzx.c
// Function: strlwr
char *strlwr(char *s)
{ int i,l;
  l=strlen(s);
  for(i=0;i<l;i++) if((s[i]>='A')&&(s[i]<='Z')) s[i]+=32;
  return s;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x10a0
testl %eax, %eax
jle 0x1308
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %ecx, %ecx
movb (%rbx,%rcx), %dl
leal -0x41(%rdx), %esi
cmpb $0x19, %sil
ja 0x1300
orb $0x20, %dl
movb %dl, (%rbx,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x12ee
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/mincebert[P]maketzx/maketzx.c
// Function: strnset
char *strnset(char *s, int ch, int n)
{ int i;
  if(n>strlen(s)) n=strlen(s);
  for(i=0;i<n;i++) s[i]=ch;
  return s;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movslq %edx, %r15
callq 0x10a0
cmpq %r15, %rax
cmovbl %eax, %r15d
testl %r15d, %r15d
jle 0x133d
movl %r15d, %edx
movq %r14, %rdi
movl %ebx, %esi
popq %rbx
popq %r14
popq %r15
jmp 0x10e0
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/mincebert[P]maketzx/maketzx.c
// Function: strrev
char *strrev(char *s)
{ int i;
  char c;
  for(i=0;i<(strlen(s)+1)/2;i++)
     { c=s[i];
       s[i]=s[strlen(s)-1-i];
       s[strlen(s)-1-i]=c;
     }
  return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x10a0
leaq 0x1(%rax), %rcx
cmpq $0x2, %rcx
jb 0x139a
leaq -0x1(%rbx), %r14
xorl %r15d, %r15d
movb (%rbx,%r15), %bpl
movb (%r14,%rax), %al
movb %al, (%rbx,%r15)
movq %rbx, %rdi
callq 0x10a0
movb %bpl, (%r14,%rax)
incq %r15
movq %rbx, %rdi
callq 0x10a0
movq %rax, %rcx
incq %rcx
shrq %rcx
decq %r14
cmpq %r15, %rcx
ja 0x1366
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mincebert[P]maketzx/maketzx.c
// Function: eof
int eof(int h)
{ long l,m;
  l=lseek(h,0,SEEK_CUR);
  m=lseek(h,0,SEEK_END);
  lseek(h,l,SEEK_SET);
  return (l==m);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edi, %ebx
xorl %esi, %esi
movl $0x1, %edx
callq 0x10d0
movq %rax, %r14
movl %ebx, %edi
xorl %esi, %esi
movl $0x2, %edx
callq 0x10d0
movq %rax, %r15
movl %ebx, %edi
movq %r14, %rsi
xorl %edx, %edx
callq 0x10d0
xorl %eax, %eax
cmpq %r15, %r14
sete %al
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/mincebert[P]maketzx/maketzx.c
// Function: CreateFile
byte CreateFile(char* filename)
{
  int handle;
  handle=open(filename,O_CREAT | O_TRUNC | O_RDWR,0666);
  if (handle==-1) { Error(2); }
  return handle;
}

// Assembly:
pushq %rax
movl $0x242, %esi            # imm = 0x242
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x1130
cmpl $-0x1, %eax
je 0x1402
popq %rcx
retq
movl $0x2, %edi
callq 0x140c
// File: /workspace/github_c_makefile_star2_O1/mincebert[P]maketzx/maketzx.c
// Function: OpenFile
byte OpenFile(char* filename)
{
  int handle;
  handle=open(filename,O_RDONLY);
  if (handle==-1) Error(1);
  return handle;
}

// Assembly:
pushq %rax
xorl %esi, %esi
xorl %eax, %eax
callq 0x1130
cmpl $-0x1, %eax
je 0x15ba
popq %rcx
retq
movl $0x1, %edi
callq 0x140c