; LLVM IR from jrl-umi3218/mc_rtc :: 3rd-party/qhull/src/libqhull_r (io_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.17 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.83 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.168 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.169 = external hidden unnamed_addr constant [7 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_printpointid(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, i32 noundef %5) #2 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca double, align 8
  %15 = 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 i32 %3, ptr %10, align 4, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  store i32 %5, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %16 = load ptr, ptr %11, align 8, !tbaa !5
  %17 = icmp ne ptr %16, null
  br i1 %17, label %19, label %18

18:                                               ; preds = %6
  store i32 1, ptr %15, align 4
  br label %60

19:                                               ; preds = %6
  %20 = load ptr, ptr %9, align 8, !tbaa !5
  %21 = icmp ne ptr %20, null
  br i1 %21, label %22, label %36

22:                                               ; preds = %19
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %23, ptr noundef %24, i32 noundef 9211, ptr noundef @.str.83, ptr noundef %25)
  %26 = load i32, ptr %12, align 4, !tbaa !9
  %27 = icmp ne i32 %26, -1
  br i1 %27, label %28, label %35

28:                                               ; preds = %22
  %29 = load i32, ptr %12, align 4, !tbaa !9
  %30 = icmp ne i32 %29, -3
  br i1 %30, label %31, label %35

31:                                               ; preds = %28
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = load i32, ptr %12, align 4, !tbaa !9
  call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %32, ptr noundef %33, i32 noundef 9212, ptr noundef @.str.168, i32 noundef %34)
  br label %35

35:                                               ; preds = %31, %28, %22
  br label %36

36:                                               ; preds = %35, %19
  %37 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %37, ptr %13, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %56, %36
  %39 = load i32, ptr %13, align 4, !tbaa !9
  %40 = add nsw i32 %39, -1
  store i32 %40, ptr %13, align 4, !tbaa !9
  %41 = icmp ne i32 %39, 0
  br i1 %41, label %42, label %57

42:                                               ; preds = %38
  %43 = load ptr, ptr %11, align 8, !tbaa !5
  %44 = getelementptr inbounds double, ptr %43, i32 1
  store ptr %44, ptr %11, align 8, !tbaa !5
  %45 = load double, ptr %43, align 8, !tbaa !11
  store double %45, ptr %14, align 8, !tbaa !11
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = icmp ne ptr %46, null
  br i1 %47, label %48, label %52

48:                                               ; preds = %42
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = load double, ptr %14, align 8, !tbaa !11
  call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %49, ptr noundef %50, i32 noundef 9213, ptr noundef @.str.169, double noundef %51)
  br label %56

52:                                               ; preds = %42
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = load double, ptr %14, align 8, !tbaa !11
  call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %53, ptr noundef %54, i32 noundef 9214, ptr noundef @.str.17, double noundef %55)
  br label %56

56:                                               ; preds = %52, %48
  br label %38, !llvm.loop !13

57:                                               ; preds = %38
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = load ptr, ptr %8, align 8, !tbaa !5
  call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %58, ptr noundef %59, i32 noundef 9215, ptr noundef @.str.18)
  store i32 0, ptr %15, align 4
  br label %60

60:                                               ; preds = %57, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  %61 = load i32, ptr %15, align 4
  switch i32 %61, label %63 [
    i32 0, label %62
    i32 1, label %62
  ]

62:                                               ; preds = %60, %60
  ret void

63:                                               ; preds = %60
  unreachable
}

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


; 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.17 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.83 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.168 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.169 = external hidden unnamed_addr constant [7 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_printpointid(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef readonly %4, i32 noundef %5) local_unnamed_addr #1 {
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %22, label %7

7:                                                ; preds = %6
  %.not26 = icmp eq ptr %2, null
  br i1 %.not26, label %.thread, label %8

8:                                                ; preds = %7
  tail call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, ptr noundef %1, i32 noundef 9211, ptr noundef nonnull @.str.83, ptr noundef nonnull %2) #2
  %9 = and i32 %5, -3
  %or.cond.not = icmp eq i32 %9, -3
  br i1 %or.cond.not, label %11, label %10

10:                                               ; preds = %8
  tail call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, ptr noundef %1, i32 noundef 9212, ptr noundef nonnull @.str.168, i32 noundef %5) #2
  br label %11

11:                                               ; preds = %8, %10
  %.not2728 = icmp eq i32 %3, 0
  br i1 %.not2728, label %._crit_edge, label %.lr.ph

.thread:                                          ; preds = %7
  %.not272831 = icmp eq i32 %3, 0
  br i1 %.not272831, label %._crit_edge, label %.lr.ph.thread

.lr.ph.thread:                                    ; preds = %.thread
  %12 = add nsw i32 %3, -1
  br label %.lr.ph.split.us.preheader

.lr.ph:                                           ; preds = %11
  %13 = add nsw i32 %3, -1
  br i1 %.not26, label %.lr.ph.split.us.preheader, label %.lr.ph.split

.lr.ph.split.us.preheader:                        ; preds = %.lr.ph.thread, %.lr.ph
  %.ph = phi i32 [ %13, %.lr.ph ], [ %12, %.lr.ph.thread ]
  br label %.lr.ph.split.us

.lr.ph.split.us:                                  ; preds = %.lr.ph.split.us.preheader, %.lr.ph.split.us
  %14 = phi i32 [ %17, %.lr.ph.split.us ], [ %.ph, %.lr.ph.split.us.preheader ]
  %.029.us = phi ptr [ %15, %.lr.ph.split.us ], [ %4, %.lr.ph.split.us.preheader ]
  %15 = getelementptr inbounds i8, ptr %.029.us, i64 8
  %16 = load double, ptr %.029.us, align 8, !tbaa !5
  tail call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, ptr noundef %1, i32 noundef 9214, ptr noundef nonnull @.str.17, double noundef %16) #2
  %17 = add nsw i32 %14, -1
  %.not27.us = icmp eq i32 %14, 0
  br i1 %.not27.us, label %._crit_edge, label %.lr.ph.split.us, !llvm.loop !9

.lr.ph.split:                                     ; preds = %.lr.ph, %.lr.ph.split
  %18 = phi i32 [ %21, %.lr.ph.split ], [ %13, %.lr.ph ]
  %.029 = phi ptr [ %19, %.lr.ph.split ], [ %4, %.lr.ph ]
  %19 = getelementptr inbounds i8, ptr %.029, i64 8
  %20 = load double, ptr %.029, align 8, !tbaa !5
  tail call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, ptr noundef %1, i32 noundef 9213, ptr noundef nonnull @.str.169, double noundef %20) #2
  %21 = add nsw i32 %18, -1
  %.not27 = icmp eq i32 %18, 0
  br i1 %.not27, label %._crit_edge, label %.lr.ph.split, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph.split, %.lr.ph.split.us, %.thread, %11
  tail call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, ptr noundef %1, i32 noundef 9215, ptr noundef nonnull @.str.18) #2
  br label %22

22:                                               ; preds = %6, %._crit_edge
  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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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