#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 LOG_PRI(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, ...);
char *get_facility_str(int);
char *get_level_str(int);
int /*<<< orphan*/ stderr;
void print_priority(int arg) {
  int level = LOG_PRI(arg);
  int facility = arg & ~level;
  const char *level_str = get_level_str(level);
  const char *facility_str = get_facility_str(facility);
  if (facility_str) {
    fprintf(stderr, "%s | %s", level_str, facility_str);
  } else {
    fprintf(stderr, "%s | 0x%02X", level_str, facility);
  }
}


x86 assembly (clang, -O0):
<print_priority>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <LOG_PRI@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <get_level_str@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <get_facility_str@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11ab <print_priority+0x6b>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe61(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    11c9 <print_priority+0x89>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0xc(%rbp),%ecx
lea    0xe46(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_priority>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
call   1050 <LOG_PRI@plt>
mov    %eax,%ebx
not    %ebx
and    %ebp,%ebx
mov    %eax,%edi
call   1030 <get_level_str@plt>
mov    %rax,%r14
mov    %ebx,%edi
call   1040 <get_facility_str@plt>
mov    0x2e77(%rip),%rcx
mov    (%rcx),%edi
test   %rax,%rax
je     1188 <print_priority+0x48>
lea    0xe89(%rip),%rsi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <fprintf@plt>
lea    0xe79(%rip),%rsi
mov    %r14,%rdx
mov    %ebx,%ecx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [8 x i8] c"%s | %s\00"
@.str.1 = [12 x i8] c"%s | 0x%02X\00"
define void @print_priority(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @LOG_PRI(i32 %7)
store i32 %8, i32* %3
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = xor i32 %10, -1
%12 = and i32 %9, %11
store i32 %12, i32* %4
%13 = load i32, i32* %3
%14 = call i8* @get_level_str(i32 %13)
store i8* %14, i8** %5
%15 = load i32, i32* %4
%16 = call i8* @get_facility_str(i32 %15)
store i8* %16, i8** %6
%17 = load i8*, i8** %6
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %24
19: ; preds = %1
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %5
%22 = load i8*, i8** %6
%23 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %21, i8* %22)
br label %29
24: ; preds = %1
%25 = load i32, i32* @stderr
%26 = load i8*, i8** %5
%27 = load i32, i32* %4
%28 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %26, i32 %27)
br label %29
29: ; preds = %24, %19
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [8 x i8] c"%s | %s\00"
@.str.1 = [12 x i8] c"%s | 0x%02X\00"
define void @print_priority(i32 %0) {
%2 = tail call i32 @LOG_PRI(i32 %0)
%3 = xor i32 %2, -1
%4 = and i32 %3, %0
%5 = tail call i8* @get_level_str(i32 %2)
%6 = tail call i8* @get_facility_str(i32 %4)
%7 = icmp eq i8* %6, null
%8 = load i32, i32* @stderr
br i1 %7, label %11, label %9
9: ; preds = %1
%10 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
br label %13
11: ; preds = %1
%12 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %5, i32 %4)
br label %13
13: ; preds = %11, %9
ret void
}