LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/xiaowenhuyuehu[P]remote_access/src/core/net_protocol.c
// Function: sda_gen_payload_msg
char *sda_gen_payload_msg(int code, char *data, char *msg)
{
    static char _msg[DEFAULT_MSG_HDR_LEN] = {0};

    memset(_msg, 0, sizeof(_msg));
    snprintf(_msg, sizeof(_msg) - 1, MSG_RESPONSE_FMT, code, !msg ? "null" : msg, !data ? "null" : data);
    
    return _msg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq 0x65c6(%rip), %rdi      # 0xf7d0
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x2090
movl -0x4(%rbp), %eax
movl %eax, -0x1c(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x9230
leaq 0x2af0(%rip), %rax      # 0xbd1a
movq %rax, -0x28(%rbp)
jmp 0x9238
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x9254
leaq 0x2acc(%rip), %rax      # 0xbd1a
movq %rax, -0x38(%rbp)
jmp 0x925c
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %r8
movl -0x1c(%rbp), %ecx
movq -0x38(%rbp), %r9
leaq 0x6562(%rip), %rdi      # 0xf7d0
movl $0x3ff, %esi            # imm = 0x3FF
leaq 0x2b44(%rip), %rdx      # 0xbdbe
movb $0x0, %al
callq 0x20b0
leaq 0x6548(%rip), %rax      # 0xf7d0
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/xiaowenhuyuehu[P]remote_access/src/core/net_protocol.c
// Function: sda_gen_handshake_msg
char *sda_gen_handshake_msg(char *pk, char *dn, char *ds)
{
    static char msg[DEFAULT_MSG_HDR_LEN] = {0};
    char ipaddr[256] = {0};

    //FIXME
    //get_dev_ip(ipaddr, sizeof(ipaddr));

    memset(msg,0,sizeof(msg));
    snprintf(msg, sizeof(msg), MSG_HDSK_FMT, 
                    g_uuid, pk, dn, "v2.0", 
                    ipaddr, "", "", calc_sign(g_uuid, dn, pk, ds));

    return msg; 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
leaq -0x120(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x2090
leaq 0x690e(%rip), %rdi      # 0xfbd0
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x2090
movq 0x606b(%rip), %rax      # 0xf340
movq %rax, -0x140(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x130(%rbp)
leaq -0x120(%rbp), %rax
movq %rax, -0x128(%rbp)
movq 0x6039(%rip), %rdi      # 0xf340
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x9390
movq -0x140(%rbp), %rcx
movq -0x138(%rbp), %r8
movq -0x130(%rbp), %r9
movq -0x128(%rbp), %r11
leaq 0x6895(%rip), %rdi      # 0xfbd0
movl $0x400, %esi            # imm = 0x400
leaq 0x2a9b(%rip), %rdx      # 0xbde2
leaq 0x2b41(%rip), %rbx      # 0xbe8f
leaq 0x20e0(%rip), %r10      # 0xb435
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movb $0x0, %al
callq 0x20b0
leaq 0x6855(%rip), %rax      # 0xfbd0
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/xiaowenhuyuehu[P]remote_access/src/core/net_protocol.c
// Function: calc_sign
static char *calc_sign(char *uuid, char *dn, char *pk, char *ds)
{
    static char *format = "clientId%sdeviceName%sproductKey%stimestamp%lu";
    static unsigned char msg[DEFAULT_MSG_HDR_LEN] = {0};
    uint8_t mac[HMAC_SHA256_BYTES];
    static char ret[DEFAULT_MSG_HDR_LEN] = {0};

    memset(msg, 0, sizeof(msg));
    memset(mac, 0, sizeof(mac));
    memset(ret, 0, sizeof(ret));

    snprintf((char *)msg, sizeof(msg), format, uuid, dn, pk, time(NULL));
    log_debug("sign string is :  %s", msg);
    hmac_sha256(mac, msg, strlen((char *)msg), (unsigned char *)ds, strlen((char *)ds) + 1);
    int j = 0; 
    for (j = 0; j < HMAC_SHA256_BYTES; j++)
        sprintf(ret + strlen(ret), "%02x", mac[j]);
    
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
leaq 0x6c1e(%rip), %rdi      # 0xffd0
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x2090
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x2090
leaq 0x6ffb(%rip), %rdi      # 0x103d0
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x2090
movq 0x5f60(%rip), %rax      # 0xf348
movq %rax, -0x80(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x68(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x25b0
movq -0x80(%rbp), %rdx
movq -0x78(%rbp), %rcx
movq -0x70(%rbp), %r8
movq -0x68(%rbp), %r9
leaq 0x6bac(%rip), %rdi      # 0xffd0
movl $0x400, %esi            # imm = 0x400
movq %rax, (%rsp)
movb $0x0, %al
callq 0x20b0
xorl %edi, %edi
leaq 0x1bc7(%rip), %rsi      # 0xb004
leaq 0x2953(%rip), %rdx      # 0xbd97
movl $0x2c, %ecx
leaq 0x2a7f(%rip), %r8       # 0xbecf
leaq 0x6b79(%rip), %r9       # 0xffd0
movb $0x0, %al
callq 0x4f90
leaq -0x40(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq 0x6b63(%rip), %rdi      # 0xffd0
callq 0x2260
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2260
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rdx
movq -0x50(%rbp), %rcx
movq %rax, %r8
addq $0x1, %r8
leaq 0x6b2f(%rip), %rsi      # 0xffd0
callq 0x51a0
movl $0x0, -0x44(%rbp)
movl $0x0, -0x44(%rbp)
cmpl $0x20, -0x44(%rbp)
jge 0x94f2
leaq 0x6f0f(%rip), %rdi      # 0x103d0
callq 0x2260
leaq 0x6f03(%rip), %rdi      # 0x103d0
addq %rax, %rdi
movslq -0x44(%rbp), %rax
movzbl -0x40(%rbp,%rax), %edx
leaq 0x2a04(%rip), %rsi      # 0xbee4
movb $0x0, %al
callq 0x22c0
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x94b4
leaq 0x6ed7(%rip), %rax      # 0x103d0
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/xiaowenhuyuehu[P]remote_access/src/core/config_manager.c
// Function: deinit_cfg
void deinit_cfg()
{
	if(g_cfg == NULL)
		return;

	free(g_cfg->cloud_ip);
	free(g_cfg->cloud_port);
	free(g_cfg->cert_path);
	if(g_cfg->pk)
		free(g_cfg->pk);
	if(g_cfg->dn)
		free(g_cfg->dn);
	if(g_cfg->ds)
		free(g_cfg->ds);

    free(g_cfg);
    g_cfg = NULL;
	log_info("deinit cfg ok.");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpq $0x0, 0x68a4(%rip)      # 0x107d0
jne 0x9f33
jmp 0x9ff9
movq 0x6896(%rip), %rax      # 0x107d0
movq (%rax), %rdi
callq 0x2240
movq 0x6887(%rip), %rax      # 0x107d0
movq 0x8(%rax), %rdi
callq 0x2240
movq 0x6877(%rip), %rax      # 0x107d0
movq 0x10(%rax), %rdi
callq 0x2240
movq 0x6867(%rip), %rax      # 0x107d0
cmpq $0x0, 0x18(%rax)
je 0x9f80
movq 0x6859(%rip), %rax      # 0x107d0
movq 0x18(%rax), %rdi
callq 0x2240
movq 0x6849(%rip), %rax      # 0x107d0
cmpq $0x0, 0x20(%rax)
je 0x9f9e
movq 0x683b(%rip), %rax      # 0x107d0
movq 0x20(%rax), %rdi
callq 0x2240
movq 0x682b(%rip), %rax      # 0x107d0
cmpq $0x0, 0x28(%rax)
je 0x9fbc
movq 0x681d(%rip), %rax      # 0x107d0
movq 0x28(%rax), %rdi
callq 0x2240
movq 0x680d(%rip), %rdi      # 0x107d0
callq 0x2240
movq $0x0, 0x67fd(%rip) # 0x107d0
movl $0x1, %edi
leaq 0x165a(%rip), %rsi      # 0xb639
leaq 0x1f09(%rip), %rdx      # 0xbeef
movl $0xdd, %ecx
leaq 0x200c(%rip), %r8       # 0xbffe
movb $0x0, %al
callq 0x4f90
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/xiaowenhuyuehu[P]remote_access/src/core/config_manager.c
// Function: get_current_work_dir
static char *_get_current_work_dir()
{
	char *buff = NULL;
    char *tmp = NULL;
	
	buff = malloc(FILENAME_MAX);
	if(buff == NULL){
        log_error("faild to alloc memory to save abs path ");
		exit(1);
	}
	memset(buff, 0, FILENAME_MAX);
#ifdef __APPLE__
  uint32_t size = FILENAME_MAX;
  if (_NSGetExecutablePath(buff, &size) != 0) {
    // Buffer size is too small.
    log_error("faild to get current directory");
    exit(1);
  }
  log_info("current directory: %s\n", buff);

  tmp = strrchr(buff, '/');
  if(tmp){
      if(buff[tmp - buff - 1] == '.')
          buff[tmp - buff - 1] = '\0';
      else
          buff[tmp - buff] = '\0';
  }
#else     
    int read_len = 0;
    read_len = readlink("/proc/self/exe", buff, FILENAME_MAX - 1);
    if(read_len <= 0){
        log_error("faild to read /proc ");
        exit(1);
    }
    buff[read_len] = '\0';

    tmp = strrchr(buff, '/');
    if(tmp){
        buff[tmp - buff] = '\0';
    }
#endif    
	return buff;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq $0x0, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movl $0x1000, %edi           # imm = 0x1000
callq 0x2140
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0xa05d
movl $0x3, %edi
leaq 0x15a7(%rip), %rsi      # 0xb5e0
leaq 0x1eaf(%rip), %rdx      # 0xbeef
movl $0x5d, %ecx
leaq 0x1fc1(%rip), %r8       # 0xc00d
movb $0x0, %al
callq 0x4f90
movl $0x1, %edi
callq 0x2100
movq -0x8(%rbp), %rdi
xorl %esi, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x2090
movl $0x0, -0x14(%rbp)
movq -0x8(%rbp), %rsi
leaq 0x1fb6(%rip), %rdi      # 0xc035
movl $0xfff, %edx            # imm = 0xFFF
callq 0x2350
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jg 0xa0c2
movl $0x3, %edi
leaq 0x1542(%rip), %rsi      # 0xb5e0
leaq 0x1e4a(%rip), %rdx      # 0xbeef
movl $0x75, %ecx
leaq 0x1f93(%rip), %r8       # 0xc044
movb $0x0, %al
callq 0x4f90
movl $0x1, %edi
callq 0x2100
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x8(%rbp), %rdi
movl $0x2f, %esi
callq 0x22e0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xa0fa
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rdx
subq %rdx, %rcx
movb $0x0, (%rax,%rcx)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/xiaowenhuyuehu[P]remote_access/src/core/config_manager.c
// Function: dump_cfg
static void _dump_cfg()
{
	if(g_cfg == NULL)
		return;

	log_info("cloud ip: %s", g_cfg->cloud_ip);
	log_info("cloud port: %s", g_cfg->cloud_port);
	log_info("cert path: %s", g_cfg->cert_path);
	log_info("tls switch: %d", g_cfg->is_tls_on);
	log_info("listen ip: %s", g_cfg->listen_ip);
	log_info("listen port: %d", g_cfg->listen_port);
	if(g_cfg->pk)
		log_info("product key: %s", g_cfg->pk);
	if(g_cfg->dn)
		log_info("device name: %s", g_cfg->dn);
	if(g_cfg->ds)
		log_info("device secret: **********%s", g_cfg->ds + 10);//just print the last 22 character
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpq $0x0, 0x66b4(%rip)      # 0x107d0
jne 0xa123
jmp 0xa30a
movq 0x66a6(%rip), %rax      # 0x107d0
movq (%rax), %r9
movl $0x1, %edi
leaq 0x1500(%rip), %rsi      # 0xb639
leaq 0x1daf(%rip), %rdx      # 0xbeef
movl $0xf, %ecx
leaq 0x1fbe(%rip), %r8       # 0xc10a
movb $0x0, %al
callq 0x4f90
movq 0x6676(%rip), %rax      # 0x107d0
movq 0x8(%rax), %r9
movl $0x1, %edi
leaq 0x14cf(%rip), %rsi      # 0xb639
leaq 0x1d7e(%rip), %rdx      # 0xbeef
movl $0x10, %ecx
leaq 0x1f9a(%rip), %r8       # 0xc117
movb $0x0, %al
callq 0x4f90
movq 0x6645(%rip), %rax      # 0x107d0
movq 0x10(%rax), %r9
movl $0x1, %edi
leaq 0x149e(%rip), %rsi      # 0xb639
leaq 0x1d4d(%rip), %rdx      # 0xbeef
movl $0x11, %ecx
leaq 0x1f78(%rip), %r8       # 0xc126
movb $0x0, %al
callq 0x4f90
movq 0x6614(%rip), %rax      # 0x107d0
movzbl 0x3c(%rax), %r9d
movl $0x1, %edi
leaq 0x146c(%rip), %rsi      # 0xb639
leaq 0x1d1b(%rip), %rdx      # 0xbeef
movl $0x12, %ecx
leaq 0x1f54(%rip), %r8       # 0xc134
movb $0x0, %al
callq 0x4f90
movq 0x65e2(%rip), %rax      # 0x107d0
movq 0x30(%rax), %r9
movl $0x1, %edi
leaq 0x143b(%rip), %rsi      # 0xb639
leaq 0x1cea(%rip), %rdx      # 0xbeef
movl $0x13, %ecx
leaq 0x1f32(%rip), %r8       # 0xc143
movb $0x0, %al
callq 0x4f90
movq 0x65b1(%rip), %rax      # 0x107d0
movl 0x38(%rax), %r9d
movl $0x1, %edi
leaq 0x140a(%rip), %rsi      # 0xb639
leaq 0x1cb9(%rip), %rdx      # 0xbeef
movl $0x14, %ecx
leaq 0x1f0f(%rip), %r8       # 0xc151
movb $0x0, %al
callq 0x4f90
movq 0x6580(%rip), %rax      # 0x107d0
cmpq $0x0, 0x18(%rax)
je 0xa288
movq 0x6572(%rip), %rax      # 0x107d0
movq 0x18(%rax), %r9
movl $0x1, %edi
leaq 0x13cb(%rip), %rsi      # 0xb639
leaq 0x1c7a(%rip), %rdx      # 0xbeef
movl $0x16, %ecx
leaq 0x1ee0(%rip), %r8       # 0xc161
movb $0x0, %al
callq 0x4f90
movq 0x6541(%rip), %rax      # 0x107d0
cmpq $0x0, 0x20(%rax)
je 0xa2c7
movq 0x6533(%rip), %rax      # 0x107d0
movq 0x20(%rax), %r9
movl $0x1, %edi
leaq 0x138c(%rip), %rsi      # 0xb639
leaq 0x1c3b(%rip), %rdx      # 0xbeef
movl $0x18, %ecx
leaq 0x1eb1(%rip), %r8       # 0xc171
movb $0x0, %al
callq 0x4f90
movq 0x6502(%rip), %rax      # 0x107d0
cmpq $0x0, 0x28(%rax)
je 0xa30a
movq 0x64f4(%rip), %rax      # 0x107d0
movq 0x28(%rax), %r9
addq $0xa, %r9
movl $0x1, %edi
leaq 0x1349(%rip), %rsi      # 0xb639
leaq 0x1bf8(%rip), %rdx      # 0xbeef
movl $0x1a, %ecx
leaq 0x1e7e(%rip), %r8       # 0xc181
movb $0x0, %al
callq 0x4f90
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/xiaowenhuyuehu[P]remote_access/src/core/session_mgr.c
// Function: init_session_system
int init_session_system()
{
    if(g_ht != NULL)
        return 0;

    g_ht = ht_init(DEFAULT_SESSION_COUNT * 3);
    if(g_ht == NULL){
        log_error("failed to init session system: %s", strerror(errno)); 
        return -1;
    }
    g_session_count = 0;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
cmpq $0x0, 0x64b8(%rip)      # 0x107d8
je 0xa32b
movl $0x0, -0x4(%rbp)
jmp 0xa395
movl $0x60, %edi
callq 0x4420
movq %rax, 0x649c(%rip)      # 0x107d8
cmpq $0x0, 0x6494(%rip)      # 0x107d8
jne 0xa384
callq 0x23e0
movl (%rax), %edi
callq 0x2320
movq %rax, %r9
movl $0x3, %edi
leaq 0x127f(%rip), %rsi      # 0xb5e0
leaq 0x1e35(%rip), %rdx      # 0xc19d
movl $0x1b, %ecx
leaq 0x1e40(%rip), %r8       # 0xc1b4
movb $0x0, %al
callq 0x4f90
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa395
movl $0x0, 0x6452(%rip)      # 0x107e0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/xiaowenhuyuehu[P]remote_access/src/core/session_mgr.c
// Function: deinit_session_system
void deinit_session_system()
{
    if(g_ht == NULL)
        return;
    ht_destroy(g_ht);
    g_session_count = 0;
    g_ht = NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpq $0x0, 0x642c(%rip)      # 0x107d8
jne 0xa3b0
jmp 0xa3d1
movq 0x6421(%rip), %rdi      # 0x107d8
callq 0x4e40
movl $0x0, 0x641a(%rip)      # 0x107e0
movq $0x0, 0x6407(%rip) # 0x107d8
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/xiaowenhuyuehu[P]remote_access/src/core/session_mgr.c
// Function: get_timestamp_by_session_id
int _get_timestamp_by_session_id(char *session_id)
{
    SESSION_ITEM  *item = NULL; 
    
    if(g_ht == NULL || session_id == NULL){
        log_error("session system is not ready, please retry ");
        return -1;
    }

    item = ht_find(g_ht, session_id, DEFAULT_SESSION_LEN, NULL, NULL);
    if(item == NULL){
        log_error("could not find socketfd for session: %s ", session_id);
        return -1;
    }
    
    return item->last_modify_time;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
cmpq $0x0, 0x618c(%rip)      # 0x107d8
je 0xa655
cmpq $0x0, -0x10(%rbp)
jne 0xa684
movl $0x3, %edi
leaq 0xf7f(%rip), %rsi       # 0xb5e0
leaq 0x1b35(%rip), %rdx      # 0xc19d
movl $0x81, %ecx
leaq 0x1b73(%rip), %r8       # 0xc1e7
movb $0x0, %al
callq 0x4f90
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa6ea
movq 0x614d(%rip), %rdi      # 0x107d8
movq -0x10(%rbp), %rsi
movl $0x40, %edx
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rcx
callq 0x46e0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xa6df
movq -0x10(%rbp), %r9
movl $0x3, %edi
leaq 0xf24(%rip), %rsi       # 0xb5e0
leaq 0x1ada(%rip), %rdx      # 0xc19d
movl $0x87, %ecx
leaq 0x1be7(%rip), %r8       # 0xc2b6
movb $0x0, %al
callq 0x4f90
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa6ea
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/xiaowenhuyuehu[P]remote_access/src/core/session_mgr.c
// Function: free_session
void free_session(char *session_id)
{
    if(g_ht == NULL){
        log_error("session system is not ready, please retry ");
        return ;
    }
    if(_get_timestamp_by_session_id(session_id) >= 0){
        ht_del_lockless(g_ht, session_id, DEFAULT_SESSION_LEN);
    
        --g_session_count;
        log_debug("current session count: %d\n", g_session_count);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, 0x60c4(%rip)      # 0x107d8
jne 0xa73e
movl $0x3, %edi
leaq 0xebe(%rip), %rsi       # 0xb5e0
leaq 0x1a74(%rip), %rdx      # 0xc19d
movl $0x91, %ecx
leaq 0x1ab2(%rip), %r8       # 0xc1e7
movb $0x0, %al
callq 0x4f90
jmp 0xa79a
movq -0x8(%rbp), %rdi
callq 0xa630
cmpl $0x0, %eax
jl 0xa79a
movq 0x6085(%rip), %rdi      # 0x107d8
movq -0x8(%rbp), %rsi
movl $0x40, %edx
callq 0x4aa0
movl 0x6079(%rip), %eax      # 0x107e0
addl $-0x1, %eax
movl %eax, 0x6070(%rip)      # 0x107e0
movl 0x6069(%rip), %r9d      # 0x107e0
xorl %edi, %edi
leaq 0x884(%rip), %rsi       # 0xb004
leaq 0x1a16(%rip), %rdx      # 0xc19d
movl $0x98, %ecx
leaq 0x1b4c(%rip), %r8       # 0xc2df
movb $0x0, %al
callq 0x4f90
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/xiaowenhuyuehu[P]remote_access/src/core/session_mgr.c
// Function: get_session_id_by_socketfd
char *get_session_id_by_socketfd(int *socketfd)
{
    char *ret = NULL;

    if(g_ht == NULL){
        log_error("session system is not ready, please retry ");
        return 0;
    }

    ret = ht_iterator_lockless(g_ht, _get_socketfd, socketfd);

    log_debug("get session id: %s by socketfd: %d\n", ret, *socketfd);
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
cmpq $0x0, 0x601c(%rip)      # 0x107d8
jne 0xa7ee
movl $0x3, %edi
leaq 0xe16(%rip), %rsi       # 0xb5e0
leaq 0x19cc(%rip), %rdx      # 0xc19d
movl $0xb0, %ecx
leaq 0x1a0a(%rip), %r8       # 0xc1e7
movb $0x0, %al
callq 0x4f90
movq $0x0, -0x8(%rbp)
jmp 0xa841
movq 0x5fe3(%rip), %rdi      # 0x107d8
movq -0x10(%rbp), %rdx
leaq 0x50(%rip), %rsi        # 0xa850
callq 0x4c80
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %r9
movq -0x10(%rbp), %rax
movl (%rax), %eax
xorl %edi, %edi
leaq 0x7e8(%rip), %rsi       # 0xb004
leaq 0x197a(%rip), %rdx      # 0xc19d
movl $0xb6, %ecx
leaq 0x1acb(%rip), %r8       # 0xc2fa
movl %eax, (%rsp)
movb $0x0, %al
callq 0x4f90
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/xiaowenhuyuehu[P]remote_access/src/core/session_mgr.c
// Function: get_socketfd
static int _get_socketfd(void *key, void *val, void *usr)
{
    SESSION_ITEM  *item = val; 
    int *tmp = usr;
   
    //log_debug("%p, fd: %d\n", key, item->sockfd);
    if(*item->sockfd == *tmp){
   
        item->last_modify_time = time(NULL);
        return 0;
    }

    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
movq -0x30(%rbp), %rcx
cmpl (%rcx), %eax
jne 0xa8a2
xorl %eax, %eax
movl %eax, %edi
callq 0x25b0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
jmp 0xa8a9
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/xiaowenhuyuehu[P]remote_access/src/core/session_mgr.c
// Function: get_socketfd_by_session_id
int get_socketfd_by_session_id(char *session_id)
{
    SESSION_ITEM  *item = NULL; 
    
    if(g_ht == NULL || session_id == NULL){
        log_error("session system is not ready, please retry ");
        return -1;
    }

    item = ht_find(g_ht, session_id, DEFAULT_SESSION_LEN, NULL, NULL);
    if(item == NULL){
        log_error("could not find socketfd for session: %s ", session_id);
        return -1;
    }
    
    log_debug("get socketfd: %d by session id: %s \n", *item->sockfd, session_id);
    item->last_modify_time = time(NULL);
    return *item->sockfd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
cmpq $0x0, 0x5efc(%rip)      # 0x107d8
je 0xa8e5
cmpq $0x0, -0x10(%rbp)
jne 0xa917
movl $0x3, %edi
leaq 0xcef(%rip), %rsi       # 0xb5e0
leaq 0x18a5(%rip), %rdx      # 0xc19d
movl $0xbf, %ecx
leaq 0x18e3(%rip), %r8       # 0xc1e7
movb $0x0, %al
callq 0x4f90
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa9c7
movq 0x5eba(%rip), %rdi      # 0x107d8
movq -0x10(%rbp), %rsi
movl $0x40, %edx
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rcx
callq 0x46e0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xa972
movq -0x10(%rbp), %r9
movl $0x3, %edi
leaq 0xc91(%rip), %rsi       # 0xb5e0
leaq 0x1847(%rip), %rdx      # 0xc19d
movl $0xc5, %ecx
leaq 0x1954(%rip), %r8       # 0xc2b6
movb $0x0, %al
callq 0x4f90
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xa9c7
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl (%rax), %r9d
movq -0x10(%rbp), %rax
xorl %edi, %edi
leaq 0x67b(%rip), %rsi       # 0xb004
leaq 0x180d(%rip), %rdx      # 0xc19d
movl $0xc9, %ecx
leaq 0x1982(%rip), %r8       # 0xc31e
movq %rax, (%rsp)
movb $0x0, %al
callq 0x4f90
xorl %eax, %eax
movl %eax, %edi
callq 0x25b0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/xiaowenhuyuehu[P]remote_access/src/core/session_mgr.c
// Function: clear_timeout_session
static int clear_timeout_session()
{
    int count = 0;

    if(g_ht == NULL){
        log_error("session system is not ready, please retry ");
    }

    ht_iterator_lockless(g_ht, _delete_item, &count);

    return count;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x4(%rbp)
cmpq $0x0, 0x5df1(%rip)      # 0x107d8
jne 0xaa0f
movl $0x3, %edi
leaq 0xbeb(%rip), %rsi       # 0xb5e0
leaq 0x17a1(%rip), %rdx      # 0xc19d
movl $0x3e, %ecx
leaq 0x17df(%rip), %r8       # 0xc1e7
movb $0x0, %al
callq 0x4f90
movq 0x5dc2(%rip), %rdi      # 0x107d8
leaq 0x13(%rip), %rsi        # 0xaa30
leaq -0x4(%rbp), %rdx
callq 0x4c80
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/xiaowenhuyuehu[P]remote_access/src/core/session_mgr.c
// Function: delete_item
static int _delete_item(void *key, void *val, void *usr)
{
    SESSION_ITEM  *item = val; 

    if(item->last_modify_time + DEFAULT_SESSION_TIMEOUT < time(NULL)){
        log_info("delete timeout session:  %s ", (char *)key);
        *(int *)usr += 1; 
        *item->sockfd = -1;
        free_session(key);
    }

    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x708, %rax            # imm = 0x708
movq %rax, -0x28(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x25b0
movq %rax, %rcx
movq -0x28(%rbp), %rax
cmpq %rcx, %rax
jge 0xaabe
movq -0x8(%rbp), %r9
movl $0x1, %edi
leaq 0xbb6(%rip), %rsi       # 0xb639
leaq 0x1713(%rip), %rdx      # 0xc19d
movl $0x30, %ecx
leaq 0x18ad(%rip), %r8       # 0xc343
movb $0x0, %al
callq 0x4f90
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq -0x8(%rbp), %rdi
callq 0xa700
movl $0x1, %eax
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/983[P]bigint/c_examples.c
// Function: main
int main(){
    char buf[65536];

    /* neat trick to avoid having to write &a, &b, &c everywhere */
    bigint a[1], b[1], c[1];

    /* bigints have to be initialized (same as memset'ed to zero) */
    bigint_init(a);
    bigint_init(b);
    bigint_init(c);

    /* create bigint from string */
    bigint_from_str(a, "123456789");
    bigint_from_str(b, "987654321");

    /* c = a * b */
    /* first parameter is destination parameter */
    bigint_mul(c, a, b);

    /* write and print */
    puts(bigint_write(buf, sizeof(buf), c));

    /* bigints have to be free'd */
    bigint_free(a);
    bigint_free(b);
    bigint_free(c);

    return 0;
}

// Assembly:
subq $0x10068, %rsp          # imm = 0x10068
movl $0x0, 0x10064(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x17a0
leaq 0x20(%rsp), %rdi
callq 0x17a0
movq %rsp, %rdi
callq 0x17a0
leaq 0x40(%rsp), %rdi
leaq 0x4dea(%rip), %rsi      # 0x6004
callq 0x3090
leaq 0x20(%rsp), %rdi
leaq 0x4de3(%rip), %rsi      # 0x600e
callq 0x3090
movq %rsp, %rdi
leaq 0x40(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x2d80
leaq 0x60(%rsp), %rdi
movq %rsp, %rdx
movl $0x10000, %esi          # imm = 0x10000
callq 0x4920
movq %rax, %rdi
callq 0x1040
leaq 0x40(%rsp), %rdi
callq 0x18b0
leaq 0x20(%rsp), %rdi
callq 0x18b0
movq %rsp, %rdi
callq 0x18b0
xorl %eax, %eax
addq $0x10068, %rsp          # imm = 0x10068
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/salextpuru[P]speccy-toochain/src/megalz/MegaLZ_depack.c
// Function: put_buffer
ULONG put_buffer(ULONG pos,ULONG size)
{ // writes specified part of buffer to the output file (with wrapping!)
	ULONG size1,size2,success;

	if( (pos+size)<=DBSIZE )
	{ // no wrapping needed
		return (size==fwrite(&dbuf[pos],1,size,file_out))?1:0;
	}
	else
	{ // wrapping
		size1=(DBSIZE-pos);
		size2=size-size1;

		success=  (size1==fwrite(&dbuf[pos],1,size1,file_out))?1:0;
		success&= (size2==fwrite(&dbuf[0],  1,size2,file_out))?1:0;
		return success;
	}
}

// Assembly:
subq $0x38, %rsp
movl %edi, 0x30(%rsp)
movl %esi, 0x2c(%rsp)
movl 0x30(%rsp), %eax
addl 0x2c(%rsp), %eax
cmpl $0x2000, %eax           # imm = 0x2000
ja 0x1afa
movl 0x2c(%rsp), %eax
movq %rax, 0x18(%rsp)
movl 0x30(%rsp), %eax
leaq 0x4631(%rip), %rdi      # 0x60f0
addq %rax, %rdi
movl 0x2c(%rsp), %eax
movl %eax, %edx
leaq 0x4601(%rip), %rax      # 0x60d0
movq (%rax), %rcx
movl $0x1, %esi
callq 0x1120
movq 0x18(%rsp), %rdx
movq %rax, %rsi
xorl %eax, %eax
movl $0x1, %ecx
cmpq %rsi, %rdx
cmovel %ecx, %eax
movl %eax, 0x34(%rsp)
jmp 0x1bac
movl $0x2000, %eax           # imm = 0x2000
subl 0x30(%rsp), %eax
movl %eax, 0x28(%rsp)
movl 0x2c(%rsp), %eax
subl 0x28(%rsp), %eax
movl %eax, 0x24(%rsp)
movl 0x28(%rsp), %eax
movq %rax, 0x8(%rsp)
movl 0x30(%rsp), %eax
leaq 0x45c9(%rip), %rdi      # 0x60f0
addq %rax, %rdi
movl 0x28(%rsp), %eax
movl %eax, %edx
leaq 0x4599(%rip), %rax      # 0x60d0
movq (%rax), %rcx
movl $0x1, %esi
callq 0x1120
movq 0x8(%rsp), %rdx
movq %rax, %rsi
xorl %eax, %eax
movl $0x1, %ecx
cmpq %rsi, %rdx
cmovel %ecx, %eax
movl %eax, 0x20(%rsp)
movl 0x24(%rsp), %eax
movq %rax, 0x10(%rsp)
movl 0x24(%rsp), %eax
movl %eax, %edx
leaq 0x455d(%rip), %rax      # 0x60d0
movq (%rax), %rcx
leaq 0x4573(%rip), %rdi      # 0x60f0
movl $0x1, %esi
callq 0x1120
movq 0x10(%rsp), %rdx
movq %rax, %rsi
xorl %eax, %eax
movl $0x1, %ecx
cmpq %rsi, %rdx
cmovel %ecx, %eax
andl 0x20(%rsp), %eax
movl %eax, 0x20(%rsp)
movl 0x20(%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O0/salextpuru[P]speccy-toochain/src/megalz/MegaLZ_depacker.c
// Function: get_bits
ULONG get_bits(ULONG numbits)
{ // gets specified number of bits from bitstream
  // returns them LSB-aligned
  // if error (get_byte() fails) return 0xFFFFFFFF, so function can't get more than 31 bits!
  // if 0 bits required, returns 0

	ULONG count;
	ULONG bits;
	ULONG input;

	bits=0;
	count=numbits;

	while(count--)
	{
		if( bitcount-- )
		{
			bits<<=1;
			bits|=0x00000001&(bitstream>>7);
			bitstream<<=1;
		}
		else
		{
			bitcount=8;
			input=get_byte();
#ifdef ERRORS
			if( input==0xFFFFFFFF ) return 0xFFFFFFFF;
#endif
			bitstream=(UBYTE)input;

			count++;    // repeat loop once more
		}
	}

	return bits;
}

// Assembly:
subq $0x18, %rsp
movl %edi, 0x10(%rsp)
movl $0x0, 0x8(%rsp)
movl 0x10(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, 0xc(%rsp)
cmpl $0x0, %eax
je 0x2002
movl 0x6174(%rip), %eax      # 0x80f8
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, 0x6169(%rip)      # 0x80f8
cmpl $0x0, %eax
je 0x1fc4
movl 0x8(%rsp), %eax
shll %eax
movl %eax, 0x8(%rsp)
movzbl 0x614f(%rip), %eax      # 0x80f4
sarl $0x7, %eax
andl $0x1, %eax
orl 0x8(%rsp), %eax
movl %eax, 0x8(%rsp)
movzbl 0x613a(%rip), %eax      # 0x80f4
shll %eax
movb %al, 0x6132(%rip)       # 0x80f4
jmp 0x1ffd
movl $0x8, 0x612a(%rip)      # 0x80f8
callq 0x1a40
movl %eax, 0x4(%rsp)
cmpl $-0x1, 0x4(%rsp)
jne 0x1fe8
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x200a
movl 0x4(%rsp), %eax
movb %al, 0x6102(%rip)       # 0x80f4
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x1f68
movl 0x8(%rsp), %eax
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/salextpuru[P]speccy-toochain/src/megalz/MegaLZ_depacker.c
// Function: repeat
void repeat(LONG disp,ULONG len)
{ // repeat len bytes with disp displacement (negative)
  // uses dbpos & dbuf

	ULONG i;

	for(i=0;i<len;i++)
	{
		dbuf[DBMASK&dbpos]=dbuf[DBMASK&(dbpos+disp)];
		dbpos++;
	}
}

// Assembly:
movl %edi, -0x4(%rsp)
movl %esi, -0x8(%rsp)
movl $0x0, -0xc(%rsp)
movl -0xc(%rsp), %eax
cmpl -0x8(%rsp), %eax
jae 0x208c
movl 0x60b0(%rip), %eax      # 0x80f0
addl -0x4(%rsp), %eax
andl $0x1fff, %eax           # imm = 0x1FFF
movl %eax, %eax
movl %eax, %ecx
leaq 0x409c(%rip), %rax      # 0x60f0
movb (%rax,%rcx), %dl
movl 0x6093(%rip), %eax      # 0x80f0
andl $0x1fff, %eax           # imm = 0x1FFF
movl %eax, %eax
movl %eax, %ecx
leaq 0x4083(%rip), %rax      # 0x60f0
movb %dl, (%rax,%rcx)
movl 0x607a(%rip), %eax      # 0x80f0
addl $0x1, %eax
movl %eax, 0x6071(%rip)      # 0x80f0
movl -0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rsp)
jmp 0x2030
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/salextpuru[P]speccy-toochain/src/megalz/MegaLZ_depacker.c
// Function: get_bigdisp
LONG get_bigdisp(void)
{ // fetches 'big' displacement (-1..-4352)
  // returns negative displacement or ZERO if failed either get_bits() or get_byte()

	ULONG bits,byte;

	bits=get_bits(1);
#ifdef ERRORS
	if( bits==0xFFFFFFFF ) return 0;
#endif

	if( bits )
	{ // longer displacement
		bits=get_bits(4);
#ifdef ERRORS
		if( bits==0xFFFFFFFF ) return 0;
#endif
		byte=get_byte();
#ifdef ERRORS
		if( byte==0xFFFFFFFF ) return 0;
#endif
		return (LONG)( ((0xFFFFF000|(bits<<8))-0x0100)|byte );
	}
	else
	{ // shorter displacement
		byte=get_byte();
#ifdef ERRORS
		if( byte==0xFFFFFFFF ) return 0;
#endif
		return (LONG)( 0xFFFFFF00|byte );
	}
}

// Assembly:
subq $0x18, %rsp
movl $0x1, %edi
callq 0x1f50
movl %eax, 0x10(%rsp)
cmpl $-0x1, 0x10(%rsp)
jne 0x20b6
movl $0x0, 0x14(%rsp)
jmp 0x2138
cmpl $0x0, 0x10(%rsp)
je 0x2111
movl $0x4, %edi
callq 0x1f50
movl %eax, 0x10(%rsp)
cmpl $-0x1, 0x10(%rsp)
jne 0x20dc
movl $0x0, 0x14(%rsp)
jmp 0x2138
callq 0x1a40
movl %eax, 0xc(%rsp)
cmpl $-0x1, 0xc(%rsp)
jne 0x20f6
movl $0x0, 0x14(%rsp)
jmp 0x2138
movl 0x10(%rsp), %eax
shll $0x8, %eax
orl $0xfffff000, %eax       # imm = 0xFFFFF000
subl $0x100, %eax            # imm = 0x100
orl 0xc(%rsp), %eax
movl %eax, 0x14(%rsp)
jmp 0x2138
callq 0x1a40
movl %eax, 0xc(%rsp)
cmpl $-0x1, 0xc(%rsp)
jne 0x212b
movl $0x0, 0x14(%rsp)
jmp 0x2138
movl 0xc(%rsp), %eax
orl $0xffffff00, %eax       # imm = 0xFFFFFF00
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/salextpuru[P]speccy-toochain/src/megalz/MegaLZ_emit.c
// Function: emit_code
ULONG emit_code(struct lzinfo * lz)
{ // emits given lz code to the output stream

	// write bits

	emit_bits(lz->bits,lz->bitsnum);


	// write byte, if any

	if( lz->byte!=0xFFFFFFFF )
	{
		oubuf[ob_freepos++]=(UBYTE)(lz->byte&0x000000FF);
	}


	// flush to disk if needed

	if( ob_freepos>(OUBUFSIZE-8) )
	{
		// write up to current bit position
		if( ob_bitpos!=fwrite( oubuf, 1, ob_bitpos, file_out ) )  return 0;

		// move remaining part of buffer to the beginning
		memcpy( oubuf, &oubuf[ob_bitpos], OUBUFSIZE-ob_bitpos);

		// update pointers
		ob_freepos-=ob_bitpos;
		ob_bitpos=0;
	}

	return 1;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x8(%rsp)
movq 0x8(%rsp), %rax
movl 0x10(%rax), %edi
movq 0x8(%rsp), %rax
movl 0x14(%rax), %esi
callq 0x22a0
movq 0x8(%rsp), %rax
cmpl $-0x1, 0xc(%rax)
je 0x21e7
movq 0x8(%rsp), %rax
movl 0xc(%rax), %eax
andl $0xff, %eax
movb %al, %dl
movl 0x6036(%rip), %eax      # 0x8204
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x602b(%rip)      # 0x8204
movl %eax, %eax
movl %eax, %ecx
leaq 0x5f1c(%rip), %rax      # 0x8100
movb %dl, (%rax,%rcx)
cmpl $0xf8, 0x6013(%rip)     # 0x8204
jbe 0x2283
movl 0x6003(%rip), %eax      # 0x8200
movq %rax, (%rsp)
movl 0x5ff9(%rip), %eax      # 0x8200
movl %eax, %edx
leaq 0x3ec0(%rip), %rax      # 0x60d0
movq (%rax), %rcx
leaq 0x5ee6(%rip), %rdi      # 0x8100
movl $0x1, %esi
callq 0x1120
movq %rax, %rcx
movq (%rsp), %rax
cmpq %rcx, %rax
je 0x223a
movl $0x0, 0x14(%rsp)
jmp 0x228b
movl 0x5fc0(%rip), %eax      # 0x8200
leaq 0x5eb9(%rip), %rsi      # 0x8100
addq %rax, %rsi
movl $0x100, %eax            # imm = 0x100
subl 0x5fab(%rip), %eax      # 0x8200
movl %eax, %eax
movl %eax, %edx
leaq 0x5ea0(%rip), %rdi      # 0x8100
callq 0x1070
movl 0x5f95(%rip), %ecx      # 0x8200
movl 0x5f93(%rip), %eax      # 0x8204
subl %ecx, %eax
movl %eax, 0x5f8b(%rip)      # 0x8204
movl $0x0, 0x5f7d(%rip)      # 0x8200
movl $0x1, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/salextpuru[P]speccy-toochain/src/megalz/MegaLZ_emit.c
// Function: emit_bits
void emit_bits(ULONG bits,ULONG bitsnum)
{
	ULONG i,shifter;

	shifter=bits;

	for(i=0;i<bitsnum;i++)
	{
		if( ob_bits==8 )
		{
			ob_bitpos=ob_freepos;
			ob_freepos++;
			ob_bits=0;
		}

		oubuf[ob_bitpos]=(UBYTE)( (oubuf[ob_bitpos]<<1) | (UBYTE)( shifter>>31 ));

		ob_bits++;

		shifter<<=1;
	}
}

// Assembly:
movl %edi, -0x4(%rsp)
movl %esi, -0x8(%rsp)
movl -0x4(%rsp), %eax
movl %eax, -0x10(%rsp)
movl $0x0, -0xc(%rsp)
movl -0xc(%rsp), %eax
cmpl -0x8(%rsp), %eax
jae 0x2352
cmpl $0x8, 0x5f3b(%rip)      # 0x8208
jne 0x22f4
movl 0x5f2f(%rip), %eax      # 0x8204
movl %eax, 0x5f25(%rip)      # 0x8200
movl 0x5f23(%rip), %eax      # 0x8204
addl $0x1, %eax
movl %eax, 0x5f1a(%rip)      # 0x8204
movl $0x0, 0x5f14(%rip)      # 0x8208
movl 0x5f06(%rip), %eax      # 0x8200
movl %eax, %ecx
leaq 0x5dfd(%rip), %rax      # 0x8100
movzbl (%rax,%rcx), %eax
shll %eax
movl -0x10(%rsp), %ecx
shrl $0x1f, %ecx
movzbl %cl, %ecx
orl %ecx, %eax
movb %al, %dl
movl 0x5ee3(%rip), %eax      # 0x8200
movl %eax, %ecx
leaq 0x5dda(%rip), %rax      # 0x8100
movb %dl, (%rax,%rcx)
movl 0x5ed9(%rip), %eax      # 0x8208
addl $0x1, %eax
movl %eax, 0x5ed0(%rip)      # 0x8208
movl -0x10(%rsp), %eax
shll %eax
movl %eax, -0x10(%rsp)
movl -0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rsp)
jmp 0x22b8
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/salextpuru[P]speccy-toochain/src/megalz/MegaLZ_emit.c
// Function: emit_finish
ULONG emit_finish(void)
{ // finishes output stream outting (flushes everyth, writes stopping bitcode)

	// write stopping bitcode
	emit_bits(0x60100000,12);

	// fill up last unfinished 'bit'-byte
	while( ob_bits<8 )
	{
		oubuf[ob_bitpos]<<=1;
		ob_bits++;
	}

	// write remaining part of buffer
	if( ob_freepos!=fwrite( oubuf, 1, ob_freepos, file_out ) )  return 0;

	return 1;
}

// Assembly:
subq $0x18, %rsp
movl $0x60100000, %edi       # imm = 0x60100000
movl $0xc, %esi
callq 0x22a0
cmpl $0x8, 0x5e8e(%rip)      # 0x8208
jae 0x23ae
movl 0x5e7e(%rip), %eax      # 0x8200
movl %eax, %ecx
leaq 0x5d75(%rip), %rax      # 0x8100
movzbl (%rax,%rcx), %eax
shll %eax
movb %al, %dl
leaq 0x5d66(%rip), %rax      # 0x8100
movb %dl, (%rax,%rcx)
movl 0x5e65(%rip), %eax      # 0x8208
addl $0x1, %eax
movl %eax, 0x5e5c(%rip)      # 0x8208
jmp 0x2373
movl 0x5e50(%rip), %eax      # 0x8204
movq %rax, 0x8(%rsp)
movl 0x5e45(%rip), %eax      # 0x8204
movl %eax, %edx
leaq 0x3d08(%rip), %rax      # 0x60d0
movq (%rax), %rcx
leaq 0x5d2e(%rip), %rdi      # 0x8100
movl $0x1, %esi
callq 0x1120
movq %rax, %rcx
movq 0x8(%rsp), %rax
cmpq %rcx, %rax
je 0x23f3
movl $0x0, 0x14(%rsp)
jmp 0x23fb
movl $0x1, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O0/salextpuru[P]speccy-toochain/src/megalz/MegaLZ_hash.c
// Function: make_hash
void make_hash(void)
{ // makes hash for every byte of input file
  // for position i, hash is from bytes at [i-2],[i-1],[i]
  // first and second bytes does not have valid hash values

	UBYTE curr,prev,prev2;
	ULONG i;

	prev=curr=0;

	for(i=0;i<inlen;i++)
	{
		prev2=(UBYTE)((prev>>1)|(prev<<7));
		prev=(UBYTE)((curr>>1)|(curr<<7));
		curr=indata[i];

		hash[i]=(UBYTE)(prev2^prev^curr);
	}
}

// Assembly:
movb $0x0, -0x1(%rsp)
movb $0x0, -0x2(%rsp)
movl $0x0, -0x8(%rsp)
movl -0x8(%rsp), %eax
leaq 0x3c4b(%rip), %rcx      # 0x60d8
cmpl (%rcx), %eax
jae 0x2500
movzbl -0x2(%rsp), %eax
sarl %eax
movzbl -0x2(%rsp), %ecx
shll $0x7, %ecx
orl %ecx, %eax
movb %al, -0x3(%rsp)
movzbl -0x1(%rsp), %eax
sarl %eax
movzbl -0x1(%rsp), %ecx
shll $0x7, %ecx
orl %ecx, %eax
movb %al, -0x2(%rsp)
leaq 0x3c1e(%rip), %rax      # 0x60e0
movq (%rax), %rax
movl -0x8(%rsp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x1(%rsp)
movzbl -0x3(%rsp), %eax
movzbl -0x2(%rsp), %ecx
xorl %ecx, %eax
movzbl -0x1(%rsp), %ecx
xorl %ecx, %eax
movb %al, %dl
movq 0x5d24(%rip), %rax      # 0x8210
movl -0x8(%rsp), %ecx
movb %dl, (%rax,%rcx)
movl -0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rsp)
jmp 0x2482
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/salextpuru[P]speccy-toochain/src/megalz/MegaLZ_lz.c
// Function: end_lz
void end_lz(void)
{ // ends codes[] array filling by setting stopflag
	codes[codepos].disp=0;
	codes[codepos].length=1;

 if(codepos>=256) printf("end_lz(): overflow!\n");
}

// Assembly:
pushq %rax
movl 0x5cf9(%rip), %eax      # 0x8220
movl %eax, %ecx
leaq 0x5d00(%rip), %rax      # 0x8230
movw $0x0, 0x2(%rax,%rcx,4)
movl 0x5ce3(%rip), %eax      # 0x8220
movl %eax, %ecx
leaq 0x5cea(%rip), %rax      # 0x8230
movw $0x1, (%rax,%rcx,4)
cmpl $0x100, 0x5cca(%rip)    # imm = 0x100
jb 0x2566
leaq 0x1f01(%rip), %rdi      # 0x4460
movb $0x0, %al
callq 0x1040
popq %rax
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/salextpuru[P]speccy-toochain/src/megalz/MegaLZ_lz.c
// Function: add_lz
void add_lz(LONG disp, ULONG length)
{ // adds LZ code to the codes[] array
  // position - from which point LZ code starts in input file, (position-curpos) - back displacement

	codes[codepos].length = (UWORD)length;
	codes[codepos].disp   = (WORD)disp;
	codepos++;
}

// Assembly:
movl %edi, -0x4(%rsp)
movl %esi, -0x8(%rsp)
movl -0x8(%rsp), %eax
movw %ax, %dx
movl 0x5c9b(%rip), %eax      # 0x8220
movl %eax, %ecx
leaq 0x5ca2(%rip), %rax      # 0x8230
movw %dx, (%rax,%rcx,4)
movl -0x4(%rsp), %eax
movw %ax, %dx
movl 0x5c81(%rip), %eax      # 0x8220
movl %eax, %ecx
leaq 0x5c88(%rip), %rax      # 0x8230
movw %dx, 0x2(%rax,%rcx,4)
movl 0x5c6d(%rip), %eax      # 0x8220
addl $0x1, %eax
movl %eax, 0x5c64(%rip)      # 0x8220
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/salextpuru[P]speccy-toochain/src/megalz/MegaLZ_pack.c
// Function: update_price
void update_price(ULONG curpos,ULONG bitsize,struct lzcode * lz)
{ // update price for given data

	ULONG curprice;
	ULONG newpos;


	if( lz )
	{
		newpos=curpos+lz->length;
	}
	else
	{
		newpos=curpos+1;
	}

	curprice=pdata[newpos].price;

	if( curprice > bitsize+pdata[curpos].price )
	{
		pdata[newpos].price=bitsize+pdata[curpos].price;

		if(lz)
		{
			pdata[newpos].best= *lz;
		}
		else
		{
			pdata[newpos].best.length=1;
			pdata[newpos].best.disp=0;
		}
	}
}

// Assembly:
movl %edi, -0x4(%rsp)
movl %esi, -0x8(%rsp)
movq %rdx, -0x10(%rsp)
cmpq $0x0, -0x10(%rsp)
je 0x3349
movl -0x4(%rsp), %eax
movq -0x10(%rsp), %rcx
movzwl (%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x18(%rsp)
jmp 0x3354
movl -0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rsp)
movq 0x52d5(%rip), %rax      # 0x8630
movl -0x18(%rsp), %ecx
movl 0x4(%rax,%rcx,8), %eax
movl %eax, -0x14(%rsp)
movl -0x14(%rsp), %eax
movl -0x8(%rsp), %ecx
movq 0x52ba(%rip), %rdx      # 0x8630
movl -0x4(%rsp), %esi
addl 0x4(%rdx,%rsi,8), %ecx
cmpl %ecx, %eax
jbe 0x33e8
movl -0x8(%rsp), %edx
movq 0x52a3(%rip), %rax      # 0x8630
movl -0x4(%rsp), %ecx
addl 0x4(%rax,%rcx,8), %edx
movq 0x5294(%rip), %rax      # 0x8630
movl -0x18(%rsp), %ecx
movl %edx, 0x4(%rax,%rcx,8)
cmpq $0x0, -0x10(%rsp)
je 0x33c3
movq 0x527d(%rip), %rax      # 0x8630
movl -0x18(%rsp), %ecx
movq -0x10(%rsp), %rdx
movl (%rdx), %edx
movl %edx, (%rax,%rcx,8)
jmp 0x33e6
movq 0x5266(%rip), %rax      # 0x8630
movl -0x18(%rsp), %ecx
movw $0x1, (%rax,%rcx,8)
movq 0x5255(%rip), %rax      # 0x8630
movl -0x18(%rsp), %ecx
movw $0x0, 0x2(%rax,%rcx,8)
jmp 0x33e8
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/salextpuru[P]speccy-toochain/src/megalz/MegaLZ_pack.c
// Function: gen_output
ULONG gen_output(void)
{
	ULONG pos;

	struct lzinfo lz;




	if( !emit_init() )
	{
		printf("gen_output(): emit_init() failed!\n");
		return 0;
	}


	pos=1; // first byte copied to output 'as-is', without LZ coding

	while( pos<inlen )
	{
		// write best code to the output stream
		if( !make_lz_info(indata[pos],&pdata[pos].best,&lz) )
		{
				printf("gen_output(): make_lz_info() failed!\n");
				return 0;
		}

		if( !emit_code(&lz) )
		{
			printf("gen_output(): emit_code() failed!\n");
			return 0;
		}
		pos+=lz.length; // step to the next unpacked byte
	}

	// sanity check
	if( pos>inlen )
	{
		printf("gen_output(): last position is out of input file!\n");
		return 0;
	}





	// just finish all deals
	if( !emit_finish() )
	{
		printf("gen_output(): emit_finish() failed!\n");
		return 0;
	}

	return 1;
}

// Assembly:
subq $0x28, %rsp
callq 0x2150
cmpl $0x0, %eax
jne 0x3419
leaq 0x10ec(%rip), %rdi      # 0x44f1
movb $0x0, %al
callq 0x1040
movl $0x0, 0x24(%rsp)
jmp 0x350d
movl $0x1, 0x20(%rsp)
movl 0x20(%rsp), %eax
leaq 0x2cac(%rip), %rcx      # 0x60d8
cmpl (%rcx), %eax
jae 0x34bc
leaq 0x2ca5(%rip), %rax      # 0x60e0
movq (%rax), %rax
movl 0x20(%rsp), %ecx
movb (%rax,%rcx), %al
movq 0x51e4(%rip), %rsi      # 0x8630
movl 0x20(%rsp), %ecx
shlq $0x3, %rcx
addq %rcx, %rsi
leaq 0x4(%rsp), %rdx
movzbl %al, %edi
callq 0x25c0
cmpl $0x0, %eax
jne 0x3484
leaq 0x10a4(%rip), %rdi      # 0x4514
movb $0x0, %al
callq 0x1040
movl $0x0, 0x24(%rsp)
jmp 0x350d
leaq 0x4(%rsp), %rdi
callq 0x2190
cmpl $0x0, %eax
jne 0x34ab
leaq 0x10a0(%rip), %rdi      # 0x453a
movb $0x0, %al
callq 0x1040
movl $0x0, 0x24(%rsp)
jmp 0x350d
movl 0x4(%rsp), %eax
addl 0x20(%rsp), %eax
movl %eax, 0x20(%rsp)
jmp 0x3421
movl 0x20(%rsp), %eax
leaq 0x2c11(%rip), %rcx      # 0x60d8
cmpl (%rcx), %eax
jbe 0x34e3
leaq 0x108b(%rip), %rdi      # 0x455d
movb $0x0, %al
callq 0x1040
movl $0x0, 0x24(%rsp)
jmp 0x350d
callq 0x2360
cmpl $0x0, %eax
jne 0x3505
leaq 0x109c(%rip), %rdi      # 0x4590
movb $0x0, %al
callq 0x1040
movl $0x0, 0x24(%rsp)
jmp 0x350d
movl $0x1, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/salextpuru[P]speccy-toochain/src/megalz/MegaLZ_twobyters.c
// Function: init_twobyters
void init_twobyters(void)
{ // init pointers tb_free, tb_bunches and tb_entry array

	ULONG i;


	tb_free=NULL; // init linked list of free tb_chain elements

	tb_bunches=NULL; // no bunches already allocated

	for(i=0;i<0x10000;i++) // init array of 2-byte match pointers
	{
		tb_entry[i]=NULL;
	}
}

// Assembly:
movq $0x0, 0x50e5(%rip) # 0x8640
movq $0x0, 0x50e2(%rip) # 0x8648
movl $0x0, -0x4(%rsp)
cmpl $0x10000, -0x4(%rsp)    # imm = 0x10000
jae 0x359a
movl -0x4(%rsp), %eax
movl %eax, %ecx
leaq 0x50cb(%rip), %rax      # 0x8650
movq $0x0, (%rax,%rcx,8)
movl -0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rsp)
jmp 0x356e
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/salextpuru[P]speccy-toochain/src/megalz/MegaLZ_twobyters.c
// Function: free_twobyters
void free_twobyters(void)
{ // free all twobyter-related memory

	struct tb_bunch * tbtmp;

	while( tb_bunches )
	{
		tbtmp=tb_bunches;
		tb_bunches=tb_bunches->next;
		free( tbtmp );
	}
}

// Assembly:
pushq %rax
cmpq $0x0, 0x509f(%rip)      # 0x8648
je 0x35d2
movq 0x5096(%rip), %rax      # 0x8648
movq %rax, (%rsp)
movq 0x508b(%rip), %rax      # 0x8648
movq (%rax), %rax
movq %rax, 0x5081(%rip)      # 0x8648
movq (%rsp), %rdi
callq 0x10d0
jmp 0x35a1
popq %rax
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/salextpuru[P]speccy-toochain/src/megalz/MegaLZ_twobyters.c
// Function: add_twobyter
ULONG add_twobyter(UBYTE last,UBYTE curr,ULONG curpos)
{ // adds new twobyter to the array of chains

	struct tb_chain * newtb;
	ULONG index;


	index=(((ULONG)last)<<8)+((ULONG)curr);

	newtb=get_free_twobyter();
	if( !newtb )
	{ // no free elements

		// first try to flush current chain
		cutoff_twobyte_chain(index,curpos);

		newtb=get_free_twobyter();
		if( !newtb )
		{ // nothing free - allocate new bunch
			if( !add_bunch_of_twobyters() )
			{
				return 0;
			}

			newtb=get_free_twobyter();
		}
	}



	newtb->next=tb_entry[index];
	tb_entry[index]=newtb;

	newtb->pos=curpos-1; // points to the first byte of given two bytes

	return 1;
}

// Assembly:
subq $0x28, %rsp
movb %sil, %al
movb %dil, %cl
movb %cl, 0x23(%rsp)
movb %al, 0x22(%rsp)
movl %edx, 0x1c(%rsp)
movzbl 0x23(%rsp), %eax
shll $0x8, %eax
movzbl 0x22(%rsp), %ecx
addl %ecx, %eax
movl %eax, 0xc(%rsp)
callq 0x36b0
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0x365a
movl 0xc(%rsp), %edi
movl 0x1c(%rsp), %esi
callq 0x3700
callq 0x36b0
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0x3658
callq 0x3810
cmpl $0x0, %eax
jne 0x364e
movl $0x0, 0x24(%rsp)
jmp 0x36a0
callq 0x36b0
movq %rax, 0x10(%rsp)
jmp 0x365a
movl 0xc(%rsp), %eax
movl %eax, %ecx
leaq 0x4fe9(%rip), %rax      # 0x8650
movq (%rax,%rcx,8), %rcx
movq 0x10(%rsp), %rax
movq %rcx, (%rax)
movq 0x10(%rsp), %rdx
movl 0xc(%rsp), %eax
movl %eax, %ecx
leaq 0x4fcb(%rip), %rax      # 0x8650
movq %rdx, (%rax,%rcx,8)
movl 0x1c(%rsp), %ecx
subl $0x1, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x8(%rax)
movl $0x1, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopl (%rax)