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

	if (nargs != 5) {
		fprintf(stderr, "Usage: mmc: bootbus set <boot_mode> <reset_boot_bus_conditions> <boot_bus_width> <device>\n");
		exit(1);
	}

	if (strcmp(argv[1], "single_backward") == 0)
		value |= 0;
	else if (strcmp(argv[1], "single_hs") == 0)
		value |= 0x8;
	else if (strcmp(argv[1], "dual") == 0)
		value |= 0x10;
	else {
		fprintf(stderr, "illegal <boot_mode> specified\n");
		exit(1);
	}

	if (strcmp(argv[2], "x1") == 0)
		value |= 0;
	else if (strcmp(argv[2], "retain") == 0)
		value |= 0x4;
	else {
		fprintf(stderr,
			"illegal <reset_boot_bus_conditions> specified\n");
		exit(1);
	}

	if (strcmp(argv[3], "x1") == 0)
		value |= 0;
	else if (strcmp(argv[3], "x4") == 0)
		value |= 0x1;
	else if (strcmp(argv[3], "x8") == 0)
		value |= 0x2;
	else {
		fprintf(stderr,	"illegal <boot_bus_width> specified\n");
		exit(1);
	}

	device = argv[4];
	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);
	}
	printf("Changing ext_csd[BOOT_BUS_CONDITIONS] from 0x%02x to 0x%02x\n",
		ext_csd[EXT_CSD_BOOT_BUS_CONDITIONS], value);

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x211(%rbp)
cmpl $0x5, -0x4(%rbp)
je 0x5211
movq 0x15dfa(%rip), %rax     # 0x1aff0
movq (%rax), %rdi
leaq 0xe88c(%rip), %rsi      # 0x13a8c
movb $0x0, %al
callq 0x3180
movl $0x1, %edi
callq 0x3240
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xe8c7(%rip), %rsi      # 0x13ae7
callq 0x3170
cmpl $0x0, %eax
jne 0x523c
movzbl -0x211(%rbp), %eax
orl $0x0, %eax
movb %al, -0x211(%rbp)
jmp 0x52b8
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xe8ac(%rip), %rsi      # 0x13af7
callq 0x3170
cmpl $0x0, %eax
jne 0x5267
movzbl -0x211(%rbp), %eax
orl $0x8, %eax
movb %al, -0x211(%rbp)
jmp 0x52b6
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xe88b(%rip), %rsi      # 0x13b01
callq 0x3170
cmpl $0x0, %eax
jne 0x5292
movzbl -0x211(%rbp), %eax
orl $0x10, %eax
movb %al, -0x211(%rbp)
jmp 0x52b4
movq 0x15d57(%rip), %rax     # 0x1aff0
movq (%rax), %rdi
leaq 0xe863(%rip), %rsi      # 0x13b06
movb $0x0, %al
callq 0x3180
movl $0x1, %edi
callq 0x3240
jmp 0x52b6
jmp 0x52b8
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0xe85e(%rip), %rsi      # 0x13b25
callq 0x3170
cmpl $0x0, %eax
jne 0x52e3
movzbl -0x211(%rbp), %eax
orl $0x0, %eax
movb %al, -0x211(%rbp)
jmp 0x5332
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0xe836(%rip), %rsi      # 0x13b28
callq 0x3170
cmpl $0x0, %eax
jne 0x530e
movzbl -0x211(%rbp), %eax
orl $0x4, %eax
movb %al, -0x211(%rbp)
jmp 0x5330
movq 0x15cdb(%rip), %rax     # 0x1aff0
movq (%rax), %rdi
leaq 0xe810(%rip), %rsi      # 0x13b2f
movb $0x0, %al
callq 0x3180
movl $0x1, %edi
callq 0x3240
jmp 0x5332
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0xe7e4(%rip), %rsi      # 0x13b25
callq 0x3170
cmpl $0x0, %eax
jne 0x535d
movzbl -0x211(%rbp), %eax
orl $0x0, %eax
movb %al, -0x211(%rbp)
jmp 0x53d9
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0xe7f2(%rip), %rsi      # 0x13b5e
callq 0x3170
cmpl $0x0, %eax
jne 0x5388
movzbl -0x211(%rbp), %eax
orl $0x1, %eax
movb %al, -0x211(%rbp)
jmp 0x53d7
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0xe7ca(%rip), %rsi      # 0x13b61
callq 0x3170
cmpl $0x0, %eax
jne 0x53b3
movzbl -0x211(%rbp), %eax
orl $0x2, %eax
movb %al, -0x211(%rbp)
jmp 0x53d5
movq 0x15c36(%rip), %rax     # 0x1aff0
movq (%rax), %rdi
leaq 0xe7a0(%rip), %rsi      # 0x13b64
movb $0x0, %al
callq 0x3180
movl $0x1, %edi
callq 0x3240
jmp 0x53d7
jmp 0x53d9
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x228(%rbp)
movq -0x228(%rbp), %rdi
movl $0x2, %esi
movb $0x0, %al
callq 0x31e0
movl %eax, -0x218(%rbp)
cmpl $0x0, -0x218(%rbp)
jge 0x5420
leaq 0x10bd3(%rip), %rdi     # 0x15fe4
callq 0x3200
movl $0x1, %edi
callq 0x3240
movl -0x218(%rbp), %edi
leaq -0x210(%rbp), %rsi
callq 0x3e90
movl %eax, -0x21c(%rbp)
cmpl $0x0, -0x21c(%rbp)
je 0x546a
movq 0x15ba8(%rip), %rax     # 0x1aff0
movq (%rax), %rdi
movq -0x228(%rbp), %rdx
leaq 0xe29c(%rip), %rsi      # 0x136f5
movb $0x0, %al
callq 0x3180
movl $0x1, %edi
callq 0x3240
movzbl -0x15f(%rbp), %esi
movzbl -0x211(%rbp), %edx
leaq 0xe709(%rip), %rdi      # 0x13b88
movb $0x0, %al
callq 0x30c0
movl -0x218(%rbp), %edi
movl $0xb1, %esi
movzbl -0x211(%rbp), %edx
callq 0x3f30
movl %eax, -0x21c(%rbp)
cmpl $0x0, -0x21c(%rbp)
je 0x54e1
movq 0x15b3d(%rip), %rax     # 0x1aff0
movq (%rax), %rdi
movzbl -0x211(%rbp), %edx
movq -0x228(%rbp), %r8
leaq 0xe27f(%rip), %rsi      # 0x1374a
movl $0xb1, %ecx
movb $0x0, %al
callq 0x3180
movl $0x1, %edi
callq 0x3240
movl -0x218(%rbp), %edi
callq 0x3110
movl -0x21c(%rbp), %eax
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
nopl (%rax,%rax)