; LLVM IR from Aakriti05/DSP-implementation_LMS_RNN :: rnn (sub_1)

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

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 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 ptr @sub_1(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %8 = call noalias ptr @malloc(i64 noundef 256) #4
  store ptr %8, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %9

9:                                                ; preds = %19, %1
  %10 = load i32, ptr %4, align 4, !tbaa !9
  %11 = icmp slt i32 %10, 32
  br i1 %11, label %13, label %12

12:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  br label %22

13:                                               ; preds = %9
  %14 = call noalias ptr @malloc(i64 noundef 128) #4
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = load i32, ptr %4, align 4, !tbaa !9
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds ptr, ptr %15, i64 %17
  store ptr %14, ptr %18, align 8, !tbaa !5
  br label %19

19:                                               ; preds = %13
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %4, align 4, !tbaa !9
  br label %9, !llvm.loop !11

22:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %55, %22
  %24 = load i32, ptr %5, align 4, !tbaa !9
  %25 = icmp slt i32 %24, 32
  br i1 %25, label %27, label %26

26:                                               ; preds = %23
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %58

27:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %51, %27
  %29 = load i32, ptr %7, align 4, !tbaa !9
  %30 = icmp slt i32 %29, 16
  br i1 %30, label %32, label %31

31:                                               ; preds = %28
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %54

32:                                               ; preds = %28
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = load i32, ptr %5, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds ptr, ptr %33, i64 %35
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  %38 = load i32, ptr %7, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds double, ptr %37, i64 %39
  %41 = load double, ptr %40, align 8, !tbaa !13
  %42 = fsub double 1.000000e+00, %41
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = load i32, ptr %5, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds ptr, ptr %43, i64 %45
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  %48 = load i32, ptr %7, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds double, ptr %47, i64 %49
  store double %42, ptr %50, align 8, !tbaa !13
  br label %51

51:                                               ; preds = %32
  %52 = load i32, ptr %7, align 4, !tbaa !9
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %7, align 4, !tbaa !9
  br label %28, !llvm.loop !15

54:                                               ; preds = %31
  br label %55

55:                                               ; preds = %54
  %56 = load i32, ptr %5, align 4, !tbaa !9
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %5, align 4, !tbaa !9
  br label %23, !llvm.loop !16

58:                                               ; preds = %26
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret ptr %59
}

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

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


; 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: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

; Function Attrs: nofree nounwind uwtable
define dso_local noalias noundef ptr @sub_1(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
.preheader.preheader:
  %1 = tail call noalias dereferenceable_or_null(256) ptr @malloc(i64 noundef 256) #2
  %2 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  store ptr %2, ptr %1, align 8, !tbaa !5
  %3 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %4 = getelementptr inbounds i8, ptr %1, i64 8
  store ptr %3, ptr %4, align 8, !tbaa !5
  %5 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %6 = getelementptr inbounds i8, ptr %1, i64 16
  store ptr %5, ptr %6, align 8, !tbaa !5
  %7 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %8 = getelementptr inbounds i8, ptr %1, i64 24
  store ptr %7, ptr %8, align 8, !tbaa !5
  %9 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %10 = getelementptr inbounds i8, ptr %1, i64 32
  store ptr %9, ptr %10, align 8, !tbaa !5
  %11 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %12 = getelementptr inbounds i8, ptr %1, i64 40
  store ptr %11, ptr %12, align 8, !tbaa !5
  %13 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %14 = getelementptr inbounds i8, ptr %1, i64 48
  store ptr %13, ptr %14, align 8, !tbaa !5
  %15 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %16 = getelementptr inbounds i8, ptr %1, i64 56
  store ptr %15, ptr %16, align 8, !tbaa !5
  %17 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %18 = getelementptr inbounds i8, ptr %1, i64 64
  store ptr %17, ptr %18, align 8, !tbaa !5
  %19 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %20 = getelementptr inbounds i8, ptr %1, i64 72
  store ptr %19, ptr %20, align 8, !tbaa !5
  %21 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %22 = getelementptr inbounds i8, ptr %1, i64 80
  store ptr %21, ptr %22, align 8, !tbaa !5
  %23 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %24 = getelementptr inbounds i8, ptr %1, i64 88
  store ptr %23, ptr %24, align 8, !tbaa !5
  %25 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %26 = getelementptr inbounds i8, ptr %1, i64 96
  store ptr %25, ptr %26, align 8, !tbaa !5
  %27 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %28 = getelementptr inbounds i8, ptr %1, i64 104
  store ptr %27, ptr %28, align 8, !tbaa !5
  %29 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %30 = getelementptr inbounds i8, ptr %1, i64 112
  store ptr %29, ptr %30, align 8, !tbaa !5
  %31 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %32 = getelementptr inbounds i8, ptr %1, i64 120
  store ptr %31, ptr %32, align 8, !tbaa !5
  %33 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %34 = getelementptr inbounds i8, ptr %1, i64 128
  store ptr %33, ptr %34, align 8, !tbaa !5
  %35 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %36 = getelementptr inbounds i8, ptr %1, i64 136
  store ptr %35, ptr %36, align 8, !tbaa !5
  %37 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %38 = getelementptr inbounds i8, ptr %1, i64 144
  store ptr %37, ptr %38, align 8, !tbaa !5
  %39 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %40 = getelementptr inbounds i8, ptr %1, i64 152
  store ptr %39, ptr %40, align 8, !tbaa !5
  %41 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %42 = getelementptr inbounds i8, ptr %1, i64 160
  store ptr %41, ptr %42, align 8, !tbaa !5
  %43 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %44 = getelementptr inbounds i8, ptr %1, i64 168
  store ptr %43, ptr %44, align 8, !tbaa !5
  %45 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %46 = getelementptr inbounds i8, ptr %1, i64 176
  store ptr %45, ptr %46, align 8, !tbaa !5
  %47 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %48 = getelementptr inbounds i8, ptr %1, i64 184
  store ptr %47, ptr %48, align 8, !tbaa !5
  %49 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %50 = getelementptr inbounds i8, ptr %1, i64 192
  store ptr %49, ptr %50, align 8, !tbaa !5
  %51 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %52 = getelementptr inbounds i8, ptr %1, i64 200
  store ptr %51, ptr %52, align 8, !tbaa !5
  %53 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %54 = getelementptr inbounds i8, ptr %1, i64 208
  store ptr %53, ptr %54, align 8, !tbaa !5
  %55 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %56 = getelementptr inbounds i8, ptr %1, i64 216
  store ptr %55, ptr %56, align 8, !tbaa !5
  %57 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %58 = getelementptr inbounds i8, ptr %1, i64 224
  store ptr %57, ptr %58, align 8, !tbaa !5
  %59 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %60 = getelementptr inbounds i8, ptr %1, i64 232
  store ptr %59, ptr %60, align 8, !tbaa !5
  %61 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %62 = getelementptr inbounds i8, ptr %1, i64 240
  store ptr %61, ptr %62, align 8, !tbaa !5
  %63 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #2
  %64 = getelementptr inbounds i8, ptr %1, i64 248
  store ptr %63, ptr %64, align 8, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.preheader
  %indvars.iv = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next, %.preheader ]
  %65 = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  %67 = getelementptr inbounds ptr, ptr %1, i64 %indvars.iv
  %68 = load ptr, ptr %67, align 8, !tbaa !5
  %69 = load double, ptr %66, align 8, !tbaa !9
  %70 = fsub double 1.000000e+00, %69
  store double %70, ptr %68, align 8, !tbaa !9
  %71 = getelementptr inbounds i8, ptr %66, i64 8
  %72 = load double, ptr %71, align 8, !tbaa !9
  %73 = fsub double 1.000000e+00, %72
  %74 = getelementptr inbounds i8, ptr %68, i64 8
  store double %73, ptr %74, align 8, !tbaa !9
  %75 = getelementptr inbounds i8, ptr %66, i64 16
  %76 = load double, ptr %75, align 8, !tbaa !9
  %77 = fsub double 1.000000e+00, %76
  %78 = getelementptr inbounds i8, ptr %68, i64 16
  store double %77, ptr %78, align 8, !tbaa !9
  %79 = getelementptr inbounds i8, ptr %66, i64 24
  %80 = load double, ptr %79, align 8, !tbaa !9
  %81 = fsub double 1.000000e+00, %80
  %82 = getelementptr inbounds i8, ptr %68, i64 24
  store double %81, ptr %82, align 8, !tbaa !9
  %83 = getelementptr inbounds i8, ptr %66, i64 32
  %84 = load double, ptr %83, align 8, !tbaa !9
  %85 = fsub double 1.000000e+00, %84
  %86 = getelementptr inbounds i8, ptr %68, i64 32
  store double %85, ptr %86, align 8, !tbaa !9
  %87 = getelementptr inbounds i8, ptr %66, i64 40
  %88 = load double, ptr %87, align 8, !tbaa !9
  %89 = fsub double 1.000000e+00, %88
  %90 = getelementptr inbounds i8, ptr %68, i64 40
  store double %89, ptr %90, align 8, !tbaa !9
  %91 = getelementptr inbounds i8, ptr %66, i64 48
  %92 = load double, ptr %91, align 8, !tbaa !9
  %93 = fsub double 1.000000e+00, %92
  %94 = getelementptr inbounds i8, ptr %68, i64 48
  store double %93, ptr %94, align 8, !tbaa !9
  %95 = getelementptr inbounds i8, ptr %66, i64 56
  %96 = load double, ptr %95, align 8, !tbaa !9
  %97 = fsub double 1.000000e+00, %96
  %98 = getelementptr inbounds i8, ptr %68, i64 56
  store double %97, ptr %98, align 8, !tbaa !9
  %99 = getelementptr inbounds i8, ptr %66, i64 64
  %100 = load double, ptr %99, align 8, !tbaa !9
  %101 = fsub double 1.000000e+00, %100
  %102 = getelementptr inbounds i8, ptr %68, i64 64
  store double %101, ptr %102, align 8, !tbaa !9
  %103 = getelementptr inbounds i8, ptr %66, i64 72
  %104 = load double, ptr %103, align 8, !tbaa !9
  %105 = fsub double 1.000000e+00, %104
  %106 = getelementptr inbounds i8, ptr %68, i64 72
  store double %105, ptr %106, align 8, !tbaa !9
  %107 = getelementptr inbounds i8, ptr %66, i64 80
  %108 = load double, ptr %107, align 8, !tbaa !9
  %109 = fsub double 1.000000e+00, %108
  %110 = getelementptr inbounds i8, ptr %68, i64 80
  store double %109, ptr %110, align 8, !tbaa !9
  %111 = getelementptr inbounds i8, ptr %66, i64 88
  %112 = load double, ptr %111, align 8, !tbaa !9
  %113 = fsub double 1.000000e+00, %112
  %114 = getelementptr inbounds i8, ptr %68, i64 88
  store double %113, ptr %114, align 8, !tbaa !9
  %115 = getelementptr inbounds i8, ptr %66, i64 96
  %116 = load double, ptr %115, align 8, !tbaa !9
  %117 = fsub double 1.000000e+00, %116
  %118 = getelementptr inbounds i8, ptr %68, i64 96
  store double %117, ptr %118, align 8, !tbaa !9
  %119 = getelementptr inbounds i8, ptr %66, i64 104
  %120 = load double, ptr %119, align 8, !tbaa !9
  %121 = fsub double 1.000000e+00, %120
  %122 = getelementptr inbounds i8, ptr %68, i64 104
  store double %121, ptr %122, align 8, !tbaa !9
  %123 = getelementptr inbounds i8, ptr %66, i64 112
  %124 = load double, ptr %123, align 8, !tbaa !9
  %125 = fsub double 1.000000e+00, %124
  %126 = getelementptr inbounds i8, ptr %68, i64 112
  store double %125, ptr %126, align 8, !tbaa !9
  %127 = getelementptr inbounds i8, ptr %66, i64 120
  %128 = load double, ptr %127, align 8, !tbaa !9
  %129 = fsub double 1.000000e+00, %128
  %130 = getelementptr inbounds i8, ptr %68, i64 120
  store double %129, ptr %130, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 32
  br i1 %exitcond.not, label %131, label %.preheader, !llvm.loop !11

131:                                              ; preds = %.preheader
  ret ptr %1
}

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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" }
attributes #2 = { nounwind allocsize(0) }

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass