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

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

@memoryGuard1 = external dso_local global double, align 8
@memoryGuard2 = external dso_local global double, align 8
@.str.4 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [47 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 i32 @printf(ptr noundef, ...) #1

; 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 @checkForNAN(ptr noundef %0, i32 noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds double, ptr %10, i64 -100
  store ptr %11, ptr %8, align 8, !tbaa !5
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %12

12:                                               ; preds = %31, %2
  %13 = load i32, ptr %7, align 4, !tbaa !9
  %14 = icmp ult i32 %13, 100
  br i1 %14, label %15, label %34

15:                                               ; preds = %12
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  %17 = load i32, ptr %7, align 4, !tbaa !9
  %18 = zext i32 %17 to i64
  %19 = getelementptr inbounds double, ptr %16, i64 %18
  %20 = load double, ptr %19, align 8, !tbaa !11
  %21 = fcmp une double %20, 0x169BF822017C18B6
  br i1 %21, label %22, label %30

22:                                               ; preds = %15
  %23 = load i32, ptr %7, align 4, !tbaa !9
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = zext i32 %25 to i64
  %27 = getelementptr inbounds double, ptr %24, i64 %26
  %28 = load double, ptr %27, align 8, !tbaa !11
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %23, double noundef %28)
  store i32 128, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %119

30:                                               ; preds = %15
  br label %31

31:                                               ; preds = %30
  %32 = load i32, ptr %7, align 4, !tbaa !9
  %33 = add i32 %32, 1
  store i32 %33, ptr %7, align 4, !tbaa !9
  br label %12, !llvm.loop !13

34:                                               ; preds = %12
  %35 = load i32, ptr %5, align 4, !tbaa !9
  %36 = icmp ugt i32 %35, 280
  br i1 %36, label %37, label %40

37:                                               ; preds = %34
  %38 = load i32, ptr %5, align 4, !tbaa !9
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %38)
  store i32 139, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %119

40:                                               ; preds = %34
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %76, %40
  %42 = load i32, ptr %6, align 4, !tbaa !9
  %43 = load i32, ptr %5, align 4, !tbaa !9
  %44 = icmp ult i32 %42, %43
  br i1 %44, label %45, label %81

45:                                               ; preds = %41
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = load i32, ptr %7, align 4, !tbaa !9
  %48 = zext i32 %47 to i64
  %49 = getelementptr inbounds double, ptr %46, i64 %48
  %50 = load double, ptr %49, align 8, !tbaa !11
  %51 = fcmp oeq double %50, 0x169BF822017C18B6
  br i1 %51, label %52, label %60

52:                                               ; preds = %45
  %53 = load i32, ptr %6, align 4, !tbaa !9
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = load i32, ptr %7, align 4, !tbaa !9
  %56 = zext i32 %55 to i64
  %57 = getelementptr inbounds double, ptr %54, i64 %56
  %58 = load double, ptr %57, align 8, !tbaa !11
  %59 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %53, double noundef %58)
  store i32 131, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %119

60:                                               ; preds = %45
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  %62 = load i32, ptr %7, align 4, !tbaa !9
  %63 = zext i32 %62 to i64
  %64 = getelementptr inbounds double, ptr %61, i64 %63
  %65 = load double, ptr %64, align 8, !tbaa !11
  %66 = fcmp oeq double %65, 0x1F51E6A6CD594789
  br i1 %66, label %67, label %75

67:                                               ; preds = %60
  %68 = load i32, ptr %6, align 4, !tbaa !9
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = load i32, ptr %7, align 4, !tbaa !9
  %71 = zext i32 %70 to i64
  %72 = getelementptr inbounds double, ptr %69, i64 %71
  %73 = load double, ptr %72, align 8, !tbaa !11
  %74 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %68, double noundef %73)
  store i32 132, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %119

75:                                               ; preds = %60
  br label %76

76:                                               ; preds = %75
  %77 = load i32, ptr %6, align 4, !tbaa !9
  %78 = add i32 %77, 1
  store i32 %78, ptr %6, align 4, !tbaa !9
  %79 = load i32, ptr %7, align 4, !tbaa !9
  %80 = add i32 %79, 1
  store i32 %80, ptr %7, align 4, !tbaa !9
  br label %41, !llvm.loop !15

81:                                               ; preds = %41
  br label %82

82:                                               ; preds = %103, %81
  %83 = load i32, ptr %7, align 4, !tbaa !9
  %84 = icmp ult i32 %83, 480
  br i1 %84, label %85, label %106

85:                                               ; preds = %82
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  %87 = load i32, ptr %7, align 4, !tbaa !9
  %88 = zext i32 %87 to i64
  %89 = getelementptr inbounds double, ptr %86, i64 %88
  %90 = load double, ptr %89, align 8, !tbaa !11
  %91 = fcmp une double %90, 0x1F51E6A6CD594789
  br i1 %91, label %92, label %100

92:                                               ; preds = %85
  %93 = load i32, ptr %7, align 4, !tbaa !9
  %94 = load ptr, ptr %8, align 8, !tbaa !5
  %95 = load i32, ptr %7, align 4, !tbaa !9
  %96 = zext i32 %95 to i64
  %97 = getelementptr inbounds double, ptr %94, i64 %96
  %98 = load double, ptr %97, align 8, !tbaa !11
  %99 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %93, double noundef %98)
  store i32 133, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %119

100:                                              ; preds = %85
  %101 = load i32, ptr %7, align 4, !tbaa !9
  %102 = add i32 %101, 1
  store i32 %102, ptr %7, align 4, !tbaa !9
  br label %103

103:                                              ; preds = %100
  %104 = load i32, ptr %7, align 4, !tbaa !9
  %105 = add i32 %104, 1
  store i32 %105, ptr %7, align 4, !tbaa !9
  br label %82, !llvm.loop !16

106:                                              ; preds = %82
  %107 = load double, ptr @memoryGuard1, align 8, !tbaa !11
  %108 = fcmp une double %107, 0x20E03A9C7A5E6978
  br i1 %108, label %109, label %112

109:                                              ; preds = %106
  %110 = load double, ptr @memoryGuard1, align 8, !tbaa !11
  %111 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, double noundef %110, double noundef 0x20E03A9C7A5E6978)
  store i32 134, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %119

112:                                              ; preds = %106
  %113 = load double, ptr @memoryGuard2, align 8, !tbaa !11
  %114 = fcmp une double %113, 0x1DCF2E656FAFE994
  br i1 %114, label %115, label %118

115:                                              ; preds = %112
  %116 = load double, ptr @memoryGuard2, align 8, !tbaa !11
  %117 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, double noundef %116, double noundef 0x1DCF2E656FAFE994)
  store i32 135, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %119

118:                                              ; preds = %112
  store i32 0, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %119

119:                                              ; preds = %118, %115, %109, %92, %67, %52, %37, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  %120 = load i32, ptr %3, align 4
  ret i32 %120
}

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 }

!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, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


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

@memoryGuard1 = external dso_local local_unnamed_addr global double, align 8
@memoryGuard2 = external dso_local local_unnamed_addr global double, align 8
@.str.4 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [47 x i8], align 1

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

; Function Attrs: nofree nounwind uwtable
define dso_local range(i32 0, 140) i32 @checkForNAN(ptr nocapture noundef readonly %0, i32 noundef %1) local_unnamed_addr #1 {
  %3 = getelementptr inbounds i8, ptr %0, i64 -800
  br label %4

4:                                                ; preds = %27, %2
  %indvars.iv = phi i64 [ 0, %2 ], [ %indvars.iv.next.4, %27 ]
  %5 = getelementptr inbounds double, ptr %3, i64 %indvars.iv
  %6 = load double, ptr %5, align 8, !tbaa !5
  %7 = fcmp une double %6, 0x169BF822017C18B6
  br i1 %7, label %8, label %11

8:                                                ; preds = %23, %19, %15, %11, %4
  %indvars.iv.lcssa = phi i64 [ %indvars.iv, %4 ], [ %indvars.iv.next, %11 ], [ %indvars.iv.next.1, %15 ], [ %indvars.iv.next.2, %19 ], [ %indvars.iv.next.3, %23 ]
  %.lcssa94 = phi double [ %6, %4 ], [ %13, %11 ], [ %17, %15 ], [ %21, %19 ], [ %25, %23 ]
  %9 = trunc nuw nsw i64 %indvars.iv.lcssa to i32
  %10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %9, double noundef %.lcssa94)
  br label %64

11:                                               ; preds = %4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %12 = getelementptr inbounds double, ptr %3, i64 %indvars.iv.next
  %13 = load double, ptr %12, align 8, !tbaa !5
  %14 = fcmp une double %13, 0x169BF822017C18B6
  br i1 %14, label %8, label %15

15:                                               ; preds = %11
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %16 = getelementptr inbounds double, ptr %3, i64 %indvars.iv.next.1
  %17 = load double, ptr %16, align 8, !tbaa !5
  %18 = fcmp une double %17, 0x169BF822017C18B6
  br i1 %18, label %8, label %19

19:                                               ; preds = %15
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %20 = getelementptr inbounds double, ptr %3, i64 %indvars.iv.next.2
  %21 = load double, ptr %20, align 8, !tbaa !5
  %22 = fcmp une double %21, 0x169BF822017C18B6
  br i1 %22, label %8, label %23

23:                                               ; preds = %19
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %24 = getelementptr inbounds double, ptr %3, i64 %indvars.iv.next.3
  %25 = load double, ptr %24, align 8, !tbaa !5
  %26 = fcmp une double %25, 0x169BF822017C18B6
  br i1 %26, label %8, label %27

27:                                               ; preds = %23
  %indvars.iv.next.4 = add nuw nsw i64 %indvars.iv, 5
  %exitcond.not.4 = icmp eq i64 %indvars.iv.next.4, 100
  br i1 %exitcond.not.4, label %28, label %4, !llvm.loop !9

28:                                               ; preds = %27
  %29 = icmp ugt i32 %1, 280
  br i1 %29, label %31, label %.preheader42

.preheader42:                                     ; preds = %28
  %.not = icmp eq i32 %1, 0
  br i1 %.not, label %.lr.ph56.preheader, label %.lr.ph.preheader

.lr.ph56.preheader:                               ; preds = %.preheader, %.preheader42
  %indvars.iv71.ph = phi i64 [ 100, %.preheader42 ], [ %33, %.preheader ]
  br label %.lr.ph56

.lr.ph.preheader:                                 ; preds = %.preheader42
  %30 = add nuw nsw i32 %1, 100
  br label %.lr.ph

31:                                               ; preds = %28
  %32 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %1)
  br label %64

.preheader:                                       ; preds = %44
  %33 = zext nneg i32 %30 to i64
  br label %.lr.ph56.preheader

.lr.ph:                                           ; preds = %.lr.ph.preheader, %44
  %.154 = phi i32 [ %46, %44 ], [ 100, %.lr.ph.preheader ]
  %.03353 = phi i32 [ %45, %44 ], [ 0, %.lr.ph.preheader ]
  %34 = zext i32 %.154 to i64
  %35 = getelementptr inbounds double, ptr %3, i64 %34
  %36 = load double, ptr %35, align 8, !tbaa !5
  %37 = fcmp oeq double %36, 0x169BF822017C18B6
  br i1 %37, label %38, label %40

38:                                               ; preds = %.lr.ph
  %39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %.03353, double noundef 0x169BF822017C18B6)
  br label %64

40:                                               ; preds = %.lr.ph
  %41 = fcmp oeq double %36, 0x1F51E6A6CD594789
  br i1 %41, label %42, label %44

42:                                               ; preds = %40
  %43 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %.03353, double noundef 0x1F51E6A6CD594789)
  br label %64

44:                                               ; preds = %40
  %45 = add nuw i32 %.03353, 1
  %46 = add i32 %.154, 1
  %exitcond70.not = icmp eq i32 %45, %1
  br i1 %exitcond70.not, label %.preheader, label %.lr.ph, !llvm.loop !11

.lr.ph56:                                         ; preds = %.lr.ph56.preheader, %53
  %indvars.iv71 = phi i64 [ %indvars.iv.next72, %53 ], [ %indvars.iv71.ph, %.lr.ph56.preheader ]
  %47 = getelementptr inbounds double, ptr %3, i64 %indvars.iv71
  %48 = load double, ptr %47, align 8, !tbaa !5
  %49 = fcmp une double %48, 0x1F51E6A6CD594789
  br i1 %49, label %50, label %53

50:                                               ; preds = %.lr.ph56
  %51 = trunc nuw nsw i64 %indvars.iv71 to i32
  %52 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %51, double noundef %48)
  br label %64

53:                                               ; preds = %.lr.ph56
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 2
  %54 = icmp ult i64 %indvars.iv71, 478
  br i1 %54, label %.lr.ph56, label %._crit_edge, !llvm.loop !12

._crit_edge:                                      ; preds = %53
  %55 = load double, ptr @memoryGuard1, align 8, !tbaa !5
  %56 = fcmp une double %55, 0x20E03A9C7A5E6978
  br i1 %56, label %57, label %59

57:                                               ; preds = %._crit_edge
  %58 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, double noundef %55, double noundef 0x20E03A9C7A5E6978)
  br label %64

59:                                               ; preds = %._crit_edge
  %60 = load double, ptr @memoryGuard2, align 8, !tbaa !5
  %61 = fcmp une double %60, 0x1DCF2E656FAFE994
  br i1 %61, label %62, label %64

62:                                               ; preds = %59
  %63 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, double noundef %60, double noundef 0x1DCF2E656FAFE994)
  br label %64

64:                                               ; preds = %59, %62, %57, %50, %42, %38, %31, %8
  %.0 = phi i32 [ 128, %8 ], [ 139, %31 ], [ 131, %38 ], [ 132, %42 ], [ 133, %50 ], [ 134, %57 ], [ 135, %62 ], [ 0, %59 ]
  ret i32 %.0
}

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 = { nofree 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" }

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass