// File: /workspace/github_c_makefile_star2_O2/blasphemy[P]mmc-utils/lsmmc.c
// Function: print_sd_cid
void print_sd_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;
	char oid[3];
	char pnm[6];
	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, "8u16a40a4u4u32u4r8u4u7u1r",
		&mid, &oid[0], &pnm[0], &prv_major, &prv_minor, &psn,
		&mdt_year, &mdt_month, &crc);

	oid[2] = '\0';
	pnm[5] = '\0';

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

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

		printf("\tOID: %s\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%02x%01x %d %s\n", mdt_year, mdt_month,
		       2000 + mdt_year, months[mdt_month]);
		printf("\tCRC: 0x%02x\n", crc);
	} else {
		if (config->sd_ids[mid])
			printf("manufacturer: '%s' '%s'\n",
			       config->sd_ids[mid], oid);
		else
			printf("manufacturer: 'Unlisted' '%s'\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", 2000 + mdt_year,
		       months[mdt_month]);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rax
movq %rdi, %rbx
subq $0x8, %rsp
leaq 0x24(%rsp), %r10
leaq 0x1c(%rsp), %r11
leaq 0x18(%rsp), %r12
leaq 0x20(%rsp), %r13
leaq 0x9869(%rip), %rsi      # 0x11f8a
xorl %ebp, %ebp
leaq 0x14(%rsp), %rdx
leaq 0x9(%rsp), %r14
leaq 0x2a(%rsp), %r15
leaq 0x10(%rsp), %r9
movq %rax, %rdi
movq %r14, %rcx
movq %r15, %r8
movl $0x0, %eax
pushq %r10
pushq %r11
pushq %r12
pushq %r13
leaq 0x2c(%rsp), %r10
pushq %r10
callq 0x8524
addq $0x30, %rsp
movb %bpl, 0x2(%r14)
movb %bpl, 0x5(%r15)
cmpb $0x1, 0x10(%rbx)
jne 0x87b6
leaq 0x9832(%rip), %rsi      # 0x11fa4
pushq $0x1
popq %rbp
movl %ebp, %edi
xorl %eax, %eax
callq 0x31d0
movl 0xc(%rsp), %edx
leaq 0x982f(%rip), %rsi      # 0x11fb8
movl %ebp, %edi
xorl %eax, %eax
callq 0x31d0
movq 0x28(%rbx), %rax
movl 0xc(%rsp), %ecx
movq (%rax,%rcx,8), %rdx
testq %rdx, %rdx
je 0x87e6
leaq 0x6d26(%rip), %rsi      # 0xf4d0
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x31d0
jmp 0x87f7
movq 0x28(%rbx), %rax
movl 0xc(%rsp), %ecx
movq (%rax,%rcx,8), %rdx
testq %rdx, %rdx
je 0x88a8
leaq 0x9863(%rip), %rsi      # 0x12035
pushq $0x1
popq %rdi
leaq 0x1(%rsp), %rcx
xorl %eax, %eax
callq 0x31d0
jmp 0x88be
leaq 0x97da(%rip), %rsi      # 0x11fc7
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x31d0
leaq 0x97d4(%rip), %rsi      # 0x11fd2
pushq $0x1
popq %rbx
leaq 0x1(%rsp), %rdx
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
leaq 0x97c6(%rip), %rsi      # 0x11fdc
leaq 0x22(%rsp), %rdx
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
movl 0x8(%rsp), %edx
movl 0x4(%rsp), %ecx
leaq 0x97b3(%rip), %rsi      # 0x11fe6
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
movl 0x8(%rsp), %edx
movl 0x4(%rsp), %ecx
leaq 0x97ad(%rip), %rsi      # 0x11ff8
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
movl 0x18(%rsp), %edx
leaq 0x97a2(%rip), %rsi      # 0x12001
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
movl 0x10(%rsp), %edx
movl 0x14(%rsp), %ecx
leal 0x7d0(%rdx), %r8d
leaq 0xf302(%rip), %rax      # 0x17b80
movq (%rax,%rcx,8), %r9
leaq 0x9786(%rip), %rsi      # 0x1200f
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
movl 0x1c(%rsp), %edx
leaq 0x978a(%rip), %rsi      # 0x12027
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
jmp 0x891b
leaq 0x979f(%rip), %rsi      # 0x1204e
pushq $0x1
popq %rdi
leaq 0x1(%rsp), %rdx
xorl %eax, %eax
callq 0x31d0
movl 0x8(%rsp), %ecx
movl 0x4(%rsp), %r8d
leaq 0x979f(%rip), %rsi      # 0x1206d
pushq $0x1
popq %rbx
leaq 0x22(%rsp), %rdx
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
movl 0x18(%rsp), %edx
leaq 0x9798(%rip), %rsi      # 0x12082
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
movl $0x7d0, %edx            # imm = 0x7D0
addl 0x10(%rsp), %edx
movl 0x14(%rsp), %eax
leaq 0xf279(%rip), %rcx      # 0x17b80
movq (%rcx,%rax,8), %rcx
leaq 0x9780(%rip), %rsi      # 0x12092
movl %ebx, %edi
xorl %eax, %eax
callq 0x31d0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq