#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 */

/* Variables and functions */
int rtas_print(char *, ...);
int print_fru_priority(char priority) {
  int len = 0;
  len = rtas_print("%-20s%c - ", "Priority:", priority);
  switch (priority) {
  case 'H':
    len += rtas_print("High priority and mandatory call-out.\n");
    break;
  case 'M':
    len += rtas_print("Medium priority.\n");
    break;
  case 'A':
    len += rtas_print("Medium priority group A (1st group).\n");
    break;
  case 'B':
    len += rtas_print("Medium priority group B (2nd group).\n");
    break;
  case 'C':
    len += rtas_print("Medium priority group C (3rd group).\n");
    break;
  case 'L':
    len += rtas_print("Low Priority.\n");
    break;
  }
  return len;
}


x86 assembly (clang, -O0):
<print_fru_priority>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0x8(%rbp)
movsbl -0x1(%rbp),%edx
lea    0xf04(%rip),%rdi
lea    0xf08(%rip),%rsi
xor    %eax,%eax
call   1030 <rtas_print@plt>
mov    %eax,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0xc,%eax
ja     11fc <print_fru_priority+0xec>
mov    -0x10(%rbp),%rax
lea    0xe9e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <rtas_print@plt>
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11fc <print_fru_priority+0xec>
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <rtas_print@plt>
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11fc <print_fru_priority+0xec>
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <rtas_print@plt>
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11fc <print_fru_priority+0xec>
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1030 <rtas_print@plt>
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11fc <print_fru_priority+0xec>
lea    0xef8(%rip),%rdi
mov    $0x0,%al
call   1030 <rtas_print@plt>
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11fc <print_fru_priority+0xec>
lea    0xf05(%rip),%rdi
mov    $0x0,%al
call   1030 <rtas_print@plt>
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_fru_priority>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
lea    0xee4(%rip),%rdi
lea    0xee8(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <rtas_print@plt>
mov    %eax,%ebx
add    $0xffffffbf,%ebp
cmp    $0xc,%ebp
ja     115a <print_fru_priority+0x4a>
mov    $0x1887,%eax
bt     %ebp,%eax
jae    115a <print_fru_priority+0x4a>
movslq %ebp,%rax
lea    0xf86(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
xor    %eax,%eax
call   1030 <rtas_print@plt>
add    %eax,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%-20s%c - \00"
@.str.1 = [10 x i8] c"Priority:\00"
@.str.2 = [39 x i8] c"High priority and mandatory call-out.\0A\00"
@.str.3 = [18 x i8] c"Medium priority.\0A\00"
@.str.4 = [38 x i8] c"Medium priority group A (1st group).\0A\00"
@.str.5 = [38 x i8] c"Medium priority group B (2nd group).\0A\00"
@.str.6 = [38 x i8] c"Medium priority group C (3rd group).\0A\00"
@.str.7 = [15 x i8] c"Low Priority.\0A\00"
define i32 @print_fru_priority(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 0, i32* %3
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = call i32 (i8*, ...) @rtas_print(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %5)
store i32 %6, i32* %3
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
switch i32 %8, label %33 [
i32 72, label %9
i32 77, label %13
i32 65, label %17
i32 66, label %21
i32 67, label %25
i32 76, label %29
]
9: ; preds = %1
%10 = call i32 (i8*, ...) @rtas_print(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* %3
%12 = add nsw i32 %11, %10
store i32 %12, i32* %3
br label %33
13: ; preds = %1
%14 = call i32 (i8*, ...) @rtas_print(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%15 = load i32, i32* %3
%16 = add nsw i32 %15, %14
store i32 %16, i32* %3
br label %33
17: ; preds = %1
%18 = call i32 (i8*, ...) @rtas_print(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%19 = load i32, i32* %3
%20 = add nsw i32 %19, %18
store i32 %20, i32* %3
br label %33
21: ; preds = %1
%22 = call i32 (i8*, ...) @rtas_print(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
%23 = load i32, i32* %3
%24 = add nsw i32 %23, %22
store i32 %24, i32* %3
br label %33
25: ; preds = %1
%26 = call i32 (i8*, ...) @rtas_print(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0))
%27 = load i32, i32* %3
%28 = add nsw i32 %27, %26
store i32 %28, i32* %3
br label %33
29: ; preds = %1
%30 = call i32 (i8*, ...) @rtas_print(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%31 = load i32, i32* %3
%32 = add nsw i32 %31, %30
store i32 %32, i32* %3
br label %33
33: ; preds = %1, %29, %25, %21, %17, %13, %9
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@.str = [11 x i8] c"%-20s%c - \00"
@.str.1 = [10 x i8] c"Priority:\00"
@.str.2 = [39 x i8] c"High priority and mandatory call-out.\0A\00"
@.str.3 = [18 x i8] c"Medium priority.\0A\00"
@.str.4 = [38 x i8] c"Medium priority group A (1st group).\0A\00"
@.str.5 = [38 x i8] c"Medium priority group B (2nd group).\0A\00"
@.str.6 = [38 x i8] c"Medium priority group C (3rd group).\0A\00"
@.str.7 = [15 x i8] c"Low Priority.\0A\00"
@reltable.print_fru_priority = [13 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([38 x i8]* @.str.4 to i64), i64 ptrtoint ([13 x i32]* @reltable.print_fru_priority to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([38 x i8]* @.str.5 to i64), i64 ptrtoint ([13 x i32]* @reltable.print_fru_priority to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([38 x i8]* @.str.6 to i64), i64 ptrtoint ([13 x i32]* @reltable.print_fru_priority to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([39 x i8]* @.str.2 to i64), i64 ptrtoint ([13 x i32]* @reltable.print_fru_priority to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([39 x i8]* @.str.2 to i64), i64 ptrtoint ([13 x i32]* @reltable.print_fru_priority to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([39 x i8]* @.str.2 to i64), i64 ptrtoint ([13 x i32]* @reltable.print_fru_priority to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([39 x i8]* @.str.2 to i64), i64 ptrtoint ([13 x i32]* @reltable.print_fru_priority to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([39 x i8]* @.str.2 to i64), i64 ptrtoint ([13 x i32]* @reltable.print_fru_priority to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([39 x i8]* @.str.2 to i64), i64 ptrtoint ([13 x i32]* @reltable.print_fru_priority to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([39 x i8]* @.str.2 to i64), i64 ptrtoint ([13 x i32]* @reltable.print_fru_priority to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([39 x i8]* @.str.2 to i64), i64 ptrtoint ([13 x i32]* @reltable.print_fru_priority to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.7 to i64), i64 ptrtoint ([13 x i32]* @reltable.print_fru_priority to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str.3 to i64), i64 ptrtoint ([13 x i32]* @reltable.print_fru_priority to i64)) to i32)]
define i32 @print_fru_priority(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = tail call i32 (i8*, ...) @rtas_print(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%4 = add nsw i32 %2, -65
%5 = icmp ult i32 %4, 13
br i1 %5, label %6, label %17
6: ; preds = %1
%7 = trunc i32 %4 to i16
%8 = lshr i16 6279, %7
%9 = and i16 %8, 1
%10 = icmp eq i16 %9, 0
br i1 %10, label %17, label %11
11: ; preds = %6
%12 = sext i32 %4 to i64
%13 = shl i64 %12, 2
%14 = call i8* @llvm.load.relative.i64(i8* bitcast ([13 x i32]* @reltable.print_fru_priority to i8*), i64 %13)
%15 = tail call i32 (i8*, ...) @rtas_print(i8* %14)
%16 = add nsw i32 %15, %3
br label %17
17: ; preds = %6, %1, %11
%18 = phi i32 [ %3, %1 ], [ %16, %11 ], [ %3, %6 ]
ret i32 %18
}