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

; 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.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 }

@qhmem = external dso_local global %struct.qhmemT, align 8
@.str.22 = external hidden unnamed_addr constant [477 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [3 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

; Function Attrs: nounwind uwtable
declare dso_local void @qh_memcheck() #2

; Function Attrs: nounwind uwtable
define dso_local void @qh_memstatistics(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @qh_memcheck()
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 15), align 4, !tbaa !9
  %8 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 16), align 8, !tbaa !12
  %9 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 17), align 4, !tbaa !13
  %10 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 18), align 8, !tbaa !14
  %11 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 19), align 4, !tbaa !15
  %12 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 25), align 4, !tbaa !16
  %13 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 22), align 8, !tbaa !17
  %14 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 21), align 4, !tbaa !18
  %15 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 11), align 8, !tbaa !19
  %16 = add nsw i32 %14, %15
  %17 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 26), align 8, !tbaa !20
  %18 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 24), align 8, !tbaa !21
  %19 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 23), align 4, !tbaa !22
  %20 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 17), align 4, !tbaa !13
  %21 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 19), align 4, !tbaa !15
  %22 = sub nsw i32 %20, %21
  %23 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 20), align 8, !tbaa !23
  %24 = load i32, ptr @qhmem, align 8, !tbaa !24
  %25 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 1), align 4, !tbaa !25
  call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %6, i32 noundef 9278, ptr noundef @.str.22, i32 noundef %7, i32 noundef %8, i32 noundef %9, i32 noundef %10, i32 noundef %11, i32 noundef %12, i32 noundef %13, i32 noundef %16, i32 noundef %17, i32 noundef %18, i32 noundef %19, i32 noundef %22, i32 noundef %23, i32 noundef %24, i32 noundef %25)
  %26 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 27), align 4, !tbaa !26
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %28, label %37

28:                                               ; preds = %1
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 27), align 4, !tbaa !26
  %31 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 28), align 8, !tbaa !27
  %32 = sitofp i32 %31 to double
  %33 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 27), align 4, !tbaa !26
  %34 = sitofp i32 %33 to double
  %35 = fdiv double %32, %34
  call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %29, i32 noundef 9279, ptr noundef @.str.23, i32 noundef %30, double noundef %35)
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %36, i32 noundef 9280, ptr noundef @.str.24)
  br label %37

37:                                               ; preds = %28, %1
  store i32 0, ptr %3, align 4, !tbaa !28
  br label %38

38:                                               ; preds = %65, %37
  %39 = load i32, ptr %3, align 4, !tbaa !28
  %40 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 2), align 8, !tbaa !29
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %42, label %68

42:                                               ; preds = %38
  store i32 0, ptr %4, align 4, !tbaa !28
  %43 = load ptr, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 6), align 8, !tbaa !30
  %44 = load i32, ptr %3, align 4, !tbaa !28
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds ptr, ptr %43, i64 %45
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  store ptr %47, ptr %5, align 8, !tbaa !5
  br label %48

48:                                               ; preds = %54, %42
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %57

51:                                               ; preds = %48
  %52 = load i32, ptr %4, align 4, !tbaa !28
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %4, align 4, !tbaa !28
  br label %54

54:                                               ; preds = %51
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  store ptr %56, ptr %5, align 8, !tbaa !5
  br label %48, !llvm.loop !31

57:                                               ; preds = %48
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = load ptr, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 7), align 8, !tbaa !33
  %60 = load i32, ptr %3, align 4, !tbaa !28
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds i32, ptr %59, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !28
  %64 = load i32, ptr %4, align 4, !tbaa !28
  call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %58, i32 noundef 9281, ptr noundef @.str.25, i32 noundef %63, i32 noundef %64)
  br label %65

65:                                               ; preds = %57
  %66 = load i32, ptr %3, align 4, !tbaa !28
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %3, align 4, !tbaa !28
  br label %38, !llvm.loop !34

68:                                               ; preds = %38
  %69 = load ptr, ptr %2, align 8, !tbaa !5
  call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %69, i32 noundef 9282, ptr noundef @.str.26)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #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, !11, i64 92}
!10 = !{!"qhmemT", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !11, i64 64, !6, i64 72, !6, i64 80, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !11, i64 128, !11, i64 132, !11, i64 136, !11, i64 140, !11, i64 144}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 96}
!13 = !{!10, !11, i64 100}
!14 = !{!10, !11, i64 104}
!15 = !{!10, !11, i64 108}
!16 = !{!10, !11, i64 132}
!17 = !{!10, !11, i64 120}
!18 = !{!10, !11, i64 116}
!19 = !{!10, !11, i64 64}
!20 = !{!10, !11, i64 136}
!21 = !{!10, !11, i64 128}
!22 = !{!10, !11, i64 124}
!23 = !{!10, !11, i64 112}
!24 = !{!10, !11, i64 0}
!25 = !{!10, !11, i64 4}
!26 = !{!10, !11, i64 140}
!27 = !{!10, !11, i64 144}
!28 = !{!11, !11, i64 0}
!29 = !{!10, !11, i64 8}
!30 = !{!10, !6, i64 24}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = !{!10, !6, i64 32}
!34 = distinct !{!34, !32}


; 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.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 }

@qhmem = external dso_local local_unnamed_addr global %struct.qhmemT, align 8
@.str.22 = external hidden unnamed_addr constant [477 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [3 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local void @qh_memcheck() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @qh_memstatistics(ptr noundef %0) local_unnamed_addr #1 {
  tail call void @qh_memcheck()
  %2 = load i32, ptr getelementptr inbounds (i8, ptr @qhmem, i64 92), align 4, !tbaa !5
  %3 = load i32, ptr getelementptr inbounds (i8, ptr @qhmem, i64 96), align 8, !tbaa !11
  %4 = load i32, ptr getelementptr inbounds (i8, ptr @qhmem, i64 100), align 4, !tbaa !12
  %5 = load i32, ptr getelementptr inbounds (i8, ptr @qhmem, i64 104), align 8, !tbaa !13
  %6 = load i32, ptr getelementptr inbounds (i8, ptr @qhmem, i64 108), align 4, !tbaa !14
  %7 = load i32, ptr getelementptr inbounds (i8, ptr @qhmem, i64 132), align 4, !tbaa !15
  %8 = load i32, ptr getelementptr inbounds (i8, ptr @qhmem, i64 120), align 8, !tbaa !16
  %9 = load i32, ptr getelementptr inbounds (i8, ptr @qhmem, i64 116), align 4, !tbaa !17
  %10 = load i32, ptr getelementptr inbounds (i8, ptr @qhmem, i64 64), align 8, !tbaa !18
  %11 = add nsw i32 %10, %9
  %12 = load i32, ptr getelementptr inbounds (i8, ptr @qhmem, i64 136), align 8, !tbaa !19
  %13 = load i32, ptr getelementptr inbounds (i8, ptr @qhmem, i64 128), align 8, !tbaa !20
  %14 = load i32, ptr getelementptr inbounds (i8, ptr @qhmem, i64 124), align 4, !tbaa !21
  %15 = sub nsw i32 %4, %6
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @qhmem, i64 112), align 8, !tbaa !22
  %17 = load i32, ptr @qhmem, align 8, !tbaa !23
  %18 = load i32, ptr getelementptr inbounds (i8, ptr @qhmem, i64 4), align 4, !tbaa !24
  tail call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, i32 noundef 9278, ptr noundef nonnull @.str.22, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef %7, i32 noundef %8, i32 noundef %11, i32 noundef %12, i32 noundef %13, i32 noundef %14, i32 noundef %15, i32 noundef %16, i32 noundef %17, i32 noundef %18) #2
  %19 = load i32, ptr getelementptr inbounds (i8, ptr @qhmem, i64 140), align 4, !tbaa !25
  %.not = icmp eq i32 %19, 0
  br i1 %.not, label %25, label %20

20:                                               ; preds = %1
  %21 = load i32, ptr getelementptr inbounds (i8, ptr @qhmem, i64 144), align 8, !tbaa !26
  %22 = sitofp i32 %21 to double
  %23 = sitofp i32 %19 to double
  %24 = fdiv double %22, %23
  tail call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, i32 noundef 9279, ptr noundef nonnull @.str.23, i32 noundef %19, double noundef %24) #2
  tail call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, i32 noundef 9280, ptr noundef nonnull @.str.24) #2
  br label %25

25:                                               ; preds = %20, %1
  %26 = load i32, ptr getelementptr inbounds (i8, ptr @qhmem, i64 8), align 8, !tbaa !27
  %27 = icmp sgt i32 %26, 0
  br i1 %27, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %25, %32
  %indvars.iv = phi i64 [ %indvars.iv.next, %32 ], [ 0, %25 ]
  %28 = load ptr, ptr getelementptr inbounds (i8, ptr @qhmem, i64 24), align 8, !tbaa !28
  %29 = getelementptr inbounds ptr, ptr %28, i64 %indvars.iv
  br label %30

30:                                               ; preds = %30, %.lr.ph
  %.012 = phi i32 [ 0, %.lr.ph ], [ %31, %30 ]
  %.0.in = phi ptr [ %29, %.lr.ph ], [ %.0, %30 ]
  %.0 = load ptr, ptr %.0.in, align 8, !tbaa !29
  %.not15 = icmp eq ptr %.0, null
  %31 = add nuw nsw i32 %.012, 1
  br i1 %.not15, label %32, label %30, !llvm.loop !30

32:                                               ; preds = %30
  %33 = load ptr, ptr getelementptr inbounds (i8, ptr @qhmem, i64 32), align 8, !tbaa !32
  %34 = getelementptr inbounds i32, ptr %33, i64 %indvars.iv
  %35 = load i32, ptr %34, align 4, !tbaa !33
  tail call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, i32 noundef 9281, ptr noundef nonnull @.str.25, i32 noundef %35, i32 noundef %.012) #2
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %36 = load i32, ptr getelementptr inbounds (i8, ptr @qhmem, i64 8), align 8, !tbaa !27
  %37 = sext i32 %36 to i64
  %38 = icmp slt i64 %indvars.iv.next, %37
  br i1 %38, label %.lr.ph, label %._crit_edge, !llvm.loop !34

._crit_edge:                                      ; preds = %32, %25
  tail call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, i32 noundef 9282, ptr noundef nonnull @.str.26) #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, !7, i64 92}
!6 = !{!"qhmemT", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !7, i64 64, !10, i64 72, !10, i64 80, !7, i64 88, !7, i64 92, !7, i64 96, !7, i64 100, !7, i64 104, !7, i64 108, !7, i64 112, !7, i64 116, !7, i64 120, !7, i64 124, !7, i64 128, !7, i64 132, !7, i64 136, !7, i64 140, !7, i64 144}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 96}
!12 = !{!6, !7, i64 100}
!13 = !{!6, !7, i64 104}
!14 = !{!6, !7, i64 108}
!15 = !{!6, !7, i64 132}
!16 = !{!6, !7, i64 120}
!17 = !{!6, !7, i64 116}
!18 = !{!6, !7, i64 64}
!19 = !{!6, !7, i64 136}
!20 = !{!6, !7, i64 128}
!21 = !{!6, !7, i64 124}
!22 = !{!6, !7, i64 112}
!23 = !{!6, !7, i64 0}
!24 = !{!6, !7, i64 4}
!25 = !{!6, !7, i64 140}
!26 = !{!6, !7, i64 144}
!27 = !{!6, !7, i64 8}
!28 = !{!6, !10, i64 24}
!29 = !{!10, !10, i64 0}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{!6, !10, i64 32}
!33 = !{!7, !7, i64 0}
!34 = distinct !{!34, !31}


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