// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
leaq -0x140(%rbp), %rsi
xorl %edx, %edx
callq 0x10d0
movl %eax, -0x144(%rbp)
movq -0x140(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x18ef
movl $0x2, -0x4(%rbp)
jmp 0x1a86
leaq -0x2c(%rbp), %rdi
movl $0x8, %esi
movl $0x4, %edx
callq 0x1aa0
movl -0x144(%rbp), %eax
movw %ax, -0x24(%rbp)
leaq -0x2c(%rbp), %rdi
movl $0xc, %esi
callq 0x1520
movl %eax, -0x148(%rbp)
movslq -0x148(%rbp), %rax
cmpq $0xc, %rax
je 0x1939
movl $0x3, -0x4(%rbp)
jmp 0x1a86
leaq -0x138(%rbp), %rdi
movl $0x10c, %esi            # imm = 0x10C
callq 0x1570
movl %eax, -0x148(%rbp)
movslq -0x148(%rbp), %rax
cmpq $0xc, %rax
jae 0x1969
movl $0x3, -0x4(%rbp)
jmp 0x1a86
leaq 0x2720(%rip), %rax      # 0x4090
cmpl $0x0, 0x8(%rax)
je 0x1994
movq 0x267b(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movl -0x130(%rbp), %edx
leaq 0x7b0(%rip), %rsi       # 0x213d
movb $0x0, %al
callq 0x1090
cmpl $0x0, -0x130(%rbp)
je 0x19a9
movl $0x3, -0x4(%rbp)
jmp 0x1a86
movq 0x2618(%rip), %rax      # 0x3fc8
movq (%rax), %rdi
movzbl -0x121(%rbp), %edx
leaq 0x787(%rip), %rsi       # 0x2148
movb $0x0, %al
callq 0x1090
movq 0x25f9(%rip), %rax      # 0x3fc8
movq (%rax), %rdi
leaq -0x138(%rbp), %rdx
addq $0xc, %rdx
addq $0xc, %rdx
leaq 0x76a(%rip), %rsi       # 0x2152
movb $0x0, %al
callq 0x1090
movq 0x25d2(%rip), %rax      # 0x3fc8
movq (%rax), %rdi
movl -0x110(%rbp), %edx
movl -0x10c(%rbp), %ecx
leaq 0x750(%rip), %rsi       # 0x215c
movb $0x0, %al
callq 0x1090
movq 0x25ae(%rip), %rax      # 0x3fc8
movq (%rax), %rdi
movl -0x108(%rbp), %edx
movl -0x104(%rbp), %ecx
leaq 0x73f(%rip), %rsi       # 0x216f
movb $0x0, %al
callq 0x1090
movq 0x258a(%rip), %rax      # 0x3fc8
movq (%rax), %rdi
movl -0x100(%rbp), %edx
movl -0xfc(%rbp), %ecx
leaq 0x72e(%rip), %rsi       # 0x2182
movb $0x0, %al
callq 0x1090
movq 0x2566(%rip), %rax      # 0x3fc8
movq (%rax), %rdi
movl -0xf8(%rbp), %edx
movl -0xf4(%rbp), %ecx
leaq 0x720(%rip), %rsi       # 0x2198
movb $0x0, %al
callq 0x1090
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nopw %cs:(%rax,%rax)