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

%struct.setT = type { i32, [1 x %union.setelemT] }
%union.setelemT = type { ptr }

@.str.55 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.58 = external hidden unnamed_addr constant [4 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

declare i32 @qh_pointid(ptr noundef, ptr noundef) #1

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

13:                                               ; preds = %4
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %14, ptr noundef %15, i32 noundef 9004, ptr noundef @.str.56, ptr noundef %16)
  store ptr null, ptr %9, align 8, !tbaa !5
  %17 = load ptr, ptr %8, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %35

19:                                               ; preds = %13
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.setT, ptr %20, i32 0, i32 1
  %22 = getelementptr inbounds [1 x %union.setelemT], ptr %21, i64 0, i64 0
  store ptr %22, ptr %10, align 8, !tbaa !5
  br label %23

23:                                               ; preds = %28, %19
  %24 = load ptr, ptr %10, align 8, !tbaa !5
  %25 = getelementptr inbounds ptr, ptr %24, i32 1
  store ptr %25, ptr %10, align 8, !tbaa !5
  %26 = load ptr, ptr %24, align 8, !tbaa !5
  store ptr %26, ptr %9, align 8, !tbaa !5
  %27 = icmp ne ptr %26, null
  br i1 %27, label %28, label %34

28:                                               ; preds = %23
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = call i32 @qh_pointid(ptr noundef %31, ptr noundef %32)
  call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %29, ptr noundef %30, i32 noundef 9005, ptr noundef @.str.57, i32 noundef %33)
  br label %23, !llvm.loop !9

34:                                               ; preds = %23
  br label %35

35:                                               ; preds = %34, %13
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %36, ptr noundef %37, i32 noundef 9006, ptr noundef @.str.55)
  br label %60

38:                                               ; preds = %4
  store ptr null, ptr %9, align 8, !tbaa !5
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %57

41:                                               ; preds = %38
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.setT, ptr %42, i32 0, i32 1
  %44 = getelementptr inbounds [1 x %union.setelemT], ptr %43, i64 0, i64 0
  store ptr %44, ptr %10, align 8, !tbaa !5
  br label %45

45:                                               ; preds = %50, %41
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = getelementptr inbounds ptr, ptr %46, i32 1
  store ptr %47, ptr %10, align 8, !tbaa !5
  %48 = load ptr, ptr %46, align 8, !tbaa !5
  store ptr %48, ptr %9, align 8, !tbaa !5
  %49 = icmp ne ptr %48, null
  br i1 %49, label %50, label %56

50:                                               ; preds = %45
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  %55 = call i32 @qh_pointid(ptr noundef %53, ptr noundef %54)
  call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %51, ptr noundef %52, i32 noundef 9007, ptr noundef @.str.58, i32 noundef %55)
  br label %45, !llvm.loop !11

56:                                               ; preds = %45
  br label %57

57:                                               ; preds = %56, %38
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %58, ptr noundef %59, i32 noundef 9008, ptr noundef @.str.55)
  br label %60

60:                                               ; preds = %57, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; 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.55 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.58 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local void @qh_printpoints(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef readonly %3) local_unnamed_addr #1 {
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %10, label %5

5:                                                ; preds = %4
  tail call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, ptr noundef %1, i32 noundef 9004, ptr noundef nonnull @.str.56, ptr noundef nonnull %2) #2
  %.not29 = icmp eq ptr %3, null
  br i1 %.not29, label %.loopexit33, label %.preheader32

.preheader32:                                     ; preds = %5
  %.034 = getelementptr inbounds i8, ptr %3, i64 8
  %6 = load ptr, ptr %.034, align 8, !tbaa !5
  %.not3135 = icmp eq ptr %6, null
  br i1 %.not3135, label %.loopexit33, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader32, %.lr.ph
  %7 = phi ptr [ %9, %.lr.ph ], [ %6, %.preheader32 ]
  %.036 = phi ptr [ %.0, %.lr.ph ], [ %.034, %.preheader32 ]
  %8 = tail call i32 @qh_pointid(ptr noundef %0, ptr noundef nonnull %7) #2
  tail call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, ptr noundef %1, i32 noundef 9005, ptr noundef nonnull @.str.57, i32 noundef %8) #2
  %.0 = getelementptr inbounds i8, ptr %.036, i64 8
  %9 = load ptr, ptr %.0, align 8, !tbaa !5
  %.not31 = icmp eq ptr %9, null
  br i1 %.not31, label %.loopexit33, label %.lr.ph, !llvm.loop !9

10:                                               ; preds = %4
  %.not27 = icmp eq ptr %3, null
  br i1 %.not27, label %.loopexit33, label %.preheader

.preheader:                                       ; preds = %10
  %.137 = getelementptr inbounds i8, ptr %3, i64 8
  %11 = load ptr, ptr %.137, align 8, !tbaa !5
  %.not2838 = icmp eq ptr %11, null
  br i1 %.not2838, label %.loopexit33, label %.lr.ph40

.lr.ph40:                                         ; preds = %.preheader, %.lr.ph40
  %12 = phi ptr [ %14, %.lr.ph40 ], [ %11, %.preheader ]
  %.139 = phi ptr [ %.1, %.lr.ph40 ], [ %.137, %.preheader ]
  %13 = tail call i32 @qh_pointid(ptr noundef %0, ptr noundef nonnull %12) #2
  tail call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, ptr noundef %1, i32 noundef 9007, ptr noundef nonnull @.str.58, i32 noundef %13) #2
  %.1 = getelementptr inbounds i8, ptr %.139, i64 8
  %14 = load ptr, ptr %.1, align 8, !tbaa !5
  %.not28 = icmp eq ptr %14, null
  br i1 %.not28, label %.loopexit33, label %.lr.ph40, !llvm.loop !11

.loopexit33:                                      ; preds = %.lr.ph, %.lr.ph40, %10, %.preheader, %5, %.preheader32
  %.sink = phi i32 [ 9006, %.preheader32 ], [ 9006, %5 ], [ 9008, %.preheader ], [ 9008, %10 ], [ 9008, %.lr.ph40 ], [ 9006, %.lr.ph ]
  tail call void (ptr, ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, ptr noundef %1, i32 noundef %.sink, ptr noundef nonnull @.str.55) #2
  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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


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