LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/ps3dm/sm/cmd_sm_set_encdec_key.c
// Function: cmd_sm_set_encdec_key_exec
int
cmd_sm_set_encdec_key_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct ps3dm_sm_set_encdec_key set_encdec_key;
	uint64_t laid, paid;
	uint8_t key[24];
	int key_length;
	int ret;

	key_length = parse_hex(argv[0], key, sizeof(key));
	if (key_length <= 0)
		return (CMD_EINVAL);

	laid = opts.laid_valid ? opts.laid : 0x1070000002000001ull;
	paid = opts.paid_valid ? opts.paid : 0x10700003ff000001ull;

	ps3dm_init_header(&set_encdec_key.dm_hdr, 1, PS3DM_FID_SM,
	    sizeof(set_encdec_key) - sizeof(struct ps3dm_header),
	    sizeof(set_encdec_key) - sizeof(struct ps3dm_header));
	ps3dm_init_ss_header(&set_encdec_key.ss_hdr, PS3DM_PID_SM_SET_ENCDEC_KEY,
	    laid, paid);
	memset(set_encdec_key.key, 0, sizeof(set_encdec_key.key));
	memcpy(set_encdec_key.key, key, key_length);
	set_encdec_key.key_length = key_length;

	ret = dev_write(&set_encdec_key, sizeof(set_encdec_key));
	if (ret != sizeof(set_encdec_key))
		return (CMD_EIO);

	ret = dev_read(&set_encdec_key, sizeof(set_encdec_key));
	if (ret != sizeof(set_encdec_key))
		return (CMD_EIO);

	if (opts.do_verbose > 0)
		fprintf(stderr, "ss status %d\n", set_encdec_key.ss_hdr.status);

	if (set_encdec_key.ss_hdr.status)
		return (CMD_EIO);

	fprintf(stdout, "%llx\n", set_encdec_key.key_index);

	return (CMD_EOK);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq (%rcx), %rdi
movq %rsp, %rsi
movl $0x18, %edx
callq 0x3acc
testl %eax, %eax
jle 0x2b90
leaq 0x453d(%rip), %r15      # 0x70c0
cmpl $0x0, 0x20(%r15)
je 0x2b9a
movq 0x18(%r15), %rcx
jmp 0x2ba4
movl $0x2, %ebx
jmp 0x2c72
movabsq $0x1070000002000001, %rcx # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r15)
je 0x2bb1
movq 0x28(%r15), %rdx
jmp 0x2bbb
movabsq $0x10700003ff000001, %rdx # imm = 0x10700003FF000001
movaps 0x16be(%rip), %xmm0     # 0x4280
leaq 0x58(%rsp), %rbx
movups %xmm0, -0x38(%rbx)
movq $0x5001, -0x28(%rbx)    # imm = 0x5001
movq $0x5000, -0x20(%rbx)    # imm = 0x5000
movq %rcx, -0x10(%rbx)
movq %rdx, -0x8(%rbx)
movl %eax, %r14d
movl $0x18, %ecx
subq %r14, %rcx
xorl %edx, %edx
cmpl $0x18, %eax
cmovbq %rcx, %rdx
leaq (%rsp,%r14), %rdi
addq $0x58, %rdi
xorl %esi, %esi
callq 0x2070
movq %rsp, %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x20e0
movq %r14, 0x18(%rbx)
leaq 0x20(%rsp), %rdi
movl $0x60, %esi
callq 0x2730
movl $0x3, %ebx
cmpl $0x60, %eax
jne 0x2c72
leaq 0x20(%rsp), %rdi
movl $0x60, %esi
callq 0x2751
cmpl $0x60, %eax
jne 0x2c72
cmpl $0x0, 0x8(%r15)
jg 0x2c81
cmpl $0x0, 0x40(%rsp)
jne 0x2c72
movq 0x436e(%rip), %rax      # 0x6fc8
movq (%rax), %rdi
movq 0x78(%rsp), %rdx
leaq 0x1627(%rip), %rsi      # 0x4290
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x20d0
movl %ebx, %eax
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x20(%rsp), %rdi
callq 0x2200
jmp 0x2c4c
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/ps3dm/srtc/cmd_srtc_get_time.c
// Function: cmd_srtc_get_time_exec
int
cmd_srtc_get_time_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct ps3dm_srtc_get_time get_time;
	uint64_t epoch;
	char *endptr;
	uint64_t laid, paid;
	int len;
	int ret;

	epoch = strtoull(argv[0], &endptr, 0);
	if (*endptr != '\0' || epoch > 1)
		return (CMD_EINVAL);

	laid = opts.laid_valid ? opts.laid : 0x1070000002000001ull;
	paid = opts.paid_valid ? opts.paid : 0x10700003ff000001ull;

	ps3dm_init_header(&get_time.dm_hdr, 1, PS3DM_FID_SRTC,
	    sizeof(get_time) - sizeof(struct ps3dm_header),
	    sizeof(get_time) - sizeof(struct ps3dm_header));
	ps3dm_init_ss_header(&get_time.ss_hdr, PS3DM_PID_SRTC_GET_TIME,
	    laid, paid);
	get_time.epoch = epoch;

	len = sizeof(get_time);

	ret = dev_write(&get_time, len);
	if (ret != len)
		return (CMD_EIO);

	ret = dev_read(&get_time, sizeof(get_time));
	if (ret != sizeof(get_time))
		return (CMD_EIO);

	if (opts.do_verbose > 0)
		fprintf(stderr, "ss status %d\n", get_time.ss_hdr.status);

	if (get_time.ss_hdr.status)
		return (CMD_EIO);

	fprintf(stdout, "%lld\n", get_time.time);

	return (CMD_EOK);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x58, %rsp
movq (%rcx), %rdi
movq %rsp, %rbx
movq %rbx, %rsi
xorl %edx, %edx
callq 0x20b0
movq (%rbx), %rcx
cmpb $0x0, (%rcx)
setne %cl
cmpq $0x2, %rax
setae %dl
orb %cl, %dl
movl $0x2, %ebx
jne 0x2d8d
leaq 0x43e1(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x2cec
movq 0x18(%r14), %rcx
jmp 0x2cf6
movabsq $0x1070000002000001, %rcx # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x2d03
movq 0x28(%r14), %rdx
jmp 0x2d0d
movabsq $0x10700003ff000001, %rdx # imm = 0x10700003FF000001
movaps 0x15dc(%rip), %xmm0     # 0x42f0
leaq 0x8(%rsp), %rdi
movups %xmm0, (%rdi)
movq $0x3002, 0x10(%rdi)     # imm = 0x3002
movq $0x3000, 0x18(%rdi)     # imm = 0x3000
movq %rcx, 0x28(%rdi)
movq %rdx, 0x30(%rdi)
movq %rax, 0x38(%rdi)
movl $0x50, %esi
callq 0x2730
movl $0x3, %ebx
cmpl $0x50, %eax
jne 0x2d8d
leaq 0x8(%rsp), %rdi
movl $0x50, %esi
callq 0x2751
cmpl $0x50, %eax
jne 0x2d8d
cmpl $0x0, 0x8(%r14)
jg 0x2d97
cmpl $0x0, 0x28(%rsp)
jne 0x2d8d
movq 0x4253(%rip), %rax      # 0x6fc8
movq (%rax), %rdi
movq 0x48(%rsp), %rdx
leaq 0x157c(%rip), %rsi      # 0x4300
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x20d0
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r14
retq
leaq 0x8(%rsp), %rdi
callq 0x2224
jmp 0x2d67
nop
// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/ps3dm/srtc/cmd_srtc_set_time.c
// Function: cmd_srtc_set_time_exec
int
cmd_srtc_set_time_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct ps3dm_srtc_set_time set_time;
	uint64_t time;
	char *endptr;
	uint64_t laid, paid;
	int len;
	int ret;

	time = strtoull(argv[0], &endptr, 0);
	if (*endptr != '\0' || time > 0xffffffffull)
		return (CMD_EINVAL);

	laid = opts.laid_valid ? opts.laid : 0x1070000002000001ull;
	paid = opts.paid_valid ? opts.paid : 0x10700003ff000001ull;

	ps3dm_init_header(&set_time.dm_hdr, 1, PS3DM_FID_SRTC,
	    sizeof(set_time) - sizeof(struct ps3dm_header),
	    sizeof(set_time) - sizeof(struct ps3dm_header));
	ps3dm_init_ss_header(&set_time.ss_hdr, PS3DM_PID_SRTC_SET_TIME,
	    laid, paid);
	set_time.time = time;

	len = sizeof(set_time);

	ret = dev_write(&set_time, len);
	if (ret != len)
		return (CMD_EIO);

	ret = dev_read(&set_time, sizeof(set_time));
	if (ret != sizeof(set_time))
		return (CMD_EIO);

	if (opts.do_verbose > 0)
		fprintf(stderr, "ss status %d\n", set_time.ss_hdr.status);

	if (set_time.ss_hdr.status)
		return (CMD_EIO);

	return (CMD_EOK);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq (%rcx), %rdi
movq %rsp, %rbx
movq %rbx, %rsi
xorl %edx, %edx
callq 0x20b0
movq (%rbx), %rcx
cmpb $0x0, (%rcx)
setne %cl
movq %rax, %rdx
shrq $0x20, %rdx
setne %dl
orb %cl, %dl
movl $0x2, %ebx
jne 0x2e77
leaq 0x42de(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x2def
movq 0x18(%r14), %rcx
jmp 0x2df9
movabsq $0x1070000002000001, %rcx # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x2e06
movq 0x28(%r14), %rdx
jmp 0x2e10
movabsq $0x10700003ff000001, %rdx # imm = 0x10700003FF000001
movaps 0x1519(%rip), %xmm0     # 0x4330
leaq 0x8(%rsp), %rdi
movups %xmm0, (%rdi)
movq $0x3003, 0x10(%rdi)     # imm = 0x3003
movq $0x3000, 0x18(%rdi)     # imm = 0x3000
movq %rcx, 0x28(%rdi)
movq %rdx, 0x30(%rdi)
movq %rax, 0x38(%rdi)
movl $0x40, %esi
callq 0x2730
movl $0x3, %ebx
cmpl $0x40, %eax
jne 0x2e77
leaq 0x8(%rsp), %rdi
movl $0x40, %esi
callq 0x2751
cmpl $0x40, %eax
jne 0x2e77
cmpl $0x0, 0x8(%r14)
jg 0x2e81
xorl %eax, %eax
cmpl $0x0, 0x28(%rsp)
setne %al
leal (%rax,%rax,2), %ebx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
leaq 0x8(%rsp), %rdi
callq 0x2248
jmp 0x2e6a
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/ps3dm/vtrm/cmd_vtrm_init.c
// Function: cmd_vtrm_init_exec
int
cmd_vtrm_init_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct ps3dm_vtrm_init init;
	uint64_t laid, paid;
	int len;
	int ret;

	laid = opts.laid_valid ? opts.laid : 0x1070000002000001ull;
	paid = opts.paid_valid ? opts.paid : 0x10700003ff000001ull;

	ps3dm_init_header(&init.dm_hdr, 1, PS3DM_FID_SM,
	    sizeof(struct ps3dm_ss_header),
	    sizeof(init) - sizeof(struct ps3dm_header));
	ps3dm_init_ss_header(&init.ss_hdr, PS3DM_PID_VTRM_INIT,
	    laid, paid);

	len = sizeof(struct ps3dm_header) + sizeof(struct ps3dm_ss_header);

	ret = dev_write(&init, len);
	if (ret != len)
		return (CMD_EIO);

	ret = dev_read(&init, sizeof(init));
	if (ret != sizeof(init))
		return (CMD_EIO);

	if (opts.do_verbose > 0)
		fprintf(stderr, "ss status %d\n", init.ss_hdr.status);

	if (init.ss_hdr.status)
		return (CMD_EIO);

	return (CMD_EOK);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
leaq 0x420e(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x2ebf
movq 0x18(%r14), %rax
jmp 0x2ec9
movabsq $0x1070000002000001, %rax # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x2ed6
movq 0x28(%r14), %rcx
jmp 0x2ee0
movabsq $0x10700003ff000001, %rcx # imm = 0x10700003FF000001
movaps 0x14a9(%rip), %xmm0     # 0x4390
movq %rsp, %rdi
movups %xmm0, (%rdi)
movq $0x2001, 0x10(%rdi)     # imm = 0x2001
movq $0x2000, 0x18(%rdi)     # imm = 0x2000
movq %rax, 0x28(%rdi)
movq %rcx, 0x30(%rdi)
movl $0x38, %esi
callq 0x2730
movl $0x3, %ebx
cmpl $0x38, %eax
jne 0x2f3f
movq %rsp, %rdi
movl $0x38, %esi
callq 0x2751
cmpl $0x38, %eax
jne 0x2f3f
cmpl $0x0, 0x8(%r14)
jg 0x2f49
xorl %eax, %eax
cmpl $0x0, 0x20(%rsp)
setne %al
leal (%rax,%rax,2), %ebx
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r14
retq
movq %rsp, %rdi
callq 0x226c
jmp 0x2f32
nop
// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/ps3dm/vtrm/cmd_vtrm_retrieve.c
// Function: cmd_vtrm_retrieve_exec
int
cmd_vtrm_retrieve_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct ps3dm_vtrm_retrieve retrieve;
	char *endptr;
	uint64_t nth;
	uint64_t laid, paid;
	int len;
	int ret;

	nth = strtoull(argv[0], &endptr, 0);
	if (*endptr != '\0')
		return (CMD_EINVAL);

	laid = opts.laid_valid ? opts.laid : 0x1070000002000001ull;
	paid = opts.paid_valid ? opts.paid : 0x10700003ff000001ull;

	if (opts.do_verbose > 0)
		fprintf(stderr, "laid %016llx paid %016llx\n", laid, paid);

	ps3dm_init_header(&retrieve.dm_hdr, 1, PS3DM_FID_VTRM,
	    sizeof(retrieve) - sizeof(struct ps3dm_header),
	    sizeof(retrieve) - sizeof(struct ps3dm_header));
	ps3dm_init_ss_header(&retrieve.ss_hdr, PS3DM_PID_VTRM_RETRIEVE,
	    laid, paid);
	retrieve.nth = nth;

	len = sizeof(retrieve);

	ret = dev_write(&retrieve, len);
	if (ret != len)
		return (CMD_EIO);

	ret = dev_read(&retrieve, sizeof(retrieve));
	if (ret < (sizeof(struct ps3dm_header) + sizeof(struct ps3dm_ss_header)))
		return (CMD_EIO);

	if (opts.do_verbose > 0)
		fprintf(stderr, "ss status %d\n", retrieve.ss_hdr.status);

	if (retrieve.ss_hdr.status)
		return (CMD_EIO);

	if (ret != sizeof(retrieve))
		return (CMD_EIO);

	fwrite(retrieve.data, 1, sizeof(retrieve.data), stdout);

	return (CMD_EOK);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x90, %rsp
movq (%rcx), %rdi
leaq 0x8(%rsp), %r14
movq %r14, %rsi
xorl %edx, %edx
callq 0x20b0
movq %rax, %rbx
movq (%r14), %rax
movl $0x2, %ebp
cmpb $0x0, (%rax)
jne 0x305c
leaq 0x4130(%rip), %r12      # 0x70c0
cmpl $0x0, 0x20(%r12)
je 0x2f9f
movq 0x18(%r12), %r14
jmp 0x2fa9
movabsq $0x1070000002000001, %r14 # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r12)
je 0x2fb8
movq 0x28(%r12), %r15
jmp 0x2fc2
movabsq $0x10700003ff000001, %r15 # imm = 0x10700003FF000001
cmpl $0x0, 0x8(%r12)
jg 0x306e
movaps 0x13eb(%rip), %xmm0     # 0x43c0
leaq 0x10(%rsp), %rdi
movups %xmm0, (%rdi)
movq $0x2005, 0x10(%rdi)     # imm = 0x2005
movq $0x2000, 0x18(%rdi)     # imm = 0x2000
movq %r14, 0x28(%rdi)
movq %r15, 0x30(%rdi)
movq %rbx, 0x78(%rdi)
movl $0x80, %esi
callq 0x2730
movl $0x3, %ebp
cmpl $0x80, %eax
jne 0x305c
leaq 0x10(%rsp), %rdi
movl $0x80, %esi
callq 0x2751
cmpl $0x38, %eax
jb 0x305c
movl %eax, %ebx
cmpl $0x0, 0x8(%r12)
jg 0x3091
cmpl $0x80, %ebx
jne 0x305c
cmpl $0x0, 0x30(%rsp)
jne 0x305c
leaq 0x48(%rsp), %rdi
movq 0x3f80(%rip), %rax      # 0x6fc8
movq (%rax), %rcx
movl $0x1, %esi
movl $0x40, %edx
callq 0x2130
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x3f83(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x1351(%rip), %rsi      # 0x43d0
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x20d0
jmp 0x2fce
leaq 0x10(%rsp), %rdi
callq 0x2290
jmp 0x302d
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/ps3dm/iim/cmd_iim_get_data.c
// Function: cmd_iim_get_data_exec
int
cmd_iim_get_data_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
#define BUFSIZE	0xa00

	char buf[sizeof(struct ps3dm_iim_get_data) + BUFSIZE + sizeof(uint64_t)];
	struct ps3dm_iim_get_data *get_data;
	uint64_t index;
	char *endptr;
	uint64_t laid, paid, data_size;
	int i, len;
	int ret;

	index = strtoull(argv[0], &endptr, 0);
	if (*endptr != '\0')
		return (CMD_EINVAL);

	laid = opts.laid_valid ? opts.laid : 0x1070000002000001ull;
	paid = opts.paid_valid ? opts.paid : 0x1070000300000001ull;

	get_data = (struct ps3dm_iim_get_data *) buf;
	ps3dm_init_header(&get_data->dm_hdr, 1, PS3DM_FID_IIM,
	    sizeof(*get_data) + BUFSIZE + sizeof(uint64_t) - sizeof(struct ps3dm_header),
	    sizeof(*get_data) + BUFSIZE + sizeof(uint64_t) - sizeof(struct ps3dm_header));
	ps3dm_init_ss_header(&get_data->ss_hdr, PS3DM_PID_IIM_GET_DATA,
	    laid, paid);
	get_data->index = index;
	get_data->buf_size = BUFSIZE;

	len = sizeof(*get_data) + BUFSIZE + sizeof(uint64_t);

	ret = dev_write(get_data, len);
	if (ret != len)
		return (CMD_EIO);

	len = sizeof(*get_data) + BUFSIZE + sizeof(uint64_t);

	ret = dev_read(get_data, len);
	if (ret != len)
		return (CMD_EIO);

	if (opts.do_verbose > 0)
		fprintf(stderr, "ss status %d\n", get_data->ss_hdr.status);

	if (get_data->ss_hdr.status)
		return (CMD_EIO);

	data_size = *(uint64_t *) (buf + sizeof(*get_data) + BUFSIZE);

	for (i = 0; i < data_size; i++)
		fprintf(stdout, "%c", get_data->buf[i]);

	return (CMD_EOK);

#undef BUFSIZE
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xa68, %rsp            # imm = 0xA68
movq (%rcx), %rdi
leaq 0x8(%rsp), %rbx
movq %rbx, %rsi
xorl %edx, %edx
callq 0x20b0
movq (%rbx), %rcx
movl $0x2, %ebx
cmpb $0x0, (%rcx)
jne 0x331e
leaq 0x3e6c(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x3261
movq 0x18(%r14), %rcx
jmp 0x326b
movabsq $0x1070000002000001, %rcx # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x3278
movq 0x28(%r14), %rdx
jmp 0x3282
movabsq $0x1070000300000001, %rdx # imm = 0x1070000300000001
movaps 0x1207(%rip), %xmm0     # 0x4490
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x17002, 0x10(%rdi)    # imm = 0x17002
movq $0x17000, 0x18(%rdi)    # imm = 0x17000
movq %rcx, 0x28(%rdi)
movq %rdx, 0x30(%rdi)
movq %rax, 0x38(%rdi)
movq $0xa00, 0x40(%rdi)      # imm = 0xA00
movl $0xa50, %esi            # imm = 0xA50
callq 0x2730
movl $0x3, %ebx
cmpl $0xa50, %eax            # imm = 0xA50
jne 0x331e
leaq 0x10(%rsp), %rdi
movl $0xa50, %esi            # imm = 0xA50
callq 0x2751
cmpl $0xa50, %eax            # imm = 0xA50
jne 0x331e
cmpl $0x0, 0x8(%r14)
jg 0x332f
cmpl $0x0, 0x30(%rsp)
jne 0x331e
movq 0xa58(%rsp), %r14
xorl %ebx, %ebx
testq %r14, %r14
je 0x331e
movq 0x3cc3(%rip), %r15      # 0x6fc8
xorl %r12d, %r12d
movq (%r15), %rsi
movzbl 0x58(%rsp,%r12), %edi
callq 0x2090
incq %r12
cmpq %r12, %r14
jne 0x3308
movl %ebx, %eax
addq $0xa68, %rsp            # imm = 0xA68
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x10(%rsp), %rdi
callq 0x22d8
jmp 0x32e8
nop
// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/ps3dm/iim/cmd_iim_get_data_size.c
// Function: cmd_iim_get_data_size_exec
int
cmd_iim_get_data_size_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct ps3dm_iim_get_data_size get_data_size;
	uint64_t index;
	char *endptr;
	uint64_t laid, paid;
	int len;
	int ret;

	index = strtoull(argv[0], &endptr, 0);
	if (*endptr != '\0')
		return (CMD_EINVAL);

	laid = opts.laid_valid ? opts.laid : 0x1070000002000001ull;
	paid = opts.paid_valid ? opts.paid : 0x1070000300000001ull;

	ps3dm_init_header(&get_data_size.dm_hdr, 1, PS3DM_FID_IIM,
	    sizeof(get_data_size) - sizeof(struct ps3dm_header),
	    sizeof(get_data_size) - sizeof(struct ps3dm_header));
	ps3dm_init_ss_header(&get_data_size.ss_hdr, PS3DM_PID_IIM_GET_DATA_SIZE,
	    laid, paid);
	get_data_size.index = index;

	len = sizeof(struct ps3dm_iim_get_data_size);

	ret = dev_write(&get_data_size, len);
	if (ret != len)
		return (CMD_EIO);

	ret = dev_read(&get_data_size, sizeof(get_data_size));
	if (ret != sizeof(get_data_size))
		return (CMD_EIO);

	if (opts.do_verbose > 0)
		fprintf(stderr, "ss status %d\n", get_data_size.ss_hdr.status);

	if (get_data_size.ss_hdr.status)
		return (CMD_EIO);

	fprintf(stdout, "%llx\n", get_data_size.size);

	return (CMD_EOK);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x58, %rsp
movq (%rcx), %rdi
leaq 0x8(%rsp), %rbx
movq %rbx, %rsi
xorl %edx, %edx
callq 0x20b0
movq (%rbx), %rcx
movl $0x2, %ebx
cmpb $0x0, (%rcx)
jne 0x341b
leaq 0x3d53(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x337a
movq 0x18(%r14), %rcx
jmp 0x3384
movabsq $0x1070000002000001, %rcx # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x3391
movq 0x28(%r14), %rdx
jmp 0x339b
movabsq $0x1070000300000001, %rdx # imm = 0x1070000300000001
movaps 0x112e(%rip), %xmm0     # 0x44d0
leaq 0x10(%rsp), %rdi
movups %xmm0, (%rdi)
movq $0x17001, 0x10(%rdi)    # imm = 0x17001
movq $0x17000, 0x18(%rdi)    # imm = 0x17000
movq %rcx, 0x28(%rdi)
movq %rdx, 0x30(%rdi)
movq %rax, 0x38(%rdi)
movl $0x48, %esi
callq 0x2730
movl $0x3, %ebx
cmpl $0x48, %eax
jne 0x341b
leaq 0x10(%rsp), %rdi
movl $0x48, %esi
callq 0x2751
cmpl $0x48, %eax
jne 0x341b
cmpl $0x0, 0x8(%r14)
jg 0x3425
cmpl $0x0, 0x30(%rsp)
jne 0x341b
movq 0x3bc5(%rip), %rax      # 0x6fc8
movq (%rax), %rdi
movq 0x50(%rsp), %rdx
leaq 0xe7e(%rip), %rsi       # 0x4290
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x20d0
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r14
retq
leaq 0x10(%rsp), %rdi
callq 0x22fc
jmp 0x33f5
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/ps3dm/aim/cmd_aim_get_dev_id.c
// Function: cmd_aim_get_dev_id_exec
int
cmd_aim_get_dev_id_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct ps3dm_aim_get_dev_id get_dev_id;
	uint64_t laid, paid;
	int len;
	int ret;

	laid = opts.laid_valid ? opts.laid : 0x1070000002000001ull;
	paid = opts.paid_valid ? opts.paid : 0x10700003ff000001ull;

	ps3dm_init_header(&get_dev_id.dm_hdr, 1, PS3DM_FID_AIM,
	    sizeof(get_dev_id) - sizeof(struct ps3dm_header),
	    sizeof(get_dev_id) - sizeof(struct ps3dm_header));
	ps3dm_init_ss_header(&get_dev_id.ss_hdr, PS3DM_PID_AIM_GET_DEV_ID,
	    laid, paid);

	len = sizeof(get_dev_id);

	ret = dev_write(&get_dev_id, len);
	if (ret != len)
		return (CMD_EIO);

	ret = dev_read(&get_dev_id, sizeof(get_dev_id));
	if (ret != sizeof(get_dev_id))
		return (CMD_EIO);

	if (opts.do_verbose > 0)
		fprintf(stderr, "ss status %d\n", get_dev_id.ss_hdr.status);

	if (get_dev_id.ss_hdr.status)
		return (CMD_EIO);

	hex_fprintf(stdout, (char *) get_dev_id.data, sizeof(get_dev_id.data));

	return (CMD_EOK);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
leaq 0x3c6a(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x3463
movq 0x18(%r14), %rax
jmp 0x346d
movabsq $0x1070000002000001, %rax # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x347a
movq 0x28(%r14), %rcx
jmp 0x3484
movabsq $0x10700003ff000001, %rcx # imm = 0x10700003FF000001
movaps 0x10a5(%rip), %xmm0     # 0x4530
movq %rsp, %rdi
movups %xmm0, (%rdi)
movq $0x19003, 0x10(%rdi)    # imm = 0x19003
movq $0x19000, 0x18(%rdi)    # imm = 0x19000
movq %rax, 0x28(%rdi)
movq %rcx, 0x30(%rdi)
movl $0x48, %esi
callq 0x2730
movl $0x3, %ebx
cmpl $0x48, %eax
jne 0x34f8
movq %rsp, %rdi
movl $0x48, %esi
callq 0x2751
cmpl $0x48, %eax
jne 0x34f8
cmpl $0x0, 0x8(%r14)
jg 0x3502
cmpl $0x0, 0x20(%rsp)
jne 0x34f8
movq 0x3ae4(%rip), %rax      # 0x6fc8
movq (%rax), %rdi
leaq 0x38(%rsp), %rsi
movl $0x10, %edx
callq 0x3bc5
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
movq %rsp, %rdi
callq 0x2320
jmp 0x34d6
// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/ps3dm/aim/cmd_aim_get_dev_type.c
// Function: cmd_aim_get_dev_type_exec
int
cmd_aim_get_dev_type_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct ps3dm_aim_get_dev_type get_dev_type;
	uint64_t laid, paid;
	int len;
	int ret;

	laid = opts.laid_valid ? opts.laid : 0x1070000002000001ull;
	paid = opts.paid_valid ? opts.paid : 0x10700003ff000001ull;

	ps3dm_init_header(&get_dev_type.dm_hdr, 1, PS3DM_FID_AIM,
	    sizeof(get_dev_type) - sizeof(struct ps3dm_header),
	    sizeof(get_dev_type) - sizeof(struct ps3dm_header));
	ps3dm_init_ss_header(&get_dev_type.ss_hdr, PS3DM_PID_AIM_GET_DEV_TYPE,
	    laid, paid);

	len = sizeof(get_dev_type);

	ret = dev_write(&get_dev_type, len);
	if (ret != len)
		return (CMD_EIO);

	ret = dev_read(&get_dev_type, sizeof(get_dev_type));
	if (ret != sizeof(get_dev_type))
		return (CMD_EIO);

	if (opts.do_verbose > 0)
		fprintf(stderr, "ss status %d\n", get_dev_type.ss_hdr.status);

	if (get_dev_type.ss_hdr.status)
		return (CMD_EIO);

	hex_fprintf(stdout, (char *) get_dev_type.data, sizeof(get_dev_type.data));

	return (CMD_EOK);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
leaq 0x3ba6(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x3527
movq 0x18(%r14), %rax
jmp 0x3531
movabsq $0x1070000002000001, %rax # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x353e
movq 0x28(%r14), %rcx
jmp 0x3548
movabsq $0x10700003ff000001, %rcx # imm = 0x10700003FF000001
movaps 0xfe1(%rip), %xmm0      # 0x4530
movq %rsp, %rdi
movups %xmm0, (%rdi)
movq $0x19002, 0x10(%rdi)    # imm = 0x19002
movq $0x19000, 0x18(%rdi)    # imm = 0x19000
movq %rax, 0x28(%rdi)
movq %rcx, 0x30(%rdi)
movl $0x48, %esi
callq 0x2730
movl $0x3, %ebx
cmpl $0x48, %eax
jne 0x35bc
movq %rsp, %rdi
movl $0x48, %esi
callq 0x2751
cmpl $0x48, %eax
jne 0x35bc
cmpl $0x0, 0x8(%r14)
jg 0x35c6
cmpl $0x0, 0x20(%rsp)
jne 0x35bc
movq 0x3a20(%rip), %rax      # 0x6fc8
movq (%rax), %rdi
leaq 0x38(%rsp), %rsi
movl $0x10, %edx
callq 0x3bc5
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
movq %rsp, %rdi
callq 0x2344
jmp 0x359a
// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/ps3dm/um/cmd_um_read_eprom.c
// Function: cmd_um_read_eprom_exec
int
cmd_um_read_eprom_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct ps3dm_um_read_eprom read_eprom;
	uint32_t offset;
	char *endptr;
	uint64_t laid, paid;
	int len;
	int ret;

	offset = strtoul(argv[0], &endptr, 0);
	if (*endptr != '\0')
		return (CMD_EINVAL);

	laid = opts.laid_valid ? opts.laid : 0x1070000002000001ull;
	paid = opts.paid_valid ? opts.paid : 0x10700003ff000001ull;

	ps3dm_init_header(&read_eprom.dm_hdr, 1, PS3DM_FID_UM,
	    sizeof(read_eprom) - sizeof(struct ps3dm_header),
	    sizeof(read_eprom) - sizeof(struct ps3dm_header));
	ps3dm_init_ss_header(&read_eprom.ss_hdr, PS3DM_PID_UM_READ_EPROM,
	    laid, paid);
	read_eprom.offset = offset;

	len = sizeof(read_eprom);

	ret = dev_write(&read_eprom, len);
	if (ret != len)
		return (CMD_EIO);

	ret = dev_read(&read_eprom, sizeof(read_eprom));
	if (ret != sizeof(read_eprom))
		return (CMD_EIO);

	if (opts.do_verbose > 0)
		fprintf(stderr, "ss status %d\n", read_eprom.ss_hdr.status);

	if (read_eprom.ss_hdr.status)
		return (CMD_EIO);

	fprintf(stdout, "%02x\n", read_eprom.data);

	return (CMD_EOK);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x58, %rsp
movq (%rcx), %rdi
leaq 0x8(%rsp), %rbx
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2110
movq (%rbx), %rcx
movl $0x2, %ebx
cmpb $0x0, (%rcx)
jne 0x36c2
leaq 0x3aab(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x3622
movq 0x18(%r14), %rcx
jmp 0x362c
movabsq $0x1070000002000001, %rcx # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x3639
movq 0x28(%r14), %rdx
jmp 0x3643
movabsq $0x10700003ff000001, %rdx # imm = 0x10700003FF000001
movaps 0xf56(%rip), %xmm0      # 0x45a0
leaq 0x10(%rsp), %rdi
movups %xmm0, (%rdi)
movq $0x600b, 0x10(%rdi)     # imm = 0x600B
movq $0x6000, 0x18(%rdi)     # imm = 0x6000
movq %rcx, 0x28(%rdi)
movq %rdx, 0x30(%rdi)
movl %eax, 0x38(%rdi)
movl $0x48, %esi
callq 0x2730
movl $0x3, %ebx
cmpl $0x48, %eax
jne 0x36c2
leaq 0x10(%rsp), %rdi
movl $0x48, %esi
callq 0x2751
cmpl $0x48, %eax
jne 0x36c2
cmpl $0x0, 0x8(%r14)
jg 0x36cc
cmpl $0x0, 0x30(%rsp)
jne 0x36c2
movq 0x391e(%rip), %rax      # 0x6fc8
movq (%rax), %rdi
movzbl 0x50(%rsp), %edx
leaq 0xef7(%rip), %rsi       # 0x45b0
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x20d0
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r14
retq
leaq 0x10(%rsp), %rdi
callq 0x2368
jmp 0x369c
// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/ps3dm/um/cmd_um_write_eprom.c
// Function: cmd_um_write_eprom_exec
int
cmd_um_write_eprom_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct ps3dm_um_write_eprom write_eprom;
	uint32_t offset, data;
	char *endptr;
	uint64_t laid, paid;
	int len;
	int ret;

	offset = strtoul(argv[0], &endptr, 0);
	if (*endptr != '\0')
		return (CMD_EINVAL);

	data = strtoul(argv[1], &endptr, 0);
	if (*endptr != '\0' || data > 0xff)
		return (CMD_EINVAL);

	laid = opts.laid_valid ? opts.laid : 0x1070000002000001ull;
	paid = opts.paid_valid ? opts.paid : 0x10700003ff000001ull;

	ps3dm_init_header(&write_eprom.dm_hdr, 1, PS3DM_FID_UM,
	    sizeof(write_eprom) - sizeof(struct ps3dm_header),
	    sizeof(write_eprom) - sizeof(struct ps3dm_header));
	ps3dm_init_ss_header(&write_eprom.ss_hdr, PS3DM_PID_UM_WRITE_EPROM,
	    laid, paid);
	write_eprom.offset = offset;
	write_eprom.data = data;

	len = sizeof(write_eprom);

	ret = dev_write(&write_eprom, len);
	if (ret != len)
		return (CMD_EIO);

	ret = dev_write(&write_eprom, sizeof(write_eprom));
	if (ret != sizeof(write_eprom))
		return (CMD_EIO);

	if (opts.do_verbose > 0)
		fprintf(stderr, "ss status %d\n", write_eprom.ss_hdr.status);

	if (write_eprom.ss_hdr.status)
		return (CMD_EIO);

	return (CMD_EOK);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x58, %rsp
movq %rcx, %r14
movq (%rcx), %rdi
leaq 0x8(%rsp), %r15
movq %r15, %rsi
xorl %edx, %edx
callq 0x2110
movq %rax, %rbx
movq (%r15), %rax
movl $0x2, %ebp
cmpb $0x0, (%rax)
jne 0x37d5
movq 0x8(%r14), %rdi
leaq 0x8(%rsp), %r14
movq %r14, %rsi
xorl %edx, %edx
callq 0x2110
movq (%r14), %rcx
cmpb $0x0, (%rcx)
setne %cl
testl $0xffffff00, %eax       # imm = 0xFFFFFF00
setne %dl
orb %cl, %dl
jne 0x37d5
leaq 0x3982(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x374b
movq 0x18(%r14), %rcx
jmp 0x3755
movabsq $0x1070000002000001, %rcx # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x3762
movq 0x28(%r14), %rdx
jmp 0x376c
movabsq $0x10700003ff000001, %rdx # imm = 0x10700003FF000001
movaps 0xe2d(%rip), %xmm0      # 0x45a0
leaq 0x10(%rsp), %rdi
movups %xmm0, (%rdi)
movq $0x600c, 0x10(%rdi)     # imm = 0x600C
movq $0x6000, 0x18(%rdi)     # imm = 0x6000
movq %rcx, 0x28(%rdi)
movq %rdx, 0x30(%rdi)
movl %ebx, 0x38(%rdi)
movb %al, 0x40(%rdi)
movl $0x48, %esi
callq 0x2730
movl $0x3, %ebp
cmpl $0x48, %eax
jne 0x37d5
leaq 0x10(%rsp), %rdi
movl $0x48, %esi
callq 0x2730
cmpl $0x48, %eax
jne 0x37d5
cmpl $0x0, 0x8(%r14)
jg 0x37e2
xorl %eax, %eax
cmpl $0x0, 0x30(%rsp)
setne %al
leal (%rax,%rax,2), %ebp
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10(%rsp), %rdi
callq 0x238c
jmp 0x37c8
nop
// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/ps3dm/scm/cmd_scm_get_region_data.c
// Function: cmd_scm_get_region_data_exec
int
cmd_scm_get_region_data_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct ps3dm_scm_get_region_data get_region_data;
	uint64_t id;
	char *endptr;
	uint64_t laid, paid;
	int len;
	int ret;

	id = strtoull(argv[0], &endptr, 0);
	if (*endptr != '\0')
		return (CMD_EINVAL);

	laid = opts.laid_valid ? opts.laid : 0x1070000002000001ull;
	paid = opts.paid_valid ? opts.paid : 0x10700003ff000001ull;

	ps3dm_init_header(&get_region_data.dm_hdr, 1, PS3DM_FID_SCM,
	    sizeof(get_region_data) - sizeof(struct ps3dm_header),
	    sizeof(get_region_data) - sizeof(struct ps3dm_header));
	ps3dm_init_ss_header(&get_region_data.ss_hdr, PS3DM_PID_SCM_GET_REGION_DATA,
	    laid, paid);
	get_region_data.id = id;
	get_region_data.data_size = 0x30;

	len = sizeof(get_region_data);

	ret = dev_write(&get_region_data, len);
	if (ret != len)
		return (CMD_EIO);

	ret = dev_read(&get_region_data, sizeof(get_region_data));
	if (ret < (sizeof(struct ps3dm_header) + sizeof(struct ps3dm_ss_header)))
		return (CMD_EIO);

	if (opts.do_verbose > 0)
		fprintf(stderr, "ss status %d\n", get_region_data.ss_hdr.status);

	if (get_region_data.ss_hdr.status)
		return (CMD_EIO);

	if (ret != sizeof(get_region_data))
		return (CMD_EIO);

	fwrite(get_region_data.data, 1, get_region_data.data_size, stdout);

	return (CMD_EOK);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq (%rcx), %rdi
movq %rsp, %rbx
movq %rbx, %rsi
xorl %edx, %edx
callq 0x20b0
movq (%rbx), %rcx
movl $0x2, %ebx
cmpb $0x0, (%rcx)
jne 0x38f4
leaq 0x3889(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x3844
movq 0x18(%r14), %rcx
jmp 0x384e
movabsq $0x1070000002000001, %rcx # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x385b
movq 0x28(%r14), %rdx
jmp 0x3865
movabsq $0x10700003ff000001, %rdx # imm = 0x10700003FF000001
movaps 0xdd4(%rip), %xmm0      # 0x4640
leaq 0x8(%rsp), %rdi
movups %xmm0, (%rdi)
movq $0x9006, 0x10(%rdi)     # imm = 0x9006
movq $0x9000, 0x18(%rdi)     # imm = 0x9000
movq %rcx, 0x28(%rdi)
movq %rdx, 0x30(%rdi)
movq %rax, 0x38(%rdi)
movq $0x30, 0x40(%rdi)
movl $0x78, %esi
callq 0x2730
movl $0x3, %ebx
cmpl $0x78, %eax
jne 0x38f4
leaq 0x8(%rsp), %rdi
movl $0x78, %esi
callq 0x2751
cmpl $0x38, %eax
jb 0x38f4
movl %eax, %ebp
cmpl $0x0, 0x8(%r14)
jg 0x3902
cmpl $0x78, %ebp
jne 0x38f4
cmpl $0x0, 0x28(%rsp)
jne 0x38f4
leaq 0x50(%rsp), %rdi
movq -0x8(%rdi), %rdx
movq 0x36e3(%rip), %rax      # 0x6fc8
movq (%rax), %rcx
movl $0x1, %esi
callq 0x2130
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x80, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x8(%rsp), %rdi
callq 0x23b0
jmp 0x38c9
nop
// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/cmd/cmd.c
// Function: cmd_find
struct cmd *
cmd_find(int cmdc, struct cmd **cmdv, const char *name)
{
	int l, r, m;
	int cmp;

	l = 0;
	r = cmdc - 1;

	while (l <= r) {
		m = (l + r) / 2;

		cmp = strcmp(name, cmdv[m]->name);
		if (!cmp)
			return (cmdv[m]);
		else if (cmp < 0)
			r = m - 1;
		else
			l = m + 1;

	}

	return (NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testl %edi, %edi
jle 0x395b
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %r15d
decl %r15d
xorl %r13d, %r13d
leal (%r15,%r13), %ebp
shrl %ebp
movq (%r14,%rbp,8), %r12
movq (%r12), %rsi
movq %rbx, %rdi
callq 0x20c0
testl %eax, %eax
je 0x395e
js 0x3951
incl %ebp
movl %ebp, %r13d
jmp 0x3956
decl %ebp
movl %ebp, %r15d
cmpl %r15d, %r13d
jle 0x392e
xorl %r12d, %r12d
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/cmd/cmd.c
// Function: cmd_exec
int
cmd_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct cmd *cmd;

	if (argc <= 0)
		return (CMD_EBADCMD);

	cmd = cmd_find(cmdc, cmdv, argv[0]);
	if (!cmd)
		return (CMD_EBADCMD);

	if ((cmd->min_argc != -1 && (argc - 1) < cmd->min_argc) ||
	    (cmd->max_argc != -1 && (argc - 1) > cmd->max_argc))
		return (CMD_EINVAL);

	return (cmd->exec(cmdc, cmdv, argc - 1, argv + 1));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl $0x1, %r12d
testl %edx, %edx
jle 0x39c6
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r14
movl %edi, %r15d
movq (%rcx), %rdx
callq 0x3910
testq %rax, %rax
je 0x39c6
movl 0x18(%rax), %ecx
cmpl $-0x1, %ecx
setne %dl
cmpl %ebp, %ecx
setge %cl
movl $0x2, %r12d
testb %cl, %dl
jne 0x39c6
movl 0x1c(%rax), %ecx
cmpl $-0x1, %ecx
setne %dl
decl %ebp
cmpl %ecx, %ebp
setg %cl
testb %cl, %dl
je 0x39d2
movl %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%rax), %rax
addq $0x8, %rbx
movl %r15d, %edi
movq %r14, %rsi
movl %ebp, %edx
movq %rbx, %rcx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmpq *%rax
nop
// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/cmd/cmd_list.c
// Function: cmd_list_exec
int
cmd_list_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	int i;

	for (i = 0; i < cmdc; i++)
		fprintf(stdout, "%s\n", cmdv[i]->name);

	return (CMD_EOK);
}

// Assembly:
testl %edi, %edi
jle 0x3a3a
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movl %edi, %r15d
movq 0x35be(%rip), %r12      # 0x6fc8
leaq 0xc98(%rip), %r14       # 0x46a9
xorl %r13d, %r13d
movq (%r12), %rdi
movq (%rbx,%r13,8), %rax
movq (%rax), %rdx
movq %r14, %rsi
xorl %eax, %eax
callq 0x20d0
incq %r13
cmpq %r13, %r15
jne 0x3a14
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
xorl %eax, %eax
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/cmd/cmd_help.c
// Function: cmd_help_exec
int
cmd_help_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct cmd *cmd;
	int i;

	for (i = 0; i < argc; i++) {
		cmd = cmd_find(cmdc, cmdv, argv[i]);
		if (cmd) {
			fprintf(stdout, "%s\n", cmd->help);
			fprintf(stdout, "usage: %s\n", cmd->usage);
		} else {
			fprintf(stdout, "invalid command %s\n", argv[i]);
		}
	}

	return (CMD_EOK);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, (%rsp)
testl %edx, %edx
jle 0x3abb
movq %rcx, %rbx
movl %edi, %ebp
movl %edx, %r12d
xorl %r13d, %r13d
movq (%rbx,%r13,8), %rdx
movl %ebp, %edi
movq (%rsp), %rsi
callq 0x3910
movq 0x3554(%rip), %r14      # 0x6fc8
movq (%r14), %rdi
testq %rax, %rax
je 0x3aa1
movq %rax, %r15
movq 0x8(%rax), %rdx
leaq 0xc1f(%rip), %rsi       # 0x46a9
xorl %eax, %eax
callq 0x20d0
movq (%r14), %rdi
movq 0x10(%r15), %rdx
leaq 0xc03(%rip), %rsi       # 0x46a2
jmp 0x3aac
movq (%rbx,%r13,8), %rdx
leaq 0xc01(%rip), %rsi       # 0x46ad
xorl %eax, %eax
callq 0x20d0
incq %r13
cmpq %r13, %r12
jne 0x3a5e
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/util/util.c
// Function: parse_hex
int
parse_hex(const char *s, unsigned char *b, int maxlen)
{
	int len;
	char c;
	int i;

	len = strlen(s);
	if (len % 2)
		return (-1);

	for (i = 0; (i < (len / 2)) && (i < maxlen); i++) {
		if (!isxdigit(s[2 * i + 0]) || !isxdigit(s[2 * i + 1]))
			return (-1);

		b[i] = 0;

		c = tolower(s[2 * i + 0]);
		if (isdigit(c))
			b[i] += (c - '0') * 16;
		else
			b[i] += (c - 'a' + 10) * 16;

		c = tolower(s[2 * i + 1]);
		if (isdigit(c))
			b[i] += c - '0';
		else
			b[i] += c - 'a' + 10;
	}

	return (i);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
callq 0x2050
movq %rax, %r12
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb $0x1, %r12b
jne 0x3bb6
sarl %r12d
cmpl %ebp, %r12d
cmovgel %ebp, %r12d
testl %r12d, %r12d
jle 0x3bb4
callq 0x2150
movq %rax, %r13
movl %r12d, %ebp
xorl %ebx, %ebx
movq (%r13), %rax
movsbq (%r15,%rbx,2), %rcx
testb $0x10, 0x1(%rax,%rcx,2)
je 0x3bad
movsbq 0x1(%r15,%rbx,2), %rcx
testb $0x10, 0x1(%rax,%rcx,2)
je 0x3bad
movb $0x0, (%r14,%rbx)
callq 0x2140
movq (%rax), %rcx
movsbq (%r15,%rbx,2), %rdx
movl (%rcx,%rdx,4), %ecx
movq (%r13), %rdx
movsbq %cl, %rsi
movzwl (%rdx,%rsi,2), %edx
shll $0x4, %ecx
leal -0x70(%rcx), %esi
btl $0xb, %edx
movzbl %sil, %edx
cmovbl %ecx, %edx
movb %dl, (%r14,%rbx)
movq (%rax), %rax
movsbq 0x1(%r15,%rbx,2), %rcx
movsbq (%rax,%rcx,4), %rax
movq (%r13), %rcx
movzwl (%rcx,%rax,2), %ecx
btl $0xb, %ecx
movl $0xd0, %ecx
movl $0xa9, %esi
cmovael %esi, %ecx
addb %al, %cl
addb %dl, %cl
movb %cl, (%r14,%rbx)
incq %rbx
cmpq %rbx, %rbp
jne 0x3b16
movl %r12d, %eax
jmp 0x3bb6
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x3bb6
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/util/util.c
// Function: hex_fprintf
void
hex_fprintf(FILE *fp, const char *buf, size_t len)
{
	int i;

	if (len <= 0)
		return;

	for (i = 0; i < len; i++) {
		if ((i > 0) && !(i % 16))
			fprintf(fp, "\n");

		fprintf(fp, "%02x ", buf[i]);
	}

	fprintf(fp, "\n");
}

// Assembly:
testq %rdx, %rdx
je 0x3c34
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xb10(%rip), %r12       # 0x46f3
xorl %r13d, %r13d
testq %r13, %r13
sete %al
testb $0xf, %r13b
setne %cl
orb %al, %cl
jne 0x3c04
movl $0xa, %edi
movq %rbx, %rsi
callq 0x2090
movsbl (%r15,%r13), %edx
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x20d0
incq %r13
cmpq %r13, %r14
jne 0x3be6
movl $0xa, %edi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x2090
retq
// File: /workspace/github_c_makefile_star2_O1/DVaronos[P]AnLogProject1/logistic.c
// Function: ModelIinit
Model* ModelIinit(int size){
	Model* model=malloc(sizeof(Model));
	model->array_size=2*size;
  model->weight_array=malloc(sizeof(double)*(model->array_size));
  memset(model->weight_array, 0,(model->array_size)*sizeof(double));
	return model;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edi, %ebx
movl $0x18, %edi
callq 0x11a0
movq %rax, %r14
addl %ebx, %ebx
movl %ebx, 0x10(%rax)
movslq %ebx, %rbx
shlq $0x3, %rbx
movq %rbx, %rdi
callq 0x11a0
movq %rax, (%r14)
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x10f0
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/DVaronos[P]AnLogProject1/logistic.c
// Function: GetCameraVector
HVector* GetCameraVector(char* camera_id, Hash* H){
	NList *L;
	int i=0,j=0,in;
	char name[20];
	while(camera_id[i]!='/')
	{//Vrisko to simio pou teliwnei to onoma ths istoselidas tou proiontos
		i++;
	}
	i+=2;//pigeno to i sthn thesh pou arxizei o arithmos tou proiontos
	while(i<strlen(camera_id))
	{
		name[j]=camera_id[i];
		j++;
		i++;
	}
	name[j]='\0';
	in=atoi(name);//apothievo ton arithmo tou proiontos ston int in
	int index=hash(in,H->size);
	L=(NList*)H[index].Head;//pernw thn lista pou vriskete sto index bucket tou HashTable
	L = L->Next;
	while(L!=NULL){
		if(strcmp(L->camera,camera_id) == 0)	return L->vector;
		L=L->Next;
	}
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl $0x1, %r15d
cmpb $0x2f, -0x1(%rbx,%r15)
leaq 0x1(%r15), %r15
jne 0x1ed2
movq %rbx, %rdi
callq 0x10c0
movl %r15d, %ecx
cmpq %rcx, %rax
jbe 0x1f07
xorl %ecx, %ecx
movb (%rbx,%r15), %dl
movb %dl, -0x30(%rbp,%rcx)
incq %rcx
incq %r15
cmpq %r15, %rax
ja 0x1ef0
movl %ecx, %eax
jmp 0x1f09
xorl %eax, %eax
movb $0x0, -0x30(%rbp,%rax)
leaq -0x30(%rbp), %rdi
callq 0x1240
movl (%r14), %esi
movl %eax, %edi
callq 0x4230
cltq
shlq $0x4, %rax
movq 0x8(%r14,%rax), %r15
xorl %r14d, %r14d
movq 0x20(%r15), %r15
testq %r15, %r15
je 0x1f4b
movq (%r15), %rdi
movq %rbx, %rsi
callq 0x1140
testl %eax, %eax
jne 0x1f2f
movq 0x18(%r15), %r14
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/DVaronos[P]AnLogProject1/logistic.c
// Function: VectorConcat
HVector* VectorConcat(HVector* F,HVector* S,int dif){
	int size=(F->count)+(S->count),c=0;
	size+=(size*0.3);
	HVector* C=CreateHVector(size);

	int fr,se;
	fr=F->sum;
	se=S->sum;
	if(fr>se){//Eelgxo pio ap ta dio vectors tha mpei proto
		c=0;
		for(int i=0 ; i<F->size ; i++){	//Isago tis leksis tou protou vector
			if(F[i].key!=-1){
				c++;
				C=InsertHVector(C,F[i].key,F[i].value);
			}
			if(c==F->count) break;
		}
		c=0;
		for(int i=0 ; i<S->size ; i++){	//Isago tis leksis tou defterou vectour me afksimeno to key kata dif
			if(S[i].key!=-1){
				c++;
				C=InsertHVector(C,(S[i].key)+dif,S[i].value);
			}
			if(c==S->count) break;
		}

	}else{
		c=0;
		for(int i=0 ; i<S->size ; i++){
			if(S[i].key!=-1){
				c++;
				C=InsertHVector(C,S[i].key,S[i].value);
			}
			if(c==S->count) break;
		}
		c=0;
		for(int i=0 ; i<F->size ; i++){
			if(F[i].key!=-1){
				c++;
				C=InsertHVector(C,(F[i].key)+dif,F[i].value);
			}
			if(c==F->count) break;
		}
	}
	return C;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
movl 0x18(%rsi), %eax
addl 0x18(%rdi), %eax
movl %edx, %ebx
cvtsi2sd %eax, %xmm0
movsd 0x428f(%rip), %xmm1     # 0x6210
mulsd %xmm0, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %edi
callq 0x3f68
cvttsd2si 0x10(%r15), %ecx
cvttsd2si 0x10(%r14), %edx
cmpl %edx, %ecx
movl %ebx, -0x2c(%rbp)
jle 0x203b
cmpl $0x0, 0x1c(%r15)
jle 0x1fe9
leaq 0x8(%r15), %r12
xorl %r13d, %r13d
xorl %ebx, %ebx
movl -0x8(%r12), %esi
cmpl $-0x1, %esi
je 0x1fd3
incl %ebx
movsd (%r12), %xmm0
movq %rax, %rdi
callq 0x3fbe
cmpl 0x18(%r15), %ebx
je 0x1fe9
incq %r13
movslq 0x1c(%r15), %rcx
addq $0x20, %r12
cmpq %rcx, %r13
jl 0x1fb9
cmpl $0x0, 0x1c(%r14)
jle 0x20c0
leaq 0x8(%r14), %r15
xorl %r12d, %r12d
xorl %r13d, %r13d
movl -0x2c(%rbp), %ebx
movl -0x8(%r15), %esi
cmpl $-0x1, %esi
je 0x201c
incl %r13d
addl %ebx, %esi
movsd (%r15), %xmm0
movq %rax, %rdi
callq 0x3fbe
cmpl 0x18(%r14), %r13d
je 0x20c0
incq %r12
movslq 0x1c(%r14), %rcx
addq $0x20, %r15
cmpq %rcx, %r12
jl 0x2001
jmp 0x20c0
cmpl $0x0, 0x1c(%r14)
jle 0x207b
leaq 0x8(%r14), %r12
xorl %r13d, %r13d
xorl %ebx, %ebx
movl -0x8(%r12), %esi
cmpl $-0x1, %esi
je 0x2065
incl %ebx
movsd (%r12), %xmm0
movq %rax, %rdi
callq 0x3fbe
cmpl 0x18(%r14), %ebx
je 0x207b
incq %r13
movslq 0x1c(%r14), %rcx
addq $0x20, %r12
cmpq %rcx, %r13
jl 0x204b
cmpl $0x0, 0x1c(%r15)
jle 0x20c0
leaq 0x8(%r15), %r14
xorl %r12d, %r12d
xorl %r13d, %r13d
movl -0x2c(%rbp), %ebx
movl -0x8(%r14), %esi
cmpl $-0x1, %esi
je 0x20aa
incl %r13d
addl %ebx, %esi
movsd (%r14), %xmm0
movq %rax, %rdi
callq 0x3fbe
cmpl 0x18(%r15), %r13d
je 0x20c0
incq %r12
movslq 0x1c(%r15), %rcx
addq $0x20, %r14
cmpq %rcx, %r12
jl 0x208f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/DVaronos[P]AnLogProject1/logistic.c
// Function: InputInit
Input* InputInit(){
	Input* in = malloc(sizeof(Input));
	in->Cons = NULL;
	in->matches = NULL;
	in->size = 0;
	return in;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0x18, %edi
callq 0x11a0
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0x0, 0x10(%rax)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/DVaronos[P]AnLogProject1/logistic.c
// Function: FreeInput
void FreeInput(Input* input)
{
	free(input->matches);
	for(int i =0; i<input->size; i++)
	{
		FreeHVector(input->Cons[i]);
	}
	free(input->Cons);
	free(input);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x1030
cmpl $0x0, 0x10(%rbx)
jle 0x2120
xorl %r14d, %r14d
movq (%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x39cb
incq %r14
movslq 0x10(%rbx), %rax
cmpq %rax, %r14
jl 0x2108
movq (%rbx), %rdi
callq 0x1030
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O1/DVaronos[P]AnLogProject1/logistic.c
// Function: JobTraining
void JobTraining(void *args){

	TrainStruct* arg=(TrainStruct*)args;
	int i,j,c;
	double k,p,result;
	HVector* Con;
	for( i=arg->start ; i<arg->end ; i++){
			Con=arg->input->Cons[i];
    	p=Predict(&(arg->w),&(arg->b),Con);	//Ipologizoume thn provlepsh tou modelou
    	k=p-(arg->input->matches[i]);	//Ipologizoume thn apoklhsh ths provlepshs
			c=0;
    	for( j=0 ;  j<Con->size ; j++){	//Gia kathe varos
				if(Con[j].key!=-1){
					c++;
					result=k*Con[j].value;	//Ipologizoume to ginomeno ths apoklishs epi thn timh tou concat se afthn thn diastash
					arg->w[Con[j].key]=arg->w[Con[j].key]-(0.6*result);
					arg->b = (double)((arg->b) +k)/(double)2;	//enimeronoume to b
				}
				if(c==Con->count) break;
    	}
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq (%rdi), %r13
cmpl 0x4(%rdi), %r13d
jge 0x2720
movq %rdi, %rbx
leaq 0x10(%rdi), %r14
leaq 0x8(%rdi), %r15
movq 0x18(%rbx), %rax
movq (%rax), %rax
movq (%rax,%r13,8), %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x2951
xorpd 0x3bd8(%rip), %xmm0     # 0x6240
callq 0x12a0
movsd 0x3bb3(%rip), %xmm3     # 0x6228
movsd 0x3ba3(%rip), %xmm2     # 0x6220
movslq 0x1c(%r12), %rax
testq %rax, %rax
jle 0x2710
movsd 0x3b85(%rip), %xmm1     # 0x6218
addsd %xmm1, %xmm0
divsd %xmm0, %xmm1
movq 0x18(%rbx), %rcx
movq 0x8(%rcx), %rcx
xorps %xmm0, %xmm0
cvtsi2sdl (%rcx,%r13,4), %xmm0
subsd %xmm0, %xmm1
movl 0x18(%r12), %ecx
addq $0x8, %r12
xorl %edx, %edx
movl $0x1, %esi
movslq -0x8(%r12), %rdi
cmpq $-0x1, %rdi
je 0x26fc
incl %edx
movsd (%r12), %xmm0
mulsd %xmm1, %xmm0
movq (%r14), %r8
mulsd %xmm2, %xmm0
addsd (%r8,%rdi,8), %xmm0
movsd %xmm0, (%r8,%rdi,8)
movsd (%r15), %xmm0
addsd %xmm1, %xmm0
mulsd %xmm3, %xmm0
movsd %xmm0, (%r15)
cmpl %ecx, %edx
je 0x2710
addq $0x20, %r12
leaq 0x1(%rsi), %rdi
cmpq %rax, %rsi
movq %rdi, %rsi
jb 0x26c0
incq %r13
movslq 0x4(%rbx), %rax
cmpq %rax, %r13
jl 0x2647
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/DVaronos[P]AnLogProject1/logistic.c
// Function: Fx
double Fx(double** w,double* b,HVector* con){
  double wx,sum=*(b);
	double* W=*w;
	int c=0;
  for(int i=0; i<con->size ; i++){	//Ipologismos tou f(X)
		if(con[i].key!=-1){
			c++;
			wx=W[con[i].key]*(con[i].value);
			sum+=wx;
		}
		if(c==con->count) break;
	}
  return sum;
}

// Assembly:
movsd (%rsi), %xmm0
movslq 0x1c(%rdx), %rax
testq %rax, %rax
jle 0x29a4
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rcx
movl 0x18(%rdx), %esi
shlq $0x5, %rax
addq $-0x20, %rax
xorl %edi, %edi
xorl %r8d, %r8d
movslq (%rdx,%rdi), %r9
cmpq $-0x1, %r9
je 0x2992
incl %r8d
movsd (%rcx,%r9,8), %xmm1
mulsd 0x8(%rdx,%rdi), %xmm1
addsd %xmm1, %xmm0
cmpl %esi, %r8d
je 0x29a3
leaq 0x20(%rdi), %r9
cmpq %rdi, %rax
movq %r9, %rdi
jne 0x2975
popq %rbp
retq