; LLVM IR from Discngine/fpocket :: src/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.21 = external hidden unnamed_addr constant [477 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.25 = 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.21, 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 %38

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 float
  %33 = load i32, ptr getelementptr inbounds (%struct.qhmemT, ptr @qhmem, i32 0, i32 27), align 4, !tbaa !26
  %34 = sitofp i32 %33 to float
  %35 = fdiv float %32, %34
  %36 = fpext float %35 to double
  call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %29, i32 noundef 9279, ptr noundef @.str.22, i32 noundef %30, double noundef %36)
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %37, i32 noundef 9280, ptr noundef @.str.23)
  br label %38

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

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

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

49:                                               ; preds = %55, %43
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = icmp ne ptr %50, null
  br i1 %51, label %52, label %58

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

55:                                               ; preds = %52
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = load ptr, ptr %56, align 8, !tbaa !5
  store ptr %57, ptr %5, align 8, !tbaa !5
  br label %49, !llvm.loop !31

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

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

69:                                               ; preds = %39
  %70 = load ptr, ptr %2, align 8, !tbaa !5
  call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %70, i32 noundef 9282, ptr noundef @.str.25)
  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.21 = external hidden unnamed_addr constant [477 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.25 = 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.21, 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 %26, 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 float
  %23 = sitofp i32 %19 to float
  %24 = fdiv float %22, %23
  %25 = fpext float %24 to double
  tail call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, i32 noundef 9279, ptr noundef nonnull @.str.22, i32 noundef %19, double noundef %25) #2
  tail call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, i32 noundef 9280, ptr noundef nonnull @.str.23) #2
  br label %26

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

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

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

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

._crit_edge:                                      ; preds = %33, %26
  tail call void (ptr, i32, ptr, ...) @qh_fprintf(ptr noundef %0, i32 noundef 9282, ptr noundef nonnull @.str.25) #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