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

; 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 @_ZN3Cpg8cpgClass5calSwEi(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 14
  %8 = load i32, ptr %5, align 4, !tbaa !9
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds [2 x i8], ptr %7, i64 0, i64 %9
  store i8 0, ptr %10, align 1, !tbaa !11
  %11 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 2
  %12 = load double, ptr %11, align 8, !tbaa !13
  %13 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 17
  %14 = load i32, ptr %5, align 4, !tbaa !9
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [2 x double], ptr %13, i64 0, i64 %15
  %17 = load double, ptr %16, align 8, !tbaa !17
  %18 = fsub double %12, %17
  %19 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 4
  %20 = load i32, ptr %5, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [2 x double], ptr %19, i64 0, i64 %21
  store double %18, ptr %22, align 8, !tbaa !17
  %23 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 4
  %24 = load i32, ptr %5, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [2 x double], ptr %23, i64 0, i64 %25
  %27 = load double, ptr %26, align 8, !tbaa !17
  %28 = fcmp olt double %27, 0.000000e+00
  br i1 %28, label %29, label %36

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

36:                                               ; preds = %29, %2
  %37 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 18
  %38 = load i32, ptr %5, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [2 x double], ptr %37, i64 0, i64 %39
  %41 = load double, ptr %40, align 8, !tbaa !17
  %42 = fsub double 1.000000e+00, %41
  %43 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 4
  %44 = load i32, ptr %5, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [2 x double], ptr %43, i64 0, i64 %45
  %47 = load double, ptr %46, align 8, !tbaa !17
  %48 = fdiv double %47, %42
  store double %48, ptr %46, align 8, !tbaa !17
  %49 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 4
  %50 = load i32, ptr %5, align 4, !tbaa !9
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [2 x double], ptr %49, i64 0, i64 %51
  %53 = load double, ptr %52, align 8, !tbaa !17
  %54 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 10
  %55 = load i32, ptr %5, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [2 x double], ptr %54, i64 0, i64 %56
  %58 = load double, ptr %57, align 8, !tbaa !17
  %59 = fmul double %53, %58
  %60 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 7
  %61 = load i32, ptr %5, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [2 x double], ptr %60, i64 0, i64 %62
  store double %59, ptr %63, align 8, !tbaa !17
  %64 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 7
  %65 = load i32, ptr %5, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [2 x double], ptr %64, i64 0, i64 %66
  %68 = load double, ptr %67, align 8, !tbaa !17
  %69 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 8
  %70 = load i32, ptr %5, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [2 x double], ptr %69, i64 0, i64 %71
  store double %68, ptr %72, align 8, !tbaa !17
  %73 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 4
  %74 = load i32, ptr %5, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [2 x double], ptr %73, i64 0, i64 %75
  %77 = load double, ptr %76, align 8, !tbaa !17
  %78 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 5
  %79 = load i32, ptr %5, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [2 x double], ptr %78, i64 0, i64 %80
  store double %77, ptr %81, align 8, !tbaa !17
  %82 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 4
  %83 = load i32, ptr %5, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [2 x double], ptr %82, i64 0, i64 %84
  %86 = load double, ptr %85, align 8, !tbaa !17
  %87 = fcmp ogt double %86, 1.000000e+00
  br i1 %87, label %95, label %88

88:                                               ; preds = %36
  %89 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 18
  %90 = load i32, ptr %5, align 4, !tbaa !9
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [2 x double], ptr %89, i64 0, i64 %91
  %93 = load double, ptr %92, align 8, !tbaa !17
  %94 = fcmp ogt double %93, 0x3FEFAE147AE147AE
  br i1 %94, label %95, label %108

95:                                               ; preds = %88, %36
  %96 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 4
  %97 = load i32, ptr %5, align 4, !tbaa !9
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [2 x double], ptr %96, i64 0, i64 %98
  store double 0.000000e+00, ptr %99, align 8, !tbaa !17
  %100 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 7
  %101 = load i32, ptr %5, align 4, !tbaa !9
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [2 x double], ptr %100, i64 0, i64 %102
  store double 0.000000e+00, ptr %103, align 8, !tbaa !17
  %104 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %6, i32 0, i32 12
  %105 = load i32, ptr %5, align 4, !tbaa !9
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [2 x i8], ptr %104, i64 0, i64 %106
  store i8 0, ptr %107, align 1, !tbaa !11
  store i1 true, ptr %3, align 1
  br label %109

108:                                              ; preds = %88
  store i1 false, ptr %3, align 1
  br label %109

109:                                              ; preds = %108, %95
  %110 = load i1, ptr %3, align 1
  ret i1 %110
}

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, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !15, i64 8}
!14 = !{!"_ZTSN3Cpg8cpgClassE", !12, i64 0, !12, i64 1, !15, i64 8, !15, 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, !12, i64 154, !7, i64 155, !15, i64 160, !15, i64 168, !7, i64 176, !7, i64 192, !16, i64 208}
!15 = !{!"double", !7, i64 0}
!16 = !{!"_ZTSN3Cpg8cpgClassUt_E", !15, i64 0, !7, i64 8, !7, i64 24}
!17 = !{!15, !15, i64 0}


; 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 @_ZN3Cpg8cpgClass5calSwEi(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 155
  %4 = sext i32 %1 to i64
  %5 = getelementptr inbounds [2 x i8], ptr %3, i64 0, i64 %4
  store i8 0, ptr %5, align 1, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load double, ptr %6, align 8, !tbaa !9
  %8 = getelementptr inbounds i8, ptr %0, i64 176
  %9 = getelementptr inbounds [2 x double], ptr %8, i64 0, i64 %4
  %10 = load double, ptr %9, align 8, !tbaa !13
  %11 = fsub double %7, %10
  %12 = getelementptr inbounds i8, ptr %0, i64 24
  %13 = getelementptr inbounds [2 x double], ptr %12, i64 0, i64 %4
  %14 = fcmp olt double %11, 0.000000e+00
  %15 = fadd double %11, 1.000000e+00
  %storemerge = select i1 %14, double %15, double %11
  %16 = getelementptr inbounds i8, ptr %0, i64 192
  %17 = getelementptr inbounds [2 x double], ptr %16, i64 0, i64 %4
  %18 = load double, ptr %17, align 8, !tbaa !13
  %19 = fsub double 1.000000e+00, %18
  %20 = fdiv double %storemerge, %19
  store double %20, ptr %13, align 8, !tbaa !13
  %21 = getelementptr inbounds i8, ptr %0, i64 120
  %22 = getelementptr inbounds [2 x double], ptr %21, i64 0, i64 %4
  %23 = load double, ptr %22, align 8, !tbaa !13
  %24 = fmul double %20, %23
  %25 = getelementptr inbounds i8, ptr %0, i64 72
  %26 = getelementptr inbounds [2 x double], ptr %25, i64 0, i64 %4
  store double %24, ptr %26, align 8, !tbaa !13
  %27 = getelementptr inbounds i8, ptr %0, i64 88
  %28 = getelementptr inbounds [2 x double], ptr %27, i64 0, i64 %4
  store double %24, ptr %28, align 8, !tbaa !13
  %29 = getelementptr inbounds i8, ptr %0, i64 40
  %30 = getelementptr inbounds [2 x double], ptr %29, i64 0, i64 %4
  store double %20, ptr %30, align 8, !tbaa !13
  %31 = fcmp ogt double %20, 1.000000e+00
  %32 = fcmp ogt double %18, 0x3FEFAE147AE147AE
  %or.cond = or i1 %32, %31
  br i1 %or.cond, label %33, label %36

33:                                               ; preds = %2
  store double 0.000000e+00, ptr %13, align 8, !tbaa !13
  store double 0.000000e+00, ptr %26, align 8, !tbaa !13
  %34 = getelementptr inbounds i8, ptr %0, i64 152
  %35 = getelementptr inbounds [2 x i8], ptr %34, i64 0, i64 %4
  store i8 0, ptr %35, align 1, !tbaa !5
  br label %36

36:                                               ; preds = %2, %33
  ret i1 %or.cond
}

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, !6, i64 0}
!6 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 8}
!10 = !{!"_ZTSN3Cpg8cpgClassE", !6, i64 0, !6, i64 1, !11, i64 8, !11, 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, !6, i64 154, !7, i64 155, !11, i64 160, !11, i64 168, !7, i64 176, !7, i64 192, !12, i64 208}
!11 = !{!"double", !7, i64 0}
!12 = !{!"_ZTSN3Cpg8cpgClassUt_E", !11, i64 0, !7, i64 8, !7, i64 24}
!13 = !{!11, !11, i64 0}


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