LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/wtarreau[P]httpterm/httpterm.c
// Function: buffer_replace
int buffer_replace(struct buffer *b, char *pos, char *end, char *str) {
    int delta;
    int len;

    len = strlen(str);
    delta = len - (end - pos);

    if (delta + b->r >= b->data + BUFSIZE)
	return 0;  /* no space left */

    /* first, protect the end of the buffer */
    memmove(end + delta, end, b->data + b->l - end);

    /* now, copy str over pos */
    memcpy(pos, str,len);

    /* we only move data after the displaced zone */
    if (b->r  > pos) b->r  += delta;
    if (b->w  > pos) b->w  += delta;
    if (b->h  > pos) b->h  += delta;
    if (b->lr > pos) b->lr += delta;
    b->l += delta;

    return delta;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movq %rcx, %rdi
callq 0x2130
movq %r14, %rbp
subq %r12, %rbp
addq %rax, %rbp
movslq %ebp, %r13
movq 0x8(%rbx), %rsi
addq %r13, %rsi
movq 0x30(%rbx), %rdx
leaq 0x1000(%rdx), %rdi
xorl %ecx, %ecx
cmpq %rdi, %rsi
jae 0x41d0
cltq
movq %rax, (%rsp)
leaq (%r12,%r13), %rdi
movl (%rbx), %eax
addq %rax, %rdx
subq %r12, %rdx
movq %r12, %rsi
callq 0x2300
movq %r14, %rdi
movq %r15, %rsi
movq (%rsp), %rdx
callq 0x2250
movq 0x8(%rbx), %rax
cmpq %r14, %rax
jbe 0x419c
addq %r13, %rax
movq %rax, 0x8(%rbx)
movq 0x10(%rbx), %rax
cmpq %r14, %rax
jbe 0x41ac
addq %r13, %rax
movq %rax, 0x10(%rbx)
movq 0x18(%rbx), %rax
cmpq %r14, %rax
jbe 0x41bc
addq %r13, %rax
movq %rax, 0x18(%rbx)
movq 0x20(%rbx), %rax
cmpq %r14, %rax
jbe 0x41cc
addq %r13, %rax
movq %rax, 0x20(%rbx)
addl %ebp, (%rbx)
movl %ebp, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wtarreau[P]httpterm/httpterm.c
// Function: buffer_replace2
int buffer_replace2(struct buffer *b, char *pos, char *end, char *str, int len) {
    int delta;

    delta = len - (end - pos);

    if (delta + b->r >= b->data + BUFSIZE)
	return 0;  /* no space left */

    if (b->data + b->l < end)
	/* The data has been stolen, we could have crashed. Maybe we should abort() ? */
	return 0;

    /* first, protect the end of the buffer */
    memmove(end + delta, end, b->data + b->l - end);

    /* now, copy str over pos */
    if (len)
	memcpy(pos, str, len);

    /* we only move data after the displaced zone */
    if (b->r  > pos) b->r  += delta;
    if (b->w  > pos) b->w  += delta;
    if (b->h  > pos) b->h  += delta;
    if (b->lr > pos) b->lr += delta;
    b->l += delta;

    return delta;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movl %r14d, %r12d
subl %edx, %r12d
addl %r8d, %r12d
movslq %r12d, %r13
movq 0x8(%rdi), %rsi
addq %r13, %rsi
movq 0x30(%rdi), %rcx
leaq 0x1000(%rcx), %rdi
xorl %eax, %eax
cmpq %rdi, %rsi
jae 0x428e
movl (%rbx), %esi
addq %rsi, %rcx
subq %rdx, %rcx
jb 0x428e
movl %r8d, %ebp
leaq (%rdx,%r13), %rdi
movq %rdx, %rsi
movq %rcx, %rdx
callq 0x2300
testl %ebp, %ebp
je 0x4248
movslq %ebp, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2250
movq 0x8(%rbx), %rax
cmpq %r14, %rax
jbe 0x4258
addq %r13, %rax
movq %rax, 0x8(%rbx)
movq 0x10(%rbx), %rax
cmpq %r14, %rax
jbe 0x4268
addq %r13, %rax
movq %rax, 0x10(%rbx)
movq 0x18(%rbx), %rax
cmpq %r14, %rax
jbe 0x4278
addq %r13, %rax
movq %rax, 0x18(%rbx)
movq 0x20(%rbx), %rax
cmpq %r14, %rax
jbe 0x4288
addq %r13, %rax
movq %rax, 0x20(%rbx)
addl %r12d, (%rbx)
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wtarreau[P]httpterm/httpterm.c
// Function: buffer_slow_realign
void buffer_slow_realign(struct buffer *buf)
{
    char *end = buf->data + BUFSIZE;
    int off   = buf->data + BUFSIZE - buf->w;

    /* two possible cases :
     *   - the buffer is in one contiguous block, we move it in-place
     *   - the buffer is in two blocks, we move it via the trash
     */
    if (buf->l) {
	int block1 = buf->l;
	int block2 = 0;
	if (buf->r <= buf->w) {
	    /* non-contiguous block */
	    block1 = buf->data + BUFSIZE - buf->w;
	    block2 = buf->r - buf->data;
	}
	if (block2)
	    memcpy(trash, buf->data, block2);
	memmove(buf->data, buf->w, block1);
	if (block2)
	    memcpy(buf->data + block1, trash, block2);
    }

    /* adjust all known pointers */
    buf->w    = buf->data;
    buf->r   += off; if (buf->r   >= end) buf->r   -= BUFSIZE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x30(%rdi), %rax
leaq 0x1000(%rax), %r12
movq 0x10(%rdi), %rsi
movq %r12, %r13
subq %rsi, %r13
movl (%rdi), %ebp
testl %ebp, %ebp
je 0x4330
movq 0x8(%rbx), %rcx
movl %ecx, %edx
subl %eax, %edx
xorl %r14d, %r14d
cmpq %rsi, %rcx
cmovbel %r13d, %ebp
cmovbel %edx, %r14d
movslq %r14d, %rdx
testl %r14d, %r14d
movq %rdx, (%rsp)
je 0x42ff
leaq 0x2a141(%rip), %rdi     # 0x2e430
movq %rax, %rsi
callq 0x2250
movq 0x10(%rbx), %rsi
movq 0x30(%rbx), %rax
movslq %ebp, %r15
movq %rax, %rdi
movq %r15, %rdx
callq 0x2300
movq 0x30(%rbx), %rax
testl %r14d, %r14d
je 0x4330
addq %r15, %rax
leaq 0x2a110(%rip), %rsi     # 0x2e430
movq %rax, %rdi
movq (%rsp), %rdx
callq 0x2250
movq 0x30(%rbx), %rax
movq %rax, 0x10(%rbx)
movslq %r13d, %rax
addq 0x8(%rbx), %rax
xorl %ecx, %ecx
cmpq %r12, %rax
setb %cl
shll $0xc, %ecx
addq %rcx, %rax
addq $-0x1000, %rax          # imm = 0xF000
movq %rax, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wtarreau[P]httpterm/httpterm.c
// Function: tv_diff
static inline unsigned long tv_diff(struct timeval *tv1, struct timeval *tv2) {
    unsigned long ret;
  
    ret = (tv2->tv_sec - tv1->tv_sec) * 1000;
    if (tv2->tv_usec > tv1->tv_usec)
	ret += (tv2->tv_usec - tv1->tv_usec) / 1000;
    else
	ret -= (tv1->tv_usec - tv2->tv_usec) / 1000;
    return (unsigned long) ret;
}

// Assembly:
movq 0x8a0b(%rip), %rsi      # 0xe400
movq (%rdi), %r8
movq 0x8(%rdi), %rax
movq 0x8a05(%rip), %rdx      # 0xe408
movq %rdx, %rcx
subq %rax, %rcx
jle 0x5a1a
movl $0x3e8, %edi            # imm = 0x3E8
movq %rcx, %rax
cqto
idivq %rdi
jmp 0x5a29
subq %rdx, %rax
movq $-0x3e8, %rcx           # imm = 0xFC18
cqto
idivq %rcx
subq %r8, %rsi
imulq $0x3e8, %rsi, %rcx      # imm = 0x3E8
addq %rax, %rcx
movq %rcx, %rax
retq
// File: /workspace/github_c_makefile_star2_O2/wtarreau[P]httpterm/httpterm.c
// Function: fd_delete
static void fd_delete(int fd) {
    my_fd_clr(fd, StaticReadEvent);
    my_fd_clr(fd, StaticWriteEvent);
#if defined(ENABLE_EPOLL)
    if (PrevReadEvent) {
	my_fd_clr(fd, PrevReadEvent);
	my_fd_clr(fd, PrevWriteEvent);
    }
#endif

    close(fd);
    fdtab[fd].state = FD_STCLOSE;

    while ((maxfd-1 >= 0) && (fdtab[maxfd-1].state == FD_STCLOSE))
	    maxfd--;
}

// Assembly:
pushq %rbx
movl %edi, %ebx
pushq $-0x2
popq %rax
movl %ebx, %ecx
roll %cl, %eax
movq 0x89ad(%rip), %rcx      # 0xe3f8
movl %edi, %edx
sarl $0x5, %edx
movslq %edx, %rdx
andl %eax, (%rcx,%rdx,4)
movq 0x289c3(%rip), %rcx     # 0x2e420
andl %eax, (%rcx,%rdx,4)
callq 0x21b0
movq 0x8914(%rip), %rax      # 0xe380
movslq %ebx, %rcx
shlq $0x5, %rcx
andl $0x0, 0x18(%rax,%rcx)
movl 0x299ce(%rip), %ecx     # 0x2f44c
addq $-0x8, %rax
testl %ecx, %ecx
jle 0x5a9c
movl %ecx, %edx
shlq $0x5, %rdx
cmpl $0x0, (%rax,%rdx)
jne 0x5a9c
decl %ecx
movl %ecx, 0x299b2(%rip)     # 0x2f44c
jmp 0x5a82
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/wtarreau[P]httpterm/httpterm.c
// Function: tv_cmp2_ms
static int tv_cmp2_ms(struct timeval *tv1, struct timeval *tv2) {
    if (tv_iseternity(tv1))
	if (tv_iseternity(tv2))
	    return 0; /* same */
	else
	    return 1; /* tv1 later than tv2 */
    else if (tv_iseternity(tv2))
	return -1; /* tv2 later than tv1 */
    
    if (tv1->tv_sec == tv2->tv_sec) {
	if (tv1->tv_usec >= tv2->tv_usec + 1000)
	    return 1;
	else if (tv2->tv_usec >= tv1->tv_usec + 1000)
	    return -1;
	else
	    return 0;
    }
    else if ((tv1->tv_sec > tv2->tv_sec + 1) ||
	     ((tv1->tv_sec == tv2->tv_sec + 1) && (tv1->tv_usec + 1000000 >= tv2->tv_usec + 1000)))
	return 1;
    else if ((tv2->tv_sec > tv1->tv_sec + 1) ||
	     ((tv2->tv_sec == tv1->tv_sec + 1) && (tv2->tv_usec + 1000000 >= tv1->tv_usec + 1000)))
	return -1;
    else
	return 0;
}

// Assembly:
movq (%rdi), %rsi
testq %rsi, %rsi
jne 0x5aad
cmpq $0x0, 0x8(%rdi)
je 0x5b29
movq 0x894c(%rip), %r8       # 0xe400
movq 0x894d(%rip), %rcx      # 0xe408
pushq $-0x1
popq %rdx
movq %r8, %rax
orq %rcx, %rax
jne 0x5ac9
movl %edx, %eax
retq
cmpq %r8, %rsi
jne 0x5af0
movq 0x8(%rdi), %rdx
leaq 0x3e8(%rcx), %rax
cmpq %rax, %rdx
jge 0x5b3d
addq $0x3e8, %rdx            # imm = 0x3E8
xorl %eax, %eax
cmpq %rdx, %rcx
setge %al
negl %eax
retq
leaq 0x1(%r8), %r9
pushq $0x1
popq %rax
cmpq %r9, %rsi
jg 0x5b28
jne 0x5b0d
movl $0xf3e58, %r9d          # imm = 0xF3E58
addq 0x8(%rdi), %r9
cmpq %rcx, %r9
jge 0x5b28
incq %rsi
cmpq %rsi, %r8
jg 0x5ac6
jne 0x5b26
addq $0xf3e58, %rcx          # imm = 0xF3E58
movl %edx, %eax
cmpq 0x8(%rdi), %rcx
jge 0x5b28
xorl %eax, %eax
retq
movq 0x88d8(%rip), %rcx      # 0xe408
xorl %eax, %eax
orq 0x88c7(%rip), %rcx      # 0xe400
setne %al
retq
pushq $0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/wtarreau[P]httpterm/httpterm.c
// Function: process_runnable_tasks
int process_runnable_tasks() {
  int next_time;
  struct task *t, *tnext;

  next_time = TIME_ETERNITY; /* set the timer to wait eternally first */

  /* look for expired tasks and add them to the run queue.
   */
  tnext = ((struct task *)LIST_HEAD(wait_queue[0]))->next;
  while ((t = tnext) != LIST_HEAD(wait_queue[0])) { /* we haven't looped ? */
      tnext = t->next;
      if (t->state & TASK_RUNNING)
	  continue;
      
      if (tv_iseternity(&t->expire))
	  continue;

      /* wakeup expired entries. It doesn't matter if they are
       * already running because of a previous event
       */
      if (tv_cmp_ms(&t->expire, &now) <= 0) {
	  task_wakeup(&rq, t);
      }
      else {
	  /* first non-runnable task. Use its expiration date as an upper bound */
	  int temp_time = tv_remain(&now, &t->expire);
	  if (temp_time)
	      next_time = temp_time;
	  break;
      }
  }

  /* process each task in the run queue now. Each task may be deleted
   * since we only use the run queue's head. Note that any task can be
   * woken up by any other task and it will be processed immediately
   * after as it will be queued on the run queue's head.
   */
  while ((t = rq) != NULL) {
      int temp_time;

      task_sleep(&rq, t);
      temp_time = t->process(t);
      next_time = MINTIME(temp_time, next_time);
  }
  return next_time;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x86ed(%rip), %rbx      # 0xe240
movq 0x882e(%rip), %r14      # 0xe388
leaq 0x86df(%rip), %r15      # 0xe240
cmpq %r15, %rbx
je 0x5bbe
movq %rbx, %r13
movq (%rbx), %rbx
movl 0x20(%r13), %ebp
testb $0x1, %bpl
jne 0x5b61
movq 0x28(%r13), %rdx
testq %rdx, %rdx
jne 0x5b86
cmpq $0x0, 0x30(%r13)
je 0x5b61
movq %rdx, (%rsp)
leaq 0x28(%r13), %r12
movq %r12, %rdi
leaq 0x8868(%rip), %rsi      # 0xe400
callq 0x5c7c
testl %eax, %eax
jg 0x5bc6
cmpl $0x1, %ebp
je 0x5b61
movq %r14, 0x10(%r13)
movl $0x1, 0x20(%r13)
movq %r13, 0x87cf(%rip)      # 0xe388
movq %r13, %r14
jmp 0x5b61
pushq $-0x1
popq %rbx
jmp 0x5c66
leaq 0x8833(%rip), %rdi      # 0xe400
movq %r12, %rsi
callq 0x5c7c
xorl %ebx, %ebx
testl %eax, %eax
js 0x5bdf
xorl %eax, %eax
jmp 0x5c25
movq (%rsp), %rax
subq 0x8816(%rip), %rax      # 0xe400
imulq $0x3e8, %rax, %rsi      # imm = 0x3E8
movq 0x30(%r13), %rdx
movq 0x880c(%rip), %rax      # 0xe408
movq %rdx, %rcx
subq %rax, %rcx
jle 0x5c13
movl $0x3e8, %edi            # imm = 0x3E8
movq %rcx, %rax
cqto
idivq %rdi
jmp 0x5c22
subq %rdx, %rax
movq $-0x3e8, %rcx           # imm = 0xFC18
cqto
idivq %rcx
addq %rsi, %rax
cmpl $0x1, %eax
sbbl %ebx, %ebx
orl %eax, %ebx
jmp 0x5c66
cmpl $0x1, 0x20(%r14)
jne 0x5c45
movq 0x10(%r14), %rax
movq %rax, 0x8748(%rip)      # 0xe388
andl $0x0, 0x20(%r14)
movq %r14, %rdi
callq *0x38(%r14)
cmpl %eax, %ebx
movl %eax, %ecx
cmovll %ebx, %ecx
testl %eax, %eax
cmovsl %ebx, %ecx
testl %ebx, %ebx
cmovsl %eax, %ecx
movq 0x8724(%rip), %r14      # 0xe388
movl %ecx, %ebx
testq %r14, %r14
jne 0x5c2e
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wtarreau[P]httpterm/httpterm.c
// Function: tv_cmp_ms
static int tv_cmp_ms(struct timeval *tv1, struct timeval *tv2) {
    if (tv1->tv_sec == tv2->tv_sec) {
	if (tv2->tv_usec >= tv1->tv_usec + 1000)
	    return -1;
	else if (tv1->tv_usec >= tv2->tv_usec + 1000)
	    return 1;
	else
	    return 0;
    }
    else if ((tv2->tv_sec > tv1->tv_sec + 1) ||
	     ((tv2->tv_sec == tv1->tv_sec + 1) && (tv2->tv_usec + 1000000 >= tv1->tv_usec + 1000)))
	return -1;
    else if ((tv1->tv_sec > tv2->tv_sec + 1) ||
	     ((tv1->tv_sec == tv2->tv_sec + 1) && (tv1->tv_usec + 1000000 >= tv2->tv_usec + 1000)))
	return 1;
    else
	return 0;
}

// Assembly:
movq (%rdi), %rcx
movq (%rsi), %rdx
cmpq %rdx, %rcx
jne 0x5cab
movq 0x8(%rsi), %rcx
movq 0x8(%rdi), %rdx
leaq 0x3e8(%rdx), %rax
cmpq %rax, %rcx
jge 0x5ce8
addq $0x3e8, %rcx            # imm = 0x3E8
xorl %eax, %eax
cmpq %rcx, %rdx
setge %al
retq
leaq 0x1(%rcx), %r8
pushq $-0x1
popq %rax
cmpq %r8, %rdx
jg 0x5ce7
jne 0x5cc9
movl $0xf3e58, %r8d          # imm = 0xF3E58
addq 0x8(%rsi), %r8
cmpq 0x8(%rdi), %r8
jge 0x5ce7
incq %rdx
pushq $0x1
popq %rax
cmpq %rdx, %rcx
jg 0x5ce7
jne 0x5ce5
movl $0xf3e58, %ecx          # imm = 0xF3E58
addq 0x8(%rdi), %rcx
cmpq 0x8(%rsi), %rcx
jge 0x5ce7
xorl %eax, %eax
retq
pushq $-0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/wtarreau[P]httpterm/httpterm.c
// Function: sig_dump_state
void sig_dump_state(int sig) {
    struct proxy *p = proxy;

    Warning("SIGHUP received, dumping servers states.\n");
    while (p) {
	struct server *s = p->srv;

	while (s) {
	    snprintf(trash, sizeof(trash),
		     "SIGHUP: Server %s/%s : Conn: %d act, %d pend, %d tot.",
		     p->id, s->id,
		     s->cur_sess, 0, s->cum_sess);
	    Warning("%s\n", trash);
	    s = s->next;
	}

	snprintf(trash, sizeof(trash),
		 "SIGHUP: Proxy %s has %d active servers available."
		 " Conn: %d act, %d pend (%d unass), %d tot.",
		 p->id, p->srv_act, 
		 p->nbconn, 0, 0, p->cum_conn);
	Warning("%s\n", trash);
	p = p->next;
    }
    signal(sig, sig_dump_state);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, 0x4(%rsp)
movq 0x840e(%rip), %rbp      # 0xe378
leaq 0x43bf(%rip), %rdi      # 0xa330
xorl %eax, %eax
callq 0x2adf
leaq 0x284b1(%rip), %r14     # 0x2e430
leaq 0x440a(%rip), %r15      # 0xa390
leaq 0x4cdb(%rip), %r12      # 0xac68
leaq 0x43c6(%rip), %r13      # 0xa35a
testq %rbp, %rbp
je 0x6022
leaq 0x10(%rbp), %rbx
movq (%rbx), %rbx
movq 0x38(%rbp), %rcx
testq %rbx, %rbx
je 0x5fe0
movq 0x8(%rbx), %r8
movl 0x18(%rbx), %r9d
movl 0x1c(%rbx), %r10d
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rdi
movq %r13, %rdx
xorl %eax, %eax
pushq %r10
pushq $0x0
callq 0x2170
popq %rcx
popq %rdx
movq %r12, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x2adf
jmp 0x5fa1
movl 0x18(%rbp), %r8d
movl 0x40(%rbp), %r9d
movl 0x44(%rbp), %r10d
subq $0x8, %rsp
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
pushq %r10
pushq $0x0
pushq $0x0
callq 0x2170
addq $0x20, %rsp
movq %r12, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x2adf
movq 0x50(%rbp), %rbp
jmp 0x5f94
leaq -0xd5(%rip), %rsi       # 0x5f54
movl 0x4(%rsp), %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2210
// File: /workspace/github_c_makefile_star2_O2/wtarreau[P]httpterm/httpterm.c
// Function: init_default_instance
void init_default_instance() {
    memset(&defproxy, 0, sizeof(defproxy));
    defproxy.state = PR_STNEW;
    defproxy.maxconn = cfg_maxconn ? cfg_maxconn : global.maxconn;
    if (!defproxy.maxconn)
	defproxy.maxconn = DEFAULT_MAXPCONN;
}

// Assembly:
pushq %rax
leaq 0x2907f(%rip), %rdi     # 0x2f450
movl $0xe0, %edx
xorl %esi, %esi
callq 0x21a0
movl 0x7f4d(%rip), %eax      # 0xe330
testl %eax, %eax
jne 0x63ed
movl 0x7fbb(%rip), %eax      # 0xe3a8
testl %eax, %eax
movl $0x40000000, %ecx       # imm = 0x40000000
cmovnel %eax, %ecx
movl %ecx, 0x2909b(%rip)     # 0x2f498
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/wtarreau[P]httpterm/httpterm.c
// Function: pool_destroy
void pool_destroy(void **pool)
{
    void *temp, *next;
    next = pool;
    while (next) {
	temp = next;
	next = *(void **)temp;
	free(temp);
    }
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x7d0b
movq (%rdi), %rbx
callq 0x2050
movq %rbx, %rdi
jmp 0x7cf9
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/codeniko[P]CS214-Malloc-Free/Test8.c
// Function: main
void main()
{
    void* p = malloc(2);
    free(p);
    printf("p has been freed\n");
    free(p + 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0xeaa(%rip), %rbx       # 0x2004
pushq $0x2
popq %rdi
pushq $0x6
popq %rdx
movq %rbx, %rsi
callq 0x119c
movq %rax, %r14
pushq $0x7
popq %rdx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x12d5
leaq 0xe8c(%rip), %rdi       # 0x200c
callq 0x1030
incq %r14
pushq $0x9
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x12d5
nop
// File: /workspace/github_c_makefile_star2_O2/ramirezsebas[P]TP-LISTINGS/./src/capitulo_5/5.12/socket-inet.c
// Function: get_home_page
void get_home_page (int socket_fd)
{
  char buffer[10000];
  ssize_t number_characters_read;
  /* Send the HTTP GET command for the home page. */
  sprintf (buffer, "GET /\n");
  write (socket_fd, buffer, strlen (buffer));
  /* Read from the socket. The call to read may not return all the data at one time, so keep
  trying until we run out. */
  while (1) {
    number_characters_read = read (socket_fd, buffer, 10000);
    if (number_characters_read == 0)
      return;
    /* Write the data to standard output. */
    fwrite (buffer, sizeof (char), number_characters_read, stdout);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x2710, %rsp           # imm = 0x2710
movl %edi, %ebx
leaq -0x2730(%rbp), %r14
movl $0xa2f20, 0x3(%r14)     # imm = 0xA2F20
movl $0x20544547, (%r14)     # imm = 0x20544547
movq %r14, %rdi
callq 0x1040
movl %ebx, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x1030
movq 0x2dee(%rip), %r12      # 0x3fe0
pushq $0x1
popq %r15
movl $0x2710, %edx           # imm = 0x2710
movl %ebx, %edi
movq %r14, %rsi
callq 0x1050
testq %rax, %rax
je 0x121e
movq (%r12), %rcx
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x1090
jmp 0x11f6
addq $0x2710, %rsp           # imm = 0x2710
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ramirezsebas[P]TP-LISTINGS/./src/capitulo_5/5.12/socket-inet.c
// Function: main
int main (int argc, char* const argv[])
{
  int socket_fd;
  struct sockaddr_in name;
  struct hostent* hostinfo;
  /* Create the socket. */
  socket_fd = socket (PF_INET, SOCK_STREAM, 0);
  /* Store the server’s name in the socket address. */
  name.sin_family = AF_INET;
  /* Convert from strings to numbers. */
  hostinfo = gethostbyname (argv[1]);
  if (hostinfo == NULL)
    return 1;
  else
    name.sin_addr = *((struct in_addr *) hostinfo->h_addr);
  /* Web servers use port 80. */
  name.sin_port = htons (80);
  /*Connect to the Web server*/

  if (connect (socket_fd, (const struct sockaddr *)&name, sizeof (struct sockaddr_in)) == -1) {
    perror ("connect");
    return 1;
  }
  /* Retrieve the server’s home page. */
  get_home_page (socket_fd);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r15
pushq $0x2
popq %rdi
pushq $0x1
popq %rbx
movl %ebx, %esi
xorl %edx, %edx
callq 0x10a0
movl %eax, %r14d
movw $0x2, -0x28(%rbp)
movq 0x8(%r15), %rdi
callq 0x1060
testq %rax, %rax
je 0x1294
movq 0x18(%rax), %rax
movq (%rax), %rax
movl (%rax), %eax
leaq -0x28(%rbp), %rsi
movl %eax, 0x4(%rsi)
movw $0x5000, 0x2(%rsi)      # imm = 0x5000
pushq $0x10
popq %rdx
movl %r14d, %edi
callq 0x1080
cmpl $-0x1, %eax
je 0x12a1
movl %r14d, %edi
callq 0x11ac
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd63(%rip), %rdi       # 0x200b
callq 0x1070
jmp 0x1294
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/aes256otrsv2/ref/OTR.c
// Function: Setup
int Setup(const uint8 *skey)
{
	uint8 cst[16] = {0};

	KeySchedule(KeyLen, ENC, skey);
	Encryption(KeyLen, cst, gamma);
	mul2(gamma, gamma2); 
	mul2(gamma2, Q); /* Q = 4gamma */
	return SUCCESS;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rdx
vxorps %xmm0, %xmm0, %xmm0
movq %rsp, %rbx
vmovaps %xmm0, (%rbx)
movl $0x100, %edi            # imm = 0x100
xorl %esi, %esi
callq 0x1090
movq 0x3d64(%rip), %r14      # 0x4f88
movl $0x100, %edi            # imm = 0x100
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1100
movq 0x3db5(%rip), %rbx      # 0x4ff0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x125f
movq 0x3d6b(%rip), %rsi      # 0x4fb8
movq %rbx, %rdi
callq 0x125f
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/aes256otrsv2/ref/OTR.c
// Function: mul2
static void mul2(const uint8 *in, uint8 *out)
{
	int i, t = in[0] >> 7;
    for(i = 0; i < 15; i++)
        out[i] = (in[i] << 1) | (in[i + 1] >> 7);
    out[15] = (in[15] << 1) ^ cst_mul[t];
}

// Assembly:
movzbl (%rdi), %eax
xorl %ecx, %ecx
cmpq $0xf, %rcx
je 0x1283
movb (%rdi,%rcx), %dl
movb 0x1(%rdi,%rcx), %r8b
shrb $0x7, %r8b
addb %dl, %dl
orb %r8b, %dl
movb %dl, (%rsi,%rcx)
incq %rcx
jmp 0x1264
shrl $0x7, %eax
movb 0xf(%rdi), %cl
addb %cl, %cl
leaq 0x1d6e(%rip), %rdx      # 0x3000
xorb (%rax,%rdx), %cl
movb %cl, 0xf(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/aes256otrsv2/ref/OTR.c
// Function: nEnc
int nEnc(const uint8 *nonce, uint32 nonce_len, uint32 t_len){
	uint8 tmp[BLOCK]={0};

	memcpy(&tmp[BLOCK-nonce_len],nonce,nonce_len);
	tmp[0]=(uint8)((t_len*8)%(BLOCK*8)<<1);
	tmp[BLOCK-nonce_len-1] |= 0x01;
#ifdef INTERMEDIATE
	printf("(Format(tau,N)||0*||1||N) :\n"); printbseq(tmp,BLOCK);
#endif
	Encryption(KeyLen, tmp, delta);	// delta = E(Format(tau,N))
	if(ADP==Seri){
		xor(delta, TA, delta); // delta ^= TA
	}
	mul2(delta, L);
	mul2(L, L); //L = 4delta
	return SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %rsi
vxorps %xmm0, %xmm0, %xmm0
movq %rsp, %r14
vmovaps %xmm0, (%r14)
pushq $0x10
popq %rax
subl %ebp, %eax
leaq (%rsp,%rax), %rdi
movl %ebp, %edx
callq 0x1110
shlb $0x4, %bl
movb %bl, (%r14)
pushq $0xf
popq %rax
subl %ebp, %eax
orb $0x1, (%rsp,%rax)
movq 0x3cee(%rip), %rbx      # 0x4fc8
movl $0x100, %edi            # imm = 0x100
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1100
movq 0x3cf7(%rip), %rsi      # 0x4fe8
movq %rbx, %rdi
movq %rbx, %rdx
callq 0x1324
movq 0x3c95(%rip), %r14      # 0x4f98
movq %rbx, %rdi
movq %r14, %rsi
callq 0x125f
movq %r14, %rdi
movq %r14, %rsi
callq 0x125f
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/aes256otrsv2/ref/OTR.c
// Function: AFunc
int AFunc(
		  const uint8 *header,
		  uint32 h_len)
{
	uint32 i,j = 0;
	uint32 m, last;
	uint8 ASum[BLOCK]={0}, tmp[BLOCK], mask[BLOCK];

	last = h_len % BLOCK;
	if(last == 0) last = BLOCK;
	m = (h_len-last) / BLOCK; //header = m blocks + last bytes

	memcpy(mask,Q,BLOCK);
	/* XE */
	for(i = 0; i < m; i++, j=j+BLOCK){
		xor(mask,header+j,tmp);
		Encryption(KeyLen,tmp,tmp);
		xor(ASum,tmp,ASum);
		mul2(mask,mask);
	}
	/* last block */
	ozp(last,header+j,tmp);
	xor(ASum,tmp,ASum);

	if(last != BLOCK ){
		xor(mask, gamma, mask);
	}
	else{
		xor(mask,gamma2,mask);
	}
	xor(ASum,mask,ASum);
	Encryption(KeyLen,ASum,TA);
    return SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %ebp
movq %rdi, %rbx
vxorps %xmm0, %xmm0, %xmm0
leaq 0x30(%rsp), %r14
vmovaps %xmm0, (%r14)
movl %esi, %eax
andl $0xf, %eax
pushq $0x10
popq %r13
movl %eax, 0xc(%rsp)
cmovnel %eax, %r13d
subl %r13d, %ebp
shrl $0x4, %ebp
movq 0x365a(%rip), %rax      # 0x4fb8
vmovaps (%rax), %xmm0
leaq 0x20(%rsp), %r15
vmovaps %xmm0, (%r15)
leaq 0x10(%rsp), %r12
subl $0x1, %ebp
jb 0x19b3
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x1324
movl $0x100, %edi            # imm = 0x100
movq %r12, %rsi
movq %r12, %rdx
callq 0x1100
movq %r14, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x1324
movq %r15, %rdi
movq %r15, %rsi
callq 0x125f
addq $0x10, %rbx
jmp 0x1971
movl %r13d, %r14d
pushq $0x10
popq %rax
subq %r14, %rax
xorl %edx, %edx
movl 0xc(%rsp), %ebp
testl %ebp, %ebp
cmovneq %rax, %rdx
leaq (%rsp,%r14), %rdi
addq $0x10, %rdi
xorl %esi, %esi
callq 0x1030
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1110
testl %ebp, %ebp
je 0x19fa
movb $-0x80, 0x10(%rsp,%r14)
movq 0x3590(%rip), %rbx      # 0x4f88
jmp 0x1a01
movq 0x35ef(%rip), %rbx      # 0x4ff0
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r14, %rdx
callq 0x1324
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x1324
movq %r14, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1324
movq 0x35aa(%rip), %rdx      # 0x4fe8
movl $0x100, %edi            # imm = 0x100
movq %r14, %rsi
callq 0x1100
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/aes256otrsv2/ref/OTR.c
// Function: AFuncS
int AFuncS(
		  const uint8 *header,
		  uint32 h_len)
{
	uint32 i,j = 0;
	uint32 m, last;
	uint8 tmp[BLOCK], chain[BLOCK]={0};

	last = h_len % BLOCK;
	if(last == 0) last = BLOCK;
	m = (h_len-last) / BLOCK; //header = m blocks + last bytes

	/* CBC */
	for(i = 0; i < m; i++, j=j+BLOCK){
		xor(chain,header+j,chain);
		Encryption(KeyLen,chain,chain);
	}
	/* last block */
	ozp(last,header+j,tmp);
	xor(tmp,chain,chain);
	if(last != BLOCK ){
		xor(chain,gamma2,chain);
	}
	else{
		xor(chain,Q,chain);
	}
	Encryption(KeyLen,chain,TA);
    return SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
vxorps %xmm0, %xmm0, %xmm0
leaq 0x10(%rsp), %r14
vmovaps %xmm0, (%r14)
movl %esi, %ebp
movq %rdi, %rbx
movl %esi, %r15d
andl $0xf, %r15d
pushq $0x10
popq %r12
cmovnel %r15d, %r12d
subl %r12d, %ebp
shrl $0x4, %ebp
subl $0x1, %ebp
jb 0x1ab9
movq %r14, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1324
movl $0x100, %edi            # imm = 0x100
movq %r14, %rsi
movq %r14, %rdx
callq 0x1100
addq $0x10, %rbx
jmp 0x1a90
movl %r12d, %r14d
pushq $0x10
popq %rax
subq %r14, %rax
xorl %edx, %edx
testl %r15d, %r15d
cmovneq %rax, %rdx
leaq (%rsp,%r14), %rdi
xorl %esi, %esi
callq 0x1030
movq %rsp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1110
testl %r15d, %r15d
je 0x1af7
movb $-0x80, (%rsp,%r14)
movq 0x34fb(%rip), %rbx      # 0x4ff0
jmp 0x1afe
movq 0x34ba(%rip), %rbx      # 0x4fb8
movq %rsp, %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
movq %r14, %rdx
callq 0x1324
movq %r14, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1324
movq 0x34c2(%rip), %rdx      # 0x4fe8
movl $0x100, %edi            # imm = 0x100
movq %r14, %rsi
callq 0x1100
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/soso7885[P]OPCUA_example/demo_src/server_firstSteps.c
// Function: main
int main(void) {
    signal(SIGINT,  stopHandler);
    signal(SIGTERM, stopHandler);

    UA_ServerConfig config = UA_ServerConfig_standard;
    UA_ServerNetworkLayer nl = UA_ServerNetworkLayerTCP(UA_ConnectionConfig_standard, 16664);
    config.networkLayers = &nl;
    config.networkLayersSize = 1;
    UA_Server *server = UA_Server_new(config);

    UA_StatusCode retval = UA_Server_run(server, &running);
    UA_Server_delete(server);
    nl.deleteMembers(&nl);
    return (int)retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x318, %rsp            # imm = 0x318
leaq 0xbd(%rip), %rbx        # 0x1260
pushq $0x2
popq %rdi
movq %rbx, %rsi
callq 0x1060
pushq $0xf
popq %rdi
movq %rbx, %rsi
callq 0x1060
movq 0x2e20(%rip), %rsi      # 0x3fe0
leaq -0x1c8(%rbp), %rbx
movl $0x160, %edx            # imm = 0x160
movq %rbx, %rdi
callq 0x1050
movq 0x2e15(%rip), %rax      # 0x3ff0
movl 0x10(%rax), %ecx
movl %ecx, -0x20(%rbp)
movups (%rax), %xmm0
movaps %xmm0, -0x30(%rbp)
movl -0x20(%rbp), %eax
movl %eax, 0x10(%rsp)
movaps -0x30(%rbp), %xmm0
movups %xmm0, (%rsp)
leaq -0x68(%rbp), %r14
movq %r14, %rdi
movl $0x4118, %esi           # imm = 0x4118
callq 0x1040
movq %r14, 0xf8(%rbx)
movq $0x1, 0xf0(%rbx)
pushq $0x2c
popq %rcx
movq %rsp, %rdi
movq %rbx, %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x1030
movq %rax, %rbx
leaq 0x2e23(%rip), %rsi      # 0x4058
movq %rax, %rdi
callq 0x1070
movl %eax, %r15d
movq %rbx, %rdi
callq 0x1080
movq %r14, %rdi
callq *0x30(%r14)
movl %r15d, %eax
addq $0x318, %rsp            # imm = 0x318
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/diaxen[P]fft-garden/./cp_bf.h
// Function: cp_dit_bf_pi4
static inline void
cp_dit_bf_pi4(unsigned s,
           complex double * restrict out)
{
  complex double a = out[0];
  complex double b = out[s];
  complex double c = out[s * 2];
  complex double d = out[s * 3];

  double rc   = M_SQRT1_2 * creal(c);
  double rd   = M_SQRT1_2 * creal(d);
  double ic   = M_SQRT1_2 * cimag(c);
  double id   = M_SQRT1_2 * cimag(d);
  double wcr  = ic + rc;
  double wci  = ic - rc;
  double cwdr = rd - id;
  double cwdi = rd + id;
  double rsu  = wcr + cwdr;
  double rsb  = wcr - cwdr;
  double isu  = wci + cwdi;
  double isb  = wci - cwdi;

  out[0]     = CMPLX(creal(a) + rsu, cimag(a) + isu);
  out[s]     = CMPLX(creal(b) + isb, cimag(b) - rsb);
  out[s * 2] = CMPLX(creal(a) - rsu, cimag(a) - isu);
  out[s * 3] = CMPLX(creal(b) - isb, cimag(b) + rsb);
}

// Assembly:
movl %edi, %eax
shlq $0x4, %rax
leal (%rdi,%rdi), %ecx
shlq $0x4, %rcx
leal (%rdi,%rdi,2), %edx
shlq $0x4, %rdx
movupd (%rsi), %xmm0
movsd (%rsi,%rcx), %xmm1
movhpd (%rsi,%rdx), %xmm1      # xmm1 = xmm1[0],mem[0]
movsd 0x8(%rsi,%rcx), %xmm2
movapd 0x1656(%rip), %xmm3     # 0x3220
movhpd 0x8(%rsi,%rdx), %xmm2   # xmm2 = xmm2[0],mem[0]
mulpd %xmm3, %xmm1
mulpd %xmm3, %xmm2
movapd %xmm1, %xmm3
shufpd $0x1, %xmm2, %xmm3      # xmm3 = xmm3[1],xmm2[0]
movapd %xmm2, %xmm4
shufpd $0x1, %xmm1, %xmm4      # xmm4 = xmm4[1],xmm1[0]
subpd %xmm4, %xmm3
addpd %xmm1, %xmm2
movapd %xmm2, %xmm1
addpd %xmm3, %xmm1
movupd (%rsi,%rax), %xmm4
movapd %xmm3, %xmm5
shufpd $0x1, %xmm2, %xmm5      # xmm5 = xmm5[1],xmm2[0]
shufpd $0x1, %xmm3, %xmm2      # xmm2 = xmm2[1],xmm3[0]
subpd %xmm2, %xmm5
movapd %xmm0, %xmm2
addpd %xmm1, %xmm2
movupd %xmm2, (%rsi)
movapd %xmm4, %xmm2
addpd %xmm5, %xmm2
subpd %xmm5, %xmm4
movapd %xmm4, %xmm3
movsd %xmm2, %xmm3            # xmm3 = xmm2[0],xmm3[1]
movupd %xmm3, (%rsi,%rax)
subpd %xmm1, %xmm0
movupd %xmm0, (%rsi,%rcx)
shufpd $0x2, %xmm2, %xmm4      # xmm4 = xmm4[0],xmm2[1]
movupd %xmm4, (%rsi,%rdx)
retq
// File: /workspace/github_c_makefile_star2_O2/motet-a[P]libforks/tests/closed_exit_pipe.c
// Function: main
int main() {
  libforks_ServerConn conn;

  check(libforks_start(&conn) == libforks_OK);

  int exit_fd;
  pid_t child_pid;
  int socket_fd;

  libforks_Result r = libforks_fork(
    conn,
    &child_pid, // pid_ptr
    &socket_fd, // socket_fd_ptr
    &exit_fd, // exit_fd_ptr
    child_main
  );
  check(r == libforks_OK);

  close(exit_fd);
  write(socket_fd, "o", 1);
  check(write(socket_fd, "o", 1) == 1);

  // child exits now, but since exit_fd is closed we have to do this
  // dirty hack
  check(libforks_eval(conn, serv_wait) == libforks_OK);

  check(libforks_stop(conn) == libforks_OK);

  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
leaq 0x8(%rsp), %rdi
callq 0x17a2
testl %eax, %eax
jne 0x139e
movq 0x8(%rsp), %rdi
leaq 0xe3(%rip), %r8         # 0x1404
leaq 0x14(%rsp), %rsi
leaq 0x4(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x209e
testl %eax, %eax
jne 0x13a9
movl 0x10(%rsp), %edi
callq 0x10c0
movl 0x4(%rsp), %edi
leaq 0x1d06(%rip), %rbx      # 0x3053
pushq $0x1
popq %r14
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1080
movl 0x4(%rsp), %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1080
cmpq $0x1, %rax
jne 0x13b4
movq 0x8(%rsp), %rdi
leaq 0xc0(%rip), %rsi        # 0x143d
callq 0x22f6
testl %eax, %eax
jne 0x13bf
movq 0x8(%rsp), %rdi
callq 0x2242
testl %eax, %eax
jne 0x13ca
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
leaq 0x1c5f(%rip), %rdi      # 0x3004
pushq $0x12
jmp 0x13d3
leaq 0x1c92(%rip), %rdi      # 0x3042
pushq $0x1f
jmp 0x13d3
leaq 0x1c9a(%rip), %rdi      # 0x3055
pushq $0x23
jmp 0x13d3
leaq 0x1cad(%rip), %rdi      # 0x3073
pushq $0x27
jmp 0x13d3
leaq 0x1cd0(%rip), %rdi      # 0x30a1
pushq $0x29
popq %rsi
callq 0x13d9
// File: /workspace/github_c_makefile_star2_O2/motet-a[P]libforks/tests/closed_exit_pipe.c
// Function: child_main
static void child_main(libforks_ServerConn conn, int socket_fd) {
  (void)conn;
  char c;
  check(read(socket_fd, &c, 1) == 1);
  check(c == 'o');
}

// Assembly:
pushq %rax
movl %esi, %edi
leaq 0x7(%rsp), %rsi
pushq $0x1
popq %rdx
callq 0x10f0
cmpq $0x1, %rax
jne 0x1423
cmpb $0x6f, 0x7(%rsp)
jne 0x142e
popq %rax
retq
leaq 0x1cb6(%rip), %rdi      # 0x30e0
pushq $0x6
jmp 0x1437
leaq 0x1cc7(%rip), %rdi      # 0x30fc
pushq $0x7
popq %rsi
callq 0x13d9
// File: /workspace/github_c_makefile_star2_O2/motet-a[P]libforks/libforks.c
// Function: read_exact
__attribute__((warn_unused_result))
static int read_exact(int fd, void *data, size_t length) {
  ssize_t res = read(fd, data, length);
  if (res == -1) {
    return -1;
  }
  if (res != (ssize_t)length) {
    errno = EMSGSIZE;
    return -1;
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdx, %rbx
callq 0x10f0
pushq $-0x1
popq %rbp
cmpq $-0x1, %rax
je 0x160a
movq %rax, %rcx
xorl %eax, %eax
cmpq %rbx, %rcx
je 0x160c
callq 0x1050
movl $0x5a, (%rax)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/motet-a[P]libforks/libforks.c
// Function: libforks_write_socket_fds
int libforks_write_socket_fds(
    int socket_fd,
    void *data, size_t length,
    const int *fds, size_t fd_count) {
  // See https://man.openbsd.org/CMSG_DATA and https://man.openbsd.org/recv

  if (fd_count == 0) {
    // Same macOS issue, same workaround:
    return write_exact(socket_fd, data, length);
  }

  struct iovec iovec = {
    .iov_base = data,
    .iov_len = length,
  };

  char cmsg_buffer[CMSG_BUFFER_SIZE] = {0};
  size_t cmsg_buffer_space = CMSG_SPACE(sizeof(int) * fd_count);

  if (cmsg_buffer_space > sizeof cmsg_buffer) {
    errno = ENOMEM;
    return -1;
  }

  struct msghdr msg = {0};
  msg.msg_iov = &iovec;
  msg.msg_iovlen = 1;
  msg.msg_control = cmsg_buffer;
  msg.msg_controllen = cmsg_buffer_space;

  struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg);
  assert(cmsg);
  cmsg->cmsg_len = CMSG_LEN(sizeof(int) * fd_count);
  cmsg->cmsg_level = SOL_SOCKET;
  cmsg->cmsg_type = SCM_RIGHTS;
  memcpy(CMSG_DATA(cmsg), fds, sizeof(int) * fd_count);

  ssize_t send_res = sendmsg(socket_fd, &msg, 0);
  if (send_res == -1) {
    return -1;
  }
  if (send_res != (ssize_t)length) {
    errno = EMSGSIZE;
    return -1;
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0xd0, %rsp
movq %rdx, %rbx
movl %edi, %ebp
testq %r8, %r8
je 0x169b
movq %rsi, (%rsp)
movq %rbx, 0x8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
leaq 0x7(,%r8,4), %rax
movq %rax, %rdx
andq $-0x8, %rdx
addq $0x10, %rdx
cmpq $0x81, %rdx
jb 0x16b0
callq 0x1050
movl $0xc, (%rax)
pushq $-0x1
popq %r14
jmp 0x1742
movl %ebp, %edi
movq %rbx, %rdx
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x1770
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x30(%rsp)
andq $0x0, 0x40(%rsp)
movaps %xmm0, 0x10(%rsp)
movq %rsp, %rsi
movq %rsi, 0x20(%rsp)
movq $0x1, 0x28(%rsp)
leaq 0x50(%rsp), %rsi
movq %rsi, 0x30(%rsp)
movq %rdx, 0x38(%rsp)
cmpq $-0x10, %rax
jae 0x1751
shlq $0x2, %r8
leaq 0x10(%r8), %rax
leaq 0x60(%rsp), %rdi
movq %rax, -0x10(%rdi)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, -0x8(%rdi)
movq %rcx, %rsi
movq %r8, %rdx
callq 0x1130
leaq 0x10(%rsp), %rsi
xorl %r14d, %r14d
movl %ebp, %edi
xorl %edx, %edx
callq 0x1060
pushq $-0x1
popq %rbp
cmpq $-0x1, %rax
je 0x173f
cmpq %rbx, %rax
je 0x1742
callq 0x1050
movl $0x5a, (%rax)
movl %ebp, %r14d
movl %r14d, %eax
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x1a83(%rip), %rdi      # 0x31db
leaq 0x1a30(%rip), %rsi      # 0x318f
leaq 0x1a7a(%rip), %rcx      # 0x31e0
movl $0x12c, %edx            # imm = 0x12C
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O2/motet-a[P]libforks/libforks.c
// Function: write_exact
__attribute__((warn_unused_result))
static int write_exact(int fd, const void *data, size_t length) {
  ssize_t res = write(fd, data, length);
  if (res == -1) {
    return -1;
  }
  if (res != (ssize_t)length) {
    errno = EMSGSIZE;
    return -1;
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdx, %rbx
callq 0x1080
pushq $-0x1
popq %rbp
cmpq $-0x1, %rax
je 0x1799
movq %rax, %rcx
xorl %eax, %eax
cmpq %rbx, %rcx
je 0x179b
callq 0x1050
movl $0x5a, (%rax)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/motet-a[P]libforks/libforks.c
// Function: libforks_start
libforks_Result libforks_start(libforks_ServerConn *conn_ptr) {
  libforks_Result res;
  pid_t main_proc_pid = getpid();

  int sockets[2];
  if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockets) == -1) {
    res = libforks_SOCKET_CREATION_ERROR;
    goto exit;
  }

  int server_pid = fork();
  if (server_pid == -1) {
    res = libforks_FORK_ERROR;
    goto del_sockets;
  }

  if (server_pid == 0) {
    // this is the server process
    close(sockets[1]);

    serv_Client *client = malloc(sizeof(serv_Client));
    if (!client) {
      serv_print_errno("malloc");
      serv_panic();
    }
    client->pid = main_proc_pid;
    client->main = true;
    client->socket = sockets[0];
    client->exit_fd = -1;
    client->next = NULL;

    serv_main(client);
    abort(); // not reached
  }

  ServerConn *conn = malloc(sizeof(ServerConn));
  if (!conn) {
    res = libforks_MALLOC_ERROR;
    goto kill_server;
  }

  close(sockets[0]);
  conn->server_pid = server_pid;
  conn->socket = sockets[1];

  conn_ptr->private = conn;
  res = libforks_OK;
  goto exit;

kill_server:
  kill(server_pid, SIGKILL);

del_sockets:
  close(sockets[0]);
  close(sockets[1]);

exit:
  return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x1090
movl %eax, %ebp
pushq $0x1
popq %rdi
movq %rsp, %rcx
movl %edi, %esi
xorl %edx, %edx
callq 0x1140
cmpl $-0x1, %eax
je 0x1802
callq 0x11f0
cmpl $-0x1, %eax
je 0x1807
movl %eax, %r14d
testl %eax, %eax
je 0x1837
pushq $0x8
popq %rdi
callq 0x1160
testq %rax, %rax
je 0x180b
movq %rax, %r15
movl (%rsp), %edi
callq 0x187b
movl %r14d, (%r15)
movl 0x4(%rsp), %eax
movl %eax, 0x4(%r15)
movq %r15, (%rbx)
xorl %ebx, %ebx
jmp 0x182a
pushq $-0x3
popq %rbx
jmp 0x182a
pushq $-0x5
jmp 0x1818
pushq $0x9
popq %rsi
movl %r14d, %edi
callq 0x1150
pushq $-0x4
popq %rbx
movl (%rsp), %edi
callq 0x187b
movl 0x4(%rsp), %edi
callq 0x187b
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl 0x4(%rsp), %edi
callq 0x187b
pushq $0x18
popq %rdi
callq 0x1160
testq %rax, %rax
jne 0x185e
leaq 0x19d4(%rip), %rdi      # 0x3228
callq 0x1898
callq 0x2389
movl %ebp, (%rax)
movb $0x1, 0x4(%rax)
movl (%rsp), %ecx
movl %ecx, 0x8(%rax)
orl $-0x1, 0xc(%rax)
andq $0x0, 0x10(%rax)
movq %rax, %rdi
callq 0x190b
// File: /workspace/github_c_makefile_star2_O2/motet-a[P]libforks/libforks.c
// Function: checked_close
static int checked_close(int fd) {
  if (close(fd) != 0) {
    perror("libforks: close");
    abort();
  }
  return 0;
}

// Assembly:
pushq %rax
callq 0x10c0
testl %eax, %eax
jne 0x1887
popq %rax
retq
leaq 0x1ba3(%rip), %rdi      # 0x3431
callq 0x11b0
callq 0x1040
// File: /workspace/github_c_makefile_star2_O2/motet-a[P]libforks/libforks.c
// Function: serv_print_errno
static void serv_print_errno(const char *msg) {
  int e = errno;
  char buffer[256];
  assert(msg);
  snprintf(buffer, sizeof buffer, "libforks server: %s", msg);
  errno = e;
  perror(buffer);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, %rbx
callq 0x1050
testq %rbx, %rbx
je 0x18ec
movq %rax, %r14
movl (%rax), %ebp
leaq 0x1ba7(%rip), %rdx      # 0x3465
movq %rsp, %r15
movl $0x100, %esi            # imm = 0x100
movq %r15, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x10a0
movl %ebp, (%r14)
movq %r15, %rdi
callq 0x11b0
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18e9(%rip), %rdi      # 0x31dc
leaq 0x1895(%rip), %rsi      # 0x318f
leaq 0x1b40(%rip), %rcx      # 0x3441
movl $0x14e, %edx            # imm = 0x14E
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O2/motet-a[P]libforks/libforks.c
// Function: libforks_fork
libforks_Result libforks_fork(
    libforks_ServerConn conn_p,
    pid_t *pid_ptr, // out
    int *socket_fd_ptr, // out
    int *exit_fd_ptr, // out
    void (*entrypoint)(libforks_ServerConn conn, int socket_fd)
  ) {

  ServerConn *conn = conn_p.private;

  ClientMessage req = {
    .type = ClientMessageType_FORK_REQUEST,
    .u = {
      .fork_request = {
        .create_user_socket = socket_fd_ptr != NULL,
        .create_exit_pipe = exit_fd_ptr != NULL,
        .entrypoint = entrypoint,
      },
    },
  };

  if (write_exact(conn->socket, &req, sizeof req) == -1) {
    return libforks_WRITE_ERROR;
  }

  ServerMessage res;
  int received_fds[2] = {-1, -1};
  int read_res = libforks_read_socket_fds(
    conn->socket,
    &res, sizeof res,
    received_fds, 2
  );
  if (read_res == -1) {
    return libforks_READ_ERROR;
  }

  if (res.type == ServerMessageType_FORK_FAILURE) {
    assert(res.u.fork_failure.error_code != libforks_OK);
    errno = res.u.fork_failure.saved_errno;
    return res.u.fork_failure.error_code;
  }

  assert(res.type == ServerMessageType_FORK_SUCCESS);

  if (pid_ptr) {
    *pid_ptr = res.u.fork_success.pid;
  }

  unsigned i = 0;
  if (socket_fd_ptr) {
    *socket_fd_ptr = received_fds[i++];
  }
  if (exit_fd_ptr) {
    *exit_fd_ptr = received_fds[i++];
  }

  return libforks_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r13
testq %rdx, %rdx
leaq 0x18(%rsp), %rsi
setne (%rsi)
testq %rcx, %rcx
setne 0x1(%rsi)
movq %r8, 0x8(%rsi)
andl $0x0, 0x10(%rsi)
movl 0x4(%rdi), %edi
pushq $0x18
popq %rdx
callq 0x1770
cmpl $-0x1, %eax
je 0x212d
leaq 0x10(%rsp), %r12
orq $-0x1, (%r12)
movl 0x4(%r13), %edi
leaq 0x4(%rsp), %rsi
pushq $0xc
popq %rdx
pushq $0x2
popq %r8
movq %r12, %rcx
callq 0x144c
cmpl $-0x1, %eax
je 0x2131
movl 0xc(%rsp), %eax
testl %eax, %eax
je 0x2142
cmpl $0x1, %eax
jne 0x216f
cmpl $0x0, 0x4(%rsp)
je 0x218e
movl 0x8(%rsp), %ebx
callq 0x1050
movl %ebx, (%rax)
movl 0x4(%rsp), %eax
jmp 0x2134
pushq $-0x2
jmp 0x2133
pushq $-0x1
popq %rax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
testq %r15, %r15
je 0x214e
movl 0x4(%rsp), %eax
movl %eax, (%r15)
testq %r14, %r14
je 0x2160
leaq 0x14(%rsp), %r12
movl -0x4(%r12), %eax
movl %eax, (%r14)
xorl %eax, %eax
testq %rbx, %rbx
je 0x2134
movl (%r12), %ecx
movl %ecx, (%rbx)
jmp 0x2134
leaq 0x1154(%rip), %rdi      # 0x32ca
leaq 0x1012(%rip), %rsi      # 0x318f
leaq 0x10d8(%rip), %rcx      # 0x325c
movl $0x43f, %edx            # imm = 0x43F
callq 0x10b0
leaq 0x109a(%rip), %rdi      # 0x322f
leaq 0xff3(%rip), %rsi       # 0x318f
leaq 0x10b9(%rip), %rcx      # 0x325c
movl $0x43a, %edx            # imm = 0x43A
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O2/motet-a[P]libforks/libforks.c
// Function: finalize_stop
static libforks_Result finalize_stop(ServerConn *conn) {
  int status;
  if (waitpid(conn->server_pid, &status, 0) == -1) {
    return libforks_WAIT_ERROR;
  }

  assert(WIFEXITED(status) || WIFSIGNALED(status));

  close(conn->socket); // ignore error
  free(conn);
  return libforks_OK;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl (%rdi), %edi
leaq 0xc(%rsp), %rsi
xorl %edx, %edx
callq 0x1190
cmpl $-0x1, %eax
je 0x221a
movl 0xc(%rsp), %eax
andl $0x7f, %eax
je 0x2206
shll $0x18, %eax
addl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x1ffffff, %eax        # imm = 0x1FFFFFF
jle 0x2223
movl 0x4(%rbx), %edi
callq 0x187b
movq %rbx, %rdi
callq 0x1030
xorl %eax, %eax
jmp 0x221d
pushq $-0x6
popq %rax
addq $0x10, %rsp
popq %rbx
retq
leaq 0x13ed(%rip), %rdi      # 0x3617
leaq 0xf5e(%rip), %rsi       # 0x318f
leaq 0x1537(%rip), %rcx      # 0x376f
movl $0x457, %edx            # imm = 0x457
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O2/motet-a[P]libforks/libforks.c
// Function: libforks_free_conn
libforks_Result libforks_free_conn(libforks_ServerConn conn_p) {
  ServerConn *conn = conn_p.private;
  close(conn->socket); // ignore error
  free(conn);
  return libforks_OK;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x4(%rdi), %edi
callq 0x187b
movq %rbx, %rdi
callq 0x1030
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/motet-a[P]libforks/libforks.c
// Function: libforks_kill_all
libforks_Result libforks_kill_all(libforks_ServerConn conn_p, int signal) {
  ServerConn *conn = conn_p.private;

  ClientMessage req = {
    .type = ClientMessageType_KILL_ALL_REQUEST,
    .u = {
      .kill_all_request = {
        .signal = signal
      },
    },
  };
  if (write_exact(conn->socket, &req, sizeof req) == -1) {
    return libforks_WRITE_ERROR;
  }

  ServerMessage res;
  if (read_exact(conn->socket, &res, sizeof res) == -1) {
    return libforks_READ_ERROR;
  }

  assert(res.type == ServerMessageType_KILL_SUCCESS);
  return libforks_OK;
}

// Assembly:
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
leaq 0x18(%rsp), %rax
movl %esi, (%rax)
movl $0x3, 0x10(%rax)
movl 0x4(%rdi), %edi
pushq $0x18
popq %rdx
movq %rax, %rsi
callq 0x1770
cmpl $-0x1, %eax
je 0x22e9
movl 0x4(%rbx), %edi
leaq 0xc(%rsp), %rsi
pushq $0xc
popq %rdx
callq 0x15e1
cmpl $-0x1, %eax
je 0x22ed
xorl %eax, %eax
cmpl $0x2, 0x14(%rsp)
je 0x22f0
leaq 0x1024(%rip), %rdi      # 0x32f5
leaq 0xeb7(%rip), %rsi       # 0x318f
leaq 0x1041(%rip), %rcx      # 0x3320
movl $0x494, %edx            # imm = 0x494
callq 0x10b0
pushq $-0x2
jmp 0x22ef
pushq $-0x1
popq %rax
addq $0x30, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/motet-a[P]libforks/libforks.c
// Function: libforks_eval
libforks_Result libforks_eval(libforks_ServerConn conn_p, void (*function)(void)) {
  ServerConn *conn = conn_p.private;

  ClientMessage req = {
    .type = ClientMessageType_EVAL_REQUEST,
    .u = {
      .eval_request = {
        .function = function
      },
    },
  };
  if (write_exact(conn->socket, &req, sizeof req) == -1) {
    return libforks_WRITE_ERROR;
  }

  ServerMessage res;
  if (read_exact(conn->socket, &res, sizeof res) == -1) {
    return libforks_READ_ERROR;
  }

  assert(res.type == ServerMessageType_EVAL_SUCCESS);
  return libforks_OK;
}

// Assembly:
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
leaq 0x18(%rsp), %rax
movq %rsi, (%rax)
movl $0x4, 0x10(%rax)
movl 0x4(%rdi), %edi
pushq $0x18
popq %rdx
movq %rax, %rsi
callq 0x1770
cmpl $-0x1, %eax
je 0x235d
movl 0x4(%rbx), %edi
leaq 0xc(%rsp), %rsi
pushq $0xc
popq %rdx
callq 0x15e1
cmpl $-0x1, %eax
je 0x2361
xorl %eax, %eax
cmpl $0x3, 0x14(%rsp)
je 0x2364
leaq 0x1017(%rip), %rdi      # 0x335c
leaq 0xe43(%rip), %rsi       # 0x318f
leaq 0x1034(%rip), %rcx      # 0x3387
movl $0x4ac, %edx            # imm = 0x4AC
callq 0x10b0
pushq $-0x2
jmp 0x2363
pushq $-0x1
popq %rax
addq $0x30, %rsp
popq %rbx
retq