; LLVM IR from buresjan/optim_lbm :: nomad/src/Eval/EvalPoint.ll (ZNK9NOMAD_4_39EvalPointeqERKS0_)

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

; 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
declare dso_local noundef ptr @_ZNK9NOMAD_4_39EvalPoint7getEvalENS_8EvalTypeE(ptr noundef nonnull align 8 dereferenceable(160), i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK9NOMAD_4_39EvalPointeqERKS0_(ptr noundef nonnull align 8 dereferenceable(160) %0, ptr noundef nonnull align 8 dereferenceable(160) %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %10 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #4
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = call noundef zeroext i1 @_ZNK9NOMAD_4_313ArrayOfDoubleeqERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %11)
  %13 = zext i1 %12 to i8
  store i8 %13, ptr %5, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store i64 0, ptr %6, align 8, !tbaa !11
  br label %14

14:                                               ; preds = %55, %2
  %15 = load i8, ptr %5, align 1, !tbaa !9, !range !13, !noundef !14
  %16 = trunc i8 %15 to i1
  br i1 %16, label %17, label %20

17:                                               ; preds = %14
  %18 = load i64, ptr %6, align 8, !tbaa !11
  %19 = icmp ult i64 %18, 3
  br label %20

20:                                               ; preds = %17, %14
  %21 = phi i1 [ false, %14 ], [ %19, %17 ]
  br i1 %21, label %23, label %22

22:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %58

23:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %24 = load i64, ptr %6, align 8, !tbaa !11
  %25 = trunc i64 %24 to i32
  store i32 %25, ptr %7, align 4, !tbaa !15
  %26 = load i8, ptr %5, align 1, !tbaa !9, !range !13, !noundef !14
  %27 = trunc i8 %26 to i1
  br i1 %27, label %28, label %54

28:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %29 = load i32, ptr %7, align 4, !tbaa !15
  %30 = call noundef ptr @_ZNK9NOMAD_4_39EvalPoint7getEvalENS_8EvalTypeE(ptr noundef nonnull align 8 dereferenceable(160) %10, i32 noundef %29)
  store ptr %30, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = load i32, ptr %7, align 4, !tbaa !15
  %33 = call noundef ptr @_ZNK9NOMAD_4_39EvalPoint7getEvalENS_8EvalTypeE(ptr noundef nonnull align 8 dereferenceable(160) %31, i32 noundef %32)
  store ptr %33, ptr %9, align 8, !tbaa !5
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = icmp eq ptr null, %34
  br i1 %35, label %36, label %40

36:                                               ; preds = %28
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = icmp eq ptr null, %37
  br i1 %38, label %39, label %40

39:                                               ; preds = %36
  store i8 1, ptr %5, align 1, !tbaa !9
  br label %53

40:                                               ; preds = %36, %28
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = icmp eq ptr null, %41
  br i1 %42, label %46, label %43

43:                                               ; preds = %40
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = icmp eq ptr null, %44
  br i1 %45, label %46, label %47

46:                                               ; preds = %43, %40
  store i8 0, ptr %5, align 1, !tbaa !9
  br label %52

47:                                               ; preds = %43
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = call noundef zeroext i1 @_ZNK9NOMAD_4_34EvaleqERKS0_(ptr noundef nonnull align 8 dereferenceable(105) %48, ptr noundef nonnull align 8 dereferenceable(105) %49)
  %51 = zext i1 %50 to i8
  store i8 %51, ptr %5, align 1, !tbaa !9
  br label %52

52:                                               ; preds = %47, %46
  br label %53

53:                                               ; preds = %52, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %54

54:                                               ; preds = %53, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %55

55:                                               ; preds = %54
  %56 = load i64, ptr %6, align 8, !tbaa !11
  %57 = add i64 %56, 1
  store i64 %57, ptr %6, align 8, !tbaa !11
  br label %14, !llvm.loop !17

58:                                               ; preds = %22
  %59 = load i8, ptr %5, align 1, !tbaa !9, !range !13, !noundef !14
  %60 = trunc i8 %59 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #4
  ret i1 %60
}

declare noundef zeroext i1 @_ZNK9NOMAD_4_313ArrayOfDoubleeqERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #3

declare noundef zeroext i1 @_ZNK9NOMAD_4_34EvaleqERKS0_(ptr noundef nonnull align 8 dereferenceable(105), ptr noundef nonnull align 8 dereferenceable(105)) #3

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 = { 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 #3 = { "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 #4 = { 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 = !{!"long", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !16, i64 0}
!16 = !{!"_ZTSN9NOMAD_4_38EvalTypeE", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"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
declare dso_local noundef ptr @_ZNK9NOMAD_4_39EvalPoint7getEvalENS_8EvalTypeE(ptr noundef nonnull align 8 dereferenceable(160), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK9NOMAD_4_39EvalPointeqERKS0_(ptr noundef nonnull align 8 dereferenceable(160) %0, ptr noundef nonnull align 8 dereferenceable(160) %1) local_unnamed_addr #1 align 2 {
  %3 = tail call noundef zeroext i1 @_ZNK9NOMAD_4_313ArrayOfDoubleeqERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1)
  br i1 %3, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %9, %12, %2
  %.0.lcssa = phi i1 [ false, %2 ], [ false, %9 ], [ %.1, %12 ]
  ret i1 %.0.lcssa

.lr.ph:                                           ; preds = %2, %12
  %.01922 = phi i64 [ %13, %12 ], [ 0, %2 ]
  %4 = trunc nuw nsw i64 %.01922 to i32
  %5 = tail call noundef ptr @_ZNK9NOMAD_4_39EvalPoint7getEvalENS_8EvalTypeE(ptr noundef nonnull align 8 dereferenceable(160) %0, i32 noundef %4)
  %6 = tail call noundef ptr @_ZNK9NOMAD_4_39EvalPoint7getEvalENS_8EvalTypeE(ptr noundef nonnull align 8 dereferenceable(160) %1, i32 noundef %4)
  %7 = icmp eq ptr %5, null
  %8 = icmp eq ptr %6, null
  %or.cond = and i1 %7, %8
  br i1 %or.cond, label %12, label %9

9:                                                ; preds = %.lr.ph
  %or.cond3 = or i1 %7, %8
  br i1 %or.cond3, label %._crit_edge, label %10

10:                                               ; preds = %9
  %11 = tail call noundef zeroext i1 @_ZNK9NOMAD_4_34EvaleqERKS0_(ptr noundef nonnull align 8 dereferenceable(105) %5, ptr noundef nonnull align 8 dereferenceable(105) %6)
  br label %12

12:                                               ; preds = %10, %.lr.ph
  %.1 = phi i1 [ %11, %10 ], [ true, %.lr.ph ]
  %13 = add nuw nsw i64 %.01922, 1
  %14 = icmp ult i64 %.01922, 2
  %15 = and i1 %.1, %14
  br i1 %15, label %.lr.ph, label %._crit_edge, !llvm.loop !5
}

declare noundef zeroext i1 @_ZNK9NOMAD_4_313ArrayOfDoubleeqERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

declare noundef zeroext i1 @_ZNK9NOMAD_4_34EvaleqERKS0_(ptr noundef nonnull align 8 dereferenceable(105), ptr noundef nonnull align 8 dereferenceable(105)) local_unnamed_addr #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" }
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 = { "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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass