LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/mvermeulen[P]wspy/topdown.c
// Function: start_counters
void start_counters(struct counter_group *counter_group_list){
  int i,j;
  int status;
  struct counter_group *cgroup;

  for (cgroup = counter_group_list;cgroup;cgroup=cgroup->next){
    debug("Starting %s counters\n",cgroup->label);  
    for (i=0;i<cgroup->ncounters;i++){
      if (cgroup->cinfo[i].fd != -1){
	status = ioctl(cgroup->cinfo[i].fd,PERF_EVENT_IOC_ENABLE,0);
	if (status != 0){
	  error("unable to start %s counter %s, errno=%d,%s\n",
		cgroup->label,cgroup->cinfo[i].label,errno,strerror(errno));
	} else {
	  debug("   started %s counter, name=%s\n",cgroup->label,cgroup->cinfo[i].label);
	}
      }
    }
  }
}

// Assembly:
testq %rdi, %rdi
je 0x53fb
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rbx), %rsi
leaq 0x77b0(%rip), %rdi      # 0xcafe
xorl %eax, %eax
callq 0x9600
cmpl $0x0, 0xc(%rbx)
jle 0x53e0
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x18(%rbx), %rax
movl 0x28(%rax,%r15), %edi
cmpl $-0x1, %edi
je 0x53d0
movl $0x2400, %esi           # imm = 0x2400
xorl %edx, %edx
xorl %eax, %eax
callq 0x3110
movq (%rbx), %r13
movq 0x18(%rbx), %rcx
movq (%rcx,%r15), %rbp
testl %eax, %eax
je 0x53bc
callq 0x3040
movl (%rax), %r14d
movl %r14d, %edi
callq 0x32f0
leaq 0x776d(%rip), %rdi      # 0xcb14
movq %r13, %rsi
movq %rbp, %rdx
movl %r14d, %ecx
movq %rax, %r8
xorl %eax, %eax
callq 0x9256
jmp 0x53d0
leaq 0x777d(%rip), %rdi      # 0xcb40
movq %r13, %rsi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x9600
incq %r12
movslq 0xc(%rbx), %rax
addq $0x58, %r15
cmpq %rax, %r12
jl 0x5365
movq 0x20(%rbx), %rbx
testq %rbx, %rbx
jne 0x5344
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mvermeulen[P]wspy/topdown.c
// Function: check_nmi_watchdog
int check_nmi_watchdog(void){
  int c;
  FILE *fp;
  if ((fp = fopen("/proc/sys/kernel/nmi_watchdog","r")) != NULL){
    c = getc(fp);
    if (c == '1'){
      warning("/proc/sys/kernel/nmi_watchdog is running, missing performance counters\n");
      nmi_running = 1;
    }
    fclose(fp);
  }
}

// Assembly:
pushq %rbx
leaq 0x76a8(%rip), %rdi      # 0xcc11
leaq 0x6dae(%rip), %rsi      # 0xc31e
callq 0x3250
testq %rax, %rax
je 0x55ab
movq %rax, %rbx
movq %rax, %rdi
callq 0x3310
cmpl $0x31, %eax
jne 0x55a2
leaq 0x769e(%rip), %rdi      # 0xcc2f
xorl %eax, %eax
callq 0x935d
movl $0x1, 0xcb7e(%rip)      # 0x12120
movq %rbx, %rdi
popq %rbx
jmp 0x30a0
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/mvermeulen[P]wspy/topdown.c
// Function: find_ci_label
struct counter_info *find_ci_label(struct counter_group *cgroup,char *label){
  int i;
  for (i=0;i<cgroup->ncounters;i++){
    if (!strcmp(cgroup->cinfo[i].label,label)){
      return &cgroup->cinfo[i];
    }
  }
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movslq 0xc(%rdi), %r15
testq %r15, %r15
jle 0x58aa
movq %rsi, %r14
movq 0x18(%rdi), %rbx
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x31a0
testl %eax, %eax
je 0x58ac
addq $0x58, %rbx
decq %r15
jne 0x5892
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/mvermeulen[P]wspy/topdown.c
// Function: print_software
void print_software(struct counter_group *cgroup,enum output_format oformat){
  int i;
  struct counter_info *task_info = find_ci_label(cgroup,"task-clock");
  double task_time = (double) task_info->value / 1000000000.0;
  struct counter_info *cinfo;
  if (oformat == PRINT_CSV_HEADER){
    return;
  }
  for (i=0;i<cgroup->ncounters;i++){
    fprintf(outfile,"%-20s %-14lu",cgroup->cinfo[i].label,cgroup->cinfo[i].value);
    if (!strcmp(cgroup->cinfo[i].label,"task-clock") ||
	!strcmp(cgroup->cinfo[i].label,"cpu-clock")){
      fprintf(outfile," # %4.3f seconds",
	     (double) cgroup->cinfo[i].value / 1000000000.0);
    } else {
      fprintf(outfile," # %4.3f/sec",cgroup->cinfo[i].value / task_time);
	     
    }
    fprintf(outfile,"\n");
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x40f8(%rip), %rsi      # 0xc942
callq 0x587d
cmpl $0x2, %ebp
je 0x897d
cmpl $0x0, 0xc(%rbx)
jle 0x897d
movsd 0x30(%rax), %xmm0
unpcklps 0x30d2(%rip), %xmm0     # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x30da(%rip), %xmm0     # 0xb950
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd 0x295e(%rip), %xmm1     # 0xb1e8
movapd %xmm1, (%rsp)
movl $0x30, %r12d
leaq 0x985c(%rip), %r13      # 0x120f8
xorl %r14d, %r14d
movq (%r13), %rdi
movq 0x18(%rbx), %rax
movq -0x30(%rax,%r12), %rdx
movq (%rax,%r12), %rcx
leaq 0x5165(%rip), %rsi      # 0xda1c
xorl %eax, %eax
callq 0x31c0
movq 0x18(%rbx), %r15
movq -0x30(%r15,%r12), %rbp
movq %rbp, %rdi
leaq 0x4071(%rip), %rsi      # 0xc942
callq 0x31a0
testl %eax, %eax
je 0x8920
movq %rbp, %rdi
leaq 0x4054(%rip), %rsi      # 0xc938
callq 0x31a0
testl %eax, %eax
je 0x8920
movq (%r13), %rdi
movsd (%r15,%r12), %xmm1
unpcklps 0x3042(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x304a(%rip), %xmm1     # 0xb950
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd (%rsp), %xmm0
leaq 0x511c(%rip), %rsi      # 0xda3a
jmp 0x8954
movq (%r13), %rdi
movsd (%r15,%r12), %xmm1
unpcklps 0x300f(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x3017(%rip), %xmm1     # 0xb950
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd 0x289b(%rip), %xmm0     # 0xb1e8
leaq 0x50d5(%rip), %rsi      # 0xda29
movb $0x1, %al
callq 0x31c0
movq (%r13), %rsi
movl $0xa, %edi
callq 0x3150
incq %r14
movslq 0xc(%rbx), %rax
addq $0x58, %r12
cmpq %rax, %r14
jl 0x889f
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mvermeulen[P]wspy/topdown.c
// Function: timer_callback
void timer_callback(int signum){
  int i;
  struct rusage rusage;
  double elapsed;

  clock_gettime(CLOCK_REALTIME,&finish_time);
  elapsed = finish_time.tv_sec + finish_time.tv_nsec / 1000000000.0 -
    start_time.tv_sec - start_time.tv_nsec / 1000000000.0;

  if (sflag) read_system();
  read_counters(cpu_info->systemwide_counters,0);

  if (csvflag){
    fprintf(outfile,"%4.1f,",elapsed);
  }

  if (sflag){
    print_system(csvflag?PRINT_CSV:PRINT_NORMAL);
  }
  
  print_metrics(cpu_info->systemwide_counters,csvflag?PRINT_CSV:PRINT_NORMAL);
  if (csvflag) fprintf(outfile,"\n");

  if (is_still_running){
    alarm(interval);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
leaq 0xa5ba(%rip), %rsi      # 0x13140
xorl %edi, %edi
callq 0x3070
cvtsi2sdq 0xa5aa(%rip), %xmm0 # 0x13140
movsd %xmm0, 0x8(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdq 0xa5a0(%rip), %xmm0 # 0x13148
movsd %xmm0, 0x18(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdq 0xa596(%rip), %xmm0 # 0x13150
movsd %xmm0, (%rsp)
xorps %xmm0, %xmm0
cvtsi2sdq 0xa58d(%rip), %xmm0 # 0x13158
movsd %xmm0, 0x10(%rsp)
leaq 0x94f8(%rip), %r15      # 0x120d0
cmpl $0x0, (%r15)
je 0x8be3
callq 0x992d
leaq 0xa576(%rip), %r14      # 0x13160
movq (%r14), %rax
movq 0x20(%rax), %rdi
xorl %esi, %esi
callq 0x53fc
leaq 0x94d9(%rip), %rbx      # 0x120d8
cmpl $0x0, (%rbx)
je 0x8c47
movsd 0x25dc(%rip), %xmm1     # 0xb1e8
movsd 0x18(%rsp), %xmm0
divsd %xmm1, %xmm0
addsd 0x8(%rsp), %xmm0
subsd (%rsp), %xmm0
movsd 0x10(%rsp), %xmm2
divsd %xmm1, %xmm2
subsd %xmm2, %xmm0
leaq 0x94c2(%rip), %rax      # 0x120f8
movq (%rax), %rdi
leaq 0x44ef(%rip), %rsi      # 0xd12f
movb $0x1, %al
callq 0x31c0
cmpl $0x0, (%r15)
je 0x8c5b
xorl %edi, %edi
cmpl $0x0, (%rbx)
setne %dil
callq 0x9cf7
movq (%r14), %rax
movq 0x20(%rax), %rdi
xorl %esi, %esi
cmpl $0x0, (%rbx)
setne %sil
callq 0x898c
cmpl $0x0, (%rbx)
je 0x8c89
leaq 0x947c(%rip), %rax      # 0x120f8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x3150
cmpl $0x0, 0x94a4(%rip)      # 0x12134
je 0x8ca9
leaq 0x9443(%rip), %rax      # 0x120dc
movl (%rax), %edi
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x3120
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O1/mvermeulen[P]wspy/system.c
// Function: setup_net_info
void setup_net_info(void){
  FILE *fp;
  char buffer[1024];
  char *p,*p2;
  int i;
  int count = 0;
  if (fp = fopen("/proc/net/dev","r")){
    // process once to count the number of lines with ':'
    while (fgets(buffer,sizeof(buffer),fp) != NULL){
      p = strchr(buffer,':');
      if (p == NULL) continue;
      count++;
    }

    rewind(fp);
    system_state.num_net = count;
    system_state.netinfo = calloc(count,sizeof(struct netinfo));

    // process again to count create device entries
    count = 0;
    while (fgets(buffer,sizeof(buffer),fp) != NULL){
      p = strchr(buffer,':');
      if (p == NULL) continue;      
      *p = 0;
      p2 = buffer;
      while (isspace(*p2)) p2++;
      system_state.netinfo[count].name = strdup(p2);
      count++;
    }
    fclose(fp);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
leaq 0x433e(%rip), %rdi      # 0xdb6c
leaq 0x2ae9(%rip), %rsi      # 0xc31e
callq 0x3250
testq %rax, %rax
je 0x991d
movq %rax, %rbx
movq %rsp, %rdi
movl $0x400, %esi            # imm = 0x400
movq %rax, %rdx
callq 0x3170
xorl %ebp, %ebp
testq %rax, %rax
je 0x9889
movq %rsp, %r14
movq %r14, %rdi
movl $0x3a, %esi
callq 0x30d0
cmpq $0x1, %rax
sbbl $-0x1, %ebp
movq %r14, %rdi
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdx
callq 0x3170
testq %rax, %rax
jne 0x9860
movq %rbx, %rdi
callq 0x30e0
movl %ebp, 0x9979(%rip)      # 0x13210
movl %ebp, %edi
movl $0x20, %esi
callq 0x3190
movq %rax, 0x996e(%rip)      # 0x13218
leaq -0x1(%rsp), %r15
xorl %r12d, %r12d
movq %rsp, %r14
movq %r14, %rdi
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdx
callq 0x3170
testq %rax, %rax
je 0x9915
movq %r14, %rdi
movl $0x3a, %esi
callq 0x30d0
testq %rax, %rax
je 0x98b5
movb $0x0, (%rax)
callq 0x3350
movq (%rax), %rax
movq %r15, %rdi
movsbq 0x1(%rdi), %rcx
incq %rdi
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x98ea
callq 0x32e0
movq 0x9913(%rip), %rcx      # 0x13218
movq %r12, %rdx
shlq $0x5, %rdx
movq %rax, (%rcx,%rdx)
incq %r12
jmp 0x98b5
movq %rbx, %rdi
callq 0x30a0
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/tsoding[P]x11-double-buffering/././db_pixmap.c
// Function: db_init
void db_init(DB *db, Display *display, Window window)
{
    db->display = display;
    db->window = window;
    db->gc = XCreateGC(display, window, 0, NULL);
    db->back_buffer = XCreatePixmap(display, window, WIDTH, HEIGHT, 24);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq %rsi, (%rdi)
movq %rdx, 0x8(%rdi)
movq %rsi, %rdi
movq %rdx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x10f0
movq %rax, 0x10(%r15)
movq %r14, %rdi
movq %rbx, %rsi
movl $0x320, %edx            # imm = 0x320
movl $0x258, %ecx            # imm = 0x258
movl $0x18, %r8d
callq 0x1170
movq %rax, 0x18(%r15)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/tsoding[P]x11-double-buffering/././db_pixmap.c
// Function: db_swap_buffers
void db_swap_buffers(DB *db)
{
    XCopyArea(db->display,
              db->back_buffer,
              db->window,
              db->gc,
              0, 0,
              WIDTH, HEIGHT,
              0, 0);
}

// Assembly:
pushq %rax
movq 0x18(%rdi), %rsi
movq (%rdi), %rax
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
xorl %r10d, %r10d
movq %rax, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %r10
pushq %r10
pushq $0x258                  # imm = 0x258
pushq $0x320                  # imm = 0x320
callq 0x10a0
addq $0x20, %rsp
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O1/ikbenlike[P]nngutils/src/printenv.c
// Function: main
int main(int argc, char **argv){
    char *var;
    int ret = 0;
    if(argc == 1){
        for(int i = 0; environ[i] != NULL; i++){
            puts(environ[i]);
        }
    }
    else if(!strcmp(argv[1], "-0") || !strcmp(argv[1], "--null")){
        for(int i = 2; i < argc; i++){
            var = getenv(argv[i]);
            if(var == NULL){
                ret = 1;
                continue;
            }
            else {
                fprintf(stdout, "%s", var);
                putchar('\0');
            }
        }
    }
    else {
        for(int i = 1; i < argc; i++){
            var = getenv(argv[i]);
            if(var == NULL){
                ret = 1;
                continue;
            }
            else {
                fprintf(stdout, "%s\n", var);
            }
        }
    }
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x1, %edi
jne 0x11d8
movq 0x2e42(%rip), %rbx      # 0x3fe8
movq (%rbx), %rax
movq (%rax), %rdi
xorl %r14d, %r14d
testq %rdi, %rdi
je 0x12ab
movl $0x8, %r15d
callq 0x1050
movq (%rbx), %rax
movq (%rax,%r15), %rdi
addq $0x8, %r15
testq %rdi, %rdi
jne 0x11be
jmp 0x12ab
movq %rsi, %rbx
movl %edi, %r14d
movq 0x8(%rsi), %r15
leaq 0xe1b(%rip), %rsi       # 0x2004
movq %r15, %rdi
callq 0x1070
testl %eax, %eax
je 0x125c
leaq 0xe0b(%rip), %rsi       # 0x2007
movq %r15, %rdi
callq 0x1070
testl %eax, %eax
je 0x125c
cmpl $0x2, %r14d
jl 0x12a8
movl %r14d, %r12d
movl $0x1, %r13d
leaq 0xdec(%rip), %r15       # 0x200e
xorl %r14d, %r14d
movq (%rbx,%r13,8), %rdi
callq 0x1030
testq %rax, %rax
je 0x124c
movq 0x2d9e(%rip), %rcx      # 0x3fd8
movq (%rcx), %rdi
movq %r15, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x1080
jmp 0x1252
movl $0x1, %r14d
incq %r13
cmpq %r13, %r12
jne 0x1225
jmp 0x12ab
cmpl $0x3, %r14d
jl 0x12a8
movl %r14d, %r15d
xorl %r14d, %r14d
movl $0x2, %r12d
movq 0x2d63(%rip), %r13      # 0x3fd8
movq (%rbx,%r12,8), %rdi
callq 0x1030
testq %rax, %rax
je 0x1298
movq (%r13), %rsi
movq %rax, %rdi
callq 0x1060
xorl %edi, %edi
callq 0x1040
jmp 0x129e
movl $0x1, %r14d
incq %r12
cmpq %r12, %r15
jne 0x1275
jmp 0x12ab
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/obstcp-tlsadvert.c
// Function: main
int
main(int argc, char **argv) {
  if (argc > 2) return usage(argv[0]);

  unsigned long portnum;
  if (argc == 2) {
    char *endptr;
    portnum = strtoul(argv[1], &endptr, 10);
    if (*endptr) {
      fprintf(stderr, "Not a valid number: %s\n", argv[1]);
      return usage(argv[0]);
    }

    if (portnum < 1 || portnum > 65535) {
      fprintf(stderr, "Not a valid port number (1..65535): %d\n", (int) portnum);
      return usage(argv[0]);
    }
  } else {
    portnum = 443;
  }

  char output[512];
  const int r = obstcp_advert_base32_create(output, sizeof(output), NULL,
                                            OBSTCP_ADVERT_TLSPORT, (int) portnum,
                                            OBSTCP_ADVERT_END);
  if (r >= sizeof(output)) {
    fprintf(stderr, "Advert too large\n");
    return 1;
  } else if (r < 0) {
    perror("Error creating advert");
    return 1;
  }

  output[r] = 0;
  fprintf(stderr, "Port: %d\n", (int) portnum);
  fprintf(stderr, "Advert: %s\n", output);

  char dnsadvert[512];
  if (obstcp_advert_cname_encode_sz(r) > sizeof(dnsadvert)) {
    fprintf(stderr, "Cannot print DNS advert");
  } else {
    obstcp_advert_cname_encode(dnsadvert, output, r);
    dnsadvert[obstcp_advert_cname_encode_sz(r)] = 0;
    fprintf(stderr, "DNS Advert: %s\n", dnsadvert);
  }

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movq %rsi, %r14
cmpl $0x3, %edi
jge 0x137f
cmpl $0x2, %edi
jne 0x1389
movq 0x8(%r14), %rdi
movq %rsp, %r15
movq %r15, %rsi
movl $0xa, %edx
callq 0x10d0
movq %rax, %rbx
movq (%r15), %rax
cmpb $0x0, (%rax)
jne 0x13cf
movq $-0x10000, %rax         # imm = 0xFFFF0000
movq %rbx, %rcx
addq %rax, %rcx
cmpq %rax, %rcx
jbe 0x13da
xorl %r14d, %r14d
movb $0x1, %al
testb %al, %al
jne 0x138e
movl %r14d, %eax
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
callq 0x1209
jmp 0x13b9
movl $0x1bb, %ebx            # imm = 0x1BB
xorl %r14d, %r14d
movq %rsp, %rdi
movl $0x200, %esi            # imm = 0x200
xorl %edx, %edx
movl $0x2, %ecx
movl %ebx, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x1630
cmpl $0x200, %eax            # imm = 0x200
jb 0x13c1
callq 0x11e7
movl $0x1, %r14d
jmp 0x136f
movq %rsp, %rsi
movl %eax, %edi
movl %ebx, %edx
callq 0x1139
jmp 0x136f
leaq 0x8(%r14), %rdi
callq 0x1100
jmp 0x13f4
movq 0x8c17(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x5c31(%rip), %rsi      # 0x701c
movl %ebx, %edx
xorl %eax, %eax
callq 0x10a0
movq %r14, %rdi
callq 0x111e
movl $0x1, %r14d
xorl %eax, %eax
jmp 0x136b
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/libobstcp.c
// Function: obstcp_advert_create
int EXPORTED
obstcp_advert_create(uint8_t *output, unsigned length,
                            const struct obstcp_keys *keys, ...) {
  va_list ap;
  va_start(ap, keys);

  const int r = advert_create(output, length, keys, ap);
  va_end(ap);

  return r;
}

// Assembly:
subq $0xd8, %rsp
leaq 0x20(%rsp), %r10
movq %rcx, 0x18(%r10)
movq %r8, 0x20(%r10)
movq %r9, 0x28(%r10)
testb %al, %al
je 0x145f
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)
movq %rsp, %rcx
movq %r10, 0x10(%rcx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000018, %rax     # imm = 0x3000000018
movq %rax, (%rcx)
callq 0x148c
addq $0xd8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/libobstcp.c
// Function: obstcp_advert_base32_create
int EXPORTED
obstcp_advert_base32_create(char *output, unsigned length,
                            const struct obstcp_keys *keys, ...) {
  uint8_t advert[384];
  va_list ap;
  va_start(ap, keys);

  const int ret = advert_create(advert, sizeof(advert), keys, ap);
  va_end(ap);

  if (ret > sizeof(advert)) {
    goto spc;
  } else if (ret == -1) {
    return -1;
  }

  const unsigned outlen = base32_encode_length(ret);
  if (outlen <= length) {
    base32_encode(output, advert, ret);
  }
  return outlen;

 spc:
  errno = E2BIG;
  return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x20(%rsp), %rsi
movq %rcx, 0x18(%rsi)
movq %r8, 0x20(%rsi)
movq %r9, 0x28(%rsi)
testb %al, %al
je 0x168e
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)
movq %rsp, %rcx
movq %rsi, 0x10(%rcx)
leaq 0x280(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000018, %rax     # imm = 0x3000000018
movq %rax, (%rcx)
leaq 0xd0(%rsp), %rdi
movl $0x180, %esi            # imm = 0x180
callq 0x148c
cmpl $0x180, %eax            # imm = 0x180
jbe 0x16da
callq 0x1050
movl $0x7, (%rax)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x16fe
movl %eax, %r15d
movl %eax, %edi
callq 0x5b82
movl %eax, %r14d
cmpl %ebp, %eax
ja 0x16fe
leaq 0xd0(%rsp), %rsi
movq %rbx, %rdi
movl %r15d, %edx
callq 0x5b97
movl %r14d, %eax
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/libobstcp.c
// Function: obstcp_advert_base32_parse
int EXPORTED
obstcp_advert_base32_parse(const char *input, unsigned length, ...) {
  va_list ap;
  va_start(ap, length);
  uint8_t advert[384];
  const unsigned decoded_length = base32_decode_length(length);

  if (decoded_length > sizeof(advert)) return 0;
  if (!base32_decode(advert, input, length)) return 0;

  const int r = advert_parse(advert, decoded_length, ap);
  va_end(ap);

  return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movl %esi, %ebx
movq %rdi, %r14
leaq 0x20(%rsp), %rsi
movq %rdx, 0x10(%rsi)
movq %rcx, 0x18(%rsi)
movq %r8, 0x20(%rsi)
movq %r9, 0x28(%rsi)
testb %al, %al
je 0x1a1b
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)
movq %rsi, 0x10(%rsp)
leaq 0x280(%rsp), %rax
movq %rax, 0x8(%rsp)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rsp)
movl %ebx, %edi
callq 0x5b04
xorl %ebp, %ebp
cmpl $0x180, %eax            # imm = 0x180
ja 0x1a79
movl %eax, %r15d
leaq 0xd0(%rsp), %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x5b0b
testl %eax, %eax
je 0x1a79
leaq 0xd0(%rsp), %rdi
movq %rsp, %rdx
movl %r15d, %esi
callq 0x1793
movl %eax, %ebp
movl %ebp, %eax
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/libobstcp.c
// Function: obstcp_advert_hostent_extract
int EXPORTED
obstcp_advert_hostent_extract(char *output, unsigned *outlen,
                              const struct hostent *hent) {
  unsigned i;

  for (i = 0; hent->h_aliases[i]; ++i) {
      if (!obstcp_advert_cname_extract(output, outlen, hent->h_aliases[i])) {
        if (errno != EEXIST)
          return 0;
      } else {
        return 1;
      }
  }

  if (hent->h_name) {
    return obstcp_advert_cname_extract(output, outlen, hent->h_name);
  } else {
    errno = EEXIST;
    return 0;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdx), %rax
movq (%rax), %rdx
testq %rdx, %rdx
je 0x1c62
movl $0x1, %ebp
movl $0x1, %r12d
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1a89
testl %eax, %eax
jne 0x1c8a
callq 0x1050
cmpl $0x11, (%rax)
jne 0x1c88
movq 0x8(%r15), %rax
movl %r12d, %ecx
movq (%rax,%rcx,8), %rdx
incl %r12d
testq %rdx, %rdx
jne 0x1c36
movq (%r15), %rdx
testq %rdx, %rdx
je 0x1c7d
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1a89
callq 0x1050
movl $0x11, (%rax)
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/libobstcp.c
// Function: obstcp_advert_cname_encode
void EXPORTED
obstcp_advert_cname_encode(char *output,
                           const char *advert, unsigned advertlen) {
  unsigned i = 0, j = 0;  // i indexes @advert, j indexes @output

  while (advertlen) {
    memcpy(output + j, kDNSMagic, kDNSMagicLen);
    j += kDNSMagicLen;
    unsigned todo = advertlen;
    if (todo > kDNSCharsPerLabel)
      todo = kDNSCharsPerLabel;
    memcpy(output + j, advert + i, todo);
    i += todo;
    j += todo;
    advertlen -= todo;
    output[j++] = '.';
  }
}

// Assembly:
testl %edx, %edx
je 0x1d23
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
xorl %r13d, %r13d
xorl %ebp, %ebp
movl %r13d, %eax
movb $0x78, 0x4(%r15,%rax)
movl $0x78306561, (%r15,%rax) # imm = 0x78306561
cmpl $0x3a, %ebx
movl $0x3a, %r12d
cmovbl %ebx, %r12d
leal 0x5(%r13), %edi
addq %r15, %rdi
movl %ebp, %esi
addq %r14, %rsi
movq %r12, %rdx
callq 0x10b0
addl %r12d, %ebp
leal (%r12,%r13), %eax
addl $0x5, %eax
addl %r12d, %r13d
addl $0x6, %r13d
movb $0x2e, (%r15,%rax)
subl %r12d, %ebx
jne 0x1cc8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/libobstcp.c
// Function: obstcp_keys_key_add
int EXPORTED
obstcp_keys_key_add(struct obstcp_keys *keys, const uint8_t *private_key) {
  struct obstcp_keypair *kp, *a;
  static const uint8_t basepoint[32] = {9};

  kp = (struct obstcp_keypair *) malloc(sizeof(struct obstcp_keypair));
  if (!kp) {
    errno = ENOMEM;
    return 0;
  }

  memcpy(kp->private_key, private_key, 32);
  kp->private_key[0] &= 248;
  kp->private_key[31] &= 127;
  kp->private_key[31] |= 64;

  curve25519(kp->public_key, kp->private_key, basepoint);

  kp->keyid = key_keyid(kp->public_key);

  for (a = keys->keys; a; a = a->next) {
    if (a->keyid == kp->keyid) {
      free(kp);
      errno = ENOSPC;
      return 0;
    }
  }


  kp->next = keys->keys;
  keys->keys = kp;

  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
movl $0x50, %edi
callq 0x10c0
testq %rax, %rax
je 0x1db9
movq %rax, %r14
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups %xmm0, (%rax)
andb $-0x8, (%rax)
movups %xmm1, 0x10(%rax)
movb 0x1f(%rax), %al
andb $0x3f, %al
orb $0x40, %al
movb %al, 0x1f(%r14)
movq %r14, %rdi
addq $0x20, %rdi
leaq 0x533b(%rip), %rdx      # 0x70b0
movq %r14, %rsi
callq 0x5c0c
xorl %eax, %eax
movl $0x8, %ecx
xorl (%r14,%rcx,4), %eax
incq %rcx
cmpq $0x10, %rcx
jne 0x1d84
movl %eax, 0x40(%r14)
movq (%rbx), %rcx
testq %rcx, %rcx
je 0x1da8
cmpl %eax, 0x40(%rcx)
je 0x1dc6
movq 0x48(%rcx), %rcx
jmp 0x1d98
movq (%rbx), %rax
movq %rax, 0x48(%r14)
movq %r14, (%rbx)
movl $0x1, %eax
jmp 0x1ddb
callq 0x1050
movl $0xc, (%rax)
jmp 0x1dd9
movq %r14, %rdi
callq 0x1030
callq 0x1050
movl $0x1c, (%rax)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/libobstcp.c
// Function: obstcp_keys_free
void EXPORTED
obstcp_keys_free(struct obstcp_keys *keys) {
  struct obstcp_keypair *kp, *next;

  for (kp = keys->keys; kp; kp = next) {
    next = kp->next;
    free(kp);
  }

  keys->keys = NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x1e01
movq 0x48(%rdi), %r14
callq 0x1030
movq %r14, %rdi
testq %r14, %r14
jne 0x1df0
movq $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/./cursor.h
// Function: cursor_read
static const uint8_t * MAYBEUNUSED
cursor_read(uint8_t *buffer, struct obstcp_cursor *c, size_t n) {
  struct iovec iov;

  if (!c->get(c, &iov, n))
    abort();

  if (iov.iov_len == n)
    return (const uint8_t *) iov.iov_base;

  size_t j = 0;
  while (n) {
    memcpy(buffer + j, iov.iov_base, iov.iov_len);
    n -= iov.iov_len;
    j += iov.iov_len;
    if (!c->get(c, &iov, n))
      abort();
  }

  return buffer;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq *(%r15)
testl %eax, %eax
je 0x24e8
cmpq %r14, 0x10(%rsp)
jne 0x24b0
movq 0x8(%rsp), %rbx
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
leaq 0x8(%rsp), %r12
testq %r14, %r14
je 0x249e
leaq (%rbx,%rbp), %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %r13
movq %r13, %rdx
callq 0x10b0
subq %r13, %r14
addq %r13, %rbp
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq *(%r15)
testl %eax, %eax
jne 0x24b7
callq 0x1040
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/libobstcp.c
// Function: obs_encrypt
static void
obs_encrypt(struct obstcp_half_connection *hc, uint8_t *out,
        const uint8_t *in, size_t len) {
  size_t l = len, j = 0, i;

  if (hc->used < 64) {
    const size_t m = min_t(size_t, 64u - hc->used, l);
    xor(out, in, hc->keystream + hc->used, m);
    l -= m;
    hc->used += m;
    j += m;
  }
  const unsigned chunks = l >> 6;
  if (chunks) {
    for (i = 0; i < chunks; ++i) {
      salsa208(hc->keystream, hc->block_ctr, hc->key, sigma);
      block_ctr_inc(hc->block_ctr);
      xor(out + j, in + j, hc->keystream, 64);
      l -= 64;
      j += 64;
    }
  }
  if (l) {
    salsa208(hc->keystream, hc->block_ctr, hc->key, sigma);
    block_ctr_inc(hc->block_ctr);
    xor(out + j, in + j, hc->keystream, l);
    hc->used = l;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
movl 0x40(%rdi), %edx
cmpq $0x3f, %rdx
ja 0x259c
movl $0x40, %r13d
subq %rdx, %r13
cmpq %rbx, %r13
cmovaeq %rbx, %r13
addq %r14, %rdx
movq %r12, %rdi
movq %r15, %rsi
movl %r13d, %ecx
callq 0x37bf
subq %r13, %rbx
addl %r13d, 0x40(%r14)
jmp 0x259f
xorl %r13d, %r13d
movq %rbx, %rcx
shrq $0x6, %rcx
testl %ecx, %ecx
je 0x265b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
andq %rax, %rcx
je 0x265b
movq %rbx, 0x10(%rsp)
leaq 0x64(%r14), %rbp
leaq 0x44(%r14), %rax
movq %rax, 0x18(%rsp)
movq %r12, (%rsp)
addq %r13, %r12
movq %r15, 0x8(%rsp)
addq %r13, %r15
xorl %ebx, %ebx
movq %rcx, 0x20(%rsp)
movq %r14, %rdi
movq %rbp, %rsi
movq 0x18(%rsp), %rdx
leaq 0x4aea(%rip), %rcx      # 0x70e0
callq 0x38f8
xorl %eax, %eax
incb (%rbp,%rax)
jne 0x2610
leaq 0x1(%rax), %rcx
cmpq $0xf, %rax
movq %rcx, %rax
jne 0x25fd
xorl %eax, %eax
movl (%r14,%rax,4), %ecx
xorl (%r15,%rax,4), %ecx
movl %ecx, (%r12,%rax,4)
incq %rax
cmpq $0x10, %rax
jne 0x2612
addq $0x40, %r13
incq %rbx
addq $0x40, %r12
addq $0x40, %r15
movq 0x20(%rsp), %rcx
cmpq %rcx, %rbx
jne 0x25e4
movabsq $-0x3fffffffc1, %rax    # imm = 0xFFFFFFC00000003F
movq 0x10(%rsp), %rbx
andq %rax, %rbx
movq 0x8(%rsp), %r15
movq (%rsp), %r12
testq %rbx, %rbx
je 0x26a9
leaq 0x64(%r14), %rsi
leaq 0x44(%r14), %rdx
leaq 0x4a71(%rip), %rcx      # 0x70e0
movq %r14, %rdi
callq 0x38f8
movl $0x64, %eax
incb (%r14,%rax)
jne 0x268f
leaq 0x1(%rax), %rcx
cmpq $0x73, %rax
movq %rcx, %rax
jne 0x267c
addq %r13, %r12
addq %r13, %r15
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movl %ebx, %ecx
callq 0x37bf
movl %ebx, 0x40(%r14)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/libobstcp.c
// Function: obstcp_server_encrypt
ssize_t EXPORTED
obstcp_server_encrypt(struct obstcp_server_ctx *ctx, uint8_t *output,
                      const uint8_t *buffer, size_t len) {
  obs_encrypt(&ctx->u.b.out, output, buffer, len);
  if (!ctx->frame_valid && ctx->state == SRV_ST_2ND_FRAME_PENDING) {
    ctx->state = SRV_ST_RUNNING;
  }

  ctx->frame_valid = 1;

  return len;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdi, %r14
addq $0x7c, %rdi
callq 0x254f
cmpb $0x0, 0x195(%r14)
jne 0x26f7
cmpl $0x2, 0x190(%r14)
jne 0x26f7
movl $0x3, 0x190(%r14)
movb $0x1, 0x195(%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/libobstcp.c
// Function: obstcp_server_prefix
int EXPORTED
obstcp_server_prefix(struct obstcp_server_ctx *ctx, struct iovec *prefix) {
  static const uint8_t banner[2] = {0, 0};

  if (!ctx->frame_valid) return -1;

  if (ctx->state == SRV_ST_FIRST_FRAME) {
    prefix->iov_base = (void *) banner;
    prefix->iov_len = 2;
    ctx->state = SRV_ST_2ND_FRAME_PENDING;
    return 1;
  } else {
    prefix->iov_len = 0;
    return 0;
  }
}

// Assembly:
cmpb $0x0, 0x195(%rdi)
je 0x273e
cmpl $0x1, 0x190(%rdi)
jne 0x2744
leaq 0x49ad(%rip), %rax      # 0x70d0
movq %rax, (%rsi)
movq $0x2, 0x8(%rsi)
movl $0x2, 0x190(%rdi)
movl $0x1, %eax
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
movq $0x0, 0x8(%rsi)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/libobstcp.c
// Function: obstcp_client_banner
void EXPORTED
obstcp_client_banner(struct obstcp_client_ctx *ctx,
                     struct iovec *out) {
  if (ctx->state != CLI_ST_WRITING) abort();
  out->iov_base = (void *) ctx->buffer;
  out->iov_len = ctx->n;
  ctx->n = 0;

  ctx->state = CLI_ST_READING;
}

// Assembly:
cmpl $0x0, 0x270(%rdi)
jne 0x2a8b
movq %rdi, (%rsi)
movl 0x184(%rdi), %eax
movq %rax, 0x8(%rsi)
movl $0x0, 0x184(%rdi)
movl $0x1, 0x270(%rdi)
retq
pushq %rax
callq 0x1040
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/libobstcp.c
// Function: obstcp_client_accum_init
void EXPORTED
obstcp_client_accum_init(struct obstcp_accum *ac, struct obstcp_client_ctx *ctx) {
  obstcp_accum_init(ac);
  ac->is_server = 0;
  ac->frame_size = obstcp_client_frame_payload_sz(ctx);
  ac->ctx = ctx;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0x1c0, %edx            # imm = 0x1C0
xorl %esi, %esi
callq 0x1080
movl $0x10, %eax
movb $0x1, %cl
movb %cl, (%r14,%rax)
addq $0x48, %rax
incb %cl
cmpq $0x178, %rax            # imm = 0x178
jne 0x2cc5
movb $-0x1, 0x178(%r14)
movl $0xffff00, 0x1ba(%r14) # imm = 0xFFFF00
movw $0xffff, 0x8(%r14)      # imm = 0xFFFF
movq %rbx, (%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/libobstcp.c
// Function: obstcp_server_accum_init
void EXPORTED
obstcp_server_accum_init(struct obstcp_accum *ac, struct obstcp_server_ctx *ctx) {
  obstcp_accum_init(ac);
  ac->is_server = 1;
  ac->frame_size = obstcp_server_frame_payload_sz(ctx);
  ac->ctx = ctx;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0x1c0, %edx            # imm = 0x1C0
xorl %esi, %esi
callq 0x1080
movl $0x10, %eax
movb $0x1, %cl
movb %cl, (%r14,%rax)
addq $0x48, %rax
incb %cl
cmpq $0x178, %rax            # imm = 0x178
jne 0x2d19
movb $-0x1, 0x178(%r14)
movl $0x1ffff00, 0x1ba(%r14) # imm = 0x1FFFF00
movw $0xffff, 0x8(%r14)      # imm = 0xFFFF
movq %rbx, (%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/./iovec_cursor.h
// Function: iovec_cursor_copy
static size_t MAYBEUNUSED
iovec_cursor_copy(struct iovec_cursor *dest, struct iovec_cursor *src,
                  size_t len) {
  while (len && dest->i < dest->count && src->i < src->count) {
    size_t bytes = src->iov[src->i].iov_len - src->j;
    if (bytes > len) bytes = len;

    dest->iov[dest->i].iov_base = src->iov[src->i].iov_base + src->j;
    dest->iov[dest->i].iov_len = bytes;

    len -= bytes;
    src->j += bytes;
    if (src->j == src->iov[src->i].iov_len) {
      src->j = 0;
      src->i++;
    }
    dest->i++;
  }

  return len;
}

// Assembly:
testq %rdx, %rdx
je 0x30e2
pushq %r15
pushq %r14
pushq %rbx
movl 0x18(%rdi), %eax
movl 0x1c(%rdi), %r8d
cmpl %eax, %r8d
jae 0x30dd
movl 0x1c(%rsi), %ecx
cmpl 0x18(%rsi), %ecx
jae 0x30dd
movq %rcx, %r10
shlq $0x4, %r10
movq 0x10(%rsi), %r11
movq 0x20(%rsi), %rbx
movq 0x8(%r11,%r10), %r9
subq %rbx, %r9
cmpq %rdx, %r9
cmovaeq %rdx, %r9
leaq (%r9,%rbx), %r14
addq (%r11,%r10), %rbx
movq 0x10(%rdi), %r15
shlq $0x4, %r8
movq %rbx, (%r15,%r8)
movq %r9, 0x8(%r15,%r8)
movq %r14, 0x20(%rsi)
cmpq 0x8(%r11,%r10), %r14
jne 0x30d2
movq $0x0, 0x20(%rsi)
incl %ecx
movl %ecx, 0x1c(%rsi)
subq %r9, %rdx
incl 0x1c(%rdi)
testq %rdx, %rdx
jne 0x3072
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/libobstcp.c
// Function: obstcp_accum_commit
ssize_t EXPORTED
obstcp_accum_commit(struct obstcp_accum *ac, ssize_t bytes) {
  struct obstcp_accum_buffer *ab = NULL;
  uint8_t c, next;
  ssize_t used = 0;

  if (bytes < 0) {
    errno = EINVAL;
    return -1;
  }

  for (c = ac->data_head; bytes && c != 0xff; c = next) {
    ab = &ac->buffers[c];

    if (ab->prefix_used < ab->prefix_len) {
      size_t a = ab->prefix_len - ab->prefix_used;
      if (a > bytes) a = bytes;
      ab->prefix_used += a;
      bytes -= a;
    }

    size_t a = ab->payload_len - ab->payload_used;
    if (a > bytes) a = bytes;
    ab->payload_used += a;
    bytes -= a;
    used += a;

    next = ab->next;

    if (ab->payload_len == ab->payload_used &&
        ab->prefix_len == ab->prefix_used) {

      ac->data_head = ab->next;
      if (ac->data_head == 0xff) ac->data_tail = 0xff;

      ab->next = ac->free_head;
      ac->free_head = c;
    }
  }

  // The user has claimed to have written more bytes than we've ever given
  // them.
  if (bytes) {
    errno = EINVAL;
    return -1;
  }

  return used;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
testq %rsi, %rsi
js 0x322a
movb 0x1bb(%rdi), %dl
setne %r8b
cmpb $-0x1, %dl
setne %al
andb %r8b, %al
cmpb $0x1, %al
jne 0x3223
leaq 0xa(%rdi), %rcx
xorl %eax, %eax
movzbl %dl, %r8d
leaq (%r8,%r8,8), %r8
leaq (%rcx,%r8,8), %r8
movzbl 0x5(%r8), %r10d
movzbl 0x4(%r8), %r9d
cmpb %r9b, %r10b
jae 0x31b2
movq %r9, %r11
subq %r10, %r11
cmpq %rsi, %r11
cmovaeq %rsi, %r11
addl %r11d, %r10d
movb %r10b, 0x5(%r8)
subq %r11, %rsi
movzwl (%r8), %ebx
movzwl 0x2(%r8), %r11d
movq %rbx, %r10
subq %r11, %r10
cmpq %rsi, %r10
cmovaeq %rsi, %r10
leal (%r10,%r11), %ebp
movw %bp, 0x2(%r8)
movb 0x6(%r8), %r11b
cmpw %bp, %bx
jne 0x3205
cmpb 0x5(%r8), %r9b
jne 0x3205
movb %r11b, 0x1bb(%rdi)
cmpb $-0x1, %r11b
jne 0x31f4
movb $-0x1, 0x1bc(%rdi)
movb 0x1ba(%rdi), %r9b
movb %r9b, 0x6(%r8)
movb %dl, 0x1ba(%rdi)
subq %r10, %rsi
addq %r10, %rax
testq %rsi, %rsi
setne %r8b
je 0x3225
movl %r11d, %edx
cmpb $-0x1, %r11b
jne 0x3180
jmp 0x3225
xorl %eax, %eax
testb %r8b, %r8b
je 0x323c
callq 0x1050
movl $0x16, (%rax)
movq $-0x1, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/./varbuf.h
// Function: varbuf_copy_in
static int MAYBEUNUSED
varbuf_copy_in(struct varbuf *vb, const uint8_t *buffer, size_t len) {
  off_t j = 0;

  if (vb->tail) {
    size_t remaining = vb->tail->length - vb->tail->used;
    if (remaining > len)
      remaining = len;

    memcpy(vb->tail->data + vb->tail->used, buffer, remaining);
    vb->tail->used += remaining;
    j += remaining;
    len -= remaining;
  }

  if (len) {
    size_t alloc = len;
    if (alloc < VARBUF_CHUNK_SIZE)
      alloc = VARBUF_CHUNK_SIZE;

    struct chunk *const chunk = malloc(sizeof(struct chunk) + alloc);
    if (!chunk) {
      errno = ENOMEM;
      return -1;
    }

    chunk->length = alloc;
    chunk->used = len;
    chunk->read = 0;
    chunk->next = NULL;
    chunk->prev = vb->tail;
    if (vb->tail) {
      vb->tail->next = chunk;
      vb->tail = chunk;
    } else {
      vb->tail = vb->head = chunk;
    }

    memcpy(chunk->data, buffer + j, len);
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x35f1
movq (%rax), %r12
movq 0x8(%rax), %rcx
subq %rcx, %r12
cmpq %rbx, %r12
cmovaeq %rbx, %r12
leaq (%rax,%rcx), %rdi
addq $0x28, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x10b0
movq 0x8(%r15), %rax
addq %r12, 0x8(%rax)
subq %r12, %rbx
jmp 0x35f4
xorl %r12d, %r12d
testq %rbx, %rbx
je 0x366a
cmpq $0x101, %rbx            # imm = 0x101
movl $0x100, %ebp            # imm = 0x100
cmovaeq %rbx, %rbp
leaq 0x28(%rbp), %rdi
callq 0x10c0
movq %rax, %r13
testq %rax, %rax
je 0x365a
movq %rbp, (%r13)
movq %rbx, 0x8(%r13)
xorl %eax, %eax
movq %rax, 0x10(%r13)
movq %rax, 0x20(%r13)
movq 0x8(%r15), %rax
movq %rax, 0x18(%r13)
leaq 0x20(%rax), %rcx
testq %rax, %rax
cmoveq %r15, %rcx
movq %r13, (%rcx)
movq %r13, 0x8(%r15)
leaq 0x28(%r13), %rdi
addq %r12, %r14
movq %r14, %rsi
movq %rbx, %rdx
callq 0x10b0
jmp 0x3665
callq 0x1050
movl $0xc, (%rax)
testq %r13, %r13
je 0x366e
xorl %eax, %eax
jmp 0x3673
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/libobstcp.c
// Function: read_wrapper
static ssize_t
read_wrapper(void *ctx, uint8_t *buffer, size_t len) {
  intptr_t fd = (intptr_t) ctx;
  ssize_t n;

  do {
    n = read(fd, buffer, len);
  } while (n == -1 && errno == EINTR);

  return n;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl %r15d, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1090
movq %rax, %r12
cmpq $-0x1, %rax
jne 0x36cc
callq 0x1050
cmpl $0x4, (%rax)
je 0x36ab
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/./iovec_cursor.h
// Function: iovec_cursor_get_
static int MAYBEUNUSED
iovec_cursor_get_(void *arg, struct iovec *iov, size_t n) {
  struct iovec_cursor *c = arg;

  if (c->i == c->count)
    return 0;

  size_t todo = c->iov[c->i].iov_len - c->j;
  if (todo > n)
    todo = n;

  iov->iov_base = c->iov[c->i].iov_base + c->j;
  iov->iov_len = todo;

  c->j += todo;
  if (c->j == c->iov[c->i].iov_len) {
    c->j = 0;
    c->i++;
  }

  return 1;
}

// Assembly:
movl 0x1c(%rdi), %ecx
xorl %eax, %eax
cmpl 0x18(%rdi), %ecx
je 0x3742
movq %rcx, %r8
shlq $0x4, %r8
movq 0x10(%rdi), %r9
movq 0x20(%rdi), %rax
movq 0x8(%r9,%r8), %r10
subq %rax, %r10
cmpq %rdx, %r10
cmovaeq %rdx, %r10
movq (%r9,%r8), %rdx
addq %rax, %rdx
movq %rdx, (%rsi)
movq %r10, 0x8(%rsi)
addq %rax, %r10
movq %r10, 0x20(%rdi)
movl $0x1, %eax
cmpq 0x8(%r9,%r8), %r10
jne 0x3742
movq $0x0, 0x20(%rdi)
incl %ecx
movl %ecx, 0x1c(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/./iovec_cursor.h
// Function: iovec_cursor_fold
static int MAYBEUNUSED
iovec_cursor_fold(void *arg, int (*f) (void *, uint8_t *, size_t len), void *ctx) {
  struct iovec_cursor *c = arg;
  int r;
  unsigned i;

  for (i = c->i; i < c->count; ++i) {
    if (i == c->i) {
      r = f(ctx, c->iov[i].iov_base + c->j, c->iov[i].iov_len - c->j);
    } else {
      r = f(ctx, c->iov[i].iov_base, c->iov[i].iov_len);
    }

    if (r)
      return r;
  }

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl 0x1c(%rdi), %r12d
cmpl 0x18(%rdi), %r12d
jae 0x37b3
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq %r12, %r13
shlq $0x4, %r13
orq $0x8, %r13
movl 0x1c(%r15), %eax
cmpq %rax, %r12
jne 0x378c
movq 0x10(%r15), %rax
movq 0x20(%r15), %rcx
movq -0x8(%rax,%r13), %rsi
addq %rcx, %rsi
movq (%rax,%r13), %rdx
subq %rcx, %rdx
jmp 0x3799
movq 0x10(%r15), %rax
movq -0x8(%rax,%r13), %rsi
movq (%rax,%r13), %rdx
movq %rbx, %rdi
callq *%r14
testl %eax, %eax
jne 0x37b5
incq %r12
movl 0x18(%r15), %eax
addq $0x10, %r13
cmpq %rax, %r12
jb 0x376a
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/libobstcp.c
// Function: xor
static void
xor(uint8_t *dst, const uint8_t *src, const uint8_t *xorbytes, unsigned l) {
  const unsigned words = l >> 2;
  const unsigned bytes = l & 3;
  uint32_t *dst32 = (uint32_t *) dst;
  const uint32_t *src32 = (uint32_t *) src;
  const uint32_t *xorbytes32 = (uint32_t *) xorbytes;
  unsigned i;

  for (i = 0; i < words; ++i) {
    dst32[i] = src32[i] ^ xorbytes32[i];
  }

  for (i = 0; i < bytes; ++i) {
    dst[words * 4 + i] = src[words * 4 + i] ^ xorbytes[words * 4 + i];
  }
}

// Assembly:
movl %ecx, %eax
andl $0x3, %eax
cmpl $0x4, %ecx
jb 0x37e7
movl %ecx, %r8d
shrl $0x2, %r8d
xorl %r9d, %r9d
movl (%rdx,%r9,4), %r10d
xorl (%rsi,%r9,4), %r10d
movl %r10d, (%rdi,%r9,4)
incq %r9
cmpq %r9, %r8
jne 0x37d3
testl %eax, %eax
je 0x380f
andl $-0x4, %ecx
movl %eax, %eax
addq %rcx, %rsi
addq %rcx, %rdx
addq %rcx, %rdi
xorl %ecx, %ecx
movb (%rdx,%rcx), %r8b
xorb (%rsi,%rcx), %r8b
movb %r8b, (%rdi,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x37fb
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/./varbuf.h
// Function: varbuf_cursor_get
static int MAYBEUNUSED
varbuf_cursor_get(void *arg, struct iovec *iov, size_t n) {
  struct varbuf_cursor *c = arg;

  if (c->chunk) {
    size_t todo = c->chunk->used - c->chunk->read;
    if (todo > n)
      todo = n;
    iov->iov_base = c->chunk->data + c->chunk->read;
    iov->iov_len = todo;

    c->chunk->read += todo;
    if (c->chunk->read == c->chunk->used)
      c->chunk = c->chunk->next;

    return 1;
  }

  if (c->used > c->read) {
    size_t todo = c->used - c->read;
    if (todo > n)
      todo = n;
    iov->iov_base = c->extra + c->read;
    iov->iov_len = todo;

    c->read += todo;

    return 1;
  }

  return 0;
}

// Assembly:
movq 0x10(%rdi), %rcx
testq %rcx, %rcx
je 0x3857
movq 0x8(%rcx), %r8
movq 0x10(%rcx), %rax
movq %r8, %r9
subq %rax, %r9
cmpq %rdx, %r9
cmovaeq %rdx, %r9
leaq (%rcx,%rax), %rdx
addq $0x28, %rdx
movq %rdx, (%rsi)
movq %r9, 0x8(%rsi)
addq %rax, %r9
movq %r9, 0x10(%rcx)
movl $0x1, %eax
cmpq %r8, %r9
jne 0x3887
movq 0x20(%rcx), %rcx
movq %rcx, 0x10(%rdi)
retq
movq 0x18(%rdi), %rcx
movq 0x28(%rdi), %r8
xorl %eax, %eax
subq %rcx, %r8
jbe 0x3887
cmpq %rdx, %r8
cmovbq %r8, %rdx
movq 0x20(%rdi), %rax
addq %rcx, %rax
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
addq %rcx, %rdx
movq %rdx, 0x18(%rdi)
movl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/./varbuf.h
// Function: varbuf_cursor_fold
static int MAYBEUNUSED
varbuf_cursor_fold(void *arg, int (*f) (void *, uint8_t *, size_t), void *ctx) {
  struct varbuf_cursor *c = arg;
  int r;

  const struct chunk *chunk = c->chunk;
  while (chunk) {
    r = f(ctx, (uint8_t *) chunk->data + c->chunk->read, chunk->used - c->chunk->read);
    if (r)
      return r;
    chunk = chunk->next;
  }

  if (c->used - c->read) {
    r = f(ctx, c->extra, c->used - c->read);
  } else {
    r = 0;
  }

  return r;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r14
movq 0x10(%rdi), %r15
testq %r15, %r15
je 0x38c9
movq 0x10(%r14), %rax
movq 0x10(%rax), %rax
leaq (%r15,%rax), %rsi
addq $0x28, %rsi
movq 0x8(%r15), %rdx
subq %rax, %rdx
movq %rbx, %rdi
callq *%r12
testl %eax, %eax
jne 0x38d5
movq 0x20(%r15), %r15
jmp 0x389d
movq 0x28(%r14), %rdx
xorl %eax, %eax
subq 0x18(%r14), %rdx
jne 0x38e1
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x20(%r14), %rsi
movq %rbx, %rdi
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *%rax
// File: /workspace/github_c_makefile_star2_O1/agl[P]obstcp/sha256.c
// Function: sha256_update
void
sha256_update(struct sha256_ctx *md, const uint8_t *in, unsigned inlen) {
  unsigned n;
  unsigned block_size = sizeof(md->buf);

  if (md->curlen > block_size) return;

  while (inlen > 0) {
    if (md->curlen == 0 && inlen >= block_size) {
      sha256_transform(md->state, (uint8_t *)in);
      md->length += block_size * 8;
      in             += block_size;
      inlen          -= block_size;
    } else {
      n = MIN(inlen, (block_size - md->curlen));
      memcpy(md->buf + md->curlen, in, (size_t)n);
      md->curlen += n;
      in             += n;
      inlen          -= n;
      if (md->curlen == block_size) {
        sha256_transform(md->state, md->buf);
        md->length += block_size * 8;
        md->curlen = 0;
      }
    }
  }
}

// Assembly:
cmpl $0x41, 0x28(%rdi)
setae %al
testl %edx, %edx
sete %cl
orb %al, %cl
jne 0x3e45
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x2c(%rdi), %r12
leaq 0x8(%rdi), %r13
movl 0x28(%r15), %edi
testq %rdi, %rdi
setne %al
cmpl $0x40, %ebx
setb %cl
orb %al, %cl
jne 0x3deb
movq %r13, %rdi
movq %r14, %rsi
callq 0x3e46
addq $0x200, (%r15)          # imm = 0x200
addq $0x40, %r14
addl $-0x40, %ebx
jmp 0x3e33
movl $0x40, %ebp
subl %edi, %ebp
cmpl %ebp, %ebx
cmovbl %ebx, %ebp
addq %r12, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x10b0
movl %ebp, %eax
addl 0x28(%r15), %eax
subl %ebp, %ebx
movl %eax, 0x28(%r15)
addq %rbp, %r14
cmpl $0x40, %eax
jne 0x3e33
movq %r13, %rdi
movq %r12, %rsi
callq 0x3e46
addq $0x200, (%r15)          # imm = 0x200
movl $0x0, 0x28(%r15)
testl %ebx, %ebx
jne 0x3dbc
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq