// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xe0, %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, -0xb0(%rbp)
movq -0xa8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x3ac0
movl $0x2, -0x4(%rbp)
jmp 0x3ca8
leaq 0x55f9(%rip), %rax      # 0x90c0
cmpl $0x0, 0x20(%rax)
je 0x3ae1
leaq 0x55ec(%rip), %rax      # 0x90c0
movq 0x18(%rax), %rax
movq %rax, -0xd0(%rbp)
jmp 0x3af4
movabsq $0x1070000002000001, %rax # imm = 0x1070000002000001
movq %rax, -0xd0(%rbp)
jmp 0x3af4
movq -0xd0(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq 0x55b7(%rip), %rax      # 0x90c0
cmpl $0x0, 0x30(%rax)
je 0x3b23
leaq 0x55aa(%rip), %rax      # 0x90c0
movq 0x28(%rax), %rax
movq %rax, -0xd8(%rbp)
jmp 0x3b36
movabsq $0x10700003ff000001, %rax # imm = 0x10700003FF000001
movq %rax, -0xd8(%rbp)
jmp 0x3b36
movq -0xd8(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq 0x5575(%rip), %rax      # 0x90c0
cmpl $0x0, 0x8(%rax)
jle 0x3b77
movq 0x54a0(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
movq -0xb8(%rbp), %rdx
movq -0xc0(%rbp), %rcx
leaq 0x2864(%rip), %rsi      # 0x63d4
movb $0x0, %al
callq 0x20c0
leaq -0xa0(%rbp), %rdi
movl $0x1, %esi
movl $0x2000, %edx           # imm = 0x2000
movl $0x70, %r8d
movl %r8d, %ecx
callq 0x3cc0
leaq -0xa0(%rbp), %rdi
addq $0x10, %rdi
movq -0xb8(%rbp), %rdx
movq -0xc0(%rbp), %rcx
movl $0x2005, %esi           # imm = 0x2005
callq 0x3d00
movq -0xb0(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x80, -0xc4(%rbp)
movslq -0xc4(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x2620
movl %eax, -0xc8(%rbp)
movl -0xc8(%rbp), %eax
cmpl -0xc4(%rbp), %eax
je 0x3c01
movl $0x3, -0x4(%rbp)
jmp 0x3ca8
leaq -0xa0(%rbp), %rdi
movl $0x80, %esi
callq 0x2670
movl %eax, -0xc8(%rbp)
movslq -0xc8(%rbp), %rax
cmpq $0x38, %rax
jae 0x3c2e
movl $0x3, -0x4(%rbp)
jmp 0x3ca8
leaq 0x548b(%rip), %rax      # 0x90c0
cmpl $0x0, 0x8(%rax)
jle 0x3c56
movq 0x53b6(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
movl -0x80(%rbp), %edx
leaq 0x25d5(%rip), %rsi      # 0x6224
movb $0x0, %al
callq 0x20c0
cmpl $0x0, -0x80(%rbp)
je 0x3c65
movl $0x3, -0x4(%rbp)
jmp 0x3ca8
movslq -0xc8(%rbp), %rax
cmpq $0x80, %rax
je 0x3c7d
movl $0x3, -0x4(%rbp)
jmp 0x3ca8
leaq -0xa0(%rbp), %rdi
addq $0x38, %rdi
movq 0x5339(%rip), %rax      # 0x8fc8
movq (%rax), %rcx
movl $0x1, %esi
movl $0x40, %edx
callq 0x2130
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)