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

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

14:                                               ; preds = %72, %2
  %15 = load i32, ptr %8, align 4, !tbaa !9
  %16 = icmp ult i32 %15, 480
  br i1 %16, label %17, label %75

17:                                               ; preds = %14
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = load i32, ptr %8, align 4, !tbaa !9
  %20 = zext i32 %19 to i64
  %21 = getelementptr inbounds double, ptr %18, i64 %20
  %22 = load double, ptr %21, align 8, !tbaa !11
  %23 = fcmp une double %22, 0x1F51E6A6CD594789
  br i1 %23, label %24, label %71

24:                                               ; preds = %17
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = load i32, ptr %8, align 4, !tbaa !9
  %27 = zext i32 %26 to i64
  %28 = getelementptr inbounds double, ptr %25, i64 %27
  %29 = load double, ptr %28, align 8, !tbaa !11
  %30 = fcmp une double %29, 0x169BF822017C18B6
  br i1 %30, label %31, label %71

31:                                               ; preds = %24
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = load i32, ptr %8, align 4, !tbaa !9
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds double, ptr %32, i64 %34
  %36 = load double, ptr %35, align 8, !tbaa !11
  %37 = fsub double %36, 0x3EB0C6F7A0B5ED8D
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = load i32, ptr %8, align 4, !tbaa !9
  %40 = zext i32 %39 to i64
  %41 = getelementptr inbounds double, ptr %38, i64 %40
  %42 = load double, ptr %41, align 8, !tbaa !11
  %43 = fcmp olt double %37, %42
  br i1 %43, label %44, label %57

44:                                               ; preds = %31
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = load i32, ptr %8, align 4, !tbaa !9
  %47 = zext i32 %46 to i64
  %48 = getelementptr inbounds double, ptr %45, i64 %47
  %49 = load double, ptr %48, align 8, !tbaa !11
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = load i32, ptr %8, align 4, !tbaa !9
  %52 = zext i32 %51 to i64
  %53 = getelementptr inbounds double, ptr %50, i64 %52
  %54 = load double, ptr %53, align 8, !tbaa !11
  %55 = fadd double %54, 0x3EB0C6F7A0B5ED8D
  %56 = fcmp olt double %49, %55
  br i1 %56, label %70, label %57

57:                                               ; preds = %44, %31
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = load i32, ptr %8, align 4, !tbaa !9
  %60 = zext i32 %59 to i64
  %61 = getelementptr inbounds double, ptr %58, i64 %60
  %62 = load double, ptr %61, align 8, !tbaa !11
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = load i32, ptr %8, align 4, !tbaa !9
  %65 = zext i32 %64 to i64
  %66 = getelementptr inbounds double, ptr %63, i64 %65
  %67 = load double, ptr %66, align 8, !tbaa !11
  %68 = load i32, ptr %8, align 4, !tbaa !9
  %69 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, double noundef %62, double noundef %67, i32 noundef %68)
  store i32 127, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %76

70:                                               ; preds = %44
  br label %71

71:                                               ; preds = %70, %24, %17
  br label %72

72:                                               ; preds = %71
  %73 = load i32, ptr %8, align 4, !tbaa !9
  %74 = add i32 %73, 1
  store i32 %74, ptr %8, align 4, !tbaa !9
  br label %14, !llvm.loop !13

75:                                               ; preds = %14
  store i32 0, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %76

76:                                               ; preds = %75, %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %77 = load i32, ptr %3, align 4
  ret i32 %77
}

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


; 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.10 = external hidden unnamed_addr constant [78 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, 128) i32 @checkSameContent(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #1 {
  %3 = getelementptr inbounds i8, ptr %0, i64 -800
  %4 = getelementptr inbounds i8, ptr %1, i64 -800
  br label %5

5:                                                ; preds = %32, %2
  %indvars.iv = phi i64 [ 0, %2 ], [ %indvars.iv.next.1, %32 ]
  %6 = getelementptr inbounds double, ptr %3, i64 %indvars.iv
  %7 = load double, ptr %6, align 8, !tbaa !5
  %8 = fcmp une double %7, 0x1F51E6A6CD594789
  %9 = fcmp une double %7, 0x169BF822017C18B6
  %or.cond = and i1 %8, %9
  br i1 %or.cond, label %10, label %20

10:                                               ; preds = %5
  %11 = getelementptr inbounds double, ptr %4, i64 %indvars.iv
  %12 = load double, ptr %11, align 8, !tbaa !5
  %13 = fadd double %12, 0xBEB0C6F7A0B5ED8D
  %14 = fcmp olt double %13, %7
  %15 = fadd double %12, 0x3EB0C6F7A0B5ED8D
  %16 = fcmp olt double %7, %15
  %or.cond24 = and i1 %14, %16
  br i1 %or.cond24, label %20, label %17

17:                                               ; preds = %25, %10
  %indvars.iv.lcssa = phi i64 [ %indvars.iv, %10 ], [ %indvars.iv.next, %25 ]
  %.lcssa38 = phi double [ %7, %10 ], [ %22, %25 ]
  %.lcssa = phi double [ %12, %10 ], [ %27, %25 ]
  %18 = trunc nuw nsw i64 %indvars.iv.lcssa to i32
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, double noundef %.lcssa38, double noundef %.lcssa, i32 noundef %18)
  br label %.loopexit

20:                                               ; preds = %10, %5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %21 = getelementptr inbounds double, ptr %3, i64 %indvars.iv.next
  %22 = load double, ptr %21, align 8, !tbaa !5
  %23 = fcmp une double %22, 0x1F51E6A6CD594789
  %24 = fcmp une double %22, 0x169BF822017C18B6
  %or.cond.1 = and i1 %23, %24
  br i1 %or.cond.1, label %25, label %32

25:                                               ; preds = %20
  %26 = getelementptr inbounds double, ptr %4, i64 %indvars.iv.next
  %27 = load double, ptr %26, align 8, !tbaa !5
  %28 = fadd double %27, 0xBEB0C6F7A0B5ED8D
  %29 = fcmp olt double %28, %22
  %30 = fadd double %27, 0x3EB0C6F7A0B5ED8D
  %31 = fcmp olt double %22, %30
  %or.cond24.1 = and i1 %29, %31
  br i1 %or.cond24.1, label %32, label %17

32:                                               ; preds = %25, %20
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 480
  br i1 %exitcond.not.1, label %.loopexit, label %5, !llvm.loop !9

.loopexit:                                        ; preds = %32, %17
  %.021 = phi i32 [ 127, %17 ], [ 0, %32 ]
  ret i32 %.021
}

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


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