LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/ttoobne[P]bohttpd/src/core/rio.c
// Function: rio_readline_buf
ssize_t	rio_readline_buf(rio_t* rp, void* usrbuf, size_t maxlen) {
    size_t n, rc;
    char c;
    char* bufp = usrbuf;

    for (n = 1; n <= maxlen; ++ n) {
        if ((rc = rio_read(rp, &c, 1)) == 1) {
            *bufp ++ = c;
            if (c == '\n') {        /* 读到换行符 */ 
                n ++ ;
                break;
            }
        } else if (rc == 0) {       /* 读到 EOF */
            break;
        } else {
            return -1;
        }
    }
    *bufp = '\0';
    return (n - 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %r12
xorl %r13d, %r13d
leaq 0x1(%r13), %rbx
cmpq %r15, %rbx
ja 0x56f3
movq %r12, %rdi
leaq -0x29(%rbp), %rsi
pushq $0x1
popq %rdx
callq 0x5614
cmpq $0x1, %rax
jne 0x56ee
movb -0x29(%rbp), %al
movb %al, (%r14,%r13)
cmpb $0xa, %al
je 0x56fe
movq %rbx, %r13
jmp 0x56c0
testq %rax, %rax
jne 0x56f8
addq %r13, %r14
jmp 0x5707
pushq $-0x1
popq %r13
jmp 0x570b
addq %r13, %r14
incq %r14
incq %r13
movb $0x0, (%r14)
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/ttoobne[P]bohttpd/src/core/threadpool.c
// Function: threadpool_worker
static void* threadpool_worker(void* threadpool) {

    threadpool_t* pool = (threadpool_t*)threadpool;
    threadpool_task_t task;

    for ( ;; ) {
        /* 获取互斥锁 */
        pthread_mutex_lock(&(pool->lock_mutex));

        /* 当任务队列中任务数为空，工作线程阻塞在 nempty_cond 上 */
        while ((pool->task_num == 0) && (!pool->shutdown)) {
            pthread_cond_wait(&(pool->nempty_cond), &(pool->lock_mutex));
        }
        
        /* 若线程池关闭，则线程终止 */
        if (pool->shutdown) {
            break;
        }

        /* 从任务队列首部取任务 */
        task.func = pool->task_queue[pool->task_queue_front].func;
        task.args = pool->task_queue[pool->task_queue_front].args;
        
        /* 循环队列 */
        pool->task_queue_front = (pool->task_queue_front + 1) % pool->task_queue_size;
        pool->task_num -- ;

        /* 取完任务则广播任务队列未满条件 */
        pthread_cond_broadcast(&(pool->nfull_cond));
        /* 解开互斥锁 */
        pthread_mutex_unlock(&(pool->lock_mutex));

        /* 执行任务 */
        (*(task.func))(task.args);
    }

    /* 终止线程 */
    pool->thread_running -- ;
    pthread_mutex_unlock(&(pool->lock_mutex));
    pthread_exit(NULL);

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x30(%rdi), %rbx
leaq 0x88(%rdi), %r15
leaq 0x58(%rdi), %rax
movq %rax, -0x30(%rbp)
movq %rbx, %rdi
callq 0x2480
movl 0x24(%r14), %ecx
movl 0x28(%r14), %eax
testl %ecx, %ecx
jne 0x5937
testl %eax, %eax
jne 0x597b
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2110
jmp 0x591a
testl %eax, %eax
jne 0x597b
movq 0x8(%r14), %rdx
movslq 0x1c(%r14), %rsi
leal 0x1(%rsi), %eax
shlq $0x4, %rsi
movq (%rdx,%rsi), %r12
movq 0x8(%rdx,%rsi), %r13
cltd
idivl 0x18(%r14)
movl %edx, 0x1c(%r14)
decl %ecx
movl %ecx, 0x24(%r14)
movq -0x30(%rbp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x22b0
movq %r13, %rdi
callq *%r12
jmp 0x5912
decl 0x14(%r14)
movq %rbx, %rdi
callq 0x22b0
xorl %edi, %edi
callq 0x22c0
// File: /workspace/github_c_makefile_star2_O2/ttoobne[P]bohttpd/src/core/threadpool.c
// Function: threadpool_free
static int threadpool_free(threadpool_t* threadpool) {
    if (threadpool == NULL) {
        return -1;
    }

    /* 释放线程 tid 数组空间 */
    if (threadpool->threads) {
        free(threadpool->threads);
        threadpool->threads = NULL;

        /* 由于初始化互斥量和条件变量在 threads 之前，所以此处一定已经初始化成功 */
        pthread_mutex_lock(&(threadpool->lock_mutex));
        pthread_mutex_destroy(&(threadpool->lock_mutex));
        pthread_cond_destroy(&(threadpool->nfull_cond));
        pthread_cond_destroy(&(threadpool->nempty_cond));
    }

    /* 释放任务队列空间 */
    if (threadpool->task_queue) {
        free(threadpool->task_queue);
        threadpool->task_queue = NULL;
    }

    /* 释放线程池空间 */
    free(threadpool);
    threadpool = NULL;

    return 0;
}

// Assembly:
testq %rdi, %rdi
je 0x59ef
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x59d7
callq 0x2030
andq $0x0, (%rbx)
leaq 0x30(%rbx), %r14
movq %r14, %rdi
callq 0x2480
movq %r14, %rdi
callq 0x2170
leaq 0x58(%rbx), %rdi
callq 0x2370
leaq 0x88(%rbx), %rdi
callq 0x2370
movq 0x8(%rbx), %rdi
callq 0x2030
movq %rbx, %rdi
callq 0x2030
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
pushq $-0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/ttoobne[P]bohttpd/src/core/threadpool.c
// Function: threadpool_add_task
int threadpool_add_task(threadpool_t* threadpool, task_function_t* func, void* args) {
    if (threadpool == NULL || func == NULL) {
        log_error("arguments invalid.");
        return -1;
    }

    /* 加锁 */
    pthread_mutex_lock(&(threadpool->lock_mutex));

    /* 如果任务队列中任务已满，则阻塞在条件 nfull_cond 上 */
    while ((threadpool->task_num == threadpool->task_queue_size) && (!threadpool->shutdown)) {
        pthread_cond_wait(&(threadpool->nfull_cond), &(threadpool->lock_mutex));
    }

    /* 如果线程池已经关闭 */
    if (threadpool->shutdown) {
        pthread_mutex_unlock(&(threadpool->lock_mutex));
        log_error("threadpool already shutdown.");
        return -1;
    }

    /* 添加任务到任务队列尾部 */
    threadpool->task_queue[threadpool->task_queue_rear].func = func;
    threadpool->task_queue[threadpool->task_queue_rear].args = args;
    threadpool->task_queue_rear = (threadpool->task_queue_rear + 1) % threadpool->task_queue_size;
    threadpool->task_num ++ ;

    /* 通知一个阻塞在 nempty_cond 上的线程并解锁互斥锁 */
    pthread_cond_signal(&(threadpool->nempty_cond));
    pthread_mutex_unlock(&(threadpool->lock_mutex));

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
setne %al
testq %rsi, %rsi
setne %cl
testb %cl, %al
jne 0x5a30
leaq 0x1475(%rip), %rsi      # 0x6e8d
leaq 0x1532(%rip), %rdx      # 0x6f51
leaq 0x148f(%rip), %r8       # 0x6eb5
pushq $0x4
popq %rdi
movl $0x8b, %ecx
jmp 0x5a90
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x30(%rdi), %r14
movq %r14, %rdi
callq 0x2480
leaq 0x58(%rbx), %r13
movl 0x18(%rbx), %esi
movl 0x24(%rbx), %ecx
movl 0x28(%rbx), %eax
cmpl %esi, %ecx
jne 0x5a67
testl %eax, %eax
jne 0x5a6b
movq %r13, %rdi
movq %r14, %rsi
callq 0x2110
jmp 0x5a49
testl %eax, %eax
je 0x5aa9
movq %r14, %rdi
callq 0x22b0
leaq 0x1413(%rip), %rsi      # 0x6e8d
leaq 0x14d0(%rip), %rdx      # 0x6f51
leaq 0x14dd(%rip), %r8       # 0x6f65
pushq $0x4
popq %rdi
movl $0x9a, %ecx
xorl %eax, %eax
callq 0x4c60
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbx), %rdx
movslq 0x20(%rbx), %rdi
leal 0x1(%rdi), %eax
shlq $0x4, %rdi
movq %r12, (%rdx,%rdi)
movq %r15, 0x8(%rdx,%rdi)
cltd
idivl %esi
movl %edx, 0x20(%rbx)
incl %ecx
movl %ecx, 0x24(%rbx)
addq $0x88, %rbx
movq %rbx, %rdi
callq 0x2220
movq %r14, %rdi
callq 0x22b0
xorl %eax, %eax
jmp 0x5a9a
// File: /workspace/github_c_makefile_star2_O2/ttoobne[P]bohttpd/src/core/threadpool.c
// Function: threadpool_destroy
int threadpool_destroy(threadpool_t* threadpool) {
    int i;

    do {
        if (threadpool == NULL) {
            log_error("arguments invalid.");
            break;
        }

        /* 取得互斥锁资源 */
        if (pthread_mutex_lock(&(threadpool->lock_mutex)) != 0) {
            log_error("lock failed.");
            break;
        }

        /* 如果线程池已经关闭，则直接返回 */
        if (threadpool->shutdown) {
            log_error("already shutting down.");
            break;
        }

        /* 将线程池设置为关闭 */
        threadpool->shutdown = 1;

        /* 广播通知线程终止并解锁 */
        if ((pthread_cond_broadcast(&(threadpool->nempty_cond)) != 0) ||
            (pthread_mutex_unlock(&(threadpool->lock_mutex)) != 0)) {
            log_error("threadpool unlock failed.");
            break;
        }

        /* 回收线程池中的所有线程 */
        for (i = 0; i < threadpool->thread_running; ++ i) {
            if (pthread_join(threadpool->threads[i], NULL) != 0) {
                log_error("thread join failed.");
            }
        }

        return threadpool_free(threadpool);

    } while (0);

    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x5b2f
movq %rdi, %rbx
leaq 0x30(%rdi), %r14
movq %r14, %rdi
callq 0x2480
testl %eax, %eax
je 0x5b4e
leaq 0x1379(%rip), %rsi      # 0x6e8d
leaq 0x1467(%rip), %rdx      # 0x6f82
leaq 0x1497(%rip), %r8       # 0x6fb9
pushq $0x4
popq %rdi
movl $0xdc, %ecx
jmp 0x5bb3
leaq 0x1357(%rip), %rsi      # 0x6e8d
leaq 0x1445(%rip), %rdx      # 0x6f82
leaq 0x1371(%rip), %r8       # 0x6eb5
pushq $0x4
popq %rdi
movl $0xd6, %ecx
jmp 0x5bb3
cmpl $0x0, 0x28(%rbx)
je 0x5b73
leaq 0x1332(%rip), %rsi      # 0x6e8d
leaq 0x1420(%rip), %rdx      # 0x6f82
leaq 0x142c(%rip), %r8       # 0x6f95
pushq $0x4
popq %rdi
movl $0xe2, %ecx
jmp 0x5bb3
movl $0x1, 0x28(%rbx)
leaq 0x88(%rbx), %rdi
callq 0x20a0
testl %eax, %eax
jne 0x5b96
movq %r14, %rdi
callq 0x22b0
testl %eax, %eax
je 0x5bcc
leaq 0x12f0(%rip), %rsi      # 0x6e8d
leaq 0x13de(%rip), %rdx      # 0x6f82
leaq 0x1401(%rip), %r8       # 0x6fac
pushq $0x4
popq %rdi
movl $0xec, %ecx
xorl %eax, %eax
callq 0x4c60
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x13af(%rip), %r15      # 0x6f82
leaq 0x13ec(%rip), %r12      # 0x6fc6
pushq $0x4
popq %r13
xorl %r14d, %r14d
movslq 0x14(%rbx), %rax
cmpq %rax, %r14
jge 0x5c1d
movq (%rbx), %rax
movq (%rax,%r14,8), %rdi
xorl %esi, %esi
callq 0x2420
testl %eax, %eax
je 0x5c18
movl %r13d, %edi
leaq 0x1287(%rip), %rsi      # 0x6e8d
movq %r15, %rdx
movl $0xf3, %ecx
movq %r12, %r8
xorl %eax, %eax
callq 0x4c60
incq %r14
jmp 0x5be1
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x598e
nop
// File: /workspace/github_c_makefile_star2_O2/ttoobne[P]bohttpd/src/core/utility.c
// Function: set_nonblocking
int set_nonblocking(int fd)
{
    int old_option;
    int new_option;

    if ((old_option = fcntl(fd, F_GETFL)) == -1)
    {
        log_error("get fd option failed.");
        return -1;
    }

    new_option = old_option | O_NONBLOCK;

    if (fcntl(fd, F_SETFL, new_option) == -1)
    {
        log_error("set fd option failed.");
        return -1;
    }

    return old_option;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edi, %r14d
pushq $0x3
popq %rsi
xorl %eax, %eax
callq 0x20e0
cmpl $-0x1, %eax
je 0x5c85
movl %eax, %ebx
movl %eax, %edx
orl $0x800, %edx            # imm = 0x800
pushq $0x4
popq %rsi
movl %r14d, %edi
xorl %eax, %eax
callq 0x20e0
cmpl $-0x1, %eax
jne 0x5caa
leaq 0x136a(%rip), %rsi      # 0x6fda
leaq 0x1376(%rip), %rdx      # 0x6fed
leaq 0x1395(%rip), %r8       # 0x7013
pushq $0x4
popq %rdi
pushq $0x26
jmp 0x5c9f
leaq 0x134e(%rip), %rsi      # 0x6fda
leaq 0x135a(%rip), %rdx      # 0x6fed
leaq 0x1363(%rip), %r8       # 0x6ffd
pushq $0x4
popq %rdi
pushq $0x1e
popq %rcx
xorl %eax, %eax
callq 0x4c60
pushq $-0x1
popq %rbx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ttoobne[P]bohttpd/src/core/utility.c
// Function: ignore_sigpipe
int ignore_sigpipe()
{
    struct sigaction sa;

    memset(&sa, 0, sizeof(sa));
    sa.sa_handler = SIG_IGN;
    sa.sa_flags = 0;

    if (sigaction(SIGPIPE, &sa, NULL))
    {
        log_error("ignore SIGPIPE signal failed.");
        return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xa0, %rsp
leaq -0xa0(%rbp), %r14
xorl %ebx, %ebx
movl $0x90, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x21b0
movq $0x1, -0x8(%r14)
pushq $0xd
popq %rdi
leaq -0xa8(%rbp), %rsi
xorl %edx, %edx
callq 0x20b0
testl %eax, %eax
je 0x5d19
leaq 0x12df(%rip), %rsi      # 0x6fda
leaq 0x1327(%rip), %rdx      # 0x7029
leaq 0x132f(%rip), %r8       # 0x7038
pushq $0x4
popq %rdi
pushq $0x3a
popq %rcx
xorl %eax, %eax
callq 0x4c60
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0xa0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/main.c
// Function: help
void help() {
	char **s;
	fprintf(ferr, "\n");
	fprintf(ferr, "NAME\n");
	fprintf(ferr, "\n");
	fprintf(ferr, "%s\n", version);
	fprintf(ferr, "%s\n", copyright);

	fprintf(ferr, "\n");
	fprintf(ferr, "SYNOPSIS\n");
	fprintf(ferr, "\n");
	fprintf(ferr, "Command line options are processed strictly left-to-right. \n\n");
	// getopt must be initialized to print the syntax
	getopt_help(&getopt_parser, stdout, arg_menu_linewidth, 10, PROGNAME);
	fprintf(ferr, "\n");
	fprintf(ferr, "EXAMPLES\n");
	fprintf(ferr, "\n");
	for (s = examples; *s; s++)
		fputs(*s, ferr);

	fprintf(ferr, "\n");
	fprintf(ferr, "SEE ALSO\n");
	fprintf(ferr, "\n");
	fprintf(ferr, "Online docs: www.retrocmp.com/tools/tu58fs \n");
	fprintf(ferr, "Repository: https://github.com/j-hoppe/tu58fs\n");
	fprintf(ferr, "Contact: j_hoppe@t-online.de\n");
	fprintf(ferr, "\n");
	exit(1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
leaq 0x1ab45(%rip), %r12     # 0x1e230
movq (%r12), %rsi
pushq $0xa
popq %rbx
movl %ebx, %edi
callq 0x3290
movq (%r12), %rcx
leaq 0xd92c(%rip), %rdi      # 0x11030
pushq $0x5
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
callq 0x3550
movq (%r12), %rsi
movl %ebx, %edi
callq 0x3290
movq (%r12), %rdi
leaq 0x11668(%rip), %r15     # 0x14d91
leaq 0x18bf0(%rip), %rdx     # 0x1c320
movq %r15, %rsi
xorl %eax, %eax
callq 0x3310
movq (%r12), %rdi
leaq 0x18c3b(%rip), %rdx     # 0x1c380
movq %r15, %rsi
xorl %eax, %eax
callq 0x3310
movq (%r12), %rsi
movl %ebx, %edi
callq 0x3290
movq (%r12), %rcx
leaq 0xd8d1(%rip), %rdi      # 0x11036
pushq $0x9
popq %r15
movq %r15, %rsi
movq %r14, %rdx
callq 0x3550
movq (%r12), %rsi
movl %ebx, %edi
callq 0x3290
movq (%r12), %rcx
leaq 0xd8b6(%rip), %rdi      # 0x11040
pushq $0x3d
popq %rsi
movq %r14, %rdx
callq 0x3550
movq 0x18834(%rip), %rax     # 0x1bfd0
movq (%rax), %rsi
movl 0x18b6f(%rip), %edx     # 0x1c314
leaq 0x192e4(%rip), %rdi     # 0x1ca90
leaq 0xd8cb(%rip), %r8       # 0x1107e
movl %ebx, %ecx
callq 0x5b6a
movq (%r12), %rsi
movl %ebx, %edi
callq 0x3290
movq (%r12), %rcx
leaq 0xd8b5(%rip), %rdi      # 0x11085
movq %r15, %rsi
movq %r14, %rdx
callq 0x3550
movq (%r12), %rsi
movl %ebx, %edi
callq 0x3290
leaq 0x18433(%rip), %rbx     # 0x1bc20
movq (%rbx), %rdi
movq (%r12), %rsi
testq %rdi, %rdi
je 0x3804
callq 0x3210
addq $0x8, %rbx
jmp 0x37ed
pushq $0xa
popq %rbx
movl %ebx, %edi
callq 0x3290
movq (%r12), %rcx
leaq 0xd876(%rip), %rdi      # 0x1108f
pushq $0x9
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
callq 0x3550
movq (%r12), %rsi
movl %ebx, %edi
callq 0x3290
movq (%r12), %rcx
leaq 0xd85b(%rip), %rdi      # 0x11099
pushq $0x2c
popq %rsi
movq %r14, %rdx
callq 0x3550
movq (%r12), %rcx
leaq 0xd872(%rip), %rdi      # 0x110c6
pushq $0x2e
popq %rsi
movq %r14, %rdx
callq 0x3550
movq (%r12), %rcx
leaq 0xd88b(%rip), %rdi      # 0x110f5
pushq $0x1d
popq %rsi
movq %r14, %rdx
callq 0x3550
movq (%r12), %rsi
movl %ebx, %edi
callq 0x3290
pushq $0x1
popq %rdi
callq 0x3540
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/main.c
// Function: commandline_option_error
static void commandline_option_error(char *errtext, ...) {
	va_list args;
	fprintf(ferr, "Error while parsing commandline option:\n");
	if (errtext) {
		va_start(args, errtext);
		vfprintf(ferr, errtext, args);
		fprintf(ferr, "\nSyntax:  ");
		va_end(args);
	} else
		fprintf(ferr, "  %s\nSyntax:  ", getopt_parser.curerrortext);
	getopt_help_option(&getopt_parser, stdout, 96, 10);
	exit(1);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %rbx
movq %rsi, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0x4f63
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
leaq 0x192c6(%rip), %r14     # 0x1e230
movq (%r14), %rcx
leaq 0xe114(%rip), %rdi      # 0x13088
pushq $0x28
popq %rsi
pushq $0x1
popq %rdx
callq 0x3550
testq %rbx, %rbx
jne 0x4f9e
movq (%r14), %rdi
leaq 0xe123(%rip), %rsi      # 0x130b1
leaq 0x1817f(%rip), %rdx     # 0x1d114
xorl %eax, %eax
callq 0x3310
jmp 0x4fe3
leaq 0x20(%rsp), %rax
movq %rsp, %rdx
movq %rax, 0x10(%rdx)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rdx)
movq (%r14), %rdi
movq %rbx, %rsi
callq 0x34f0
movq (%r14), %rcx
leaq 0xe0dd(%rip), %rdi      # 0x130b5
pushq $0xa
popq %rsi
pushq $0x1
popq %rdx
callq 0x3550
movq 0x16fe6(%rip), %rax     # 0x1bfd0
movq (%rax), %rsi
leaq 0x17a9c(%rip), %rdi     # 0x1ca90
pushq $0x60
popq %rdx
pushq $0xa
popq %rcx
callq 0x62ed
pushq $0x1
popq %rdi
callq 0x3540
nop
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/getopt2.c
// Function: getopt_isoption
int getopt_isoption(getopt_t *_this, char *name)
{
	if (name == NULL && _this->cur_option == _this->nonoption_descr)
		return 1; // were parsing the non-option args
	if (!_this->cur_option)
		return 0; // not equal
	if (!name) // nonoption args already tested
		return 0;
	// names NULL for nonoption-args
	if (_this->cur_option->short_name && !getopt_strcmp(_this, name, _this->cur_option->short_name))
		return 1;
	if (_this->cur_option->long_name && !getopt_strcmp(_this, name, _this->cur_option->long_name))
		return 1;
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x338(%rdi), %r12
xorl %ebx, %ebx
testq %rsi, %rsi
je 0x52e2
testq %r12, %r12
je 0x52e9
movq %rsi, %r15
movq 0x8(%r12), %rdx
pushq $0x1
popq %rbx
testq %rdx, %rdx
je 0x52c5
movq %r14, %rdi
movq %r15, %rsi
callq 0x52f7
testl %eax, %eax
je 0x52e9
movq 0x10(%r12), %rdx
testq %rdx, %rdx
je 0x52de
movq %r14, %rdi
movq %r15, %rsi
callq 0x52f7
testl %eax, %eax
je 0x52e9
xorl %ebx, %ebx
jmp 0x52e9
cmpq 0x8(%r14), %r12
sete %bl
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/getopt2.c
// Function: getopt_parse_error
static int getopt_parse_error(getopt_t *_this, int error)
{
	_this->curerror = error;
	switch (error) {
	case GETOPT_STATUS_ILLEGALOPTION:
		snprintf(_this->curerrortext, sizeof(_this->curerrortext),
			"Undefined option at \"%s\"", _this->curtoken);
		break;
	case GETOPT_STATUS_MINARGCOUNT:
		if (_this->cur_option == _this->nonoption_descr)
			snprintf(_this->curerrortext, sizeof(_this->curerrortext),
				"Less than %d non-option arguments at \"%s\"",
				_this->cur_option->fix_arg_count, _this->curtoken);
		else
			snprintf(_this->curerrortext, sizeof(_this->curerrortext),
				"Less than %d arguments for option \"%s\" at \"%s\"",
				_this->cur_option->fix_arg_count, _this->cur_option->long_name, _this->curtoken);
		break;
	case GETOPT_STATUS_MAXARGCOUNT:
		if (_this->cur_option == _this->nonoption_descr)
			snprintf(_this->curerrortext, sizeof(_this->curerrortext),
				"More than %d non-option arguments at \"%s\"", _this->cur_option->max_arg_count, _this->curtoken);
		else
			snprintf(_this->curerrortext, sizeof(_this->curerrortext),
				"More than %d arguments for option \"%s\" at \"%s\"",
				_this->cur_option->max_arg_count, _this->cur_option->long_name, _this->curtoken);
		break;
	}
	return error;
}

// Assembly:
pushq %rbx
movl %esi, %ebx
movl %esi, 0x680(%rdi)
cmpl $-0x3, %esi
je 0x557b
cmpl $-0x2, %ebx
jne 0x55b8
movq 0x338(%rdi), %rdx
leaq 0x684(%rdi), %rax
movl 0x678(%rdx), %ecx
cmpq 0x8(%rdi), %rdx
je 0x55db
movq 0x10(%rdx), %r8
movq 0x678(%rdi), %r9
leaq 0xe005(%rip), %rdx      # 0x1357e
jmp 0x55a7
movq 0x338(%rdi), %rdx
leaq 0x684(%rdi), %rax
movl 0x67c(%rdx), %ecx
cmpq 0x8(%rdi), %rdx
je 0x55eb
movq 0x10(%rdx), %r8
movq 0x678(%rdi), %r9
leaq 0xe030(%rip), %rdx      # 0x135d7
movl $0x101, %esi            # imm = 0x101
movq %rax, %rdi
xorl %eax, %eax
callq 0x31d0
jmp 0x5608
movq 0x678(%rdi), %rcx
addq $0x684, %rdi            # imm = 0x684
leaq 0xdf6e(%rip), %rdx      # 0x1353b
movl $0x101, %esi            # imm = 0x101
xorl %eax, %eax
callq 0x31d0
jmp 0x5608
movq 0x678(%rdi), %r8
leaq 0xdf6b(%rip), %rdx      # 0x13554
jmp 0x55f9
movq 0x678(%rdi), %r8
leaq 0xdfb4(%rip), %rdx      # 0x135ad
movl $0x101, %esi            # imm = 0x101
movq %rax, %rdi
xorl %eax, %eax
callq 0x31d0
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/getopt2.c
// Function: getopt_arg_s
int getopt_arg_s(getopt_t *_this, char *argname, char *val, unsigned valsize)
{
	int argidx;
	getopt_option_descr_t  *odesc = _this->cur_option;
	if (!odesc)
		return getopt_parse_error(_this, GETOPT_STATUS_ILLEGALOPTION);
	argidx = getopt_optionargidx(_this, odesc, argname);
	if (argidx < 0)
		return getopt_arg_error(_this, odesc, GETOPT_STATUS_ILLEGALARG, argname, NULL);
	if (argidx >= (int)_this->cur_option_argvalcount)
		// only n args specified, but this has list place > n
		// the optional argument [argidx] is not given in the arguument list
		return GETOPT_STATUS_EOF;
	//		return getopt_arg_error(_this, odesc, GETOPT_STATUS_ARGNOTSET, argname, NULL);
	strncpy(val, _this->cur_option_argval[argidx], valsize);
	val[valsize - 1] = 0;
	return GETOPT_STATUS_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x338(%rdi), %r13
testq %r13, %r13
je 0x5821
movq %rsi, %r12
movq %rdx, 0x8(%rsp)
movq %rcx, 0x10(%rsp)
movslq 0x678(%r13), %r15
xorl %ebp, %ebp
testl %r15d, %r15d
movl $0x0, %r14d
cmovgl %r15d, %r14d
cmpq %rbp, %r14
je 0x5835
movq 0x18(%r13,%rbp,8), %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x52f7
testl %eax, %eax
je 0x587c
incq %rbp
jmp 0x5803
pushq $-0x1
popq %r15
movq %rbx, %rdi
movl %r15d, %esi
callq 0x553a
jmp 0x58d2
movslq 0x67c(%r13), %rbp
leaq 0x340(%r13), %r14
cmpq %rbp, %r15
jge 0x5863
movq (%r14), %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x52f7
testl %eax, %eax
je 0x5879
incq %r15
addq $0x8, %r14
jmp 0x5843
pushq $-0x5
popq %rdx
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x58e4
jmp 0x58ba
movq %r15, %rbp
testl %ebp, %ebp
js 0x58ba
xorl %r15d, %r15d
cmpl %ebp, 0x670(%rbx)
jle 0x58d2
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movq 0x348(%rbx,%rbp,8), %rsi
movq 0x10(%rsp), %rbx
movl %ebx, %edx
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x30a0
decl %ebx
movb $0x0, (%r14,%rbx)
pushq $0x1
popq %r15
jmp 0x58d2
pushq $-0x4
popq %r15
movq %rbx, %rdi
movq %r13, %rsi
movl %r15d, %edx
movq %r12, %rcx
xorl %r8d, %r8d
callq 0x58e4
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/getopt2.c
// Function: getopt_arg_error
static int getopt_arg_error(getopt_t *_this, getopt_option_descr_t *odesc, int error, char *argname, char *argval) {
	_this->curerror = error;
	switch (error) {
	case GETOPT_STATUS_ILLEGALARG:
		snprintf(_this->curerrortext, sizeof(_this->curerrortext),
			"Option \"%s\" has no argument \"%s\"", odesc->long_name, argname);
		break;
	case GETOPT_STATUS_ARGNOTSET:
		snprintf(_this->curerrortext, sizeof(_this->curerrortext),
			"Optional argument \"%s\" for option \"%s\" not set", argname, odesc->long_name);
		break;
	case GETOPT_STATUS_ARGFORMATINT:
		snprintf(_this->curerrortext, sizeof(_this->curerrortext),
			"Argument \"%s\" of option \"%s\" has value \"%s\", which is no integer", argname, odesc->long_name, argval);
		break;
	case GETOPT_STATUS_ARGFORMATHEX:
		snprintf(_this->curerrortext, sizeof(_this->curerrortext),
			"Argument \"%s\" of option \"%s\" has value \"%s\", which is no hex integer", argname, odesc->long_name, argval);
		break;
	}
	return error;
}

// Assembly:
pushq %rbx
movq %r8, %r9
movq %rcx, %rax
movl %edx, %ebx
movl %edx, 0x680(%rdi)
addq $0x684, %rdi            # imm = 0x684
movq 0x10(%rsi), %r8
leal 0x7(%rbx), %ecx
leaq 0xda20(%rip), %rdx      # 0x13328
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leaq 0xdd7f(%rip), %rdx      # 0x13697
jmp 0x594d
leaq 0xdd06(%rip), %rdx      # 0x13627
movl $0x101, %esi            # imm = 0x101
movq %rax, %rcx
jmp 0x593d
leaq 0xdcd4(%rip), %rdx      # 0x13606
movl $0x101, %esi            # imm = 0x101
movq %r8, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x31d0
jmp 0x595c
leaq 0xdd09(%rip), %rdx      # 0x13656
movl $0x101, %esi            # imm = 0x101
movq %rax, %rcx
xorl %eax, %eax
callq 0x31d0
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/getopt2.c
// Function: getopt_arg_i
int getopt_arg_i(getopt_t *_this, char *argname, int *val)
{
	int res;
	char *endptr;
	char buff[GETOPT_MAX_LINELEN + 1];
	res = getopt_arg_s(_this, argname, buff, sizeof(buff));
	if (res <= 0) // error or EOF
		return res;
	*val = strtol(buff, &endptr, 0);
	if (*endptr) // stop char: error
		return getopt_arg_error(_this, _this->cur_option, GETOPT_STATUS_ARGFORMATINT, argname, buff);
	return GETOPT_STATUS_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x120, %rsp            # imm = 0x120
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x10(%rsp), %rdx
movl $0x101, %ecx            # imm = 0x101
callq 0x57c3
testl %eax, %eax
jle 0x59c9
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %r12
movq %r12, %rsi
xorl %edx, %edx
callq 0x3330
movl %eax, (%r15)
movq (%r12), %rax
cmpb $0x0, (%rax)
je 0x59cd
movq 0x338(%r14), %rsi
pushq $-0x6
popq %rbp
leaq 0x10(%rsp), %r8
movq %r14, %rdi
movl %ebp, %edx
movq %rbx, %rcx
callq 0x58e4
jmp 0x59d0
movl %eax, %ebp
jmp 0x59d0
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/getopt2.c
// Function: getopt_arg_u
int getopt_arg_u(getopt_t *_this, char *argname, unsigned *val)
{
	int res;
	char *endptr;
	char buff[GETOPT_MAX_LINELEN + 1];
	res = getopt_arg_s(_this, argname, buff, sizeof(buff));
	if (res <= 0) // error or EOF
		return res;
	*val = strtoul(buff, &endptr, 0);
	if (*endptr) // stop char: error
		return getopt_arg_error(_this, _this->cur_option, GETOPT_STATUS_ARGFORMATINT, argname, buff);
	return GETOPT_STATUS_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x120, %rsp            # imm = 0x120
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x10(%rsp), %rdx
movl $0x101, %ecx            # imm = 0x101
callq 0x57c3
testl %eax, %eax
jle 0x5a4b
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %r12
movq %r12, %rsi
xorl %edx, %edx
callq 0x3500
movl %eax, (%r15)
movq (%r12), %rax
cmpb $0x0, (%rax)
je 0x5a4f
movq 0x338(%r14), %rsi
pushq $-0x6
popq %rbp
leaq 0x10(%rsp), %r8
movq %r14, %rdi
movl %ebp, %edx
movq %rbx, %rcx
callq 0x58e4
jmp 0x5a52
movl %eax, %ebp
jmp 0x5a52
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/getopt2.c
// Function: getopt_arg_o
int getopt_arg_o(getopt_t *_this, char *argname, int *val)
{
	int res;
	char *endptr;
	char buff[GETOPT_MAX_LINELEN + 1];
	res = getopt_arg_s(_this, argname, buff, sizeof(buff));
	if (res <= 0) // error or EOF
		return res;
	*val = strtol(buff, &endptr, 8);
	if (*endptr) // stop char: error
		return getopt_arg_error(_this, _this->cur_option, GETOPT_STATUS_ARGFORMATHEX, argname, buff);
	return GETOPT_STATUS_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x120, %rsp            # imm = 0x120
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x10(%rsp), %rdx
movl $0x101, %ecx            # imm = 0x101
callq 0x57c3
testl %eax, %eax
jle 0x5ace
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %r12
pushq $0x8
popq %rdx
movq %r12, %rsi
callq 0x3330
movl %eax, (%r15)
movq (%r12), %rax
cmpb $0x0, (%rax)
je 0x5ad2
movq 0x338(%r14), %rsi
pushq $-0x7
popq %rbp
leaq 0x10(%rsp), %r8
movq %r14, %rdi
movl %ebp, %edx
movq %rbx, %rcx
callq 0x58e4
jmp 0x5ad5
movl %eax, %ebp
jmp 0x5ad5
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/getopt2.c
// Function: getopt_arg_h
int getopt_arg_h(getopt_t *_this, char *argname, int *val)
{
	int res;
	char *endptr;
	char buff[GETOPT_MAX_LINELEN + 1];
	res = getopt_arg_s(_this, argname, buff, sizeof(buff));
	if (res <= 0) // error or EOF
		return res;
	*val = strtol(buff, &endptr, 16);
	if (*endptr) // stop char: error
		return getopt_arg_error(_this, _this->cur_option, GETOPT_STATUS_ARGFORMATHEX, argname, buff);
	return GETOPT_STATUS_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x120, %rsp            # imm = 0x120
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x10(%rsp), %rdx
movl $0x101, %ecx            # imm = 0x101
callq 0x57c3
testl %eax, %eax
jle 0x5b51
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %r12
pushq $0x10
popq %rdx
movq %r12, %rsi
callq 0x3330
movl %eax, (%r15)
movq (%r12), %rax
cmpb $0x0, (%rax)
je 0x5b55
movq 0x338(%r14), %rsi
pushq $-0x7
popq %rbp
leaq 0x10(%rsp), %r8
movq %r14, %rdi
movl %ebp, %edx
movq %rbx, %rcx
callq 0x58e4
jmp 0x5b58
movl %eax, %ebp
jmp 0x5b58
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/getopt2.c
// Function: output_append
static void output_append(FILE *stream, char *line, int linesize, char *s, int linebreak, unsigned linelen, unsigned indent)
{
	unsigned _i_;
	if (linebreak
		|| (strlen(line) > indent && (strlen(line) + strlen(s)) > linelen)) {
		// prevent the indent from prev line to be accounted for another line break
		fprintf(stream, "%s\n", line); \
			for (_i_ = 0; _i_ < indent; _i_++) line[_i_] = ' ';
		line[_i_] = 0;
	}
	strncat(line, s, linesize);
	line[linesize - 1] = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %r12d
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
testl %ecx, %ecx
je 0x5f43
movl %r12d, %r12d
leaq 0xee74(%rip), %rsi      # 0x14d91
xorl %r13d, %r13d
movq %r15, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3310
cmpq %r13, %r12
je 0x5f3c
movb $0x20, (%rbx,%r13)
incq %r13
jmp 0x5f2d
movb $0x0, (%rbx,%r12)
jmp 0x5f6b
movl %r8d, %ebp
movq %rbx, %rdi
callq 0x3190
movl %r12d, %r12d
cmpq %r12, %rax
jbe 0x5f6b
movq %rax, %r13
movq %r14, %rdi
callq 0x3190
addq %r13, %rax
movl %ebp, %ecx
cmpq %rcx, %rax
ja 0x5f16
movl $0x200, %edx            # imm = 0x200
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3250
movb $0x0, 0x1ff(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/getopt2.c
// Function: getopt_help_commandline
void getopt_help_commandline(getopt_t *_this, FILE *stream, unsigned linelen, unsigned indent)
{
	int	i;
	char linebuff[2 * GETOPT_MAX_LINELEN];
	char phrase[2 * GETOPT_MAX_LINELEN];
	linebuff[0] = 0;
	for (i = 0; i < _this->argc; i++) {
		if (i == 0)
			snprintf(phrase, sizeof(phrase), "\"%s\"", _this->argv[i]);
		else
			snprintf(phrase, sizeof(phrase), " \"%s\"", _this->argv[i]);
		output_append(stream, linebuff, sizeof(linebuff), phrase, /*linebreak*/0, linelen, indent);
	}

	fprintf(stream, "%s\n", linebuff);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movl %ecx, 0x4(%rsp)
movl %edx, %r14d
movq %rsi, 0x8(%rsp)
movq %rdi, %r15
leaq 0x10(%rsp), %rax
movb $0x0, (%rax)
leaq 0xb78(%rdi), %rbx
leaq 0x210(%rsp), %r13
movq %rbx, %r12
xorl %ebp, %ebp
movslq 0xb70(%r15), %rax
cmpq %rax, %rbp
jge 0x62c3
testq %rbp, %rbp
movq %r12, %rax
cmoveq %rbx, %rax
leaq 0xd46c(%rip), %rdx      # 0x136ed
leaq 0xd466(%rip), %rcx      # 0x136ee
cmoveq %rcx, %rdx
movq (%rax), %rcx
movl $0x200, %esi            # imm = 0x200
movq %r13, %rdi
xorl %eax, %eax
callq 0x31d0
movq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movq %r13, %rdx
xorl %ecx, %ecx
movl %r14d, %r8d
movl 0x4(%rsp), %r9d
callq 0x5ef8
incq %rbp
addq $0x8, %r12
jmp 0x6264
leaq 0xeac7(%rip), %rsi      # 0x14d91
leaq 0x10(%rsp), %rdx
movq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x3310
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/getopt2.c
// Function: getopt_print_multilinestring
static void getopt_print_multilinestring(FILE *stream, char *linebuff, unsigned linebuffsize, char *text, unsigned linelen, unsigned indent)
{
	char *s_text;
	char *s_start, *s;

	s_start = s_text = strdup(text); // print multiline info. make writeable copy
	while (*s_start) {
		s = s_start;
		// seach end of substring
		while (*s && *s != '\n') s++;
		if (*s) { // substr seperator
			*s = '\0'; // terminate

			output_append(stream, linebuff, linebuffsize, s_start, /*linebreak*/s_start != s_text, linelen, indent);
			s_start = s + 1; // advance to start of next substr
		}
		else { // last substr
			output_append(stream, linebuff, linebuffsize, s_start, /*linebreak*/s_start != s_text, linelen, indent);
			s_start = s; // stop
		}
	}
	free(s_text);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebx
movl %ecx, %ebp
movq %rsi, %r14
movq %rdi, %r15
movq %rdx, %rdi
callq 0x3570
movq %rax, %r12
movq %rax, %rdx
movb (%rdx), %al
testb %al, %al
je 0x6385
leaq 0x1(%rdx), %r13
testb %al, %al
je 0x6364
movzbl %al, %eax
cmpl $0xa, %eax
je 0x6341
movb (%r13), %al
incq %r13
jmp 0x632c
movb $0x0, -0x1(%r13)
xorl %ecx, %ecx
cmpq %r12, %rdx
setne %cl
movq %r15, %rdi
movq %r14, %rsi
movl %ebp, %r8d
movl %ebx, %r9d
callq 0x5ef8
movq %r13, %rdx
jmp 0x6322
xorl %ecx, %ecx
cmpq %r12, %rdx
setne %cl
movq %r15, %rdi
movq %r14, %rsi
movl %ebp, %r8d
movl %ebx, %r9d
callq 0x5ef8
decq %r13
movq %r13, %rdx
jmp 0x6322
movq %r12, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3050
nop
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/tu58drive.c
// Function: tu58image_create
image_t *tu58image_create(int32_t unit, int forced_data_size) {
	if (!IMAGE_UNIT_VALID(unit)) {
		fatal("bad unit %d", unit); //terminates
	}
	if (tu58_image[unit] != NULL)
		fatal("tu58image_create(): duplicate allocation"); //terminates

	tu58_image[unit] = image_create(devTU58, unit, forced_data_size);
	return tu58_image[unit];
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movslq %edi, %rbx
leaq 0x17ab9(%rip), %r14     # 0x1de80
cmpq $0x0, (%r14,%rbx,8)
je 0x63dc
leaq 0xd3ef(%rip), %rdi      # 0x137c4
xorl %eax, %eax
callq 0x9b87
pushq $0x1
popq %rdi
movl %ebx, %esi
movl %ebp, %edx
callq 0x76bc
movq %rax, (%r14,%rbx,8)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/tu58drive.c
// Function: tu58images_closeall
void tu58images_closeall(void) {
	image_t *img;
	int32_t unit;
	for (unit = 0; unit < TU58_DEVICECOUNT; unit++) {
		img = tu58_image[unit];
		if (img) {
			if (img->open)
				image_sync(img);
			image_destroy(img);
		}
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
xorl %r14d, %r14d
leaq 0x17a71(%rip), %r15     # 0x1de80
cmpq $0x40, %r14
je 0x643d
movq (%r14,%r15), %rbx
testq %rbx, %rbx
je 0x6437
cmpb $0x0, 0xf4(%rbx)
je 0x642f
movq %rbx, %rdi
callq 0x7fad
movq %rbx, %rdi
callq 0x800d
addq $0x8, %r14
jmp 0x640f
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/tu58drive.c
// Function: tu58images_sync_all
void tu58images_sync_all() {
	image_t *img;
	int32_t unit;

	if (!opt_synctimeout_sec)
		return; // not wanted

	for (unit = 0; unit < TU58_DEVICECOUNT; unit++) {
		img = tu58_image[unit];

		if (img && img->open) {
			if (opt_debug)
				info("unit %d sync ", unit);
			image_sync(img); // does locking
		}
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0x1662d(%rip), %rax     # 0x1ca80
cmpl $0x0, (%rax)
je 0x64ae
leaq 0x17a21(%rip), %r12     # 0x1de80
leaq 0x1660e(%rip), %r13     # 0x1ca74
leaq 0xd380(%rip), %rbx      # 0x137ed
xorl %r14d, %r14d
cmpq $0x8, %r14
je 0x64ae
movq (%r12), %r15
testq %r15, %r15
je 0x64a5
cmpb $0x0, 0xf4(%r15)
je 0x64a5
cmpl $0x0, (%r13)
je 0x649d
movq %rbx, %rdi
movl %r14d, %esi
xorl %eax, %eax
callq 0x99c3
movq %r15, %rdi
callq 0x7fad
incq %r14
addq $0x8, %r12
jmp 0x6470
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/tu58drive.c
// Function: reinit
static void reinit(void) {
	// clear all buffers, wait a bit
	serial_devrxinit(&tu58_serial);
	serial_devtxinit(&tu58_serial);
	delay_ms(5);

	// init sequence, send immediately
	serial_devtxstart(&tu58_serial);
	serial_devtxput(&tu58_serial, TUF_INIT);
	serial_devtxput(&tu58_serial, TUF_INIT);
	serial_devtxflush(&tu58_serial);

	return;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
leaq 0x16bda(%rip), %rbx     # 0x1dec8
movq %rbx, %rdi
callq 0x80b2
movq %rbx, %rdi
callq 0x8090
pushq $0x5
popq %rdi
callq 0x9c93
movq %rbx, %rdi
callq 0x807d
pushq $0x4
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x81f1
movq %rbx, %rdi
movl %ebp, %esi
callq 0x81f1
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x816c
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/tu58drive.c
// Function: tu58_monitor
void* tu58_monitor(void* none) {
	int32_t sts;
	uint64_t now;
	uint64_t next_sync_time;
	UNUSED(none) ;

	next_sync_time = now_ms() + opt_synctimeout_sec * 1000;
	for (;;) {

		// check for any error
		switch (sts = serial_devrxerror(&tu58_serial)) {
		case DEV_ERROR: // error
		case DEV_BREAK: // break
			// kill and restart the emulator
			if (opt_verbose)
				info("BREAK detected");
#ifdef THIS_DOES_NOT_YET_WORK_RELIABLY
			if (pthread_cancel(tu58_server))
			error("unable to cancel emulation thread");
			if (pthread_join(tu58_server, NULL))
			error("unable to join on emulation thread");
			if (pthread_create(&tu58_server, NULL, run, NULL))
			error("unable to restart emulation thread");
#endif // THIS_DOES_NOT_YET_WORK_RELIABLY
			break;
		case DEV_OK: // OK
			break;
		case DEV_NYI: // not yet implemented
			// return (void*)1;
			break;
		default: // something else...
			error("monitor(): unknown flag %d", sts);
			break;
		}
		now = now_ms();
		// image_*() routines have, mutex locking, so no change while saving possible
		if (next_sync_time < now
				&& tu58_serial.rx_lasttime_ms + opt_synctimeout_sec * 1000 < now
				&& tu58_serial.tx_lasttime_ms + opt_synctimeout_sec * 1000 < now) {
			// next sync time passed, and RS232 inactive
			tu58images_sync_all();
			next_sync_time = now + opt_synctimeout_sec * 1000;
		}

		// bit of a delay, loop again
		delay_ms(5);

	}

	return (void*) 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %eax, %eax
callq 0x9c9e
leaq 0x15734(%rip), %r13     # 0x1ca80
movslq (%r13), %rcx
imulq $0x3e8, %rcx, %r14      # imm = 0x3E8
addq %rax, %r14
leaq 0x16b67(%rip), %rbx     # 0x1dec8
pushq $0x5
popq %rbp
leaq 0x156f9(%rip), %r15     # 0x1ca64
movq %rbx, %rdi
callq 0x80d6
leal 0x1(%rax), %ecx
cmpl $0x2, %ecx
jb 0x73a9
leal -0x1(%rax), %ecx
cmpl $0x1, %ecx
ja 0x7399
cmpl $0x0, (%r15)
je 0x73a9
leaq 0xc585(%rip), %rdi      # 0x13915
xorl %eax, %eax
callq 0x99c3
jmp 0x73a9
leaq 0xc584(%rip), %rdi      # 0x13924
movl %eax, %esi
xorl %eax, %eax
callq 0x98f2
xorl %eax, %eax
callq 0x9c9e
cmpq %rax, %r14
jae 0x73f4
movq %rax, %r12
movslq (%r13), %rax
imulq $0x3e8, %rax, %rax      # imm = 0x3E8
movq 0x16b0e(%rip), %rcx     # 0x1ded8
addq %rax, %rcx
cmpq %r12, %rcx
jae 0x73f4
addq 0x16b07(%rip), %rax     # 0x1dee0
cmpq %r12, %rax
jae 0x73f4
callq 0x6443
movslq (%r13), %rax
imulq $0x3e8, %rax, %rax      # imm = 0x3E8
addq %rax, %r12
movq %r12, %r14
movl %ebp, %edi
callq 0x9c93
jmp 0x736b
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/tu58drive.c
// Function: getpacket
static int32_t getpacket(tu_packet *pkt) {
	int32_t count = pkt->cmd.length + 2; // +2 for checksum bytes
	uint8_t *ptr = (uint8_t *) pkt + 2; // skip over flag/length bytes
	uint16_t rcvchk, expchk;

	// get remaining packet bytes, incl two checksum bytes
	while (--count >= 0)
		*ptr++ = serial_devrxget(&tu58_serial);

	// get checksum bytes
	rcvchk = (ptr[-1] << 8) | (ptr[-2] << 0);

	// compute expected checksum
	expchk = checksum(pkt);

	// for debug...
	if (opt_debug)
		dumppacket(pkt, "getpacket");

	// message on error
	if (expchk != rcvchk)
		error("getpacket checksum error: exp=0x%04X rcv=0x%04X", expchk, rcvchk);

	// return checksum match indication
	return (expchk != rcvchk);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movzbl 0x1(%rdi), %ebp
addl $0x2, %ebp
leaq 0x2(%rdi), %r15
leaq 0x16aac(%rip), %r14     # 0x1dec8
testl %ebp, %ebp
jle 0x7432
decl %ebp
movq %r14, %rdi
callq 0x81ba
movb %al, (%r15)
incq %r15
jmp 0x741c
movzwl -0x2(%r15), %ebp
movq %rbx, %rdi
callq 0x7579
movl %eax, %r14d
leaq 0x1562b(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x745d
leaq 0xc5f6(%rip), %rsi      # 0x13a4b
movq %rbx, %rdi
callq 0x75b2
movzwl %r14w, %ebx
cmpl %ebx, %ebp
je 0x7477
leaq 0xc5e9(%rip), %rdi      # 0x13a55
movl %ebx, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x98f2
xorl %eax, %eax
cmpl %ebx, %ebp
setne %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/tu58drive.c
// Function: putpacket
static void putpacket(tu_packet *pkt) {
	int32_t count = pkt->cmd.length + 2; // +2 for flag/length bytes
	uint8_t *ptr = (uint8_t *) pkt; // start at flag byte
	uint16_t chksum;

	// send all packet bytes
	while (--count >= 0) {
		serial_devtxput(&tu58_serial, *ptr++);
		wait4cont(mrsp);
	}

	// compute/send checksum bytes, append to packet
	chksum = checksum(pkt);
	serial_devtxput(&tu58_serial, *ptr++ = chksum >> 0);
	wait4cont(mrsp);
	serial_devtxput(&tu58_serial, *ptr++ = chksum >> 8);
	wait4cont(mrsp);

	// for debug...
	if (opt_debug)
		dumppacket(pkt, "putpacket");

	// now actually send the packet (or whatever is left to send)
	serial_devtxflush(&tu58_serial);

	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movzbl 0x1(%rdi), %ebp
addl $0x2, %ebp
leaq 0x169f0(%rip), %r14     # 0x1dec8
movq %rdi, %r15
testl %ebp, %ebp
jle 0x74fe
decl %ebp
movzbl (%r15), %esi
incq %r15
movq %r14, %rdi
callq 0x81f1
movzbl 0x16979(%rip), %edi     # 0x1de70
callq 0x7658
jmp 0x74db
movq %rbx, %rdi
callq 0x7579
movzwl %ax, %ebp
movb %bpl, (%r15)
movzbl %bpl, %esi
leaq 0x169b1(%rip), %r14     # 0x1dec8
movq %r14, %rdi
callq 0x81f1
movzbl 0x1694a(%rip), %edi     # 0x1de70
callq 0x7658
shrl $0x8, %ebp
movb %bpl, 0x1(%r15)
movq %r14, %rdi
movl %ebp, %esi
callq 0x81f1
movzbl 0x1692d(%rip), %edi     # 0x1de70
callq 0x7658
leaq 0x15525(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x7563
leaq 0xc75c(%rip), %rsi      # 0x13cb7
movq %rbx, %rdi
callq 0x75b2
leaq 0x1695e(%rip), %rdi     # 0x1dec8
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x816c
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/tu58drive.c
// Function: checksum
static uint16_t checksum(tu_packet *pkt) {
	int32_t count = pkt->cmd.length + 2; // +2 for flag/length bytes
	uint8_t *ptr = (uint8_t *) pkt; // start at flag byte
	uint32_t chksum = 0; // initial checksum value

	while (--count >= 0) {
		chksum += *ptr++; // at least one byte
		if (--count >= 0)
			chksum += (*ptr++ << 8); // at least two bytes
		chksum = (chksum + (chksum >> 16)) & 0xFFFF; // 16b end around carry
	}

	return chksum;
}

// Assembly:
movzbl 0x1(%rdi), %ecx
addl $0x2, %ecx
xorl %eax, %eax
testl %ecx, %ecx
jle 0x75b1
movzbl (%rdi), %edx
addl %edx, %eax
cmpl $0x1, %ecx
jne 0x7595
incq %rdi
jmp 0x75a2
movzbl 0x1(%rdi), %edx
addq $0x2, %rdi
shll $0x8, %edx
addl %edx, %eax
movl %eax, %edx
shrl $0x10, %edx
addl %eax, %edx
movzwl %dx, %eax
addl $-0x2, %ecx
jmp 0x7582
retq
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/tu58drive.c
// Function: dumppacket
static void dumppacket(tu_packet *pkt, char *name) {
	int32_t count = 0;
	uint8_t *ptr = (uint8_t *) pkt;

	// formatted packet dump, but skip it in background mode
	if (!opt_background) {
		fprintf(ferr, "info: %s()\n", name);
		while (count++ < pkt->cmd.length + 2) {
			if (count == 3 || ((count - 4) % 32 == 31))
				fprintf(ferr, "\n");
			fprintf(ferr, " %02X", *ptr++);
		}
		fprintf(ferr, "\n %02X %02X\n", ptr[0], ptr[1]);
	}

	return;
}

// Assembly:
leaq 0x154c3(%rip), %rax     # 0x1ca7c
cmpl $0x0, (%rax)
je 0x75bf
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rdx
movq %rdi, %rbx
leaq 0x16c5c(%rip), %r15     # 0x1e230
movq (%r15), %rdi
leaq 0xc4a7(%rip), %rsi      # 0x13a85
xorl %eax, %eax
callq 0x3310
pushq $0xa
popq %rbp
leaq 0xc4a2(%rip), %r14      # 0x13a91
xorl %r12d, %r12d
movzbl 0x1(%rbx), %eax
addl $0x2, %eax
cmpl %eax, %r12d
jae 0x7634
cmpl $0x2, %r12d
je 0x7613
leal -0x3(%r12), %eax
andl $0x8000001f, %eax       # imm = 0x8000001F
cmpl $0x1f, %eax
jne 0x761d
movq (%r15), %rsi
movl %ebp, %edi
callq 0x3290
movq (%r15), %rdi
movzbl (%rbx,%r12), %edx
movq %r14, %rsi
xorl %eax, %eax
callq 0x3310
incq %r12
jmp 0x75f2
movq (%r15), %rdi
movzbl (%rbx,%r12), %edx
movzbl 0x1(%rbx,%r12), %ecx
leaq 0xc44e(%rip), %rsi      # 0x13a97
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3310
// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/tu58drive.c
// Function: wait4cont
static void wait4cont(uint8_t code) {
	uint8_t c;
	int32_t maxchar = TU_CTRL_LEN + TU_DATA_LEN + 8;

	// send any existing data out ... makes USB serial emulation be real slow if enabled!
	if (0)
		serial_devtxflush(&tu58_serial);

	// don't do any waiting if flag not set
	if (!code)
		return;

	// wait for a CONT to arrive, but only so long
	do {
		c = serial_devrxget(&tu58_serial);
		if (opt_debug)
			info("wait4cont(): char=0x%02X", c);
	} while (c != TUF_CONT && --maxchar >= 0);

	// all done
	return;
}

// Assembly:
testl %edi, %edi
je 0x76b8
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl $0xffffff6e, %r15d      # imm = 0xFFFFFF6E
leaq 0x16857(%rip), %rbx     # 0x1dec8
leaq 0x153fc(%rip), %r12     # 0x1ca74
leaq 0xc642(%rip), %r14      # 0x13cc1
movq %rbx, %rdi
callq 0x81ba
movl %eax, %ebp
cmpl $0x0, (%r12)
je 0x769e
movzbl %bpl, %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x99c3
cmpb $0x10, %bpl
je 0x76b0
leal 0x1(%r15), %eax
testl %r15d, %r15d
movl %eax, %r15d
jne 0x767f
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)