; LLVM IR from thekyria/elabtsaot2 :: emulator_hw/hardware_model/node.ll (ZN9elabtsaot4Node5resetEb)

; 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.elabtsaot::Node" = type { double, double, double, double, i8, i8, i8, i8, double, double, double, double, i8, i8, i8, i8, [4 x i8], %"class.elabtsaot::Potentiometer", %"class.elabtsaot::Potentiometer", %"class.elabtsaot::Potentiometer", %"class.elabtsaot::Potentiometer" }
%"class.elabtsaot::Potentiometer" = type <{ ptr, double, double, i32, [4 x i8], double, i32, i32, i8, i8, [6 x i8] }>

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN9elabtsaot4Node5resetEb(ptr noundef nonnull align 8 dereferenceable(304) %0, i1 noundef zeroext %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %6 = zext i1 %1 to i8
  store i8 %6, ptr %4, align 1, !tbaa !9
  %7 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !11
  %8 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 4
  store i8 0, ptr %8, align 8, !tbaa !13
  %9 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 5
  store i8 0, ptr %9, align 1, !tbaa !17
  %10 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 6
  store i8 0, ptr %10, align 2, !tbaa !18
  %11 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 7
  store i8 0, ptr %11, align 1, !tbaa !19
  %12 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 17
  %13 = load i8, ptr %4, align 1, !tbaa !9, !range !20, !noundef !21
  %14 = trunc i8 %13 to i1
  %15 = call noundef i32 @_ZN9elabtsaot13Potentiometer5resetEb(ptr noundef nonnull align 8 dereferenceable(50) %12, i1 noundef zeroext %14)
  %16 = load i32, ptr %5, align 4, !tbaa !11
  %17 = or i32 %16, %15
  store i32 %17, ptr %5, align 4, !tbaa !11
  %18 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 18
  %19 = load i8, ptr %4, align 1, !tbaa !9, !range !20, !noundef !21
  %20 = trunc i8 %19 to i1
  %21 = call noundef i32 @_ZN9elabtsaot13Potentiometer5resetEb(ptr noundef nonnull align 8 dereferenceable(50) %18, i1 noundef zeroext %20)
  %22 = load i32, ptr %5, align 4, !tbaa !11
  %23 = or i32 %22, %21
  store i32 %23, ptr %5, align 4, !tbaa !11
  %24 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 12
  store i8 0, ptr %24, align 8, !tbaa !22
  %25 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 13
  store i8 0, ptr %25, align 1, !tbaa !23
  %26 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 14
  store i8 0, ptr %26, align 2, !tbaa !24
  %27 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 15
  store i8 0, ptr %27, align 1, !tbaa !25
  %28 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 19
  %29 = load i8, ptr %4, align 1, !tbaa !9, !range !20, !noundef !21
  %30 = trunc i8 %29 to i1
  %31 = call noundef i32 @_ZN9elabtsaot13Potentiometer5resetEb(ptr noundef nonnull align 8 dereferenceable(50) %28, i1 noundef zeroext %30)
  %32 = load i32, ptr %5, align 4, !tbaa !11
  %33 = or i32 %32, %31
  store i32 %33, ptr %5, align 4, !tbaa !11
  %34 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 20
  %35 = load i8, ptr %4, align 1, !tbaa !9, !range !20, !noundef !21
  %36 = trunc i8 %35 to i1
  %37 = call noundef i32 @_ZN9elabtsaot13Potentiometer5resetEb(ptr noundef nonnull align 8 dereferenceable(50) %34, i1 noundef zeroext %36)
  %38 = load i32, ptr %5, align 4, !tbaa !11
  %39 = or i32 %38, %37
  store i32 %39, ptr %5, align 4, !tbaa !11
  %40 = load i8, ptr %4, align 1, !tbaa !9, !range !20, !noundef !21
  %41 = trunc i8 %40 to i1
  br i1 %41, label %42, label %51

42:                                               ; preds = %2
  %43 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 0
  store double 0.000000e+00, ptr %43, align 8, !tbaa !26
  %44 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 1
  store double 1.000000e+00, ptr %44, align 8, !tbaa !27
  %45 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 2
  store double 0.000000e+00, ptr %45, align 8, !tbaa !28
  %46 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 3
  store double 1.000000e+00, ptr %46, align 8, !tbaa !29
  %47 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 8
  store double 0.000000e+00, ptr %47, align 8, !tbaa !30
  %48 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 9
  store double 1.000000e+00, ptr %48, align 8, !tbaa !31
  %49 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 10
  store double 0.000000e+00, ptr %49, align 8, !tbaa !32
  %50 = getelementptr inbounds %"class.elabtsaot::Node", ptr %7, i32 0, i32 11
  store double 1.000000e+00, ptr %50, align 8, !tbaa !33
  br label %51

51:                                               ; preds = %42, %2
  %52 = load i32, ptr %5, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret i32 %52
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare noundef i32 @_ZN9elabtsaot13Potentiometer5resetEb(ptr noundef nonnull align 8 dereferenceable(50), i1 noundef zeroext) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 #3 = { 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, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !10, i64 32}
!14 = !{!"_ZTSN9elabtsaot4NodeE", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !10, i64 32, !10, i64 33, !10, i64 34, !10, i64 35, !15, i64 40, !15, i64 48, !15, i64 56, !15, i64 64, !10, i64 72, !10, i64 73, !10, i64 74, !10, i64 75, !16, i64 80, !16, i64 136, !16, i64 192, !16, i64 248}
!15 = !{!"double", !7, i64 0}
!16 = !{!"_ZTSN9elabtsaot13PotentiometerE", !15, i64 8, !15, i64 16, !12, i64 24, !15, i64 32, !12, i64 40, !12, i64 44, !10, i64 48, !10, i64 49}
!17 = !{!14, !10, i64 33}
!18 = !{!14, !10, i64 34}
!19 = !{!14, !10, i64 35}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!14, !10, i64 72}
!23 = !{!14, !10, i64 73}
!24 = !{!14, !10, i64 74}
!25 = !{!14, !10, i64 75}
!26 = !{!14, !15, i64 0}
!27 = !{!14, !15, i64 8}
!28 = !{!14, !15, i64 16}
!29 = !{!14, !15, i64 24}
!30 = !{!14, !15, i64 40}
!31 = !{!14, !15, i64 48}
!32 = !{!14, !15, i64 56}
!33 = !{!14, !15, i64 64}


; 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"

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN9elabtsaot4Node5resetEb(ptr noundef nonnull align 8 dereferenceable(304) %0, i1 noundef zeroext %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  %4 = getelementptr inbounds i8, ptr %0, i64 80
  store i32 0, ptr %3, align 8
  %5 = tail call noundef i32 @_ZN9elabtsaot13Potentiometer5resetEb(ptr noundef nonnull align 8 dereferenceable(50) %4, i1 noundef zeroext %1)
  %6 = getelementptr inbounds i8, ptr %0, i64 136
  %7 = tail call noundef i32 @_ZN9elabtsaot13Potentiometer5resetEb(ptr noundef nonnull align 8 dereferenceable(50) %6, i1 noundef zeroext %1)
  %8 = getelementptr inbounds i8, ptr %0, i64 72
  %9 = getelementptr inbounds i8, ptr %0, i64 192
  store i32 0, ptr %8, align 8
  %10 = tail call noundef i32 @_ZN9elabtsaot13Potentiometer5resetEb(ptr noundef nonnull align 8 dereferenceable(50) %9, i1 noundef zeroext %1)
  %11 = getelementptr inbounds i8, ptr %0, i64 248
  %12 = tail call noundef i32 @_ZN9elabtsaot13Potentiometer5resetEb(ptr noundef nonnull align 8 dereferenceable(50) %11, i1 noundef zeroext %1)
  br i1 %1, label %13, label %17

13:                                               ; preds = %2
  store <2 x double> <double 0.000000e+00, double 1.000000e+00>, ptr %0, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %0, i64 16
  store <2 x double> <double 0.000000e+00, double 1.000000e+00>, ptr %14, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %0, i64 40
  store <2 x double> <double 0.000000e+00, double 1.000000e+00>, ptr %15, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %0, i64 56
  store <2 x double> <double 0.000000e+00, double 1.000000e+00>, ptr %16, align 8, !tbaa !5
  br label %17

17:                                               ; preds = %13, %2
  %18 = or i32 %7, %5
  %19 = or i32 %18, %10
  %20 = or i32 %19, %12
  ret i32 %20
}

declare noundef i32 @_ZN9elabtsaot13Potentiometer5resetEb(ptr noundef nonnull align 8 dereferenceable(50), i1 noundef zeroext) 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 = { "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" }

!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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,ReassociatePass,SLPVectorizerPass,SROAPass,TailCallElimPass