#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_cmdtm_reg(uint32_t *emmc) {
  uint32_t cmdtm = *(emmc + 0xC / 4);
  printf("CMDTM:-----------------------------------------\n");
  printf("CMD_INDEX:         %i\n", ((cmdtm & 0x3F000000) >> 24));
  printf("CMD_TYPE:          %i%i\n", ((cmdtm & (1 << 23)) != 0) ? 1 : 0,
         ((cmdtm & (1 << 22)) != 0) ? 1 : 0);
  printf("CMD_ISDATA:        %i\n", ((cmdtm & (1 << 21)) != 0) ? 1 : 0);
  printf("CMD_IXCHK_EN:      %i\n", ((cmdtm & (1 << 20)) != 0) ? 1 : 0);
  printf("CMD_CRCCHK_EN:     %i\n", ((cmdtm & (1 << 19)) != 0) ? 1 : 0);
  printf("CMD_RSPNS_TYPE:    %i%i\n", ((cmdtm & (1 << 17)) != 0) ? 1 : 0,
         ((cmdtm & (1 << 16)) != 0) ? 1 : 0);
  printf("TM_MULTI_BLOCK:    %i\n", ((cmdtm & (1 << 5)) != 0) ? 1 : 0);
  printf("TM_DAT_DIR:        %i\n", ((cmdtm & (1 << 4)) != 0) ? 1 : 0);
  printf("TM_AUTO_CMD_EN:    %i%i\n", ((cmdtm & (1 << 3)) != 0) ? 1 : 0,
         ((cmdtm & (1 << 2)) != 0) ? 1 : 0);
  printf("TM_BLKCNT_T:       %i\n", ((cmdtm & (1 << 1)) != 0) ? 1 : 0);
}


x86 assembly (clang, -O0):
<print_cmdtm_reg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0xc(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
and    $0x3f000000,%esi
sar    $0x18,%esi
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
and    $0x800000,%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
mov    -0xc(%rbp),%ecx
and    $0x400000,%ecx
xor    %edx,%edx
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%edx
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
and    $0x200000,%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
and    $0x100000,%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
and    $0x80000,%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
and    $0x20000,%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
mov    -0xc(%rbp),%ecx
and    $0x10000,%ecx
xor    %edx,%edx
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%edx
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
and    $0x20,%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
and    $0x10,%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
and    $0x8,%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
mov    -0xc(%rbp),%ecx
and    $0x4,%ecx
xor    %edx,%edx
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%edx
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
and    $0x2,%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_cmdtm_reg>:
push   %rbx
mov    0xc(%rdi),%ebx
lea    0xfc1(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%esi
shr    $0x18,%esi
and    $0x3f,%esi
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x17,%esi
and    $0x1,%esi
mov    %ebx,%edx
shr    $0x16,%edx
and    $0x1,%edx
lea    0xeba(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x15,%esi
and    $0x1,%esi
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x14,%esi
and    $0x1,%esi
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x13,%esi
and    $0x1,%esi
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x11,%esi
and    $0x1,%esi
mov    %ebx,%edx
shr    $0x10,%edx
and    $0x1,%edx
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x5,%esi
and    $0x1,%esi
lea    0xebb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x4,%esi
and    $0x1,%esi
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x3,%esi
and    $0x1,%esi
mov    %ebx,%edx
shr    $0x2,%edx
and    $0x1,%edx
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
shr    %ebx
and    $0x1,%ebx
lea    0xebb(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"CMDTM:-----------------------------------------\0A\00"
@.str.1 = [23 x i8] c"CMD_INDEX: %i\0A\00"
@.str.2 = [25 x i8] c"CMD_TYPE: %i%i\0A\00"
@.str.3 = [23 x i8] c"CMD_ISDATA: %i\0A\00"
@.str.4 = [23 x i8] c"CMD_IXCHK_EN: %i\0A\00"
@.str.5 = [23 x i8] c"CMD_CRCCHK_EN: %i\0A\00"
@.str.6 = [25 x i8] c"CMD_RSPNS_TYPE: %i%i\0A\00"
@.str.7 = [23 x i8] c"TM_MULTI_BLOCK: %i\0A\00"
@.str.8 = [23 x i8] c"TM_DAT_DIR: %i\0A\00"
@.str.9 = [25 x i8] c"TM_AUTO_CMD_EN: %i%i\0A\00"
@.str.10 = [23 x i8] c"TM_BLKCNT_T: %i\0A\00"
define void @print_cmdtm_reg(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 3
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %3
%9 = and i32 %8, 1056964608
%10 = ashr i32 %9, 24
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %3
%13 = and i32 %12, 8388608
%14 = icmp ne i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 1, i32 0
%17 = load i32, i32* %3
%18 = and i32 %17, 4194304
%19 = icmp ne i32 %18, 0
%20 = zext i1 %19 to i64
%21 = select i1 %19, i32 1, i32 0
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 %21)
%23 = load i32, i32* %3
%24 = and i32 %23, 2097152
%25 = icmp ne i32 %24, 0
%26 = zext i1 %25 to i64
%27 = select i1 %25, i32 1, i32 0
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %3
%30 = and i32 %29, 1048576
%31 = icmp ne i32 %30, 0
%32 = zext i1 %31 to i64
%33 = select i1 %31, i32 1, i32 0
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %33)
%35 = load i32, i32* %3
%36 = and i32 %35, 524288
%37 = icmp ne i32 %36, 0
%38 = zext i1 %37 to i64
%39 = select i1 %37, i32 1, i32 0
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %3
%42 = and i32 %41, 131072
%43 = icmp ne i32 %42, 0
%44 = zext i1 %43 to i64
%45 = select i1 %43, i32 1, i32 0
%46 = load i32, i32* %3
%47 = and i32 %46, 65536
%48 = icmp ne i32 %47, 0
%49 = zext i1 %48 to i64
%50 = select i1 %48, i32 1, i32 0
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 %45, i32 %50)
%52 = load i32, i32* %3
%53 = and i32 %52, 32
%54 = icmp ne i32 %53, 0
%55 = zext i1 %54 to i64
%56 = select i1 %54, i32 1, i32 0
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 %56)
%58 = load i32, i32* %3
%59 = and i32 %58, 16
%60 = icmp ne i32 %59, 0
%61 = zext i1 %60 to i64
%62 = select i1 %60, i32 1, i32 0
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i32 %62)
%64 = load i32, i32* %3
%65 = and i32 %64, 8
%66 = icmp ne i32 %65, 0
%67 = zext i1 %66 to i64
%68 = select i1 %66, i32 1, i32 0
%69 = load i32, i32* %3
%70 = and i32 %69, 4
%71 = icmp ne i32 %70, 0
%72 = zext i1 %71 to i64
%73 = select i1 %71, i32 1, i32 0
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %68, i32 %73)
%75 = load i32, i32* %3
%76 = and i32 %75, 2
%77 = icmp ne i32 %76, 0
%78 = zext i1 %77 to i64
%79 = select i1 %77, i32 1, i32 0
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0), i32 %79)
ret void
}

LLVM IR (-O2):
@.str.1 = [23 x i8] c"CMD_INDEX: %i\0A\00"
@.str.2 = [25 x i8] c"CMD_TYPE: %i%i\0A\00"
@.str.3 = [23 x i8] c"CMD_ISDATA: %i\0A\00"
@.str.4 = [23 x i8] c"CMD_IXCHK_EN: %i\0A\00"
@.str.5 = [23 x i8] c"CMD_CRCCHK_EN: %i\0A\00"
@.str.6 = [25 x i8] c"CMD_RSPNS_TYPE: %i%i\0A\00"
@.str.7 = [23 x i8] c"TM_MULTI_BLOCK: %i\0A\00"
@.str.8 = [23 x i8] c"TM_DAT_DIR: %i\0A\00"
@.str.9 = [25 x i8] c"TM_AUTO_CMD_EN: %i%i\0A\00"
@.str.10 = [23 x i8] c"TM_BLKCNT_T: %i\0A\00"
@str = [48 x i8] c"CMDTM:-----------------------------------------\00"
define void @print_cmdtm_reg(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 3
%3 = load i32, i32* %2
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%5 = lshr i32 %3, 24
%6 = and i32 %5, 63
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = lshr i32 %3, 23
%9 = and i32 %8, 1
%10 = lshr i32 %3, 22
%11 = and i32 %10, 1
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %9, i32 %11)
%13 = lshr i32 %3, 21
%14 = and i32 %13, 1
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = lshr i32 %3, 20
%17 = and i32 %16, 1
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %17)
%19 = lshr i32 %3, 19
%20 = and i32 %19, 1
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i32 %20)
%22 = lshr i32 %3, 17
%23 = and i32 %22, 1
%24 = lshr i32 %3, 16
%25 = and i32 %24, 1
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 %23, i32 %25)
%27 = lshr i32 %3, 5
%28 = and i32 %27, 1
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 %28)
%30 = lshr i32 %3, 4
%31 = and i32 %30, 1
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i32 %31)
%33 = lshr i32 %3, 3
%34 = and i32 %33, 1
%35 = lshr i32 %3, 2
%36 = and i32 %35, 1
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %34, i32 %36)
%38 = lshr i32 %3, 1
%39 = and i32 %38, 1
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0), i32 %39)
ret void
}