; 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.57 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.58 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [30 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

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

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

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 @TestAssertStrEquals_NULL(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca [1 x %struct.__jmp_buf_tag], align 16
  %4 = 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
  %5 = call ptr @CuTestNew(ptr noundef @.str.58, ptr noundef @zTestFails)
  store ptr %5, ptr %4, align 8, !tbaa !5
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.CuTest, ptr %6, i32 0, i32 5
  store ptr %3, ptr %7, align 8, !tbaa !9
  %8 = getelementptr inbounds [1 x %struct.__jmp_buf_tag], ptr %3, i64 0, i64 0
  %9 = call i32 @_setjmp(ptr noundef %8) #5
  %10 = icmp eq i32 %9, 0
  br i1 %10, label %11, label %13

11:                                               ; preds = %1
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  call void @CuAssertStrEquals_LineMsg(ptr noundef %12, ptr noundef @.str, i32 noundef 517, ptr noundef null, ptr noundef null, ptr noundef null)
  br label %13

13:                                               ; preds = %11, %1
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.CuTest, ptr %15, i32 0, i32 2
  %17 = load i32, ptr %16, align 8, !tbaa !12
  %18 = icmp ne i32 %17, 0
  %19 = xor i1 %18, true
  %20 = zext i1 %19 to i32
  call void @CuAssert_Line(ptr noundef %14, ptr noundef @.str, i32 noundef 519, ptr noundef @.str.1, i32 noundef %20)
  %21 = load ptr, ptr %2, 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 %21, ptr noundef @.str, i32 noundef 520, ptr noundef @.str.59, ptr noundef null, 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 = %13
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  call void @CuAssertStrEquals_LineMsg(ptr noundef %29, ptr noundef @.str, i32 noundef 522, ptr noundef @.str.57, ptr noundef null, ptr noundef null)
  br label %30

30:                                               ; preds = %28, %13
  %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
  %35 = icmp ne i32 %34, 0
  %36 = xor i1 %35, true
  %37 = zext i1 %36 to i32
  call void @CuAssert_Line(ptr noundef %31, ptr noundef @.str, i32 noundef 524, ptr noundef @.str.1, i32 noundef %37)
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.CuTest, ptr %39, i32 0, i32 4
  %41 = load ptr, ptr %40, align 8, !tbaa !13
  call void @X_CompareAsserts(ptr noundef %38, ptr noundef @.str, i32 noundef 525, ptr noundef @.str.59, ptr noundef null, ptr noundef %41)
  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.57 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.58 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [30 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

declare void @CuAssertStrEquals_LineMsg(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr 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 @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 @TestAssertStrEquals_NULL(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.58, 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 @CuAssertStrEquals_LineMsg(ptr noundef nonnull %3, ptr noundef nonnull @.str, i32 noundef 517, ptr noundef null, ptr noundef null, ptr noundef null) #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
  %.not = icmp eq i32 %10, 0
  %11 = zext i1 %.not to i32
  call void @CuAssert_Line(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 519, ptr noundef nonnull @.str.1, i32 noundef %11) #4
  %12 = getelementptr inbounds i8, ptr %3, i64 24
  %13 = load ptr, ptr %12, align 8, !tbaa !12
  call void @X_CompareAsserts(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 520, ptr noundef nonnull @.str.59, ptr noundef null, ptr noundef %13)
  %14 = call i32 @_setjmp(ptr noundef nonnull %2) #5
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %16, label %17

16:                                               ; preds = %8
  call void @CuAssertStrEquals_LineMsg(ptr noundef nonnull %3, ptr noundef nonnull @.str, i32 noundef 522, ptr noundef nonnull @.str.57, ptr noundef null, ptr noundef null) #4
  br label %17

17:                                               ; preds = %16, %8
  %18 = load i32, ptr %9, align 8, !tbaa !11
  %.not11 = icmp eq i32 %18, 0
  %19 = zext i1 %.not11 to i32
  call void @CuAssert_Line(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 524, ptr noundef nonnull @.str.1, i32 noundef %19) #4
  %20 = load ptr, ptr %12, align 8, !tbaa !12
  call void @X_CompareAsserts(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 525, ptr noundef nonnull @.str.59, ptr noundef null, ptr noundef %20)
  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