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

/* Variables and functions */
scalar_t__ librpip_dt_file_get_str(int, int, char *, int);
scalar_t__ librpip_dt_module_exists(int);
scalar_t__ strcmp(char const *, char *);
uint32_t librpip_dt_module_enabled(uint32_t moduleid) {
  char status[10];
  if (librpip_dt_module_exists(moduleid)) {
    if (librpip_dt_file_get_str(moduleid, 1, &status[0], 10)) {
      if (strcmp((const char *)&status[0], "disabled")) {
        return 1;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<librpip_dt_module_enabled>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <librpip_dt_module_exists@plt>
cmp    $0x0,%rax
je     119d <librpip_dt_module_enabled+0x6d>
mov    -0x8(%rbp),%edi
lea    -0x12(%rbp),%rdx
mov    $0x1,%esi
mov    $0xa,%ecx
call   1050 <librpip_dt_file_get_str@plt>
cmp    $0x0,%rax
je     1198 <librpip_dt_module_enabled+0x68>
lea    -0x12(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1193 <librpip_dt_module_enabled+0x63>
movl   $0x1,-0x4(%rbp)
jmp    11a4 <librpip_dt_module_enabled+0x74>
jmp    1198 <librpip_dt_module_enabled+0x68>
jmp    119d <librpip_dt_module_enabled+0x6d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<librpip_dt_module_enabled>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebp
call   1030 <librpip_dt_module_exists@plt>
test   %rax,%rax
je     1178 <librpip_dt_module_enabled+0x48>
mov    $0x1,%ebx
lea    0xe(%rsp),%rdx
mov    %ebp,%edi
mov    $0x1,%esi
mov    $0xa,%ecx
call   1050 <librpip_dt_file_get_str@plt>
test   %rax,%rax
je     1178 <librpip_dt_module_enabled+0x48>
lea    0xe97(%rip),%rsi
lea    0xe(%rsp),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    117a <librpip_dt_module_enabled+0x4a>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"disabled\00"
define i32 @librpip_dt_module_enabled(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i8]
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i64 @librpip_dt_module_exists(i32 %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %1
%9 = load i32, i32* %3
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%11 = call i64 @librpip_dt_file_get_str(i32 %9, i32 1, i8* %10, i32 10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %8
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 1, i32* %2
br label %21
18: ; preds = %13
br label %19
19: ; preds = %18, %8
br label %20
20: ; preds = %19, %1
store i32 0, i32* %2
br label %21
21: ; preds = %20, %17
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
@.str = [9 x i8] c"disabled\00"
define i32 @librpip_dt_module_enabled(i32 %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = tail call i64 @librpip_dt_module_exists(i32 %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %1
%7 = call i64 @librpip_dt_file_get_str(i32 %0, i32 1, i8* %3, i32 10)
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %6, %9, %1
br label %13
13: ; preds = %9, %12
%14 = phi i32 [ 0, %12 ], [ 1, %9 ]
ret i32 %14
}