#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 uint16_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned int,
                           unsigned int);
int /*<<< orphan*/ stderr;
unsigned int get_radix_insn_ptes(uint16_t flags3) {
  unsigned int host_mode;
  unsigned int guest_mode;
  guest_mode = (flags3 >> 8) & 0x3;
  host_mode = (flags3 >> 10) & 0x3;
  if (guest_mode == 0) {
    fprintf(stderr, "Unsupported radix configuration host %d guest %d\n",
            host_mode, guest_mode);
    exit(1);
  }
  if (host_mode == 0)
    return 4;
  return 0;
}


x86 assembly (clang, -O0):
<get_radix_insn_ptes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
and    $0x3,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sar    $0xa,%eax
and    $0x3,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1172 <get_radix_insn_ptes+0x52>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe9d(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
cmpl   $0x0,-0xc(%rbp)
jne    1188 <get_radix_insn_ptes+0x68>
movl   $0x4,-0x4(%rbp)
jmp    118f <get_radix_insn_ptes+0x6f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_radix_insn_ptes>:
mov    %edi,%edx
shr    $0xa,%edx
and    $0x3,%edx
test   $0x300,%edi
je     113b <get_radix_insn_ptes+0x1b>
xor    %eax,%eax
test   %edx,%edx
sete   %al
shl    $0x2,%eax
ret
push   %rax
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
lea    0xeb4(%rip),%rsi
xor    %ecx,%ecx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [50 x i8] c"Unsupported radix configuration host %d guest %d\0A\00"
define i32 @get_radix_insn_ptes(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = ashr i32 %6, 8
%8 = and i32 %7, 3
store i32 %8, i32* %5
%9 = load i32, i32* %3
%10 = ashr i32 %9, 10
%11 = and i32 %10, 3
store i32 %11, i32* %4
%12 = load i32, i32* %5
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %1
%15 = load i32, i32* @stderr
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %17)
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %1
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %20
store i32 4, i32* %2
br label %25
24: ; preds = %20
store i32 0, i32* %2
br label %25
25: ; preds = %24, %23
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [50 x i8] c"Unsupported radix configuration host %d guest %d\0A\00"
define i32 @get_radix_insn_ptes(i32 %0) {
%2 = lshr i32 %0, 10
%3 = and i32 %2, 3
%4 = and i32 %0, 768
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %3, i32 0)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %1
%11 = icmp eq i32 %3, 0
%12 = select i1 %11, i32 4, i32 0
ret i32 %12
}