; LLVM IR from theck01/offbrand_lib :: apps/minlog/src/funct (minlog_funct)

; 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 [91 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [63 x i8], align 1
@__PRETTY_FUNCTION__.printEqnVector = external hidden unnamed_addr constant [57 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [2 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.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 i32 @printf(ptr noundef, ...) #2

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

declare zeroext i8 @ob_has_class(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @printEqnVector(ptr noundef %0, i8 noundef zeroext %1, i32 noundef %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i8 %1, ptr %5, align 1, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %9 = call i32 (ptr, ...) @printf(ptr noundef @.str.21)
  store i32 0, ptr %7, align 4, !tbaa !10
  br label %10

10:                                               ; preds = %48, %3
  %11 = load i32, ptr %7, align 4, !tbaa !10
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = call i32 @obvector_length(ptr noundef %12)
  %14 = icmp ult i32 %11, %13
  br i1 %14, label %15, label %51

15:                                               ; preds = %10
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = load i32, ptr %7, align 4, !tbaa !10
  %18 = zext i32 %17 to i64
  %19 = call ptr @obvector_obj_at_index(ptr noundef %16, i64 noundef %18)
  %20 = call zeroext i8 @ob_has_class(ptr noundef %19, ptr noundef @.str.22)
  %21 = icmp ne i8 %20, 0
  br i1 %21, label %22, label %23

22:                                               ; preds = %15
  br label %24

23:                                               ; preds = %15
  call void @__assert_fail(ptr noundef @.str.23, ptr noundef @.str.1, i32 noundef 304, ptr noundef @__PRETTY_FUNCTION__.printEqnVector) #6
  unreachable

24:                                               ; preds = %22
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = load i32, ptr %7, align 4, !tbaa !10
  %27 = zext i32 %26 to i64
  %28 = call ptr @obvector_obj_at_index(ptr noundef %25, i64 noundef %27)
  %29 = load i8, ptr %5, align 1, !tbaa !9
  %30 = load i32, ptr %6, align 4, !tbaa !10
  %31 = trunc i32 %30 to i8
  %32 = call ptr @nCubeStr(ptr noundef %28, i8 noundef zeroext %29, i8 noundef zeroext %31)
  store ptr %32, ptr %8, align 8, !tbaa !5
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = call i32 (ptr, ...) @printf(ptr noundef @.str.24, ptr noundef %33)
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  call void @free(ptr noundef %35) #5
  %36 = load i8, ptr %5, align 1, !tbaa !9
  %37 = zext i8 %36 to i32
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %47

39:                                               ; preds = %24
  %40 = load i32, ptr %7, align 4, !tbaa !10
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = call i32 @obvector_length(ptr noundef %41)
  %43 = sub i32 %42, 1
  %44 = icmp ne i32 %40, %43
  br i1 %44, label %45, label %47

45:                                               ; preds = %39
  %46 = call i32 (ptr, ...) @printf(ptr noundef @.str.25)
  br label %47

47:                                               ; preds = %45, %39, %24
  br label %48

48:                                               ; preds = %47
  %49 = load i32, ptr %7, align 4, !tbaa !10
  %50 = add i32 %49, 1
  store i32 %50, ptr %7, align 4, !tbaa !10
  br label %10, !llvm.loop !12

51:                                               ; preds = %10
  %52 = call i32 (ptr, ...) @printf(ptr noundef @.str.15)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret void
}

declare ptr @nCubeStr(ptr noundef, i8 noundef zeroext, i8 noundef zeroext) #2

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

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 "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 #5 = { nounwind }
attributes #6 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !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 [91 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [63 x i8], align 1
@__PRETTY_FUNCTION__.printEqnVector = external hidden unnamed_addr constant [57 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [2 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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

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

; Function Attrs: nounwind uwtable
define dso_local void @printEqnVector(ptr noundef %0, i8 noundef zeroext %1, i32 noundef %2) local_unnamed_addr #3 {
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21)
  %5 = tail call i32 @obvector_length(ptr noundef %0) #5
  %.not16 = icmp eq i32 %5, 0
  br i1 %.not16, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3
  %6 = trunc i32 %2 to i8
  %.not13 = icmp eq i8 %1, 0
  br i1 %.not13, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph, %9
  %indvars.iv20 = phi i64 [ %indvars.iv.next21, %9 ], [ 0, %.lr.ph ]
  %7 = tail call ptr @obvector_obj_at_index(ptr noundef %0, i64 noundef %indvars.iv20) #5
  %8 = tail call zeroext i8 @ob_has_class(ptr noundef %7, ptr noundef nonnull @.str.22) #5
  %.not.us = icmp eq i8 %8, 0
  br i1 %.not.us, label %.split.us, label %9

9:                                                ; preds = %.lr.ph.split.us
  %10 = tail call ptr @obvector_obj_at_index(ptr noundef %0, i64 noundef %indvars.iv20) #5
  %11 = tail call ptr @nCubeStr(ptr noundef %10, i8 noundef zeroext 0, i8 noundef zeroext %6) #5
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.24, ptr noundef %11)
  tail call void @free(ptr noundef %11) #5
  %indvars.iv.next21 = add nuw nsw i64 %indvars.iv20, 1
  %13 = tail call i32 @obvector_length(ptr noundef %0) #5
  %14 = zext i32 %13 to i64
  %15 = icmp ult i64 %indvars.iv.next21, %14
  br i1 %15, label %.lr.ph.split.us, label %._crit_edge, !llvm.loop !5

.lr.ph.split:                                     ; preds = %.lr.ph, %27
  %indvars.iv = phi i64 [ %indvars.iv.next, %27 ], [ 0, %.lr.ph ]
  %16 = tail call ptr @obvector_obj_at_index(ptr noundef %0, i64 noundef %indvars.iv) #5
  %17 = tail call zeroext i8 @ob_has_class(ptr noundef %16, ptr noundef nonnull @.str.22) #5
  %.not = icmp eq i8 %17, 0
  br i1 %.not, label %.split.us, label %18

.split.us:                                        ; preds = %.lr.ph.split, %.lr.ph.split.us
  tail call void @__assert_fail(ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.1, i32 noundef 304, ptr noundef nonnull @__PRETTY_FUNCTION__.printEqnVector) #6
  unreachable

18:                                               ; preds = %.lr.ph.split
  %19 = tail call ptr @obvector_obj_at_index(ptr noundef %0, i64 noundef %indvars.iv) #5
  %20 = tail call ptr @nCubeStr(ptr noundef %19, i8 noundef zeroext %1, i8 noundef zeroext %6) #5
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.24, ptr noundef %20)
  tail call void @free(ptr noundef %20) #5
  %22 = tail call i32 @obvector_length(ptr noundef %0) #5
  %23 = add i32 %22, -1
  %24 = zext i32 %23 to i64
  %.not14 = icmp eq i64 %indvars.iv, %24
  br i1 %.not14, label %27, label %25

25:                                               ; preds = %18
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.25)
  br label %27

27:                                               ; preds = %18, %25
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %28 = tail call i32 @obvector_length(ptr noundef %0) #5
  %29 = zext i32 %28 to i64
  %30 = icmp ult i64 %indvars.iv.next, %29
  br i1 %30, label %.lr.ph.split, label %._crit_edge, !llvm.loop !5

._crit_edge:                                      ; preds = %27, %9, %3
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15)
  ret void
}

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

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 = { nofree 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 #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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #5 = { nounwind }
attributes #6 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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