; LLVM IR from theck01/offbrand_lib :: apps/minlog/src/classes (RTable)

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

@.str.1 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [15 x i8], align 1
@__PRETTY_FUNCTION__.initTermCoverArray = external hidden unnamed_addr constant [63 x i8], align 1

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

declare i32 @obvector_length(ptr noundef) #2

declare ptr @obvector_obj_at_index(ptr noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @initTermCoverArray(ptr noundef %0, i32 noundef %1, ptr noundef %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = call i32 @obvector_length(ptr noundef %11)
  store i32 %12, ptr %9, align 4, !tbaa !9
  store i32 0, ptr %10, align 4, !tbaa !9
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %13

13:                                               ; preds = %42, %3
  %14 = load i32, ptr %8, align 4, !tbaa !9
  %15 = load i32, ptr %9, align 4, !tbaa !9
  %16 = icmp ult i32 %14, %15
  br i1 %16, label %17, label %45

17:                                               ; preds = %13
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = load i32, ptr %8, align 4, !tbaa !9
  %20 = zext i32 %19 to i64
  %21 = call ptr @obvector_obj_at_index(ptr noundef %18, i64 noundef %20)
  %22 = load i32, ptr %5, align 4, !tbaa !9
  %23 = call zeroext i8 @nCubeCoversTerm(ptr noundef %21, i32 noundef %22)
  %24 = icmp ne i8 %23, 0
  br i1 %24, label %25, label %36

25:                                               ; preds = %17
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = load i32, ptr %8, align 4, !tbaa !9
  %28 = zext i32 %27 to i64
  %29 = getelementptr inbounds i8, ptr %26, i64 %28
  store i8 1, ptr %29, align 1, !tbaa !11
  %30 = load i32, ptr %10, align 4, !tbaa !9
  %31 = add i32 %30, 1
  store i32 %31, ptr %10, align 4, !tbaa !9
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = load i32, ptr %8, align 4, !tbaa !9
  %34 = zext i32 %33 to i64
  %35 = call ptr @obvector_obj_at_index(ptr noundef %32, i64 noundef %34)
  store ptr %35, ptr %7, align 8, !tbaa !5
  br label %41

36:                                               ; preds = %17
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = load i32, ptr %8, align 4, !tbaa !9
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds i8, ptr %37, i64 %39
  store i8 0, ptr %40, align 1, !tbaa !11
  br label %41

41:                                               ; preds = %36, %25
  br label %42

42:                                               ; preds = %41
  %43 = load i32, ptr %8, align 4, !tbaa !9
  %44 = add i32 %43, 1
  store i32 %44, ptr %8, align 4, !tbaa !9
  br label %13, !llvm.loop !12

45:                                               ; preds = %13
  %46 = load i32, ptr %10, align 4, !tbaa !9
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %48, label %49

48:                                               ; preds = %45
  br label %50

49:                                               ; preds = %45
  call void @__assert_fail(ptr noundef @.str.13, ptr noundef @.str.1, i32 noundef 180, ptr noundef @__PRETTY_FUNCTION__.initTermCoverArray) #5
  unreachable

50:                                               ; preds = %48
  %51 = load i32, ptr %10, align 4, !tbaa !9
  %52 = icmp eq i32 %51, 1
  br i1 %52, label %53, label %55

53:                                               ; preds = %50
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  call void @markNCubeAsEssential(ptr noundef %54)
  br label %55

55:                                               ; preds = %53, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret void
}

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

declare zeroext i8 @nCubeCoversTerm(ptr noundef, i32 noundef) #2

declare void @markNCubeAsEssential(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn nounwind "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" }
attributes #3 = { 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 #4 = { nounwind }
attributes #5 = { noreturn 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"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"

@.str.1 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [15 x i8], align 1
@__PRETTY_FUNCTION__.initTermCoverArray = external hidden unnamed_addr constant [63 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

declare i32 @obvector_length(ptr noundef) local_unnamed_addr #1

declare ptr @obvector_obj_at_index(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @initTermCoverArray(ptr noundef %0, i32 noundef %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #2 {
  %4 = tail call i32 @obvector_length(ptr noundef %0) #3
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %._crit_edge.thread, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %3
  %wide.trip.count = zext i32 %4 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %12
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %12 ]
  %.022 = phi i32 [ 0, %.lr.ph.preheader ], [ %.1, %12 ]
  %.01621 = phi ptr [ undef, %.lr.ph.preheader ], [ %.117, %12 ]
  %5 = tail call ptr @obvector_obj_at_index(ptr noundef %0, i64 noundef %indvars.iv) #3
  %6 = tail call zeroext i8 @nCubeCoversTerm(ptr noundef %5, i32 noundef %1) #3
  %.not19 = icmp eq i8 %6, 0
  %7 = getelementptr inbounds i8, ptr %2, i64 %indvars.iv
  br i1 %.not19, label %11, label %8

8:                                                ; preds = %.lr.ph
  store i8 1, ptr %7, align 1, !tbaa !5
  %9 = add i32 %.022, 1
  %10 = tail call ptr @obvector_obj_at_index(ptr noundef %0, i64 noundef %indvars.iv) #3
  br label %12

11:                                               ; preds = %.lr.ph
  store i8 0, ptr %7, align 1, !tbaa !5
  br label %12

12:                                               ; preds = %8, %11
  %.117 = phi ptr [ %10, %8 ], [ %.01621, %11 ]
  %.1 = phi i32 [ %9, %8 ], [ %.022, %11 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !8

._crit_edge:                                      ; preds = %12
  switch i32 %.1, label %14 [
    i32 0, label %._crit_edge.thread
    i32 1, label %13
  ]

._crit_edge.thread:                               ; preds = %3, %._crit_edge
  tail call void @__assert_fail(ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.1, i32 noundef 180, ptr noundef nonnull @__PRETTY_FUNCTION__.initTermCoverArray) #4
  unreachable

13:                                               ; preds = %._crit_edge
  tail call void @markNCubeAsEssential(ptr noundef %.117) #3
  br label %14

14:                                               ; preds = %._crit_edge, %13
  ret void
}

declare zeroext i8 @nCubeCoversTerm(ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @markNCubeAsEssential(ptr noundef) local_unnamed_addr #1

attributes #0 = { noreturn nounwind "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 = { "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 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 }
attributes #4 = { noreturn 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass