; LLVM IR from jrl-umi3218/mc_rtc :: 3rd-party/qhull/src/libqhull_r (io_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.facetT = type { double, double, double, ptr, %union.anon, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32 }
%union.anon = type { double }
%struct.setT = type { i32, [1 x %union.setelemT] }
%union.setelemT = type { ptr }
%struct.qhT = type { i32, i32, i32, i32, i32, i32, double, i32, i32, i32, i32, i32, i32, i32, i32, double, double, i32, i32, i32, i32, i32, i32, ptr, i32, i32, ptr, i32, i32, i32, i32, i32, i32, i32, double, double, i32, i32, i32, i32, double, double, i32, i32, double, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [29 x i32], i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, double, i32, i32, i32, i32, i32, i32, i32, i32, double, i32, ptr, ptr, i32, i32, i32, i32, i32, ptr, i32, ptr, i32, [256 x i8], i32, [256 x i8], [512 x i8], i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, double, double, double, double, double, double, double, double, double, double, double, double, double, double, ptr, double, double, double, double, i32, [6 x i8], [1 x %struct.__jmp_buf_tag], [40 x i8], [1 x %struct.__jmp_buf_tag], [40 x i8], ptr, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, i32, ptr, i32, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i64, i32, i32, i32, i32, i32, ptr, ptr, i32, i32, i32, double, i32, double, double, double, i32, i32, i32, i32, i32, double, double, i32, i32, i32, i32, i32, i32, double, double, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr, i32, i32, i32, ptr, double, double, double, double, i32, i32, i32, i32, i32, i32, ptr, i32, i32, [1 x %struct.__jmp_buf_tag], [40 x i8], i32, double, ptr, ptr, ptr, %struct.qhmemT, %struct.qhstatT }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }
%struct.qhmemT = type { i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.qhstatT = type { [249 x %union.intrealT], [259 x i8], [249 x ptr], [249 x i16], [249 x i8], [249 x i8], [9 x %union.intrealT], i32, i32, i32, i32, double }
%union.intrealT = type { double }
%struct.vertexT = type { ptr, ptr, ptr, ptr, i32, i32, i8 }

; 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

; Function Attrs: nounwind uwtable
define dso_local void @qh_facet2point(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #1 {
  %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
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca double, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !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
  %14 = load ptr, ptr %7, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.facetT, ptr %14, i32 0, i32 15
  %16 = load i32, ptr %15, align 8
  %17 = lshr i32 %16, 12
  %18 = and i32 %17, 1
  %19 = xor i32 %18, 0
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %34

21:                                               ; preds = %5
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.facetT, ptr %22, i32 0, i32 8
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = getelementptr inbounds %struct.setT, ptr %24, i32 0, i32 1
  %26 = getelementptr inbounds [1 x %union.setelemT], ptr %25, i64 0, i64 0
  %27 = load ptr, ptr %26, align 8, !tbaa !13
  store ptr %27, ptr %11, align 8, !tbaa !5
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.facetT, ptr %28, i32 0, i32 8
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = getelementptr inbounds %struct.setT, ptr %30, i32 0, i32 1
  %32 = getelementptr inbounds [1 x %union.setelemT], ptr %31, i64 0, i64 1
  %33 = load ptr, ptr %32, align 8, !tbaa !13
  store ptr %33, ptr %12, align 8, !tbaa !5
  br label %47

34:                                               ; preds = %5
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.facetT, ptr %35, i32 0, i32 8
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  %38 = getelementptr inbounds %struct.setT, ptr %37, i32 0, i32 1
  %39 = getelementptr inbounds [1 x %union.setelemT], ptr %38, i64 0, i64 0
  %40 = load ptr, ptr %39, align 8, !tbaa !13
  store ptr %40, ptr %12, align 8, !tbaa !5
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.facetT, ptr %41, i32 0, i32 8
  %43 = load ptr, ptr %42, align 8, !tbaa !9
  %44 = getelementptr inbounds %struct.setT, ptr %43, i32 0, i32 1
  %45 = getelementptr inbounds [1 x %union.setelemT], ptr %44, i64 0, i64 1
  %46 = load ptr, ptr %45, align 8, !tbaa !13
  store ptr %46, ptr %11, align 8, !tbaa !5
  br label %47

47:                                               ; preds = %34, %21
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.qhT, ptr %48, i32 0, i32 258
  %50 = getelementptr inbounds %struct.qhstatT, ptr %49, i32 0, i32 0
  %51 = getelementptr inbounds [249 x %union.intrealT], ptr %50, i64 0, i64 60
  %52 = load i32, ptr %51, align 8, !tbaa !13
  %53 = add nsw i32 %52, 2
  store i32 %53, ptr %51, align 8, !tbaa !13
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = load ptr, ptr %11, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.vertexT, ptr %55, i32 0, i32 2
  %57 = load ptr, ptr %56, align 8, !tbaa !14
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  call void @qh_distplane(ptr noundef %54, ptr noundef %57, ptr noundef %58, ptr noundef %13)
  %59 = load double, ptr %13, align 8, !tbaa !16
  %60 = load ptr, ptr %10, align 8, !tbaa !5
  store double %59, ptr %60, align 8, !tbaa !16
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = load ptr, ptr %11, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.vertexT, ptr %62, i32 0, i32 2
  %64 = load ptr, ptr %63, align 8, !tbaa !14
  %65 = load ptr, ptr %7, align 8, !tbaa !5
  %66 = load double, ptr %13, align 8, !tbaa !16
  %67 = call ptr @qh_projectpoint(ptr noundef %61, ptr noundef %64, ptr noundef %65, double noundef %66)
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %67, ptr %68, align 8, !tbaa !5
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = load ptr, ptr %12, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.vertexT, ptr %70, i32 0, i32 2
  %72 = load ptr, ptr %71, align 8, !tbaa !14
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  call void @qh_distplane(ptr noundef %69, ptr noundef %72, ptr noundef %73, ptr noundef %13)
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = load double, ptr %74, align 8, !tbaa !16
  %76 = load double, ptr %13, align 8, !tbaa !16
  %77 = fcmp ogt double %75, %76
  br i1 %77, label %78, label %81

78:                                               ; preds = %47
  %79 = load double, ptr %13, align 8, !tbaa !16
  %80 = load ptr, ptr %10, align 8, !tbaa !5
  store double %79, ptr %80, align 8, !tbaa !16
  br label %81

81:                                               ; preds = %78, %47
  %82 = load ptr, ptr %6, align 8, !tbaa !5
  %83 = load ptr, ptr %12, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.vertexT, ptr %83, i32 0, i32 2
  %85 = load ptr, ptr %84, align 8, !tbaa !14
  %86 = load ptr, ptr %7, align 8, !tbaa !5
  %87 = load double, ptr %13, align 8, !tbaa !16
  %88 = call ptr @qh_projectpoint(ptr noundef %82, ptr noundef %85, ptr noundef %86, double noundef %87)
  %89 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %88, ptr %89, align 8, !tbaa !5
  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
}

declare void @qh_distplane(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare ptr @qh_projectpoint(ptr noundef, ptr noundef, ptr noundef, double noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 64}
!10 = !{!"facetT", !11, i64 0, !11, i64 8, !11, i64 16, !6, i64 24, !7, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !12, i64 104, !12, i64 108, !12, i64 112, !12, i64 113, !12, i64 113, !12, i64 113, !12, i64 113, !12, i64 113, !12, i64 113, !12, i64 113, !12, i64 114, !12, i64 114, !12, i64 114, !12, i64 114, !12, i64 114, !12, i64 114, !12, i64 114, !12, i64 114, !12, i64 115, !12, i64 115, !12, i64 115, !12, i64 115, !12, i64 115, !12, i64 115, !12, i64 115, !12, i64 115}
!11 = !{!"double", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !6, i64 16}
!15 = !{!"vertexT", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 40, !12, i64 40, !12, i64 40, !12, i64 40, !12, i64 40}
!16 = !{!11, !11, 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"

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

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

; Function Attrs: nounwind uwtable
define dso_local void @qh_facet2point(ptr noundef %0, ptr noundef %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef %4) local_unnamed_addr #1 {
  %6 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  %7 = getelementptr inbounds i8, ptr %1, i64 112
  %8 = load i32, ptr %7, align 8
  %9 = and i32 %8, 4096
  %.not = icmp eq i32 %9, 0
  %10 = getelementptr inbounds i8, ptr %1, i64 64
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %11, i64 8
  %13 = getelementptr inbounds i8, ptr %11, i64 16
  %. = select i1 %.not, ptr %13, ptr %12
  %.25 = select i1 %.not, ptr %12, ptr %13
  %.0 = load ptr, ptr %.25, align 8, !tbaa !12
  %.023 = load ptr, ptr %., align 8, !tbaa !12
  %14 = getelementptr inbounds i8, ptr %0, i64 3904
  %15 = load i32, ptr %14, align 8, !tbaa !12
  %16 = add nsw i32 %15, 2
  store i32 %16, ptr %14, align 8, !tbaa !12
  %17 = getelementptr inbounds i8, ptr %.023, i64 16
  %18 = load ptr, ptr %17, align 8, !tbaa !13
  call void @qh_distplane(ptr noundef %0, ptr noundef %18, ptr noundef nonnull %1, ptr noundef nonnull %6) #3
  %19 = load double, ptr %6, align 8, !tbaa !15
  store double %19, ptr %4, align 8, !tbaa !15
  %20 = load ptr, ptr %17, align 8, !tbaa !13
  %21 = call ptr @qh_projectpoint(ptr noundef %0, ptr noundef %20, ptr noundef nonnull %1, double noundef %19) #3
  store ptr %21, ptr %2, align 8, !tbaa !16
  %22 = getelementptr inbounds i8, ptr %.0, i64 16
  %23 = load ptr, ptr %22, align 8, !tbaa !13
  call void @qh_distplane(ptr noundef %0, ptr noundef %23, ptr noundef nonnull %1, ptr noundef nonnull %6) #3
  %24 = load double, ptr %4, align 8, !tbaa !15
  %25 = load double, ptr %6, align 8, !tbaa !15
  %26 = fcmp ogt double %24, %25
  br i1 %26, label %27, label %28

27:                                               ; preds = %5
  store double %25, ptr %4, align 8, !tbaa !15
  br label %28

28:                                               ; preds = %27, %5
  %29 = load ptr, ptr %22, align 8, !tbaa !13
  %30 = call ptr @qh_projectpoint(ptr noundef nonnull %0, ptr noundef %29, ptr noundef nonnull %1, double noundef %25) #3
  store ptr %30, ptr %3, align 8, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  ret void
}

declare void @qh_distplane(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @qh_projectpoint(ptr noundef, ptr noundef, ptr noundef, double noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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, !10, i64 64}
!6 = !{!"facetT", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !8, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 113, !11, i64 113, !11, i64 113, !11, i64 113, !11, i64 113, !11, i64 113, !11, i64 113, !11, i64 114, !11, i64 114, !11, i64 114, !11, i64 114, !11, i64 114, !11, i64 114, !11, i64 114, !11, i64 114, !11, i64 115, !11, i64 115, !11, i64 115, !11, i64 115, !11, i64 115, !11, i64 115, !11, i64 115, !11, i64 115}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!8, !8, i64 0}
!13 = !{!14, !10, i64 16}
!14 = !{!"vertexT", !10, i64 0, !10, i64 8, !10, i64 16, !10, 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}
!15 = !{!7, !7, i64 0}
!16 = !{!10, !10, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass