LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc.c
// Function: print_help
static void print_help(char *programname, struct Command *cmd, int helptype)
{
	char	*pc;

	printf("\t%s %s ", programname, cmd->verb );

	if (helptype == ADVANCED_HELP && cmd->adv_help)
		for(pc = cmd->adv_help; *pc; pc++){
			putchar(*pc);
			if(*pc == '\n')
				printf("\t\t");
		}
	else
		for(pc = cmd->help; *pc; pc++){
			putchar(*pc);
			if(*pc == '\n')
				printf("\t\t");
		}

	putchar('\n');
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %rdx
movq 0x10(%rsi), %rcx
leaq 0xa8b6(%rip), %rsi      # 0xe5ef
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
cmpl $0x1, %ebp
jne 0x3d8e
movq 0x20(%rbx), %r14
testq %r14, %r14
je 0x3d8e
movb (%r14), %al
testb %al, %al
je 0x3dcb
incq %r14
leaq 0xa893(%rip), %rbx      # 0xe5f7
movsbl %al, %edi
callq 0x3040
cmpb $0xa, -0x1(%r14)
jne 0x3d82
movl $0x1, %edi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x31c0
movb (%r14), %al
incq %r14
testb %al, %al
jne 0x3d64
jmp 0x3dcb
movq 0x18(%rbx), %r14
movb (%r14), %al
testb %al, %al
je 0x3dcb
incq %r14
leaq 0xa854(%rip), %rbx      # 0xe5f7
movsbl %al, %edi
callq 0x3040
cmpb $0xa, -0x1(%r14)
jne 0x3dc1
movl $0x1, %edi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x31c0
movb (%r14), %al
incq %r14
testb %al, %al
jne 0x3da3
movl $0xa, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x3040
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc.c
// Function: prepare_args
static int prepare_args(int *ac, char ***av, char *prgname, struct Command *cmd ){

	char	**ret;
	int	i;
	char	*newname;

	ret = (char **)malloc(sizeof(char*)*(*ac+1));
	newname = (char*)malloc(strlen(prgname)+strlen(cmd->verb)+2);
	if( !ret || !newname ){
		free(ret);
		free(newname);
		return -1;
	}

	ret[0] = newname;
	for(i=0; i < *ac ; i++ )
		ret[i+1] = (*av)[i];

	strcpy(newname, prgname);
	strcat(newname, " ");
	strcat(newname, cmd->verb);

	(*ac)++;
	*av = ret;

	return 0;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %r13
movq %rsi, (%rsp)
movq %rdi, %r14
movslq (%rdi), %rbx
leaq 0x8(,%rbx,8), %rdi
callq 0x31a0
movq %rax, %r12
movq %r13, %rdi
callq 0x30a0
movq %rax, %rbp
movq 0x10(%r15), %rdi
callq 0x30a0
leaq (%rax,%rbp), %rdi
addq $0x2, %rdi
callq 0x31a0
movq %rax, %rbp
testq %r12, %r12
je 0x3e88
testq %rbp, %rbp
je 0x3e88
movq %rbp, (%r12)
testl %ebx, %ebx
jle 0x3e54
movq (%rsp), %rax
movq (%rax), %rax
xorl %ecx, %ecx
movq (%rax,%rcx,8), %rdx
movq %rdx, 0x8(%r12,%rcx,8)
incq %rcx
cmpq %rcx, %rbx
jne 0x3e43
movq %rbp, %rdi
movq %r13, %rsi
callq 0x3060
movq %rbp, %rdi
callq 0x30a0
movw $0x20, (%rbp,%rax)
movq 0x10(%r15), %rsi
movq %rbp, %rdi
callq 0x3210
incl (%r14)
movq (%rsp), %rax
movq %r12, (%rax)
xorl %eax, %eax
jmp 0x3e9d
movq %r12, %rdi
callq 0x3030
movq %rbp, %rdi
callq 0x3030
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc_cmds.c
// Function: read_extcsd
int read_extcsd(int fd, __u8 *ext_csd)
{
	int ret = 0;
	struct mmc_ioc_cmd idata;
	memset(&idata, 0, sizeof(idata));
	memset(ext_csd, 0, sizeof(__u8) * 512);
	idata.write_flag = 0;
	idata.opcode = MMC_SEND_EXT_CSD;
	idata.arg = 0;
	idata.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC;
	idata.blksz = 512;
	idata.blocks = 1;
	mmc_ioc_cmd_set_data(idata, ext_csd);

	ret = ioctl(fd, MMC_IOC_CMD, &idata);
	if (ret)
		perror("ioctl");

	return ret;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rsi, %rbx
movl %edi, %ebp
xorps %xmm0, %xmm0
movq %rsp, %r14
movaps %xmm0, 0x30(%r14)
movaps %xmm0, 0x20(%r14)
movaps %xmm0, 0x10(%r14)
movaps %xmm0, (%r14)
movl $0x200, %edx            # imm = 0x200
movq %rsi, %rdi
xorl %esi, %esi
callq 0x30e0
movl $0x0, (%r14)
movq $0x8, 0x8(%r14)
movabsq $0x200000000b5, %rax    # imm = 0x200000000B5
movq %rax, 0x20(%r14)
movl $0x1, 0x28(%r14)
movq %rbx, 0x40(%r14)
movl $0xc048b300, %esi       # imm = 0xC048B300
movl %ebp, %edi
movq %r14, %rdx
xorl %eax, %eax
callq 0x30f0
movl %eax, %ebx
testl %eax, %eax
jne 0x3f2c
movl %ebx, %eax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xd5fb(%rip), %rdi      # 0x1152e
callq 0x31e0
jmp 0x3f21
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc_cmds.c
// Function: write_extcsd_value
int write_extcsd_value(int fd, __u8 index, __u8 value)
{
	int ret = 0;
	struct mmc_ioc_cmd idata;

	memset(&idata, 0, sizeof(idata));
	idata.write_flag = 1;
	idata.opcode = MMC_SWITCH;
	idata.arg = (MMC_SWITCH_MODE_WRITE_BYTE << 24) |
			(index << 16) |
			(value << 8) |
			EXT_CSD_CMD_SET_NORMAL;
	idata.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;

	ret = ioctl(fd, MMC_IOC_CMD, &idata);
	if (ret)
		perror("ioctl");

	return ret;
}

// Assembly:
pushq %rbx
subq $0x50, %rsp
xorps %xmm0, %xmm0
movq %rsp, %rax
movaps %xmm0, (%rax)
movaps %xmm0, 0x20(%rax)
movaps %xmm0, 0x30(%rax)
movaps %xmm0, 0x10(%rax)
movq $0x0, 0x40(%rax)
movl $0x1, (%rax)
movl $0x6, 0x8(%rax)
shll $0x10, %esi
shll $0x8, %edx
leal (%rdx,%rsi), %ecx
addl $0x3000001, %ecx        # imm = 0x3000001
movl %ecx, 0xc(%rax)
movl $0x49d, 0x20(%rax)      # imm = 0x49D
movl $0xc048b300, %esi       # imm = 0xC048B300
movq %rax, %rdx
xorl %eax, %eax
callq 0x30f0
movl %eax, %ebx
testl %eax, %eax
jne 0x3f9f
movl %ebx, %eax
addq $0x50, %rsp
popq %rbx
retq
leaq 0xd588(%rip), %rdi      # 0x1152e
callq 0x31e0
jmp 0x3f97
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc_cmds.c
// Function: send_status
int send_status(int fd, __u32 *response)
{
	int ret = 0;
	struct mmc_ioc_cmd idata;

	memset(&idata, 0, sizeof(idata));
	idata.opcode = MMC_SEND_STATUS;
	idata.arg = (1 << 16);
	idata.flags = MMC_RSP_R1 | MMC_CMD_AC;

	ret = ioctl(fd, MMC_IOC_CMD, &idata);
	if (ret)
	perror("ioctl");

	*response = idata.response[0];

	return ret;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
xorps %xmm0, %xmm0
movq %rsp, %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x20(%rdx)
movaps %xmm0, 0x30(%rdx)
movaps %xmm0, 0x10(%rdx)
movq $0x0, 0x40(%rdx)
movabsq $0x100000000000d, %rax  # imm = 0x100000000000D
movq %rax, 0x8(%rdx)
movl $0x15, 0x20(%rdx)
movl $0xc048b300, %esi       # imm = 0xC048B300
xorl %eax, %eax
callq 0x30f0
movl %eax, %ebp
testl %eax, %eax
jne 0x4009
movl 0x10(%rsp), %eax
movl %eax, (%rbx)
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %rbp
retq
leaq 0xd51e(%rip), %rdi      # 0x1152e
callq 0x31e0
jmp 0x3ffa
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc_cmds.c
// Function: do_writeprotect_boot_get
int do_writeprotect_boot_get(int nargs, char **argv)
{
	__u8 ext_csd[512];
	int fd, ret;
	char *device;

	if (nargs != 2) {
		fprintf(stderr, "Usage: mmc writeprotect boot get </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);
	}

	print_writeprotect_boot_status(ext_csd);

	return ret;
}

// Assembly:
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
cmpl $0x2, %edi
jne 0x405c
movq 0x8(%rsi), %rbx
movq %rbx, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x31d0
testl %eax, %eax
js 0x407b
movq %rsp, %rsi
movl %eax, %edi
callq 0x3eac
testl %eax, %eax
jne 0x4080
movq %rsp, %rdi
callq 0x40aa
xorl %eax, %eax
addq $0x200, %rsp            # imm = 0x200
popq %rbx
retq
movq 0x12f8d(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0xa663(%rip), %rdx      # 0xe6d0
movl $0x1, %esi
xorl %eax, %eax
callq 0x3240
jmp 0x40a0
callq 0x3280
movq 0x12f69(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0xa674(%rip), %rdx      # 0xe705
movl $0x1, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3240
movl $0x1, %edi
callq 0x3220
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc_cmds.c
// Function: print_writeprotect_boot_status
static void print_writeprotect_boot_status(__u8 *ext_csd)
{
	__u8 reg;
	__u8 ext_csd_rev = ext_csd[EXT_CSD_REV];

	/* A43: reserved [174:0] */
	if (ext_csd_rev >= 5) {
		printf("Boot write protection status registers"
			" [BOOT_WP_STATUS]: 0x%02x\n", ext_csd[174]);

		reg = ext_csd[EXT_CSD_BOOT_WP];
		printf("Boot Area Write protection [BOOT_WP]: 0x%02x\n", reg);
		printf(" Power ro locking: ");
		if (reg & EXT_CSD_BOOT_WP_B_PWR_WP_DIS)
			printf("not possible\n");
		else
			printf("possible\n");

		printf(" Permanent ro locking: ");
		if (reg & EXT_CSD_BOOT_WP_B_PERM_WP_DIS)
			printf("not possible\n");
		else
			printf("possible\n");

		printf(" ro lock status: ");
		if (reg & EXT_CSD_BOOT_WP_B_PWR_WP_EN)
			printf("locked until next power on\n");
		else if (reg & EXT_CSD_BOOT_WP_B_PERM_WP_EN)
			printf("locked permanently\n");
		else
			printf("not locked\n");
	}
}

// Assembly:
cmpb $0x5, 0xc0(%rdi)
jb 0x419c
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movzbl 0xae(%rdi), %edx
leaq 0xd6ee(%rip), %rsi      # 0x117bb
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movzbl 0xad(%rbx), %ebx
leaq 0xd715(%rip), %rsi      # 0x117fc
movl $0x1, %edi
movl %ebx, %edx
xorl %eax, %eax
callq 0x31c0
leaq 0xd72e(%rip), %rsi      # 0x1182a
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
testb $0x40, %bl
leaq 0xd730(%rip), %r15      # 0x11842
leaq 0xd725(%rip), %r14      # 0x1183e
movq %r14, %rsi
cmoveq %r15, %rsi
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
leaq 0xd719(%rip), %rsi      # 0x1184c
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
testb $0x10, %bl
cmoveq %r15, %r14
movl $0x1, %edi
movq %r14, %rsi
xorl %eax, %eax
callq 0x31c0
leaq 0xd708(%rip), %rsi      # 0x11864
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
testb $0x4, %bl
leaq 0xd734(%rip), %rax      # 0x118a6
leaq 0xd719(%rip), %rcx      # 0x11892
cmoveq %rax, %rcx
testb $0x1, %bl
leaq 0xd6ef(%rip), %rsi      # 0x11876
cmoveq %rcx, %rsi
movl $0x1, %edi
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x31c0
retq
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc_cmds.c
// Function: do_writeprotect_boot_set
int do_writeprotect_boot_set(int nargs, char **argv)
{
	__u8 ext_csd[512], value;
	int fd, ret;
	char *device;

	if (nargs != 2) {
		fprintf(stderr, "Usage: mmc writeprotect boot set </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);
	}

	value = ext_csd[EXT_CSD_BOOT_WP] |
		EXT_CSD_BOOT_WP_B_PWR_WP_EN;
	ret = write_extcsd_value(fd, EXT_CSD_BOOT_WP, value);
	if (ret) {
		fprintf(stderr, "Could not write 0x%02x to "
			"EXT_CSD[%d] in %s\n",
			value, EXT_CSD_BOOT_WP, device);
		exit(1);
	}

	return ret;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
cmpl $0x2, %edi
jne 0x4201
movq 0x8(%rsi), %rbx
movq %rbx, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x31d0
testl %eax, %eax
js 0x4220
movl %eax, %r14d
movq %rsp, %rsi
movl %eax, %edi
callq 0x3eac
testl %eax, %eax
jne 0x4225
movzbl 0xad(%rsp), %ebp
orl $0x1, %ebp
movl %r14d, %edi
movl $0xad, %esi
movl %ebp, %edx
callq 0x3f3a
testl %eax, %eax
jne 0x4247
xorl %eax, %eax
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %rbp
retq
movq 0x12de8(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0xa513(%rip), %rdx      # 0xe725
movl $0x1, %esi
xorl %eax, %eax
callq 0x3240
jmp 0x426f
callq 0x3295
movq 0x12dc4(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0xa4cf(%rip), %rdx      # 0xe705
movl $0x1, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3240
jmp 0x426f
movq 0x12da2(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0xa502(%rip), %rdx      # 0xe75a
movl $0x1, %esi
movl %ebp, %ecx
movl $0xad, %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0x3240
movl $0x1, %edi
callq 0x3220
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc_cmds.c
// Function: do_disable_512B_emulation
int do_disable_512B_emulation(int nargs, char **argv)
{
	__u8 ext_csd[512], native_sector_size, data_sector_size, wr_rel_param;
	int fd, ret;
	char *device;

	if (nargs != 2) {
		fprintf(stderr, "Usage: mmc disable 512B emulation </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);
	}

	wr_rel_param = ext_csd[EXT_CSD_WR_REL_PARAM];
	native_sector_size = ext_csd[EXT_CSD_NATIVE_SECTOR_SIZE];
	data_sector_size = ext_csd[EXT_CSD_DATA_SECTOR_SIZE];

	if (native_sector_size && !data_sector_size &&
	   (wr_rel_param & EN_REL_WR)) {
		ret = write_extcsd_value(fd, EXT_CSD_USE_NATIVE_SECTOR, 1);

		if (ret) {
			fprintf(stderr, "Could not write 0x%02x to EXT_CSD[%d] in %s\n",
					1, EXT_CSD_NATIVE_SECTOR_SIZE, device);
			exit(1);
		}
		printf("MMC disable 512B emulation successful.  Now reset the device to switch to 4KB native sector mode.\n");
	} else if (native_sector_size && data_sector_size) {
		printf("MMC 512B emulation mode is already disabled; doing nothing.\n");
	} else {
		printf("MMC does not support disabling 512B emulation mode.\n");
	}

	return ret;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
cmpl $0x2, %edi
jne 0x4954
movq 0x8(%rsi), %rbx
movq %rbx, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x31d0
testl %eax, %eax
js 0x4973
movl %eax, %ebp
movq %rsp, %rsi
movl %eax, %edi
callq 0x3eac
testl %eax, %eax
jne 0x4978
movb 0x3d(%rsp), %cl
movb 0x3f(%rsp), %al
testb %al, %al
sete %dl
testb %cl, %cl
setne %sil
orb %dl, %sil
je 0x490d
testb %cl, %cl
setne %cl
testb %al, %al
setne %al
testb %cl, %al
je 0x4917
leaq 0xa0b5(%rip), %rsi      # 0xe9c0
jmp 0x493c
testb $0x4, 0xa6(%rsp)
jne 0x4920
leaq 0xa0df(%rip), %rsi      # 0xe9fd
jmp 0x493c
movl %ebp, %edi
movl $0x3e, %esi
movl $0x1, %edx
callq 0x3f3a
testl %eax, %eax
jne 0x49a2
leaq 0xa021(%rip), %rsi      # 0xe95d
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
xorl %eax, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %rbp
retq
movq 0x12695(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0x9fc2(%rip), %rdx      # 0xe927
movl $0x1, %esi
xorl %eax, %eax
callq 0x3240
jmp 0x4998
callq 0x3355
movq 0x12671(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0x9d7c(%rip), %rdx      # 0xe705
movl $0x1, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3240
movl $0x1, %edi
callq 0x3220
movq 0x12647(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0x9da7(%rip), %rdx      # 0xe75a
movl $0x1, %esi
movl $0x1, %ecx
movl $0x3f, %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0x3240
jmp 0x4998
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc_cmds.c
// Function: do_hwreset
int do_hwreset(int value, int nargs, char **argv)
{
	__u8 ext_csd[512];
	int fd, ret;
	char *device;

	if (nargs != 2) {
		fprintf(stderr, "Usage: mmc hwreset 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_RST_N_FUNCTION] & EXT_CSD_RST_N_EN_MASK) ==
	    EXT_CSD_HW_RESET_EN) {
		fprintf(stderr,
			"H/W Reset is already permanently enabled on %s\n",
			device);
		exit(1);
	}
	if ((ext_csd[EXT_CSD_RST_N_FUNCTION] & EXT_CSD_RST_N_EN_MASK) ==
	    EXT_CSD_HW_RESET_DIS) {
		fprintf(stderr,
			"H/W Reset is already permanently disabled on %s\n",
			device);
		exit(1);
	}

	ret = write_extcsd_value(fd, EXT_CSD_RST_N_FUNCTION, value);
	if (ret) {
		fprintf(stderr,
			"Could not write 0x%02x to EXT_CSD[%d] in %s\n",
			value, EXT_CSD_RST_N_FUNCTION, device);
		exit(1);
	}

	return ret;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
cmpl $0x2, %esi
jne 0x4d9e
movl %edi, %ebp
movq 0x8(%rdx), %rbx
movq %rbx, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x31d0
testl %eax, %eax
js 0x4dbd
movl %eax, %r14d
movq %rsp, %rsi
movl %eax, %edi
callq 0x3eac
testl %eax, %eax
jne 0x4dc2
movzbl 0xa2(%rsp), %eax
andl $0x3, %eax
cmpl $0x2, %eax
je 0x4dd5
cmpl $0x1, %eax
je 0x4de8
movzbl %bpl, %edx
movl %r14d, %edi
movl $0xa2, %esi
callq 0x3f3a
testl %eax, %eax
jne 0x4e0a
xorl %eax, %eax
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %rbp
retq
movq 0x1224b(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0x9e1d(%rip), %rdx      # 0xebcc
movl $0x1, %esi
xorl %eax, %eax
callq 0x3240
jmp 0x4e32
callq 0x3394
movq 0x12227(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0x9932(%rip), %rdx      # 0xe705
jmp 0x4df9
movq 0x12214(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0x9e44(%rip), %rdx      # 0xec2a
jmp 0x4df9
movq 0x12201(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0x9e01(%rip), %rdx      # 0xebfa
movl $0x1, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3240
jmp 0x4e32
movq 0x121df(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0x993f(%rip), %rdx      # 0xe75a
movl $0x1, %esi
movl %ebp, %ecx
movl $0xa2, %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0x3240
movl $0x1, %edi
callq 0x3220
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc_cmds.c
// Function: do_write_bkops_en
int do_write_bkops_en(int nargs, char **argv)
{
	__u8 ext_csd[512], value = 0;
	int fd, ret;
	char *device;

	if (nargs != 2) {
	       fprintf(stderr, "Usage: mmc bkops 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_BKOPS_SUPPORT] & 0x1)) {
		fprintf(stderr, "%s doesn't support BKOPS\n", device);
		exit(1);
	}

	ret = write_extcsd_value(fd, EXT_CSD_BKOPS_EN, BKOPS_ENABLE);
	if (ret) {
		fprintf(stderr, "Could not write 0x%02x to EXT_CSD[%d] in %s\n",
			value, EXT_CSD_BKOPS_EN, device);
		exit(1);
	}

	return ret;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
cmpl $0x2, %edi
jne 0x4ec4
movq 0x8(%rsi), %rbx
movq %rbx, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x31d0
testl %eax, %eax
js 0x4ee3
movl %eax, %ebp
movq %rsp, %rsi
movl %eax, %edi
callq 0x3eac
testl %eax, %eax
jne 0x4ee8
testb $0x1, 0x1f6(%rsp)
je 0x4efb
movl %ebp, %edi
movl $0xa3, %esi
movl $0x1, %edx
callq 0x3f3a
testl %eax, %eax
jne 0x4f1d
xorl %eax, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %rbp
retq
movq 0x12125(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0x9d86(%rip), %rdx      # 0xec5b
movl $0x1, %esi
xorl %eax, %eax
callq 0x3240
jmp 0x4f45
callq 0x33a9
movq 0x12101(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0x980c(%rip), %rdx      # 0xe705
jmp 0x4f0c
movq 0x120ee(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0x9d7b(%rip), %rdx      # 0xec87
movl $0x1, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3240
jmp 0x4f45
movq 0x120cc(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0x982c(%rip), %rdx      # 0xe75a
movl $0x1, %esi
xorl %ecx, %ecx
movl $0xa3, %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0x3240
movl $0x1, %edi
callq 0x3220
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc_cmds.c
// Function: do_status_get
int do_status_get(int nargs, char **argv)
{
	__u32 response;
	int fd, ret;
	char *device;

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

	device = argv[1];

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

	ret = send_status(fd, &response);
	if (ret) {
		fprintf(stderr, "Could not read response to SEND_STATUS from %s\n", device);
		exit(1);
	}

	printf("SEND_STATUS response: 0x%08x\n", response);

	return ret;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
cmpl $0x2, %edi
jne 0x4f9f
movq 0x8(%rsi), %rbx
movq %rbx, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x31d0
testl %eax, %eax
js 0x4fbe
leaq 0xc(%rsp), %rsi
movl %eax, %edi
callq 0x3fad
testl %eax, %eax
jne 0x4fc3
movl 0xc(%rsp), %edx
leaq 0x9d70(%rip), %rsi      # 0xecfb
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
movq 0x1204a(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0x9cf1(%rip), %rdx      # 0xeca1
movl $0x1, %esi
xorl %eax, %eax
callq 0x3240
jmp 0x4fe3
callq 0x33be
movq 0x12026(%rip), %rax     # 0x16ff0
movq (%rax), %rdi
leaq 0x9cf7(%rip), %rdx      # 0xeccb
movl $0x1, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3240
movl $0x1, %edi
callq 0x3220
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc_cmds.c
// Function: set_partitioning_setting_completed
int set_partitioning_setting_completed(int dry_run, const char * const device,
		int fd)
{
	int ret;

	if (dry_run == 1) {
		fprintf(stderr, "NOT setting PARTITION_SETTING_COMPLETED\n");
		fprintf(stderr, "These changes will not take effect neither "
			"now nor after a power cycle\n");
		return 1;
	} else if (dry_run == 2) {
		printf("-c given, expecting more partition settings before "
			"writing PARTITION_SETTING_COMPLETED\n");
		return 0;
	}

	fprintf(stderr, "setting OTP PARTITION_SETTING_COMPLETED!\n");
	ret = write_extcsd_value(fd, EXT_CSD_PARTITION_SETTING_COMPLETED, 0x1);
	if (ret) {
		fprintf(stderr, "Could not write 0x1 to "
			"EXT_CSD[%d] in %s\n",
			EXT_CSD_PARTITION_SETTING_COMPLETED, device);
		return 1;
	}

	__u32 response;
	ret = send_status(fd, &response);
	if (ret) {
		fprintf(stderr, "Could not get response to SEND_STATUS "
			"from %s\n", device);
		return 1;
	}

	if (response & R1_SWITCH_ERROR) {
		fprintf(stderr, "Setting OTP PARTITION_SETTING_COMPLETED "
			"failed on %s\n", device);
		return 1;
	}

	fprintf(stderr, "Setting OTP PARTITION_SETTING_COMPLETED on "
		"%s SUCCESS\n", device);
	fprintf(stderr, "Device power cycle needed for settings to "
		"take effect.\n"
		"Confirm that PARTITION_SETTING_COMPLETED bit is set "
		"using 'extcsd read' after power cycle\n");

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x2, %edi
je 0x5062
cmpl $0x1, %edi
jne 0x507c
movq 0x11fc4(%rip), %r14     # 0x16ff0
movq (%r14), %rdi
leaq 0x9ce3(%rip), %rdx      # 0xed19
movl $0x1, %ebx
movl $0x1, %esi
xorl %eax, %eax
callq 0x3240
movq (%r14), %rdi
leaq 0x9cf1(%rip), %rdx      # 0xed42
movl $0x1, %esi
xorl %eax, %eax
callq 0x3240
jmp 0x5140
leaq 0x9d21(%rip), %rsi      # 0xed8a
xorl %ebx, %ebx
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
jmp 0x5140
movl %edx, %ebp
movq %rsi, %r14
movq 0x11f68(%rip), %r15     # 0x16ff0
movq (%r15), %rdi
leaq 0x9d50(%rip), %rdx      # 0xede2
movl $0x1, %ebx
movl $0x1, %esi
xorl %eax, %eax
callq 0x3240
movl %ebp, %edi
movl $0x9b, %esi
movl $0x1, %edx
callq 0x3f3a
testl %eax, %eax
je 0x50d8
movq (%r15), %rdi
leaq 0x9d4a(%rip), %rdx      # 0xee0c
movl $0x1, %esi
movl $0x9b, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x3240
jmp 0x5140
leaq 0x4(%rsp), %rsi
movl %ebp, %edi
callq 0x3fad
testl %eax, %eax
je 0x50f4
movq (%r15), %rdi
leaq 0x9d44(%rip), %rdx      # 0xee36
jmp 0x512c
testb $-0x80, 0x4(%rsp)
movq (%r15), %rdi
jne 0x5125
leaq 0x9d96(%rip), %rdx      # 0xee9b
xorl %ebx, %ebx
movl $0x1, %esi
movq %r14, %rcx
xorl %eax, %eax
callq 0x3240
movq (%r15), %rdi
leaq 0x9db2(%rip), %rdx      # 0xeed2
jmp 0x5051
leaq 0x9d39(%rip), %rdx      # 0xee65
movl $0x1, %ebx
movl $0x1, %esi
movq %r14, %rcx
xorl %eax, %eax
callq 0x3240
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc_cmds.c
// Function: do_sanitize
int do_sanitize(int nargs, char **argv)
{
	int fd, ret;
	char *device;

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

	device = argv[1];

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

	ret = write_extcsd_value(fd, EXT_CSD_SANITIZE_START, 1);
	if (ret) {
		fprintf(stderr, "Could not write 0x%02x to EXT_CSD[%d] in %s\n",
			1, EXT_CSD_SANITIZE_START, device);
		exit(1);
	}

	return ret;

}

// Assembly:
pushq %rbx
cmpl $0x2, %edi
jne 0x7006
movq 0x8(%rsi), %rbx
movq %rbx, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x31d0
testl %eax, %eax
js 0x7025
movl %eax, %edi
movl $0xa5, %esi
movl $0x1, %edx
callq 0x3f3a
testl %eax, %eax
jne 0x702a
xorl %eax, %eax
popq %rbx
retq
movq 0xffe3(%rip), %rax      # 0x16ff0
movq (%rax), %rdi
leaq 0x9f5e(%rip), %rdx      # 0x10f75
movl $0x1, %esi
xorl %eax, %eax
callq 0x3240
jmp 0x7055
callq 0x3427
movq 0xffbf(%rip), %rax      # 0x16ff0
movq (%rax), %rdi
leaq 0x771f(%rip), %rdx      # 0xe75a
movl $0x1, %esi
movl $0x1, %ecx
movl $0xa5, %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0x3240
movl $0x1, %edi
callq 0x3220
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc_cmds.c
// Function: rpmb_read_counter
int rpmb_read_counter(int dev_fd, unsigned int *cnt)
{
	int ret;
	struct rpmb_frame frame_in = {
		.req_resp = htobe16(MMC_RPMB_READ_CNT)
	}, frame_out;

	/* Execute RPMB op */
	ret = do_rpmb_op(dev_fd, &frame_in, &frame_out, 1);
	if (ret != 0) {
		perror("RPMB ioctl failed");
		exit(1);
	}

	/* Check RPMB response */
	if (frame_out.result != 0)
		return be16toh(frame_out.result);

	*cnt = be32toh(frame_out.write_counter);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x200(%rsp), %r14
movl $0x200, %edx            # imm = 0x200
movq %r14, %rdi
xorl %esi, %esi
callq 0x30e0
movw $0x200, 0x1fe(%r14)     # imm = 0x200
movq %rsp, %rdx
movl %ebp, %edi
movq %r14, %rsi
movl $0x1, %ecx
callq 0x71fb
testl %eax, %eax
jne 0x74b6
movzwl 0x1fc(%rsp), %eax
testw %ax, %ax
je 0x749d
rolw $0x8, %ax
movzwl %ax, %eax
jmp 0x74aa
movl 0x1f4(%rsp), %eax
bswapl %eax
movl %eax, (%rbx)
xorl %eax, %eax
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r14
popq %rbp
retq
callq 0x3490
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc_cmds.c
// Function: do_rpmb_read_counter
int do_rpmb_read_counter(int nargs, char **argv)
{
	int ret, dev_fd;
	unsigned int cnt;

	if (nargs != 2) {
		fprintf(stderr, "Usage: mmc rpmb read-counter </path/to/mmcblkXrpmb>\n");
		exit(1);
	}

	dev_fd = open(argv[1], O_RDWR);
	if (dev_fd < 0) {
		perror("device open");
		exit(1);
	}

	ret = rpmb_read_counter(dev_fd, &cnt);

	/* Check RPMB response */
	if (ret != 0) {
		printf("RPMB operation failed, retcode 0x%04x\n", ret);
		exit(1);
	}

	close(dev_fd);

	printf("Counter value: 0x%08x\n", cnt);

	return ret;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
cmpl $0x2, %edi
jne 0x7511
movq 0x8(%rsi), %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x31d0
testl %eax, %eax
js 0x7530
movl %eax, %ebx
leaq 0xc(%rsp), %rsi
movl %eax, %edi
callq 0x7440
testl %eax, %eax
jne 0x7535
movl %ebx, %edi
callq 0x3100
movl 0xc(%rsp), %edx
leaq 0x9bba(%rip), %rsi      # 0x110b7
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
movq 0xfad8(%rip), %rax      # 0x16ff0
movq (%rax), %rdi
leaq 0x9b60(%rip), %rdx      # 0x11082
movl $0x1, %esi
xorl %eax, %eax
callq 0x3240
jmp 0x754a
callq 0x34a5
leaq 0x9b1f(%rip), %rsi      # 0x1105b
movl $0x1, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x31c0
movl $0x1, %edi
callq 0x3220
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r14
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
cmpl $0x2, %esi
jne 0x7ce7
movl %edi, %ebp
movq 0x8(%rdx), %rbx
movq %rbx, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x31d0
testl %eax, %eax
js 0x7d06
movl %eax, %r14d
movq %rsp, %rsi
movl %eax, %edi
callq 0x3eac
testl %eax, %eax
jne 0x7d0b
cmpb $0x5, 0xc0(%rsp)
jbe 0x7d1e
cmpl $0x0, 0xf9(%rsp)
je 0x7d31
movzbl %bpl, %edx
movl %r14d, %edi
movl $0x21, %esi
callq 0x3f3a
testl %eax, %eax
jne 0x7d53
xorl %eax, %eax
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %rbp
retq
movq 0xf302(%rip), %rax      # 0x16ff0
movq (%rax), %rdi
leaq 0x965f(%rip), %rdx      # 0x11357
movl $0x1, %esi
xorl %eax, %eax
callq 0x3240
jmp 0x7d7b
callq 0x35f5
movq 0xf2de(%rip), %rax      # 0x16ff0
movq (%rax), %rdi
leaq 0x69e9(%rip), %rdx      # 0xe705
jmp 0x7d42
movq 0xf2cb(%rip), %rax      # 0x16ff0
movq (%rax), %rdi
leaq 0x9654(%rip), %rdx      # 0x11383
jmp 0x7d42
movq 0xf2b8(%rip), %rax      # 0x16ff0
movq (%rax), %rdi
leaq 0x967d(%rip), %rdx      # 0x113bf
movl $0x1, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3240
jmp 0x7d7b
movq 0xf296(%rip), %rax      # 0x16ff0
movq (%rax), %rdi
leaq 0x69f6(%rip), %rdx      # 0xe75a
movl $0x1, %esi
movl %ebp, %ecx
movl $0x21, %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0x3240
movl $0x1, %edi
callq 0x3220
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc_cmds.c
// Function: do_PPEU
int do_PPEU(int nargs, char **argv)
{
 int cmd56_arg = 0x110005FB;
 char data_in[SD_BLOCK_SIZE];
 int fd, ret;
 char *device;
 if (!((nargs == 2)||(nargs == 3))) {
	 printf("Usage mmc ppeu read <-d>");
	 exit(1);
 }
 device = argv[nargs-1];
 fd = open(device, O_RDWR);
 if (fd < 0) {
 perror("open");
 exit(1);
 }
 //execute CMD56 and get one 512-byte data block
 ret = CMD56_data_in(fd, cmd56_arg, data_in);
 if (ret) {
 fprintf(stderr, "CMD56 CALL FAILED, %s\n", device);
 exit(1);
 }
 if (!strcmp("-d", argv[1]))
 dump_data_block(data_in); //data block dumping
 /* write data to stdout in CSV format */
 printf("Fixed Filed Header: %02Xh %02Xh %02Xh %02Xh\n",
 data_in[0], data_in[1], data_in[2], data_in[3]);
 printf("Percentage Step Size: %d\n", data_in[7]);
 printf("TLC/QLC Percentage Utilization: %d%%\n", data_in[8]);
 printf("SLC Percentage Utilization: %d%%\n", data_in[9]);

 return ret;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movl %edi, %eax
andl $-0x2, %eax
cmpl $0x2, %eax
jne 0x83d4
movq %rsi, %r14
movl %edi, %eax
movq -0x8(%rsi,%rax,8), %rbx
movq %rbx, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x31d0
testl %eax, %eax
js 0x83e9
movq %rsp, %rdx
movl %eax, %edi
movl $0x110005fb, %esi       # imm = 0x110005FB
callq 0x8418
testl %eax, %eax
jne 0x83ee
movq 0x8(%r14), %rcx
movzbl (%rcx), %eax
subl $0x2d, %eax
jne 0x8349
movzbl 0x1(%rcx), %eax
subl $0x64, %eax
jne 0x8349
movzbl 0x2(%rcx), %eax
negl %eax
testl %eax, %eax
jne 0x8357
movq %rsp, %rdi
callq 0x84b2
movsbl (%rsp), %edx
movsbl 0x1(%rsp), %ecx
movsbl 0x2(%rsp), %r8d
movsbl 0x3(%rsp), %r9d
leaq 0x9391(%rip), %rsi      # 0x11704
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movsbl 0x7(%rsp), %edx
leaq 0x93a6(%rip), %rsi      # 0x11731
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movsbl 0x8(%rsp), %edx
leaq 0x93a8(%rip), %rsi      # 0x1174b
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movsbl 0x9(%rsp), %edx
leaq 0x93b6(%rip), %rsi      # 0x11771
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
xorl %eax, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r14
retq
leaq 0x92f9(%rip), %rsi      # 0x116d4
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
jmp 0x840e
callq 0x363d
movq 0xebfb(%rip), %rax      # 0x16ff0
movq (%rax), %rdi
leaq 0x92ee(%rip), %rdx      # 0x116ed
movl $0x1, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3240
movl $0x1, %edi
callq 0x3220
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc_cmds.c
// Function: CMD56_data_in
int CMD56_data_in(int fd, int cmd56_arg, char *lba_block_data)
{
 int ret = 0;
 struct mmc_ioc_cmd idata;
 memset(&idata, 0, sizeof(idata));
 memset(lba_block_data, 0, sizeof(__u8) * 512);
 idata.write_flag = 0;
 idata.opcode = SD_GEN_CMD;
 idata.arg = cmd56_arg;
 idata.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC;
 idata.blksz = SD_BLOCK_SIZE;
 idata.blocks = 1;
 mmc_ioc_cmd_set_data(idata, lba_block_data);
 ret = ioctl(fd, MMC_IOC_CMD, &idata);
 if (ret)
 perror("ioctl");
 return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdx, %rbx
movl %esi, %ebp
movl %edi, %r14d
xorps %xmm0, %xmm0
movq %rsp, %r15
movaps %xmm0, 0x30(%r15)
movaps %xmm0, 0x20(%r15)
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
movl $0x200, %edx            # imm = 0x200
movq %rbx, %rdi
xorl %esi, %esi
callq 0x30e0
movl $0x0, (%r15)
movl $0x38, 0x8(%r15)
movl %ebp, 0xc(%r15)
movabsq $0x200000000b5, %rax    # imm = 0x200000000B5
movq %rax, 0x20(%r15)
movl $0x1, 0x28(%r15)
movq %rbx, 0x40(%r15)
movl $0xc048b300, %esi       # imm = 0xC048B300
movl %r14d, %edi
movq %r15, %rdx
xorl %eax, %eax
callq 0x30f0
movl %eax, %ebx
testl %eax, %eax
jne 0x84a4
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9083(%rip), %rdi      # 0x1152e
callq 0x31e0
jmp 0x8497
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/mmc_cmds.c
// Function: dump_data_block
void dump_data_block(char *lba_block_data)
{
 int count=0;
 printf("CMD56 data block dumping:");
 while( count < SD_BLOCK_SIZE) {
 if(count % 16 == 0)
 printf("\n%03d: ", count);
 printf("%02x ", lba_block_data[count]);
 count++;
 }
 printf("\n");

 return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x92cf(%rip), %rsi      # 0x11793
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
leaq 0x92d6(%rip), %r14      # 0x117ad
leaq 0x92d7(%rip), %r15      # 0x117b5
xorl %r12d, %r12d
testb $0xf, %r12b
jne 0x84f9
movl $0x1, %edi
movq %r14, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x31c0
movsbl (%rbx,%r12), %edx
movl $0x1, %edi
movq %r15, %rsi
xorl %eax, %eax
callq 0x31c0
incq %r12
cmpq $0x200, %r12            # imm = 0x200
jne 0x84e1
leaq 0xa5ba(%rip), %rsi      # 0x12ada
movl $0x1, %edi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x31c0
nop
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/lsmmc.c
// Function: usage
void usage(void)
{
	printf("Usage: print mmc [-h] [-v] <device path ...>\n");
	printf("\n");
	printf("Options:\n");
	printf("\t-h\tShow this help.\n");
	printf("\t-v\tEnable verbose mode.\n");
}

// Assembly:
pushq %rax
leaq 0x96d0(%rip), %rsi      # 0x11c10
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
leaq 0xa587(%rip), %rsi      # 0x12ada
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
leaq 0x96d8(%rip), %rsi      # 0x11c3e
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
leaq 0x96cf(%rip), %rsi      # 0x11c48
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
leaq 0x96d1(%rip), %rsi      # 0x11c5d
movl $0x1, %edi
xorl %eax, %eax
popq %rcx
jmp 0x31c0
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/lsmmc.c
// Function: parse_opts
int parse_opts(int argc, char **argv, struct config *config)
{
	int c;

	while ((c = getopt(argc, argv, "hv")) != -1) {
		switch (c) {
		case 'h':
			usage();
			return -1;
		case 'v':
			config->verbose = true;
			break;
		case '?':
			fprintf(stderr,
				"Unknown option '%c' encountered.\n\n", c);
			usage();
			return -1;
		case ':':
			fprintf(stderr,
				"Argument for option '%c' missing.\n\n", c);
			usage();
			return -1;
		default:
			fprintf(stderr,
				"Unimplemented option '%c' encountered.\n", c);
			break;
		}
	}

	if (optind >= argc) {
		fprintf(stderr, "Expected mmc directory arguments.\n\n");
		usage();
		return -1;
	}

	config->dir = strdup(argv[optind]);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
leaq 0x96c4(%rip), %r15      # 0x11c77
movq 0xea36(%rip), %r13      # 0x16ff0
leaq 0x9700(%rip), %r12      # 0x11cc1
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x31f0
cmpl $0x67, %eax
jle 0x85de
cmpl $0x76, %eax
jne 0x85ef
movb $0x1, 0x10(%rbx)
jmp 0x85c1
cmpl $-0x1, %eax
je 0x860f
cmpl $0x3a, %eax
je 0x8645
cmpl $0x3f, %eax
jne 0x85f8
jmp 0x862e
cmpl $0x68, %eax
je 0x867a
movq (%r13), %rdi
movl $0x1, %esi
movq %r12, %rdx
movl %eax, %ecx
xorl %eax, %eax
callq 0x3240
jmp 0x85c1
movq 0xe9ba(%rip), %rax      # 0x16fd0
movslq (%rax), %rax
cmpl %ebp, %eax
jge 0x8663
movq (%r14,%rax,8), %rdi
callq 0x3250
movq %rax, 0x8(%rbx)
xorl %eax, %eax
jmp 0x8684
movq (%r13), %rdi
leaq 0x9641(%rip), %rdx      # 0x11c7a
movl $0x1, %esi
movl $0x3f, %ecx
jmp 0x865a
movq (%r13), %rdi
leaq 0x964d(%rip), %rdx      # 0x11c9d
movl $0x1, %esi
movl $0x3a, %ecx
xorl %eax, %eax
callq 0x3240
jmp 0x867a
movq (%r13), %rdi
leaq 0x967b(%rip), %rdx      # 0x11ce9
movl $0x1, %esi
xorl %eax, %eax
callq 0x3240
callq 0x8538
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/lsmmc.c
// Function: parse_ids
int parse_ids(struct config *config)
{
	unsigned int ids_cnt = sizeof(database) / sizeof(struct ids_database);
	unsigned int value;
	char **ids;
	char *type;
	int i;

	for (i = 0; i < ids_cnt; i++) {
		type = database[i].type;

		if (!strcmp(type, "mmc")) {
			ids = config->mmc_ids;
		} else if (!strcmp(type, "sd")) {
			ids = config->sd_ids;
		} else {
			fprintf(stderr,
				"MMC/SD id parse error, unknown type: '%s'.\n",
				type);
			return -1;
		}

		value = database[i].id;

		if (value >= IDS_MAX) {
			fprintf(stderr,
				"MMC/SD id parse error, id out of range.\n");
			return -1;
		}

		if (ids[value]) {
			fprintf(stderr,
				"Duplicate entries: type='%s', id='0x%1x'.\n",
				type, value);
			return -1;
		}

		ids[value] = database[i].manufacturer;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x28(%rdi), %r12
addq $0x20, %r14
movl $0x10, %r13d
leaq 0xf0ba(%rip), %rbp      # 0x17770
leaq 0x9514(%rip), %r15      # 0x11bd1
movq -0x10(%r13,%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3150
movq %r14, %rcx
testl %eax, %eax
je 0x86e8
cmpb $0x73, (%rbx)
jne 0x871a
cmpb $0x64, 0x1(%rbx)
jne 0x871a
cmpb $0x0, 0x2(%rbx)
movq %r12, %rcx
jne 0x871a
movl -0x8(%r13,%rbp), %r8d
cmpq $0x100, %r8             # imm = 0x100
jae 0x873c
movq (%rcx), %rax
cmpq $0x0, (%rax,%r8,8)
jne 0x875b
movq (%r13,%rbp), %rcx
movq %rcx, (%rax,%r8,8)
addq $0x18, %r13
cmpq $0x2b0, %r13            # imm = 0x2B0
jne 0x86bd
xorl %eax, %eax
jmp 0x8780
movq 0xe8cf(%rip), %rax      # 0x16ff0
movq (%rax), %rdi
leaq 0x95e2(%rip), %rdx      # 0x11d0d
movl $0x1, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3240
jmp 0x877b
movq 0xe8ad(%rip), %rax      # 0x16ff0
movq (%rax), %rdi
leaq 0x95ec(%rip), %rdx      # 0x11d39
movl $0x1, %esi
xorl %eax, %eax
callq 0x3240
jmp 0x877b
movq 0xe88e(%rip), %rax      # 0x16ff0
movq (%rax), %rdi
leaq 0x95f6(%rip), %rdx      # 0x11d62
movl $0x1, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3240
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/lsmmc.c
// Function: read_file
char *read_file(char *name)
{
	char line[4096];
	char *preparsed, *start = line;
	int len;
	FILE *f;

	f = fopen(name, "r");
	if (!f) {
		fprintf(stderr, "Could not open MMC/SD file '%s'.\n", name);
		return NULL;
	}

	preparsed = fgets(line, sizeof(line), f);
	if (!preparsed) {
		if (ferror(f))
			fprintf(stderr, "Could not read MMC/SD file '%s'.\n",
				name);
		else
			fprintf(stderr,
				"Could not read data from MMC/SD file '%s'.\n",
				name);

		if (fclose(f))
			fprintf(stderr, "Could not close MMC/SD file '%s'.\n",
				name);
		return NULL;
	}

	if (fclose(f)) {
		fprintf(stderr, "Could not close MMC/SD file '%s'.\n", name);
		return NULL;
	}

	line[sizeof(line) - 1] = '\0';
	len = strlen(line);

	while (len > 0 && isspace(line[len - 1]))
		len--;

	while (len > 0 && isspace(*start)) {
		start++;
		len--;
	}
	memmove(line, start, len);
	line[len] = '\0';

	return strdup(line);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movq %rdi, %r14
leaq 0x9a1b(%rip), %rsi      # 0x121c2
callq 0x3170
testq %rax, %rax
je 0x87e8
movq %rax, %r15
movq %rsp, %rbx
movq %rbx, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %rax, %rdx
callq 0x3130
testq %rax, %rax
je 0x87fb
movq %r15, %rdi
callq 0x3090
testl %eax, %eax
je 0x886d
movq 0xe80d(%rip), %rax      # 0x16ff0
movq (%rax), %rdi
jmp 0x8843
movq 0xe801(%rip), %rax      # 0x16ff0
movq (%rax), %rdi
leaq 0x9594(%rip), %rdx      # 0x11d8d
jmp 0x884a
movq %r15, %rdi
callq 0x3070
testl %eax, %eax
movq 0xe7e4(%rip), %r12      # 0x16ff0
movq (%r12), %rdi
leaq 0x95ba(%rip), %rax      # 0x11dd1
leaq 0x9591(%rip), %rdx      # 0x11daf
cmoveq %rax, %rdx
xorl %ebx, %ebx
movl $0x1, %esi
movq %r14, %rcx
xorl %eax, %eax
callq 0x3240
movq %r15, %rdi
callq 0x3090
testl %eax, %eax
je 0x885b
movq (%r12), %rdi
leaq 0x95b3(%rip), %rdx      # 0x11dfd
xorl %ebx, %ebx
movl $0x1, %esi
movq %r14, %rcx
xorl %eax, %eax
callq 0x3240
movq %rbx, %rax
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movb $0x0, 0xfff(%rsp)
movq %rbx, %rdi
callq 0x30a0
movq %rax, %r14
movl %r14d, %r12d
movl %r14d, %r15d
sarl $0x1f, %r15d
andl %r14d, %r15d
incq %r12
testl %r14d, %r14d
jle 0x88e5
callq 0x3260
movq (%rax), %rax
movsbq -0x2(%rsp,%r12), %rcx
decl %r14d
decq %r12
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x8890
callq 0x3260
movq (%rax), %rax
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
leaq (%rsp,%r12), %rcx
movl %r14d, %r15d
incq %r15
movq %rsp, %rbx
movsbq (%rbx), %rdx
testb $0x20, 0x1(%rax,%rdx,2)
je 0x88e5
incq %rbx
decq %r15
jne 0x88cc
xorl %r15d, %r15d
movq %rcx, %rbx
movslq %r15d, %r14
movq %rsp, %r15
movl $0x1000, %ecx           # imm = 0x1000
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x3160
movb $0x0, (%rsp,%r14)
movq %r15, %rdi
callq 0x3250
movq %rax, %rbx
jmp 0x885b
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/lsmmc.c
// Function: to_binstr
char *to_binstr(char *hexstr)
{
	char *bindigits[] = {
		"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111",
		"1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111",
	};
	char *binstr, *tail;

	binstr = calloc(strlen(hexstr) * 4 + 1, sizeof(char));
	if (!binstr)
		return NULL;

	tail = binstr;

	while (hexstr && *hexstr != '\0') {
		if (!isxdigit(*hexstr)) {
			free(binstr);
			return NULL;
		}

		if (isdigit(*hexstr))
			strcat(tail, bindigits[*hexstr - '0']);
		else if (islower(*hexstr))
			strcat(tail, bindigits[*hexstr - 'a' + 10]);
		else
			strcat(tail, bindigits[*hexstr - 'A' + 10]);

		hexstr++;
		tail += 4;
	}

	return binstr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x30a0
leaq 0x1(,%rax,4), %rdi
movl $0x1, %esi
callq 0x3140
testq %rax, %rax
je 0x89c2
movq %rax, %rbx
testq %r14, %r14
je 0x89c4
movb (%r14), %r13b
testb %r13b, %r13b
je 0x89c4
callq 0x3260
movq %rax, %r15
incq %r14
leaq 0x909d(%rip), %rbp      # 0x11a00
movq %rbx, %r12
movq (%r15), %rcx
movsbq %r13b, %rax
movzwl (%rcx,%rax,2), %ecx
btl $0xc, %ecx
jae 0x89ba
xorl %edx, %edx
btl $0x9, %ecx
setae %dl
shll $0x5, %edx
addq $-0x57, %rdx
btl $0xb, %ecx
movq $-0x30, %rcx
cmovbq %rcx, %rdx
addq %rax, %rdx
movslq (%rbp,%rdx,4), %rsi
addq %rbp, %rsi
movq %r12, %rdi
callq 0x3210
addq $0x4, %r12
movb (%r14), %r13b
incq %r14
testb %r13b, %r13b
jne 0x8966
jmp 0x89c4
movq %rbx, %rdi
callq 0x3030
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/lsmmc.c
// Function: bin_to_unsigned
void bin_to_unsigned(unsigned int *u, char *binstr, int width)
{
	*u = 0;
	assert(width <= 32);

	while (binstr && *binstr != '\0' && width > 0) {
		*u <<= 1;
		*u |= *binstr == '0' ? 0 : 1;

		binstr++;
		width--;
	}
}

// Assembly:
pushq %rax
movl $0x0, (%rdi)
cmpl $0x20, %edx
jg 0x8a22
testq %rsi, %rsi
je 0x8a20
cmpb $0x0, (%rsi)
sete %al
testl %edx, %edx
setle %cl
orb %al, %cl
jne 0x8a20
incq %rsi
xorl %eax, %eax
leal (%rax,%rax), %ecx
movl %ecx, (%rdi)
xorl %ecx, %ecx
cmpb $0x30, -0x1(%rsi)
setne %cl
leal (%rcx,%rax,2), %eax
movl %eax, (%rdi)
cmpb $0x0, (%rsi)
je 0x8a20
leal -0x1(%rdx), %ecx
incq %rsi
cmpl $0x1, %edx
movl %ecx, %edx
jg 0x89fb
popq %rax
retq
leaq 0x9447(%rip), %rdi      # 0x11e70
leaq 0x944c(%rip), %rsi      # 0x11e7c
leaq 0x944d(%rip), %rcx      # 0x11e84
movl $0x19a, %edx            # imm = 0x19A
callq 0x30d0
// File: /workspace/github_c_makefile_star2_O3/blasphemy[P]mmc-utils/lsmmc.c
// Function: bin_to_ascii
void bin_to_ascii(char *a, char *binstr, int width)
{
	assert(width % 8 == 0);
	*a = '\0';

	while (binstr && *binstr != '\0' && width > 0) {
		unsigned int u;
		char c[2] = { '\0', '\0' };
		char *s = &c[0];

		bin_to_unsigned(&u, binstr, 8);
		c[0] = u;

		strcat(a, s);
		binstr += 8;
		width -= 8;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edx, %r15d
testb $0x7, %r15b
jne 0x8aed
movq %rsi, %rbx
movq %rdi, %r14
movb $0x0, (%rdi)
testq %rsi, %rsi
je 0x8adf
movb (%rbx), %al
testb %al, %al
sete %cl
testl %r15d, %r15d
setle %dl
orb %cl, %dl
jne 0x8adf
leaq 0x1(%rbx), %r13
leaq 0xe(%rsp), %r12
movw $0x0, 0xe(%rsp)
movl $0x8, %esi
xorl %ecx, %ecx
movq %r13, %rdx
movl %ecx, %edi
addb %cl, %dil
cmpb $0x30, %al
setne %cl
orb %dil, %cl
movb (%rdx), %al
testb %al, %al
je 0x8ab4
leal -0x1(%rsi), %edi
incq %rdx
cmpl $0x1, %esi
movl %edi, %esi
ja 0x8a94
movb %cl, 0xe(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x3210
movb 0x8(%rbx), %al
testb %al, %al
je 0x8adf
addq $0x8, %rbx
leal -0x8(%r15), %ecx
addq $0x8, %r13
cmpl $0x8, %r15d
movl %ecx, %r15d
jg 0x8a83
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x93c2(%rip), %rdi      # 0x11eb6
leaq 0x9381(%rip), %rsi      # 0x11e7c
leaq 0x93c3(%rip), %rcx      # 0x11ec5
movl $0x1a7, %edx            # imm = 0x1A7
callq 0x30d0