; LLVM IR from lshil00/Quadruped_robot :: 单片机控制代码/Quadruped_Robot/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/JTest/src (segments)

; 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.JTEST_FW_struct = type { i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, i32, i32 }

@JTEST_FW = external global %struct.JTEST_FW_struct, align 8

; Function Attrs: nounwind uwtable
define dso_local void @jtest_dump_str_segments() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  store i32 0, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %4 = load volatile ptr, ptr getelementptr inbounds (%struct.JTEST_FW_struct, ptr @JTEST_FW, i32 0, i32 8), align 8, !tbaa !9
  %5 = call i64 @strlen(ptr noundef %4) #6
  %6 = udiv i64 %5, 128
  %7 = add i64 %6, 1
  %8 = trunc i64 %7 to i32
  store i32 %8, ptr %3, align 4, !tbaa !5
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %9

9:                                                ; preds = %43, %0
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %11 = load i32, ptr %3, align 4, !tbaa !5
  %12 = icmp ult i32 %10, %11
  br i1 %12, label %13, label %46

13:                                               ; preds = %9
  br label %14

14:                                               ; preds = %13
  call void @dump_str()
  br label %15

15:                                               ; preds = %14
  br label %16

16:                                               ; preds = %15
  %17 = load i32, ptr %1, align 4, !tbaa !5
  %18 = icmp ult i32 %17, 2
  br i1 %18, label %19, label %42

19:                                               ; preds = %16
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %27, %19
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = load i32, ptr %1, align 4, !tbaa !5
  %24 = sub i32 %22, %23
  %25 = sub i32 %24, 1
  %26 = icmp ult i32 %21, %25
  br i1 %26, label %27, label %41

27:                                               ; preds = %20
  %28 = load volatile ptr, ptr getelementptr inbounds (%struct.JTEST_FW_struct, ptr @JTEST_FW, i32 0, i32 8), align 8, !tbaa !9
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = mul i32 %29, 128
  %31 = zext i32 %30 to i64
  %32 = getelementptr inbounds i8, ptr %28, i64 %31
  %33 = load volatile ptr, ptr getelementptr inbounds (%struct.JTEST_FW_struct, ptr @JTEST_FW, i32 0, i32 8), align 8, !tbaa !9
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = add i32 %34, 1
  %36 = mul i32 %35, 128
  %37 = zext i32 %36 to i64
  %38 = getelementptr inbounds i8, ptr %33, i64 %37
  call void @llvm.memmove.p0.p0.i64(ptr align 1 %32, ptr align 1 %38, i64 256, i1 false)
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = add i32 %39, 1
  store i32 %40, ptr %2, align 4, !tbaa !5
  br label %20, !llvm.loop !12

41:                                               ; preds = %20
  br label %42

42:                                               ; preds = %41, %16
  br label %43

43:                                               ; preds = %42
  %44 = load i32, ptr %1, align 4, !tbaa !5
  %45 = add i32 %44, 1
  store i32 %45, ptr %1, align 4, !tbaa !5
  br label %9, !llvm.loop !14

46:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  ret void
}

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #2

declare void @dump_str() #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #4

; 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 = { nounwind willreturn memory(read) "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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }

!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, !11, i64 40}
!10 = !{!"JTEST_FW_struct", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !6, i64 56, !6, i64 60}
!11 = !{!"any pointer", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}


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

%struct.JTEST_FW_struct = type { i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, i32, i32 }

@JTEST_FW = external global %struct.JTEST_FW_struct, align 8

; Function Attrs: nounwind uwtable
define dso_local void @jtest_dump_str_segments() local_unnamed_addr #0 {
  %1 = load volatile ptr, ptr getelementptr inbounds (i8, ptr @JTEST_FW, i64 40), align 8, !tbaa !5
  %2 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #5
  %3 = lshr i64 %2, 7
  %4 = trunc i64 %3 to i32
  %5 = add i32 %4, 1
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph14.preheader

.lr.ph14.preheader:                               ; preds = %0
  %6 = and i64 %3, 4294967295
  %wide.trip.count = zext i32 %5 to i64
  br label %.lr.ph14

.lr.ph14:                                         ; preds = %.lr.ph14.preheader, %.loopexit
  %indvars.iv17 = phi i64 [ 0, %.lr.ph14.preheader ], [ %indvars.iv.next18, %.loopexit ]
  %7 = sub nsw i64 %3, %indvars.iv17
  %8 = and i64 %7, 4294967295
  %umax = tail call i64 @llvm.umax.i64(i64 %8, i64 1)
  tail call void @dump_str() #6
  %9 = icmp ugt i64 %indvars.iv17, 1
  %.not15 = icmp eq i64 %indvars.iv17, %6
  %or.cond = or i1 %9, %.not15
  br i1 %or.cond, label %.loopexit, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.lr.ph14
  %xtraiter = and i64 %umax, 1
  %10 = icmp ult i64 %8, 2
  br i1 %10, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %umax, 4294967294
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader.new ], [ %indvars.iv.next.1, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %.lr.ph ]
  %11 = load volatile ptr, ptr getelementptr inbounds (i8, ptr @JTEST_FW, i64 40), align 8, !tbaa !5
  %12 = shl i64 %indvars.iv, 7
  %13 = and i64 %12, 4294967040
  %14 = getelementptr inbounds i8, ptr %11, i64 %13
  %15 = load volatile ptr, ptr getelementptr inbounds (i8, ptr @JTEST_FW, i64 40), align 8, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %16 = shl i64 %indvars.iv.next, 7
  %17 = and i64 %16, 4294967168
  %18 = getelementptr inbounds i8, ptr %15, i64 %17
  tail call void @llvm.memmove.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(256) %14, ptr noundef nonnull align 1 dereferenceable(256) %18, i64 256, i1 false)
  %19 = load volatile ptr, ptr getelementptr inbounds (i8, ptr @JTEST_FW, i64 40), align 8, !tbaa !5
  %20 = shl i64 %indvars.iv.next, 7
  %21 = and i64 %20, 4294967168
  %22 = getelementptr inbounds i8, ptr %19, i64 %21
  %23 = load volatile ptr, ptr getelementptr inbounds (i8, ptr @JTEST_FW, i64 40), align 8, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %24 = shl i64 %indvars.iv.next.1, 7
  %25 = and i64 %24, 4294967040
  %26 = getelementptr inbounds i8, ptr %23, i64 %25
  tail call void @llvm.memmove.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(256) %22, ptr noundef nonnull align 1 dereferenceable(256) %26, i64 256, i1 false)
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1.not = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1.not, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !11

.loopexit.loopexit.unr-lcssa:                     ; preds = %.lr.ph, %.lr.ph.preheader
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next.1, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.loopexit, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %.loopexit.loopexit.unr-lcssa
  %27 = load volatile ptr, ptr getelementptr inbounds (i8, ptr @JTEST_FW, i64 40), align 8, !tbaa !5
  %28 = shl i64 %indvars.iv.unr, 7
  %29 = and i64 %28, 4294967168
  %30 = getelementptr inbounds i8, ptr %27, i64 %29
  %31 = load volatile ptr, ptr getelementptr inbounds (i8, ptr @JTEST_FW, i64 40), align 8, !tbaa !5
  %indvars.iv.next.epil = shl i64 %indvars.iv.unr, 7
  %32 = add i64 %indvars.iv.next.epil, 128
  %33 = and i64 %32, 4294967168
  %34 = getelementptr inbounds i8, ptr %31, i64 %33
  tail call void @llvm.memmove.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(256) %30, ptr noundef nonnull align 1 dereferenceable(256) %34, i64 256, i1 false)
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph.epil, %.loopexit.loopexit.unr-lcssa, %.lr.ph14
  %indvars.iv.next18 = add nuw nsw i64 %indvars.iv17, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next18, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph14, !llvm.loop !13

._crit_edge:                                      ; preds = %.loopexit, %0
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #1

declare void @dump_str() local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #4

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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind willreturn memory(read) }
attributes #6 = { 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, !10, i64 40}
!6 = !{!"JTEST_FW_struct", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !7, i64 56, !7, i64 60}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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