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

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3Cpg8cpgClass7isAllSwEd(ptr noundef nonnull align 8 dereferenceable(248) %0, double noundef %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  %5 = alloca i8, align 1
  %6 = alloca double, align 8
  %7 = alloca i32, align 4
  %8 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !9
  %9 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #3
  %10 = call noundef zeroext i1 @_ZN3Cpg8cpgClass6isStopEv(ptr noundef nonnull align 8 dereferenceable(248) %9)
  %11 = xor i1 %10, true
  %12 = zext i1 %11 to i8
  store i8 %12, ptr %5, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %13 = load double, ptr %4, align 8, !tbaa !9
  %14 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %9, i32 0, i32 16
  %15 = load double, ptr %14, align 8, !tbaa !13
  %16 = fdiv double %13, %15
  store double %16, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !16
  br label %17

17:                                               ; preds = %81, %2
  %18 = load i32, ptr %7, align 4, !tbaa !16
  %19 = icmp ne i32 %18, 2
  br i1 %19, label %21, label %20

20:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %84

21:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %22 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %9, i32 0, i32 2
  %23 = load double, ptr %22, align 8, !tbaa !18
  %24 = load double, ptr %6, align 8, !tbaa !9
  %25 = fadd double %23, %24
  %26 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %9, i32 0, i32 17
  %27 = load i32, ptr %7, align 4, !tbaa !16
  %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 !9
  %31 = fsub double %25, %30
  %32 = fadd double %31, 1.000000e+00
  store double %32, ptr %8, align 8, !tbaa !9
  %33 = load double, ptr %8, align 8, !tbaa !9
  %34 = fptosi double %33 to i32
  %35 = sitofp i32 %34 to double
  %36 = load double, ptr %8, align 8, !tbaa !9
  %37 = fsub double %36, %35
  store double %37, ptr %8, align 8, !tbaa !9
  %38 = load double, ptr %8, align 8, !tbaa !9
  %39 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %9, i32 0, i32 18
  %40 = load i32, ptr %7, align 4, !tbaa !16
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [2 x double], ptr %39, i64 0, i64 %41
  %43 = load double, ptr %42, align 8, !tbaa !9
  %44 = fsub double 1.000000e+00, %43
  %45 = fcmp olt double %38, %44
  %46 = zext i1 %45 to i32
  %47 = load i8, ptr %5, align 1, !tbaa !11, !range !19, !noundef !20
  %48 = trunc i8 %47 to i1
  %49 = zext i1 %48 to i32
  %50 = and i32 %49, %46
  %51 = icmp ne i32 %50, 0
  %52 = zext i1 %51 to i8
  store i8 %52, ptr %5, align 1, !tbaa !11
  %53 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %9, i32 0, i32 14
  %54 = load i32, ptr %7, align 4, !tbaa !16
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [2 x i8], ptr %53, i64 0, i64 %55
  %57 = load i8, ptr %56, align 1, !tbaa !11, !range !19, !noundef !20
  %58 = trunc i8 %57 to i1
  %59 = zext i1 %58 to i32
  %60 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %9, i32 0, i32 2
  %61 = load double, ptr %60, align 8, !tbaa !18
  %62 = load double, ptr %6, align 8, !tbaa !9
  %63 = fadd double %61, %62
  %64 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %9, i32 0, i32 17
  %65 = load i32, ptr %7, align 4, !tbaa !16
  %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 !9
  %69 = fcmp olt double %63, %68
  %70 = zext i1 %69 to i32
  %71 = and i32 %59, %70
  %72 = icmp ne i32 %71, 0
  %73 = xor i1 %72, true
  %74 = zext i1 %73 to i32
  %75 = load i8, ptr %5, align 1, !tbaa !11, !range !19, !noundef !20
  %76 = trunc i8 %75 to i1
  %77 = zext i1 %76 to i32
  %78 = and i32 %77, %74
  %79 = icmp ne i32 %78, 0
  %80 = zext i1 %79 to i8
  store i8 %80, ptr %5, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %81

81:                                               ; preds = %21
  %82 = load i32, ptr %7, align 4, !tbaa !16
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %7, align 4, !tbaa !16
  br label %17, !llvm.loop !21

84:                                               ; preds = %20
  %85 = load i8, ptr %5, align 1, !tbaa !11, !range !19, !noundef !20
  %86 = trunc i8 %85 to i1
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #3
  ret i1 %86
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3Cpg8cpgClass6isStopEv(ptr noundef nonnull align 8 dereferenceable(248)) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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" }
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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !10, i64 168}
!14 = !{!"_ZTSN3Cpg8cpgClassE", !12, i64 0, !12, i64 1, !10, i64 8, !10, 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, !10, i64 160, !10, i64 168, !7, i64 176, !7, i64 192, !15, i64 208}
!15 = !{!"_ZTSN3Cpg8cpgClassUt_E", !10, i64 0, !7, i64 8, !7, i64 24}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!14, !10, i64 8}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


; 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 nounwind uwtable
define dso_local noundef zeroext i1 @_ZN3Cpg8cpgClass7isAllSwEd(ptr noundef nonnull align 8 dereferenceable(248) %0, double noundef %1) local_unnamed_addr #0 align 2 {
  %3 = tail call noundef zeroext i1 @_ZN3Cpg8cpgClass6isStopEv(ptr noundef nonnull align 8 dereferenceable(248) %0)
  %4 = xor i1 %3, true
  %5 = getelementptr inbounds i8, ptr %0, i64 168
  %6 = load double, ptr %5, align 8, !tbaa !5
  %7 = fdiv double %1, %6
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load double, ptr %8, align 8, !tbaa !12
  %10 = fadd double %7, %9
  %11 = getelementptr inbounds i8, ptr %0, i64 176
  %12 = getelementptr inbounds i8, ptr %0, i64 192
  %13 = getelementptr inbounds i8, ptr %0, i64 155
  %14 = load <2 x double>, ptr %11, align 8, !tbaa !13
  %15 = insertelement <2 x double> poison, double %10, i64 0
  %16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> zeroinitializer
  %17 = fsub <2 x double> %16, %14
  %18 = fadd <2 x double> %17, <double 1.000000e+00, double 1.000000e+00>
  %19 = fptosi <2 x double> %18 to <2 x i32>
  %20 = sitofp <2 x i32> %19 to <2 x double>
  %21 = fsub <2 x double> %18, %20
  %22 = load <2 x double>, ptr %12, align 8, !tbaa !13
  %23 = fsub <2 x double> <double 1.000000e+00, double 1.000000e+00>, %22
  %24 = fcmp olt <2 x double> %21, %23
  %25 = load <2 x i8>, ptr %13, align 1, !tbaa !14
  %26 = fcmp uge <2 x double> %16, %14
  %27 = icmp eq <2 x i8> %25, zeroinitializer
  %28 = or <2 x i1> %26, %27
  %29 = and <2 x i1> %28, %24
  %30 = extractelement <2 x i1> %29, i64 0
  %31 = and i1 %30, %4
  %32 = extractelement <2 x i1> %29, i64 1
  %33 = and i1 %31, %32
  ret i1 %33
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3Cpg8cpgClass6isStopEv(ptr noundef nonnull align 8 dereferenceable(248)) local_unnamed_addr #0 align 2

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, !10, i64 168}
!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 = !{!6, !10, i64 8}
!13 = !{!10, !10, i64 0}
!14 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass