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

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

@insufficientClockPrecision = external dso_local global i32, align 4
@timeInProfiledCall = external dso_local global double, align 8
@worstProfiledCall = external dso_local global double, align 8
@nbProfiledCall = external dso_local global i32, align 4
@doExtensiveProfiling = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [46 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %9 = load ptr, ptr %5, align 8, !tbaa !9
  store i32 0, ptr @insufficientClockPrecision, align 4, !tbaa !5
  store double 0.000000e+00, ptr @timeInProfiledCall, align 8, !tbaa !11
  store double 0.000000e+00, ptr @worstProfiledCall, align 8, !tbaa !11
  store i32 0, ptr @nbProfiledCall, align 4, !tbaa !5
  store i32 0, ptr @doExtensiveProfiling, align 4, !tbaa !5
  %10 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %11 = call ptr @TA_GetVersionString()
  %12 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, ptr noundef %11)
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %14 = load i32, ptr %4, align 4, !tbaa !5
  %15 = icmp eq i32 %14, 2
  br i1 %15, label %16, label %43

16:                                               ; preds = %2
  %17 = load ptr, ptr %5, align 8, !tbaa !9
  %18 = getelementptr inbounds ptr, ptr %17, i64 1
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = getelementptr inbounds i8, ptr %19, i64 0
  %21 = load i8, ptr %20, align 1, !tbaa !13
  %22 = sext i8 %21 to i32
  %23 = icmp eq i32 %22, 45
  br i1 %23, label %24, label %41

24:                                               ; preds = %16
  %25 = load ptr, ptr %5, align 8, !tbaa !9
  %26 = getelementptr inbounds ptr, ptr %25, i64 1
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  %28 = getelementptr inbounds i8, ptr %27, i64 1
  %29 = load i8, ptr %28, align 1, !tbaa !13
  %30 = sext i8 %29 to i32
  %31 = icmp eq i32 %30, 112
  br i1 %31, label %32, label %41

32:                                               ; preds = %24
  %33 = load ptr, ptr %5, align 8, !tbaa !9
  %34 = getelementptr inbounds ptr, ptr %33, i64 1
  %35 = load ptr, ptr %34, align 8, !tbaa !9
  %36 = getelementptr inbounds i8, ptr %35, i64 2
  %37 = load i8, ptr %36, align 1, !tbaa !13
  %38 = sext i8 %37 to i32
  %39 = icmp eq i32 %38, 0
  br i1 %39, label %40, label %41

40:                                               ; preds = %32
  store i32 1, ptr @doExtensiveProfiling, align 4, !tbaa !5
  br label %42

41:                                               ; preds = %32, %24, %16
  call void @printUsage()
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %107

42:                                               ; preds = %40
  br label %43

43:                                               ; preds = %42, %2
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = icmp sgt i32 %44, 2
  br i1 %45, label %46, label %47

46:                                               ; preds = %43
  call void @printUsage()
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %107

47:                                               ; preds = %43
  %48 = call i64 @time(ptr noundef null) #4
  %49 = trunc i64 %48 to i32
  call void @srand(i32 noundef %49) #4
  %50 = call i32 @test_internals()
  store i32 %50, ptr %7, align 4, !tbaa !5
  %51 = load i32, ptr %7, align 4, !tbaa !5
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %57

53:                                               ; preds = %47
  %54 = load i32, ptr %7, align 4, !tbaa !5
  %55 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %54)
  %56 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %56, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %107

57:                                               ; preds = %47
  %58 = call i32 @test_abstract()
  store i32 %58, ptr %7, align 4, !tbaa !5
  %59 = load i32, ptr %7, align 4, !tbaa !5
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %61, label %65

61:                                               ; preds = %57
  %62 = load i32, ptr %7, align 4, !tbaa !5
  %63 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %62)
  %64 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %64, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %107

65:                                               ; preds = %57
  %66 = load i32, ptr @doExtensiveProfiling, align 4, !tbaa !5
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %106, label %68

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

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

74:                                               ; preds = %68
  %75 = load i32, ptr @insufficientClockPrecision, align 4, !tbaa !5
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %77, label %79

77:                                               ; preds = %74
  %78 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  br label %104

79:                                               ; preds = %74
  %80 = load i32, ptr @nbProfiledCall, align 4, !tbaa !5
  %81 = icmp sgt i32 %80, 0
  br i1 %81, label %82, label %103

82:                                               ; preds = %79
  %83 = load i32, ptr @nbProfiledCall, align 4, !tbaa !5
  %84 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %83)
  store double 1.000000e+06, ptr %6, align 8, !tbaa !11
  %85 = load double, ptr @timeInProfiledCall, align 8, !tbaa !11
  %86 = load double, ptr %6, align 8, !tbaa !11
  %87 = fdiv double %85, %86
  %88 = fdiv double %87, 1.000000e+03
  %89 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, double noundef %88)
  %90 = load double, ptr @worstProfiledCall, align 8, !tbaa !11
  %91 = load double, ptr %6, align 8, !tbaa !11
  %92 = fdiv double %90, %91
  %93 = fdiv double %92, 1.000000e+03
  %94 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, double noundef %93)
  %95 = load double, ptr @timeInProfiledCall, align 8, !tbaa !11
  %96 = load double, ptr %6, align 8, !tbaa !11
  %97 = fdiv double %95, %96
  %98 = fdiv double %97, 1.000000e+06
  %99 = load i32, ptr @nbProfiledCall, align 4, !tbaa !5
  %100 = sitofp i32 %99 to double
  %101 = fdiv double %98, %100
  %102 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, double noundef %101)
  br label %103

103:                                              ; preds = %82, %79
  br label %104

104:                                              ; preds = %103, %77
  %105 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  br label %106

106:                                              ; preds = %104, %65
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %107

107:                                              ; preds = %106, %72, %61, %53, %46, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %108 = load i32, ptr %3, align 4
  ret i32 %108
}

; 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 ptr @TA_GetVersionString() #2

; Function Attrs: nounwind uwtable
declare hidden void @printUsage() #0

; Function Attrs: nounwind
declare void @srand(i32 noundef) #3

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #3

declare i32 @test_internals() #2

declare i32 @test_abstract() #2

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

; 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 "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 = !{!"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 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!7, !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"

@insufficientClockPrecision = external dso_local local_unnamed_addr global i32, align 4
@timeInProfiledCall = external dso_local local_unnamed_addr global double, align 8
@worstProfiledCall = external dso_local local_unnamed_addr global double, align 8
@nbProfiledCall = external dso_local local_unnamed_addr global i32, align 4
@doExtensiveProfiling = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [46 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  store i32 0, ptr @insufficientClockPrecision, align 4, !tbaa !5
  store double 0.000000e+00, ptr @timeInProfiledCall, align 8, !tbaa !9
  store double 0.000000e+00, ptr @worstProfiledCall, align 8, !tbaa !9
  store i32 0, ptr @nbProfiledCall, align 4, !tbaa !5
  store i32 0, ptr @doExtensiveProfiling, align 4, !tbaa !5
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %4 = tail call ptr @TA_GetVersionString() #4
  %5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef %4)
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %7 = icmp eq i32 %0, 2
  br i1 %7, label %8, label %22

8:                                                ; preds = %2
  %9 = getelementptr inbounds i8, ptr %1, i64 8
  %10 = load ptr, ptr %9, align 8, !tbaa !11
  %11 = load i8, ptr %10, align 1, !tbaa !13
  %12 = icmp eq i8 %11, 45
  br i1 %12, label %13, label %21

13:                                               ; preds = %8
  %14 = getelementptr inbounds i8, ptr %10, i64 1
  %15 = load i8, ptr %14, align 1, !tbaa !13
  %16 = icmp eq i8 %15, 112
  br i1 %16, label %17, label %21

17:                                               ; preds = %13
  %18 = getelementptr inbounds i8, ptr %10, i64 2
  %19 = load i8, ptr %18, align 1, !tbaa !13
  %20 = icmp eq i8 %19, 0
  br i1 %20, label %.thread, label %21

.thread:                                          ; preds = %17
  store i32 1, ptr @doExtensiveProfiling, align 4, !tbaa !5
  br label %25

21:                                               ; preds = %17, %13, %8
  tail call void @printUsage()
  br label %65

22:                                               ; preds = %2
  %23 = icmp sgt i32 %0, 2
  br i1 %23, label %24, label %25

24:                                               ; preds = %22
  tail call void @printUsage()
  br label %65

25:                                               ; preds = %.thread, %22
  %26 = tail call i64 @time(ptr noundef null) #4
  %27 = trunc i64 %26 to i32
  tail call void @srand(i32 noundef %27) #4
  %28 = tail call i32 @test_internals() #4
  %.not = icmp eq i32 %28, 0
  br i1 %.not, label %31, label %29

29:                                               ; preds = %25
  %30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28)
  br label %65

31:                                               ; preds = %25
  %32 = tail call i32 @test_abstract() #4
  %.not21 = icmp eq i32 %32, 0
  br i1 %.not21, label %35, label %33

33:                                               ; preds = %31
  %34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %32)
  br label %65

35:                                               ; preds = %31
  %36 = load i32, ptr @doExtensiveProfiling, align 4, !tbaa !5
  %.not22 = icmp eq i32 %36, 0
  br i1 %.not22, label %37, label %65

37:                                               ; preds = %35
  %38 = tail call i32 @test_with_simulator()
  %.not23 = icmp eq i32 %38, 0
  br i1 %.not23, label %39, label %65

39:                                               ; preds = %37
  %40 = load i32, ptr @insufficientClockPrecision, align 4, !tbaa !5
  %.not24 = icmp eq i32 %40, 0
  br i1 %.not24, label %43, label %41

41:                                               ; preds = %39
  %42 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %63

43:                                               ; preds = %39
  %44 = load i32, ptr @nbProfiledCall, align 4, !tbaa !5
  %45 = icmp sgt i32 %44, 0
  br i1 %45, label %46, label %63

46:                                               ; preds = %43
  %47 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %44)
  %48 = load double, ptr @timeInProfiledCall, align 8, !tbaa !9
  %49 = fdiv double %48, 1.000000e+06
  %50 = fdiv double %49, 1.000000e+03
  %51 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, double noundef %50)
  %52 = load double, ptr @worstProfiledCall, align 8, !tbaa !9
  %53 = fdiv double %52, 1.000000e+06
  %54 = fdiv double %53, 1.000000e+03
  %55 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, double noundef %54)
  %56 = load double, ptr @timeInProfiledCall, align 8, !tbaa !9
  %57 = fdiv double %56, 1.000000e+06
  %58 = fdiv double %57, 1.000000e+06
  %59 = load i32, ptr @nbProfiledCall, align 4, !tbaa !5
  %60 = sitofp i32 %59 to double
  %61 = fdiv double %58, %60
  %62 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, double noundef %61)
  br label %63

63:                                               ; preds = %43, %46, %41
  %64 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  br label %65

65:                                               ; preds = %35, %63, %37, %33, %29, %24, %21
  %.0 = phi i32 [ 1, %24 ], [ %28, %29 ], [ %32, %33 ], [ 1, %21 ], [ %38, %37 ], [ 0, %63 ], [ 0, %35 ]
  ret i32 %.0
}

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

declare ptr @TA_GetVersionString() local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @printUsage() local_unnamed_addr #0

; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #3

declare i32 @test_internals() local_unnamed_addr #2

declare i32 @test_abstract() local_unnamed_addr #2

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

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 = { 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 #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 }

!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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!7, !7, i64 0}


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