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

; 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.rboxT = type { ptr, ptr, i32, double, [1 x %struct.__jmp_buf_tag], [40 x i8] }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@rbox = external dso_local global %struct.rboxT, align 8
@.str.24 = 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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @qh_out1(double noundef) #2

declare i32 @qh_rand() #1

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

17:                                               ; preds = %52, %5
  %18 = load i32, ptr %14, align 4, !tbaa !5
  %19 = load i32, ptr %6, align 4, !tbaa !5
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %21, label %55

21:                                               ; preds = %17
  %22 = load ptr, ptr %9, align 8, !tbaa !11
  store ptr %22, ptr %11, align 8, !tbaa !11
  %23 = load i32, ptr %8, align 4, !tbaa !5
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %26

25:                                               ; preds = %21
  call void @qh_out1(double noundef 1.000000e+00)
  br label %26

26:                                               ; preds = %25, %21
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %47, %26
  %28 = load i32, ptr %15, align 4, !tbaa !5
  %29 = load i32, ptr %10, align 4, !tbaa !5
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %31, label %50

31:                                               ; preds = %27
  %32 = call i32 @qh_rand()
  %33 = sitofp i32 %32 to double
  store double %33, ptr %12, align 8, !tbaa !9
  %34 = load double, ptr %12, align 8, !tbaa !9
  %35 = fmul double 2.000000e+00, %34
  %36 = load double, ptr %16, align 8, !tbaa !9
  %37 = fdiv double %35, %36
  %38 = fsub double %37, 1.000000e+00
  store double %38, ptr %13, align 8, !tbaa !9
  %39 = load double, ptr %7, align 8, !tbaa !9
  %40 = load double, ptr %13, align 8, !tbaa !9
  %41 = fmul double %40, %39
  store double %41, ptr %13, align 8, !tbaa !9
  %42 = load ptr, ptr %11, align 8, !tbaa !11
  %43 = getelementptr inbounds double, ptr %42, i32 1
  store ptr %43, ptr %11, align 8, !tbaa !11
  %44 = load double, ptr %42, align 8, !tbaa !9
  %45 = load double, ptr %13, align 8, !tbaa !9
  %46 = fadd double %44, %45
  call void @qh_out1(double noundef %46)
  br label %47

47:                                               ; preds = %31
  %48 = load i32, ptr %15, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %15, align 4, !tbaa !5
  br label %27, !llvm.loop !13

50:                                               ; preds = %27
  %51 = load ptr, ptr @rbox, align 8, !tbaa !15
  call void (ptr, i32, ptr, ...) @qh_fprintf_rbox(ptr noundef %51, i32 noundef 9410, ptr noundef @.str.24)
  br label %52

52:                                               ; preds = %50
  %53 = load i32, ptr %14, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %14, align 4, !tbaa !5
  br label %17, !llvm.loop !17

55:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #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 = !{!"int", !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 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !12, i64 0}
!16 = !{!"rboxT", !12, i64 0, !12, i64 8, !6, i64 16, !10, i64 24, !7, i64 32, !7, i64 232}
!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"

%struct.rboxT = type { ptr, ptr, i32, double, [1 x %struct.__jmp_buf_tag], [40 x i8] }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@rbox = external dso_local local_unnamed_addr global %struct.rboxT, align 8
@.str.24 = external hidden unnamed_addr constant [2 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local void @qh_out1(double noundef) local_unnamed_addr #1

declare i32 @qh_rand() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @qh_outcoincident(i32 noundef %0, double noundef %1, i32 noundef %2, ptr nocapture noundef readonly %3, i32 noundef %4) local_unnamed_addr #1 {
  %6 = icmp sgt i32 %0, 0
  br i1 %6, label %.lr.ph19, label %._crit_edge20

.lr.ph19:                                         ; preds = %5
  %.not = icmp eq i32 %2, 0
  %7 = icmp sgt i32 %4, 0
  br i1 %7, label %.lr.ph19.split.us, label %.lr.ph19.split

.lr.ph19.split.us:                                ; preds = %.lr.ph19
  br i1 %.not, label %.lr.ph.us.us, label %.lr.ph.us

.lr.ph.us.us:                                     ; preds = %.lr.ph19.split.us, %._crit_edge.us.us
  %.01417.us.us = phi i32 [ %20, %._crit_edge.us.us ], [ 0, %.lr.ph19.split.us ]
  br label %8

8:                                                ; preds = %8, %.lr.ph.us.us
  %.016.us.us = phi ptr [ %3, %.lr.ph.us.us ], [ %15, %8 ]
  %.01315.us.us = phi i32 [ 0, %.lr.ph.us.us ], [ %18, %8 ]
  %9 = tail call i32 @qh_rand() #2
  %10 = sitofp i32 %9 to double
  %11 = fmul double %10, 2.000000e+00
  %12 = fdiv double %11, 0x41DFFFFFFF800000
  %13 = fadd double %12, -1.000000e+00
  %14 = fmul double %13, %1
  %15 = getelementptr inbounds i8, ptr %.016.us.us, i64 8
  %16 = load double, ptr %.016.us.us, align 8, !tbaa !5
  %17 = fadd double %16, %14
  tail call void @qh_out1(double noundef %17)
  %18 = add nuw nsw i32 %.01315.us.us, 1
  %exitcond28.not = icmp eq i32 %18, %4
  br i1 %exitcond28.not, label %._crit_edge.us.us, label %8, !llvm.loop !9

._crit_edge.us.us:                                ; preds = %8
  %19 = load ptr, ptr @rbox, align 8, !tbaa !11
  tail call void (ptr, i32, ptr, ...) @qh_fprintf_rbox(ptr noundef %19, i32 noundef 9410, ptr noundef nonnull @.str.24) #2
  %20 = add nuw nsw i32 %.01417.us.us, 1
  %exitcond29.not = icmp eq i32 %20, %0
  br i1 %exitcond29.not, label %._crit_edge20, label %.lr.ph.us.us, !llvm.loop !15

.lr.ph.us:                                        ; preds = %.lr.ph19.split.us, %._crit_edge.us
  %.01417.us = phi i32 [ %33, %._crit_edge.us ], [ 0, %.lr.ph19.split.us ]
  tail call void @qh_out1(double noundef 1.000000e+00)
  br label %21

21:                                               ; preds = %.lr.ph.us, %21
  %.016.us = phi ptr [ %3, %.lr.ph.us ], [ %28, %21 ]
  %.01315.us = phi i32 [ 0, %.lr.ph.us ], [ %31, %21 ]
  %22 = tail call i32 @qh_rand() #2
  %23 = sitofp i32 %22 to double
  %24 = fmul double %23, 2.000000e+00
  %25 = fdiv double %24, 0x41DFFFFFFF800000
  %26 = fadd double %25, -1.000000e+00
  %27 = fmul double %26, %1
  %28 = getelementptr inbounds i8, ptr %.016.us, i64 8
  %29 = load double, ptr %.016.us, align 8, !tbaa !5
  %30 = fadd double %29, %27
  tail call void @qh_out1(double noundef %30)
  %31 = add nuw nsw i32 %.01315.us, 1
  %exitcond26.not = icmp eq i32 %31, %4
  br i1 %exitcond26.not, label %._crit_edge.us, label %21, !llvm.loop !9

._crit_edge.us:                                   ; preds = %21
  %32 = load ptr, ptr @rbox, align 8, !tbaa !11
  tail call void (ptr, i32, ptr, ...) @qh_fprintf_rbox(ptr noundef %32, i32 noundef 9410, ptr noundef nonnull @.str.24) #2
  %33 = add nuw nsw i32 %.01417.us, 1
  %exitcond27.not = icmp eq i32 %33, %0
  br i1 %exitcond27.not, label %._crit_edge20, label %.lr.ph.us, !llvm.loop !15

.lr.ph19.split:                                   ; preds = %.lr.ph19
  br i1 %.not, label %.lr.ph19.split.split.us, label %.lr.ph19.split.split

.lr.ph19.split.split.us:                          ; preds = %.lr.ph19.split, %.lr.ph19.split.split.us
  %.01417.us21 = phi i32 [ %35, %.lr.ph19.split.split.us ], [ 0, %.lr.ph19.split ]
  %34 = load ptr, ptr @rbox, align 8, !tbaa !11
  tail call void (ptr, i32, ptr, ...) @qh_fprintf_rbox(ptr noundef %34, i32 noundef 9410, ptr noundef nonnull @.str.24) #2
  %35 = add nuw nsw i32 %.01417.us21, 1
  %exitcond25.not = icmp eq i32 %35, %0
  br i1 %exitcond25.not, label %._crit_edge20, label %.lr.ph19.split.split.us, !llvm.loop !15

.lr.ph19.split.split:                             ; preds = %.lr.ph19.split, %.lr.ph19.split.split
  %.01417 = phi i32 [ %37, %.lr.ph19.split.split ], [ 0, %.lr.ph19.split ]
  tail call void @qh_out1(double noundef 1.000000e+00)
  %36 = load ptr, ptr @rbox, align 8, !tbaa !11
  tail call void (ptr, i32, ptr, ...) @qh_fprintf_rbox(ptr noundef %36, i32 noundef 9410, ptr noundef nonnull @.str.24) #2
  %37 = add nuw nsw i32 %.01417, 1
  %exitcond.not = icmp eq i32 %37, %0
  br i1 %exitcond.not, label %._crit_edge20, label %.lr.ph19.split.split, !llvm.loop !15

._crit_edge20:                                    ; preds = %.lr.ph19.split.split, %.lr.ph19.split.split.us, %._crit_edge.us, %._crit_edge.us.us, %5
  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"}
!11 = !{!12, !13, i64 0}
!12 = !{!"rboxT", !13, i64 0, !13, i64 8, !14, i64 16, !6, i64 24, !7, i64 32, !7, i64 232}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = distinct !{!15, !10}


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