; LLVM IR from scemama/slaterlib :: src (simple)

; 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 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [59 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: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #1

declare i32 @to_orbital_list(i32 noundef, ptr noundef, ptr noundef) #2

declare i32 @printf(ptr noundef, ...) #2

declare void @debug_det(i32 noundef, ptr noundef) #2

; Function Attrs: noreturn
declare void @errx(i32 noundef, ptr noundef, ...) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @get_holes_simple(i32 noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #4 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !9
  %17 = load i32, ptr %5, align 4, !tbaa !5
  %18 = zext i32 %17 to i64
  %19 = load i32, ptr %5, align 4, !tbaa !5
  %20 = zext i32 %19 to i64
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %21 = load i32, ptr %5, align 4, !tbaa !5
  %22 = mul i32 %21, 64
  %23 = zext i32 %22 to i64
  %24 = call ptr @llvm.stacksave.p0()
  store ptr %24, ptr %13, align 8
  %25 = alloca i32, i64 %23, align 16
  store i64 %23, ptr %14, align 8
  %26 = load i32, ptr %5, align 4, !tbaa !5
  %27 = mul i32 %26, 64
  %28 = zext i32 %27 to i64
  %29 = alloca i32, i64 %28, align 16
  store i64 %28, ptr %15, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %30 = load ptr, ptr %8, align 8, !tbaa !9
  %31 = getelementptr inbounds i32, ptr %30, i64 0
  store i32 0, ptr %31, align 4, !tbaa !5
  %32 = load ptr, ptr %8, align 8, !tbaa !9
  %33 = getelementptr inbounds i32, ptr %32, i64 1
  store i32 0, ptr %33, align 4, !tbaa !5
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = load ptr, ptr %6, align 8, !tbaa !9
  %36 = call i32 @to_orbital_list(i32 noundef %34, ptr noundef %35, ptr noundef %25)
  store i32 %36, ptr %11, align 4, !tbaa !5
  %37 = load i32, ptr %11, align 4, !tbaa !5
  %38 = load i32, ptr %5, align 4, !tbaa !5
  %39 = load ptr, ptr %7, align 8, !tbaa !9
  %40 = call i32 @to_orbital_list(i32 noundef %38, ptr noundef %39, ptr noundef %29)
  %41 = icmp ne i32 %37, %40
  br i1 %41, label %42, label %52

42:                                               ; preds = %4
  %43 = load i32, ptr %11, align 4, !tbaa !5
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = load ptr, ptr %7, align 8, !tbaa !9
  %46 = call i32 @to_orbital_list(i32 noundef %44, ptr noundef %45, ptr noundef %29)
  %47 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %43, i32 noundef %46)
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = load ptr, ptr %6, align 8, !tbaa !9
  call void @debug_det(i32 noundef %48, ptr noundef %49)
  %50 = load i32, ptr %5, align 4, !tbaa !5
  %51 = load ptr, ptr %7, align 8, !tbaa !9
  call void @debug_det(i32 noundef %50, ptr noundef %51)
  call void (i32, ptr, ...) @errx(i32 noundef 1, ptr noundef @.str.2) #6
  unreachable

52:                                               ; preds = %4
  store i32 0, ptr %12, align 4, !tbaa !5
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %92, %52
  %54 = load i32, ptr %9, align 4, !tbaa !5
  %55 = load i32, ptr %11, align 4, !tbaa !5
  %56 = icmp ult i32 %54, %55
  br i1 %56, label %57, label %95

57:                                               ; preds = %53
  store i32 0, ptr %16, align 4, !tbaa !5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %74, %57
  %59 = load i32, ptr %10, align 4, !tbaa !5
  %60 = load i32, ptr %11, align 4, !tbaa !5
  %61 = icmp ult i32 %59, %60
  br i1 %61, label %62, label %77

62:                                               ; preds = %58
  %63 = load i32, ptr %9, align 4, !tbaa !5
  %64 = zext i32 %63 to i64
  %65 = getelementptr inbounds i32, ptr %25, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = load i32, ptr %10, align 4, !tbaa !5
  %68 = zext i32 %67 to i64
  %69 = getelementptr inbounds i32, ptr %29, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = icmp eq i32 %66, %70
  br i1 %71, label %72, label %73

72:                                               ; preds = %62
  store i32 1, ptr %16, align 4, !tbaa !5
  br label %77

73:                                               ; preds = %62
  br label %74

74:                                               ; preds = %73
  %75 = load i32, ptr %10, align 4, !tbaa !5
  %76 = add i32 %75, 1
  store i32 %76, ptr %10, align 4, !tbaa !5
  br label %58, !llvm.loop !11

77:                                               ; preds = %72, %58
  %78 = load i32, ptr %16, align 4, !tbaa !5
  %79 = icmp eq i32 %78, 0
  br i1 %79, label %80, label %91

80:                                               ; preds = %77
  %81 = load i32, ptr %9, align 4, !tbaa !5
  %82 = zext i32 %81 to i64
  %83 = getelementptr inbounds i32, ptr %25, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = load ptr, ptr %8, align 8, !tbaa !9
  %86 = load i32, ptr %12, align 4, !tbaa !5
  %87 = zext i32 %86 to i64
  %88 = getelementptr inbounds i32, ptr %85, i64 %87
  store i32 %84, ptr %88, align 4, !tbaa !5
  %89 = load i32, ptr %12, align 4, !tbaa !5
  %90 = add i32 %89, 1
  store i32 %90, ptr %12, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %80, %77
  br label %92

92:                                               ; preds = %91
  %93 = load i32, ptr %9, align 4, !tbaa !5
  %94 = add i32 %93, 1
  store i32 %94, ptr %9, align 4, !tbaa !5
  br label %53, !llvm.loop !13

95:                                               ; preds = %53
  %96 = load i32, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  %97 = load ptr, ptr %13, align 8
  call void @llvm.stackrestore.p0(ptr %97)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  ret i32 %96
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn }
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 = { noreturn "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 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 #5 = { nounwind }
attributes #6 = { noreturn }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; 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 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [59 x i8], align 1

declare i32 @to_orbital_list(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

declare void @debug_det(i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: noreturn
declare void @errx(i32 noundef, ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local i32 @get_holes_simple(i32 noundef %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #3 {
  %5 = shl i32 %0, 6
  %6 = zext i32 %5 to i64
  %7 = alloca i32, i64 %6, align 16
  %8 = alloca i32, i64 %6, align 16
  store i32 0, ptr %3, align 4, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %3, i64 4
  store i32 0, ptr %9, align 4, !tbaa !5
  %10 = call i32 @to_orbital_list(i32 noundef %0, ptr noundef %1, ptr noundef nonnull %7) #4
  %11 = call i32 @to_orbital_list(i32 noundef %0, ptr noundef %2, ptr noundef nonnull %8) #4
  %.not = icmp eq i32 %10, %11
  br i1 %.not, label %.preheader38, label %12

.preheader38:                                     ; preds = %4
  %.not42 = icmp eq i32 %10, 0
  br i1 %.not42, label %._crit_edge, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.preheader38
  %wide.trip.count47 = zext i32 %10 to i64
  br label %.preheader

12:                                               ; preds = %4
  %13 = call i32 @to_orbital_list(i32 noundef %0, ptr noundef %2, ptr noundef nonnull %8) #4
  %14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %10, i32 noundef %13)
  call void @debug_det(i32 noundef %0, ptr noundef %1) #4
  call void @debug_det(i32 noundef %0, ptr noundef %2) #4
  call void (i32, ptr, ...) @errx(i32 noundef 1, ptr noundef nonnull @.str.2) #5
  unreachable

.preheader:                                       ; preds = %.preheader.preheader, %.loopexit
  %indvars.iv44 = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next45, %.loopexit ]
  %.03440 = phi i32 [ 0, %.preheader.preheader ], [ %.1, %.loopexit ]
  %15 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv44
  %16 = load i32, ptr %15, align 4, !tbaa !5
  br label %18

17:                                               ; preds = %18
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count47
  br i1 %exitcond.not, label %.critedge, label %18, !llvm.loop !9

18:                                               ; preds = %.preheader, %17
  %indvars.iv = phi i64 [ 0, %.preheader ], [ %indvars.iv.next, %17 ]
  %19 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = icmp eq i32 %16, %20
  br i1 %21, label %.loopexit, label %17

.critedge:                                        ; preds = %17
  %22 = zext i32 %.03440 to i64
  %23 = getelementptr inbounds i32, ptr %3, i64 %22
  store i32 %16, ptr %23, align 4, !tbaa !5
  %24 = add i32 %.03440, 1
  br label %.loopexit

.loopexit:                                        ; preds = %18, %.critedge
  %.1 = phi i32 [ %24, %.critedge ], [ %.03440, %18 ]
  %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
  %exitcond48.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count47
  br i1 %exitcond48.not, label %._crit_edge, label %.preheader, !llvm.loop !11

._crit_edge:                                      ; preds = %.loopexit, %.preheader38
  %.034.lcssa = phi i32 [ 0, %.preheader38 ], [ %.1, %.loopexit ]
  ret i32 %.034.lcssa
}

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


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