#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_control1_reg(uint32_t *emmc) {
  uint32_t ctrl1 = (*(emmc + 0x2C / 4));
  printf("CONTROL1:--------------------------------------\n");
  printf("SRST_DATA:     %i\n", ((ctrl1 & (1 << 26)) != 0) ? 1 : 0);
  printf("SRST_CMD:      %i\n", ((ctrl1 & (1 << 25)) != 0) ? 1 : 0);
  printf("SRST_HC:       %i\n", ((ctrl1 & (1 << 24)) != 0) ? 1 : 0);
  printf("DATA_TOUNIT:   %i\n", ((ctrl1 & 0x0F0000) >> 16));
  printf("CLK_FREQ8:     %i\n", ((ctrl1 & 0xFF00) >> 8));
  printf("CLK_FREQ_MS2:  %i\n", ((ctrl1 & 0xC0) >> 6));
  printf("CLK_GENSEL:    %i\n", ((ctrl1 & (1 << 5)) != 0) ? 1 : 0);
  printf("CLK_EN:        %i\n", ((ctrl1 & (1 << 2)) != 0) ? 1 : 0);
  printf("CLK_STABLE:    %i\n", ((ctrl1 & (1 << 1)) != 0) ? 1 : 0);
  printf("CLK_INTLEN:    %i\n", ((ctrl1 & (1 << 0)) != 0) ? 1 : 0);
}


x86 assembly (clang, -O0):
<print_control1_reg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2c(%rax),%eax
mov    %eax,-0xc(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
and    $0x4000000,%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xee0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
and    $0x2000000,%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
and    $0x1000000,%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
and    $0xf0000,%esi
sar    $0x10,%esi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
and    $0xff00,%esi
sar    $0x8,%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
and    $0xc0,%esi
sar    $0x6,%esi
lea    0xea9(%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    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
and    $0x4,%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xe8d(%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    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%ecx
and    $0x1,%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_control1_reg>:
push   %rbx
mov    0x2c(%rdi),%ebx
lea    0xf93(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%esi
shr    $0x1a,%esi
and    $0x1,%esi
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x19,%esi
and    $0x1,%esi
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x18,%esi
and    $0x1,%esi
lea    0xebb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x10,%esi
and    $0xf,%esi
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl %bh,%esi
lea    0xeba(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x6,%esi
and    $0x3,%esi
lea    0xeb7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x5,%esi
and    $0x1,%esi
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    $0x2,%esi
and    $0x1,%esi
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%esi
shr    %esi
and    $0x1,%esi
lea    0xeaf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
and    $0x1,%ebx
lea    0xeb1(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"CONTROL1:--------------------------------------\0A\00"
@.str.1 = [19 x i8] c"SRST_DATA: %i\0A\00"
@.str.2 = [19 x i8] c"SRST_CMD: %i\0A\00"
@.str.3 = [19 x i8] c"SRST_HC: %i\0A\00"
@.str.4 = [19 x i8] c"DATA_TOUNIT: %i\0A\00"
@.str.5 = [19 x i8] c"CLK_FREQ8: %i\0A\00"
@.str.6 = [19 x i8] c"CLK_FREQ_MS2: %i\0A\00"
@.str.7 = [19 x i8] c"CLK_GENSEL: %i\0A\00"
@.str.8 = [19 x i8] c"CLK_EN: %i\0A\00"
@.str.9 = [19 x i8] c"CLK_STABLE: %i\0A\00"
@.str.10 = [19 x i8] c"CLK_INTLEN: %i\0A\00"
define void @print_control1_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 11
%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, 67108864
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i64
%12 = select i1 %10, i32 1, i32 0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %3
%15 = and i32 %14, 33554432
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i64
%18 = select i1 %16, i32 1, i32 0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %3
%21 = and i32 %20, 16777216
%22 = icmp ne i32 %21, 0
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 1, i32 0
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %3
%27 = and i32 %26, 983040
%28 = ashr i32 %27, 16
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %3
%31 = and i32 %30, 65280
%32 = ashr i32 %31, 8
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %3
%35 = and i32 %34, 192
%36 = ashr i32 %35, 6
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %3
%39 = and i32 %38, 32
%40 = icmp ne i32 %39, 0
%41 = zext i1 %40 to i64
%42 = select i1 %40, i32 1, i32 0
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %3
%45 = and i32 %44, 4
%46 = icmp ne i32 %45, 0
%47 = zext i1 %46 to i64
%48 = select i1 %46, i32 1, i32 0
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %3
%51 = and i32 %50, 2
%52 = icmp ne i32 %51, 0
%53 = zext i1 %52 to i64
%54 = select i1 %52, i32 1, i32 0
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i32 %54)
%56 = load i32, i32* %3
%57 = and i32 %56, 1
%58 = icmp ne i32 %57, 0
%59 = zext i1 %58 to i64
%60 = select i1 %58, i32 1, i32 0
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %60)
ret void
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"SRST_DATA: %i\0A\00"
@.str.2 = [19 x i8] c"SRST_CMD: %i\0A\00"
@.str.3 = [19 x i8] c"SRST_HC: %i\0A\00"
@.str.4 = [19 x i8] c"DATA_TOUNIT: %i\0A\00"
@.str.5 = [19 x i8] c"CLK_FREQ8: %i\0A\00"
@.str.6 = [19 x i8] c"CLK_FREQ_MS2: %i\0A\00"
@.str.7 = [19 x i8] c"CLK_GENSEL: %i\0A\00"
@.str.8 = [19 x i8] c"CLK_EN: %i\0A\00"
@.str.9 = [19 x i8] c"CLK_STABLE: %i\0A\00"
@.str.10 = [19 x i8] c"CLK_INTLEN: %i\0A\00"
@str = [48 x i8] c"CONTROL1:--------------------------------------\00"
define void @print_control1_reg(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 11
%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, 26
%6 = and i32 %5, 1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = lshr i32 %3, 25
%9 = and i32 %8, 1
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = lshr i32 %3, 24
%12 = and i32 %11, 1
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = lshr i32 %3, 16
%15 = and i32 %14, 15
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %15)
%17 = lshr i32 %3, 8
%18 = and i32 %17, 255
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %18)
%20 = lshr i32 %3, 6
%21 = and i32 %20, 3
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %21)
%23 = lshr i32 %3, 5
%24 = and i32 %23, 1
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %24)
%26 = lshr i32 %3, 2
%27 = and i32 %26, 1
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 %27)
%29 = lshr i32 %3, 1
%30 = and i32 %29, 1
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i32 %30)
%32 = and i32 %3, 1
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %32)
ret void
}