// File: /workspace/github_c_makefile_star2_O2/sguerrini97[P]ps3linux-ps3vuart-tools/ps3dm/vtrm/cmd_vtrm_store_with_update.c
// Function: cmd_vtrm_store_with_update_exec
int
cmd_vtrm_store_with_update_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct ps3dm_vtrm_store_with_update store_with_update;
	uint64_t laid, paid;
	unsigned char data[64];
	int data_length;
	int len;
	int ret;

	data_length = parse_hex(argv[0], data, sizeof(data));
	if (data_length <= 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(&store_with_update.dm_hdr, 1, PS3DM_FID_VTRM,
	    sizeof(store_with_update) - sizeof(struct ps3dm_header),
	    sizeof(store_with_update) - sizeof(struct ps3dm_header));
	ps3dm_init_ss_header(&store_with_update.ss_hdr, PS3DM_PID_VTRM_STORE_WITH_UPDATE,
	    laid, paid);
	memset(store_with_update.data, 0, sizeof(store_with_update.data));
	memcpy(store_with_update.data, data, data_length);

	len = sizeof(store_with_update);

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

	ret = dev_read(&store_with_update, sizeof(store_with_update));
	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", store_with_update.ss_hdr.status);

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

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

	return (CMD_EOK);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq (%rcx), %rdi
leaq 0x80(%rsp), %rsi
pushq $0x40
popq %rdx
callq 0x38d4
testl %eax, %eax
jle 0x2e9a
movl %eax, %ebx
leaq 0x4233(%rip), %r13      # 0x70c0
cmpl $0x0, 0x20(%r13)
je 0x2ea2
movq 0x18(%r13), %r14
jmp 0x2eac
pushq $0x2
popq %rbx
jmp 0x2f6e
movabsq $0x1070000002000001, %r14 # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r13)
je 0x2eb9
movq 0x28(%r13), %r15
jmp 0x2ec3
movabsq $0x10700003ff000001, %r15 # imm = 0x10700003FF000001
cmpl $0x0, 0x8(%r13)
jg 0x2f82
movaps 0x153b(%rip), %xmm0     # 0x4410
leaq 0x38(%rsp), %r12
movaps %xmm0, -0x38(%r12)
movq $0x2003, -0x28(%r12)    # imm = 0x2003
movq $0x2000, -0x20(%r12)    # imm = 0x2000
movq %r14, -0x10(%r12)
movq %r15, -0x8(%r12)
movl %ebx, %r14d
pushq $0x40
popq %rax
subq %r14, %rax
xorl %edx, %edx
cmpl $0x40, %ebx
cmovbq %rax, %rdx
leaq (%rsp,%r14), %rdi
addq $0x38, %rdi
xorl %esi, %esi
callq 0x2070
leaq 0x80(%rsp), %rsi
movq %r12, %rdi
movq %r14, %rdx
callq 0x20e0
movq %rsp, %rdi
pushq $0x78
popq %rsi
callq 0x24a2
pushq $0x3
popq %rbx
cmpl $0x78, %eax
jne 0x2f6e
movq %rsp, %rdi
pushq $0x78
popq %rsi
callq 0x24c1
cmpl $0x38, %eax
jb 0x2f6e
movl %eax, %ebp
cmpl $0x0, 0x8(%r13)
jg 0x2fa5
cmpl $0x0, 0x20(%rsp)
jne 0x2f6e
xorl %eax, %eax
cmpl $0x78, %ebp
setne %al
leal (%rax,%rax,2), %ebx
movl %ebx, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x406f(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x143d(%rip), %rsi      # 0x43d0
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x20d0
jmp 0x2ece
movq 0x404c(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
movl 0x20(%rsp), %edx
leaq 0x11c6(%rip), %rsi      # 0x4180
xorl %eax, %eax
callq 0x20d0
jmp 0x2f5c
nop