; LLVM IR from tryingfly/nabo :: nabo_core/src/robot/cpg.ll (ZN3Cpg8cpgClass5calStEi)

; 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.Cpg::cpgClass" = type { i8, i8, double, double, [2 x double], [2 x double], [2 x double], [2 x double], [2 x double], [2 x double], [2 x double], [2 x double], [2 x i8], i8, [2 x i8], double, double, [2 x double], [2 x double], %struct.anon }
%struct.anon = type { double, [2 x double], [2 x double] }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN3Cpg8cpgClass5calStEi(ptr noundef nonnull align 8 dereferenceable(248) %0, i32 noundef %1) #0 align 2 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %6 = load ptr, ptr %4, align 8
  %7 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 2
  %8 = load double, ptr %7, align 8, !tbaa !11
  %9 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 17
  %10 = load i32, ptr %5, align 4, !tbaa !9
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds [2 x double], ptr %9, i64 0, i64 %11
  %13 = load double, ptr %12, align 8, !tbaa !16
  %14 = fsub double %8, %13
  %15 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 18
  %16 = load i32, ptr %5, align 4, !tbaa !9
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [2 x double], ptr %15, i64 0, i64 %17
  %19 = load double, ptr %18, align 8, !tbaa !16
  %20 = fadd double %14, %19
  %21 = fsub double %20, 1.000000e+00
  %22 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 6
  %23 = load i32, ptr %5, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [2 x double], ptr %22, i64 0, i64 %24
  store double %21, ptr %25, align 8, !tbaa !16
  %26 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 6
  %27 = load i32, ptr %5, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [2 x double], ptr %26, i64 0, i64 %28
  %30 = load double, ptr %29, align 8, !tbaa !16
  %31 = fcmp olt double %30, 0.000000e+00
  br i1 %31, label %32, label %39

32:                                               ; preds = %2
  %33 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 6
  %34 = load i32, ptr %5, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [2 x double], ptr %33, i64 0, i64 %35
  %37 = load double, ptr %36, align 8, !tbaa !16
  %38 = fadd double %37, 1.000000e+00
  store double %38, ptr %36, align 8, !tbaa !16
  br label %39

39:                                               ; preds = %32, %2
  %40 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 6
  %41 = load i32, ptr %5, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [2 x double], ptr %40, i64 0, i64 %42
  %44 = load double, ptr %43, align 8, !tbaa !16
  %45 = fcmp olt double %44, 0.000000e+00
  br i1 %45, label %46, label %51

46:                                               ; preds = %39
  %47 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 6
  %48 = load i32, ptr %5, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [2 x double], ptr %47, i64 0, i64 %49
  store double 0.000000e+00, ptr %50, align 8, !tbaa !16
  br label %51

51:                                               ; preds = %46, %39
  %52 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 18
  %53 = load i32, ptr %5, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [2 x double], ptr %52, i64 0, i64 %54
  %56 = load double, ptr %55, align 8, !tbaa !16
  %57 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 6
  %58 = load i32, ptr %5, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [2 x double], ptr %57, i64 0, i64 %59
  %61 = load double, ptr %60, align 8, !tbaa !16
  %62 = fdiv double %61, %56
  store double %62, ptr %60, align 8, !tbaa !16
  %63 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 6
  %64 = load i32, ptr %5, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [2 x double], ptr %63, i64 0, i64 %65
  %67 = load double, ptr %66, align 8, !tbaa !16
  %68 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 11
  %69 = load i32, ptr %5, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [2 x double], ptr %68, i64 0, i64 %70
  %72 = load double, ptr %71, align 8, !tbaa !16
  %73 = fmul double %67, %72
  %74 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 9
  %75 = load i32, ptr %5, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [2 x double], ptr %74, i64 0, i64 %76
  store double %73, ptr %77, align 8, !tbaa !16
  %78 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 2
  %79 = load double, ptr %78, align 8, !tbaa !11
  %80 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 17
  %81 = load i32, ptr %5, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [2 x double], ptr %80, i64 0, i64 %82
  %84 = load double, ptr %83, align 8, !tbaa !16
  %85 = fsub double %79, %84
  %86 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 5
  %87 = load i32, ptr %5, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [2 x double], ptr %86, i64 0, i64 %88
  store double %85, ptr %89, align 8, !tbaa !16
  %90 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 14
  %91 = load i32, ptr %5, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [2 x i8], ptr %90, i64 0, i64 %92
  %94 = load i8, ptr %93, align 1, !tbaa !17, !range !18, !noundef !19
  %95 = trunc i8 %94 to i1
  br i1 %95, label %96, label %101

96:                                               ; preds = %51
  %97 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 5
  %98 = load i32, ptr %5, align 4, !tbaa !9
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [2 x double], ptr %97, i64 0, i64 %99
  store double 0.000000e+00, ptr %100, align 8, !tbaa !16
  br label %101

101:                                              ; preds = %96, %51
  %102 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 5
  %103 = load i32, ptr %5, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [2 x double], ptr %102, i64 0, i64 %104
  %106 = load double, ptr %105, align 8, !tbaa !16
  %107 = fcmp olt double %106, 0.000000e+00
  br i1 %107, label %108, label %115

108:                                              ; preds = %101
  %109 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 5
  %110 = load i32, ptr %5, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [2 x double], ptr %109, i64 0, i64 %111
  %113 = load double, ptr %112, align 8, !tbaa !16
  %114 = fadd double %113, 1.000000e+00
  store double %114, ptr %112, align 8, !tbaa !16
  br label %115

115:                                              ; preds = %108, %101
  %116 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 18
  %117 = load i32, ptr %5, align 4, !tbaa !9
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [2 x double], ptr %116, i64 0, i64 %118
  %120 = load double, ptr %119, align 8, !tbaa !16
  %121 = fsub double 1.000000e+00, %120
  %122 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 5
  %123 = load i32, ptr %5, align 4, !tbaa !9
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [2 x double], ptr %122, i64 0, i64 %124
  %126 = load double, ptr %125, align 8, !tbaa !16
  %127 = fdiv double %126, %121
  store double %127, ptr %125, align 8, !tbaa !16
  %128 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 5
  %129 = load i32, ptr %5, align 4, !tbaa !9
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [2 x double], ptr %128, i64 0, i64 %130
  %132 = load double, ptr %131, align 8, !tbaa !16
  %133 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 10
  %134 = load i32, ptr %5, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [2 x double], ptr %133, i64 0, i64 %135
  %137 = load double, ptr %136, align 8, !tbaa !16
  %138 = fmul double %132, %137
  %139 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 8
  %140 = load i32, ptr %5, align 4, !tbaa !9
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [2 x double], ptr %139, i64 0, i64 %141
  store double %138, ptr %142, align 8, !tbaa !16
  %143 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 6
  %144 = load i32, ptr %5, align 4, !tbaa !9
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [2 x double], ptr %143, i64 0, i64 %145
  %147 = load double, ptr %146, align 8, !tbaa !16
  %148 = fcmp oge double %147, 1.000000e+00
  br i1 %148, label %149, label %162

149:                                              ; preds = %115
  %150 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 6
  %151 = load i32, ptr %5, align 4, !tbaa !9
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [2 x double], ptr %150, i64 0, i64 %152
  store double 0.000000e+00, ptr %153, align 8, !tbaa !16
  %154 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 9
  %155 = load i32, ptr %5, align 4, !tbaa !9
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [2 x double], ptr %154, i64 0, i64 %156
  store double 0.000000e+00, ptr %157, align 8, !tbaa !16
  %158 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 12
  %159 = load i32, ptr %5, align 4, !tbaa !9
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [2 x i8], ptr %158, i64 0, i64 %160
  store i8 1, ptr %161, align 1, !tbaa !17
  store i1 true, ptr %3, align 1
  br label %163

162:                                              ; preds = %115
  store i1 false, ptr %3, align 1
  br label %163

163:                                              ; preds = %162, %149
  %164 = load i1, ptr %3, align 1
  ret i1 %164
}

attributes #0 = { mustprogress nounwind 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" }

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !14, i64 8}
!12 = !{!"_ZTSN3Cpg8cpgClassE", !13, i64 0, !13, i64 1, !14, i64 8, !14, i64 16, !7, i64 24, !7, i64 40, !7, i64 56, !7, i64 72, !7, i64 88, !7, i64 104, !7, i64 120, !7, i64 136, !7, i64 152, !13, i64 154, !7, i64 155, !14, i64 160, !14, i64 168, !7, i64 176, !7, i64 192, !15, i64 208}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!"_ZTSN3Cpg8cpgClassUt_E", !14, i64 0, !7, i64 8, !7, i64 24}
!16 = !{!14, !14, i64 0}
!17 = !{!13, !13, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}


; 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 nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local noundef zeroext i1 @_ZN3Cpg8cpgClass5calStEi(ptr nocapture noundef nonnull align 8 dereferenceable(248) %0, i32 noundef %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load double, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 176
  %6 = sext i32 %1 to i64
  %7 = getelementptr inbounds [2 x double], ptr %5, i64 0, i64 %6
  %8 = load double, ptr %7, align 8, !tbaa !12
  %9 = fsub double %4, %8
  %10 = getelementptr inbounds i8, ptr %0, i64 192
  %11 = getelementptr inbounds [2 x double], ptr %10, i64 0, i64 %6
  %12 = load double, ptr %11, align 8, !tbaa !12
  %13 = fadd double %9, %12
  %14 = fadd double %13, -1.000000e+00
  %15 = getelementptr inbounds i8, ptr %0, i64 56
  %16 = getelementptr inbounds [2 x double], ptr %15, i64 0, i64 %6
  %17 = fcmp olt double %14, 0.000000e+00
  %18 = fadd double %14, 1.000000e+00
  %storemerge = select i1 %17, double %18, double %14
  %19 = fcmp olt double %storemerge, 0.000000e+00
  %storemerge30 = select i1 %19, double 0.000000e+00, double %storemerge
  %20 = fdiv double %storemerge30, %12
  store double %20, ptr %16, align 8, !tbaa !12
  %21 = getelementptr inbounds i8, ptr %0, i64 136
  %22 = getelementptr inbounds [2 x double], ptr %21, i64 0, i64 %6
  %23 = load double, ptr %22, align 8, !tbaa !12
  %24 = fmul double %23, %20
  %25 = getelementptr inbounds i8, ptr %0, i64 104
  %26 = getelementptr inbounds [2 x double], ptr %25, i64 0, i64 %6
  store double %24, ptr %26, align 8, !tbaa !12
  %27 = load double, ptr %3, align 8, !tbaa !5
  %28 = fsub double %27, %8
  %29 = getelementptr inbounds i8, ptr %0, i64 40
  %30 = getelementptr inbounds [2 x double], ptr %29, i64 0, i64 %6
  %31 = getelementptr inbounds i8, ptr %0, i64 155
  %32 = getelementptr inbounds [2 x i8], ptr %31, i64 0, i64 %6
  %33 = load i8, ptr %32, align 1, !tbaa !13, !range !14, !noundef !15
  %34 = trunc nuw i8 %33 to i1
  %spec.store.select = select i1 %34, double 0.000000e+00, double %28
  %35 = fcmp olt double %spec.store.select, 0.000000e+00
  %36 = fadd double %spec.store.select, 1.000000e+00
  %storemerge31 = select i1 %35, double %36, double %spec.store.select
  %37 = fsub double 1.000000e+00, %12
  %38 = fdiv double %storemerge31, %37
  store double %38, ptr %30, align 8, !tbaa !12
  %39 = getelementptr inbounds i8, ptr %0, i64 120
  %40 = getelementptr inbounds [2 x double], ptr %39, i64 0, i64 %6
  %41 = load double, ptr %40, align 8, !tbaa !12
  %42 = fmul double %41, %38
  %43 = getelementptr inbounds i8, ptr %0, i64 88
  %44 = getelementptr inbounds [2 x double], ptr %43, i64 0, i64 %6
  store double %42, ptr %44, align 8, !tbaa !12
  %45 = fcmp oge double %20, 1.000000e+00
  br i1 %45, label %46, label %49

46:                                               ; preds = %2
  store double 0.000000e+00, ptr %16, align 8, !tbaa !12
  store double 0.000000e+00, ptr %26, align 8, !tbaa !12
  %47 = getelementptr inbounds i8, ptr %0, i64 152
  %48 = getelementptr inbounds [2 x i8], ptr %47, i64 0, i64 %6
  store i8 1, ptr %48, align 1, !tbaa !13
  br label %49

49:                                               ; preds = %2, %46
  ret i1 %45
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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" }

!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, !10, i64 8}
!6 = !{!"_ZTSN3Cpg8cpgClassE", !7, i64 0, !7, i64 1, !10, i64 8, !10, i64 16, !8, i64 24, !8, i64 40, !8, i64 56, !8, i64 72, !8, i64 88, !8, i64 104, !8, i64 120, !8, i64 136, !8, i64 152, !7, i64 154, !8, i64 155, !10, i64 160, !10, i64 168, !8, i64 176, !8, i64 192, !11, i64 208}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"_ZTSN3Cpg8cpgClassUt_E", !10, i64 0, !8, i64 8, !8, i64 24}
!12 = !{!10, !10, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass