// File: /workspace/github_c_makefile_star2_O0/sguerrini97[P]ps3linux-ps3vuart-tools/ps3dm/srtc/cmd_srtc_get_time.c
// Function: cmd_srtc_get_time_exec
int
cmd_srtc_get_time_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct ps3dm_srtc_get_time get_time;
	uint64_t epoch;
	char *endptr;
	uint64_t laid, paid;
	int len;
	int ret;

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

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

	ps3dm_init_header(&get_time.dm_hdr, 1, PS3DM_FID_SRTC,
	    sizeof(get_time) - sizeof(struct ps3dm_header),
	    sizeof(get_time) - sizeof(struct ps3dm_header));
	ps3dm_init_ss_header(&get_time.ss_hdr, PS3DM_PID_SRTC_GET_TIME,
	    laid, paid);
	get_time.epoch = epoch;

	len = sizeof(get_time);

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

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

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

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

	fprintf(stdout, "%lld\n", get_time.time);

	return (CMD_EOK);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %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 -0x80(%rbp), %rsi
xorl %edx, %edx
callq 0x20a0
movq %rax, -0x78(%rbp)
movq -0x80(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x33c2
cmpq $0x1, -0x78(%rbp)
jbe 0x33ce
movl $0x2, -0x4(%rbp)
jmp 0x3554
leaq 0x5ceb(%rip), %rax      # 0x90c0
cmpl $0x0, 0x20(%rax)
je 0x33ef
leaq 0x5cde(%rip), %rax      # 0x90c0
movq 0x18(%rax), %rax
movq %rax, -0xa0(%rbp)
jmp 0x3402
movabsq $0x1070000002000001, %rax # imm = 0x1070000002000001
movq %rax, -0xa0(%rbp)
jmp 0x3402
movq -0xa0(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq 0x5ca9(%rip), %rax      # 0x90c0
cmpl $0x0, 0x30(%rax)
je 0x3431
leaq 0x5c9c(%rip), %rax      # 0x90c0
movq 0x28(%rax), %rax
movq %rax, -0xa8(%rbp)
jmp 0x3444
movabsq $0x10700003ff000001, %rax # imm = 0x10700003FF000001
movq %rax, -0xa8(%rbp)
jmp 0x3444
movq -0xa8(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x70(%rbp), %rdi
movl $0x1, %esi
movl $0x3000, %edx           # imm = 0x3000
movl $0x40, %r8d
movl %r8d, %ecx
callq 0x3560
leaq -0x70(%rbp), %rdi
addq $0x10, %rdi
movq -0x88(%rbp), %rdx
movq -0x90(%rbp), %rcx
movl $0x3002, %esi           # imm = 0x3002
callq 0x35a0
movq -0x78(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x50, -0x94(%rbp)
movslq -0x94(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x2620
movl %eax, -0x98(%rbp)
movl -0x98(%rbp), %eax
cmpl -0x94(%rbp), %eax
je 0x34d0
movl $0x3, -0x4(%rbp)
jmp 0x3554
leaq -0x70(%rbp), %rdi
movl $0x50, %esi
callq 0x2670
movl %eax, -0x98(%rbp)
movslq -0x98(%rbp), %rax
cmpq $0x50, %rax
je 0x34fa
movl $0x3, -0x4(%rbp)
jmp 0x3554
leaq 0x5bbf(%rip), %rax      # 0x90c0
cmpl $0x0, 0x8(%rax)
jle 0x3522
movq 0x5aea(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
movl -0x50(%rbp), %edx
leaq 0x2d09(%rip), %rsi      # 0x6224
movb $0x0, %al
callq 0x20c0
cmpl $0x0, -0x50(%rbp)
je 0x3531
movl $0x3, -0x4(%rbp)
jmp 0x3554
movq 0x5a90(%rip), %rax      # 0x8fc8
movq (%rax), %rdi
movq -0x30(%rbp), %rdx
leaq 0x2e05(%rip), %rsi      # 0x634b
movb $0x0, %al
callq 0x20c0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq