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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
void do_DrIR(uint8_t *p, uint8_t *max, int is_up) {
  if ((max - p) < 24)
    return;
  printf("RDPDR: I/O-Request: Dev-id=%u\n",
         (unsigned)((p + 4)[0] | (p + 4)[1] << 8 | (p + 4)[2] << 16 |
                    (p + 4)[3] << 24));
}


x86 assembly (clang, -O0):
<do_DrIR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
cmp    $0x18,%rax
jge    1141 <do_DrIR+0x31>
jmp    1178 <do_DrIR+0x68>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%esi
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%eax
shl    $0x8,%eax
or     %eax,%esi
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%eax
shl    $0x10,%eax
or     %eax,%esi
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%eax
shl    $0x18,%eax
or     %eax,%esi
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_DrIR>:
sub    %rdi,%rsi
cmp    $0x60,%rsi
jge    111a <do_DrIR+0xa>
ret
mov    0x14(%rdi),%eax
mov    0x18(%rdi),%ecx
shl    $0x8,%eax
or     0x10(%rdi),%eax
shl    $0x10,%ecx
mov    0x1c(%rdi),%esi
shl    $0x18,%esi
or     %ecx,%esi
or     %eax,%esi
lea    0xec6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"RDPDR: I/O-Request: Dev-id=%u\0A\00"
define void @do_DrIR(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32*, i32** %5
%8 = load i32*, i32** %4
%9 = ptrtoint i32* %7 to i64
%10 = ptrtoint i32* %8 to i64
%11 = sub i64 %9, %10
%12 = sdiv exact i64 %11, 4
%13 = icmp slt i64 %12, 24
br i1 %13, label %14, label %15
14: ; preds = %3
br label %39
15: ; preds = %3
%16 = load i32*, i32** %4
%17 = getelementptr inbounds i32, i32* %16, i64 4
%18 = getelementptr inbounds i32, i32* %17, i64 0
%19 = load i32, i32* %18
%20 = load i32*, i32** %4
%21 = getelementptr inbounds i32, i32* %20, i64 4
%22 = getelementptr inbounds i32, i32* %21, i64 1
%23 = load i32, i32* %22
%24 = shl i32 %23, 8
%25 = or i32 %19, %24
%26 = load i32*, i32** %4
%27 = getelementptr inbounds i32, i32* %26, i64 4
%28 = getelementptr inbounds i32, i32* %27, i64 2
%29 = load i32, i32* %28
%30 = shl i32 %29, 16
%31 = or i32 %25, %30
%32 = load i32*, i32** %4
%33 = getelementptr inbounds i32, i32* %32, i64 4
%34 = getelementptr inbounds i32, i32* %33, i64 3
%35 = load i32, i32* %34
%36 = shl i32 %35, 24
%37 = or i32 %31, %36
%38 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %15, %14
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"RDPDR: I/O-Request: Dev-id=%u\0A\00"
define void @do_DrIR(i32* %0, i32* %1, i32 %2) {
%4 = ptrtoint i32* %1 to i64
%5 = ptrtoint i32* %0 to i64
%6 = sub i64 %4, %5
%7 = icmp slt i64 %6, 96
br i1 %7, label %24, label %8
8: ; preds = %3
%9 = getelementptr inbounds i32, i32* %0, i64 4
%10 = load i32, i32* %9
%11 = getelementptr inbounds i32, i32* %0, i64 5
%12 = load i32, i32* %11
%13 = shl i32 %12, 8
%14 = or i32 %13, %10
%15 = getelementptr inbounds i32, i32* %0, i64 6
%16 = load i32, i32* %15
%17 = shl i32 %16, 16
%18 = or i32 %14, %17
%19 = getelementptr inbounds i32, i32* %0, i64 7
%20 = load i32, i32* %19
%21 = shl i32 %20, 24
%22 = or i32 %18, %21
%23 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %3, %8
ret void
}