LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/RodionGork[P]tinyscheme/scheme.c
// Function: check_strbuff_size
static int check_strbuff_size(scheme * sc, char **p) {
  char *t;
  int len = *p - sc->strbuff;
  if (len + 4 < sc->strbuff_size) {
    return 1;
  }
  sc->strbuff_size *= 2;
  if (sc->strbuff_size >= STRBUFF_MAX_SIZE) {
    sc->strbuff_size /= 2;
    return 0;
  }
  t = sc->malloc(sc->strbuff_size);
  memcpy(t, sc->strbuff, len);
  *p = t + len;
  sc->free(sc->strbuff);
  sc->strbuff = t;
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq (%rsi), %r13
subq 0xea0(%rdi), %r13
leal 0x4(%r13), %ecx
movl 0xea8(%rdi), %eax
pushq $0x1
popq %rbx
cmpl %eax, %ecx
jl 0xb6a8
movq %rdi, %r14
movslq %eax, %rdi
addq %rdi, %rdi
movl %edi, 0xea8(%r14)
cmpl $0x8000, %eax           # imm = 0x8000
jl 0xb672
movl %eax, 0xea8(%r14)
xorl %ebx, %ebx
jmp 0xb6a8
movq %rsi, %r15
callq *(%r14)
movq %rax, %r12
movq 0xea0(%r14), %rsi
movslq %r13d, %r13
movq %rax, %rdi
movq %r13, %rdx
callq 0x41d0
addq %r12, %r13
movq %r13, (%r15)
movq 0xea0(%r14), %rdi
callq *0x8(%r14)
movq %r12, 0xea0(%r14)
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/RodionGork[P]tinyscheme/scheme.c
// Function: num_lt
static int num_lt(num a, num b) {
  int ret;
  int is_fixnum = a.is_fixnum && b.is_fixnum;
  if (is_fixnum) {
    ret = a.value.ivalue < b.value.ivalue;
  } else {
    ret = num_rvalue(a) < num_rvalue(b);
  }
  return ret;
}

// Assembly:
testb %dil, %dil
setne %al
testb %dl, %dl
setne %r8b
andb %al, %r8b
cmpb $0x1, %r8b
jne 0xb6d1
cmpq %rcx, %rsi
setl %al
jmp 0xb6f9
testb %dil, %dil
je 0xb6dd
cvtsi2sd %rsi, %xmm0
jmp 0xb6e2
movq %rsi, %xmm0
testb %dl, %dl
je 0xb6ed
cvtsi2sd %rcx, %xmm1
jmp 0xb6f2
movq %rcx, %xmm1
ucomisd %xmm0, %xmm1
seta %al
movzbl %al, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/RodionGork[P]tinyscheme/scheme.c
// Function: readstr_upto
static char *readstr_upto(scheme * sc, char *delim) {
  char *p = sc->strbuff;
  int c, len;

  while (1) {
    c = inchar(sc);
    if (check_strbuff_size(sc, &p)) {
      char_to_utf8(c, p, &len);
      p += len;
    }
    if(is_one_of(delim, c)) {
      break;
    }
  }

  if (p == sc->strbuff + 2 && p[-2] == '\\') {
    *p = 0;
  } else {
    backchar(sc, p[-1]);
    *--p = '\0';
  }
  return sc->strbuff;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0xea0(%rdi), %rax
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
leaq 0x1a58(%rip), %r15      # 0xd1db
leaq 0x14(%rsp), %r12
movq %rbx, %rdi
callq 0xaa56
movl %eax, %ebp
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb62c
testl %eax, %eax
je 0xb7c0
movq 0x8(%rsp), %r13
movl %ebp, %edi
movq %r13, %rsi
movq %r12, %rdx
callq 0xb5be
movslq 0x14(%rsp), %rax
addq %r13, %rax
movq %rax, 0x8(%rsp)
movq %r15, %rdi
movl %ebp, %esi
callq 0xab07
testl %eax, %eax
je 0xb788
movq 0x8(%rsp), %rax
movq 0xea0(%rbx), %rcx
addq $0x2, %rcx
cmpq %rcx, %rax
jne 0xb7e9
cmpb $0x5c, -0x2(%rax)
je 0xb7f8
movsbl -0x1(%rax), %ecx
decq %rax
cmpl $-0x1, %ecx
je 0xb7f8
movl %ecx, 0x2c(%rbx)
movb $0x0, (%rax)
movq 0xea0(%rbx), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/RodionGork[P]tinyscheme/scheme.c
// Function: printatom
static void printatom(scheme * sc, pointer l, int f) {
  char *p;
  int len;
  atom2str(sc, l, f, &p, &len);
  putchars(sc, p, len);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x10(%rsp), %r14
leaq 0xc(%rsp), %r15
movq %r14, %rcx
movq %r15, %r8
callq 0xafa9
movq (%r14), %r14
movl (%r15), %ebp
movq 0x178(%rbx), %rax
movq 0x8(%rax), %r15
testb $0x1, (%r15)
jne 0xb896
subl $0x1, %ebp
jb 0xb8b2
movq 0x18(%r15), %rax
cmpq 0x10(%r15), %rax
je 0xb86b
movb (%r14), %cl
incq %r14
leaq 0x1(%rax), %rdx
movq %rdx, 0x18(%r15)
movb %cl, (%rax)
jmp 0xb84a
testb $0x4, (%r15)
je 0xb84a
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4a8a
testl %eax, %eax
je 0xb84a
movb (%r14), %al
incq %r14
movq 0x18(%r15), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x18(%r15)
movb %al, (%rcx)
jmp 0xb84a
movslq %ebp, %rdx
movq 0x8(%r15), %rcx
pushq $0x1
popq %rsi
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x42a0
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/RodionGork[P]tinyscheme/scheme.c
// Function: mark
static void mark(pointer a) {
  pointer t, q, p;

  t = (pointer) 0;
  p = a;
E2:setmark(p);
  if (is_vector(p)) {
    int i;
    int num = ivalue_unchecked(p) / 2 + ivalue_unchecked(p) % 2;
    for (i = 0; i < num; i++) {
      /* Vector cells will be treated like ordinary cells */
      mark(p + 1 + i);
    }
  }
  if (is_atom(p))
    goto E6;
  /* E4: down car */
  q = car(p);
  if (q && !is_mark(q)) {
    setatom(p);                 /* a note that we have moved car */
    car(p) = t;
    t = p;
    p = q;
    goto E2;
  }
E5:q = cdr(p);                 /* down cdr */
  if (q && !is_mark(q)) {
    cdr(p) = t;
    t = p;
    p = q;
    goto E2;
  }
E6:                            /* up.  Undo the link switching from steps E4 and E5. */
  if (!t)
    return;
  q = t;
  if (is_atom(q)) {
    clratom(q);
    t = car(q);
    car(q) = p;
    p = q;
    goto E5;
  } else {
    t = cdr(q);
    cdr(q) = p;
    p = q;
    goto E6;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %r15d, %r15d
pushq $0x2
popq %r12
xorl %ebp, %ebp
movq %rdi, %r13
movl (%rdi), %ecx
movl %ecx, %eax
orl $0x8000, %eax           # imm = 0x8000
movl %eax, (%rdi)
andl $0x1f, %ecx
cmpl $0xb, %ecx
jne 0xb917
movq 0x10(%r13), %rax
cqto
idivq %r12
movq %rax, %rbx
addl %edx, %ebx
leaq 0x18(%r13), %r14
testl %ebx, %ebx
cmovlel %r15d, %ebx
subq $0x1, %rbx
jb 0xb913
movq %r14, %rdi
callq 0xb8bd
addq $0x18, %r14
jmp 0xb8ff
movl (%r13), %eax
btl $0xe, %eax
jb 0xb959
movq 0x8(%r13), %rdi
testq %rdi, %rdi
je 0xb93e
testb $-0x80, 0x1(%rdi)
jne 0xb93e
orl $0x4000, %eax           # imm = 0x4000
movl %eax, (%r13)
movq %rbp, 0x8(%r13)
movq %r13, %rbp
jmp 0xb8d1
movq 0x10(%r13), %rdi
testq %rdi, %rdi
je 0xb959
testb $-0x80, 0x1(%rdi)
jne 0xb959
movq %rbp, 0x10(%r13)
movq %r13, %rbp
jmp 0xb8d1
movq %r13, %rax
movq %rbp, %r13
testq %r13, %r13
je 0xb992
movl (%r13), %ecx
btl $0xe, %ecx
jb 0xb97e
movq 0x10(%r13), %rcx
movq %rax, 0x10(%r13)
movq %r13, %rax
movq %rcx, %r13
jmp 0xb95f
andl $0xbfff, %ecx           # imm = 0xBFFF
movl %ecx, (%r13)
movq 0x8(%r13), %rbp
movq %rax, 0x8(%r13)
jmp 0xb93e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/VeeeectorPan[P]MyNetdisk/clientSrc/compute_file_md5.c
// Function: compute_file_md5
int compute_file_md5(const char* file_path,char* md5_str,int size)
{
    int i;
	int fd;
	int ret;
	unsigned char data[READ_DATA_SIZE];
	unsigned char md5_value[MD5_SIZE];
	MD5_CTX md5;

	fd = open(file_path, O_RDONLY);
	if (-1 == fd)
	{
		perror("open");
		return -1;
	}

	// init md5
	MD5Init(&md5);

    int total = 0;
    while(total < size)
	{
        if(size - total > 4096)
		    ret = read(fd, data, 4096);
        else
            ret = read(fd,data,size - total);
		if (-1 == ret)
		{
			perror("read");
			close(fd);
			return -1;
		}
		MD5Update(&md5, data, ret);
        total += ret;
	}

	close(fd);

	MD5Final(&md5, md5_value);

	// convert md5 value to md5 string
	for(i = 0; i < MD5_SIZE; i++)
	{
		snprintf(md5_str + i*2, 2+1, "%02x", md5_value[i]);
	}

	return 0;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1078, %rsp           # imm = 0x1078
movl %edx, -0x30(%rbp)
movq %rsi, %rbx
xorl %r14d, %r14d
xorl %esi, %esi
xorl %eax, %eax
callq 0x2100
movl %eax, -0x2c(%rbp)
cmpl $-0x1, %eax
je 0x2b36
leaq -0x98(%rbp), %rdi
callq 0x30f0
movl $0x1000, %r15d          # imm = 0x1000
leaq -0x10a0(%rbp), %r13
movl -0x30(%rbp), %eax
subl %r14d, %eax
jle 0x2ae8
cmpl %r15d, %eax
cmovgel %r15d, %eax
movslq %eax, %rdx
movl -0x2c(%rbp), %edi
movq %r13, %rsi
callq 0x2210
movq %rax, %r12
cmpl $-0x1, %r12d
je 0x2b44
leaq -0x98(%rbp), %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0x310e
addl %r12d, %r14d
jmp 0x2aab
movl -0x2c(%rbp), %edi
callq 0x22e0
leaq -0x98(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x3926
xorl %r14d, %r14d
leaq 0x259e(%rip), %r15      # 0x50a8
pushq $0x3
popq %r12
xorl %r13d, %r13d
cmpq $0x10, %r13
je 0x2b5c
movzbl -0x40(%rbp,%r13), %ecx
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2280
incq %r13
addq $0x2, %rbx
jmp 0x2b11
leaq 0x2561(%rip), %rdi      # 0x509e
callq 0x2130
jmp 0x2b58
leaq 0x2558(%rip), %rdi      # 0x50a3
callq 0x2130
movl -0x2c(%rbp), %edi
callq 0x22e0
pushq $-0x1
popq %r14
movl %r14d, %eax
addq $0x1078, %rsp           # imm = 0x1078
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/VeeeectorPan[P]MyNetdisk/clientSrc/get_absolute_path.c
// Function: get_absolute_path
int get_absolute_path(char* buf,int size)
{              
    char* oldpath = getcwd(NULL,0);
    chdir(buf);
    char* newpath = getcwd(NULL,0);
    memset(buf,0,size);
    strcpy(buf,newpath);
    chdir(oldpath);
    free(oldpath);
    free(newpath);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
xorl %edi, %edi
xorl %esi, %esi
callq 0x20d0
movq %rax, %r15
movq %r14, %rdi
callq 0x2220
xorl %edi, %edi
xorl %esi, %esi
callq 0x20d0
movq %rax, %r12
movslq %ebx, %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x20e0
movq %r14, %rdi
movq %r12, %rsi
callq 0x2160
movq %r15, %rdi
callq 0x2220
movq %r15, %rdi
callq 0x21b0
movq %r12, %rdi
callq 0x21b0
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/VeeeectorPan[P]MyNetdisk/clientSrc/gets.c
// Function: pthread_download_file
void* pthread_download_file(void* arg)
{
    int sock_fd = *(int*)arg;
    char buf[4096];
    while(1)
    {
        memset(buf,0,sizeof(buf));
        int len;
        int ret = recv(sock_fd,&len,sizeof(int),0);
        if(ret == 0)
            break;
        ret = recv_client_all(sock_fd,buf,len);
        if(ret == -1)
            break;
        char file_type = '\0';
        ret = recv(sock_fd,&file_type,sizeof(char),0);
        if(ret == 0)
            break;
        if(file_type == 'd')
        {
            puts(buf);
            struct stat st;
            ret = stat(buf,&st);
            if(ret == -1)
            {
                mkdir(buf,0777);
            }
            else if((st.st_mode & S_IFMT) != S_IFDIR)
            {
                unlink(buf);
                mkdir(buf,0777);
            }
        }
        else
        {
            ret = recv_server_file(sock_fd,buf);
            if(ret == -1)
                break;
        }
    }
    close(sock_fd);
    free(arg);
    pthread_exit(NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10a8, %rsp           # imm = 0x10A8
movq %rdi, -0x38(%rbp)
movl (%rdi), %r14d
leaq -0x10d0(%rbp), %r15
pushq $0x4
popq %r13
leaq -0x29(%rbp), %rbx
pushq $0x1
popq %r12
movl $0x1000, %edx           # imm = 0x1000
movq %r15, %rdi
xorl %esi, %esi
callq 0x20e0
movl %r14d, %edi
leaq -0x30(%rbp), %rsi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x2070
testl %eax, %eax
je 0x2d09
movl -0x30(%rbp), %edx
movl %r14d, %edi
movq %r15, %rsi
callq 0x3c68
cmpl $-0x1, %eax
je 0x2d09
movb $0x0, -0x29(%rbp)
movl %r14d, %edi
movq %rbx, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x2070
testl %eax, %eax
je 0x2d09
cmpb $0x64, -0x29(%rbp)
jne 0x2cf5
movq %r15, %rdi
callq 0x2260
movq %r15, %rdi
leaq -0xc8(%rbp), %rsi
callq 0x2150
cmpl $-0x1, %eax
je 0x2ce3
movl -0xb0(%rbp), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
cmpl $0x4000, %eax           # imm = 0x4000
je 0x2c4a
movq %r15, %rdi
callq 0x20a0
movq %r15, %rdi
movl $0x1ff, %esi            # imm = 0x1FF
callq 0x2090
jmp 0x2c4a
movl %r14d, %edi
movq %r15, %rsi
callq 0x3f64
cmpl $-0x1, %eax
jne 0x2c4a
movl %r14d, %edi
callq 0x22e0
movq -0x38(%rbp), %rdi
callq 0x21b0
xorl %edi, %edi
callq 0x22b0
// File: /workspace/github_c_makefile_star2_O2/VeeeectorPan[P]MyNetdisk/clientSrc/gets.c
// Function: gets
int gets(int sock_fd,const char* file_name,const char* path,int file_id)
{
    int ctl_num = CTL_GET;
    send(sock_fd,&ctl_num,sizeof(int),0);
    char buf[4096];
    int file_name_len = strlen(file_name);
    int path_len = strlen(path);
    memcpy(buf ,&file_id,sizeof(int));
    memcpy(buf + sizeof(int),&file_name_len,sizeof(int));
    memcpy(buf + sizeof(int) * 2,&path_len,sizeof(int));
    memcpy(buf + sizeof(int) * 3,file_name,file_name_len);
    memcpy(buf + sizeof(int) * 3 + file_name_len,path,path_len);
    send(sock_fd,buf,sizeof(int) * 3 + file_name_len + path_len,0);

    pthread_t id;
    int * arg = (int*)malloc(sizeof(int));
    *arg = sock_fd;
    pthread_create(&id,NULL,pthread_download_file,arg);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1018, %rsp           # imm = 0x1018
movl %ecx, -0x2c(%rbp)
movq %rdx, %r15
movq %rsi, %r12
movl %edi, %ebx
leaq -0x30(%rbp), %rsi
movl $0x5, (%rsi)
pushq $0x4
popq %rdx
xorl %ecx, %ecx
callq 0x20c0
movq %r12, %rdi
callq 0x2080
movq %rax, %r14
movq %r15, %rdi
callq 0x2080
movq %rax, %r13
leaq -0x1034(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, -0xc(%rdi)
movl %r14d, -0x8(%rdi)
movl %r13d, -0x4(%rdi)
movslq %r14d, %r14
movq %r12, %rsi
movq %r14, %rdx
callq 0x2110
leaq (%r14,%rbp), %rdi
addq $-0x1034, %rdi          # imm = 0xEFCC
movslq %r13d, %r12
movq %r15, %rsi
movq %r12, %rdx
callq 0x2110
leaq (%r14,%r12), %rdx
addq $0xc, %rdx
leaq -0x1040(%rbp), %rsi
movl %ebx, %edi
xorl %ecx, %ecx
callq 0x20c0
pushq $0x4
popq %rdi
callq 0x21d0
movl %ebx, (%rax)
leaq -0x1b3(%rip), %rdx      # 0x2c1c
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
movq %rax, %rcx
callq 0x22c0
xorl %eax, %eax
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/VeeeectorPan[P]MyNetdisk/clientSrc/link_path.c
// Function: link_path
void link_path(char* file_name)
{
    char tmp[256] = {0};
    strcpy(tmp,file_name);
    char* path = getcwd(NULL,0);
    sprintf(file_name,"%s/%s",path,tmp);
    free(path);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, %rbx
leaq -0x120(%rbp), %r14
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
xorl %esi, %esi
callq 0x20e0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2160
xorl %edi, %edi
xorl %esi, %esi
callq 0x20d0
movq %rax, %r15
leaq 0x2272(%rip), %rsi      # 0x50ad
movq %rbx, %rdi
movq %rax, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x2050
movq %r15, %rdi
callq 0x21b0
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/VeeeectorPan[P]MyNetdisk/clientSrc/ls.c
// Function: ls
int ls(int sock_fd,int file_id)
{
    int ctl_num = CTL_LS;
    send(sock_fd,&ctl_num,sizeof(int),0);
    send(sock_fd,&file_id,sizeof(int),0);
    int len;
    char buf[4096];
    while(1)
    {
        memset(buf,0,sizeof(buf));
        recv(sock_fd,&len,sizeof(int),0);
        if(len == LS_FIN)
            break;
        recv_n_bytes(sock_fd,buf,len);
        char file_type = buf[0];
        int file_size = *(int*)(buf + 1);
        printf("%-32s",buf + 5);
        switch(file_type)
        {
        case 'd':
            printf("%-30s"," ");
            puts("directory");
            break;
        case 'f':
            printf("%20s%-10d"," ",file_size);
            puts("regular file");
            break;
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1018, %rsp           # imm = 0x1018
movl %edi, %ebx
leaq -0x34(%rbp), %r14
movl %esi, (%r14)
leaq -0x30(%rbp), %rsi
movl $0x1, (%rsi)
pushq $0x4
popq %r15
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x20c0
movl %ebx, %edi
movq %r14, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x20c0
leaq -0x1040(%rbp), %r12
leaq -0x2c(%rbp), %r13
movl $0x1000, %edx           # imm = 0x1000
movq %r12, %rdi
xorl %esi, %esi
callq 0x20e0
movl %ebx, %edi
movq %r13, %rsi
pushq $0x4
popq %rdx
xorl %ecx, %ecx
callq 0x2070
movl -0x2c(%rbp), %edx
testl %edx, %edx
je 0x30d9
movl %ebx, %edi
movq %r12, %rsi
callq 0x3f14
movzbl -0x1040(%rbp), %r14d
movl -0x103f(%rbp), %r15d
leaq 0x20b2(%rip), %rdi      # 0x512a
leaq -0x103b(%rbp), %rsi
xorl %eax, %eax
callq 0x2030
cmpl $0x66, %r14d
je 0x30b0
cmpl $0x64, %r14d
jne 0x302f
leaq 0x2097(%rip), %rdi      # 0x5130
leaq 0x1fb1(%rip), %rsi      # 0x5051
xorl %eax, %eax
callq 0x2030
leaq 0x1fbe(%rip), %rdi      # 0x506c
jmp 0x30cf
leaq 0x207f(%rip), %rdi      # 0x5136
leaq 0x1f93(%rip), %rsi      # 0x5051
movl %r15d, %edx
xorl %eax, %eax
callq 0x2030
leaq 0x2071(%rip), %rdi      # 0x5140
callq 0x2260
jmp 0x302f
xorl %eax, %eax
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/VeeeectorPan[P]MyNetdisk/clientSrc/md5.c
// Function: MD5Update
void MD5Update(MD5_CTX *context, unsigned char *input, unsigned int inputlen)
{
	unsigned int i = 0;
	unsigned int index = 0;
	unsigned int partlen = 0;

	index = (context->count[0] >> 3) & 0x3F;
	partlen = 64 - index;
	context->count[0] += inputlen << 3;

	if(context->count[0] < (inputlen << 3))
		context->count[1]++;
	context->count[1] += inputlen >> 29;

	if(inputlen >= partlen)
	{
		memcpy(&context->buffer[index], input,partlen);
		MD5Transform(context->state, context->buffer);

		for(i = partlen; i+64 <= inputlen; i+=64)
			MD5Transform(context->state, &input[i]);

		index = 0;        
	}  
	else
	{
		i = 0;
	}
	memcpy(&context->buffer[index], &input[i], inputlen-i);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebx
movq %rdi, %r14
movl (%rdi), %ecx
movl %ecx, %eax
shrl $0x3, %eax
andl $0x3f, %eax
pushq $0x40
popq %r13
subl %eax, %r13d
leal (,%rbx,8), %edx
movl %ebx, %edi
shrl $0x1d, %edi
addl %ecx, %edx
movl %edx, (%r14)
adcl %edi, 0x4(%r14)
movq %rsi, %r15
cmpl %ebx, %r13d
jbe 0x3159
movl %eax, %eax
xorl %r13d, %r13d
jmp 0x31aa
leaq 0x18(%r14), %rcx
movq %rcx, -0x30(%rbp)
leaq (%r14,%rax), %rdi
addq $0x18, %rdi
movl %r13d, %edx
movq %r15, %rsi
callq 0x2110
movq %r14, -0x38(%rbp)
leaq 0x8(%r14), %r12
movq %r12, %rdi
movq -0x30(%rbp), %rsi
callq 0x31d4
leal 0x40(%r13), %r14d
cmpl %ebx, %r14d
ja 0x31a4
movl %r13d, %esi
addq %r15, %rsi
movq %r12, %rdi
callq 0x31d4
movl %r14d, %r13d
jmp 0x3188
movq -0x38(%rbp), %r14
xorl %eax, %eax
leaq (%r14,%rax), %rdi
addq $0x18, %rdi
movl %r13d, %eax
addq %rax, %r15
subl %r13d, %ebx
movq %r15, %rsi
movq %rbx, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2110
// File: /workspace/github_c_makefile_star2_O2/VeeeectorPan[P]MyNetdisk/clientSrc/md5.c
// Function: MD5Final
void MD5Final(MD5_CTX *context, unsigned char digest[16])
{
	unsigned int index = 0,padlen = 0;
	unsigned char bits[8];

	index = (context->count[0] >> 3) & 0x3F;
	padlen = (index < 56)?(56-index):(120-index);
	MD5Encode(bits, context->count, 8);
	MD5Update(context, PADDING, padlen);
	MD5Update(context, bits, 8);
	MD5Encode(digest, context->state, 16);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl (%rdi), %eax
shrl $0x3, %eax
andl $0x3f, %eax
xorl %r15d, %r15d
cmpl $0x38, %eax
setae %r15b
shll $0x6, %r15d
orl $0x38, %r15d
subl %eax, %r15d
leaq -0x30(%rbp), %r12
pushq $0x8
popq %r13
movq %r12, %rdi
movq %r14, %rsi
movl %r13d, %edx
callq 0x39ad
leaq 0x381c(%rip), %rsi      # 0x7190
movq %r14, %rdi
movl %r15d, %edx
callq 0x310e
movq %r14, %rdi
movq %r12, %rsi
movl %r13d, %edx
callq 0x310e
addq $0x8, %r14
pushq $0x10
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x39ad
// File: /workspace/github_c_makefile_star2_O2/VeeeectorPan[P]MyNetdisk/clientSrc/md5.c
// Function: MD5Encode
void MD5Encode(unsigned char *output,unsigned int *input,unsigned int len)
{
	unsigned int i = 0;
	unsigned int j = 0;

	while(j < len)
	{
		output[j] = input[i] & 0xFF;  
		output[j+1] = (input[i] >> 8) & 0xFF;
		output[j+2] = (input[i] >> 16) & 0xFF;
		output[j+3] = (input[i] >> 24) & 0xFF;
		i++;
		j += 4;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
addl $0x3, %edx
shrl $0x2, %edx
xorl %eax, %eax
cmpq %rax, %rdx
je 0x39e1
movb (%rsi,%rax,4), %cl
movb %cl, (%rdi,%rax,4)
movb 0x1(%rsi,%rax,4), %cl
movb %cl, 0x1(%rdi,%rax,4)
movb 0x2(%rsi,%rax,4), %cl
movb %cl, 0x2(%rdi,%rax,4)
movb 0x3(%rsi,%rax,4), %cl
movb %cl, 0x3(%rdi,%rax,4)
incq %rax
jmp 0x39b9
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/VeeeectorPan[P]MyNetdisk/clientSrc/md5.c
// Function: MD5Decode
void MD5Decode(unsigned int *output, unsigned char *input, unsigned int len)
{
	unsigned int i = 0;
	unsigned int j = 0;

	while(j < len)
	{
		output[i] = (input[j]) |
			(input[j+1] << 8) |
			(input[j+2] << 16) |
			(input[j+3] << 24);
		i++;
		j += 4; 
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
addl $0x3, %edx
shrl $0x2, %edx
xorl %eax, %eax
cmpq %rax, %rdx
je 0x39ff
movl (%rsi,%rax,4), %ecx
movl %ecx, (%rdi,%rax,4)
incq %rax
jmp 0x39ef
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/VeeeectorPan[P]MyNetdisk/clientSrc/my_mkdir.c
// Function: my_mkdir
int my_mkdir(int sock_fd,int file_id,int user_id,const char* file_name)
{
    int ctl_num = CTL_MKDIR;
    send(sock_fd,&ctl_num,sizeof(int),0);
    send(sock_fd,&file_id,sizeof(int),0);
    send(sock_fd,&user_id,sizeof(int),0);
    int len = strlen(file_name);
    send(sock_fd,&len,sizeof(int),0);
    send(sock_fd,file_name,len,0);
    recv(sock_fd,&ctl_num,sizeof(int),0);
    if(ctl_num == FILE_NAME_AVAIABLE)
    {
        puts("mkdir success!");
    }
    else
    {
        puts("mkdir fail!");
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r15
movl %edi, %r14d
leaq -0x38(%rbp), %r13
movl %esi, (%r13)
leaq -0x34(%rbp), %rbx
movl %edx, (%rbx)
leaq -0x2c(%rbp), %rsi
movl $0x7, (%rsi)
pushq $0x4
popq %r12
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x20c0
movl %r14d, %edi
movq %r13, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x20c0
movl %r14d, %edi
movq %rbx, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x20c0
movq %r15, %rdi
callq 0x2080
leaq -0x30(%rbp), %rbx
movl %eax, (%rbx)
movl %r14d, %edi
movq %rbx, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x20c0
movslq (%rbx), %rdx
movl %r14d, %edi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x20c0
movl %r14d, %edi
leaq -0x2c(%rbp), %rbx
movq %rbx, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x2070
cmpl $0x1, (%rbx)
leaq 0x16b3(%rip), %rax      # 0x5160
leaq 0x16bb(%rip), %rdi      # 0x516f
cmoveq %rax, %rdi
callq 0x2260
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/VeeeectorPan[P]MyNetdisk/clientSrc/put.c
// Function: pthread_upload_func
void* pthread_upload_func(void* arg)
{
    int sock_fd = *(int*)arg;
    int parent_id = *((int*)arg + 1);
    char* path = (char*)arg + sizeof(int) * 2;
    upload(sock_fd,path,parent_id);
    int ctl_num = NO_MORE_FILE;
    send(sock_fd,&ctl_num,sizeof(int),0);
    free(arg);
    pthread_exit(NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl (%rdi), %r14d
movl 0x4(%rdi), %edx
leaq 0x8(%rdi), %rsi
movl %r14d, %edi
callq 0x437c
leaq -0x14(%rbp), %rsi
movl $0x3, (%rsi)
pushq $0x4
popq %rdx
movl %r14d, %edi
xorl %ecx, %ecx
callq 0x20c0
movq %rbx, %rdi
callq 0x21b0
xorl %edi, %edi
callq 0x22b0
// File: /workspace/github_c_makefile_star2_O2/VeeeectorPan[P]MyNetdisk/clientSrc/put.c
// Function: put
int put(int sock_fd,char* path,int user_id,int file_id)
{
    
    char file_name[128] = {0};
    get_file_name(file_name,path);
    int ctl_num = CTL_PUT;
    send(sock_fd,&ctl_num,sizeof(int),0);
    int len = strlen(file_name);
    send(sock_fd,&user_id,sizeof(int),0);
    send(sock_fd,&file_id,sizeof(int),0);
    send(sock_fd,&len,sizeof(int),0);
    send(sock_fd,file_name,len,0);
    recv(sock_fd,&ctl_num,sizeof(int),0);
    if(ctl_num == PUT_FAIL)
    {
        puts("在当前目录有同名文件，不可上传");
        close(sock_fd);
        return -1;
    }
    char* buf = (char*)malloc(4096);
    memset(buf,0,4096);
    memcpy(buf,&sock_fd,sizeof(int));
    memcpy(buf + sizeof(int),&file_id,sizeof(int));
    strcpy(buf + sizeof(int) * 2,path);
    pthread_t id;
    pthread_create(&id,NULL,pthread_upload_func,(void*)buf);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %edi, %ebx
leaq -0x30(%rbp), %rax
movl %edx, (%rax)
leaq -0x2c(%rbp), %rax
movl %ecx, (%rax)
xorps %xmm0, %xmm0
leaq -0xd0(%rbp), %r12
movaps %xmm0, 0x70(%r12)
movaps %xmm0, 0x60(%r12)
movaps %xmm0, 0x50(%r12)
movaps %xmm0, 0x40(%r12)
movaps %xmm0, 0x30(%r12)
movaps %xmm0, 0x20(%r12)
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
movq %r12, %rdi
movq %rsi, -0x38(%rbp)
callq 0x2be0
leaq -0x40(%rbp), %r13
movl $0x4, (%r13)
pushq $0x4
popq %r15
movl %ebx, %edi
movq %r13, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x20c0
movq %r12, %rdi
callq 0x2080
leaq -0x3c(%rbp), %r14
movl %eax, (%r14)
movl %ebx, %edi
leaq -0x30(%rbp), %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x20c0
movl %ebx, %edi
leaq -0x2c(%rbp), %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x20c0
movl %ebx, %edi
movq %r14, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x20c0
movslq (%r14), %rdx
movl %ebx, %edi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0x20c0
movl %ebx, %edi
movq %r13, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x2070
cmpl $0x0, (%r13)
je 0x3c3e
pushq $0x1
popq %rdi
movl $0x1000, %esi           # imm = 0x1000
callq 0x20f0
movq %rax, %r14
movl %ebx, (%rax)
movl -0x2c(%rbp), %eax
movl %eax, 0x4(%r14)
leaq 0x8(%r14), %rdi
movq -0x38(%rbp), %rsi
callq 0x2160
leaq -0x15c(%rip), %rdx      # 0x3ad0
leaq -0x48(%rbp), %rdi
xorl %esi, %esi
movq %r14, %rcx
callq 0x22c0
xorl %eax, %eax
jmp 0x3c54
leaq 0x1536(%rip), %rdi      # 0x517b
callq 0x2260
movl %ebx, %edi
callq 0x22e0
pushq $-0x1
popq %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/VeeeectorPan[P]MyNetdisk/clientSrc/recv_client_all.c
// Function: recv_client_all
int recv_client_all(int fd,void* buf,int len)
{
    int total = 0;
    int ret;
    while(total < len)
    {
        ret = recv(fd,(char*)buf + total,len - total,MSG_WAITALL);
        if(ret == 0)
        {
            return -1;
        }
        total += ret;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r14d
movq %rsi, %r15
movl %edi, %r12d
xorl %ebx, %ebx
xorl %r13d, %r13d
movl %r14d, %eax
subl %r13d, %eax
jle 0x3cac
movslq %r13d, %rsi
addq %r15, %rsi
movslq %eax, %rdx
movl %r12d, %edi
movl $0x100, %ecx            # imm = 0x100
callq 0x2070
addl %eax, %r13d
testl %eax, %eax
jne 0x3c84
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/VeeeectorPan[P]MyNetdisk/clientSrc/recv_file.c
// Function: recv_file
int recv_file(int sock_fd,int file_fd, int file_size)
{
    int total = 0;
    int pipefd[2];
    int ret = pipe(pipefd);
    ERROR_CHECK(ret,-1,"pipe");
    int download_size = 0;
    int splice_size = file_size/10000;
    int previous_download_size = 0;
    while(total < file_size)
    {
        ret = splice(sock_fd,NULL,pipefd[1],NULL,4096,SPLICE_F_MOVE|SPLICE_F_MORE);
        ERROR_CHECK(ret,-1,"splice");
        ret = splice(pipefd[0],NULL,file_fd,NULL,ret,SPLICE_F_MOVE|SPLICE_F_MORE);
        ERROR_CHECK(ret,-1,"splice");
        total += ret;
        download_size += ret;
        if(download_size - previous_download_size >= splice_size)
        {
            printf("downloading %.2f\r",(double)download_size/file_size * 100);
            fflush(stdout);
            previous_download_size = download_size;
        }
    }
    printf("downloading %.2f\n",(double)download_size/file_size * 100);
    return 0;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebx
movl %esi, -0x30(%rbp)
movl %edi, -0x34(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x21e0
cmpl $-0x1, %eax
je 0x3dd5
movl $0x2710, %ecx           # imm = 0x2710
movl %ebx, %eax
cltd
idivl %ecx
movl %eax, -0x2c(%rbp)
movl %ebx, %r12d
cvtsi2sd %ebx, %xmm0
movsd %xmm0, -0x40(%rbp)
xorl %r14d, %r14d
pushq $0x5
popq %r13
xorl %ebx, %ebx
xorl %r15d, %r15d
cmpl %r12d, %r14d
jge 0x3d9b
movl -0x44(%rbp), %edx
movl $0x1000, %r8d           # imm = 0x1000
movl -0x34(%rbp), %edi
xorl %esi, %esi
xorl %ecx, %ecx
movl %r13d, %r9d
callq 0x20b0
cmpl $-0x1, %eax
je 0x3dcc
movl -0x48(%rbp), %edi
movslq %eax, %r8
xorl %esi, %esi
movl -0x30(%rbp), %edx
xorl %ecx, %ecx
movl %r13d, %r9d
callq 0x20b0
cmpl $-0x1, %eax
je 0x3dcc
addl %eax, %r14d
addl %eax, %r15d
movl %r15d, %eax
subl %ebx, %eax
cmpl -0x2c(%rbp), %eax
jl 0x3d10
cvtsi2sd %r15d, %xmm0
divsd -0x40(%rbp), %xmm0
mulsd 0x143a(%rip), %xmm0     # 0x51b0
leaq 0x1447(%rip), %rdi      # 0x51c4
movb $0x1, %al
callq 0x2030
movq 0x3235(%rip), %rax      # 0x6fc0
movq (%rax), %rdi
callq 0x21a0
movl %r15d, %ebx
jmp 0x3d10
cvtsi2sd %r15d, %xmm0
divsd -0x40(%rbp), %xmm0
mulsd 0x1403(%rip), %xmm0     # 0x51b0
leaq 0x1422(%rip), %rdi      # 0x51d6
movb $0x1, %al
callq 0x2030
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x13ea(%rip), %rdi      # 0x51bd
jmp 0x3ddc
leaq 0x13dc(%rip), %rdi      # 0x51b8
callq 0x2130
pushq $-0x1
popq %rax
jmp 0x3dbd
nop
// File: /workspace/github_c_makefile_star2_O2/VeeeectorPan[P]MyNetdisk/clientSrc/recv_file_from_offset.c
// Function: recv_file_from_offset
int recv_file_from_offset(int sock_fd,int file_fd, int file_size,int offset)
{
    int total = offset;
    int pipefd[2];
    int ret = pipe(pipefd);
    ERROR_CHECK(ret,-1,"pipe");
    int download_size = 0;
    int splice_size = file_size/10000;
    int previous_download_size = 0;
    while(total < file_size)
    {
        ret = splice(sock_fd,NULL,pipefd[1],NULL,4096,SPLICE_F_MOVE|SPLICE_F_MORE);
        ERROR_CHECK(ret,-1,"splice");
        ret = splice(pipefd[0],NULL,file_fd,NULL,ret,SPLICE_F_MOVE|SPLICE_F_MORE);
        ERROR_CHECK(ret,-1,"splice");
        total += ret;
        download_size += ret;
        if(download_size - previous_download_size >= splice_size)
        {
            printf("downloading %.2f\r",(double)download_size/file_size * 100);
            fflush(stdout);
            previous_download_size = download_size;
        }
    }
    printf("downloading %.2f\n",(double)download_size/file_size * 100);
    return 0;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %ebx
movl %edx, %r14d
movl %esi, -0x2c(%rbp)
movl %edi, -0x30(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x21e0
cmpl $-0x1, %eax
je 0x3f01
movl $0x2710, %ecx           # imm = 0x2710
movl %r14d, %eax
cltd
movl %r14d, -0x34(%rbp)
cvtsi2sd %r14d, %xmm0
movsd %xmm0, -0x40(%rbp)
idivl %ecx
movl %eax, %r13d
xorl %r14d, %r14d
pushq $0x5
popq %r15
xorl %r12d, %r12d
cmpl -0x34(%rbp), %ebx
jge 0x3ec7
movl -0x44(%rbp), %edx
movl $0x1000, %r8d           # imm = 0x1000
movl -0x30(%rbp), %edi
xorl %esi, %esi
xorl %ecx, %ecx
movl %r15d, %r9d
callq 0x20b0
cmpl $-0x1, %eax
je 0x3ef8
movl -0x48(%rbp), %edi
movslq %eax, %r8
xorl %esi, %esi
movl -0x2c(%rbp), %edx
xorl %ecx, %ecx
movl %r15d, %r9d
callq 0x20b0
cmpl $-0x1, %eax
je 0x3ef8
addl %eax, %ebx
addl %eax, %r12d
movl %r12d, %eax
subl %r14d, %eax
cmpl %r13d, %eax
jl 0x3e3c
cvtsi2sd %r12d, %xmm0
divsd -0x40(%rbp), %xmm0
mulsd 0x130e(%rip), %xmm0     # 0x51b0
leaq 0x131b(%rip), %rdi      # 0x51c4
movb $0x1, %al
callq 0x2030
movq 0x3109(%rip), %rax      # 0x6fc0
movq (%rax), %rdi
callq 0x21a0
movl %r12d, %r14d
jmp 0x3e3c
cvtsi2sd %r12d, %xmm0
divsd -0x40(%rbp), %xmm0
mulsd 0x12d7(%rip), %xmm0     # 0x51b0
leaq 0x12f6(%rip), %rdi      # 0x51d6
movb $0x1, %al
callq 0x2030
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x12be(%rip), %rdi      # 0x51bd
jmp 0x3f08
leaq 0x12b0(%rip), %rdi      # 0x51b8
callq 0x2130
pushq $-0x1
popq %rax
jmp 0x3ee9
nop
// File: /workspace/github_c_makefile_star2_O2/sprt[P]lossless-transport/src/sender.c
// Function: get_timeout
uint32_t get_timeout(void) {
	/* Select waits until either the socket is ready for reading or the
	 * timeout expires. If the window is full or if we've reached EOF on the
	 * file, we can't write any more data right now and we should block,
	 * albeit at *most* until the closest timer in the window expires. */
	if ((window_full(w) && !window_empty(w)) || sent_eof) {
		uint32_t timer = pkt_get_timestamp(window_peek_min_timestamp(w));
		uint32_t now = get_monotime();
		/* select doesn't like negative timeouts, and we can't return
		 * a negative number through an unsigned type anyway */
		if (timer > now) {
			return timer - now;
		}
	}
	return 0;
}

// Assembly:
pushq %rbx
movq 0x4504(%rip), %rdi      # 0x6560
callq 0x1e39
testb %al, %al
je 0x2075
movq 0x44f4(%rip), %rdi      # 0x6560
callq 0x1e61
testb %al, %al
je 0x207e
cmpb $0x1, 0x44ec(%rip)      # 0x6568
jne 0x209d
movq 0x44db(%rip), %rdi      # 0x6560
callq 0x1fb1
movq %rax, %rdi
callq 0x1593
movl %eax, %ebx
callq 0x1bd1
subl %eax, %ebx
ja 0x209f
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/sprt[P]lossless-transport/src/sender.c
// Function: handle_ack
void handle_ack(pkt_t *ack) {
	/* The seqnum field has the next sequence number expected by the receiver.
	 * The timestamp field corresponds to the last packet received by the receiver. */

	/* Whether the packet with the given timestamp has been popped from the buffer. */
	bool popped_timestamp = false;

	/* ACKs are cumulative so we can remove from the buffer all packets that
	 * have a smaller sequence number. */
	pkt_t *min_seqnum = window_peek_min_seqnum(w);
	while (min_seqnum != NULL && pkt_get_seqnum(min_seqnum) < pkt_get_seqnum(ack)) {
		assert(window_pop_min_seqnum(w) == min_seqnum);
		log_msg("Removed packet #%d from buffer\n", pkt_get_seqnum(min_seqnum));

		if (pkt_get_timestamp(min_seqnum) == pkt_get_timestamp(ack)) {
			popped_timestamp = true;
		}

		pkt_del(min_seqnum);
		min_seqnum = window_peek_min_seqnum(w);
	}

	window_slide_to(w, pkt_get_seqnum(ack));

	if (!popped_timestamp) {
		pkt_t *last = window_pop_timestamp(w, pkt_get_timestamp(ack));
		if (last == NULL) {
			log_msg("No packet with matching timestamp in buffer\n");
		} else {
			log_msg("Acking packet #%d from timestamp field, removed from buffer\n",
				pkt_get_seqnum(last));
		}
		pkt_del(last);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
xorl %r12d, %r12d
leaq 0x11a1(%rip), %r14      # 0x3259
movq 0x44a1(%rip), %rdi      # 0x6560
callq 0x2027
testq %rax, %rax
je 0x2131
movq %rax, %r15
movq %rax, %rdi
callq 0x158f
movl %eax, %ebp
movq %rbx, %rdi
callq 0x158f
cmpb %al, %bpl
jae 0x2131
movq 0x4476(%rip), %rdi      # 0x6560
callq 0x203e
cmpq %r15, %rax
jne 0x21b4
movq %r15, %rdi
callq 0x158f
movzbl %al, %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x170e
movq %r15, %rdi
callq 0x1593
movl %eax, %ebp
movq %rbx, %rdi
callq 0x1593
cmpl %eax, %ebp
sete %al
orb %al, %r12b
movq %r15, %rdi
callq 0x1319
jmp 0x20b8
movq 0x4428(%rip), %r14      # 0x6560
movq %rbx, %rdi
callq 0x158f
movzbl %al, %esi
movq %r14, %rdi
callq 0x1d5d
testb $0x1, %r12b
je 0x215a
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x43ff(%rip), %r14      # 0x6560
movq %rbx, %rdi
callq 0x1593
movq %r14, %rdi
movl %eax, %esi
callq 0x1f20
movq %rax, %rbx
testq %rax, %rax
je 0x2196
movq %rbx, %rdi
callq 0x158f
movzbl %al, %esi
leaq 0x1119(%rip), %rdi      # 0x32a6
xorl %eax, %eax
callq 0x170e
jmp 0x21a4
leaq 0x10dc(%rip), %rdi      # 0x3279
xorl %eax, %eax
callq 0x170e
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1319
leaq 0x1051(%rip), %rdi      # 0x320c
leaq 0x1071(%rip), %rsi      # 0x3233
leaq 0x1077(%rip), %rcx      # 0x3240
pushq $0x39
popq %rdx
callq 0x10e0
// File: /workspace/github_c_makefile_star2_O2/sprt[P]lossless-transport/src/sender.c
// Function: handle_nack
void handle_nack(pkt_t *nack) {
	if (!window_has(w, pkt_get_seqnum(nack))) {
		log_msg("Out of window, ignoring\n");
		return;
	}

	pkt_t *match = window_find_seqnum(w, pkt_get_seqnum(nack));
	if (match == NULL) {
		log_msg("No packet with matching seqnum in buffer\n");
		return;
	}

	/* Set the timer of the corresponding packet to the current time
	 * so that it will be resent immediately (retransmit_packets calls
	 * get_monotime after this). */
	pkt_set_timestamp(match, get_monotime());
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x4381(%rip), %r14      # 0x6560
callq 0x158f
movzbl %al, %esi
movq %r14, %rdi
callq 0x1d85
testb %al, %al
je 0x222b
movq 0x4366(%rip), %r14      # 0x6560
movq %rbx, %rdi
callq 0x158f
movzbl %al, %esi
movq %r14, %rdi
callq 0x1e6a
testq %rax, %rax
je 0x2234
movq %rax, %rbx
callq 0x1bd1
movq %rbx, %rdi
movl %eax, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1645
leaq 0x10b1(%rip), %rdi      # 0x32e3
jmp 0x223b
leaq 0x10c1(%rip), %rdi      # 0x32fc
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x170e
// File: /workspace/github_c_makefile_star2_O2/sprt[P]lossless-transport/src/sender.c
// Function: retransmit_packets
void retransmit_packets(void) {
	uint32_t loop_now = get_monotime();
	pkt_t *pkt = window_peek_min_timestamp(w);

	while (pkt != NULL && pkt_get_timestamp(pkt) <= loop_now) {
		/* Don't put this outside the loop! Would defeat its purpose. */
		uint32_t now = get_monotime();

		/* Reschedule the retransmission of the packet in case it fails again */
		if (window_update_timestamp(w, pkt_get_timestamp(pkt), now + TIMER) == -1) {
			exit_msg("Cannot update timestamp of packet\n");
		}

		/* Resend it now */
		if (send_packet(sockfd, pkt) == -1) {
			exit_perror("send");
		}

		/* The packet was in the buffer already so nothing else to do */

		log_msg("> RETR %s\n", pkt_repr(pkt));
		pkt = window_peek_min_timestamp(w);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x1bd1
movl %eax, %ebx
leaq 0x10e7(%rip), %r15      # 0x3349
leaq 0x10e5(%rip), %r12      # 0x334e
movq 0x42f0(%rip), %rdi      # 0x6560
callq 0x1fb1
testq %rax, %rax
je 0x22f9
movq %rax, %r13
movq %rax, %rdi
callq 0x1593
cmpl %ebx, %eax
ja 0x22f9
callq 0x1bd1
movl %eax, %ebp
movq 0x42c9(%rip), %r14      # 0x6560
movq %r13, %rdi
callq 0x1593
addl $0x44aa20, %ebp         # imm = 0x44AA20
movq %r14, %rdi
movl %eax, %esi
movl %ebp, %edx
callq 0x1ea5
cmpl $-0x1, %eax
jne 0x22c4
leaq 0x1069(%rip), %rdi      # 0x3326
xorl %eax, %eax
callq 0x17c3
movl 0x3e4e(%rip), %edi      # 0x6118
movq %r13, %rsi
callq 0x1b7d
cmpl $-0x1, %eax
jne 0x22df
movq %r15, %rdi
callq 0x1863
movq %r13, %rdi
callq 0x18cb
movq %r12, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x170e
jmp 0x2269
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/sprt[P]lossless-transport/src/sender.c
// Function: main
int main(int argc, char **argv) {
	parse_args(argc, argv, &hostname, &port, &filename);

	/* Initial window assumed to be 1, will be updated on ACKs */
	w = window_create(1, MAX_WINDOW_SIZE, 255);
	if (w == NULL) {
		exit_msg("Could not create window\n");
	}

	struct sockaddr_in6 dst_addr;
	const char *err = real_address(hostname, &dst_addr);
	if (err != NULL) {
		exit_msg("real_address: %s\n", err);
	}

	/* Connect the socket. This tells the socket both to send to this
	 * address by default and to only receive from this address. */
	sockfd = create_socket(NULL, -1, &dst_addr, port);
	if (sockfd == -1) {
		exit_msg("Could not create socket\n");
	}

	if (filename == NULL) {
		infile = stdin;
	} else {
		infile = fopen(filename, "rb");
		if (infile == NULL) {
			exit_perror("fopen");
		}
	}

	/* If we haven't sent the EOF packet, we still have data to read.
	 * If the window isn't empty, there are still unacknowledged packets
	 * that we'll potentially have to resend. */
	while (!sent_eof || !window_empty(w)) {
		/* This is probably the line you're looking for */
		main_loop();
	}

	log_msg("EOF acknowledged, quitting\n");

	window_free(w);
	fclose(infile);

	return 0;
}

// Assembly:
subq $0x28, %rsp
leaq 0x3d14(%rip), %rdx      # 0x6578
leaq 0x3d15(%rip), %rcx      # 0x6580
leaq 0x3d16(%rip), %r8       # 0x6588
callq 0x198c
pushq $0x1
popq %rdi
pushq $0x1f
popq %rsi
movl $0xff, %edx
callq 0x1cbc
movq %rax, 0x3cd2(%rip)      # 0x6560
testq %rax, %rax
jne 0x28a1
leaq 0xcc2(%rip), %rdi       # 0x355c
xorl %eax, %eax
callq 0x17c3
movq 0x3cd0(%rip), %rdi      # 0x6578
leaq 0xc(%rsp), %rsi
callq 0x1a60
testq %rax, %rax
je 0x28c8
leaq 0xcb7(%rip), %rdi       # 0x3575
movq %rax, %rsi
xorl %eax, %eax
callq 0x17c3
movzwl 0x3cb1(%rip), %ecx      # 0x6580
pushq $-0x1
popq %rsi
leaq 0xc(%rsp), %rdx
xorl %edi, %edi
callq 0x1ad5
movl %eax, 0x3834(%rip)      # 0x6118
cmpl $-0x1, %eax
jne 0x28f7
leaq 0xc97(%rip), %rdi       # 0x3587
xorl %eax, %eax
callq 0x17c3
movq 0x3c8a(%rip), %rdi      # 0x6588
testq %rdi, %rdi
je 0x2929
leaq 0xc96(%rip), %rsi       # 0x35a0
callq 0x1150
movq %rax, 0x3c5a(%rip)      # 0x6570
testq %rax, %rax
jne 0x2941
leaq 0xc81(%rip), %rdi       # 0x35a3
callq 0x1863
jmp 0x2941
movq 0x3698(%rip), %rax      # 0x5fc8
movq (%rax), %rax
movq %rax, 0x3c36(%rip)      # 0x6570
jmp 0x2941
callq 0x2308
cmpb $0x1, 0x3c20(%rip)      # 0x6568
jne 0x293c
movq 0x3c0f(%rip), %rdi      # 0x6560
callq 0x1e61
testb %al, %al
je 0x293c
leaq 0xc48(%rip), %rdi       # 0x35a9
xorl %eax, %eax
callq 0x170e
movq 0x3bf1(%rip), %rdi      # 0x6560
callq 0x1cf7
movq 0x3bf5(%rip), %rdi      # 0x6570
callq 0x10b0
xorl %eax, %eax
addq $0x28, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/mikecat[P]x86_interpreter/x86_interpreter.c
// Function: print_regs
void print_regs(FILE* fp) {
	fprintf(fp, "   EAX:%08"PRIx32" EBX:%08"PRIx32" ECX:%08"PRIx32" EDX:%08"PRIx32"\n",
		regs[EAX], regs[EBX], regs[ECX], regs[EDX]);
	fprintf(fp, "   ESI:%08"PRIx32" EDI:%08"PRIx32" ESP:%08"PRIx32" EBP:%08"PRIx32"\n",
		regs[ESI], regs[EDI], regs[ESP], regs[EBP]);
	fprintf(fp, "   EIP:%08"PRIx32"\n", eip);
	fprintf(fp, "EFLAGS:%08"PRIx32
		" (CF[%c] PF[%c] AF[%c] ZF[%c] SF[%c] IF[%c] DF[%c] OF[%c])\n", eflags,
		eflags & CF ? 'x' : ' ', eflags & PF ? 'x' : ' ', eflags & AF ? 'x' : ' ',
		eflags & ZF ? 'x' : ' ', eflags & SF ? 'x' : ' ', eflags & IF ? 'x' : ' ',
		eflags & DF ? 'x' : ' ', eflags & OF ? 'x' : ' ');
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x10e43(%rip), %edx     # 0x12100
movl 0x10e49(%rip), %ecx     # 0x1210c
movl 0x10e3a(%rip), %r8d     # 0x12104
movl 0x10e37(%rip), %r9d     # 0x12108
leaq 0xb064(%rip), %rsi      # 0xc33c
xorl %eax, %eax
callq 0x10d0
movl 0x10e33(%rip), %edx     # 0x12118
movl 0x10e31(%rip), %ecx     # 0x1211c
movl 0x10e1e(%rip), %r8d     # 0x12110
movl 0x10e1b(%rip), %r9d     # 0x12114
leaq 0xb064(%rip), %rsi      # 0xc364
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10d0
movl 0x10e10(%rip), %edx     # 0x12120
leaq 0xb075(%rip), %rsi      # 0xc38c
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10d0
movl 0x10dfd(%rip), %edx     # 0x12124
movd %edx, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa 0xacd8(%rip), %xmm1     # 0xc010
pand %xmm0, %xmm1
pand 0xacdc(%rip), %xmm0     # 0xc020
pxor %xmm2, %xmm2
pcmpeqd %xmm2, %xmm0
pcmpeqd %xmm2, %xmm1
packssdw %xmm0, %xmm1
packsswb %xmm1, %xmm1
pmovmskb %xmm1, %eax
testb $-0x80, %al
pushq $0x20
popq %rsi
pushq $0x78
popq %r11
movl %r11d, %ecx
cmovnel %esi, %ecx
testb $0x40, %al
movl %r11d, %r8d
cmovnel %esi, %r8d
testb $0x20, %al
movl %r11d, %r9d
cmovnel %esi, %r9d
testb $0x10, %al
movl %r11d, %r10d
cmovnel %esi, %r10d
testb $0x8, %al
movl %r11d, %r14d
cmovnel %esi, %r14d
testb $0x4, %al
movl %r11d, %r15d
cmovnel %esi, %r15d
testb $0x2, %al
movl %r11d, %r12d
cmovnel %esi, %r12d
testb $0x1, %al
cmovnel %esi, %r11d
subq $0x8, %rsp
leaq 0xafe7(%rip), %rsi      # 0xc399
movq %rbx, %rdi
xorl %eax, %eax
pushq %r11
pushq %r12
pushq %r15
pushq %r14
pushq %r10
callq 0x10d0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/mikecat[P]x86_interpreter/x86_interpreter.c
// Function: memory_access
int memory_access(uint8_t* data_read, uint32_t addr, uint8_t data, int we) {
	if (dmemory_is_allocated(addr, 1)) {
		if (we) dmemory_write(&data, addr, 1);
		dmemory_read(data_read, addr, 1);
		return 1;
	} else {
		return 0;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %r15d
movl %esi, %ebp
movq %rdi, %r14
movb %dl, 0x7(%rsp)
pushq $0x1
popq %rbx
movl %esi, %edi
movl %ebx, %esi
callq 0x606d
testl %eax, %eax
je 0x1417
testl %r15d, %r15d
je 0x1409
leaq 0x7(%rsp), %rdi
pushq $0x1
popq %rdx
movl %ebp, %esi
callq 0x5d3e
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0x5bd0
jmp 0x1419
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/mikecat[P]x86_interpreter/x86_interpreter.c
// Function: step_memread
static uint32_t step_memread(int* success, uint32_t inst_addr, int segment, uint32_t addr, int size) {
	uint32_t res = 0;
	int i;
	if (UINT32_MAX - segment_offsets[segment] < addr ||
	(size <= 0 || UINT32_MAX - (segment_offsets[segment] + addr) < (uint32_t)(size - 1))) {
		*success = 0;
		return 0;
	}
	for (i = 0; i < size; i++) {
		uint32_t this_addr = segment_offsets[segment] + addr + i;
		uint8_t value;
		if (!memory_access(&value, this_addr, 0, 0)) {
			fprintf(stderr, "failed to read memory %08"PRIx32" at %08"PRIx32"\n\n", this_addr, inst_addr);
			print_regs(stderr);
			*success = 0;
			return 0;
		}
		res |= value << (i * 8);
	}
	if (size < 4) {
		if (res & (UINT32_C(0x80) << ((size - 1) * 8))) {
			res |= UINT32_C(0xffffffff) << (size * 8);
		} else {
			res &= UINT32_C(0xffffffff) >> ((4 - size) * 8);
		}
	}
	*success = 1;
	return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movslq %edx, %rbx
leaq 0xd09b(%rip), %rax      # 0x12150
movl (%rax,%rbx,4), %eax
movq %rcx, 0x20(%rsp)
addl %ecx, %eax
setb %cl
testl %r8d, %r8d
setle %dl
orb %cl, %dl
jne 0x50d8
movl %r8d, %r12d
leal -0x1(%r12), %ecx
addl %ecx, %eax
jae 0x50e2
andl $0x0, (%rdi)
xorl %ebp, %ebp
jmp 0x517b
movl %ecx, 0x1c(%rsp)
movl %esi, 0x18(%rsp)
movq %rdi, 0x10(%rsp)
xorl %r15d, %r15d
xorl %ebp, %ebp
xorl %r14d, %r14d
cmpl %r14d, %r12d
je 0x513a
movq 0x20(%rsp), %rax
leal (%rax,%r14), %r13d
leaq 0xd044(%rip), %rax      # 0x12150
addl (%rax,%rbx,4), %r13d
leaq 0xf(%rsp), %rdi
movl %r13d, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x13d2
testl %eax, %eax
je 0x518c
movzbl 0xf(%rsp), %eax
movl %r15d, %ecx
shll %cl, %eax
orl %eax, %ebp
incl %r14d
addl $0x8, %r15d
jmp 0x50f7
cmpl $0x3, %r12d
jg 0x5164
movl 0x1c(%rsp), %ecx
shll $0x3, %ecx
movl %ebp, %eax
shrl %cl, %eax
shll $0x3, %r12d
testb %al, %al
movq 0x10(%rsp), %rdx
jns 0x516b
pushq $-0x1
popq %rax
movl %r12d, %ecx
shll %cl, %eax
orl %eax, %ebp
jmp 0x5175
movq 0x10(%rsp), %rdx
jmp 0x5175
negb %r12b
movl %r12d, %ecx
shll %cl, %ebp
shrl %cl, %ebp
movl $0x1, (%rdx)
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xce65(%rip), %rbx      # 0x11ff8
movq (%rbx), %rdi
leaq 0x7995(%rip), %rsi      # 0xcb32
xorl %ebp, %ebp
movl %r13d, %edx
movl 0x18(%rsp), %ecx
xorl %eax, %eax
callq 0x10d0
movq (%rbx), %rdi
callq 0x12ac
movq 0x10(%rsp), %rax
andl $0x0, (%rax)
jmp 0x517b