; 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_inuse = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [102 x i8], align 1
@rbox = external dso_local global %struct.rboxT, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @qh_rboxpoints(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca i32, align 4
  %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 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %11 = load i32, ptr @rbox_inuse, align 4, !tbaa !9
  %12 = icmp ne i32 %11, 0
  br i1 %12, label %13, label %14

13:                                               ; preds = %3
  call void (i32, ptr, ...) @qh_fprintf_stderr(i32 noundef 6188, ptr noundef @.str)
  store i32 5, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %34

14:                                               ; preds = %3
  store i32 1, ptr @rbox_inuse, align 4, !tbaa !9
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %15, ptr getelementptr inbounds (%struct.rboxT, ptr @rbox, i32 0, i32 1), align 8, !tbaa !11
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %16, ptr @rbox, align 8, !tbaa !14
  store ptr null, ptr %9, align 8, !tbaa !5
  %17 = call i32 @_setjmp(ptr noundef getelementptr inbounds (%struct.rboxT, ptr @rbox, i32 0, i32 4)) #5
  store i32 %17, ptr %8, align 4, !tbaa !9
  %18 = load i32, ptr %8, align 4, !tbaa !9
  %19 = icmp ne i32 %18, 0
  br i1 %19, label %20, label %27

20:                                               ; preds = %14
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %25

23:                                               ; preds = %20
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  call void @qh_free(ptr noundef %24)
  br label %25

25:                                               ; preds = %23, %20
  store i32 0, ptr @rbox_inuse, align 4, !tbaa !9
  %26 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %26, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %34

27:                                               ; preds = %14
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  call void @qh_rboxpoints2(ptr noundef %28, ptr noundef %9)
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  %30 = icmp ne ptr %29, null
  br i1 %30, label %31, label %33

31:                                               ; preds = %27
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  call void @qh_free(ptr noundef %32)
  br label %33

33:                                               ; preds = %31, %27
  store i32 0, ptr @rbox_inuse, align 4, !tbaa !9
  store i32 0, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %34

34:                                               ; preds = %33, %25, %13
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  %35 = load i32, ptr %4, align 4
  ret i32 %35
}

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

declare void @qh_fprintf_stderr(i32 noundef, ptr noundef, ...) #2

; Function Attrs: nounwind returns_twice
declare i32 @_setjmp(ptr noundef) #3

declare void @qh_free(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @qh_rboxpoints2(ptr noundef, ptr noundef) #0

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 returns_twice "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 #4 = { nounwind }
attributes #5 = { nounwind returns_twice }

!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 8}
!12 = !{!"rboxT", !6, i64 0, !6, i64 8, !10, i64 16, !13, i64 24, !7, i64 32, !7, i64 232}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !6, i64 0}


; 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_inuse = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [102 x i8], align 1
@rbox = external dso_local global %struct.rboxT, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @qh_rboxpoints(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %5 = load i32, ptr @rbox_inuse, align 4, !tbaa !5
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %7, label %6

6:                                                ; preds = %3
  call void (i32, ptr, ...) @qh_fprintf_stderr(i32 noundef 6188, ptr noundef nonnull @.str) #4
  br label %14

7:                                                ; preds = %3
  store i32 1, ptr @rbox_inuse, align 4, !tbaa !5
  store ptr %1, ptr getelementptr inbounds (i8, ptr @rbox, i64 8), align 8, !tbaa !9
  store ptr %0, ptr @rbox, align 8, !tbaa !13
  store ptr null, ptr %4, align 8, !tbaa !14
  %8 = call i32 @_setjmp(ptr noundef nonnull getelementptr inbounds (i8, ptr @rbox, i64 32)) #5
  %.not8 = icmp eq i32 %8, 0
  br i1 %.not8, label %10, label %9

9:                                                ; preds = %7
  store i32 0, ptr @rbox_inuse, align 4, !tbaa !5
  br label %14

10:                                               ; preds = %7
  call void @qh_rboxpoints2(ptr noundef %2, ptr noundef nonnull %4)
  %11 = load ptr, ptr %4, align 8, !tbaa !14
  %.not9 = icmp eq ptr %11, null
  br i1 %.not9, label %13, label %12

12:                                               ; preds = %10
  call void @qh_free(ptr noundef nonnull %11) #4
  br label %13

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

14:                                               ; preds = %13, %9, %6
  %.0 = phi i32 [ 5, %6 ], [ %8, %9 ], [ 0, %13 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  ret i32 %.0
}

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

declare void @qh_fprintf_stderr(i32 noundef, ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: nounwind returns_twice
declare i32 @_setjmp(ptr noundef) local_unnamed_addr #3

declare void @qh_free(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @qh_rboxpoints2(ptr noundef, ptr noundef) local_unnamed_addr #0

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 returns_twice "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 #4 = { nounwind }
attributes #5 = { nounwind returns_twice }

!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, !11, i64 8}
!10 = !{!"rboxT", !11, i64 0, !11, i64 8, !6, i64 16, !12, i64 24, !7, i64 32, !7, i64 232}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!10, !11, i64 0}
!14 = !{!11, !11, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SCCPPass,SROAPass