LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/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 0x5235
movq %rdi, %rbx
cmpb $0x0, (%rdi)
je 0x5235
leaq -0x140(%rbp), %r14
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
xorl %esi, %esi
callq 0x21a0
leaq 0x3119(%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 0x51e8
movl %eax, %ebx
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x10(%rdx)
movw $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 0x51f0
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 0x5235
leaq -0x40(%rbp), %rdx
movw $0x2, (%rdx)
movl %ebx, %edi
movl $0x6, %esi
xorl %eax, %eax
callq 0x20e0
jmp 0x5228
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x5235
leaq -0x1c(%rbp), %rsi
movl $0x4, %edx
movl %ebx, %edi
callq 0x21e0
movl $0x1, %r14d
cmpl $0x4, %eax
je 0x522e
callq 0x2060
movl (%rax), %edi
callq 0x2370
leaq 0x3042(%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_O3/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 0x5290
movq %r14, %rdi
callq 0x2210
testq %rax, %rax
je 0x528b
movl 0x10(%rax), %edi
callq 0x2360
testl %eax, %eax
je 0x5290
callq 0x2525
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x2feb(%rip), %rsi      # 0x8290
callq 0x2300
testq %rax, %rax
je 0x52d7
movq %rax, %rbx
callq 0x2100
leaq 0x2f8c(%rip), %rsi      # 0x824a
xorl %r14d, %r14d
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2220
movq %rbx, %rdi
callq 0x2110
jmp 0x52dd
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x2e5e(%rip), %rsi      # 0x815a
movq %rax, %rdi
callq 0x2300
testq %rax, %rax
je 0x532d
movq %rax, %r15
leaq 0x2f37(%rip), %rsi      # 0x824a
xorl %r14d, %r14d
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x20a0
movq %r15, %rdi
callq 0x2110
jmp 0x5333
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_O3/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 %rcx, -0x30(%rbp)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x5922
movl %r8d, %ebx
testl %r8d, %r8d
jle 0x5922
cmpl $0x0, -0x30(%rbp)
jle 0x5922
movq %rdx, %r15
testq %rdx, %rdx
je 0x5922
movq %rdi, %r12
cmpb $0x0, (%rdi)
je 0x5922
movsbl %sil, %esi
movq %r12, %rdi
movl %esi, -0x34(%rbp)
callq 0x2150
testq %rax, %rax
je 0x58fe
movq %rax, %r14
movl %ebx, %eax
movq %rax, -0x50(%rbp)
movl -0x30(%rbp), %eax
movq %rax, -0x48(%rbp)
movq %r15, %rbx
xorl %r15d, %r15d
movq %rbx, -0x40(%rbp)
movq %r14, %rax
subq %r12, %rax
cmpl -0x30(%rbp), %eax
jge 0x591c
cmpq -0x50(%rbp), %r15
jae 0x591c
movslq %eax, %r13
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x2250
movb $0x0, (%rbx,%r13)
incq %r15
movq %r14, %r12
incq %r12
movq %r12, %rdi
movl -0x34(%rbp), %esi
callq 0x2150
movq %rax, %r14
addq -0x48(%rbp), %rbx
testq %rax, %rax
jne 0x58ae
movl %r15d, %r14d
movq -0x40(%rbp), %r15
jmp 0x5901
xorl %r14d, %r14d
movq -0x30(%rbp), %rax
imull %r14d, %eax
addq %rax, %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x2090
incl %r14d
jmp 0x5922
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x59e3
movq %rsi, %r13
testq %rsi, %rsi
je 0x59e3
movq %rdi, %r14
cmpb $0x0, (%rdi)
je 0x59e3
movl %ecx, %r15d
testl %ecx, %ecx
jle 0x59e3
movq %rdx, %rbx
testq %rdx, %rdx
je 0x59e3
cmpb $0x0, (%r13)
je 0x59e3
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 0x59b6
xorl %r12d, %r12d
movsbl %al, %esi
movq %r13, %rdi
callq 0x2150
testq %rax, %rax
je 0x59b3
movb 0x1(%r14,%r12), %al
incq %r12
testb %al, %al
jne 0x5997
movl %r12d, %r12d
addq %r12, %r14
movq %r14, %rdi
callq 0x2130
cmpl %r15d, %eax
jge 0x59e3
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_O3/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 0x5a9a
movq %rsi, %r12
testq %rsi, %rsi
je 0x5a9a
movq %rdi, %r14
cmpb $0x0, (%rdi)
je 0x5a9a
movl %ecx, %r15d
testl %ecx, %ecx
jle 0x5a9a
movq %rdx, %rax
testq %rdx, %rdx
je 0x5a9a
cmpb $0x0, (%r12)
je 0x5a9a
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 0x5a78
movsbl (%rbx), %esi
movq %r12, %rdi
callq 0x2150
testq %rax, %rax
je 0x5a78
decl %r13d
decq %rbx
jmp 0x5a5b
cmpl %r15d, %r13d
movq -0x30(%rbp), %rdi
jge 0x5a9a
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_O3/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 0x5934
testq %rax, %rax
je 0x5b28
movq %r12, %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %r13
movq %r13, %rdx
movl %r14d, %ecx
callq 0x59f4
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
nop
// File: /workspace/github_c_makefile_star2_O3/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       # 0x5c69
movl $0xf, %ebx
movl $0xf, %edi
xorl %edx, %edx
callq 0x5034
cmpq $-0x1, %rax
je 0x5c3c
leaq 0xfd(%rip), %rsi        # 0x5c69
movl $0x2, %ebx
movl $0x2, %edi
xorl %edx, %edx
callq 0x5034
cmpq $-0x1, %rax
je 0x5c3c
leaq 0xe8(%rip), %rsi        # 0x5c76
movl $0xa, %ebx
movl $0xa, %edi
xorl %edx, %edx
callq 0x5034
cmpq $-0x1, %rax
je 0x5c3c
leaq 0xd3(%rip), %rsi        # 0x5c83
movl $0xc, %ebx
movl $0xc, %edi
xorl %edx, %edx
callq 0x5034
cmpq $-0x1, %rax
je 0x5c3c
movl $0x1, %ebx
movl $0x1, %esi
movl $0x1, %edi
xorl %edx, %edx
callq 0x5034
cmpq $-0x1, %rax
je 0x5c3c
leaq 0xa6(%rip), %rsi        # 0x5c90
movl $0x11, %ebx
movl $0x11, %edi
xorl %edx, %edx
callq 0x5034
cmpq $-0x1, %rax
je 0x5c3c
movl $0xd, %ebx
xorl %r14d, %r14d
movl $0x1, %esi
movl $0xd, %edi
xorl %edx, %edx
callq 0x5034
cmpq $-0x1, %rax
je 0x5c3c
movl $0xe, %ebx
movl $0x1, %esi
movl $0xe, %edi
xorl %edx, %edx
callq 0x5034
cmpq $-0x1, %rax
jne 0x5c61
callq 0x2060
movl (%rax), %edi
callq 0x2370
leaq 0x2643(%rip), %rdi      # 0x8292
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_O3/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 0x5d28
xorl %esi, %esi
callq 0x3626
movq %rax, %r14
movq %rax, %rdi
callq 0x3688
testq %rax, %rax
je 0x5d12
movq 0x10(%rax), %rax
movq 0xa58(%rax), %rdi
testq %rdi, %rdi
je 0x5d0d
xorl %esi, %esi
callq 0x3434
movq %r14, %rdi
jmp 0x5cec
movq %r14, %rdi
callq 0x3657
movq 0x248(%rbx), %rdi
xorl %esi, %esi
callq 0x3434
movq 0x250(%rbx), %rdi
testq %rdi, %rdi
je 0x5d3d
popq %rbx
popq %r14
popq %rbp
jmp 0x2f0b
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x1e2a(%rip), %rdi      # 0x880d
callq 0x20b0
leaq 0x1e37(%rip), %rdi      # 0x8826
callq 0x20b0
leaq 0x1e47(%rip), %rdi      # 0x8842
callq 0x20b0
leaq 0x1e63(%rip), %rdi      # 0x886a
callq 0x20b0
leaq 0x1e83(%rip), %rdi      # 0x8896
callq 0x20b0
leaq 0x1e9f(%rip), %rdi      # 0x88be
popq %rbp
jmp 0x20b0
// File: /workspace/github_c_makefile_star2_O3/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 0x6b30
movq %rdi, %rbx
cmpq $0x0, 0xa58(%rdi)
je 0x6b30
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 0x3626
movq %rax, %r14
movq %rax, %rdi
callq 0x3688
testq %rax, %rax
je 0x6b28
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 0x6b10
cmpl $0x2, 0xa50(%rbx)
jne 0x6b01
xorl %edi, %edi
callq 0x2270
subl 0xa68(%rbx), %eax
movslq %eax, %rcx
movq 0x8(%r13), %rax
cmpq %rax, %rcx
jle 0x6b05
jmp 0x6b22
movq 0x8(%r13), %rax
cmpq %r15, %rax
jg 0x6b10
cmpq %r15, 0x10(%r13)
jge 0x6b22
movq %r14, %rdi
callq 0x3688
testq %rax, %rax
jne 0x6ad1
xorl %r15d, %r15d
jmp 0x6b28
movl $0x1, %r15d
movq %r14, %rdi
callq 0x3657
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_O3/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 0x6bef
leaq -0x24(%rbp), %rbx
leaq -0x28(%rbp), %r14
leaq 0x19f5(%rip), %r15      # 0x8575
movq 0x5c31(%rip), %rdi      # 0xc7b8
movq %rbx, %rsi
movl $0x4, %edx
callq 0x2f34
movq (%rax), %r12
movl -0x28(%rbp), %eax
movl %eax, 0xa60(%r12)
xorl %edi, %edi
callq 0x2270
movq %rax, 0xa68(%r12)
movq 0x5c00(%rip), %rdi      # 0xc7b8
movq %rbx, %rsi
movl $0x4, %edx
callq 0x2d11
testl %eax, %eax
je 0x6bd6
movl -0x24(%rbp), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x471f
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %r14, %rsi
movl $0x1, %edx
callq 0x22e0
movl %eax, -0x24(%rbp)
testl %eax, %eax
jg 0x6b80
movb $0x0, 0x5bca(%rip)      # 0xc7c0
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x595a(%rip), %rdi      # 0xc568
movl $0x1, %esi
callq 0x5d42
testl %eax, %eax
je 0x6c2c
leaq 0x1970(%rip), %rdi      # 0x8593
xorl %eax, %eax
callq 0x471f
jmp 0x6c3a
leaq 0x1982(%rip), %rdi      # 0x85b5
xorl %eax, %eax
callq 0x45cb
movl $0x1, %edi
callq 0x6c4d
movb $0x0, 0x5b79(%rip)      # 0xc7c4
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x5b54(%rip), %rdi      # 0xc7b8
callq 0x2f4c
movq %rax, %r14
movq %rax, %rdi
callq 0x2fbe
testq %rax, %rax
je 0x6d09
leaq 0x195a(%rip), %r12      # 0x85de
leaq 0x195f(%rip), %r13      # 0x85ea
movq 0x8(%rax), %r15
testl %ebx, %ebx
je 0x6cc8
movl (%r15), %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x45cb
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 0x45cb
jmp 0x6ce8
movq 0x10(%rax), %rax
movq (%rax), %rsi
movl $0x10c, %eax            # imm = 0x10C
addq %rax, %rsi
movl (%r15), %edx
leaq 0x1914(%rip), %rdi      # 0x85f5
xorl %eax, %eax
callq 0x45cb
movq 0x5ac9(%rip), %rdi      # 0xc7b8
movq %r15, %rsi
movl $0x4, %edx
callq 0x2d11
movq %r14, %rdi
callq 0x2fbe
testq %rax, %rax
jne 0x6c8b
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3047
// File: /workspace/github_c_makefile_star2_O3/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 0x6f2d
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 0x6f1e
cmpb $0x0, 0xc(%r14)
je 0x6f1e
leaq 0xc(%r14), %rbx
leaq -0x24(%rbp), %rdi
movq %rbx, %rsi
callq 0x52e5
testl %eax, %eax
je 0x6f78
callq 0x2060
movl (%rax), %edi
callq 0x2370
leaq 0x174a(%rip), %rdi      # 0x86ae
movq %rbx, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x4675
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x6f1e
movl -0x24(%rbp), %edi
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x2260
testl %eax, %eax
jne 0x6f1e
movl (%r14), %esi
movl -0x24(%rbp), %edx
leaq 0x16ff(%rip), %rdi      # 0x8694
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x45cb
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 0x57e7(%rip), %rdi      # 0xc7b8
movq %r15, %rsi
movl $0x4, %edx
movq %rax, %rcx
movl $0x8, %r8d
callq 0x2a34
jmp 0x6f1e
// File: /workspace/github_c_makefile_star2_O3/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 0x1225
movl %eax, %ebp
movq %rbx, %rdi
callq 0x1225
addl %eax, %ebp
leaq 0xe68(%rip), %rdi       # 0x2004
movl %ebp, %esi
xorl %eax, %eax
callq 0x1040
movq %r14, %rdi
callq 0x1256
movq %rbx, %rdi
callq 0x1256
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_O3/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 0x1279
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x1256
movq 0x8(%rbx), %rdi
callq 0x1256
movq %rbx, %rdi
popq %rbx
jmp 0x12be
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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 0x2dc5(%rip), %rax      # 0x4048
addq %rdi, %rax
movq %rax, 0x2dbb(%rip)      # 0x4048
cmpq 0x2dbc(%rip), %rax      # 0x4050
jbe 0x1050
movq %rax, 0x2daf(%rip)      # 0x4050
jmp 0x1050
// File: /workspace/github_c_makefile_star2_O3/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 0x15b9
popq %rcx
retq
movl $0x1, %edi
callq 0x140c
// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: CloseFiles
void CloseFiles(void)
{
  close(inpfile.handle);
  if (outfile.bufpoint) Flush(&outfile);
  close(outfile.handle);
  fclose(logfile);
}

// Assembly:
pushq %rax
movzbl 0xdcb5(%rip), %edi      # 0xf280
callq 0x10f0
movl 0x11ec2(%rip), %edx     # 0x13498
testq %rdx, %rdx
je 0x15ee
movzbl 0x11db6(%rip), %edi     # 0x13398
leaq 0x11ec7(%rip), %rsi     # 0x134b0
callq 0x1080
movzbl 0x11da3(%rip), %edi     # 0x13398
callq 0x10f0
movq 0x15eaf(%rip), %rdi     # 0x174b0
popq %rax
jmp 0x1090
// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: PushFilePointers
void PushFilePointers(void)
{
  stackitem *pointer;
  byte item=stack1.busy+stack2.busy+stack3.busy+stack4.busy+stack5.busy+1;
  if (item>5) item=5;
  switch (item)
	 {
	   case 1 : pointer=&stack1; break;
	   case 2 : pointer=&stack2; break;
	   case 3 : pointer=&stack3; break;
	   case 4 : pointer=&stack4; break;
	   case 5 : pointer=&stack5; break;
	 }
  (*pointer).busy=1;
  (*pointer).savedir=direction;
  (*pointer).saverev=revsamples;
  (*pointer).savelast=lastsample;
  (*pointer).savebtype=blocktype;
  (*pointer).savepos=filepos;
  (*pointer).savetotal=totalread;
  (*pointer).saveprocess=processed;
  (*pointer).saveblocklen=blocklength;
}

// Assembly:
movb 0x19f71(%rip), %al      # 0x1b5d0
addb 0x19f9b(%rip), %al      # 0x1b600
addb 0x19fc5(%rip), %al      # 0x1b630
addb 0x19fef(%rip), %al      # 0x1b660
addb 0x1a019(%rip), %al      # 0x1b690
incb %al
movzbl %al, %ecx
cmpb $0x5, %cl
movl $0x5, %eax
cmovbl %ecx, %eax
addb $-0x2, %al
cmpb $0x3, %al
ja 0x169d
movzbl %al, %eax
leaq 0xd741(%rip), %rcx      # 0xedd8
movq (%rcx,%rax,8), %rax
jmp 0x16a4
leaq 0x19f2c(%rip), %rax     # 0x1b5d0
movb $0x1, (%rax)
movb 0xda44(%rip), %cl       # 0xf0f1
movb %cl, 0x1(%rax)
movq 0xdb51(%rip), %rcx      # 0xf208
movq %rcx, 0x8(%rax)
movb 0x19fff(%rip), %cl      # 0x1b6c0
movb %cl, 0x3(%rax)
movb 0x19ff7(%rip), %cl      # 0x1b6c1
movb %cl, 0x2(%rax)
movq 0xdb14(%rip), %rcx      # 0xf1e8
movq %rcx, 0x10(%rax)
movq 0xdaf1(%rip), %rcx      # 0xf1d0
movq %rcx, 0x18(%rax)
movq 0xdade(%rip), %rcx      # 0xf1c8
movq %rcx, 0x20(%rax)
movq 0xdacb(%rip), %rcx      # 0xf1c0
movq %rcx, 0x28(%rax)
retq
// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: PopFilePointers
void PopFilePointers(void)
{
  stackitem *pointer;
  byte item=stack1.busy+stack2.busy+stack3.busy+stack4.busy+stack5.busy;
  switch (item)
	 {
	   case 0 :
	   case 1 : pointer=&stack1; break;
	   case 2 : pointer=&stack2; break;
	   case 3 : pointer=&stack3; break;
	   case 4 : pointer=&stack4; break;
	   case 5 : pointer=&stack5; break;
	 }
  (*pointer).busy=0;
  direction=(*pointer).savedir;
  revsamples=(*pointer).saverev;
  lastsample=(*pointer).savelast;
  blocktype=(*pointer).savebtype;
  filepos=(*pointer).savepos;
  totalread=(*pointer).savetotal;
  processed=(*pointer).saveprocess;
  blocklength=(*pointer).saveblocklen;
}

// Assembly:
movb 0x19f00(%rip), %al      # 0x1b600
addb 0x19eca(%rip), %al      # 0x1b5d0
addb 0x19f24(%rip), %al      # 0x1b630
addb 0x19f4e(%rip), %al      # 0x1b660
addb 0x19f78(%rip), %al      # 0x1b690
addb $-0x2, %al
cmpb $0x3, %al
ja 0x172e
movzbl %al, %eax
leaq 0xd6b0(%rip), %rcx      # 0xedd8
movq (%rcx,%rax,8), %rax
jmp 0x1735
leaq 0x19e9b(%rip), %rax     # 0x1b5d0
movb $0x0, (%rax)
movb 0x1(%rax), %cl
movb %cl, 0xd9b0(%rip)       # 0xf0f1
movq 0x8(%rax), %rcx
movq %rcx, 0xdabc(%rip)      # 0xf208
movb 0x3(%rax), %cl
movb %cl, 0x19f6b(%rip)      # 0x1b6c0
movb 0x2(%rax), %cl
movb %cl, 0x19f63(%rip)      # 0x1b6c1
movq 0x10(%rax), %rcx
movq %rcx, 0xda7f(%rip)      # 0xf1e8
movq 0x18(%rax), %rcx
movq %rcx, 0xda5c(%rip)      # 0xf1d0
movq 0x20(%rax), %rcx
movq %rcx, 0xda49(%rip)      # 0xf1c8
movq 0x28(%rax), %rax
movq %rax, 0xda36(%rip)      # 0xf1c0
retq
// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: Instructions
void Instructions(void)
{
  printf("Translates VOC files in TZX format for ZX Spectrum emulators\n\n");
  printf("Syntax: MAKETZX <inputfile> [outputfile] [switches]\n\n");
  printf("Switches:\n\n");
  printf("   -n: operate in normal mode         -s n: use Speedlock type n algorithm\n");
  printf("   -a: use Alkatraz algorithm         -k n: skip n blocks before considering\n");
  printf("   -f: use Softlock algorithm               specific loaders\n");
  printf("   -b: use Bleepload algorithm        -x: display file informations in hex\n");
  printf("   -z: use ZetaLoad algorithm         -q: disable hi-fi reproduction tones\n");
  printf("   -l: enable logfile generation      -r: use TZX revision 1.01\n\n");
/*printf("          -digital : use Digital Integrations algorithm and timings\n");*/
  exit(0);
}

// Assembly:
pushq %rax
leaq 0xa76c(%rip), %rdi      # 0xc42d
callq 0x1070
leaq 0xa79e(%rip), %rdi      # 0xc46b
callq 0x1070
leaq 0xa7c7(%rip), %rdi      # 0xc4a0
callq 0x1070
leaq 0xa7c6(%rip), %rdi      # 0xc4ab
callq 0x1070
leaq 0xa805(%rip), %rdi      # 0xc4f6
callq 0x1070
leaq 0xa846(%rip), %rdi      # 0xc543
callq 0x1070
leaq 0xa877(%rip), %rdi      # 0xc580
callq 0x1070
leaq 0xa8b6(%rip), %rdi      # 0xc5cb
callq 0x1070
leaq 0xa8f5(%rip), %rdi      # 0xc616
callq 0x1070
xorl %edi, %edi
callq 0x1170
// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: End
void End(void)
{
  if (tempfile.bufpoint) Flush(&tempfile);
  CloseFiles();
  remove(tempfile.name);
  printf("\nDone!\n\n");
  exit(0);
}

// Assembly:
pushq %rax
movl 0x15868(%rip), %edx     # 0x175b8
testq %rdx, %rdx
je 0x1d68
movzbl 0x1575c(%rip), %edi     # 0x174b8
leaq 0x1586d(%rip), %rsi     # 0x175d0
callq 0x1080
callq 0x15c3
leaq 0x15745(%rip), %rdi     # 0x174b9
callq 0x1050
leaq 0xa8d7(%rip), %rdi      # 0xc657
callq 0x1070
xorl %edi, %edi
callq 0x1170
// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: GetData
byte GetData(fdata* record)
{
  byte value;                       /* WHAT A MESS!!!!! */
  (*record).bufpoint&=0x3fff;
  if (!((*record).bufpoint)) (*record).xferred+=read((*record).handle,(*record).buffer,sizeof((*record).buffer));
  value=(*record).buffer[(*record).bufpoint];
  (*record).bufpoint++;
  filepos++;
  if (filepos>inpfile.length && blocktype) blocktype=0;
  return value;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x3fff, %ecx           # imm = 0x3FFF
andl 0x100(%rdi), %ecx
movl %ecx, 0x100(%rdi)
jne 0x1dc4
movzbl (%rbx), %edi
leaq 0x118(%rbx), %rsi
movl $0x4000, %edx           # imm = 0x4000
callq 0x1110
addq %rax, 0x110(%rbx)
movl 0x100(%rbx), %ecx
movl %ecx, %eax
movb 0x118(%rbx,%rax), %al
incl %ecx
movl %ecx, 0x100(%rbx)
movq 0xd40c(%rip), %rcx      # 0xf1e8
incq %rcx
movq %rcx, 0xd402(%rip)      # 0xf1e8
cmpq 0xd59b(%rip), %rcx      # 0xf388
jbe 0x1dff
cmpb $0x0, 0x198cb(%rip)     # 0x1b6c1
je 0x1dff
movb $0x0, 0x198c2(%rip)     # 0x1b6c1
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: PutData
void PutData(fdata* record,byte value,word dimension)
{
  word count;                                  /* WHAT A MESS!!!!! */
  for (count=0; count<dimension; count++)
      {
	(*record).buffer[((*record).bufpoint)]=value;
	(*record).bufpoint++;
	(*record).bufpoint&=0x3fff;
	if (!(*record).bufpoint)
	   (*record).xferred+=write((*record).handle,(*record).buffer,sizeof(*record).buffer);
      }
}

// Assembly:
testl %edx, %edx
je 0x1e5f
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
leaq 0x118(%rdi), %r15
movl 0x100(%r14), %eax
movb %bpl, 0x118(%r14,%rax)
incl %eax
andl $0x3fff, %eax           # imm = 0x3FFF
movl %eax, 0x100(%r14)
jne 0x1e51
movzbl (%r14), %edi
movl $0x4000, %edx           # imm = 0x4000
movq %r15, %rsi
callq 0x1080
addq %rax, 0x110(%r14)
decl %ebx
jne 0x1e1a
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: ReadVOCBlock
void ReadVOCBlock(void)
{
  blocktype=GetData(&inpfile);
  if (!blocktype) return;
  if (blocktype>8)
     Error(5);
  switch (blocktype)
	 {
	 case 1  : ProcessVOCData(); break;
	 case 2  : ProcessContinue(); break;
	 case 3  : ProcessSilence(); break;
	 case 4  : ProcessMarker(); break;
	 case 5  : ProcessASCII(); break;
	 case 8  : ProcessExtended(); break;
	 default : printf("\nSorry, block type %d of VOC files is not yet supported\n\n",blocktype);
		   CloseFiles();
		   exit(1);
	 }
}

// Assembly:
pushq %rax
leaq 0xd239(%rip), %rdi      # 0xf280
callq 0x1d8c
movb %al, 0x1966f(%rip)      # 0x1b6c1
testb %al, %al
je 0x207b
cmpb $0x9, %al
jae 0x209b
movzbl %al, %esi
leal -0x1(%rsi), %eax
cmpl $0x7, %eax
ja 0x20a5
leaq 0x9044(%rip), %rcx      # 0xb0b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
popq %rax
jmp 0x2142
popq %rax
retq
popq %rax
jmp 0x232c
popq %rax
jmp 0x21f8
popq %rax
jmp 0x2372
popq %rax
jmp 0x223e
popq %rax
jmp 0x22e6
movl $0x5, %edi
callq 0x140c
leaq 0x9552(%rip), %rdi      # 0xb5fe
xorl %eax, %eax
callq 0x10b0
callq 0x15c3
movl $0x1, %edi
callq 0x1170
// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: ReadVOCData
byte ReadVOCData(void)
{
  if (!(blocklength-processed))
  do {
       processed=0;
       ReadVOCBlock();
       if (!blocktype) return 0;
     }
  while (blocktype==8 || blocktype==3);
  processed++;
  if (blocktype==8 || blocktype==3) processed+=3;
  totalread++;
  return(GetData(&inpfile));
}

// Assembly:
movq 0xd0ff(%rip), %rcx      # 0xf1c8
cmpq %rcx, 0xd0f0(%rip)      # 0xf1c0
jne 0x20fe
pushq %rax
movq $0x0, 0xd0ea(%rip) # 0xf1c8
callq 0x203f
movzbl 0x195d7(%rip), %eax     # 0x1b6c1
cmpl $0x3, %eax
je 0x20d3
cmpl $0x8, %eax
je 0x20d3
testl %eax, %eax
leaq 0x8(%rsp), %rsp
jne 0x2106
retq
movb 0x195bd(%rip), %al      # 0x1b6c1
jmp 0x210d
movq 0xd0bb(%rip), %rcx      # 0xf1c8
leaq 0x1(%rcx), %rdx
movq %rdx, 0xd0b0(%rip)      # 0xf1c8
cmpb $0x8, %al
je 0x2124
movzbl %al, %eax
cmpl $0x3, %eax
jne 0x212f
addq $0x4, %rcx
movq %rcx, 0xd099(%rip)      # 0xf1c8
incq 0xd09a(%rip)            # 0xf1d0
leaq 0xd143(%rip), %rdi      # 0xf280
jmp 0x1d8c
// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: ProcessVOCData
void ProcessVOCData(void)
{
  byte brate;
  word timeconst;
  dword data;
  blocklength=(byte)GetData(&inpfile);
  blocklength+=(word)(256*GetData(&inpfile));
  blocklength+=(dword)(65536*GetData(&inpfile));
  blocklength-=2;
  brate=GetData(&inpfile);
  compression=GetData(&inpfile);
  if (compression) { printf("\nSorry, compressed blocks are not yet supported\n\n"); }
  timeconst=65536-(word)(brate*256);
  if (brate>0xd3) timeconst-=0x54;
  samprate=(double)(256000000/timeconst);
  SetTimings();
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
leaq 0xd134(%rip), %rbx      # 0xf280
movq %rbx, %rdi
callq 0x1d8c
movzbl %al, %eax
movq %rax, 0xd062(%rip)      # 0xf1c0
movq %rbx, %rdi
callq 0x1d8c
movzbl %al, %eax
shll $0x8, %eax
addq %rax, 0xd04d(%rip)      # 0xf1c0
movq %rbx, %rdi
callq 0x1d8c
movzbl %al, %eax
shll $0x10, %eax
movq 0xd038(%rip), %rcx      # 0xf1c0
addq %rcx, %rax
addq $-0x2, %rax
movq %rax, 0xd02a(%rip)      # 0xf1c0
movq %rbx, %rdi
callq 0x1d8c
movl %eax, %ebp
movq %rbx, %rdi
callq 0x1d8c
movb %al, 0xd02a(%rip)       # 0xf1d8
testb %al, %al
je 0x21be
leaq 0xa4d4(%rip), %rdi      # 0xc68d
callq 0x1070
cmpb $-0x2c, %bpl
movl $0xffac, %eax           # imm = 0xFFAC
movl $0x10000, %ecx          # imm = 0x10000
cmovael %eax, %ecx
movzbl %bpl, %eax
shll $0x8, %eax
subl %eax, %ecx
movl $0xf424000, %eax        # imm = 0xF424000
xorl %edx, %edx
divl %ecx
cvtsi2ss %eax, %xmm0
movss %xmm0, 0xd003(%rip)     # 0xf1f0
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x240d
// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: ProcessSilence
void ProcessSilence(void)
{
  byte silrate;
  word sillength,timeconst;
  blocklength=(byte)GetData(&inpfile);
  blocklength+=(word)(256*GetData(&inpfile));
  blocklength+=(dword)(65536*GetData(&inpfile));
  sillength=(byte)GetData(&inpfile);
  sillength+=(word)(256*GetData(&inpfile));
  silrate=GetData(&inpfile);
  timeconst=65536-(word)(silrate*256);
  silence=sillength/((double)256000000/timeconst)*1000;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
leaq 0xd037(%rip), %rbx      # 0xf280
movq %rbx, %rdi
callq 0x1d8c
movzbl %al, %eax
movq %rax, 0xcf65(%rip)      # 0xf1c0
movq %rbx, %rdi
callq 0x1d8c
movzbl %al, %eax
shll $0x8, %eax
addq %rax, 0xcf50(%rip)      # 0xf1c0
movq %rbx, %rdi
callq 0x1d8c
movzbl %al, %eax
shll $0x10, %eax
addq %rax, 0xcf3b(%rip)      # 0xf1c0
movq %rbx, %rdi
callq 0x1d8c
movzbl %al, %ebp
movq %rbx, %rdi
callq 0x1d8c
movzbl %al, %r14d
shll $0x8, %r14d
orl %ebp, %r14d
movq %rbx, %rdi
callq 0x1d8c
movzbl %al, %eax
shll $0x8, %eax
movl $0x10000, %ecx          # imm = 0x10000
subl %eax, %ecx
cvtsi2sd %r14d, %xmm0
cvtsi2sd %ecx, %xmm1
movsd 0x8fa7(%rip), %xmm2     # 0xb270
divsd %xmm1, %xmm2
divsd %xmm2, %xmm0
mulsd 0x8f9f(%rip), %xmm0     # 0xb278
movsd %xmm0, 0xceff(%rip)     # 0xf1e0
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: ProcessExtended
void ProcessExtended(void)
{
  word timeconst;
  blocklength=(byte)GetData(&inpfile);
  blocklength+=(word)(256*GetData(&inpfile));
  blocklength+=(dword)(65536*GetData(&inpfile));
  timeconst=GetData(&inpfile);
  timeconst+=256*(GetData(&inpfile));
  if (GetData(&inpfile)) Error(6);
  if (GetData(&inpfile))
     {
       printf("\nSorry, stereo VOC files are not yet supported\n\n");
       CloseFiles();
       exit(1);
     }
  SetTimings();
}

// Assembly:
pushq %rbx
leaq 0xcf06(%rip), %rbx      # 0xf280
movq %rbx, %rdi
callq 0x1d8c
movzbl %al, %eax
movq %rax, 0xce34(%rip)      # 0xf1c0
movq %rbx, %rdi
callq 0x1d8c
movzbl %al, %eax
shll $0x8, %eax
addq %rax, 0xce1f(%rip)      # 0xf1c0
movq %rbx, %rdi
callq 0x1d8c
movzbl %al, %eax
shll $0x10, %eax
addq %rax, 0xce0a(%rip)      # 0xf1c0
movq %rbx, %rdi
callq 0x1d8c
movq %rbx, %rdi
callq 0x1d8c
movq %rbx, %rdi
callq 0x1d8c
testb %al, %al
jne 0x23e8
leaq 0xcea7(%rip), %rdi      # 0xf280
callq 0x1d8c
testb %al, %al
jne 0x23f2
popq %rbx
jmp 0x240d
movl $0x6, %edi
callq 0x140c
leaq 0xa2c5(%rip), %rdi      # 0xc6be
callq 0x1070
callq 0x15c3
movl $0x1, %edi
callq 0x1170
// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: SetTimings
void SetTimings(void)
{
  TuneRates(&pilot);
  TuneRates(&syncx);
  TuneRates(&bit0);
  TuneRates(&bit1);
}

// Assembly:
pushq %rax
leaq 0x19323(%rip), %rdi     # 0x1b738
callq 0x243f
leaq 0x19337(%rip), %rdi     # 0x1b758
callq 0x243f
leaq 0x1934b(%rip), %rdi     # 0x1b778
callq 0x243f
leaq 0x1935f(%rip), %rdi     # 0x1b798
popq %rax
jmp 0x243f
// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: TuneRates
void TuneRates(wdata* record)
{
 if (samprate && (*record).freq)
    {
      (*record).tstates=(word)(3500000/(2*(*record).freq));
      (*record).samples=(double)(samprate/(*record).freq); //-((*record).freq/100*correction)));
      (*record).rfreq=(float)(samprate/(*record).samples);
    }
}

// Assembly:
movss 0xcda9(%rip), %xmm0     # 0xf1f0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x2451
jnp 0x249e
movsd (%rdi), %xmm1
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm1
jne 0x2461
jnp 0x249e
movapd %xmm1, %xmm2
addsd %xmm1, %xmm2
movsd 0x8e0f(%rip), %xmm3     # 0xb280
divsd %xmm2, %xmm3
cvttsd2si %xmm3, %rax
movl %eax, 0x18(%rdi)
cvtss2sd %xmm0, %xmm0
movaps %xmm0, %xmm2
divsd %xmm1, %xmm2
movsd %xmm2, 0x10(%rdi)
divsd %xmm2, %xmm0
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x8(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: WriteTZXPulseSequence
void WriteTZXPulseSequence(byte pulsenum)
{
  byte count;
  pulses[1]=pulsenum;
  for (count=0; count<sizeof(pulses); count++) PutData(&outfile,pulses[count],1);
  for (count=0; count<pulsenum; count++)
      {
	PutData(&outfile,Lo(pulseseq[count]),1);
	PutData(&outfile,Hi(pulseseq[count]),1);
      }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
movb %bl, 0xbe7c(%rip)       # 0xf179
movzbl 0xbe74(%rip), %esi      # 0xf178
leaq 0x1008d(%rip), %r14     # 0x13398
movq %r14, %rdi
movl $0x1, %edx
callq 0x1e01
movzbl 0xbe5a(%rip), %esi      # 0xf179
movq %r14, %rdi
movl $0x1, %edx
callq 0x1e01
testl %ebx, %ebx
je 0x3377
movzbl %bl, %r14d
shll $0x2, %r14d
xorl %r15d, %r15d
leaq 0x1847e(%rip), %r12     # 0x1b7c0
leaq 0x1004f(%rip), %rbx     # 0x13398
movzbl (%r15,%r12), %esi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x1e01
movzbl 0x1(%r15,%r12), %esi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x1e01
addq $0x4, %r15
cmpq %r15, %r14
jne 0x3349
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: FindPause
dword FindPause(void)
{
  dword hpulse;
  double detfreq;
  PushFilePointers();
  FindingPause=1;
  printf("Finding pause...     \x0d");
//  do detfreq=BeepSearch(50);
//  while (abs(detfreq-808)>150 && blocktype);
//  if (!blocktype) return 0;
  hpulse=PilotSearch(50)/ecf;
  FindingPause=0;
  if (blocktype)
     {
       PopFilePointers();
       lseek(inpfile.handle,filepos,SEEK_SET);
       inpfile.bufpoint=0;
     }
  printf("                     \x0d");
  if (silence) { mspause+=silence; silence=0; }

  return hpulse;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
callq 0x1659
movb $0x1, 0xadff(%rip)      # 0xf1ba
leaq 0x75f6(%rip), %rdi      # 0xb9b8
xorl %eax, %eax
callq 0x10b0
movl $0x32, %edi
callq 0x2ba3
movq %rax, %rbx
movsd 0xad1a(%rip), %xmm0     # 0xf0f8
movsd %xmm0, 0x8(%rsp)
movb $0x0, 0xadcf(%rip)      # 0xf1ba
cmpb $0x0, 0x172cf(%rip)     # 0x1b6c1
je 0x4418
callq 0x16fa
movzbl 0xae80(%rip), %edi      # 0xf280
movq 0xade1(%rip), %rsi      # 0xf1e8
xorl %edx, %edx
callq 0x10d0
movl $0x0, 0xaf68(%rip)      # 0xf380
leaq 0x75b0(%rip), %rdi      # 0xb9cf
xorl %eax, %eax
callq 0x10b0
movsd 0xadb2(%rip), %xmm0     # 0xf1e0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x443a
jnp 0x4455
addsd 0xadde(%rip), %xmm0     # 0xf220
movsd %xmm0, 0xadd6(%rip)     # 0xf220
movq $0x0, 0xad8b(%rip) # 0xf1e0
movq %rbx, %xmm0
punpckldq 0x6fae(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x6fb6(%rip), %xmm0     # 0xb420
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd 0x8(%rsp), %xmm1
cvttsd2si %xmm1, %rcx
movq %rcx, %rdx
subsd 0x6e7c(%rip), %xmm1     # 0xb308
cvttsd2si %xmm1, %rax
sarq $0x3f, %rdx
andq %rdx, %rax
orq %rcx, %rax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: GetBleeploadInfo
void GetBleeploadInfo(word length)
{
  word count;
  PushFilePointers();
  ResetTempFile();
  GetData(&tempfile);
  for (count=0; count<length; count++) { bleepblock[count]=GetData(&tempfile); }
  nxtloadpos=bleepblock[0x102]+256*bleepblock[0x103];
  expectedlength=0x109+(bleepblock[0x104+bleepblock[0x104]+4]&7)+3;
  ResetTempFile();
  PopFilePointers();
//  RecoverFilePointers();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
callq 0x1659
callq 0x161e
leaq 0x1280b(%rip), %rdi     # 0x174b8
callq 0x1d8c
testl %ebx, %ebx
je 0x4cde
movl %ebx, %r14d
xorl %r15d, %r15d
leaq 0x127f5(%rip), %rbx     # 0x174b8
leaq 0x16f46(%rip), %r12     # 0x1bc10
movq %rbx, %rdi
callq 0x1d8c
movb %al, (%r15,%r12)
incq %r15
cmpq %r15, %r14
jne 0x4cca
leaq 0x16f2b(%rip), %rax     # 0x1bc10
movzwl 0x17026(%rip), %ecx     # 0x1bd12
movl %ecx, 0xa51e(%rip)      # 0xf210
movzbl 0x1701b(%rip), %ecx     # 0x1bd14
movzbl 0x108(%rcx,%rax), %eax
andl $0x7, %eax
addl $0x10c, %eax            # imm = 0x10C
movl %eax, 0xa505(%rip)      # 0xf214
callq 0x161e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x16fa
// File: /workspace/github_c_makefile_star2_O3/mincebert[P]maketzx/maketzx.c
// Function: SearchBleeploadGroup3
byte SearchBleeploadGroup3(void)
{
  PushFilePointers();
  expectedlength=0x10b;
  searching=1;
  ReadBleeploadBlock();
  searching=0;
  if (!blocktype) return blocktype;
  PopFilePointers();
  lseek(inpfile.handle,filepos,SEEK_SET);
  inpfile.bufpoint=0;
  return DataLoadOK;
}

// Assembly:
pushq %rax
callq 0x1659
movl $0x10b, 0x9994(%rip)    # imm = 0x10B
movb $0x1, 0x99ab(%rip)      # 0xf232
callq 0x49be
movb $0x0, 0x999f(%rip)      # 0xf232
cmpb $0x0, 0x15e27(%rip)     # 0x1b6c1
je 0x58c8
callq 0x16fa
movzbl 0x99d8(%rip), %edi      # 0xf280
movq 0x9939(%rip), %rsi      # 0xf1e8
xorl %edx, %edx
callq 0x10d0
movl $0x0, 0x9ac0(%rip)      # 0xf380
movb 0x16323(%rip), %al      # 0x1bbe9
jmp 0x58ca
xorl %eax, %eax
popq %rcx
retq