; LLVM IR from HRI-EU/Rcs :: src/RcsCore (HardwareComponent)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.Rcs::HardwareComponent" = type <{ ptr, ptr, ptr, i8, [7 x i8] }>

@RCS_GLOBAL_RLOG_CB = external global ptr, align 8
@.str = external hidden unnamed_addr constant [78 x i8], align 1
@__func__._ZN3Rcs17HardwareComponent35callControlLayerCallbackIfConnectedEv = external hidden unnamed_addr constant [36 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [19 x i8], align 1
@RcsLogLevel = external global i32, align 4
@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Rcs17HardwareComponent35callControlLayerCallbackIfConnectedEv(ptr noundef nonnull align 8 dereferenceable(25) %0) unnamed_addr #0 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %"class.Rcs::HardwareComponent", ptr %3, i32 0, i32 1
  %5 = load ptr, ptr %4, align 8, !tbaa !9
  %6 = icmp ne ptr %5, null
  br i1 %6, label %7, label %37

7:                                                ; preds = %1
  %8 = getelementptr inbounds %"class.Rcs::HardwareComponent", ptr %3, i32 0, i32 3
  %9 = load i8, ptr %8, align 8, !tbaa !12, !range !13, !noundef !14
  %10 = trunc i8 %9 to i1
  %11 = zext i1 %10 to i32
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %13, label %32

13:                                               ; preds = %7
  br label %14

14:                                               ; preds = %13
  %15 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %16 = icmp ne ptr %15, null
  br i1 %16, label %17, label %19

17:                                               ; preds = %14
  %18 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  call void (i32, ptr, ptr, i32, ptr, ...) %18(i32 noundef 5, ptr noundef @.str, ptr noundef @__func__._ZN3Rcs17HardwareComponent35callControlLayerCallbackIfConnectedEv, i32 noundef 80, ptr noundef @.str.1)
  br label %19

19:                                               ; preds = %17, %14
  %20 = load i32, ptr @RcsLogLevel, align 4, !tbaa !15
  %21 = icmp sle i32 5, %20
  br i1 %21, label %22, label %29

22:                                               ; preds = %19
  %23 = load ptr, ptr @stderr, align 8, !tbaa !5
  %24 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef @.str.2, ptr noundef @.str, ptr noundef @__func__._ZN3Rcs17HardwareComponent35callControlLayerCallbackIfConnectedEv, i32 noundef 80) #2
  %25 = load ptr, ptr @stderr, align 8, !tbaa !5
  %26 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef @.str.1) #2
  %27 = load ptr, ptr @stderr, align 8, !tbaa !5
  %28 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef @.str.3) #2
  br label %29

29:                                               ; preds = %22, %19
  br label %30

30:                                               ; preds = %29
  %31 = getelementptr inbounds %"class.Rcs::HardwareComponent", ptr %3, i32 0, i32 3
  store i8 1, ptr %31, align 8, !tbaa !12
  br label %32

32:                                               ; preds = %30, %7
  %33 = getelementptr inbounds %"class.Rcs::HardwareComponent", ptr %3, i32 0, i32 1
  %34 = load ptr, ptr %33, align 8, !tbaa !9
  %35 = getelementptr inbounds %"class.Rcs::HardwareComponent", ptr %3, i32 0, i32 2
  %36 = load ptr, ptr %35, align 8, !tbaa !17
  call void %34(ptr noundef %36)
  br label %63

37:                                               ; preds = %1
  %38 = getelementptr inbounds %"class.Rcs::HardwareComponent", ptr %3, i32 0, i32 3
  %39 = load i8, ptr %38, align 8, !tbaa !12, !range !13, !noundef !14
  %40 = trunc i8 %39 to i1
  %41 = zext i1 %40 to i32
  %42 = icmp eq i32 %41, 1
  br i1 %42, label %43, label %62

43:                                               ; preds = %37
  br label %44

44:                                               ; preds = %43
  %45 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %49

47:                                               ; preds = %44
  %48 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  call void (i32, ptr, ptr, i32, ptr, ...) %48(i32 noundef 5, ptr noundef @.str, ptr noundef @__func__._ZN3Rcs17HardwareComponent35callControlLayerCallbackIfConnectedEv, i32 noundef 89, ptr noundef @.str.4)
  br label %49

49:                                               ; preds = %47, %44
  %50 = load i32, ptr @RcsLogLevel, align 4, !tbaa !15
  %51 = icmp sle i32 5, %50
  br i1 %51, label %52, label %59

52:                                               ; preds = %49
  %53 = load ptr, ptr @stderr, align 8, !tbaa !5
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef @.str.2, ptr noundef @.str, ptr noundef @__func__._ZN3Rcs17HardwareComponent35callControlLayerCallbackIfConnectedEv, i32 noundef 89) #2
  %55 = load ptr, ptr @stderr, align 8, !tbaa !5
  %56 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef @.str.4) #2
  %57 = load ptr, ptr @stderr, align 8, !tbaa !5
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef @.str.3) #2
  br label %59

59:                                               ; preds = %52, %49
  br label %60

60:                                               ; preds = %59
  %61 = getelementptr inbounds %"class.Rcs::HardwareComponent", ptr %3, i32 0, i32 3
  store i8 0, ptr %61, align 8, !tbaa !12
  br label %62

62:                                               ; preds = %60, %37
  br label %63

63:                                               ; preds = %62, %32
  ret void
}

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_ZTSN3Rcs17HardwareComponentE", !6, i64 8, !6, i64 16, !11, i64 24}
!11 = !{!"bool", !7, i64 0}
!12 = !{!10, !11, i64 24}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !16, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!10, !6, i64 16}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@RCS_GLOBAL_RLOG_CB = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [78 x i8], align 1
@__func__._ZN3Rcs17HardwareComponent35callControlLayerCallbackIfConnectedEv = external hidden unnamed_addr constant [36 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [19 x i8], align 1
@RcsLogLevel = external local_unnamed_addr global i32, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Rcs17HardwareComponent35callControlLayerCallbackIfConnectedEv(ptr nocapture noundef nonnull align 8 dereferenceable(25) %0) unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %.not = icmp eq ptr %3, null
  %4 = getelementptr inbounds i8, ptr %0, i64 24
  %5 = load i8, ptr %4, align 8, !tbaa !11, !range !12, !noundef !13
  br i1 %.not, label %26, label %6

6:                                                ; preds = %1
  %7 = icmp eq i8 %5, 0
  br i1 %7, label %8, label %22

8:                                                ; preds = %6
  %9 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !14
  %.not3 = icmp eq ptr %9, null
  br i1 %.not3, label %11, label %10

10:                                               ; preds = %8
  tail call void (i32, ptr, ptr, i32, ptr, ...) %9(i32 noundef 5, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN3Rcs17HardwareComponent35callControlLayerCallbackIfConnectedEv, i32 noundef 80, ptr noundef nonnull @.str.1)
  br label %11

11:                                               ; preds = %10, %8
  %12 = load i32, ptr @RcsLogLevel, align 4, !tbaa !15
  %13 = icmp sgt i32 %12, 4
  br i1 %13, label %14, label %21

14:                                               ; preds = %11
  %15 = load ptr, ptr @stderr, align 8, !tbaa !14
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN3Rcs17HardwareComponent35callControlLayerCallbackIfConnectedEv, i32 noundef 80) #2
  %17 = load ptr, ptr @stderr, align 8, !tbaa !14
  %18 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef nonnull @.str.1) #2
  %19 = load ptr, ptr @stderr, align 8, !tbaa !14
  %20 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.3) #2
  br label %21

21:                                               ; preds = %11, %14
  store i8 1, ptr %4, align 8, !tbaa !11
  %.pre = load ptr, ptr %2, align 8, !tbaa !5
  br label %22

22:                                               ; preds = %21, %6
  %23 = phi ptr [ %.pre, %21 ], [ %3, %6 ]
  %24 = getelementptr inbounds i8, ptr %0, i64 16
  %25 = load ptr, ptr %24, align 8, !tbaa !17
  tail call void %23(ptr noundef %25)
  br label %42

26:                                               ; preds = %1
  %27 = trunc nuw i8 %5 to i1
  br i1 %27, label %28, label %42

28:                                               ; preds = %26
  %29 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !14
  %.not2 = icmp eq ptr %29, null
  br i1 %.not2, label %31, label %30

30:                                               ; preds = %28
  tail call void (i32, ptr, ptr, i32, ptr, ...) %29(i32 noundef 5, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN3Rcs17HardwareComponent35callControlLayerCallbackIfConnectedEv, i32 noundef 89, ptr noundef nonnull @.str.4)
  br label %31

31:                                               ; preds = %30, %28
  %32 = load i32, ptr @RcsLogLevel, align 4, !tbaa !15
  %33 = icmp sgt i32 %32, 4
  br i1 %33, label %34, label %41

34:                                               ; preds = %31
  %35 = load ptr, ptr @stderr, align 8, !tbaa !14
  %36 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN3Rcs17HardwareComponent35callControlLayerCallbackIfConnectedEv, i32 noundef 89) #2
  %37 = load ptr, ptr @stderr, align 8, !tbaa !14
  %38 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %37, ptr noundef nonnull @.str.4) #2
  %39 = load ptr, ptr @stderr, align 8, !tbaa !14
  %40 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef nonnull @.str.3) #2
  br label %41

41:                                               ; preds = %31, %34
  store i8 0, ptr %4, align 8, !tbaa !11
  br label %42

42:                                               ; preds = %26, %41, %22
  ret void
}

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { cold nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 8}
!6 = !{!"_ZTSN3Rcs17HardwareComponentE", !7, i64 8, !7, i64 16, !10, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!6, !10, i64 24}
!12 = !{i8 0, i8 2}
!13 = !{}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"int", !8, i64 0}
!17 = !{!6, !7, i64 16}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass