// File: /workspace/github_c_makefile_star2_O2/blasphemy[P]mmc-utils/lsmmc.c
// Function: print_mmc_cid
void print_mmc_cid(struct config *config, char *cid)
{
	static const char *months[] = {
		"jan", "feb", "mar", "apr", "may", "jun",
		"jul", "aug", "sep", "oct", "nov", "dec",
		"invalid0", "invalid1", "invalid2", "invalid3",
	};
	unsigned int mid;
	unsigned int cbx;
	unsigned int oid;
	char pnm[7];
	unsigned int prv_major;
	unsigned int prv_minor;
	unsigned int psn;
	unsigned int mdt_month;
	unsigned int mdt_year;
	unsigned int crc;

	parse_bin(cid, "8u6r2u8u48a4u4u32u4u4u7u1r",
		&mid, &cbx, &oid, &pnm[0], &psn, &prv_major, &prv_minor,
		&mdt_year, &mdt_month, &crc);

	pnm[6] = '\0';

	if (config->verbose) {
		printf("======MMC/CID======\n");

		printf("\tMID: 0x%02x (", mid);
		if (config->mmc_ids[mid])
			printf("%s)\n", config->mmc_ids[mid]);
		else
			printf("Unlisted)\n");

		printf("\tCBX: 0x%01x (", cbx);
		switch (cbx) {
		case 0:
			printf("card)\n");
			break;
		case 1:
			printf("BGA)\n");
			break;
		case 2:
			printf("PoP)\n");
			break;
		case 3:
			printf("reserved)\n");
			break;
		}

		printf("\tOID: 0x%01x\n", oid);
		printf("\tPNM: %s\n", pnm);
		printf("\tPRV: 0x%01x%01x ", prv_major, prv_minor);
		printf("(%d.%d)\n", prv_major, prv_minor);
		printf("\tPSN: 0x%08x\n", psn);
		printf("\tMDT: 0x%01x%01x %d %s\n", mdt_month, mdt_year,
		       1997 + mdt_year, months[mdt_month]);
		printf("\tCRC: 0x%02x\n", crc);
	} else {
		if (config->mmc_ids[mid])
			printf("manufacturer: '%s' '%c'\n",
			       config->mmc_ids[mid], oid);
		else
			printf("manufacturer: 'Unlisted' '%c'\n", oid);

		printf("product: '%s' %d.%d\n", pnm, prv_major, prv_minor);
		printf("serial: 0x%08x\n", psn);
		printf("manfacturing date: %d %s\n", 1997 + mdt_year,
		       months[mdt_month]);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x2c(%rsp), %r10
leaq 0x1c(%rsp), %r11
leaq 0x18(%rsp), %r15
leaq 0xc(%rsp), %r12
leaq 0x10(%rsp), %r13
leaq 0x20(%rsp), %rbp
leaq 0x9749(%rip), %rsi      # 0x120ac
leaq 0x14(%rsp), %rdx
leaq 0x28(%rsp), %rcx
leaq 0x24(%rsp), %r8
leaq 0x31(%rsp), %r14
movq %rax, %rdi
movq %r14, %r9
movl $0x0, %eax
pushq %r10
pushq %r11
pushq %r15
pushq %r12
pushq %r13
pushq %rbp
callq 0x8524
addq $0x30, %rsp
movb $0x0, 0x6(%r14)
cmpb $0x1, 0x10(%rbx)
jne 0x89ec
leaq 0x971f(%rip), %rsi      # 0x120c7
pushq $0x1
popq %rbp
movl %ebp, %edi
xorl %eax, %eax
callq 0x31d0
movl 0x14(%rsp), %edx
leaq 0x95f9(%rip), %rsi      # 0x11fb8
movl %ebp, %edi
xorl %eax, %eax
callq 0x31d0
movq 0x20(%rbx), %rax
movl 0x14(%rsp), %ecx
movq (%rax,%rcx,8), %rdx
testq %rdx, %rdx
je 0x8a1b
leaq 0x6af0(%rip), %rsi      # 0xf4d0
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x31d0
jmp 0x8a2c
movq 0x20(%rbx), %rax
movl 0x14(%rsp), %ecx
movq (%rax,%rcx,8), %rdx
movl 0x24(%rsp), %ecx
testq %rdx, %rdx
je 0x8b13
leaq 0x9723(%rip), %rsi      # 0x1212f
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x31d0
jmp 0x8b26
leaq 0x95a5(%rip), %rsi      # 0x11fc7
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x31d0
movl 0x28(%rsp), %edx
leaq 0x96a5(%rip), %rsi      # 0x120dc
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x31d0
movl 0x28(%rsp), %eax
cmpq $0x3, %rax
ja 0x8a63
leaq 0x902e(%rip), %rcx      # 0x11a80
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x31d0
movl 0x24(%rsp), %edx
leaq 0x969b(%rip), %rsi      # 0x12109
pushq $0x1
popq %rbx
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
leaq 0x955b(%rip), %rsi      # 0x11fdc
leaq 0x31(%rsp), %rdx
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
movl 0x10(%rsp), %edx
movl 0xc(%rsp), %ecx
leaq 0x9548(%rip), %rsi      # 0x11fe6
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
movl 0x10(%rsp), %edx
movl 0xc(%rsp), %ecx
leaq 0x9542(%rip), %rsi      # 0x11ff8
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
movl 0x20(%rsp), %edx
leaq 0x9537(%rip), %rsi      # 0x12001
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
movl 0x1c(%rsp), %edx
movl 0x18(%rsp), %ecx
leal 0x7cd(%rcx), %r8d
leaq 0xf097(%rip), %rax      # 0x17b80
movq (%rax,%rdx,8), %r9
leaq 0x9623(%rip), %rsi      # 0x12117
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
movl 0x2c(%rsp), %edx
leaq 0x951f(%rip), %rsi      # 0x12027
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
jmp 0x8b83
leaq 0x962e(%rip), %rsi      # 0x12148
pushq $0x1
popq %rdi
movl %ecx, %edx
xorl %eax, %eax
callq 0x31d0
movl 0x10(%rsp), %ecx
movl 0xc(%rsp), %r8d
leaq 0x9537(%rip), %rsi      # 0x1206d
pushq $0x1
popq %rbx
leaq 0x31(%rsp), %rdx
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
movl 0x20(%rsp), %edx
leaq 0x9530(%rip), %rsi      # 0x12082
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
movl $0x7cd, %edx            # imm = 0x7CD
addl 0x18(%rsp), %edx
movl 0x1c(%rsp), %eax
leaq 0xf011(%rip), %rcx      # 0x17b80
movq (%rcx,%rax,8), %rcx
leaq 0x9518(%rip), %rsi      # 0x12092
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq