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

; 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 }
%struct.vertexT = type { ptr, ptr, ptr, ptr, i32, i32, i8 }
%struct.facetT = type { double, double, double, ptr, %union.anon, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32 }
%union.anon = type { double }

@.str.22 = 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, 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) #1

declare void @qh_settempfree(ptr noundef) #1

declare void @qh_vertexneighbors() #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @qh_facetvertices(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @qh_printextremes_d(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  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 i32 %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  store i32 0, ptr %16, align 4, !tbaa !9
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = load i32, ptr %8, align 4, !tbaa !9
  %20 = call ptr @qh_facetvertices(ptr noundef %17, ptr noundef %18, i32 noundef %19)
  store ptr %20, ptr %9, align 8, !tbaa !5
  call void @qh_vertexneighbors()
  store ptr null, ptr %10, align 8, !tbaa !5
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %81

23:                                               ; preds = %4
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.setT, ptr %24, i32 0, i32 1
  %26 = getelementptr inbounds [1 x %union.setelemT], ptr %25, i64 0, i64 0
  store ptr %26, ptr %11, align 8, !tbaa !5
  br label %27

27:                                               ; preds = %79, %23
  %28 = load ptr, ptr %11, align 8, !tbaa !5
  %29 = getelementptr inbounds ptr, ptr %28, i32 1
  store ptr %29, ptr %11, align 8, !tbaa !5
  %30 = load ptr, ptr %28, align 8, !tbaa !5
  store ptr %30, ptr %10, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %80

32:                                               ; preds = %27
  store i32 0, ptr %13, align 4, !tbaa !9
  store i32 0, ptr %12, align 4, !tbaa !9
  store ptr null, ptr %14, align 8, !tbaa !5
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.vertexT, ptr %33, i32 0, i32 3
  %35 = load ptr, ptr %34, align 8, !tbaa !11
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %59

37:                                               ; preds = %32
  %38 = load ptr, ptr %10, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.vertexT, ptr %38, i32 0, i32 3
  %40 = load ptr, ptr %39, align 8, !tbaa !11
  %41 = getelementptr inbounds %struct.setT, ptr %40, i32 0, i32 1
  %42 = getelementptr inbounds [1 x %union.setelemT], ptr %41, i64 0, i64 0
  store ptr %42, ptr %15, align 8, !tbaa !5
  br label %43

43:                                               ; preds = %57, %37
  %44 = load ptr, ptr %15, align 8, !tbaa !5
  %45 = getelementptr inbounds ptr, ptr %44, i32 1
  store ptr %45, ptr %15, align 8, !tbaa !5
  %46 = load ptr, ptr %44, align 8, !tbaa !5
  store ptr %46, ptr %14, align 8, !tbaa !5
  %47 = icmp ne ptr %46, null
  br i1 %47, label %48, label %58

48:                                               ; preds = %43
  %49 = load ptr, ptr %14, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.facetT, ptr %49, i32 0, i32 15
  %51 = load i32, ptr %50, align 8
  %52 = lshr i32 %51, 17
  %53 = and i32 %52, 1
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %56

55:                                               ; preds = %48
  store i32 1, ptr %12, align 4, !tbaa !9
  br label %57

56:                                               ; preds = %48
  store i32 1, ptr %13, align 4, !tbaa !9
  br label %57

57:                                               ; preds = %56, %55
  br label %43, !llvm.loop !13

58:                                               ; preds = %43
  br label %59

59:                                               ; preds = %58, %32
  %60 = load i32, ptr %12, align 4, !tbaa !9
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %62, label %73

62:                                               ; preds = %59
  %63 = load i32, ptr %13, align 4, !tbaa !9
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %73

65:                                               ; preds = %62
  %66 = load ptr, ptr %10, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.vertexT, ptr %66, i32 0, i32 6
  %68 = load i8, ptr %67, align 8
  %69 = and i8 %68, -2
  %70 = or i8 %69, 1
  store i8 %70, ptr %67, align 8
  %71 = load i32, ptr %16, align 4, !tbaa !9
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %16, align 4, !tbaa !9
  br label %79

73:                                               ; preds = %62, %59
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.vertexT, ptr %74, i32 0, i32 6
  %76 = load i8, ptr %75, align 8
  %77 = and i8 %76, -2
  %78 = or i8 %77, 0
  store i8 %78, ptr %75, align 8
  br label %79

79:                                               ; preds = %73, %65
  br label %27, !llvm.loop !15

80:                                               ; preds = %27
  br label %81

81:                                               ; preds = %80, %4
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = load i32, ptr %16, align 4, !tbaa !9
  call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %82, i32 noundef 9091, ptr noundef @.str.22, i32 noundef %83)
  store ptr null, ptr %10, align 8, !tbaa !5
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  %85 = icmp ne ptr %84, null
  br i1 %85, label %86, label %110

86:                                               ; preds = %81
  %87 = load ptr, ptr %9, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.setT, ptr %87, i32 0, i32 1
  %89 = getelementptr inbounds [1 x %union.setelemT], ptr %88, i64 0, i64 0
  store ptr %89, ptr %11, align 8, !tbaa !5
  br label %90

90:                                               ; preds = %108, %86
  %91 = load ptr, ptr %11, align 8, !tbaa !5
  %92 = getelementptr inbounds ptr, ptr %91, i32 1
  store ptr %92, ptr %11, align 8, !tbaa !5
  %93 = load ptr, ptr %91, align 8, !tbaa !5
  store ptr %93, ptr %10, align 8, !tbaa !5
  %94 = icmp ne ptr %93, null
  br i1 %94, label %95, label %109

95:                                               ; preds = %90
  %96 = load ptr, ptr %10, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.vertexT, ptr %96, i32 0, i32 6
  %98 = load i8, ptr %97, align 8
  %99 = and i8 %98, 1
  %100 = zext i8 %99 to i32
  %101 = icmp ne i32 %100, 0
  br i1 %101, label %102, label %108

102:                                              ; preds = %95
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = load ptr, ptr %10, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.vertexT, ptr %104, i32 0, i32 2
  %106 = load ptr, ptr %105, align 8, !tbaa !16
  %107 = call i32 @qh_pointid(ptr noundef %106)
  call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %103, i32 noundef 9092, ptr noundef @.str.22, i32 noundef %107)
  br label %108

108:                                              ; preds = %102, %95
  br label %90, !llvm.loop !17

109:                                              ; preds = %90
  br label %110

110:                                              ; preds = %109, %81
  call void @qh_settempfree(ptr noundef %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 24}
!12 = !{!"vertexT", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 40, !10, i64 40, !10, i64 40, !10, i64 40, !10, i64 40}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!12, !6, i64 16}
!17 = distinct !{!17, !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.22 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress 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, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: mustprogress 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) local_unnamed_addr #1

declare void @qh_settempfree(ptr noundef) local_unnamed_addr #1

declare void @qh_vertexneighbors() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @qh_facetvertices(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @qh_printextremes_d(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) local_unnamed_addr #2 {
  %5 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %6 = tail call ptr @qh_facetvertices(ptr noundef %1, ptr noundef %2, i32 noundef %3)
  store ptr %6, ptr %5, align 8, !tbaa !5
  tail call void @qh_vertexneighbors() #3
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %.loopexit48.thread, label %.preheader47

.loopexit48.thread:                               ; preds = %4
  tail call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, i32 noundef 9091, ptr noundef nonnull @.str.22, i32 noundef 0) #3
  br label %.loopexit

.preheader47:                                     ; preds = %4
  %.02655 = getelementptr inbounds i8, ptr %6, i64 8
  %7 = load ptr, ptr %.02655, align 8, !tbaa !5
  %.not3456 = icmp eq ptr %7, null
  br i1 %.not3456, label %.loopexit48.thread69, label %.lr.ph59

.loopexit48.thread69:                             ; preds = %.preheader47
  tail call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, i32 noundef 9091, ptr noundef nonnull @.str.22, i32 noundef 0) #3
  br label %.preheader

.lr.ph59:                                         ; preds = %.preheader47, %27
  %8 = phi ptr [ %28, %27 ], [ %7, %.preheader47 ]
  %.02658 = phi ptr [ %.026, %27 ], [ %.02655, %.preheader47 ]
  %.057 = phi i32 [ %.1, %27 ], [ 0, %.preheader47 ]
  %9 = getelementptr inbounds i8, ptr %8, i64 24
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %.not39 = icmp eq ptr %10, null
  br i1 %.not39, label %.thread, label %.preheader46

.preheader46:                                     ; preds = %.lr.ph59
  %.01949 = getelementptr inbounds i8, ptr %10, i64 8
  %11 = load ptr, ptr %.01949, align 8, !tbaa !5
  %.not4150 = icmp eq ptr %11, null
  br i1 %.not4150, label %.thread, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader46, %.lr.ph
  %12 = phi ptr [ %16, %.lr.ph ], [ %11, %.preheader46 ]
  %.01953 = phi ptr [ %.019, %.lr.ph ], [ %.01949, %.preheader46 ]
  %.02052 = phi i32 [ %..020, %.lr.ph ], [ 0, %.preheader46 ]
  %.02351 = phi i32 [ %.023., %.lr.ph ], [ 0, %.preheader46 ]
  %13 = getelementptr inbounds i8, ptr %12, i64 112
  %14 = load i32, ptr %13, align 8
  %15 = and i32 %14, 131072
  %.not42 = icmp eq i32 %15, 0
  %.023. = select i1 %.not42, i32 %.02351, i32 1
  %..020 = select i1 %.not42, i32 1, i32 %.02052
  %.019 = getelementptr inbounds i8, ptr %.01953, i64 8
  %16 = load ptr, ptr %.019, align 8, !tbaa !5
  %.not41 = icmp eq ptr %16, null
  br i1 %.not41, label %._crit_edge, label %.lr.ph, !llvm.loop !12

._crit_edge:                                      ; preds = %.lr.ph
  %17 = icmp ne i32 %.023., 0
  %18 = icmp ne i32 %..020, 0
  %or.cond = select i1 %17, i1 %18, i1 false
  br i1 %or.cond, label %19, label %.thread

19:                                               ; preds = %._crit_edge
  %20 = getelementptr inbounds i8, ptr %8, i64 40
  %21 = load i8, ptr %20, align 8
  %22 = or i8 %21, 1
  store i8 %22, ptr %20, align 8
  %23 = add nsw i32 %.057, 1
  br label %27

.thread:                                          ; preds = %.preheader46, %.lr.ph59, %._crit_edge
  %24 = getelementptr inbounds i8, ptr %8, i64 40
  %25 = load i8, ptr %24, align 8
  %26 = and i8 %25, -2
  store i8 %26, ptr %24, align 8
  br label %27

27:                                               ; preds = %.thread, %19
  %.1 = phi i32 [ %23, %19 ], [ %.057, %.thread ]
  %.026 = getelementptr inbounds i8, ptr %.02658, i64 8
  %28 = load ptr, ptr %.026, align 8, !tbaa !5
  %.not34 = icmp eq ptr %28, null
  br i1 %.not34, label %.loopexit48, label %.lr.ph59, !llvm.loop !14

.loopexit48:                                      ; preds = %27
  tail call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, i32 noundef 9091, ptr noundef nonnull @.str.22, i32 noundef %.1) #3
  br i1 %.not, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %.loopexit48.thread69, %.loopexit48
  %.12761 = getelementptr inbounds i8, ptr %6, i64 8
  %29 = load ptr, ptr %.12761, align 8, !tbaa !5
  %.not3762 = icmp eq ptr %29, null
  br i1 %.not3762, label %.loopexit, label %.lr.ph64

.lr.ph64:                                         ; preds = %.preheader, %38
  %30 = phi ptr [ %39, %38 ], [ %29, %.preheader ]
  %.12763 = phi ptr [ %.127, %38 ], [ %.12761, %.preheader ]
  %31 = getelementptr inbounds i8, ptr %30, i64 40
  %32 = load i8, ptr %31, align 8
  %33 = and i8 %32, 1
  %.not38 = icmp eq i8 %33, 0
  br i1 %.not38, label %38, label %34

34:                                               ; preds = %.lr.ph64
  %35 = getelementptr inbounds i8, ptr %30, i64 16
  %36 = load ptr, ptr %35, align 8, !tbaa !15
  %37 = tail call i32 @qh_pointid(ptr noundef %36) #3
  tail call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, i32 noundef 9092, ptr noundef nonnull @.str.22, i32 noundef %37) #3
  br label %38

38:                                               ; preds = %34, %.lr.ph64
  %.127 = getelementptr inbounds i8, ptr %.12763, i64 8
  %39 = load ptr, ptr %.127, align 8, !tbaa !5
  %.not37 = icmp eq ptr %39, null
  br i1 %.not37, label %.loopexit, label %.lr.ph64, !llvm.loop !16

.loopexit:                                        ; preds = %38, %.loopexit48.thread, %.preheader, %.loopexit48
  call void @qh_settempfree(ptr noundef nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  ret void
}

attributes #0 = { mustprogress 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, !6, i64 24}
!10 = !{!"vertexT", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 40, !11, i64 40, !11, i64 40, !11, i64 40, !11, i64 40}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = !{!10, !6, i64 16}
!16 = distinct !{!16, !13}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass