#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 */
scalar_t__ _fdt_stringlist_contains(void const *, int, char const *);
void *fdt_getprop(void const *, int, char *, int *);
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;
  if (_fdt_stringlist_contains(prop, len, compatible))
    return 0;
  else
    return 1;
}


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   1040 <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    1191 <fdt_node_check_compatible+0x71>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1030 <_fdt_stringlist_contains@plt>
cmp    $0x0,%rax
je     118a <fdt_node_check_compatible+0x6a>
movl   $0x0,-0x4(%rbp)
jmp    1191 <fdt_node_check_compatible+0x71>
movl   $0x1,-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   1040 <fdt_getprop@plt>
mov    %rax,%rdi
mov    0xc(%rsp),%eax
test   %rdi,%rdi
je     115a <fdt_node_check_compatible+0x3a>
mov    %eax,%esi
mov    %rbx,%rdx
call   1030 <_fdt_stringlist_contains@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
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 i64 @_fdt_stringlist_contains(i8* %18, i32 %19, i8* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %17
store i32 0, i32* %4
br label %25
24: ; preds = %17
store i32 1, i32* %4
br label %25
25: ; preds = %24, %23, %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 i64 @_fdt_stringlist_contains(i8* %6, i32 %8, i8* %2)
%11 = icmp eq i64 %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
}