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

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

@.str = external hidden unnamed_addr constant [147 x i8], align 1
@__const.generalStackTest.numbersStr = external hidden unnamed_addr constant [14 x [10 x i8]], align 16
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 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

declare ptr @stackInitialization(ptr noundef) #2

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

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

declare void @destroyStack(ptr noundef) #2

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

declare void @stackAddAll(ptr noundef, ptr noundef, i32 noundef) #2

declare ptr @stackPop(ptr noundef) #2

declare ptr @stackPeek(ptr noundef) #2

declare signext i16 @stackIsEmpty(ptr noundef) #2

declare ptr @stackToArray(ptr noundef) #2

declare i32 @stackGetLength(ptr noundef) #2

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

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

; Function Attrs: nounwind uwtable
define dso_local void @generalStackTest(ptr noundef %0) #4 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca [14 x [10 x i8]], align 16
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %10 = call ptr @stackInitialization(ptr noundef @freeStackTestStruct)
  store ptr %10, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 140, ptr %4) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %4, ptr align 16 @__const.generalStackTest.numbersStr, i64 140, i1 false)
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = call i32 @stackGetLength(ptr noundef %12)
  call void @CuAssertIntEquals_LineMsg(ptr noundef %11, ptr noundef @.str, i32 noundef 435, ptr noundef null, i32 noundef 0, i32 noundef %13)
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = call signext i16 @stackIsEmpty(ptr noundef %15)
  %17 = sext i16 %16 to i32
  call void @CuAssertIntEquals_LineMsg(ptr noundef %14, ptr noundef @.str, i32 noundef 436, ptr noundef null, i32 noundef 1, i32 noundef %17)
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = call ptr @generateStackTestStruct(i32 noundef 1, ptr noundef @.str.2)
  call void @stackPush(ptr noundef %18, ptr noundef %19)
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = call ptr @generateStackTestStruct(i32 noundef 2, ptr noundef @.str.3)
  call void @stackPush(ptr noundef %20, ptr noundef %21)
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = call ptr @generateStackTestStruct(i32 noundef 3, ptr noundef @.str.4)
  call void @stackPush(ptr noundef %22, ptr noundef %23)
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = call i32 @stackGetLength(ptr noundef %25)
  call void @CuAssertIntEquals_LineMsg(ptr noundef %24, ptr noundef @.str, i32 noundef 442, ptr noundef null, i32 noundef 3, i32 noundef %26)
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = call signext i16 @stackIsEmpty(ptr noundef %28)
  %30 = sext i16 %29 to i32
  call void @CuAssertIntEquals_LineMsg(ptr noundef %27, ptr noundef @.str, i32 noundef 443, ptr noundef null, i32 noundef 0, i32 noundef %30)
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = call ptr @stackPeek(ptr noundef %32)
  %34 = getelementptr inbounds %struct.StackTestStruct, ptr %33, i32 0, i32 0
  %35 = load i32, ptr %34, align 8, !tbaa !9
  call void @CuAssertIntEquals_LineMsg(ptr noundef %31, ptr noundef @.str, i32 noundef 445, ptr noundef null, i32 noundef 3, i32 noundef %35)
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = call ptr @stackPeek(ptr noundef %37)
  %39 = getelementptr inbounds %struct.StackTestStruct, ptr %38, i32 0, i32 1
  %40 = load ptr, ptr %39, align 8, !tbaa !12
  call void @CuAssertStrEquals_LineMsg(ptr noundef %36, ptr noundef @.str, i32 noundef 446, ptr noundef null, ptr noundef @.str.4, ptr noundef %40)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %41 = call noalias ptr @malloc(i64 noundef 88) #7
  store ptr %41, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !13
  br label %42

42:                                               ; preds = %59, %1
  %43 = load i32, ptr %6, align 4, !tbaa !13
  %44 = icmp slt i32 %43, 11
  br i1 %44, label %46, label %45

45:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %62

46:                                               ; preds = %42
  %47 = load i32, ptr %6, align 4, !tbaa !13
  %48 = add nsw i32 %47, 4
  %49 = load i32, ptr %6, align 4, !tbaa !13
  %50 = add nsw i32 %49, 3
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [14 x [10 x i8]], ptr %4, i64 0, i64 %51
  %53 = getelementptr inbounds [10 x i8], ptr %52, i64 0, i64 0
  %54 = call ptr @generateStackTestStruct(i32 noundef %48, ptr noundef %53)
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = load i32, ptr %6, align 4, !tbaa !13
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds ptr, ptr %55, i64 %57
  store ptr %54, ptr %58, align 8, !tbaa !5
  br label %59

59:                                               ; preds = %46
  %60 = load i32, ptr %6, align 4, !tbaa !13
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %6, align 4, !tbaa !13
  br label %42, !llvm.loop !14

62:                                               ; preds = %45
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  call void @stackAddAll(ptr noundef %63, ptr noundef %64, i32 noundef 11)
  %65 = load ptr, ptr %2, align 8, !tbaa !5
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = call i32 @stackGetLength(ptr noundef %66)
  call void @CuAssertIntEquals_LineMsg(ptr noundef %65, ptr noundef @.str, i32 noundef 454, ptr noundef null, i32 noundef 14, i32 noundef %67)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = call ptr @stackToArray(ptr noundef %68)
  store ptr %69, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !13
  br label %70

70:                                               ; preds = %99, %62
  %71 = load i32, ptr %8, align 4, !tbaa !13
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = call i32 @stackGetLength(ptr noundef %72)
  %74 = icmp slt i32 %71, %73
  br i1 %74, label %76, label %75

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

76:                                               ; preds = %70
  %77 = load ptr, ptr %2, align 8, !tbaa !5
  %78 = load i32, ptr %8, align 4, !tbaa !13
  %79 = add nsw i32 %78, 1
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = load i32, ptr %8, align 4, !tbaa !13
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds ptr, ptr %80, i64 %82
  %84 = load ptr, ptr %83, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.StackTestStruct, ptr %84, i32 0, i32 0
  %86 = load i32, ptr %85, align 8, !tbaa !9
  call void @CuAssertIntEquals_LineMsg(ptr noundef %77, ptr noundef @.str, i32 noundef 458, ptr noundef null, i32 noundef %79, i32 noundef %86)
  %87 = load ptr, ptr %2, align 8, !tbaa !5
  %88 = load i32, ptr %8, align 4, !tbaa !13
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [14 x [10 x i8]], ptr %4, i64 0, i64 %89
  %91 = getelementptr inbounds [10 x i8], ptr %90, i64 0, i64 0
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = load i32, ptr %8, align 4, !tbaa !13
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds ptr, ptr %92, i64 %94
  %96 = load ptr, ptr %95, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.StackTestStruct, ptr %96, i32 0, i32 1
  %98 = load ptr, ptr %97, align 8, !tbaa !12
  call void @CuAssertStrEquals_LineMsg(ptr noundef %87, ptr noundef @.str, i32 noundef 459, ptr noundef null, ptr noundef %91, ptr noundef %98)
  br label %99

99:                                               ; preds = %76
  %100 = load i32, ptr %8, align 4, !tbaa !13
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %8, align 4, !tbaa !13
  br label %70, !llvm.loop !16

102:                                              ; preds = %75
  br label %103

103:                                              ; preds = %108, %102
  %104 = load ptr, ptr %3, align 8, !tbaa !5
  %105 = call signext i16 @stackIsEmpty(ptr noundef %104)
  %106 = icmp ne i16 %105, 0
  %107 = xor i1 %106, true
  br i1 %107, label %108, label %128

108:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %109 = load ptr, ptr %3, align 8, !tbaa !5
  %110 = call ptr @stackPop(ptr noundef %109)
  store ptr %110, ptr %9, align 8, !tbaa !5
  %111 = load ptr, ptr %2, align 8, !tbaa !5
  %112 = load ptr, ptr %3, align 8, !tbaa !5
  %113 = call i32 @stackGetLength(ptr noundef %112)
  %114 = add nsw i32 %113, 1
  %115 = load ptr, ptr %9, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.StackTestStruct, ptr %115, i32 0, i32 0
  %117 = load i32, ptr %116, align 8, !tbaa !9
  call void @CuAssertIntEquals_LineMsg(ptr noundef %111, ptr noundef @.str, i32 noundef 464, ptr noundef null, i32 noundef %114, i32 noundef %117)
  %118 = load ptr, ptr %2, align 8, !tbaa !5
  %119 = load ptr, ptr %3, align 8, !tbaa !5
  %120 = call i32 @stackGetLength(ptr noundef %119)
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [14 x [10 x i8]], ptr %4, i64 0, i64 %121
  %123 = getelementptr inbounds [10 x i8], ptr %122, i64 0, i64 0
  %124 = load ptr, ptr %9, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.StackTestStruct, ptr %124, i32 0, i32 1
  %126 = load ptr, ptr %125, align 8, !tbaa !12
  call void @CuAssertStrEquals_LineMsg(ptr noundef %118, ptr noundef @.str, i32 noundef 465, ptr noundef null, ptr noundef %123, ptr noundef %126)
  %127 = load ptr, ptr %9, align 8, !tbaa !5
  call void @freeStackTestStruct(ptr noundef %127)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %103, !llvm.loop !17

128:                                              ; preds = %103
  %129 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %129) #6
  %130 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %130) #6
  %131 = load ptr, ptr %3, align 8, !tbaa !5
  call void @destroyStack(ptr noundef %131)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 140, 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

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

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 = { "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 "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 = !{!"StackTestStruct", !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}
!17 = distinct !{!17, !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 [147 x i8], align 1
@__const.generalStackTest.numbersStr = external hidden unnamed_addr constant [14 x [10 x i8]], align 16
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 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

declare ptr @stackInitialization(ptr noundef) local_unnamed_addr #2

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

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

declare void @destroyStack(ptr noundef) local_unnamed_addr #2

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

declare void @stackAddAll(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare ptr @stackPop(ptr noundef) local_unnamed_addr #2

declare ptr @stackPeek(ptr noundef) local_unnamed_addr #2

declare signext i16 @stackIsEmpty(ptr noundef) local_unnamed_addr #2

declare ptr @stackToArray(ptr noundef) local_unnamed_addr #2

declare i32 @stackGetLength(ptr noundef) local_unnamed_addr #2

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

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

; Function Attrs: nounwind uwtable
define dso_local void @generalStackTest(ptr noundef %0) local_unnamed_addr #4 {
  %2 = alloca [14 x [10 x i8]], align 16
  %3 = tail call ptr @stackInitialization(ptr noundef nonnull @freeStackTestStruct) #6
  call void @llvm.lifetime.start.p0(i64 140, ptr nonnull %2) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(140) %2, ptr noundef nonnull align 16 dereferenceable(140) @__const.generalStackTest.numbersStr, i64 140, i1 false)
  %4 = tail call i32 @stackGetLength(ptr noundef %3) #6
  tail call void @CuAssertIntEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 435, ptr noundef null, i32 noundef 0, i32 noundef %4) #6
  %5 = tail call signext i16 @stackIsEmpty(ptr noundef %3) #6
  %6 = sext i16 %5 to i32
  tail call void @CuAssertIntEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 436, ptr noundef null, i32 noundef 1, i32 noundef %6) #6
  %7 = tail call ptr @generateStackTestStruct(i32 noundef 1, ptr noundef nonnull @.str.2)
  tail call void @stackPush(ptr noundef %3, ptr noundef %7) #6
  %8 = tail call ptr @generateStackTestStruct(i32 noundef 2, ptr noundef nonnull @.str.3)
  tail call void @stackPush(ptr noundef %3, ptr noundef %8) #6
  %9 = tail call ptr @generateStackTestStruct(i32 noundef 3, ptr noundef nonnull @.str.4)
  tail call void @stackPush(ptr noundef %3, ptr noundef %9) #6
  %10 = tail call i32 @stackGetLength(ptr noundef %3) #6
  tail call void @CuAssertIntEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 442, ptr noundef null, i32 noundef 3, i32 noundef %10) #6
  %11 = tail call signext i16 @stackIsEmpty(ptr noundef %3) #6
  %12 = sext i16 %11 to i32
  tail call void @CuAssertIntEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 443, ptr noundef null, i32 noundef 0, i32 noundef %12) #6
  %13 = tail call ptr @stackPeek(ptr noundef %3) #6
  %14 = load i32, ptr %13, align 8, !tbaa !5
  tail call void @CuAssertIntEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 445, ptr noundef null, i32 noundef 3, i32 noundef %14) #6
  %15 = tail call ptr @stackPeek(ptr noundef %3) #6
  %16 = getelementptr inbounds i8, ptr %15, i64 8
  %17 = load ptr, ptr %16, align 8, !tbaa !11
  tail call void @CuAssertStrEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 446, ptr noundef null, ptr noundef nonnull @.str.4, ptr noundef %17) #6
  %18 = tail call noalias dereferenceable_or_null(88) ptr @malloc(i64 noundef 88) #7
  %19 = getelementptr inbounds i8, ptr %2, i64 30
  %20 = call ptr @generateStackTestStruct(i32 noundef 4, ptr noundef nonnull %19)
  store ptr %20, ptr %18, align 8, !tbaa !12
  %21 = getelementptr inbounds i8, ptr %2, i64 40
  %22 = call ptr @generateStackTestStruct(i32 noundef 5, ptr noundef nonnull %21)
  %23 = getelementptr inbounds i8, ptr %18, i64 8
  store ptr %22, ptr %23, align 8, !tbaa !12
  %24 = getelementptr inbounds i8, ptr %2, i64 50
  %25 = call ptr @generateStackTestStruct(i32 noundef 6, ptr noundef nonnull %24)
  %26 = getelementptr inbounds i8, ptr %18, i64 16
  store ptr %25, ptr %26, align 8, !tbaa !12
  %27 = getelementptr inbounds i8, ptr %2, i64 60
  %28 = call ptr @generateStackTestStruct(i32 noundef 7, ptr noundef nonnull %27)
  %29 = getelementptr inbounds i8, ptr %18, i64 24
  store ptr %28, ptr %29, align 8, !tbaa !12
  %30 = getelementptr inbounds i8, ptr %2, i64 70
  %31 = call ptr @generateStackTestStruct(i32 noundef 8, ptr noundef nonnull %30)
  %32 = getelementptr inbounds i8, ptr %18, i64 32
  store ptr %31, ptr %32, align 8, !tbaa !12
  %33 = getelementptr inbounds i8, ptr %2, i64 80
  %34 = call ptr @generateStackTestStruct(i32 noundef 9, ptr noundef nonnull %33)
  %35 = getelementptr inbounds i8, ptr %18, i64 40
  store ptr %34, ptr %35, align 8, !tbaa !12
  %36 = getelementptr inbounds i8, ptr %2, i64 90
  %37 = call ptr @generateStackTestStruct(i32 noundef 10, ptr noundef nonnull %36)
  %38 = getelementptr inbounds i8, ptr %18, i64 48
  store ptr %37, ptr %38, align 8, !tbaa !12
  %39 = getelementptr inbounds i8, ptr %2, i64 100
  %40 = call ptr @generateStackTestStruct(i32 noundef 11, ptr noundef nonnull %39)
  %41 = getelementptr inbounds i8, ptr %18, i64 56
  store ptr %40, ptr %41, align 8, !tbaa !12
  %42 = getelementptr inbounds i8, ptr %2, i64 110
  %43 = call ptr @generateStackTestStruct(i32 noundef 12, ptr noundef nonnull %42)
  %44 = getelementptr inbounds i8, ptr %18, i64 64
  store ptr %43, ptr %44, align 8, !tbaa !12
  %45 = getelementptr inbounds i8, ptr %2, i64 120
  %46 = call ptr @generateStackTestStruct(i32 noundef 13, ptr noundef nonnull %45)
  %47 = getelementptr inbounds i8, ptr %18, i64 72
  store ptr %46, ptr %47, align 8, !tbaa !12
  %48 = getelementptr inbounds i8, ptr %2, i64 130
  %49 = call ptr @generateStackTestStruct(i32 noundef 14, ptr noundef nonnull %48)
  %50 = getelementptr inbounds i8, ptr %18, i64 80
  store ptr %49, ptr %50, align 8, !tbaa !12
  call void @stackAddAll(ptr noundef %3, ptr noundef nonnull %18, i32 noundef 11) #6
  %51 = call i32 @stackGetLength(ptr noundef %3) #6
  call void @CuAssertIntEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 454, ptr noundef null, i32 noundef 14, i32 noundef %51) #6
  %52 = call ptr @stackToArray(ptr noundef %3) #6
  %53 = call i32 @stackGetLength(ptr noundef %3) #6
  %54 = icmp sgt i32 %53, 0
  br i1 %54, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %.lr.ph, %1
  %55 = call signext i16 @stackIsEmpty(ptr noundef %3) #6
  %.not51 = icmp eq i16 %55, 0
  br i1 %.not51, label %.lr.ph52, label %._crit_edge

.lr.ph:                                           ; preds = %1, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %1 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %56 = getelementptr inbounds ptr, ptr %52, i64 %indvars.iv
  %57 = load ptr, ptr %56, align 8, !tbaa !12
  %58 = load i32, ptr %57, align 8, !tbaa !5
  %59 = trunc nuw nsw i64 %indvars.iv.next to i32
  call void @CuAssertIntEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 458, ptr noundef null, i32 noundef %59, i32 noundef %58) #6
  %60 = getelementptr inbounds [14 x [10 x i8]], ptr %2, i64 0, i64 %indvars.iv
  %61 = load ptr, ptr %56, align 8, !tbaa !12
  %62 = getelementptr inbounds i8, ptr %61, i64 8
  %63 = load ptr, ptr %62, align 8, !tbaa !11
  call void @CuAssertStrEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 459, ptr noundef null, ptr noundef nonnull %60, ptr noundef %63) #6
  %64 = call i32 @stackGetLength(ptr noundef %3) #6
  %65 = sext i32 %64 to i64
  %66 = icmp slt i64 %indvars.iv.next, %65
  br i1 %66, label %.lr.ph, label %.preheader, !llvm.loop !13

.lr.ph52:                                         ; preds = %.preheader, %.lr.ph52
  %67 = call ptr @stackPop(ptr noundef %3) #6
  %68 = call i32 @stackGetLength(ptr noundef %3) #6
  %69 = add nsw i32 %68, 1
  %70 = load i32, ptr %67, align 8, !tbaa !5
  call void @CuAssertIntEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 464, ptr noundef null, i32 noundef %69, i32 noundef %70) #6
  %71 = call i32 @stackGetLength(ptr noundef %3) #6
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [14 x [10 x i8]], ptr %2, i64 0, i64 %72
  %74 = getelementptr inbounds i8, ptr %67, i64 8
  %75 = load ptr, ptr %74, align 8, !tbaa !11
  call void @CuAssertStrEquals_LineMsg(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 465, ptr noundef null, ptr noundef nonnull %73, ptr noundef %75) #6
  call void @freeStackTestStruct(ptr noundef nonnull %67)
  %76 = call signext i16 @stackIsEmpty(ptr noundef %3) #6
  %.not = icmp eq i16 %76, 0
  br i1 %.not, label %.lr.ph52, label %._crit_edge, !llvm.loop !15

._crit_edge:                                      ; preds = %.lr.ph52, %.preheader
  call void @free(ptr noundef %18) #6
  call void @free(ptr noundef %52) #6
  call void @destroyStack(ptr noundef %3) #6
  call void @llvm.lifetime.end.p0(i64 140, ptr nonnull %2) #6
  ret void
}

; 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) #5

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

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 = { "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 = { 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 #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 = { mustprogress 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, !7, i64 0}
!6 = !{!"StackTestStruct", !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