// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xd0, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq -0xa8(%rbp), %rsi
xorl %edx, %edx
callq 0x20a0
movq %rax, -0xa0(%rbp)
movq -0xa8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x5000
movl $0x2, -0x4(%rbp)
jmp 0x51ba
leaq 0x40b9(%rip), %rax      # 0x90c0
cmpl $0x0, 0x20(%rax)
je 0x5021
leaq 0x40ac(%rip), %rax      # 0x90c0
movq 0x18(%rax), %rax
movq %rax, -0xc8(%rbp)
jmp 0x5034
movabsq $0x1070000002000001, %rax # imm = 0x1070000002000001
movq %rax, -0xc8(%rbp)
jmp 0x5034
movq -0xc8(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq 0x4077(%rip), %rax      # 0x90c0
cmpl $0x0, 0x30(%rax)
je 0x5063
leaq 0x406a(%rip), %rax      # 0x90c0
movq 0x28(%rax), %rax
movq %rax, -0xd0(%rbp)
jmp 0x5076
movabsq $0x10700003ff000001, %rax # imm = 0x10700003FF000001
movq %rax, -0xd0(%rbp)
jmp 0x5076
movq -0xd0(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq -0x98(%rbp), %rdi
movl $0x1, %esi
movl $0x9000, %edx           # imm = 0x9000
movl $0x68, %r8d
movl %r8d, %ecx
callq 0x51d0
leaq -0x98(%rbp), %rdi
addq $0x10, %rdi
movq -0xb0(%rbp), %rdx
movq -0xb8(%rbp), %rcx
movl $0x9006, %esi           # imm = 0x9006
callq 0x5210
movq -0xa0(%rbp), %rax
movq %rax, -0x60(%rbp)
movq $0x30, -0x58(%rbp)
movl $0x78, -0xbc(%rbp)
movslq -0xbc(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0x2620
movl %eax, -0xc0(%rbp)
movl -0xc0(%rbp), %eax
cmpl -0xbc(%rbp), %eax
je 0x5116
movl $0x3, -0x4(%rbp)
jmp 0x51ba
leaq -0x98(%rbp), %rdi
movl $0x78, %esi
callq 0x2670
movl %eax, -0xc0(%rbp)
movslq -0xc0(%rbp), %rax
cmpq $0x38, %rax
jae 0x5143
movl $0x3, -0x4(%rbp)
jmp 0x51ba
leaq 0x3f76(%rip), %rax      # 0x90c0
cmpl $0x0, 0x8(%rax)
jle 0x516b
movq 0x3ea1(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
movl -0x78(%rbp), %edx
leaq 0x10c0(%rip), %rsi      # 0x6224
movb $0x0, %al
callq 0x20c0
cmpl $0x0, -0x78(%rbp)
je 0x517a
movl $0x3, -0x4(%rbp)
jmp 0x51ba
movslq -0xc0(%rbp), %rax
cmpq $0x78, %rax
je 0x5190
movl $0x3, -0x4(%rbp)
jmp 0x51ba
leaq -0x98(%rbp), %rdi
addq $0x48, %rdi
movq -0x58(%rbp), %rdx
movq 0x3e22(%rip), %rax      # 0x8fc8
movq (%rax), %rcx
movl $0x1, %esi
callq 0x2130
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)