// File: /workspace/github_c_makefile_star2_O0/blasphemy[P]mmc-utils/mmc_cmds.c
// Function: do_cache_ctrl
int do_cache_ctrl(int value, int nargs, char **argv)
{
	__u8 ext_csd[512];
	int fd, ret;
	char *device;

	if (nargs != 2) {
	       fprintf(stderr, "Usage: mmc cache enable </path/to/mmcblkX>\n");
	       exit(1);
	}

	device = argv[1];

	fd = open(device, O_RDWR);
	if (fd < 0) {
		perror("open");
		exit(1);
	}

	ret = read_extcsd(fd, ext_csd);
	if (ret) {
		fprintf(stderr, "Could not read EXT_CSD from %s\n", device);
		exit(1);
	}

	if (ext_csd[EXT_CSD_REV] < EXT_CSD_REV_V4_5) {
		fprintf(stderr,
			"The CACHE option is only availabe on devices >= "
			"MMC 4.5 %s\n", device);
		exit(1);
	}

	/* If the cache size is zero, this device does not have a cache */
	if (!(ext_csd[EXT_CSD_CACHE_SIZE_3] ||
			ext_csd[EXT_CSD_CACHE_SIZE_2] ||
			ext_csd[EXT_CSD_CACHE_SIZE_1] ||
			ext_csd[EXT_CSD_CACHE_SIZE_0])) {
		fprintf(stderr,
			"The CACHE option is not available on %s\n",
			device);
		exit(1);
	}
	ret = write_extcsd_value(fd, EXT_CSD_CACHE_CTRL, value);
	if (ret) {
		fprintf(stderr,
			"Could not write 0x%02x to EXT_CSD[%d] in %s\n",
			value, EXT_CSD_CACHE_CTRL, device);
		exit(1);
	}

	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
cmpl $0x2, -0x8(%rbp)
je 0x961d
movq 0x119ee(%rip), %rax     # 0x1aff0
movq (%rax), %rdi
leaq 0xcd84(%rip), %rsi      # 0x16390
movb $0x0, %al
callq 0x3180
movl $0x1, %edi
callq 0x3240
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x220(%rbp)
movq -0x220(%rbp), %rdi
movl $0x2, %esi
movb $0x0, %al
callq 0x31e0
movl %eax, -0x214(%rbp)
cmpl $0x0, -0x214(%rbp)
jge 0x9664
leaq 0xc98f(%rip), %rdi      # 0x15fe4
callq 0x3200
movl $0x1, %edi
callq 0x3240
movl -0x214(%rbp), %edi
leaq -0x210(%rbp), %rsi
callq 0x3e90
movl %eax, -0x218(%rbp)
cmpl $0x0, -0x218(%rbp)
je 0x96ae
movq 0x11964(%rip), %rax     # 0x1aff0
movq (%rax), %rdi
movq -0x220(%rbp), %rdx
leaq 0xa058(%rip), %rsi      # 0x136f5
movb $0x0, %al
callq 0x3180
movl $0x1, %edi
callq 0x3240
movzbl -0x150(%rbp), %eax
cmpl $0x6, %eax
jge 0x96e3
movq 0x1192f(%rip), %rax     # 0x1aff0
movq (%rax), %rdi
movq -0x220(%rbp), %rdx
leaq 0xccea(%rip), %rsi      # 0x163bc
movb $0x0, %al
callq 0x3180
movl $0x1, %edi
callq 0x3240
movzbl -0x114(%rbp), %eax
cmpl $0x0, %eax
jne 0x973c
movzbl -0x115(%rbp), %eax
cmpl $0x0, %eax
jne 0x973c
movzbl -0x116(%rbp), %eax
cmpl $0x0, %eax
jne 0x973c
movzbl -0x117(%rbp), %eax
cmpl $0x0, %eax
jne 0x973c
movq 0x118d6(%rip), %rax     # 0x1aff0
movq (%rax), %rdi
movq -0x220(%rbp), %rdx
leaq 0xcccd(%rip), %rsi      # 0x163f8
movb $0x0, %al
callq 0x3180
movl $0x1, %edi
callq 0x3240
movl -0x214(%rbp), %edi
movl -0x4(%rbp), %eax
movl $0x21, %esi
movzbl %al, %edx
callq 0x3f30
movl %eax, -0x218(%rbp)
cmpl $0x0, -0x218(%rbp)
je 0x9792
movq 0x11888(%rip), %rax     # 0x1aff0
movq (%rax), %rdi
movl -0x4(%rbp), %edx
movq -0x220(%rbp), %r8
leaq 0x9fce(%rip), %rsi      # 0x1374a
movl $0x21, %ecx
movb $0x0, %al
callq 0x3180
movl $0x1, %edi
callq 0x3240
movl -0x218(%rbp), %eax
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
nopw %cs:(%rax,%rax)