; LLVM IR from stan-dev/math :: lib/tbb_2020.3/src/test (test_malloc_compliance)

; 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"

%"class.Harness::internal::Tracer" = type <{ i32, [4 x i8], ptr, ptr, i64, [8 x i8] }>
%struct.RoundRobin = type { i64, %class.CMemTest }
%class.CMemTest = type { i32, i8, ptr }

@__tbb_test_errno = external dso_local global i8, align 1
@_ZN7Harness8internalL6tracerE = external hidden global %"class.Harness::internal::Tracer", align 8
@.str = external hidden unnamed_addr constant [98 x i8], align 1
@Rmalloc = external dso_local global ptr, align 8
@Rcalloc = external dso_local global ptr, align 8
@Rrealloc = external dso_local global ptr, align 8
@Tfree = external dso_local global ptr, align 8
@Rposix_memalign = external dso_local global ptr, align 8
@Raligned_malloc = external dso_local global ptr, align 8
@Raligned_realloc = external dso_local global ptr, align 8
@Taligned_free = external dso_local global ptr, align 8
@error_occurred = external dso_local global i8, align 1
@argC = external dso_local global i32, align 4
@argV = external dso_local global ptr, align 8
@_ZL9MinThread = external hidden global i32, align 4
@_ZL9MaxThread = external hidden global i32, align 4
@.str.46 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZL16perProcessLimits = external hidden global i8, align 1
@_ZL7Verbose = external hidden global i8, align 1
@__FUNCTION__.main = external hidden unnamed_addr constant [5 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8limitMemm(i64 noundef) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN7Harness8internal6Tracer14set_trace_infoEiPKcmS3_(ptr noundef nonnull align 8 dereferenceable(33), i32 noundef, ptr noundef, i64 noundef, ptr noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33), ptr noundef, ...) #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11ReportErrorPKciS0_S0_(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z12ReallocParamv() #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z22CheckArgumentsOverflowv() #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z18LinuxKernelVersionv() #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z16CheckReallocLeakv() #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) #4 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca %struct.RoundRobin, align 8
  %15 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  %16 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %16, ptr @argC, align 4, !tbaa !5
  %17 = load ptr, ptr %5, align 8, !tbaa !9
  store ptr %17, ptr @argV, align 8, !tbaa !9
  store i32 1, ptr @_ZL9MinThread, align 4, !tbaa !5
  store i32 1, ptr @_ZL9MaxThread, align 4, !tbaa !5
  store ptr @scalable_malloc, ptr @Rmalloc, align 8, !tbaa !9
  store ptr @scalable_realloc, ptr @Rrealloc, align 8, !tbaa !9
  store ptr @scalable_calloc, ptr @Rcalloc, align 8, !tbaa !9
  store ptr @scalable_free, ptr @Tfree, align 8, !tbaa !9
  store ptr @scalable_posix_memalign, ptr @Rposix_memalign, align 8, !tbaa !9
  store ptr @scalable_aligned_malloc, ptr @Raligned_malloc, align 8, !tbaa !9
  store ptr @scalable_aligned_realloc, ptr @Raligned_realloc, align 8, !tbaa !9
  store ptr @scalable_aligned_free, ptr @Taligned_free, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #10
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %35, %2
  %19 = load i32, ptr %6, align 4, !tbaa !5
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  store i32 2, ptr %7, align 4
  br label %38

23:                                               ; preds = %18
  %24 = load ptr, ptr %5, align 8, !tbaa !9
  %25 = load i32, ptr %6, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds ptr, ptr %24, i64 %26
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  %29 = call i32 @strcmp(ptr noundef %28, ptr noundef @.str.46) #11
  %30 = icmp eq i32 %29, 0
  br i1 %30, label %31, label %34

31:                                               ; preds = %23
  call void @_ZL15setSystemAllocsv()
  %32 = load i32, ptr @argC, align 4, !tbaa !5
  %33 = add nsw i32 %32, -1
  store i32 %33, ptr @argC, align 4, !tbaa !5
  store i32 2, ptr %7, align 4
  br label %38

34:                                               ; preds = %23
  br label %35

35:                                               ; preds = %34
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %6, align 4, !tbaa !5
  br label %18, !llvm.loop !11

38:                                               ; preds = %31, %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #10
  br label %39

39:                                               ; preds = %38
  %40 = load i32, ptr @argC, align 4, !tbaa !5
  %41 = load ptr, ptr @argV, align 8, !tbaa !9
  call void @_Z16ParseCommandLineiPPc(i32 noundef %40, ptr noundef %41)
  %42 = call noundef i32 @_Z18LinuxKernelVersionv()
  %43 = icmp ult i32 %42, 2006010
  br i1 %43, label %44, label %45

44:                                               ; preds = %39
  store i8 0, ptr @_ZL16perProcessLimits, align 1, !tbaa !13
  br label %45

45:                                               ; preds = %44, %39
  call void @_Z8limitMemm(i64 noundef 200)
  call void @_Z12ReallocParamv()
  call void @_Z8limitMemm(i64 noundef 0)
  store i8 1, ptr @__tbb_test_errno, align 1, !tbaa !13
  call void @_Z22CheckArgumentsOverflowv()
  call void @_Z16CheckReallocLeakv()
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #10
  %46 = load i32, ptr @_ZL9MaxThread, align 4, !tbaa !5
  store i32 %46, ptr %8, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %101, %45
  %48 = load i32, ptr %8, align 4, !tbaa !5
  %49 = load i32, ptr @_ZL9MinThread, align 4, !tbaa !5
  %50 = icmp sge i32 %48, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %47
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #10
  br label %104

52:                                               ; preds = %47
  %53 = load i8, ptr @_ZL7Verbose, align 1, !tbaa !13, !range !15, !noundef !16
  %54 = trunc i8 %53 to i1
  br i1 %54, label %56, label %55

55:                                               ; preds = %52
  br label %59

56:                                               ; preds = %52
  %57 = call noundef ptr @_ZN7Harness8internal6Tracer14set_trace_infoEiPKcmS3_(ptr noundef nonnull align 8 dereferenceable(33) @_ZN7Harness8internalL6tracerE, i32 noundef 0, ptr noundef @.str, i64 noundef 497, ptr noundef @__FUNCTION__.main)
  %58 = load i32, ptr %8, align 4, !tbaa !5
  call void (ptr, ptr, ...) @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33) %57, ptr noundef @.str.47, i32 noundef %58)
  br label %59

59:                                               ; preds = %56, %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #10
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %88, %59
  %61 = load i32, ptr %9, align 4, !tbaa !5
  %62 = icmp slt i32 %61, 2
  br i1 %62, label %64, label %63

63:                                               ; preds = %60
  store i32 8, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #10
  br label %100

64:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #10
  %65 = load i32, ptr %9, align 4, !tbaa !5
  %66 = mul nsw i32 16384, %65
  %67 = sext i32 %66 to i64
  %68 = call i32 @scalable_allocation_mode(i32 noundef 1, i64 noundef %67)
  store i32 %68, ptr %10, align 4, !tbaa !5
  %69 = load i32, ptr %10, align 4, !tbaa !5
  %70 = icmp eq i32 %69, 0
  br i1 %70, label %71, label %72

71:                                               ; preds = %64
  br label %73

72:                                               ; preds = %64
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 501, ptr noundef @.str.48, ptr noundef null)
  br label %73

73:                                               ; preds = %72, %71
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #10
  %74 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 16) #12
  %75 = load i32, ptr %8, align 4, !tbaa !5
  invoke void @_ZN7Harness11SpinBarrierC2Ejb(ptr noundef nonnull align 4 dereferenceable(13) %74, i32 noundef %75, i1 noundef zeroext false)
          to label %76 unwind label %91

76:                                               ; preds = %73
  store ptr %74, ptr %11, align 8, !tbaa !9
  %77 = load i32, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #10
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = load ptr, ptr %11, align 8, !tbaa !9
  %81 = load i8, ptr @_ZL7Verbose, align 1, !tbaa !13, !range !15, !noundef !16
  %82 = trunc i8 %81 to i1
  call void @_ZN10RoundRobinC2ElPN7Harness11SpinBarrierEb(ptr noundef nonnull align 8 dereferenceable(24) %14, i64 noundef %79, ptr noundef %80, i1 noundef zeroext %82)
  invoke void @_Z17NativeParallelForIi10RoundRobinEvT_RKT0_(i32 noundef %77, ptr noundef nonnull align 8 dereferenceable(24) %14)
          to label %83 unwind label %95

83:                                               ; preds = %76
  call void @_ZN10RoundRobinD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #10
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #10
  %84 = load ptr, ptr %11, align 8, !tbaa !9
  %85 = icmp eq ptr %84, null
  br i1 %85, label %87, label %86

86:                                               ; preds = %83
  call void @_ZdlPvm(ptr noundef %84, i64 noundef 16) #13
  br label %87

87:                                               ; preds = %86, %83
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #10
  br label %88

88:                                               ; preds = %87
  %89 = load i32, ptr %9, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %9, align 4, !tbaa !5
  br label %60, !llvm.loop !17

91:                                               ; preds = %73
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %12, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %13, align 4
  call void @_ZdlPvm(ptr noundef %74, i64 noundef 16) #13
  br label %99

95:                                               ; preds = %76
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %12, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %13, align 4
  call void @_ZN10RoundRobinD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #10
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #10
  br label %99

99:                                               ; preds = %95, %91
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #10
  br label %117

100:                                              ; preds = %63
  br label %101

101:                                              ; preds = %100
  %102 = load i32, ptr %8, align 4, !tbaa !5
  %103 = add nsw i32 %102, -1
  store i32 %103, ptr %8, align 4, !tbaa !5
  br label %47, !llvm.loop !18

104:                                              ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #10
  %105 = call i32 @scalable_allocation_mode(i32 noundef 1, i64 noundef 0)
  store i32 %105, ptr %15, align 4, !tbaa !5
  %106 = load i32, ptr %15, align 4, !tbaa !5
  %107 = icmp eq i32 %106, 0
  br i1 %107, label %108, label %109

108:                                              ; preds = %104
  br label %110

109:                                              ; preds = %104
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 508, ptr noundef @.str.48, ptr noundef null)
  br label %110

110:                                              ; preds = %109, %108
  %111 = load i8, ptr @error_occurred, align 1, !tbaa !13, !range !15, !noundef !16
  %112 = trunc i8 %111 to i1
  br i1 %112, label %115, label %113

113:                                              ; preds = %110
  %114 = call noundef ptr @_ZN7Harness8internal6Tracer14set_trace_infoEiPKcmS3_(ptr noundef nonnull align 8 dereferenceable(33) @_ZN7Harness8internalL6tracerE, i32 noundef 0, ptr noundef @.str, i64 noundef 510, ptr noundef @__FUNCTION__.main)
  call void (ptr, ptr, ...) @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33) %114, ptr noundef @.str.49)
  br label %115

115:                                              ; preds = %113, %110
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #10
  %116 = load i32, ptr %3, align 4
  ret i32 %116

117:                                              ; preds = %99
  %118 = load ptr, ptr %12, align 8
  %119 = load i32, ptr %13, align 4
  %120 = insertvalue { ptr, i32 } poison, ptr %118, 0
  %121 = insertvalue { ptr, i32 } %120, i32 %119, 1
  resume { ptr, i32 } %121
}

declare ptr @scalable_malloc(i64 noundef) #5

declare ptr @scalable_realloc(ptr noundef, i64 noundef) #5

declare ptr @scalable_calloc(i64 noundef, i64 noundef) #5

declare void @scalable_free(ptr noundef) #5

declare i32 @scalable_posix_memalign(ptr noundef, i64 noundef, i64 noundef) #5

declare ptr @scalable_aligned_malloc(i64 noundef, i64 noundef) #5

declare ptr @scalable_aligned_realloc(ptr noundef, i64 noundef, i64 noundef) #5

declare void @scalable_aligned_free(ptr noundef) #5

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #6

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL15setSystemAllocsv() #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z16ParseCommandLineiPPc(i32 noundef, ptr noundef) #3

declare i32 @scalable_allocation_mode(i32 noundef, i64 noundef) #5

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #7

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Harness11SpinBarrierC2Ejb(ptr noundef nonnull align 4 dereferenceable(13), i32 noundef, i1 noundef zeroext) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z17NativeParallelForIi10RoundRobinEvT_RKT0_(i32 noundef, ptr noundef nonnull align 8 dereferenceable(24)) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10RoundRobinC2ElPN7Harness11SpinBarrierEb(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef, i1 noundef zeroext) unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN10RoundRobinD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #9 align 2

attributes #0 = { mustprogress 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 = { mustprogress 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 = { inlinehint mustprogress 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 #4 = { mustprogress norecurse 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 #5 = { "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 #6 = { nounwind willreturn memory(read) "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 #7 = { nobuiltin allocsize(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 #8 = { nobuiltin nounwind "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 #9 = { inlinehint mustprogress 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 #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(read) }
attributes #12 = { builtin allocsize(0) }
attributes #13 = { builtin 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


; 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"

%"class.Harness::internal::Tracer" = type <{ i32, [4 x i8], ptr, ptr, i64, [8 x i8] }>
%struct.RoundRobin = type { i64, %class.CMemTest }
%class.CMemTest = type { i32, i8, ptr }

@__tbb_test_errno = external dso_local local_unnamed_addr global i8, align 1
@_ZN7Harness8internalL6tracerE = external hidden global %"class.Harness::internal::Tracer", align 8
@.str = external hidden unnamed_addr constant [98 x i8], align 1
@Rmalloc = external dso_local local_unnamed_addr global ptr, align 8
@Rcalloc = external dso_local local_unnamed_addr global ptr, align 8
@Rrealloc = external dso_local local_unnamed_addr global ptr, align 8
@Tfree = external dso_local local_unnamed_addr global ptr, align 8
@Rposix_memalign = external dso_local local_unnamed_addr global ptr, align 8
@Raligned_malloc = external dso_local local_unnamed_addr global ptr, align 8
@Raligned_realloc = external dso_local local_unnamed_addr global ptr, align 8
@Taligned_free = external dso_local local_unnamed_addr global ptr, align 8
@error_occurred = external dso_local local_unnamed_addr global i8, align 1
@argC = external dso_local local_unnamed_addr global i32, align 4
@argV = external dso_local local_unnamed_addr global ptr, align 8
@_ZL9MinThread = external hidden local_unnamed_addr global i32, align 4
@_ZL9MaxThread = external hidden local_unnamed_addr global i32, align 4
@.str.46 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZL16perProcessLimits = external hidden local_unnamed_addr global i8, align 1
@_ZL7Verbose = external hidden local_unnamed_addr global i8, align 1
@__FUNCTION__.main = external hidden unnamed_addr constant [5 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8limitMemm(i64 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN7Harness8internal6Tracer14set_trace_infoEiPKcmS3_(ptr noundef nonnull align 8 dereferenceable(33), i32 noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33), ptr noundef, ...) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11ReportErrorPKciS0_S0_(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z12ReallocParamv() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z22CheckArgumentsOverflowv() local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z18LinuxKernelVersionv() local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z16CheckReallocLeakv() local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #4 personality ptr @__gxx_personality_v0 {
  %3 = alloca %struct.RoundRobin, align 8
  store i32 %0, ptr @argC, align 4, !tbaa !5
  store ptr %1, ptr @argV, align 8, !tbaa !9
  store i32 1, ptr @_ZL9MinThread, align 4, !tbaa !5
  store i32 1, ptr @_ZL9MaxThread, align 4, !tbaa !5
  store ptr @scalable_malloc, ptr @Rmalloc, align 8, !tbaa !9
  store ptr @scalable_realloc, ptr @Rrealloc, align 8, !tbaa !9
  store ptr @scalable_calloc, ptr @Rcalloc, align 8, !tbaa !9
  store ptr @scalable_free, ptr @Tfree, align 8, !tbaa !9
  store ptr @scalable_posix_memalign, ptr @Rposix_memalign, align 8, !tbaa !9
  store ptr @scalable_aligned_malloc, ptr @Raligned_malloc, align 8, !tbaa !9
  store ptr @scalable_aligned_realloc, ptr @Raligned_realloc, align 8, !tbaa !9
  store ptr @scalable_aligned_free, ptr @Taligned_free, align 8, !tbaa !9
  %4 = icmp sgt i32 %0, 1
  br i1 %4, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %2
  %wide.trip.count = zext nneg i32 %0 to i64
  br label %.lr.ph

5:                                                ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph, !llvm.loop !11

.lr.ph:                                           ; preds = %.lr.ph.preheader, %5
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next, %5 ]
  %6 = getelementptr inbounds ptr, ptr %1, i64 %indvars.iv
  %7 = load ptr, ptr %6, align 8, !tbaa !9
  %8 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.46) #10
  %9 = icmp eq i32 %8, 0
  br i1 %9, label %10, label %5

10:                                               ; preds = %.lr.ph
  tail call void @_ZL15setSystemAllocsv()
  %11 = load i32, ptr @argC, align 4, !tbaa !5
  %12 = add nsw i32 %11, -1
  store i32 %12, ptr @argC, align 4, !tbaa !5
  %.pre = load ptr, ptr @argV, align 8, !tbaa !9
  br label %.loopexit

.loopexit:                                        ; preds = %5, %2, %10
  %13 = phi ptr [ %1, %2 ], [ %.pre, %10 ], [ %1, %5 ]
  %14 = phi i32 [ %0, %2 ], [ %12, %10 ], [ %0, %5 ]
  tail call void @_Z16ParseCommandLineiPPc(i32 noundef %14, ptr noundef %13)
  %15 = tail call noundef i32 @_Z18LinuxKernelVersionv()
  %16 = icmp ult i32 %15, 2006010
  br i1 %16, label %17, label %18

17:                                               ; preds = %.loopexit
  store i8 0, ptr @_ZL16perProcessLimits, align 1, !tbaa !13
  br label %18

18:                                               ; preds = %17, %.loopexit
  tail call void @_Z8limitMemm(i64 noundef 200)
  tail call void @_Z12ReallocParamv()
  tail call void @_Z8limitMemm(i64 noundef 0)
  store i8 1, ptr @__tbb_test_errno, align 1, !tbaa !13
  tail call void @_Z22CheckArgumentsOverflowv()
  tail call void @_Z16CheckReallocLeakv()
  %19 = load i32, ptr @_ZL9MaxThread, align 4, !tbaa !5
  %20 = load i32, ptr @_ZL9MinThread, align 4, !tbaa !5
  %.not30 = icmp slt i32 %19, %20
  br i1 %.not30, label %._crit_edge, label %.lr.ph32.preheader

.lr.ph32.preheader:                               ; preds = %18
  %21 = sext i32 %19 to i64
  br label %.lr.ph32

._crit_edge:                                      ; preds = %48, %18
  %22 = call i32 @scalable_allocation_mode(i32 noundef 1, i64 noundef 0)
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %57, label %56

.lr.ph32:                                         ; preds = %.lr.ph32.preheader, %48
  %indvars.iv39 = phi i64 [ %21, %.lr.ph32.preheader ], [ %indvars.iv.next40, %48 ]
  %24 = load i8, ptr @_ZL7Verbose, align 1, !tbaa !13, !range !15, !noundef !16
  %25 = trunc nuw i8 %24 to i1
  br i1 %25, label %26, label %29

26:                                               ; preds = %.lr.ph32
  %27 = call noundef ptr @_ZN7Harness8internal6Tracer14set_trace_infoEiPKcmS3_(ptr noundef nonnull align 8 dereferenceable(33) @_ZN7Harness8internalL6tracerE, i32 noundef 0, ptr noundef nonnull @.str, i64 noundef 497, ptr noundef nonnull @__FUNCTION__.main)
  %28 = trunc nsw i64 %indvars.iv39 to i32
  call void (ptr, ptr, ...) @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33) %27, ptr noundef nonnull @.str.47, i32 noundef %28)
  br label %29

29:                                               ; preds = %.lr.ph32, %26
  %30 = call i32 @scalable_allocation_mode(i32 noundef 1, i64 noundef 0)
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %33, label %32

32:                                               ; preds = %29
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 501, ptr noundef nonnull @.str.48, ptr noundef null)
  br label %33

33:                                               ; preds = %29, %32
  %34 = call noalias noundef nonnull dereferenceable(16) ptr @_Znwm(i64 noundef 16) #11
  %35 = trunc nsw i64 %indvars.iv39 to i32
  invoke void @_ZN7Harness11SpinBarrierC2Ejb(ptr noundef nonnull align 4 dereferenceable(13) %34, i32 noundef %35, i1 noundef zeroext false)
          to label %36 unwind label %51

36:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #12
  %37 = load i8, ptr @_ZL7Verbose, align 1, !tbaa !13, !range !15, !noundef !16
  %38 = trunc nuw i8 %37 to i1
  call void @_ZN10RoundRobinC2ElPN7Harness11SpinBarrierEb(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %indvars.iv39, ptr noundef nonnull %34, i1 noundef zeroext %38)
  invoke void @_Z17NativeParallelForIi10RoundRobinEvT_RKT0_(i32 noundef %35, ptr noundef nonnull align 8 dereferenceable(24) %3)
          to label %39 unwind label %53

39:                                               ; preds = %36
  call void @_ZN10RoundRobinD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #12
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #12
  call void @_ZdlPvm(ptr noundef nonnull %34, i64 noundef 16) #13
  %40 = call i32 @scalable_allocation_mode(i32 noundef 1, i64 noundef 16384)
  %41 = icmp eq i32 %40, 0
  br i1 %41, label %43, label %42

42:                                               ; preds = %39
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 501, ptr noundef nonnull @.str.48, ptr noundef null)
  br label %43

43:                                               ; preds = %42, %39
  %44 = call noalias noundef nonnull dereferenceable(16) ptr @_Znwm(i64 noundef 16) #11
  invoke void @_ZN7Harness11SpinBarrierC2Ejb(ptr noundef nonnull align 4 dereferenceable(13) %44, i32 noundef %35, i1 noundef zeroext false)
          to label %45 unwind label %51

45:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #12
  %46 = load i8, ptr @_ZL7Verbose, align 1, !tbaa !13, !range !15, !noundef !16
  %47 = trunc nuw i8 %46 to i1
  call void @_ZN10RoundRobinC2ElPN7Harness11SpinBarrierEb(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %indvars.iv39, ptr noundef nonnull %44, i1 noundef zeroext %47)
  invoke void @_Z17NativeParallelForIi10RoundRobinEvT_RKT0_(i32 noundef %35, ptr noundef nonnull align 8 dereferenceable(24) %3)
          to label %48 unwind label %53

48:                                               ; preds = %45
  call void @_ZN10RoundRobinD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #12
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #12
  call void @_ZdlPvm(ptr noundef nonnull %44, i64 noundef 16) #13
  %indvars.iv.next40 = add nsw i64 %indvars.iv39, -1
  %49 = load i32, ptr @_ZL9MinThread, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %.not.not = icmp sgt i64 %indvars.iv39, %50
  br i1 %.not.not, label %.lr.ph32, label %._crit_edge, !llvm.loop !17

51:                                               ; preds = %43, %33
  %.lcssa = phi ptr [ %34, %33 ], [ %44, %43 ]
  %52 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %.lcssa, i64 noundef 16) #13
  br label %55

53:                                               ; preds = %45, %36
  %54 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN10RoundRobinD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #12
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #12
  br label %55

55:                                               ; preds = %53, %51
  %.pn = phi { ptr, i32 } [ %54, %53 ], [ %52, %51 ]
  resume { ptr, i32 } %.pn

56:                                               ; preds = %._crit_edge
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 508, ptr noundef nonnull @.str.48, ptr noundef null)
  br label %57

57:                                               ; preds = %._crit_edge, %56
  %58 = load i8, ptr @error_occurred, align 1, !tbaa !13, !range !15, !noundef !16
  %59 = trunc nuw i8 %58 to i1
  br i1 %59, label %62, label %60

60:                                               ; preds = %57
  %61 = call noundef ptr @_ZN7Harness8internal6Tracer14set_trace_infoEiPKcmS3_(ptr noundef nonnull align 8 dereferenceable(33) @_ZN7Harness8internalL6tracerE, i32 noundef 0, ptr noundef nonnull @.str, i64 noundef 510, ptr noundef nonnull @__FUNCTION__.main)
  call void (ptr, ptr, ...) @_ZN7Harness8internal6Tracer5traceEPKcz(ptr noundef nonnull align 8 dereferenceable(33) %61, ptr noundef nonnull @.str.49)
  br label %62

62:                                               ; preds = %60, %57
  ret i32 0
}

declare ptr @scalable_malloc(i64 noundef) #5

declare ptr @scalable_realloc(ptr noundef, i64 noundef) #5

declare ptr @scalable_calloc(i64 noundef, i64 noundef) #5

declare void @scalable_free(ptr noundef) #5

declare i32 @scalable_posix_memalign(ptr noundef, i64 noundef, i64 noundef) #5

declare ptr @scalable_aligned_malloc(i64 noundef, i64 noundef) #5

declare ptr @scalable_aligned_realloc(ptr noundef, i64 noundef, i64 noundef) #5

declare void @scalable_aligned_free(ptr noundef) #5

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL15setSystemAllocsv() local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z16ParseCommandLineiPPc(i32 noundef, ptr noundef) local_unnamed_addr #3

declare i32 @scalable_allocation_mode(i32 noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #7

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Harness11SpinBarrierC2Ejb(ptr noundef nonnull align 4 dereferenceable(13), i32 noundef, i1 noundef zeroext) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z17NativeParallelForIi10RoundRobinEvT_RKT0_(i32 noundef, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10RoundRobinC2ElPN7Harness11SpinBarrierEb(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef, i1 noundef zeroext) unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN10RoundRobinD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #9 align 2

attributes #0 = { mustprogress 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 = { mustprogress 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 = { inlinehint mustprogress 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 #4 = { mustprogress norecurse 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 #5 = { "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 #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 #7 = { nobuiltin allocsize(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 #8 = { nobuiltin nounwind "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 #9 = { inlinehint mustprogress 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 #10 = { nounwind willreturn memory(read) }
attributes #11 = { builtin allocsize(0) }
attributes #12 = { nounwind }
attributes #13 = { builtin 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !12}


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