; LLVM IR from MostafaTwfiq/C-DataStructures-And-Algorithms :: Unit Test/Tests/DataStructuresTests/ListsTest/ArrayListTest (ArrayListTest)

; 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.ArrayListTestStruct = type { i32, ptr }

@.str = external hidden unnamed_addr constant [154 x i8], align 1
@__const.generalArrayListTest.numbersStr = external hidden unnamed_addr constant [10 x [6 x i8]], align 16
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [4 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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 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
declare ptr @strcpy(ptr noundef, ptr noundef) #2

declare ptr @arrayListInitialization(i32 noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind
declare void @free(ptr noundef) #2

declare void @CuAssertIntEquals_LineMsg(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) #3

declare void @destroyArrayList(ptr noundef) #3

declare void @arrayListAdd(ptr noundef, ptr noundef) #3

declare void @arrayListAddAtIndex(ptr noundef, ptr noundef, i32 noundef) #3

declare void @CuAssertStrEquals_LineMsg(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #3

declare void @arrayListAddAll(ptr noundef, ptr noundef, i32 noundef) #3

declare ptr @arrayListRemoveAtIndexWtFr(ptr noundef, i32 noundef) #3

declare i32 @arrayListContains(ptr noundef, ptr noundef) #3

declare i32 @arrayListGetIndex(ptr noundef, ptr noundef) #3

declare i32 @arrayListGetLastIndex(ptr noundef, ptr noundef) #3

declare ptr @arrayListGet(ptr noundef, i32 noundef) #3

declare i32 @arrayListGetLength(ptr noundef) #3

declare i32 @arrayListIsEmpty(ptr noundef) #3

declare void @clearArrayList(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @freeArrayListTestStruct(ptr noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local i32 @arrayListTestStructComp(ptr noundef, ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local void @generalArrayListTest(ptr noundef %0) #4 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca [10 x [6 x i8]], align 16
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %9 = call ptr @arrayListInitialization(i32 noundef 5, ptr noundef @freeArrayListTestStruct, ptr noundef @arrayListTestStructComp)
  store ptr %9, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 60, ptr %4) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %4, ptr align 16 @__const.generalArrayListTest.numbersStr, i64 60, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = call i32 @arrayListIsEmpty(ptr noundef %11)
  call void @CuAssertIntEquals_LineMsg(ptr noundef %10, ptr noundef @.str, i32 noundef 701, ptr noundef null, i32 noundef 1, i32 noundef %12)
  %13 = call noalias ptr @malloc(i64 noundef 16) #7
  store ptr %13, ptr %5, align 8, !tbaa !5
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %14, i32 0, i32 0
  store i32 1, ptr %15, align 8, !tbaa !9
  %16 = call noalias ptr @malloc(i64 noundef 4) #7
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %17, i32 0, i32 1
  store ptr %16, ptr %18, align 8, !tbaa !12
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %19, i32 0, i32 1
  %21 = load ptr, ptr %20, align 8, !tbaa !12
  %22 = call ptr @strcpy(ptr noundef %21, ptr noundef @.str.6) #6
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  call void @arrayListAdd(ptr noundef %23, ptr noundef %24)
  %25 = call noalias ptr @malloc(i64 noundef 16) #7
  store ptr %25, ptr %5, align 8, !tbaa !5
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %26, i32 0, i32 0
  store i32 3, ptr %27, align 8, !tbaa !9
  %28 = call noalias ptr @malloc(i64 noundef 6) #7
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %29, i32 0, i32 1
  store ptr %28, ptr %30, align 8, !tbaa !12
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %31, i32 0, i32 1
  %33 = load ptr, ptr %32, align 8, !tbaa !12
  %34 = call ptr @strcpy(ptr noundef %33, ptr noundef @.str.7) #6
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  call void @arrayListAdd(ptr noundef %35, ptr noundef %36)
  %37 = call noalias ptr @malloc(i64 noundef 16) #7
  store ptr %37, ptr %5, align 8, !tbaa !5
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %38, i32 0, i32 0
  store i32 2, ptr %39, align 8, !tbaa !9
  %40 = call noalias ptr @malloc(i64 noundef 4) #7
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %41, i32 0, i32 1
  store ptr %40, ptr %42, align 8, !tbaa !12
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %43, i32 0, i32 1
  %45 = load ptr, ptr %44, align 8, !tbaa !12
  %46 = call ptr @strcpy(ptr noundef %45, ptr noundef @.str.8) #6
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  call void @arrayListAddAtIndex(ptr noundef %47, ptr noundef %48, i32 noundef 1)
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = call i32 @arrayListGetLength(ptr noundef %50)
  call void @CuAssertIntEquals_LineMsg(ptr noundef %49, ptr noundef @.str, i32 noundef 721, ptr noundef null, i32 noundef 3, i32 noundef %51)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %52 = call noalias ptr @malloc(i64 noundef 24) #7
  store ptr %52, ptr %6, align 8, !tbaa !5
  %53 = call noalias ptr @malloc(i64 noundef 16) #7
  store ptr %53, ptr %5, align 8, !tbaa !5
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %54, i32 0, i32 0
  store i32 4, ptr %55, align 8, !tbaa !9
  %56 = call noalias ptr @malloc(i64 noundef 5) #7
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %57, i32 0, i32 1
  store ptr %56, ptr %58, align 8, !tbaa !12
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %59, i32 0, i32 1
  %61 = load ptr, ptr %60, align 8, !tbaa !12
  %62 = call ptr @strcpy(ptr noundef %61, ptr noundef @.str.9) #6
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds ptr, ptr %64, i64 0
  store ptr %63, ptr %65, align 8, !tbaa !5
  %66 = call noalias ptr @malloc(i64 noundef 16) #7
  store ptr %66, ptr %5, align 8, !tbaa !5
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %67, i32 0, i32 0
  store i32 5, ptr %68, align 8, !tbaa !9
  %69 = call noalias ptr @malloc(i64 noundef 5) #7
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %70, i32 0, i32 1
  store ptr %69, ptr %71, align 8, !tbaa !12
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %72, i32 0, i32 1
  %74 = load ptr, ptr %73, align 8, !tbaa !12
  %75 = call ptr @strcpy(ptr noundef %74, ptr noundef @.str.10) #6
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = getelementptr inbounds ptr, ptr %77, i64 1
  store ptr %76, ptr %78, align 8, !tbaa !5
  %79 = call noalias ptr @malloc(i64 noundef 16) #7
  store ptr %79, ptr %5, align 8, !tbaa !5
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %80, i32 0, i32 0
  store i32 6, ptr %81, align 8, !tbaa !9
  %82 = call noalias ptr @malloc(i64 noundef 4) #7
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %83, i32 0, i32 1
  store ptr %82, ptr %84, align 8, !tbaa !12
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %85, i32 0, i32 1
  %87 = load ptr, ptr %86, align 8, !tbaa !12
  %88 = call ptr @strcpy(ptr noundef %87, ptr noundef @.str.11) #6
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = load ptr, ptr %6, align 8, !tbaa !5
  %91 = getelementptr inbounds ptr, ptr %90, i64 2
  store ptr %89, ptr %91, align 8, !tbaa !5
  %92 = load ptr, ptr %3, align 8, !tbaa !5
  %93 = load ptr, ptr %6, align 8, !tbaa !5
  call void @arrayListAddAll(ptr noundef %92, ptr noundef %93, i32 noundef 3)
  %94 = load ptr, ptr %2, align 8, !tbaa !5
  %95 = load ptr, ptr %3, align 8, !tbaa !5
  %96 = call i32 @arrayListGetLength(ptr noundef %95)
  call void @CuAssertIntEquals_LineMsg(ptr noundef %94, ptr noundef @.str, i32 noundef 745, ptr noundef null, i32 noundef 6, i32 noundef %96)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !13
  br label %97

97:                                               ; preds = %131, %1
  %98 = load i32, ptr %7, align 4, !tbaa !13
  %99 = load ptr, ptr %3, align 8, !tbaa !5
  %100 = call i32 @arrayListGetLength(ptr noundef %99)
  %101 = icmp slt i32 %98, %100
  br i1 %101, label %103, label %102

102:                                              ; preds = %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %134

103:                                              ; preds = %97
  %104 = load ptr, ptr %3, align 8, !tbaa !5
  %105 = load i32, ptr %7, align 4, !tbaa !13
  %106 = call ptr @arrayListGet(ptr noundef %104, i32 noundef %105)
  store ptr %106, ptr %5, align 8, !tbaa !5
  %107 = load ptr, ptr %2, align 8, !tbaa !5
  %108 = load i32, ptr %7, align 4, !tbaa !13
  %109 = add nsw i32 %108, 1
  %110 = load ptr, ptr %5, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %110, i32 0, i32 0
  %112 = load i32, ptr %111, align 8, !tbaa !9
  call void @CuAssertIntEquals_LineMsg(ptr noundef %107, ptr noundef @.str, i32 noundef 749, ptr noundef null, i32 noundef %109, i32 noundef %112)
  %113 = load ptr, ptr %2, align 8, !tbaa !5
  %114 = load i32, ptr %7, align 4, !tbaa !13
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [10 x [6 x i8]], ptr %4, i64 0, i64 %115
  %117 = getelementptr inbounds [6 x i8], ptr %116, i64 0, i64 0
  %118 = load ptr, ptr %5, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.ArrayListTestStruct, ptr %118, i32 0, i32 1
  %120 = load ptr, ptr %119, align 8, !tbaa !12
  call void @CuAssertStrEquals_LineMsg(ptr noundef %113, ptr noundef @.str, i32 noundef 750, ptr noundef null, ptr noundef %117, ptr noundef %120)
  %121 = load ptr, ptr %2, align 8, !tbaa !5
  %122 = load i32, ptr %7, align 4, !tbaa !13
  %123 = load ptr, ptr %3, align 8, !tbaa !5
  %124 = load ptr, ptr %5, align 8, !tbaa !5
  %125 = call i32 @arrayListGetIndex(ptr noundef %123, ptr noundef %124)
  call void @CuAssertIntEquals_LineMsg(ptr noundef %121, ptr noundef @.str, i32 noundef 751, ptr noundef null, i32 noundef %122, i32 noundef %125)
  %126 = load ptr, ptr %2, align 8, !tbaa !5
  %127 = load i32, ptr %7, align 4, !tbaa !13
  %128 = load ptr, ptr %3, align 8, !tbaa !5
  %129 = load ptr, ptr %5, align 8, !tbaa !5
  %130 = call i32 @arrayListGetLastIndex(ptr noundef %128, ptr noundef %129)
  call void @CuAssertIntEquals_LineMsg(ptr noundef %126, ptr noundef @.str, i32 noundef 752, ptr noundef null, i32 noundef %127, i32 noundef %130)
  br label %131

131:                                              ; preds = %103
  %132 = load i32, ptr %7, align 4, !tbaa !13
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %7, align 4, !tbaa !13
  br label %97, !llvm.loop !14

134:                                              ; preds = %102
  %135 = load ptr, ptr %2, align 8, !tbaa !5
  %136 = load ptr, ptr %3, align 8, !tbaa !5
  %137 = call i32 @arrayListIsEmpty(ptr noundef %136)
  call void @CuAssertIntEquals_LineMsg(ptr noundef %135, ptr noundef @.str, i32 noundef 755, ptr noundef null, i32 noundef 0, i32 noundef %137)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !13
  br label %138

138:                                              ; preds = %144, %134
  %139 = load i32, ptr %8, align 4, !tbaa !13
  %140 = load ptr, ptr %3, align 8, !tbaa !5
  %141 = call i32 @arrayListGetLength(ptr noundef %140)
  %142 = icmp slt i32 %139, %141
  br i1 %142, label %144, label %143

143:                                              ; preds = %138
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %160

144:                                              ; preds = %138
  %145 = load ptr, ptr %3, align 8, !tbaa !5
  %146 = load i32, ptr %8, align 4, !tbaa !13
  %147 = call ptr @arrayListGet(ptr noundef %145, i32 noundef %146)
  store ptr %147, ptr %5, align 8, !tbaa !5
  %148 = load ptr, ptr %2, align 8, !tbaa !5
  %149 = load ptr, ptr %3, align 8, !tbaa !5
  %150 = load ptr, ptr %5, align 8, !tbaa !5
  %151 = call i32 @arrayListContains(ptr noundef %149, ptr noundef %150)
  call void @CuAssertIntEquals_LineMsg(ptr noundef %148, ptr noundef @.str, i32 noundef 759, ptr noundef null, i32 noundef 1, i32 noundef %151)
  %152 = load ptr, ptr %3, align 8, !tbaa !5
  %153 = load i32, ptr %8, align 4, !tbaa !13
  %154 = call ptr @arrayListRemoveAtIndexWtFr(ptr noundef %152, i32 noundef %153)
  %155 = load ptr, ptr %2, align 8, !tbaa !5
  %156 = load ptr, ptr %3, align 8, !tbaa !5
  %157 = load ptr, ptr %5, align 8, !tbaa !5
  %158 = call i32 @arrayListContains(ptr noundef %156, ptr noundef %157)
  call void @CuAssertIntEquals_LineMsg(ptr noundef %155, ptr noundef @.str, i32 noundef 761, ptr noundef null, i32 noundef 0, i32 noundef %158)
  %159 = load ptr, ptr %5, align 8, !tbaa !5
  call void @freeArrayListTestStruct(ptr noundef %159)
  br label %138, !llvm.loop !16

160:                                              ; preds = %143
  %161 = load ptr, ptr %3, align 8, !tbaa !5
  call void @clearArrayList(ptr noundef %161)
  %162 = load ptr, ptr %6, align 8, !tbaa !5
  call void @free(ptr noundef %162) #6
  %163 = load ptr, ptr %3, align 8, !tbaa !5
  call void @destroyArrayList(ptr noundef %163)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 60, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

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

!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 0}
!10 = !{!"ArrayListTestStruct", !11, i64 0, !6, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = !{!11, !11, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


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

@.str = external hidden unnamed_addr constant [154 x i8], align 1
@__const.generalArrayListTest.numbersStr = external hidden unnamed_addr constant [10 x [6 x i8]], align 16
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [4 x i8], align 1

; 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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #2

declare ptr @arrayListInitialization(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

declare void @CuAssertIntEquals_LineMsg(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

declare void @destroyArrayList(ptr noundef) local_unnamed_addr #3

declare void @arrayListAdd(ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @arrayListAddAtIndex(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

declare void @CuAssertStrEquals_LineMsg(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @arrayListAddAll(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

declare ptr @arrayListRemoveAtIndexWtFr(ptr noundef, i32 noundef) local_unnamed_addr #3

declare i32 @arrayListContains(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @arrayListGetIndex(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @arrayListGetLastIndex(ptr noundef, ptr noundef) local_unnamed_addr #3

declare ptr @arrayListGet(ptr noundef, i32 noundef) local_unnamed_addr #3

declare i32 @arrayListGetLength(ptr noundef) local_unnamed_addr #3

declare i32 @arrayListIsEmpty(ptr noundef) local_unnamed_addr #3

declare void @clearArrayList(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local void @freeArrayListTestStruct(ptr noundef) #5

; Function Attrs: nounwind uwtable
declare dso_local i32 @arrayListTestStructComp(ptr noundef, ptr noundef) #5

; Function Attrs: nounwind uwtable
define dso_local void @generalArrayListTest(ptr noundef %0) local_unnamed_addr #5 {
  %2 = alloca [10 x [6 x i8]], align 16
  %3 = tail call ptr @arrayListInitialization(i32 noundef 5, ptr noundef nonnull @freeArrayListTestStruct, ptr noundef nonnull @arrayListTestStructComp) #7
  call void @llvm.lifetime.start.p0(i64 60, ptr nonnull %2) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) %2, ptr noundef nonnull align 16 dereferenceable(60) @__const.generalArrayListTest.numbersStr, i64 60, i1 false)
  %4 = tail call i32 @arrayListIsEmpty(ptr noundef %3) #7
  tail call void @CuAssertIntEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 701, ptr noundef null, i32 noundef 1, i32 noundef %4) #7
  %5 = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #8
  store i32 1, ptr %5, align 8, !tbaa !5
  %6 = tail call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #8
  %7 = getelementptr inbounds i8, ptr %5, i64 8
  store ptr %6, ptr %7, align 8, !tbaa !11
  %8 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.6) #7
  tail call void @arrayListAdd(ptr noundef %3, ptr noundef nonnull %5) #7
  %9 = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #8
  store i32 3, ptr %9, align 8, !tbaa !5
  %10 = tail call noalias dereferenceable_or_null(6) ptr @malloc(i64 noundef 6) #8
  %11 = getelementptr inbounds i8, ptr %9, i64 8
  store ptr %10, ptr %11, align 8, !tbaa !11
  %12 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %10, ptr noundef nonnull dereferenceable(1) @.str.7) #7
  tail call void @arrayListAdd(ptr noundef %3, ptr noundef nonnull %9) #7
  %13 = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #8
  store i32 2, ptr %13, align 8, !tbaa !5
  %14 = tail call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #8
  %15 = getelementptr inbounds i8, ptr %13, i64 8
  store ptr %14, ptr %15, align 8, !tbaa !11
  %16 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %14, ptr noundef nonnull dereferenceable(1) @.str.8) #7
  tail call void @arrayListAddAtIndex(ptr noundef %3, ptr noundef nonnull %13, i32 noundef 1) #7
  %17 = tail call i32 @arrayListGetLength(ptr noundef %3) #7
  tail call void @CuAssertIntEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 721, ptr noundef null, i32 noundef 3, i32 noundef %17) #7
  %18 = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #8
  %19 = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #8
  store i32 4, ptr %19, align 8, !tbaa !5
  %20 = tail call noalias dereferenceable_or_null(5) ptr @malloc(i64 noundef 5) #8
  %21 = getelementptr inbounds i8, ptr %19, i64 8
  store ptr %20, ptr %21, align 8, !tbaa !11
  %22 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %20, ptr noundef nonnull dereferenceable(1) @.str.9) #7
  store ptr %19, ptr %18, align 8, !tbaa !12
  %23 = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #8
  store i32 5, ptr %23, align 8, !tbaa !5
  %24 = tail call noalias dereferenceable_or_null(5) ptr @malloc(i64 noundef 5) #8
  %25 = getelementptr inbounds i8, ptr %23, i64 8
  store ptr %24, ptr %25, align 8, !tbaa !11
  %26 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %24, ptr noundef nonnull dereferenceable(1) @.str.10) #7
  %27 = getelementptr inbounds i8, ptr %18, i64 8
  store ptr %23, ptr %27, align 8, !tbaa !12
  %28 = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #8
  store i32 6, ptr %28, align 8, !tbaa !5
  %29 = tail call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #8
  %30 = getelementptr inbounds i8, ptr %28, i64 8
  store ptr %29, ptr %30, align 8, !tbaa !11
  %31 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %29, ptr noundef nonnull dereferenceable(1) @.str.11) #7
  %32 = getelementptr inbounds i8, ptr %18, i64 16
  store ptr %28, ptr %32, align 8, !tbaa !12
  tail call void @arrayListAddAll(ptr noundef %3, ptr noundef nonnull %18, i32 noundef 3) #7
  %33 = tail call i32 @arrayListGetLength(ptr noundef %3) #7
  tail call void @CuAssertIntEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 745, ptr noundef null, i32 noundef 6, i32 noundef %33) #7
  %34 = tail call i32 @arrayListGetLength(ptr noundef %3) #7
  %35 = icmp sgt i32 %34, 0
  br i1 %35, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %1
  %36 = call i32 @arrayListIsEmpty(ptr noundef %3) #7
  call void @CuAssertIntEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 755, ptr noundef null, i32 noundef 0, i32 noundef %36) #7
  %37 = call i32 @arrayListGetLength(ptr noundef %3) #7
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %.lr.ph76, label %._crit_edge77

.lr.ph:                                           ; preds = %1, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %1 ]
  %39 = trunc nuw nsw i64 %indvars.iv to i32
  %40 = call ptr @arrayListGet(ptr noundef %3, i32 noundef %39) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %41 = load i32, ptr %40, align 8, !tbaa !5
  %42 = trunc nuw nsw i64 %indvars.iv.next to i32
  call void @CuAssertIntEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 749, ptr noundef null, i32 noundef %42, i32 noundef %41) #7
  %43 = getelementptr inbounds [10 x [6 x i8]], ptr %2, i64 0, i64 %indvars.iv
  %44 = getelementptr inbounds i8, ptr %40, i64 8
  %45 = load ptr, ptr %44, align 8, !tbaa !11
  call void @CuAssertStrEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 750, ptr noundef null, ptr noundef nonnull %43, ptr noundef %45) #7
  %46 = call i32 @arrayListGetIndex(ptr noundef %3, ptr noundef nonnull %40) #7
  call void @CuAssertIntEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 751, ptr noundef null, i32 noundef %39, i32 noundef %46) #7
  %47 = call i32 @arrayListGetLastIndex(ptr noundef %3, ptr noundef nonnull %40) #7
  call void @CuAssertIntEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 752, ptr noundef null, i32 noundef %39, i32 noundef %47) #7
  %48 = call i32 @arrayListGetLength(ptr noundef %3) #7
  %49 = sext i32 %48 to i64
  %50 = icmp slt i64 %indvars.iv.next, %49
  br i1 %50, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge77:                                    ; preds = %.lr.ph76, %._crit_edge
  call void @clearArrayList(ptr noundef %3) #7
  call void @free(ptr noundef %18) #7
  call void @destroyArrayList(ptr noundef %3) #7
  call void @llvm.lifetime.end.p0(i64 60, ptr nonnull %2) #7
  ret void

.lr.ph76:                                         ; preds = %._crit_edge, %.lr.ph76
  %51 = call ptr @arrayListGet(ptr noundef %3, i32 noundef 0) #7
  %52 = call i32 @arrayListContains(ptr noundef %3, ptr noundef %51) #7
  call void @CuAssertIntEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 759, ptr noundef null, i32 noundef 1, i32 noundef %52) #7
  %53 = call ptr @arrayListRemoveAtIndexWtFr(ptr noundef %3, i32 noundef 0) #7
  %54 = call i32 @arrayListContains(ptr noundef %3, ptr noundef %51) #7
  call void @CuAssertIntEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 761, ptr noundef null, i32 noundef 0, i32 noundef %54) #7
  call void @freeArrayListTestStruct(ptr noundef %51)
  %55 = call i32 @arrayListGetLength(ptr noundef %3) #7
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %.lr.ph76, label %._crit_edge77, !llvm.loop !15
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 = { "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 nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }

!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 0}
!6 = !{!"ArrayListTestStruct", !7, i64 0, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!10, !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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