// File: /workspace/github_c_makefile_star2_O1/sguerrini97[P]ps3linux-ps3vuart-tools/ps3av/cmd/cmd_av_get_monitor_info.c
// Function: cmd_av_get_monitor_info_exec
int
cmd_av_get_monitor_info_exec(int cmdc, struct cmd **cmdv, int argc, char **argv)
{
	struct ps3av_av_get_monitor_info av_get_monitor_info_req;
	struct ps3av_av_get_monitor_info_reply av_get_monitor_info_reply;
	char *endptr;
	unsigned int port;
	int ret;

	port = strtoul(argv[0], &endptr, 0);
	if (*endptr != '\0')
		return (CMD_EINVAL);

	ps3av_init_request(PS3AV_REQ(&av_get_monitor_info_req),
	    sizeof(av_get_monitor_info_req) - sizeof(struct ps3av_header),
	    PS3AV_CMD_AV_GET_MONITOR_INFO);

	av_get_monitor_info_req.port = port;

	ret = dev_write(&av_get_monitor_info_req, sizeof(av_get_monitor_info_req));
	if (ret != sizeof(av_get_monitor_info_req))
		return (CMD_EIO);

	ret = dev_read(&av_get_monitor_info_reply, sizeof(av_get_monitor_info_reply));
	if (ret < sizeof(struct ps3av_reply))
		return (CMD_EIO);

	if (opts.do_verbose)
		fprintf(stderr, "status %d\n", av_get_monitor_info_reply.reply.status);

	if (av_get_monitor_info_reply.reply.status != PS3AV_STATUS_SUCCESS)
		return (CMD_EIO);

	fprintf(stdout, "type: %d\n", av_get_monitor_info_reply.monitor.type);
	fprintf(stdout, "name: %s\n", av_get_monitor_info_reply.monitor.name);
	fprintf(stdout, "res_60: %08x %08x\n", av_get_monitor_info_reply.monitor.res_60.bits,
	    av_get_monitor_info_reply.monitor.res_60.native);
	fprintf(stdout, "res_50: %08x %08x\n", av_get_monitor_info_reply.monitor.res_50.bits,
	    av_get_monitor_info_reply.monitor.res_50.native);
	fprintf(stdout, "res_other: %08x %08x\n", av_get_monitor_info_reply.monitor.res_other.bits,
	    av_get_monitor_info_reply.monitor.res_other.native);
	fprintf(stdout, "res_vesa: %08x %08x\n", av_get_monitor_info_reply.monitor.res_vesa.bits,
	    av_get_monitor_info_reply.monitor.res_vesa.native);

	return (CMD_EOK);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x120, %rsp            # imm = 0x120
movq (%rcx), %rdi
movq %rsp, %rbx
movq %rbx, %rsi
xorl %edx, %edx
callq 0x10d0
movq (%rbx), %rcx
movl $0x2, %ebx
cmpb $0x0, (%rcx)
jne 0x16bf
movabsq $0x400080205, %rcx      # imm = 0x400080205
leaq 0x8(%rsp), %rdi
movq %rcx, (%rdi)
movw %ax, 0x8(%rdi)
movl $0xc, %esi
callq 0x13e8
movl $0x3, %ebx
cmpl $0xc, %eax
jne 0x16bf
leaq 0x14(%rsp), %rdi
movl $0x10c, %esi            # imm = 0x10C
callq 0x1409
cmpl $0xc, %eax
jb 0x16bf
leaq 0x2a82(%rip), %rax      # 0x4090
cmpl $0x0, 0x8(%rax)
jne 0x16ce
cmpl $0x0, 0x1c(%rsp)
jne 0x16bf
movq 0x299e(%rip), %r15      # 0x3fc8
movq (%r15), %rdi
leaq 0x2c(%rsp), %r14
movzbl -0x1(%r14), %edx
leaq 0xb29(%rip), %rsi       # 0x2167
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x1090
movq (%r15), %rdi
leaq 0xb20(%rip), %rsi       # 0x2171
movq %r14, %rdx
xorl %eax, %eax
callq 0x1090
movq (%r15), %rdi
movl 0x10(%r14), %edx
movl 0x14(%r14), %ecx
leaq 0xb0e(%rip), %rsi       # 0x217b
xorl %eax, %eax
callq 0x1090
movq (%r15), %rdi
movl 0x18(%r14), %edx
movl 0x1c(%r14), %ecx
leaq 0xb08(%rip), %rsi       # 0x218e
xorl %eax, %eax
callq 0x1090
movq (%r15), %rdi
movl 0x20(%r14), %edx
movl 0x24(%r14), %ecx
leaq 0xb02(%rip), %rsi       # 0x21a1
xorl %eax, %eax
callq 0x1090
movq (%r15), %rdi
movl 0x28(%r14), %edx
movl 0x2c(%r14), %ecx
leaq 0xaff(%rip), %rsi       # 0x21b7
xorl %eax, %eax
callq 0x1090
movl %ebx, %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbx
popq %r14
popq %r15
retq
leaq 0x14(%rsp), %rdi
callq 0x1110
jmp 0x1618
nopl (%rax)