; LLVM IR from jrl-umi3218/mc_rtc :: 3rd-party/qhull/src/libqhull_r (geom2_r)

; 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.53 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.55 = 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

declare void @qh_fprintf(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ...) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @qh_printmatrix(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, i32 noundef %5) #2 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca double, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !9
  store i32 %5, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = load ptr, ptr %9, align 8, !tbaa !5
  call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %17, ptr noundef %18, i32 noundef 9001, ptr noundef @.str.53, ptr noundef %19)
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %47, %6
  %21 = load i32, ptr %15, align 4, !tbaa !9
  %22 = load i32, ptr %11, align 4, !tbaa !9
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %24, label %50

24:                                               ; preds = %20
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  %26 = load i32, ptr %15, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds ptr, ptr %25, i64 %27
  %29 = load ptr, ptr %28, align 8, !tbaa !5
  store ptr %29, ptr %13, align 8, !tbaa !5
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %41, %24
  %31 = load i32, ptr %16, align 4, !tbaa !9
  %32 = load i32, ptr %12, align 4, !tbaa !9
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %34, label %44

34:                                               ; preds = %30
  %35 = load ptr, ptr %13, align 8, !tbaa !5
  %36 = getelementptr inbounds double, ptr %35, i32 1
  store ptr %36, ptr %13, align 8, !tbaa !5
  %37 = load double, ptr %35, align 8, !tbaa !11
  store double %37, ptr %14, align 8, !tbaa !11
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = load double, ptr %14, align 8, !tbaa !11
  call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %38, ptr noundef %39, i32 noundef 9002, ptr noundef @.str.54, double noundef %40)
  br label %41

41:                                               ; preds = %34
  %42 = load i32, ptr %16, align 4, !tbaa !9
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %16, align 4, !tbaa !9
  br label %30, !llvm.loop !13

44:                                               ; preds = %30
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %45, ptr noundef %46, i32 noundef 9003, ptr noundef @.str.55)
  br label %47

47:                                               ; preds = %44
  %48 = load i32, ptr %15, align 4, !tbaa !9
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %15, align 4, !tbaa !9
  br label %20, !llvm.loop !15

50:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  ret void
}

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

!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 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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

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

; Function Attrs: nounwind uwtable
define dso_local void @qh_printmatrix(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef readonly %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #1 {
  tail call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, ptr noundef %1, i32 noundef 9001, ptr noundef nonnull @.str.53, ptr noundef %2) #2
  %7 = icmp sgt i32 %4, 0
  br i1 %7, label %.lr.ph22, label %._crit_edge23

.lr.ph22:                                         ; preds = %6
  %8 = icmp sgt i32 %5, 0
  br i1 %8, label %.lr.ph.us.preheader, label %.lr.ph22.split

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

.lr.ph.us:                                        ; preds = %.lr.ph.us.preheader, %._crit_edge.us
  %indvars.iv = phi i64 [ 0, %.lr.ph.us.preheader ], [ %indvars.iv.next, %._crit_edge.us ]
  %9 = getelementptr inbounds ptr, ptr %3, i64 %indvars.iv
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %.lr.ph.us, %11
  %.019.us = phi i32 [ 0, %.lr.ph.us ], [ %14, %11 ]
  %.01718.us = phi ptr [ %10, %.lr.ph.us ], [ %12, %11 ]
  %12 = getelementptr inbounds i8, ptr %.01718.us, i64 8
  %13 = load double, ptr %.01718.us, align 8, !tbaa !9
  tail call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, ptr noundef %1, i32 noundef 9002, ptr noundef nonnull @.str.54, double noundef %13) #2
  %14 = add nuw nsw i32 %.019.us, 1
  %exitcond25.not = icmp eq i32 %14, %5
  br i1 %exitcond25.not, label %._crit_edge.us, label %11, !llvm.loop !11

._crit_edge.us:                                   ; preds = %11
  tail call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, ptr noundef %1, i32 noundef 9003, ptr noundef nonnull @.str.55) #2
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond27.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond27.not, label %._crit_edge23, label %.lr.ph.us, !llvm.loop !13

.lr.ph22.split:                                   ; preds = %.lr.ph22, %.lr.ph22.split
  %.01620 = phi i32 [ %15, %.lr.ph22.split ], [ 0, %.lr.ph22 ]
  tail call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, ptr noundef %1, i32 noundef 9003, ptr noundef nonnull @.str.55) #2
  %15 = add nuw nsw i32 %.01620, 1
  %exitcond.not = icmp eq i32 %15, %4
  br i1 %exitcond.not, label %._crit_edge23, label %.lr.ph22.split, !llvm.loop !13

._crit_edge23:                                    ; preds = %.lr.ph22.split, %._crit_edge.us, %6
  ret void
}

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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; Effective O3 passes: GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass