// File: /workspace/github_c_makefile_star2_O0/sguerrini97[P]ps3linux-ps3vuart-tools/ps3dm/srtc/cmd_srtc_set_time.c
// Function: cmd_srtc_set_time_exec
int
cmd_srtc_set_time_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct ps3dm_srtc_set_time set_time;
	uint64_t time;
	char *endptr;
	uint64_t laid, paid;
	int len;
	int ret;

	time = strtoull(argv[0], &endptr, 0);
	if (*endptr != '\0' || time > 0xffffffffull)
		return (CMD_EINVAL);

	laid = opts.laid_valid ? opts.laid : 0x1070000002000001ull;
	paid = opts.paid_valid ? opts.paid : 0x10700003ff000001ull;

	ps3dm_init_header(&set_time.dm_hdr, 1, PS3DM_FID_SRTC,
	    sizeof(set_time) - sizeof(struct ps3dm_header),
	    sizeof(set_time) - sizeof(struct ps3dm_header));
	ps3dm_init_ss_header(&set_time.ss_hdr, PS3DM_PID_SRTC_SET_TIME,
	    laid, paid);
	set_time.time = time;

	len = sizeof(set_time);

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

	ret = dev_read(&set_time, sizeof(set_time));
	if (ret != sizeof(set_time))
		return (CMD_EIO);

	if (opts.do_verbose > 0)
		fprintf(stderr, "ss status %d\n", set_time.ss_hdr.status);

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

	return (CMD_EOK);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %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 -0x70(%rbp), %rsi
xorl %edx, %edx
callq 0x20a0
movq %rax, -0x68(%rbp)
movq -0x70(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x3636
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x68(%rbp)
jbe 0x3642
movl $0x2, -0x4(%rbp)
jmp 0x379d
leaq 0x5a77(%rip), %rax      # 0x90c0
cmpl $0x0, 0x20(%rax)
je 0x3663
leaq 0x5a6a(%rip), %rax      # 0x90c0
movq 0x18(%rax), %rax
movq %rax, -0x90(%rbp)
jmp 0x3676
movabsq $0x1070000002000001, %rax # imm = 0x1070000002000001
movq %rax, -0x90(%rbp)
jmp 0x3676
movq -0x90(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq 0x5a38(%rip), %rax      # 0x90c0
cmpl $0x0, 0x30(%rax)
je 0x36a2
leaq 0x5a2b(%rip), %rax      # 0x90c0
movq 0x28(%rax), %rax
movq %rax, -0x98(%rbp)
jmp 0x36b5
movabsq $0x10700003ff000001, %rax # imm = 0x10700003FF000001
movq %rax, -0x98(%rbp)
jmp 0x36b5
movq -0x98(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x60(%rbp), %rdi
movl $0x1, %esi
movl $0x3000, %edx           # imm = 0x3000
movl $0x30, %r8d
movl %r8d, %ecx
callq 0x37b0
leaq -0x60(%rbp), %rdi
addq $0x10, %rdi
movq -0x78(%rbp), %rdx
movq -0x80(%rbp), %rcx
movl $0x3003, %esi           # imm = 0x3003
callq 0x37f0
movq -0x68(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x40, -0x84(%rbp)
movslq -0x84(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x2620
movl %eax, -0x88(%rbp)
movl -0x88(%rbp), %eax
cmpl -0x84(%rbp), %eax
je 0x3735
movl $0x3, -0x4(%rbp)
jmp 0x379d
leaq -0x60(%rbp), %rdi
movl $0x40, %esi
callq 0x2670
movl %eax, -0x88(%rbp)
movslq -0x88(%rbp), %rax
cmpq $0x40, %rax
je 0x375f
movl $0x3, -0x4(%rbp)
jmp 0x379d
leaq 0x595a(%rip), %rax      # 0x90c0
cmpl $0x0, 0x8(%rax)
jle 0x3787
movq 0x5885(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
movl -0x40(%rbp), %edx
leaq 0x2aa4(%rip), %rsi      # 0x6224
movb $0x0, %al
callq 0x20c0
cmpl $0x0, -0x40(%rbp)
je 0x3796
movl $0x3, -0x4(%rbp)
jmp 0x379d
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)