#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 */
struct mcuio_packet {
  int dummy;
};

/* Variables and functions */
unsigned int mcuio_packet_bus(struct mcuio_packet *);
unsigned int mcuio_packet_dev(struct mcuio_packet *);
unsigned int mcuio_packet_func(struct mcuio_packet *);
unsigned int mcuio_packet_offset(struct mcuio_packet *);
unsigned int mcuio_packet_type(struct mcuio_packet *);
int /*<<< orphan*/ pr_debug(char *, unsigned int, unsigned int);
int mcuio_packet_is_reply_to(struct mcuio_packet *p,
                             struct mcuio_packet *request) {
  unsigned t = mcuio_packet_type(p);
  unsigned rt = mcuio_packet_type(request);
  unsigned o = mcuio_packet_offset(p);
  unsigned ro = mcuio_packet_offset(request);
  unsigned f = mcuio_packet_func(p);
  unsigned rf = mcuio_packet_func(request);
  unsigned d = mcuio_packet_dev(p);
  unsigned rd = mcuio_packet_dev(request);
  unsigned b = mcuio_packet_bus(p);
  unsigned rb = mcuio_packet_bus(request);
  pr_debug("type = 0x%02x, request type = 0x%02x\n", t, rt);
  return (t & 0x07) == rt && o == ro && f == rf && d == rd && b == rb;
}


x86 assembly (clang, -O0):
<mcuio_packet_is_reply_to>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <mcuio_packet_type@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <mcuio_packet_type@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mcuio_packet_offset@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <mcuio_packet_offset@plt>
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <mcuio_packet_func@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <mcuio_packet_func@plt>
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <mcuio_packet_dev@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <mcuio_packet_dev@plt>
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <mcuio_packet_bus@plt>
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <mcuio_packet_bus@plt>
mov    %eax,-0x38(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe0b(%rip),%rdi
call   1080 <pr_debug@plt>
mov    -0x14(%rbp),%ecx
and    $0x7,%ecx
xor    %eax,%eax
cmp    -0x18(%rbp),%ecx
mov    %al,-0x39(%rbp)
jne    124d <mcuio_packet_is_reply_to+0xed>
mov    -0x1c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x20(%rbp),%ecx
mov    %al,-0x39(%rbp)
jne    124d <mcuio_packet_is_reply_to+0xed>
mov    -0x24(%rbp),%ecx
xor    %eax,%eax
cmp    -0x28(%rbp),%ecx
mov    %al,-0x39(%rbp)
jne    124d <mcuio_packet_is_reply_to+0xed>
mov    -0x2c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x30(%rbp),%ecx
mov    %al,-0x39(%rbp)
jne    124d <mcuio_packet_is_reply_to+0xed>
mov    -0x34(%rbp),%eax
cmp    -0x38(%rbp),%eax
sete   %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mcuio_packet_is_reply_to>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbp
mov    %rdi,%r15
call   1040 <mcuio_packet_type@plt>
mov    %eax,%r13d
mov    %rbp,%rdi
call   1040 <mcuio_packet_type@plt>
mov    %eax,0x10(%rsp)
mov    %r15,%rdi
call   1030 <mcuio_packet_offset@plt>
mov    %eax,0x14(%rsp)
mov    %rbp,%rdi
call   1030 <mcuio_packet_offset@plt>
mov    %eax,%r12d
mov    %r15,%rdi
call   1050 <mcuio_packet_func@plt>
mov    %eax,0xc(%rsp)
mov    %rbp,%rdi
call   1050 <mcuio_packet_func@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1060 <mcuio_packet_dev@plt>
mov    %eax,0x8(%rsp)
mov    %rbp,%rdi
call   1060 <mcuio_packet_dev@plt>
mov    %eax,%r14d
mov    %r15,%rdi
call   1070 <mcuio_packet_bus@plt>
mov    %eax,0x4(%rsp)
mov    %rbp,%rdi
call   1070 <mcuio_packet_bus@plt>
mov    %eax,%ebp
lea    0xe17(%rip),%rdi
mov    %r13d,%esi
mov    0x10(%rsp),%r15d
mov    %r15d,%edx
call   1080 <pr_debug@plt>
and    $0x7,%r13d
xor    %r15d,%r13d
xor    0x14(%rsp),%r12d
xor    0xc(%rsp),%ebx
or     %r12d,%ebx
or     %r13d,%ebx
xor    0x8(%rsp),%r14d
or     %ebx,%r14d
xor    0x4(%rsp),%ebp
xor    %eax,%eax
or     %r14d,%ebp
sete   %al
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.mcuio_packet = type { i32 }
@.str = [38 x i8] c"type = 0x%02x, request type = 0x%02x\0A\00"
define i32 @mcuio_packet_is_reply_to(%struct.mcuio_packet* %0, %struct.mcuio_packet* %1) {
%3 = alloca %struct.mcuio_packet*
%4 = alloca %struct.mcuio_packet*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store %struct.mcuio_packet* %0, %struct.mcuio_packet** %3
store %struct.mcuio_packet* %1, %struct.mcuio_packet** %4
%15 = load %struct.mcuio_packet*, %struct.mcuio_packet** %3
%16 = call i32 @mcuio_packet_type(%struct.mcuio_packet* %15)
store i32 %16, i32* %5
%17 = load %struct.mcuio_packet*, %struct.mcuio_packet** %4
%18 = call i32 @mcuio_packet_type(%struct.mcuio_packet* %17)
store i32 %18, i32* %6
%19 = load %struct.mcuio_packet*, %struct.mcuio_packet** %3
%20 = call i32 @mcuio_packet_offset(%struct.mcuio_packet* %19)
store i32 %20, i32* %7
%21 = load %struct.mcuio_packet*, %struct.mcuio_packet** %4
%22 = call i32 @mcuio_packet_offset(%struct.mcuio_packet* %21)
store i32 %22, i32* %8
%23 = load %struct.mcuio_packet*, %struct.mcuio_packet** %3
%24 = call i32 @mcuio_packet_func(%struct.mcuio_packet* %23)
store i32 %24, i32* %9
%25 = load %struct.mcuio_packet*, %struct.mcuio_packet** %4
%26 = call i32 @mcuio_packet_func(%struct.mcuio_packet* %25)
store i32 %26, i32* %10
%27 = load %struct.mcuio_packet*, %struct.mcuio_packet** %3
%28 = call i32 @mcuio_packet_dev(%struct.mcuio_packet* %27)
store i32 %28, i32* %11
%29 = load %struct.mcuio_packet*, %struct.mcuio_packet** %4
%30 = call i32 @mcuio_packet_dev(%struct.mcuio_packet* %29)
store i32 %30, i32* %12
%31 = load %struct.mcuio_packet*, %struct.mcuio_packet** %3
%32 = call i32 @mcuio_packet_bus(%struct.mcuio_packet* %31)
store i32 %32, i32* %13
%33 = load %struct.mcuio_packet*, %struct.mcuio_packet** %4
%34 = call i32 @mcuio_packet_bus(%struct.mcuio_packet* %33)
store i32 %34, i32* %14
%35 = load i32, i32* %5
%36 = load i32, i32* %6
%37 = call i32 @pr_debug(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %35, i32 %36)
%38 = load i32, i32* %5
%39 = and i32 %38, 7
%40 = load i32, i32* %6
%41 = icmp eq i32 %39, %40
br i1 %41, label %42, label %58
42: ; preds = %2
%43 = load i32, i32* %7
%44 = load i32, i32* %8
%45 = icmp eq i32 %43, %44
br i1 %45, label %46, label %58
46: ; preds = %42
%47 = load i32, i32* %9
%48 = load i32, i32* %10
%49 = icmp eq i32 %47, %48
br i1 %49, label %50, label %58
50: ; preds = %46
%51 = load i32, i32* %11
%52 = load i32, i32* %12
%53 = icmp eq i32 %51, %52
br i1 %53, label %54, label %58
54: ; preds = %50
%55 = load i32, i32* %13
%56 = load i32, i32* %14
%57 = icmp eq i32 %55, %56
br label %58
58: ; preds = %54, %50, %46, %42, %2
%59 = phi i1 [ false, %50 ], [ false, %46 ], [ false, %42 ], [ false, %2 ], [ %57, %54 ]
%60 = zext i1 %59 to i32
ret i32 %60
}

LLVM IR (-O2):
%struct.mcuio_packet = type { i32 }
@.str = [38 x i8] c"type = 0x%02x, request type = 0x%02x\0A\00"
define i32 @mcuio_packet_is_reply_to(%struct.mcuio_packet* %0, %struct.mcuio_packet* %1) {
%3 = tail call i32 @mcuio_packet_type(%struct.mcuio_packet* %0)
%4 = tail call i32 @mcuio_packet_type(%struct.mcuio_packet* %1)
%5 = tail call i32 @mcuio_packet_offset(%struct.mcuio_packet* %0)
%6 = tail call i32 @mcuio_packet_offset(%struct.mcuio_packet* %1)
%7 = tail call i32 @mcuio_packet_func(%struct.mcuio_packet* %0)
%8 = tail call i32 @mcuio_packet_func(%struct.mcuio_packet* %1)
%9 = tail call i32 @mcuio_packet_dev(%struct.mcuio_packet* %0)
%10 = tail call i32 @mcuio_packet_dev(%struct.mcuio_packet* %1)
%11 = tail call i32 @mcuio_packet_bus(%struct.mcuio_packet* %0)
%12 = tail call i32 @mcuio_packet_bus(%struct.mcuio_packet* %1)
%13 = tail call i32 @pr_debug(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
%14 = and i32 %3, 7
%15 = icmp eq i32 %14, %4
%16 = icmp eq i32 %5, %6
%17 = select i1 %15, i1 %16, i1 false
%18 = icmp eq i32 %7, %8
%19 = select i1 %17, i1 %18, i1 false
%20 = icmp eq i32 %9, %10
%21 = select i1 %19, i1 %20, i1 false
%22 = icmp eq i32 %11, %12
%23 = select i1 %21, i1 %22, i1 false
%24 = zext i1 %23 to i32
ret i32 %24
}