// File: /workspace/github_c_makefile_star2_O1/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
movl $0x40, %edx
callq 0x3acc
testl %eax, %eax
jle 0x30e0
movl %eax, %ebx
leaq 0x3fed(%rip), %r13      # 0x70c0
cmpl $0x0, 0x20(%r13)
je 0x30ea
movq 0x18(%r13), %r14
jmp 0x30f4
movl $0x2, %ebx
jmp 0x31c2
movabsq $0x1070000002000001, %r14 # imm = 0x1070000002000001
cmpl $0x0, 0x30(%r13)
je 0x3101
movq 0x28(%r13), %r15
jmp 0x310b
movabsq $0x10700003ff000001, %r15 # imm = 0x10700003FF000001
cmpl $0x0, 0x8(%r13)
jg 0x31d6
movaps 0x12f3(%rip), %xmm0     # 0x4410
leaq 0x40(%rsp), %r12
movups %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
movl $0x40, %eax
subq %r14, %rax
xorl %edx, %edx
cmpl $0x40, %ebx
cmovbq %rax, %rdx
leaq (%rsp,%r14), %rdi
addq $0x40, %rdi
xorl %esi, %esi
callq 0x2070
leaq 0x80(%rsp), %rsi
movq %r12, %rdi
movq %r14, %rdx
callq 0x20e0
leaq 0x8(%rsp), %rdi
movl $0x78, %esi
callq 0x2730
movl $0x3, %ebx
cmpl $0x78, %eax
jne 0x31c2
leaq 0x8(%rsp), %rdi
movl $0x78, %esi
callq 0x2751
cmpl $0x38, %eax
jb 0x31c2
movl %eax, %ebp
cmpl $0x0, 0x8(%r13)
jg 0x31f9
cmpl $0x0, 0x28(%rsp)
jne 0x31c2
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 0x3e1b(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x11e9(%rip), %rsi      # 0x43d0
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x20d0
jmp 0x3116
leaq 0x8(%rsp), %rdi
callq 0x22b4
jmp 0x31b0
nopl (%rax)