; LLVM IR from mkmarek/forex.analytics :: lib/ta-lib/src/ta_abstract (ta_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"

%struct.TA_ParamHolder = type { ptr }
%struct.TA_ParamHolderPriv = type { i32, ptr, ptr, ptr, i32, i32, ptr }
%struct.TA_FuncInfo = type { ptr, ptr, ptr, ptr, i32, i32, i32, i32, ptr }
%struct.TA_FuncDef = type { i32, i32, ptr, ptr, ptr, ptr, ptr, ptr }

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @TA_CallFunc(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4) #1 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #2
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = icmp eq ptr %18, null
  br i1 %19, label %26, label %20

20:                                               ; preds = %5
  %21 = load ptr, ptr %10, align 8, !tbaa !5
  %22 = icmp eq ptr %21, null
  br i1 %22, label %26, label %23

23:                                               ; preds = %20
  %24 = load ptr, ptr %11, align 8, !tbaa !5
  %25 = icmp eq ptr %24, null
  br i1 %25, label %26, label %27

26:                                               ; preds = %23, %20, %5
  store i32 2, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %78

27:                                               ; preds = %23
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.TA_ParamHolder, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !11
  store ptr %30, ptr %13, align 8, !tbaa !5
  %31 = load ptr, ptr %13, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.TA_ParamHolderPriv, ptr %31, i32 0, i32 0
  %33 = load i32, ptr %32, align 8, !tbaa !13
  %34 = icmp ne i32 %33, -1576881662
  br i1 %34, label %35, label %36

35:                                               ; preds = %27
  store i32 7, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %78

36:                                               ; preds = %27
  %37 = load ptr, ptr %13, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.TA_ParamHolderPriv, ptr %37, i32 0, i32 4
  %39 = load i32, ptr %38, align 8, !tbaa !15
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %42

41:                                               ; preds = %36
  store i32 10, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %78

42:                                               ; preds = %36
  %43 = load ptr, ptr %13, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.TA_ParamHolderPriv, ptr %43, i32 0, i32 5
  %45 = load i32, ptr %44, align 4, !tbaa !16
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %42
  store i32 11, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %78

48:                                               ; preds = %42
  %49 = load ptr, ptr %13, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.TA_ParamHolderPriv, ptr %49, i32 0, i32 6
  %51 = load ptr, ptr %50, align 8, !tbaa !17
  store ptr %51, ptr %15, align 8, !tbaa !5
  %52 = load ptr, ptr %15, align 8, !tbaa !5
  %53 = icmp ne ptr %52, null
  br i1 %53, label %55, label %54

54:                                               ; preds = %48
  store i32 6, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %78

55:                                               ; preds = %48
  %56 = load ptr, ptr %15, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.TA_FuncInfo, ptr %56, i32 0, i32 8
  %58 = load ptr, ptr %57, align 8, !tbaa !18
  store ptr %58, ptr %14, align 8, !tbaa !5
  %59 = load ptr, ptr %14, align 8, !tbaa !5
  %60 = icmp ne ptr %59, null
  br i1 %60, label %62, label %61

61:                                               ; preds = %55
  store i32 5002, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %78

62:                                               ; preds = %55
  %63 = load ptr, ptr %14, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.TA_FuncDef, ptr %63, i32 0, i32 6
  %65 = load ptr, ptr %64, align 8, !tbaa !20
  store ptr %65, ptr %16, align 8, !tbaa !5
  %66 = load ptr, ptr %16, align 8, !tbaa !5
  %67 = icmp ne ptr %66, null
  br i1 %67, label %69, label %68

68:                                               ; preds = %62
  store i32 5002, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %78

69:                                               ; preds = %62
  %70 = load ptr, ptr %16, align 8, !tbaa !5
  %71 = load ptr, ptr %13, align 8, !tbaa !5
  %72 = load i32, ptr %8, align 4, !tbaa !9
  %73 = load i32, ptr %9, align 4, !tbaa !9
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = load ptr, ptr %11, align 8, !tbaa !5
  %76 = call i32 %70(ptr noundef %71, i32 noundef %72, i32 noundef %73, ptr noundef %74, ptr noundef %75)
  store i32 %76, ptr %12, align 4, !tbaa !9
  %77 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %77, ptr %6, align 4
  store i32 1, ptr %17, align 4
  br label %78

78:                                               ; preds = %69, %68, %61, %54, %47, %41, %35, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #2
  %79 = load i32, ptr %6, align 4
  ret i32 %79
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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}
!11 = !{!12, !6, i64 0}
!12 = !{!"TA_ParamHolder", !6, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !10, i64 36, !6, i64 40}
!15 = !{!14, !10, i64 32}
!16 = !{!14, !10, i64 36}
!17 = !{!14, !6, i64 40}
!18 = !{!19, !6, i64 48}
!19 = !{!"TA_FuncInfo", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !6, i64 48}
!20 = !{!21, !6, i64 40}
!21 = !{!"", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}


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

; Function Attrs: nounwind uwtable
define dso_local i32 @TA_CallFunc(ptr noundef readonly %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = icmp eq ptr %0, null
  %7 = icmp eq ptr %3, null
  %or.cond = or i1 %6, %7
  %8 = icmp eq ptr %4, null
  %or.cond3 = or i1 %or.cond, %8
  br i1 %or.cond3, label %29, label %9

9:                                                ; preds = %5
  %10 = load ptr, ptr %0, align 8, !tbaa !5
  %11 = load i32, ptr %10, align 8, !tbaa !10
  %.not = icmp eq i32 %11, -1576881662
  br i1 %.not, label %12, label %29

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %10, i64 32
  %14 = load i32, ptr %13, align 8, !tbaa !13
  %.not29 = icmp eq i32 %14, 0
  br i1 %.not29, label %15, label %29

15:                                               ; preds = %12
  %16 = getelementptr inbounds i8, ptr %10, i64 36
  %17 = load i32, ptr %16, align 4, !tbaa !14
  %.not30 = icmp eq i32 %17, 0
  br i1 %.not30, label %18, label %29

18:                                               ; preds = %15
  %19 = getelementptr inbounds i8, ptr %10, i64 40
  %20 = load ptr, ptr %19, align 8, !tbaa !15
  %.not31 = icmp eq ptr %20, null
  br i1 %.not31, label %29, label %21

21:                                               ; preds = %18
  %22 = getelementptr inbounds i8, ptr %20, i64 48
  %23 = load ptr, ptr %22, align 8, !tbaa !16
  %.not32 = icmp eq ptr %23, null
  br i1 %.not32, label %29, label %24

24:                                               ; preds = %21
  %25 = getelementptr inbounds i8, ptr %23, i64 40
  %26 = load ptr, ptr %25, align 8, !tbaa !18
  %.not33 = icmp eq ptr %26, null
  br i1 %.not33, label %29, label %27

27:                                               ; preds = %24
  %28 = tail call i32 %26(ptr noundef nonnull %10, i32 noundef %1, i32 noundef %2, ptr noundef nonnull %3, ptr noundef nonnull %4) #1
  br label %29

29:                                               ; preds = %24, %21, %18, %15, %12, %9, %5, %27
  %.0 = phi i32 [ %28, %27 ], [ 2, %5 ], [ 7, %9 ], [ 10, %12 ], [ 11, %15 ], [ 6, %18 ], [ 5002, %21 ], [ 5002, %24 ]
  ret i32 %.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 = { 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, !7, i64 0}
!6 = !{!"TA_ParamHolder", !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !12, i64 0}
!11 = !{!"", !12, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !12, i64 32, !12, i64 36, !7, i64 40}
!12 = !{!"int", !8, i64 0}
!13 = !{!11, !12, i64 32}
!14 = !{!11, !12, i64 36}
!15 = !{!11, !7, i64 40}
!16 = !{!17, !7, i64 48}
!17 = !{!"TA_FuncInfo", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !7, i64 48}
!18 = !{!19, !7, i64 40}
!19 = !{!"", !12, i64 0, !12, i64 4, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48}


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