; 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

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

12:                                               ; preds = %3
  call void @qh_out1(double noundef 1.000000e+00)
  br label %13

13:                                               ; preds = %12, %3
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %22, %13
  %15 = load i32, ptr %8, align 4, !tbaa !5
  %16 = load i32, ptr %6, align 4, !tbaa !5
  %17 = icmp slt i32 %15, %16
  br i1 %17, label %18, label %25

18:                                               ; preds = %14
  %19 = load ptr, ptr %7, align 8, !tbaa !9
  %20 = getelementptr inbounds double, ptr %19, i32 1
  store ptr %20, ptr %7, align 8, !tbaa !9
  %21 = load double, ptr %19, align 8, !tbaa !11
  call void @qh_out1(double noundef %21)
  br label %22

22:                                               ; preds = %18
  %23 = load i32, ptr %8, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %8, align 4, !tbaa !5
  br label %14, !llvm.loop !13

25:                                               ; preds = %14
  %26 = load ptr, ptr @rbox, align 8, !tbaa !15
  call void (ptr, i32, ptr, ...) @qh_fprintf_rbox(ptr noundef %26, i32 noundef 9396, ptr noundef @.str.24)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #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 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !10, i64 0}
!16 = !{!"rboxT", !10, i64 0, !10, i64 8, !6, i64 16, !12, i64 24, !7, i64 32, !7, i64 232}


; 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

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

4:                                                ; preds = %3
  tail call void @qh_out1(double noundef 1.000000e+00)
  br label %5

5:                                                ; preds = %4, %3
  %6 = icmp sgt i32 %2, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %5, %.lr.ph
  %.07 = phi i32 [ %9, %.lr.ph ], [ 0, %5 ]
  %.056 = phi ptr [ %7, %.lr.ph ], [ %1, %5 ]
  %7 = getelementptr inbounds i8, ptr %.056, i64 8
  %8 = load double, ptr %.056, align 8, !tbaa !5
  tail call void @qh_out1(double noundef %8)
  %9 = add nuw nsw i32 %.07, 1
  %exitcond.not = icmp eq i32 %9, %2
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %5
  %10 = load ptr, ptr @rbox, align 8, !tbaa !11
  tail call void (ptr, i32, ptr, ...) @qh_fprintf_rbox(ptr noundef %10, i32 noundef 9396, ptr noundef nonnull @.str.24) #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 = !{!"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}


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