; LLVM IR from mkmarek/forex.analytics :: lib/ta-lib/src/tools/ta_regtest (test_abstract)

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

@.str = external hidden unnamed_addr constant [28 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [67 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @test_abstract() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %9 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %10 = call i32 @allocLib()
  store i32 %10, ptr %2, align 4, !tbaa !5
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = icmp ne i32 %11, 0
  br i1 %12, label %13, label %15

13:                                               ; preds = %0
  %14 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %14, ptr %1, align 4
  store i32 1, ptr %8, align 4
  br label %103

15:                                               ; preds = %0
  %16 = call i32 @TA_GetFuncHandle(ptr noundef @.str.1, ptr noundef %5)
  store i32 %16, ptr %3, align 4, !tbaa !5
  %17 = load i32, ptr %3, align 4, !tbaa !5
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %19, label %22

19:                                               ; preds = %15
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %20)
  store i32 600, ptr %1, align 4
  store i32 1, ptr %8, align 4
  br label %103

22:                                               ; preds = %15
  %23 = load ptr, ptr %5, align 8, !tbaa !9
  %24 = call i32 @TA_ParamHolderAlloc(ptr noundef %23, ptr noundef %4)
  store i32 %24, ptr %3, align 4, !tbaa !5
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %27, label %30

27:                                               ; preds = %22
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %28)
  store i32 602, ptr %1, align 4
  store i32 1, ptr %8, align 4
  br label %103

30:                                               ; preds = %22
  %31 = load ptr, ptr %4, align 8, !tbaa !9
  %32 = call i32 @testLookback(ptr noundef %31)
  store i32 %32, ptr %2, align 4, !tbaa !5
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %41

35:                                               ; preds = %30
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %36)
  %38 = load ptr, ptr %4, align 8, !tbaa !9
  %39 = call i32 @TA_ParamHolderFree(ptr noundef %38)
  %40 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %40, ptr %1, align 4
  store i32 1, ptr %8, align 4
  br label %103

41:                                               ; preds = %30
  %42 = load ptr, ptr %4, align 8, !tbaa !9
  %43 = call i32 @TA_ParamHolderFree(ptr noundef %42)
  store i32 %43, ptr %3, align 4, !tbaa !5
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %49

46:                                               ; preds = %41
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %47)
  store i32 603, ptr %1, align 4
  store i32 1, ptr %8, align 4
  br label %103

49:                                               ; preds = %41
  %50 = call i32 @freeLib()
  store i32 %50, ptr %2, align 4, !tbaa !5
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %55

53:                                               ; preds = %49
  %54 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %54, ptr %1, align 4
  store i32 1, ptr %8, align 4
  br label %103

55:                                               ; preds = %49
  %56 = call i32 @allocLib()
  store i32 %56, ptr %2, align 4, !tbaa !5
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %59, label %61

59:                                               ; preds = %55
  %60 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %60, ptr %1, align 4
  store i32 1, ptr %8, align 4
  br label %103

61:                                               ; preds = %55
  %62 = call i32 @test_default_calls()
  store i32 %62, ptr %2, align 4, !tbaa !5
  %63 = load i32, ptr %2, align 4, !tbaa !5
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %68

65:                                               ; preds = %61
  %66 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %67 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %67, ptr %1, align 4
  store i32 1, ptr %8, align 4
  br label %103

68:                                               ; preds = %61
  %69 = call i32 @freeLib()
  store i32 %69, ptr %2, align 4, !tbaa !5
  %70 = load i32, ptr %2, align 4, !tbaa !5
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %74

72:                                               ; preds = %68
  %73 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %73, ptr %1, align 4
  store i32 1, ptr %8, align 4
  br label %103

74:                                               ; preds = %68
  %75 = call ptr @TA_FunctionDescriptionXML()
  store ptr %75, ptr %7, align 8, !tbaa !9
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %89, %74
  %77 = load i32, ptr %6, align 4, !tbaa !5
  %78 = icmp slt i32 %77, 1000000
  br i1 %78, label %79, label %92

79:                                               ; preds = %76
  %80 = load ptr, ptr %7, align 8, !tbaa !9
  %81 = load i32, ptr %6, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds i8, ptr %80, i64 %82
  %84 = load i8, ptr %83, align 1, !tbaa !11
  %85 = sext i8 %84 to i32
  %86 = icmp eq i32 %85, 0
  br i1 %86, label %87, label %88

87:                                               ; preds = %79
  br label %92

88:                                               ; preds = %79
  br label %89

89:                                               ; preds = %88
  %90 = load i32, ptr %6, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %6, align 4, !tbaa !5
  br label %76, !llvm.loop !12

92:                                               ; preds = %87, %76
  %93 = load i32, ptr %6, align 4, !tbaa !5
  %94 = icmp slt i32 %93, 500
  br i1 %94, label %95, label %97

95:                                               ; preds = %92
  %96 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  store i32 618, ptr %1, align 4
  store i32 1, ptr %8, align 4
  br label %103

97:                                               ; preds = %92
  %98 = load i32, ptr %6, align 4, !tbaa !5
  %99 = icmp eq i32 %98, 1000000
  br i1 %99, label %100, label %102

100:                                              ; preds = %97
  %101 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  store i32 619, ptr %1, align 4
  store i32 1, ptr %8, align 4
  br label %103

102:                                              ; preds = %97
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  br label %103

103:                                              ; preds = %102, %100, %95, %72, %65, %59, %53, %46, %35, %27, %19, %13
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  %104 = load i32, ptr %1, align 4
  ret i32 %104
}

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

declare i32 @printf(ptr noundef, ...) #2

declare i32 @allocLib() #2

declare i32 @TA_GetFuncHandle(ptr noundef, ptr noundef) #2

declare i32 @TA_ParamHolderAlloc(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i32 @testLookback(ptr noundef) #0

declare i32 @TA_ParamHolderFree(ptr noundef) #2

declare i32 @freeLib() #2

; Function Attrs: nounwind uwtable
declare hidden i32 @test_default_calls() #0

declare ptr @TA_FunctionDescriptionXML() #2

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

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

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


; 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 [28 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [67 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @test_abstract() local_unnamed_addr #0 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %4 = tail call i32 @allocLib() #4
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %5, label %.thread43

5:                                                ; preds = %0
  %6 = call i32 @TA_GetFuncHandle(ptr noundef nonnull @.str.1, ptr noundef nonnull %2) #4
  %.not35 = icmp eq i32 %6, 0
  br i1 %.not35, label %9, label %7

7:                                                ; preds = %5
  %8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %6)
  br label %.thread43

9:                                                ; preds = %5
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = call i32 @TA_ParamHolderAlloc(ptr noundef %10, ptr noundef nonnull %1) #4
  %.not36 = icmp eq i32 %11, 0
  br i1 %.not36, label %14, label %12

12:                                               ; preds = %9
  %13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %11)
  br label %.thread43

14:                                               ; preds = %9
  %15 = load ptr, ptr %1, align 8, !tbaa !5
  %16 = call i32 @testLookback(ptr noundef %15)
  %.not37 = icmp eq i32 %16, 0
  br i1 %.not37, label %21, label %17

17:                                               ; preds = %14
  %18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %16)
  %19 = load ptr, ptr %1, align 8, !tbaa !5
  %20 = call i32 @TA_ParamHolderFree(ptr noundef %19) #4
  br label %.thread43

21:                                               ; preds = %14
  %22 = load ptr, ptr %1, align 8, !tbaa !5
  %23 = call i32 @TA_ParamHolderFree(ptr noundef %22) #4
  %.not38 = icmp eq i32 %23, 0
  br i1 %.not38, label %26, label %24

24:                                               ; preds = %21
  %25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %23)
  br label %.thread43

26:                                               ; preds = %21
  %27 = call i32 @freeLib() #4
  %.not39 = icmp eq i32 %27, 0
  br i1 %.not39, label %28, label %.thread43

28:                                               ; preds = %26
  %29 = call i32 @allocLib() #4
  %.not40 = icmp eq i32 %29, 0
  br i1 %.not40, label %30, label %.thread43

30:                                               ; preds = %28
  %31 = call i32 @test_default_calls()
  %.not41 = icmp eq i32 %31, 0
  br i1 %.not41, label %34, label %32

32:                                               ; preds = %30
  %33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %.thread43

34:                                               ; preds = %30
  %35 = call i32 @freeLib() #4
  %.not42 = icmp eq i32 %35, 0
  br i1 %.not42, label %36, label %.thread43

36:                                               ; preds = %34
  %37 = call ptr @TA_FunctionDescriptionXML() #4
  br label %38

38:                                               ; preds = %58, %36
  %indvars.iv = phi i64 [ 0, %36 ], [ %indvars.iv.next.4, %58 ]
  %39 = getelementptr inbounds i8, ptr %37, i64 %indvars.iv
  %40 = load i8, ptr %39, align 1, !tbaa !9
  %41 = icmp eq i8 %40, 0
  br i1 %41, label %59, label %42

42:                                               ; preds = %38
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %43 = getelementptr inbounds i8, ptr %37, i64 %indvars.iv.next
  %44 = load i8, ptr %43, align 1, !tbaa !9
  %45 = icmp eq i8 %44, 0
  br i1 %45, label %59, label %46

46:                                               ; preds = %42
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %47 = getelementptr inbounds i8, ptr %37, i64 %indvars.iv.next.1
  %48 = load i8, ptr %47, align 1, !tbaa !9
  %49 = icmp eq i8 %48, 0
  br i1 %49, label %59, label %50

50:                                               ; preds = %46
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %51 = getelementptr inbounds i8, ptr %37, i64 %indvars.iv.next.2
  %52 = load i8, ptr %51, align 1, !tbaa !9
  %53 = icmp eq i8 %52, 0
  br i1 %53, label %59, label %54

54:                                               ; preds = %50
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %55 = getelementptr inbounds i8, ptr %37, i64 %indvars.iv.next.3
  %56 = load i8, ptr %55, align 1, !tbaa !9
  %57 = icmp eq i8 %56, 0
  br i1 %57, label %59, label %58

58:                                               ; preds = %54
  %indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
  %exitcond.not.4 = icmp eq i64 %indvars.iv.next.4, 1000000
  br i1 %exitcond.not.4, label %63, label %38, !llvm.loop !10

59:                                               ; preds = %54, %50, %46, %42, %38
  %indvars.iv.lcssa = phi i64 [ %indvars.iv, %38 ], [ %indvars.iv.next, %42 ], [ %indvars.iv.next.1, %46 ], [ %indvars.iv.next.2, %50 ], [ %indvars.iv.next.3, %54 ]
  %60 = icmp ult i64 %indvars.iv.lcssa, 500
  br i1 %60, label %61, label %.thread43

61:                                               ; preds = %59
  %62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  br label %.thread43

63:                                               ; preds = %58
  %64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  br label %.thread43

.thread43:                                        ; preds = %59, %34, %28, %26, %0, %63, %61, %32, %24, %17, %12, %7
  %.0 = phi i32 [ 600, %7 ], [ 602, %12 ], [ %16, %17 ], [ 603, %24 ], [ %31, %32 ], [ 618, %61 ], [ 619, %63 ], [ %4, %0 ], [ %27, %26 ], [ %29, %28 ], [ %35, %34 ], [ 0, %59 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  ret i32 %.0
}

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

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

declare i32 @allocLib() local_unnamed_addr #3

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @testLookback(ptr noundef) local_unnamed_addr #0

declare i32 @TA_ParamHolderFree(ptr noundef) local_unnamed_addr #3

declare i32 @freeLib() local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden i32 @test_default_calls() local_unnamed_addr #0

declare ptr @TA_FunctionDescriptionXML() local_unnamed_addr #3

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

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

!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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


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