; LLVM IR from MostafaTwfiq/C-DataStructures-And-Algorithms :: Unit Test/CuTest (CuTestTest)

; 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.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }
%struct.CuTest = type { ptr, ptr, i32, i32, ptr, ptr }

@.str = external hidden unnamed_addr constant [108 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.68 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.69 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.70 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [25 x i8], align 1

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

declare void @CuAssert_Line(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) #1

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

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

declare ptr @CuTestNew(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @zTestFails(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @X_CompareAsserts(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind returns_twice
declare i32 @_setjmp(ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @TestAssertIntEquals(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca [1 x %struct.__jmp_buf_tag], align 16
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 200, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %7 = call ptr @CuTestNew(ptr noundef @.str.68, ptr noundef @zTestFails)
  store ptr %7, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store ptr @.str.69, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store ptr @.str.70, ptr %6, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.CuTest, ptr %8, i32 0, i32 5
  store ptr %3, ptr %9, align 8, !tbaa !9
  %10 = getelementptr inbounds [1 x %struct.__jmp_buf_tag], ptr %3, i64 0, i64 0
  %11 = call i32 @_setjmp(ptr noundef %10) #5
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %13, label %15

13:                                               ; preds = %1
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  call void @CuAssertIntEquals_LineMsg(ptr noundef %14, ptr noundef @.str, i32 noundef 575, ptr noundef null, i32 noundef 42, i32 noundef 32)
  br label %15

15:                                               ; preds = %13, %1
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.CuTest, ptr %17, i32 0, i32 2
  %19 = load i32, ptr %18, align 8, !tbaa !12
  call void @CuAssert_Line(ptr noundef %16, ptr noundef @.str, i32 noundef 577, ptr noundef @.str.1, i32 noundef %19)
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.CuTest, ptr %22, i32 0, i32 4
  %24 = load ptr, ptr %23, align 8, !tbaa !13
  call void @X_CompareAsserts(ptr noundef %20, ptr noundef @.str, i32 noundef 578, ptr noundef @.str.71, ptr noundef %21, ptr noundef %24)
  %25 = getelementptr inbounds [1 x %struct.__jmp_buf_tag], ptr %3, i64 0, i64 0
  %26 = call i32 @_setjmp(ptr noundef %25) #5
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %30

28:                                               ; preds = %15
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  call void @CuAssertIntEquals_LineMsg(ptr noundef %29, ptr noundef @.str, i32 noundef 580, ptr noundef @.str.57, i32 noundef 42, i32 noundef 32)
  br label %30

30:                                               ; preds = %28, %15
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.CuTest, ptr %32, i32 0, i32 2
  %34 = load i32, ptr %33, align 8, !tbaa !12
  call void @CuAssert_Line(ptr noundef %31, ptr noundef @.str, i32 noundef 582, ptr noundef @.str.1, i32 noundef %34)
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.CuTest, ptr %37, i32 0, i32 4
  %39 = load ptr, ptr %38, align 8, !tbaa !13
  call void @X_CompareAsserts(ptr noundef %35, ptr noundef @.str, i32 noundef 583, ptr noundef @.str.56, ptr noundef %36, ptr noundef %39)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 200, ptr %3) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind returns_twice "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 }
attributes #5 = { nounwind returns_twice }

!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, !6, i64 32}
!10 = !{!"CuTest", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !6, i64 24, !6, i64 32}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 16}
!13 = !{!10, !6, i64 24}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@.str = external hidden unnamed_addr constant [108 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.68 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.69 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.70 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [25 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

declare void @CuAssert_Line(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 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 void @CuAssertIntEquals_LineMsg(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

declare ptr @CuTestNew(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @zTestFails(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @X_CompareAsserts(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind returns_twice
declare i32 @_setjmp(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @TestAssertIntEquals(ptr noundef %0) local_unnamed_addr #2 {
  %2 = alloca [1 x %struct.__jmp_buf_tag], align 16
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %2) #4
  %3 = call ptr @CuTestNew(ptr noundef nonnull @.str.68, ptr noundef nonnull @zTestFails) #4
  %4 = getelementptr inbounds i8, ptr %3, i64 32
  store ptr %2, ptr %4, align 8, !tbaa !5
  %5 = call i32 @_setjmp(ptr noundef nonnull %2) #5
  %6 = icmp eq i32 %5, 0
  br i1 %6, label %7, label %8

7:                                                ; preds = %1
  call void @CuAssertIntEquals_LineMsg(ptr noundef nonnull %3, ptr noundef nonnull @.str, i32 noundef 575, ptr noundef null, i32 noundef 42, i32 noundef 32) #4
  br label %8

8:                                                ; preds = %7, %1
  %9 = getelementptr inbounds i8, ptr %3, i64 16
  %10 = load i32, ptr %9, align 8, !tbaa !11
  call void @CuAssert_Line(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 577, ptr noundef nonnull @.str.1, i32 noundef %10) #4
  %11 = getelementptr inbounds i8, ptr %3, i64 24
  %12 = load ptr, ptr %11, align 8, !tbaa !12
  call void @X_CompareAsserts(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 578, ptr noundef nonnull @.str.71, ptr noundef nonnull @.str.69, ptr noundef %12)
  %13 = call i32 @_setjmp(ptr noundef nonnull %2) #5
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %15, label %16

15:                                               ; preds = %8
  call void @CuAssertIntEquals_LineMsg(ptr noundef nonnull %3, ptr noundef nonnull @.str, i32 noundef 580, ptr noundef nonnull @.str.57, i32 noundef 42, i32 noundef 32) #4
  br label %16

16:                                               ; preds = %15, %8
  %17 = load i32, ptr %9, align 8, !tbaa !11
  call void @CuAssert_Line(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 582, ptr noundef nonnull @.str.1, i32 noundef %17) #4
  %18 = load ptr, ptr %11, align 8, !tbaa !12
  call void @X_CompareAsserts(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 583, ptr noundef nonnull @.str.56, ptr noundef nonnull @.str.70, ptr noundef %18)
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %2) #4
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind returns_twice "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 }
attributes #5 = { nounwind returns_twice }

!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 32}
!6 = !{!"CuTest", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !7, i64 24, !7, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 16}
!12 = !{!6, !7, i64 24}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass