#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 scalar_t__ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_mm_ficd(uint32_t ficd, uint32_t alternate) {
  if (0 == alternate) {
    printf("    FICD    = 0x%08X\n", ficd);
  } else {
    printf("   AFICD    = 0x%08X\n", ficd);
  }
  switch (ficd & 0x00000018) {
  case 0x00000018:
    printf("                      %02x Use PGEC1/PGED1\n", 0x00000018);
    break;
  case 0x00000010:
    printf("                      %02x Use PGEC2/PGED2\n", 0x00000010);
    break;
  case 0x00000008:
    printf("                      %02x Use PGEC3/PGED3\n", 0x00000008);
    break;
  case 0x00000000:
    printf("                      %02x PGEC/PGED not connected\n", 0x00000000);
    break;
  }
  if (ficd & 0x00000004) {
    printf("                       %01x JTAG enabled\n", 0x00000004);
  } else {
    printf("                       %01x JTAG disabled\n", 0);
  }
}


x86 assembly (clang, -O0):
<print_mm_ficd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    1143 <print_mm_ficd+0x33>
mov    -0x8(%rbp),%rax
mov    %eax,%esi
lea    0xf2b(%rip),%rdi
call   1030 <printf@plt>
jmp    1155 <print_mm_ficd+0x45>
mov    -0x8(%rbp),%rax
mov    %eax,%esi
lea    0xf2a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
and    $0x18,%eax
mov    %rax,-0x18(%rbp)
sub    $0x18,%rax
ja     11ce <print_mm_ficd+0xbe>
mov    -0x18(%rbp),%rax
lea    0xe8b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf0b(%rip),%rdi
mov    $0x18,%esi
call   1030 <printf@plt>
jmp    11ce <print_mm_ficd+0xbe>
lea    0xf21(%rip),%rdi
mov    $0x10,%esi
call   1030 <printf@plt>
jmp    11ce <print_mm_ficd+0xbe>
lea    0xf37(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
jmp    11ce <print_mm_ficd+0xbe>
lea    0xf4d(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
and    $0x4,%rax
cmp    $0x0,%rax
je     11f6 <print_mm_ficd+0xe6>
lea    0xf61(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
jmp    1204 <print_mm_ficd+0xf4>
lea    0xf75(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_mm_ficd>:
push   %rbx
mov    %rdi,%rbx
test   %rsi,%rsi
lea    0xef2(%rip),%rax
lea    0xf01(%rip),%rdi
cmove  %rax,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
shr    $0x3,%eax
and    $0x3,%eax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf71(%rip),%rdi
xor    %esi,%esi
jmp    117b <print_mm_ficd+0x6b>
lea    0xf0e(%rip),%rdi
mov    $0x10,%esi
jmp    117b <print_mm_ficd+0x6b>
lea    0xed4(%rip),%rdi
mov    $0x18,%esi
jmp    117b <print_mm_ficd+0x6b>
lea    0xf1e(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
test   $0x4,%bl
jne    1194 <print_mm_ficd+0x84>
lea    0xf92(%rip),%rdi
xor    %esi,%esi
pop    %rbx
jmp    1030 <printf@plt>
lea    0xf59(%rip),%rdi
mov    $0x4,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c" FICD = 0x%08X\0A\00"
@.str.1 = [22 x i8] c" AFICD = 0x%08X\0A\00"
@.str.2 = [44 x i8] c" %02x Use PGEC1/PGED1\0A\00"
@.str.3 = [44 x i8] c" %02x Use PGEC2/PGED2\0A\00"
@.str.4 = [44 x i8] c" %02x Use PGEC3/PGED3\0A\00"
@.str.5 = [52 x i8] c" %02x PGEC/PGED not connected\0A\00"
@.str.6 = [42 x i8] c" %01x JTAG enabled\0A\00"
@.str.7 = [43 x i8] c" %01x JTAG disabled\0A\00"
define void @print_mm_ficd(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = icmp eq i64 0, %5
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i64, i64* %3
%9 = trunc i64 %8 to i32
%10 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %15
11: ; preds = %2
%12 = load i64, i64* %3
%13 = trunc i64 %12 to i32
%14 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %11, %7
%16 = load i64, i64* %3
%17 = and i64 %16, 24
switch i64 %17, label %26 [
i64 24, label %18
i64 16, label %20
i64 8, label %22
i64 0, label %24
]
18: ; preds = %15
%19 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i32 24)
br label %26
20: ; preds = %15
%21 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 16)
br label %26
22: ; preds = %15
%23 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i32 8)
br label %26
24: ; preds = %15
%25 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i32 0)
br label %26
26: ; preds = %15, %24, %22, %20, %18
%27 = load i64, i64* %3
%28 = and i64 %27, 4
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i32 4)
br label %34
32: ; preds = %26
%33 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i32 0)
br label %34
34: ; preds = %32, %30
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c" FICD = 0x%08X\0A\00"
@.str.1 = [22 x i8] c" AFICD = 0x%08X\0A\00"
@.str.2 = [44 x i8] c" %02x Use PGEC1/PGED1\0A\00"
@.str.3 = [44 x i8] c" %02x Use PGEC2/PGED2\0A\00"
@.str.4 = [44 x i8] c" %02x Use PGEC3/PGED3\0A\00"
@.str.5 = [52 x i8] c" %02x PGEC/PGED not connected\0A\00"
@.str.6 = [42 x i8] c" %01x JTAG enabled\0A\00"
@.str.7 = [43 x i8] c" %01x JTAG disabled\0A\00"
define void @print_mm_ficd(i64 %0, i64 %1) {
%3 = icmp eq i64 %1, 0
%4 = trunc i64 %0 to i32
%5 = select i1 %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0)
%6 = tail call i32 @printf(i8* %5, i32 %4)
%7 = lshr i64 %0, 3
%8 = and i64 %7, 3
switch i64 %8, label %17 [
i64 3, label %9
i64 2, label %11
i64 1, label %13
i64 0, label %15
]
9: ; preds = %2
%10 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i32 24)
br label %18
11: ; preds = %2
%12 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 16)
br label %18
13: ; preds = %2
%14 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i32 8)
br label %18
15: ; preds = %2
%16 = tail call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i32 0)
br label %18
17: ; preds = %2
unreachable
18: ; preds = %15, %13, %11, %9
%19 = and i64 %0, 4
%20 = icmp eq i64 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i32 4)
br label %25
23: ; preds = %18
%24 = tail call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i32 0)
br label %25
25: ; preds = %23, %21
ret void
}