LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/sguerrini97[P]ps3linux-ps3vuart-tools/ps3dm/sm/cmd_sm_get_rnd.c
// Function: cmd_sm_get_rnd_exec
int
cmd_sm_get_rnd_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct ps3dm_sm_get_rnd get_rnd;
	uint64_t laid, paid;
	int len;
	int ret;

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

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

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

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

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

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

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

	fwrite((char *) get_rnd.rnd, 1, sizeof(get_rnd.rnd), stdout);

	return (CMD_EOK);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x58, %rsp
leaq 0x47be(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
movabsq $0x1070000002000001, %rax # imm = 0x1070000002000001
movq %rax, %rcx
je 0x291a
movq 0x18(%r14), %rcx
cmpl $0x0, 0x30(%r14)
je 0x2927
movq 0x28(%r14), %rax
jmp 0x292d
addq $0x2f000000, %rax       # imm = 0x2F000000
movaps 0x188c(%rip), %xmm0     # 0x41c0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movq $0x5003, 0x10(%rdi)     # imm = 0x5003
movq $0x5000, 0x18(%rdi)     # imm = 0x5000
movq %rcx, 0x28(%rdi)
movq %rax, 0x30(%rdi)
movl $0x38, %esi
callq 0x273c
movl $0x3, %ebx
cmpl $0x38, %eax
jne 0x29a6
movq %rsp, %rdi
movl $0x50, %esi
callq 0x275d
cmpl $0x50, %eax
jne 0x29a6
cmpl $0x0, 0x8(%r14)
jg 0x29b0
cmpl $0x0, 0x20(%rsp)
jne 0x29a6
leaq 0x38(%rsp), %rdi
movq 0x4636(%rip), %rax      # 0x6fc8
movq (%rax), %rcx
movl $0x1, %esi
movl $0x18, %edx
callq 0x2130
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r14
retq
movq %rsp, %rdi
callq 0x2194
jmp 0x297f
nop
// File: /workspace/github_c_makefile_star2_O3/sguerrini97[P]ps3linux-ps3vuart-tools/ps3dm/sm/cmd_sm_get_version.c
// Function: cmd_sm_get_version_exec
int
cmd_sm_get_version_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct ps3dm_sm_get_version get_version;
	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_version.dm_hdr, 1, PS3DM_FID_SM,
	    sizeof(struct ps3dm_ss_header),
	    sizeof(get_version) - sizeof(struct ps3dm_header));
	ps3dm_init_ss_header(&get_version.ss_hdr, PS3DM_PID_SM_GET_VERSION,
	    laid, paid);

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

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

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

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

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

	hex_fprintf(stdout, (char *) get_version.version,
	    sizeof(get_version.version));

	return (CMD_EOK);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
leaq 0x46f6(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x29d7
movq 0x18(%r14), %rax
jmp 0x29e1
movabsq $0x1070000002000001, %rax # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x29ee
movq 0x28(%r14), %rcx
jmp 0x29f8
movabsq $0x10700003ff000001, %rcx # imm = 0x10700003FF000001
movaps 0x17f1(%rip), %xmm0     # 0x41f0
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movq $0x5006, 0x10(%rdi)     # imm = 0x5006
movq $0x5000, 0x18(%rdi)     # imm = 0x5000
movq %rax, 0x28(%rdi)
movq %rcx, 0x30(%rdi)
movl $0x38, %esi
callq 0x273c
movl $0x3, %ebx
cmpl $0x38, %eax
jne 0x2a6c
movq %rsp, %rdi
movl $0x40, %esi
callq 0x275d
cmpl $0x40, %eax
jne 0x2a6c
cmpl $0x0, 0x8(%r14)
jg 0x2a76
cmpl $0x0, 0x20(%rsp)
jne 0x2a6c
movq 0x4570(%rip), %rax      # 0x6fc8
movq (%rax), %rdi
leaq 0x38(%rsp), %rsi
movl $0x8, %edx
callq 0x3bc1
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
movq %rsp, %rdi
callq 0x21b8
jmp 0x2a4a
// File: /workspace/github_c_makefile_star2_O3/sguerrini97[P]ps3linux-ps3vuart-tools/ps3dm/sm/cmd_sm_set_del_encdec_key.c
// Function: cmd_sm_set_del_encdec_key_exec
int
cmd_sm_set_del_encdec_key_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct ps3dm_sm_set_del_encdec_key set_del_encdec_key;
	uint64_t arg, laid, paid;
	char *endptr;
	int ret;

	arg = 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(&set_del_encdec_key.dm_hdr, 1, PS3DM_FID_SM,
	    sizeof(set_del_encdec_key) - sizeof(struct ps3dm_header),
	    sizeof(set_del_encdec_key) - sizeof(struct ps3dm_header));
	ps3dm_init_ss_header(&set_del_encdec_key.ss_hdr, PS3DM_PID_SM_SET_DEL_ENCDEC_KEY,
	    laid, paid);
	set_del_encdec_key.arg = arg;

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

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

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

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

	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 0x2b46
leaq 0x460f(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x2abe
movq 0x18(%r14), %rcx
jmp 0x2ac8
movabsq $0x1070000002000001, %rcx # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x2ad5
movq 0x28(%r14), %rdx
jmp 0x2adf
movabsq $0x10700003ff000001, %rdx # imm = 0x10700003FF000001
movaps 0x168a(%rip), %xmm0     # 0x4170
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x5002, 0x10(%rdi)     # imm = 0x5002
movq $0x5000, 0x18(%rdi)     # imm = 0x5000
movq %rcx, 0x28(%rdi)
movq %rdx, 0x30(%rdi)
movq %rax, 0x38(%rdi)
movl $0x40, %esi
callq 0x273c
movl $0x3, %ebx
cmpl $0x40, %eax
jne 0x2b46
leaq 0x10(%rsp), %rdi
movl $0x40, %esi
callq 0x275d
cmpl $0x40, %eax
jne 0x2b46
cmpl $0x0, 0x8(%r14)
jg 0x2b50
xorl %eax, %eax
cmpl $0x0, 0x30(%rsp)
setne %al
leal (%rax,%rax,2), %ebx
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r14
retq
leaq 0x10(%rsp), %rdi
callq 0x21dc
jmp 0x2b39
// File: /workspace/github_c_makefile_star2_O3/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 0x3ac8
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
movaps %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 0x273c
movl $0x3, %ebx
cmpl $0x60, %eax
jne 0x2c72
leaq 0x20(%rsp), %rdi
movl $0x60, %esi
callq 0x275d
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_O3/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 $0x68, %rsp
movq (%rcx), %rdi
leaq 0x8(%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 0x2d8f
leaq 0x43df(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x2cee
movq 0x18(%r14), %rcx
jmp 0x2cf8
movabsq $0x1070000002000001, %rcx # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x2d05
movq 0x28(%r14), %rdx
jmp 0x2d0f
movabsq $0x10700003ff000001, %rdx # imm = 0x10700003FF000001
movaps 0x15da(%rip), %xmm0     # 0x42f0
leaq 0x10(%rsp), %rdi
movaps %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 0x273c
movl $0x3, %ebx
cmpl $0x50, %eax
jne 0x2d8f
leaq 0x10(%rsp), %rdi
movl $0x50, %esi
callq 0x275d
cmpl $0x50, %eax
jne 0x2d8f
cmpl $0x0, 0x8(%r14)
jg 0x2d99
cmpl $0x0, 0x30(%rsp)
jne 0x2d8f
movq 0x4251(%rip), %rax      # 0x6fc8
movq (%rax), %rdi
movq 0x50(%rsp), %rdx
leaq 0x157a(%rip), %rsi      # 0x4300
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x20d0
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
retq
leaq 0x10(%rsp), %rdi
callq 0x2224
jmp 0x2d69
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/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 $0x58, %rsp
movq (%rcx), %rdi
leaq 0x8(%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 0x2e7d
leaq 0x42d8(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x2df5
movq 0x18(%r14), %rcx
jmp 0x2dff
movabsq $0x1070000002000001, %rcx # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x2e0c
movq 0x28(%r14), %rdx
jmp 0x2e16
movabsq $0x10700003ff000001, %rdx # imm = 0x10700003FF000001
movaps 0x1513(%rip), %xmm0     # 0x4330
leaq 0x10(%rsp), %rdi
movaps %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 0x273c
movl $0x3, %ebx
cmpl $0x40, %eax
jne 0x2e7d
leaq 0x10(%rsp), %rdi
movl $0x40, %esi
callq 0x275d
cmpl $0x40, %eax
jne 0x2e7d
cmpl $0x0, 0x8(%r14)
jg 0x2e87
xorl %eax, %eax
cmpl $0x0, 0x30(%rsp)
setne %al
leal (%rax,%rax,2), %ebx
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r14
retq
leaq 0x10(%rsp), %rdi
callq 0x2248
jmp 0x2e70
nop
// File: /workspace/github_c_makefile_star2_O3/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 0x420a(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x2ec3
movq 0x18(%r14), %rax
jmp 0x2ecd
movabsq $0x1070000002000001, %rax # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x2eda
movq 0x28(%r14), %rcx
jmp 0x2ee4
movabsq $0x10700003ff000001, %rcx # imm = 0x10700003FF000001
movaps 0x14a5(%rip), %xmm0     # 0x4390
movq %rsp, %rdi
movaps %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 0x273c
movl $0x3, %ebx
cmpl $0x38, %eax
jne 0x2f43
movq %rsp, %rdi
movl $0x38, %esi
callq 0x275d
cmpl $0x38, %eax
jne 0x2f43
cmpl $0x0, 0x8(%r14)
jg 0x2f4d
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 0x2f36
nop
// File: /workspace/github_c_makefile_star2_O3/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 0x3060
leaq 0x412c(%rip), %r12      # 0x70c0
cmpl $0x0, 0x20(%r12)
je 0x2fa3
movq 0x18(%r12), %r14
jmp 0x2fad
movabsq $0x1070000002000001, %r14 # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r12)
je 0x2fbc
movq 0x28(%r12), %r15
jmp 0x2fc6
movabsq $0x10700003ff000001, %r15 # imm = 0x10700003FF000001
cmpl $0x0, 0x8(%r12)
jg 0x3072
movaps 0x13e7(%rip), %xmm0     # 0x43c0
leaq 0x10(%rsp), %rdi
movaps %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 0x273c
movl $0x3, %ebp
cmpl $0x80, %eax
jne 0x3060
leaq 0x10(%rsp), %rdi
movl $0x80, %esi
callq 0x275d
cmpl $0x38, %eax
jb 0x3060
movl %eax, %ebx
cmpl $0x0, 0x8(%r12)
jg 0x3095
cmpl $0x80, %ebx
jne 0x3060
cmpl $0x0, 0x30(%rsp)
jne 0x3060
leaq 0x48(%rsp), %rdi
movq 0x3f7c(%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 0x3f7f(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x134d(%rip), %rsi      # 0x43d0
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x20d0
jmp 0x2fd2
leaq 0x10(%rsp), %rdi
callq 0x2290
jmp 0x3031
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/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 0x331a
leaq 0x3e70(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x325d
movq 0x18(%r14), %rcx
jmp 0x3267
movabsq $0x1070000002000001, %rcx # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x3274
movq 0x28(%r14), %rdx
jmp 0x327e
movabsq $0x1070000300000001, %rdx # imm = 0x1070000300000001
movaps 0x120b(%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 0x273c
movl $0x3, %ebx
cmpl $0xa50, %eax            # imm = 0xA50
jne 0x331a
leaq 0x10(%rsp), %rdi
movl $0xa50, %esi            # imm = 0xA50
callq 0x275d
cmpl $0xa50, %eax            # imm = 0xA50
jne 0x331a
cmpl $0x0, 0x8(%r14)
jg 0x332b
cmpl $0x0, 0x30(%rsp)
jne 0x331a
movq 0xa58(%rsp), %r14
xorl %ebx, %ebx
testq %r14, %r14
je 0x331a
movq 0x3cc7(%rip), %r15      # 0x6fc8
xorl %r12d, %r12d
movq (%r15), %rsi
movzbl 0x58(%rsp,%r12), %edi
callq 0x2090
incq %r12
cmpq %r12, %r14
jne 0x3304
movl %ebx, %eax
addq $0xa68, %rsp            # imm = 0xA68
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x10(%rsp), %rdi
callq 0x22d8
jmp 0x32e4
nop
// File: /workspace/github_c_makefile_star2_O3/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 0x3417
leaq 0x3d57(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x3376
movq 0x18(%r14), %rcx
jmp 0x3380
movabsq $0x1070000002000001, %rcx # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x338d
movq 0x28(%r14), %rdx
jmp 0x3397
movabsq $0x1070000300000001, %rdx # imm = 0x1070000300000001
movaps 0x1132(%rip), %xmm0     # 0x44d0
leaq 0x10(%rsp), %rdi
movaps %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 0x273c
movl $0x3, %ebx
cmpl $0x48, %eax
jne 0x3417
leaq 0x10(%rsp), %rdi
movl $0x48, %esi
callq 0x275d
cmpl $0x48, %eax
jne 0x3417
cmpl $0x0, 0x8(%r14)
jg 0x3421
cmpl $0x0, 0x30(%rsp)
jne 0x3417
movq 0x3bc9(%rip), %rax      # 0x6fc8
movq (%rax), %rdi
movq 0x50(%rsp), %rdx
leaq 0xe82(%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 0x33f1
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/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 0x3c6e(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x345f
movq 0x18(%r14), %rax
jmp 0x3469
movabsq $0x1070000002000001, %rax # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x3476
movq 0x28(%r14), %rcx
jmp 0x3480
movabsq $0x10700003ff000001, %rcx # imm = 0x10700003FF000001
movaps 0x10a9(%rip), %xmm0     # 0x4530
movq %rsp, %rdi
movaps %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 0x273c
movl $0x3, %ebx
cmpl $0x48, %eax
jne 0x34f4
movq %rsp, %rdi
movl $0x48, %esi
callq 0x275d
cmpl $0x48, %eax
jne 0x34f4
cmpl $0x0, 0x8(%r14)
jg 0x34fe
cmpl $0x0, 0x20(%rsp)
jne 0x34f4
movq 0x3ae8(%rip), %rax      # 0x6fc8
movq (%rax), %rdi
leaq 0x38(%rsp), %rsi
movl $0x10, %edx
callq 0x3bc1
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
movq %rsp, %rdi
callq 0x2320
jmp 0x34d2
// File: /workspace/github_c_makefile_star2_O3/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 0x3baa(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x3523
movq 0x18(%r14), %rax
jmp 0x352d
movabsq $0x1070000002000001, %rax # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x353a
movq 0x28(%r14), %rcx
jmp 0x3544
movabsq $0x10700003ff000001, %rcx # imm = 0x10700003FF000001
movaps 0xfe5(%rip), %xmm0      # 0x4530
movq %rsp, %rdi
movaps %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 0x273c
movl $0x3, %ebx
cmpl $0x48, %eax
jne 0x35b8
movq %rsp, %rdi
movl $0x48, %esi
callq 0x275d
cmpl $0x48, %eax
jne 0x35b8
cmpl $0x0, 0x8(%r14)
jg 0x35c2
cmpl $0x0, 0x20(%rsp)
jne 0x35b8
movq 0x3a24(%rip), %rax      # 0x6fc8
movq (%rax), %rdi
leaq 0x38(%rsp), %rsi
movl $0x10, %edx
callq 0x3bc1
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
movq %rsp, %rdi
callq 0x2344
jmp 0x3596
// File: /workspace/github_c_makefile_star2_O3/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 0x36be
leaq 0x3aaf(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x361e
movq 0x18(%r14), %rcx
jmp 0x3628
movabsq $0x1070000002000001, %rcx # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x3635
movq 0x28(%r14), %rdx
jmp 0x363f
movabsq $0x10700003ff000001, %rdx # imm = 0x10700003FF000001
movaps 0xf5a(%rip), %xmm0      # 0x45a0
leaq 0x10(%rsp), %rdi
movaps %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 0x273c
movl $0x3, %ebx
cmpl $0x48, %eax
jne 0x36be
leaq 0x10(%rsp), %rdi
movl $0x48, %esi
callq 0x275d
cmpl $0x48, %eax
jne 0x36be
cmpl $0x0, 0x8(%r14)
jg 0x36c8
cmpl $0x0, 0x30(%rsp)
jne 0x36be
movq 0x3922(%rip), %rax      # 0x6fc8
movq (%rax), %rdi
movzbl 0x50(%rsp), %edx
leaq 0xefb(%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 0x3698
// File: /workspace/github_c_makefile_star2_O3/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 0x37d1
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 0x37d1
leaq 0x3986(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x3747
movq 0x18(%r14), %rcx
jmp 0x3751
movabsq $0x1070000002000001, %rcx # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x375e
movq 0x28(%r14), %rdx
jmp 0x3768
movabsq $0x10700003ff000001, %rdx # imm = 0x10700003FF000001
movaps 0xe31(%rip), %xmm0      # 0x45a0
leaq 0x10(%rsp), %rdi
movaps %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 0x273c
movl $0x3, %ebp
cmpl $0x48, %eax
jne 0x37d1
leaq 0x10(%rsp), %rdi
movl $0x48, %esi
callq 0x273c
cmpl $0x48, %eax
jne 0x37d1
cmpl $0x0, 0x8(%r14)
jg 0x37de
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 0x37c4
nop
// File: /workspace/github_c_makefile_star2_O3/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 $0x90, %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 0x38f2
leaq 0x388b(%rip), %r14      # 0x70c0
cmpl $0x0, 0x20(%r14)
je 0x3842
movq 0x18(%r14), %rcx
jmp 0x384c
movabsq $0x1070000002000001, %rcx # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r14)
je 0x3859
movq 0x28(%r14), %rdx
jmp 0x3863
movabsq $0x10700003ff000001, %rdx # imm = 0x10700003FF000001
movaps 0xdd6(%rip), %xmm0      # 0x4640
leaq 0x10(%rsp), %rdi
movaps %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 0x273c
movl $0x3, %ebx
cmpl $0x78, %eax
jne 0x38f2
leaq 0x10(%rsp), %rdi
movl $0x78, %esi
callq 0x275d
cmpl $0x38, %eax
jb 0x38f2
movl %eax, %ebp
cmpl $0x0, 0x8(%r14)
jg 0x3900
cmpl $0x78, %ebp
jne 0x38f2
cmpl $0x0, 0x30(%rsp)
jne 0x38f2
leaq 0x58(%rsp), %rdi
movq -0x8(%rdi), %rdx
movq 0x36e5(%rip), %rax      # 0x6fc8
movq (%rax), %rcx
movl $0x1, %esi
callq 0x2130
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x90, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x10(%rsp), %rdi
callq 0x23b0
jmp 0x38c7
// File: /workspace/github_c_makefile_star2_O3/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 0x3957
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 0x395a
js 0x394d
incl %ebp
movl %ebp, %r13d
jmp 0x3952
decl %ebp
movl %ebp, %r15d
cmpl %r15d, %r13d
jle 0x392a
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_O3/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 0x39c2
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r14
movl %edi, %r15d
movq (%rcx), %rdx
callq 0x390c
testq %rax, %rax
je 0x39c2
movl 0x18(%rax), %ecx
cmpl $-0x1, %ecx
setne %dl
cmpl %ebp, %ecx
setge %cl
movl $0x2, %r12d
testb %cl, %dl
jne 0x39c2
movl 0x1c(%rax), %ecx
cmpl $-0x1, %ecx
setne %dl
decl %ebp
cmpl %ecx, %ebp
setg %cl
testb %cl, %dl
je 0x39ce
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_O3/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 0x3a36
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movl %edi, %r15d
movq 0x35c2(%rip), %r12      # 0x6fc8
leaq 0xc9c(%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 0x3a10
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
xorl %eax, %eax
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/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 0x3ab7
movq %rcx, %rbx
movl %edi, %ebp
movl %edx, %r12d
xorl %r13d, %r13d
movq (%rbx,%r13,8), %rdx
movl %ebp, %edi
movq (%rsp), %rsi
callq 0x390c
movq 0x3558(%rip), %r14      # 0x6fc8
movq (%r14), %rdi
testq %rax, %rax
je 0x3a9d
movq %rax, %r15
movq 0x8(%rax), %rdx
leaq 0xc23(%rip), %rsi       # 0x46a9
xorl %eax, %eax
callq 0x20d0
movq (%r14), %rdi
movq 0x10(%r15), %rdx
leaq 0xc07(%rip), %rsi       # 0x46a2
jmp 0x3aa8
movq (%rbx,%r13,8), %rdx
leaq 0xc05(%rip), %rsi       # 0x46ad
xorl %eax, %eax
callq 0x20d0
incq %r13
cmpq %r13, %r12
jne 0x3a5a
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_O3/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 0x3bb2
sarl %r12d
cmpl %ebp, %r12d
cmovgel %ebp, %r12d
testl %r12d, %r12d
jle 0x3bb0
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 0x3ba9
movsbq 0x1(%r15,%rbx,2), %rcx
testb $0x10, 0x1(%rax,%rcx,2)
je 0x3ba9
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 0x3b12
movl %r12d, %eax
jmp 0x3bb2
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x3bb2
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_O3/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 0x3c30
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xb14(%rip), %r12       # 0x46f3
xorl %r13d, %r13d
testq %r13, %r13
sete %al
testb $0xf, %r13b
setne %cl
orb %al, %cl
jne 0x3c00
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 0x3be2
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_O3/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, %rsi
shlq $0x3, %rsi
movl $0x1, %edi
callq 0x1130
movq %rax, (%r14)
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x1e97
movq %rbx, %rdi
callq 0x10c0
movl %r15d, %ecx
cmpq %rcx, %rax
jbe 0x1ecc
xorl %ecx, %ecx
movb (%rbx,%r15), %dl
movb %dl, -0x30(%rbp,%rcx)
incq %rcx
incq %r15
cmpq %r15, %rax
ja 0x1eb5
movl %ecx, %eax
jmp 0x1ece
xorl %eax, %eax
movb $0x0, -0x30(%rbp,%rax)
leaq -0x30(%rbp), %rdi
callq 0x1240
movl (%r14), %esi
movl %eax, %edi
callq 0x4224
cltq
shlq $0x4, %rax
movq 0x8(%r14,%rax), %r15
xorl %r14d, %r14d
movq 0x20(%r15), %r15
testq %r15, %r15
je 0x1f10
movq (%r15), %rdi
movq %rbx, %rsi
callq 0x1140
testl %eax, %eax
jne 0x1ef4
movq 0x18(%r15), %r14
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq