// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq -0xf0(%rbp), %rsi
movl $0x40, %edx
callq 0x54f0
movl %eax, -0xf4(%rbp)
cmpl $0x0, -0xf4(%rbp)
jg 0x3d9c
movl $0x2, -0x4(%rbp)
jmp 0x3f88
leaq 0x531d(%rip), %rax      # 0x90c0
cmpl $0x0, 0x20(%rax)
je 0x3dbd
leaq 0x5310(%rip), %rax      # 0x90c0
movq 0x18(%rax), %rax
movq %rax, -0x108(%rbp)
jmp 0x3dd0
movabsq $0x1070000002000001, %rax # imm = 0x1070000002000001
movq %rax, -0x108(%rbp)
jmp 0x3dd0
movq -0x108(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq 0x52db(%rip), %rax      # 0x90c0
cmpl $0x0, 0x30(%rax)
je 0x3dff
leaq 0x52ce(%rip), %rax      # 0x90c0
movq 0x28(%rax), %rax
movq %rax, -0x110(%rbp)
jmp 0x3e12
movabsq $0x10700003ff000001, %rax # imm = 0x10700003FF000001
movq %rax, -0x110(%rbp)
jmp 0x3e12
movq -0x110(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq 0x5299(%rip), %rax      # 0x90c0
cmpl $0x0, 0x8(%rax)
jle 0x3e53
movq 0x51c4(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
movq -0xa0(%rbp), %rdx
movq -0xa8(%rbp), %rcx
leaq 0x2588(%rip), %rsi      # 0x63d4
movb $0x0, %al
callq 0x20c0
leaq -0x98(%rbp), %rdi
movl $0x1, %esi
movl $0x2000, %edx           # imm = 0x2000
movl $0x68, %r8d
movl %r8d, %ecx
callq 0x3fa0
leaq -0x98(%rbp), %rdi
addq $0x10, %rdi
movq -0xa0(%rbp), %rdx
movq -0xa8(%rbp), %rcx
movl $0x2003, %esi           # imm = 0x2003
callq 0x3fe0
leaq -0x98(%rbp), %rdi
addq $0x38, %rdi
xorl %esi, %esi
movl $0x40, %edx
callq 0x2070
leaq -0x98(%rbp), %rdi
addq $0x38, %rdi
leaq -0xf0(%rbp), %rsi
movslq -0xf4(%rbp), %rdx
callq 0x20d0
movl $0x78, -0xf8(%rbp)
movslq -0xf8(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0x2620
movl %eax, -0xfc(%rbp)
movl -0xfc(%rbp), %eax
cmpl -0xf8(%rbp), %eax
je 0x3f07
movl $0x3, -0x4(%rbp)
jmp 0x3f88
leaq -0x98(%rbp), %rdi
movl $0x78, %esi
callq 0x2670
movl %eax, -0xfc(%rbp)
movslq -0xfc(%rbp), %rax
cmpq $0x38, %rax
jae 0x3f34
movl $0x3, -0x4(%rbp)
jmp 0x3f88
leaq 0x5185(%rip), %rax      # 0x90c0
cmpl $0x0, 0x8(%rax)
jle 0x3f5c
movq 0x50b0(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
movl -0x78(%rbp), %edx
leaq 0x22cf(%rip), %rsi      # 0x6224
movb $0x0, %al
callq 0x20c0
cmpl $0x0, -0x78(%rbp)
je 0x3f6b
movl $0x3, -0x4(%rbp)
jmp 0x3f88
movslq -0xfc(%rbp), %rax
cmpq $0x78, %rax
je 0x3f81
movl $0x3, -0x4(%rbp)
jmp 0x3f88
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopw %cs:(%rax,%rax)