#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 */
void *fdt_getprop(void const *, int, char *, int *);
int /*<<< orphan*/ fdt_stringlist_contains(void const *, int, char const *);
int fdt_node_check_compatible(const void *fdt, int nodeoffset,
                              const char *compatible) {
  const void *prop;
  int len;
  prop = fdt_getprop(fdt, nodeoffset, "compatible", &len);
  if (!prop)
    return len;
  return !fdt_stringlist_contains(prop, len, compatible);
}


x86 assembly (clang, -O0):
<fdt_node_check_compatible>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    0xebf(%rip),%rdx
lea    -0x2c(%rbp),%rcx
call   1030 <fdt_getprop@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1164 <fdt_node_check_compatible+0x44>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1184 <fdt_node_check_compatible+0x64>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1040 <fdt_stringlist_contains@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdt_node_check_compatible>:
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
lea    0xed1(%rip),%rdx
lea    0xc(%rsp),%rcx
call   1030 <fdt_getprop@plt>
mov    %rax,%rdi
mov    0xc(%rsp),%eax
test   %rdi,%rdi
je     1158 <fdt_node_check_compatible+0x38>
mov    %eax,%esi
mov    %rbx,%rdx
call   1040 <fdt_stringlist_contains@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"compatible\00"
define i32 @fdt_node_check_compatible(i8* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call i8* @fdt_getprop(i8* %10, i32 %11, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %9)
store i8* %12, i8** %8
%13 = load i8*, i8** %8
%14 = icmp ne i8* %13, null
br i1 %14, label %17, label %15
15: ; preds = %3
%16 = load i32, i32* %9
store i32 %16, i32* %4
br label %25
17: ; preds = %3
%18 = load i8*, i8** %8
%19 = load i32, i32* %9
%20 = load i8*, i8** %7
%21 = call i32 @fdt_stringlist_contains(i8* %18, i32 %19, i8* %20)
%22 = icmp ne i32 %21, 0
%23 = xor i1 %22, true
%24 = zext i1 %23 to i32
store i32 %24, i32* %4
br label %25
25: ; preds = %17, %15
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
@.str = [11 x i8] c"compatible\00"
define i32 @fdt_node_check_compatible(i8* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = call i8* @fdt_getprop(i8* %0, i32 %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %4)
%7 = icmp eq i8* %6, null
%8 = load i32, i32* %4
br i1 %7, label %13, label %9
9: ; preds = %3
%10 = call i32 @fdt_stringlist_contains(i8* %6, i32 %8, i8* %2)
%11 = icmp eq i32 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %3, %9
%14 = phi i32 [ %12, %9 ], [ %8, %3 ]
ret i32 %14
}