// File: /workspace/github_c_makefile_star2_O1/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 0x912e(%rip), %rsi      # 0x11f5a
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 0x8c10
addq $0x30, %rsp
movb %bpl, 0x2(%r14)
movb %bpl, 0x5(%r15)
cmpb $0x1, 0x10(%rbx)
jne 0x8ec6
leaq 0x90f7(%rip), %rsi      # 0x11f74
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl 0xc(%rsp), %edx
leaq 0x90f4(%rip), %rsi      # 0x11f88
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movq 0x28(%rbx), %rax
movl 0xc(%rsp), %ecx
movq (%rax,%rcx,8), %rdx
testq %rdx, %rdx
je 0x8ef8
leaq 0x6627(%rip), %rsi      # 0xf4df
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
jmp 0x8f0b
movq 0x28(%rbx), %rax
movl 0xc(%rsp), %ecx
movq (%rax,%rcx,8), %rdx
testq %rdx, %rdx
je 0x8fce
leaq 0x9123(%rip), %rsi      # 0x12005
leaq 0x1(%rsp), %rcx
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
jmp 0x8fe6
leaq 0x9098(%rip), %rsi      # 0x11f97
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
leaq 0x9090(%rip), %rsi      # 0x11fa2
leaq 0x1(%rsp), %rdx
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
leaq 0x9082(%rip), %rsi      # 0x11fac
leaq 0x22(%rsp), %rdx
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl 0x8(%rsp), %edx
movl 0x4(%rsp), %ecx
leaq 0x906c(%rip), %rsi      # 0x11fb6
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl 0x8(%rsp), %edx
movl 0x4(%rsp), %ecx
leaq 0x9063(%rip), %rsi      # 0x11fc8
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl 0x18(%rsp), %edx
leaq 0x9055(%rip), %rsi      # 0x11fd1
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl 0x10(%rsp), %edx
movl 0x14(%rsp), %ecx
leal 0x7d0(%rdx), %r8d
leaq 0xdbe2(%rip), %rax      # 0x16b80
movq (%rax,%rcx,8), %r9
leaq 0x9036(%rip), %rsi      # 0x11fdf
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl 0x1c(%rsp), %edx
leaq 0x9037(%rip), %rsi      # 0x11ff7
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
jmp 0x9049
leaq 0x9049(%rip), %rsi      # 0x1201e
leaq 0x1(%rsp), %rdx
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl 0x8(%rsp), %ecx
movl 0x4(%rsp), %r8d
leaq 0x9047(%rip), %rsi      # 0x1203d
leaq 0x22(%rsp), %rdx
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl 0x18(%rsp), %edx
leaq 0x9040(%rip), %rsi      # 0x12052
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
movl $0x7d0, %edx            # imm = 0x7D0
addl 0x10(%rsp), %edx
movl 0x14(%rsp), %eax
leaq 0xdb4e(%rip), %rcx      # 0x16b80
movq (%rcx,%rax,8), %rcx
leaq 0x9025(%rip), %rsi      # 0x12062
movl $0x1, %edi
xorl %eax, %eax
callq 0x31c0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq