// File: /workspace/github_c_makefile_star2_O1/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 0x8feb(%rip), %rsi      # 0x1207c
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 0x8c10
addq $0x30, %rsp
movb $0x0, 0x6(%r14)
cmpb $0x1, 0x10(%rbx)
jne 0x911f
leaq 0x8fc1(%rip), %rsi      # 0x12097
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl 0x14(%rsp), %edx
leaq 0x8e9b(%rip), %rsi      # 0x11f88
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movq 0x20(%rbx), %rax
movl 0x14(%rsp), %ecx
movq (%rax,%rcx,8), %rdx
testq %rdx, %rdx
je 0x9150
leaq 0x63ce(%rip), %rsi      # 0xf4df
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
jmp 0x9163
movq 0x20(%rbx), %rax
movl 0x14(%rsp), %ecx
movq (%rax,%rcx,8), %rdx
movl 0x24(%rsp), %ecx
testq %rdx, %rdx
je 0x9260
leaq 0x8fc0(%rip), %rsi      # 0x120ff
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
jmp 0x9275
leaq 0x8e40(%rip), %rsi      # 0x11f97
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl 0x28(%rsp), %edx
leaq 0x8f3e(%rip), %rsi      # 0x120ac
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl 0x28(%rsp), %eax
cmpq $0x3, %rax
ja 0x919e
leaq 0x88c5(%rip), %rcx      # 0x11a50
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl 0x24(%rsp), %edx
leaq 0x8f30(%rip), %rsi      # 0x120d9
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
leaq 0x8df0(%rip), %rsi      # 0x11fac
leaq 0x31(%rsp), %rdx
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl 0x10(%rsp), %edx
movl 0xc(%rsp), %ecx
leaq 0x8dda(%rip), %rsi      # 0x11fb6
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl 0x10(%rsp), %edx
movl 0xc(%rsp), %ecx
leaq 0x8dd1(%rip), %rsi      # 0x11fc8
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl 0x20(%rsp), %edx
leaq 0x8dc3(%rip), %rsi      # 0x11fd1
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl 0x1c(%rsp), %edx
movl 0x18(%rsp), %ecx
leal 0x7cd(%rcx), %r8d
leaq 0xd950(%rip), %rax      # 0x16b80
movq (%rax,%rdx,8), %r9
leaq 0x8eac(%rip), %rsi      # 0x120e7
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl 0x2c(%rsp), %edx
leaq 0x8da5(%rip), %rsi      # 0x11ff7
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
jmp 0x92d8
leaq 0x8eb1(%rip), %rsi      # 0x12118
movl $0x1, %edi
movl %ecx, %edx
xorl %eax, %eax
callq 0x31c0
movl 0x10(%rsp), %ecx
movl 0xc(%rsp), %r8d
leaq 0x8db8(%rip), %rsi      # 0x1203d
leaq 0x31(%rsp), %rdx
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl 0x20(%rsp), %edx
leaq 0x8db1(%rip), %rsi      # 0x12052
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl $0x7cd, %edx            # imm = 0x7CD
addl 0x18(%rsp), %edx
movl 0x1c(%rsp), %eax
leaq 0xd8bf(%rip), %rcx      # 0x16b80
movq (%rcx,%rax,8), %rcx
leaq 0x8d96(%rip), %rsi      # 0x12062
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq