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

; 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 nounwind uwtable
define dso_local void @_ZN3Cpg8cpgClass10isFutureStEdPb(ptr noundef nonnull align 8 dereferenceable(248) %0, double noundef %1, ptr noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca i32, align 4
  %9 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  %11 = load double, ptr %5, align 8, !tbaa !9
  %12 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %10, i32 0, i32 16
  %13 = load double, ptr %12, align 8, !tbaa !11
  %14 = fdiv double %11, %13
  store double %14, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #2
  store i32 0, ptr %8, align 4, !tbaa !15
  br label %15

15:                                               ; preds = %104, %3
  %16 = load i32, ptr %8, align 4, !tbaa !15
  %17 = icmp ne i32 %16, 2
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #2
  br label %107

19:                                               ; preds = %15
  %20 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %10, i32 0, i32 0
  %21 = load i8, ptr %20, align 8, !tbaa !17, !range !18, !noundef !19
  %22 = trunc i8 %21 to i1
  %23 = zext i1 %22 to i32
  %24 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %10, i32 0, i32 12
  %25 = load i32, ptr %8, align 4, !tbaa !15
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [2 x i8], ptr %24, i64 0, i64 %26
  %28 = load i8, ptr %27, align 1, !tbaa !20, !range !18, !noundef !19
  %29 = trunc i8 %28 to i1
  %30 = xor i1 %29, true
  %31 = zext i1 %30 to i32
  %32 = and i32 %23, %31
  %33 = icmp ne i32 %32, 0
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = load i32, ptr %8, align 4, !tbaa !15
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds i8, ptr %34, i64 %36
  %38 = zext i1 %33 to i8
  store i8 %38, ptr %37, align 1, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  %39 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %10, i32 0, i32 2
  %40 = load double, ptr %39, align 8, !tbaa !21
  %41 = load double, ptr %7, align 8, !tbaa !9
  %42 = fadd double %40, %41
  %43 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %10, i32 0, i32 17
  %44 = load i32, ptr %8, align 4, !tbaa !15
  %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 !9
  %48 = fsub double %42, %47
  %49 = fadd double %48, 1.000000e+00
  store double %49, ptr %9, align 8, !tbaa !9
  %50 = load double, ptr %9, align 8, !tbaa !9
  %51 = fptosi double %50 to i32
  %52 = sitofp i32 %51 to double
  %53 = load double, ptr %9, align 8, !tbaa !9
  %54 = fsub double %53, %52
  store double %54, ptr %9, align 8, !tbaa !9
  %55 = load double, ptr %9, align 8, !tbaa !9
  %56 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %10, i32 0, i32 18
  %57 = load i32, ptr %8, align 4, !tbaa !15
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [2 x double], ptr %56, i64 0, i64 %58
  %60 = load double, ptr %59, align 8, !tbaa !9
  %61 = fsub double 1.000000e+00, %60
  %62 = fcmp olt double %55, %61
  %63 = xor i1 %62, true
  %64 = zext i1 %63 to i32
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = load i32, ptr %8, align 4, !tbaa !15
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds i8, ptr %65, i64 %67
  %69 = load i8, ptr %68, align 1, !tbaa !20, !range !18, !noundef !19
  %70 = trunc i8 %69 to i1
  %71 = zext i1 %70 to i32
  %72 = or i32 %71, %64
  %73 = icmp ne i32 %72, 0
  %74 = zext i1 %73 to i8
  store i8 %74, ptr %68, align 1, !tbaa !20
  %75 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %10, i32 0, i32 14
  %76 = load i32, ptr %8, align 4, !tbaa !15
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [2 x i8], ptr %75, i64 0, i64 %77
  %79 = load i8, ptr %78, align 1, !tbaa !20, !range !18, !noundef !19
  %80 = trunc i8 %79 to i1
  %81 = zext i1 %80 to i32
  %82 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %10, i32 0, i32 2
  %83 = load double, ptr %82, align 8, !tbaa !21
  %84 = load double, ptr %7, align 8, !tbaa !9
  %85 = fadd double %83, %84
  %86 = getelementptr inbounds %"class.Cpg::cpgClass", ptr %10, i32 0, i32 17
  %87 = load i32, ptr %8, align 4, !tbaa !15
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [2 x double], ptr %86, i64 0, i64 %88
  %90 = load double, ptr %89, align 8, !tbaa !9
  %91 = fcmp olt double %85, %90
  %92 = zext i1 %91 to i32
  %93 = and i32 %81, %92
  %94 = load ptr, ptr %6, align 8, !tbaa !5
  %95 = load i32, ptr %8, align 4, !tbaa !15
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds i8, ptr %94, i64 %96
  %98 = load i8, ptr %97, align 1, !tbaa !20, !range !18, !noundef !19
  %99 = trunc i8 %98 to i1
  %100 = zext i1 %99 to i32
  %101 = or i32 %100, %93
  %102 = icmp ne i32 %101, 0
  %103 = zext i1 %102 to i8
  store i8 %103, ptr %97, align 1, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  br label %104

104:                                              ; preds = %19
  %105 = load i32, ptr %8, align 4, !tbaa !15
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %8, align 4, !tbaa !15
  br label %15, !llvm.loop !22

107:                                              ; preds = %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !10, i64 168}
!12 = !{!"_ZTSN3Cpg8cpgClassE", !13, i64 0, !13, 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, !13, i64 154, !7, i64 155, !10, i64 160, !10, i64 168, !7, i64 176, !7, i64 192, !14, i64 208}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSN3Cpg8cpgClassUt_E", !10, i64 0, !7, i64 8, !7, i64 24}
!15 = !{!16, !16, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!12, !13, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!13, !13, i64 0}
!21 = !{!12, !10, i64 8}
!22 = distinct !{!22, !23}
!23 = !{!"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 nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @_ZN3Cpg8cpgClass10isFutureStEdPb(ptr nocapture noundef nonnull readonly align 8 dereferenceable(248) %0, double noundef %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #0 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 168
  %5 = load double, ptr %4, align 8, !tbaa !5
  %6 = fdiv double %1, %5
  %7 = getelementptr inbounds i8, ptr %0, i64 152
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load double, ptr %8, align 8, !tbaa !12
  %10 = fadd double %6, %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 i8, ptr %0, align 8, !tbaa !13, !range !14, !noundef !15
  %15 = load i8, ptr %7, align 8, !tbaa !16, !range !14, !noundef !15
  %16 = xor i8 %15, -1
  %17 = and i8 %14, %16
  %18 = getelementptr inbounds i8, ptr %0, i64 153
  %19 = getelementptr inbounds i8, ptr %2, i64 1
  %20 = load <2 x double>, ptr %11, align 8, !tbaa !17
  %21 = insertelement <2 x double> poison, double %10, i64 0
  %22 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
  %23 = fsub <2 x double> %22, %20
  %24 = fadd <2 x double> %23, <double 1.000000e+00, double 1.000000e+00>
  %25 = fptosi <2 x double> %24 to <2 x i32>
  %26 = sitofp <2 x i32> %25 to <2 x double>
  %27 = fsub <2 x double> %24, %26
  %28 = load <2 x double>, ptr %12, align 8, !tbaa !17
  %29 = fsub <2 x double> <double 1.000000e+00, double 1.000000e+00>, %28
  %30 = fcmp uge <2 x double> %27, %29
  %31 = extractelement <2 x i1> %30, i64 0
  %32 = zext i1 %31 to i8
  %33 = or i8 %17, %32
  store i8 %33, ptr %2, align 1, !tbaa !16
  %34 = load i8, ptr %13, align 1, !tbaa !16, !range !14, !noundef !15
  %35 = extractelement <2 x double> %20, i64 0
  %36 = fcmp olt double %10, %35
  %37 = select i1 %36, i8 %34, i8 0
  %38 = or i8 %33, %37
  store i8 %38, ptr %2, align 1, !tbaa !16
  %39 = load i8, ptr %0, align 8, !tbaa !13, !range !14, !noundef !15
  %40 = load i8, ptr %18, align 1, !tbaa !16, !range !14, !noundef !15
  %41 = xor i8 %40, -1
  %42 = and i8 %39, %41
  %43 = extractelement <2 x i1> %30, i64 1
  %44 = zext i1 %43 to i8
  %45 = or i8 %42, %44
  store i8 %45, ptr %19, align 1, !tbaa !16
  %46 = getelementptr inbounds i8, ptr %0, i64 156
  %47 = load i8, ptr %46, align 4, !tbaa !16, !range !14, !noundef !15
  %48 = extractelement <2 x double> %20, i64 1
  %49 = fcmp olt double %10, %48
  %50 = select i1 %49, i8 %47, i8 0
  %51 = or i8 %45, %50
  store i8 %51, ptr %19, align 1, !tbaa !16
  ret void
}

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 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 = !{!6, !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!7, !7, i64 0}
!17 = !{!10, !10, i64 0}


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