; LLVM IR from txus/libtreadmill :: tests (darray_tests)

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

@array = external hidden global ptr, align 8
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@val1 = external hidden global ptr, align 8
@val2 = external hidden global ptr, align 8
@.str.14 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #0

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #1

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) #0

; Function Attrs: nounwind uwtable
define dso_local ptr @test_get() #2 {
  %1 = alloca ptr, align 8
  %2 = load ptr, ptr @array, align 8, !tbaa !5
  %3 = call ptr @Tm_DArray_get(ptr noundef %2, i32 noundef 0)
  %4 = load ptr, ptr @val1, align 8, !tbaa !5
  %5 = icmp eq ptr %3, %4
  br i1 %5, label %19, label %6

6:                                                ; preds = %0
  %7 = load ptr, ptr @stderr, align 8, !tbaa !5
  %8 = call ptr @__errno_location() #4
  %9 = load i32, ptr %8, align 4, !tbaa !9
  %10 = icmp eq i32 %9, 0
  br i1 %10, label %11, label %12

11:                                               ; preds = %6
  br label %16

12:                                               ; preds = %6
  %13 = call ptr @__errno_location() #4
  %14 = load i32, ptr %13, align 4, !tbaa !9
  %15 = call ptr @strerror(i32 noundef %14) #5
  br label %16

16:                                               ; preds = %12, %11
  %17 = phi ptr [ @.str.2, %11 ], [ %15, %12 ]
  %18 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %7, ptr noundef @.str.14, ptr noundef @.str.1, i32 noundef 48, ptr noundef %17) #5
  store ptr @.str.15, ptr %1, align 8
  br label %38

19:                                               ; preds = %0
  %20 = load ptr, ptr @array, align 8, !tbaa !5
  %21 = call ptr @Tm_DArray_get(ptr noundef %20, i32 noundef 1)
  %22 = load ptr, ptr @val2, align 8, !tbaa !5
  %23 = icmp eq ptr %21, %22
  br i1 %23, label %37, label %24

24:                                               ; preds = %19
  %25 = load ptr, ptr @stderr, align 8, !tbaa !5
  %26 = call ptr @__errno_location() #4
  %27 = load i32, ptr %26, align 4, !tbaa !9
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %30

29:                                               ; preds = %24
  br label %34

30:                                               ; preds = %24
  %31 = call ptr @__errno_location() #4
  %32 = load i32, ptr %31, align 4, !tbaa !9
  %33 = call ptr @strerror(i32 noundef %32) #5
  br label %34

34:                                               ; preds = %30, %29
  %35 = phi ptr [ @.str.2, %29 ], [ %33, %30 ]
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef @.str.16, ptr noundef @.str.1, i32 noundef 49, ptr noundef %35) #5
  store ptr @.str.17, ptr %1, align 8
  br label %38

37:                                               ; preds = %19
  store ptr null, ptr %1, align 8
  br label %38

38:                                               ; preds = %37, %34, %16
  %39 = load ptr, ptr %1, align 8
  ret ptr %39
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @Tm_DArray_get(ptr noundef, i32 noundef) #3

attributes #0 = { 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 #1 = { nounwind willreturn memory(none) "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 = { inlinehint 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 #4 = { nounwind willreturn memory(none) }
attributes #5 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


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

@array = external hidden local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@val1 = external hidden local_unnamed_addr global ptr, align 8
@val2 = external hidden local_unnamed_addr global ptr, align 8
@.str.14 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #1

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @test_get() local_unnamed_addr #3 {
  %1 = load ptr, ptr @array, align 8, !tbaa !5
  %2 = tail call ptr @Tm_DArray_get(ptr noundef %1, i32 noundef 0)
  %3 = load ptr, ptr @val1, align 8, !tbaa !5
  %4 = icmp eq ptr %2, %3
  br i1 %4, label %15, label %5

5:                                                ; preds = %0
  %6 = load ptr, ptr @stderr, align 8, !tbaa !5
  %7 = tail call ptr @__errno_location() #5
  %8 = load i32, ptr %7, align 4, !tbaa !9
  %9 = icmp eq i32 %8, 0
  br i1 %9, label %12, label %10

10:                                               ; preds = %5
  %11 = tail call ptr @strerror(i32 noundef %8) #6
  br label %12

12:                                               ; preds = %5, %10
  %13 = phi ptr [ %11, %10 ], [ @.str.2, %5 ]
  %14 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %6, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.1, i32 noundef 48, ptr noundef %13) #7
  br label %30

15:                                               ; preds = %0
  %16 = load ptr, ptr @array, align 8, !tbaa !5
  %17 = tail call ptr @Tm_DArray_get(ptr noundef %16, i32 noundef 1)
  %18 = load ptr, ptr @val2, align 8, !tbaa !5
  %19 = icmp eq ptr %17, %18
  br i1 %19, label %30, label %20

20:                                               ; preds = %15
  %21 = load ptr, ptr @stderr, align 8, !tbaa !5
  %22 = tail call ptr @__errno_location() #5
  %23 = load i32, ptr %22, align 4, !tbaa !9
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %27, label %25

25:                                               ; preds = %20
  %26 = tail call ptr @strerror(i32 noundef %23) #6
  br label %27

27:                                               ; preds = %20, %25
  %28 = phi ptr [ %26, %25 ], [ @.str.2, %20 ]
  %29 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef nonnull @.str.16, ptr noundef nonnull @.str.1, i32 noundef 49, ptr noundef %28) #7
  br label %30

30:                                               ; preds = %15, %27, %12
  %.0 = phi ptr [ @.str.17, %27 ], [ @.str.15, %12 ], [ null, %15 ]
  ret ptr %.0
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @Tm_DArray_get(ptr noundef, i32 noundef) local_unnamed_addr #4

attributes #0 = { nofree 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 #1 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 = { 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 #4 = { inlinehint 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 = { nounwind willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { cold 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass