// File: /workspace/github_c_makefile_star2_O0/blasphemy[P]mmc-utils/lsmmc.c
// Function: process_dir
int process_dir(struct config *config, enum REG_TYPE reg)
{
	char *type = NULL, *cid = NULL, *csd = NULL, *scr = NULL, *ext_csd = NULL;
	int ret = 0;

	if (chdir(config->dir) < 0) {
		fprintf(stderr,
			"MMC/SD information directory '%s' does not exist.\n",
			config->dir);
		return -1;
	}

	type = read_file("type");
	if (!type) {
		fprintf(stderr,
			"Could not read card interface type in directory '%s'.\n",
			config->dir);
		return -1;
	}

	if (strcmp(type, "MMC") && strcmp(type, "SD")) {
		fprintf(stderr, "Unknown type: '%s'\n", type);
		ret = -1;
		goto err;
	}

	switch (reg) {
	case CID:
		cid = read_file("cid");
		if (!cid) {
			fprintf(stderr,
				"Could not read card identity in directory '%s'.\n",
				config->dir);
			ret = -1;
			goto err;
		}
		break;
	case CSD:
		csd = read_file("csd");
		if (!csd) {
			fprintf(stderr,
				"Could not read card specific data in "
				"directory '%s'.\n", config->dir);
			ret = -1;
			goto err;
		}
		break;
	case SCR:
		if (!strcmp(type, "SD")) {
			scr = read_file("scr");
			if (!scr) {
				fprintf(stderr, "Could not read SD card "
					"configuration in directory '%s'.\n",
					config->dir);
				ret = -1;
				goto err;
			}
		}
		break;
	case EXT_CSD:
		if (!strcmp(type, "MMC")) {
			ext_csd = read_file("ext_csd");
			if (!ext_csd) {
				fprintf(stderr, "Could not read extra specific "
					"data in directory '%s'.\n",
					config->dir);
				ret = -1;
				goto err;
			}
		}
		break;
	default:
		goto err;
	}

	print_info(config, type, cid, csd, scr, ext_csd);

err:
	free(ext_csd);
	free(scr);
	free(csd);
	free(cid);
	free(type);

	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x30b0
cmpl $0x0, %eax
jge 0xf58c
movq 0xba89(%rip), %rax      # 0x1aff0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x9133(%rip), %rsi      # 0x186ac
movb $0x0, %al
callq 0x3180
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xf7da
leaq 0x914c(%rip), %rdi      # 0x186df
callq 0xa590
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xf5cf
movq 0xba46(%rip), %rax      # 0x1aff0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x9128(%rip), %rsi      # 0x186e4
movb $0x0, %al
callq 0x3180
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xf7da
movq -0x20(%rbp), %rdi
leaq 0x90ce(%rip), %rsi      # 0x186a8
callq 0x3170
cmpl $0x0, %eax
je 0xf621
movq -0x20(%rbp), %rdi
leaq 0x90b6(%rip), %rsi      # 0x186a5
callq 0x3170
cmpl $0x0, %eax
je 0xf621
movq 0xb9f0(%rip), %rax      # 0x1aff0
movq (%rax), %rdi
movq -0x20(%rbp), %rdx
leaq 0x910d(%rip), %rsi      # 0x1871b
movb $0x0, %al
callq 0x3180
movl $0xffffffff, -0x44(%rbp) # imm = 0xFFFFFFFF
jmp 0xf7a7
movl -0x14(%rbp), %eax
movq %rax, -0x50(%rbp)
subq $0x3, %rax
ja 0xf788
movq -0x50(%rbp), %rax
leaq 0x773f(%rip), %rcx      # 0x16d7c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x90e2(%rip), %rdi      # 0x1872f
callq 0xa590
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xf689
movq 0xb98c(%rip), %rax      # 0x1aff0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x90bd(%rip), %rsi      # 0x18733
movb $0x0, %al
callq 0x3180
movl $0xffffffff, -0x44(%rbp) # imm = 0xFFFFFFFF
jmp 0xf7a7
jmp 0xf78a
leaq 0x9146(%rip), %rdi      # 0x187db
callq 0xa590
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0xf6d1
movq 0xb944(%rip), %rax      # 0x1aff0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x90a6(%rip), %rsi      # 0x18764
movb $0x0, %al
callq 0x3180
movl $0xffffffff, -0x44(%rbp) # imm = 0xFFFFFFFF
jmp 0xf7a7
jmp 0xf78a
movq -0x20(%rbp), %rdi
leaq 0x8fc4(%rip), %rsi      # 0x186a5
callq 0x3170
cmpl $0x0, %eax
jne 0xf72d
leaq 0x90a8(%rip), %rdi      # 0x1879a
callq 0xa590
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0xf72b
movq 0xb8e7(%rip), %rax      # 0x1aff0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x9083(%rip), %rsi      # 0x1879e
movb $0x0, %al
callq 0x3180
movl $0xffffffff, -0x44(%rbp) # imm = 0xFFFFFFFF
jmp 0xf7a7
jmp 0xf72d
jmp 0xf78a
movq -0x20(%rbp), %rdi
leaq 0x8f6e(%rip), %rsi      # 0x186a8
callq 0x3170
cmpl $0x0, %eax
jne 0xf786
leaq 0x908c(%rip), %rdi      # 0x187d7
callq 0xa590
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0xf784
movq 0xb88e(%rip), %rax      # 0x1aff0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x906b(%rip), %rsi      # 0x187df
movb $0x0, %al
callq 0x3180
movl $0xffffffff, -0x44(%rbp) # imm = 0xFFFFFFFF
jmp 0xf7a7
jmp 0xf786
jmp 0xf78a
jmp 0xf7a7
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %r8
movq -0x40(%rbp), %r9
callq 0xf400
movq -0x40(%rbp), %rdi
callq 0x3030
movq -0x38(%rbp), %rdi
callq 0x3030
movq -0x30(%rbp), %rdi
callq 0x3030
movq -0x28(%rbp), %rdi
callq 0x3030
movq -0x20(%rbp), %rdi
callq 0x3030
movl -0x44(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)