; LLVM IR from niuyishuai/PDCABB :: LAPACK_BLAS/BLAS/TESTING (cblat2)

; 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.complex = type { float, float }

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

; Function Attrs: nounwind uwtable
define dso_local i64 @lce_(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #2
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.complex, ptr %12, i32 -1
  store ptr %13, ptr %5, align 8, !tbaa !5
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.complex, ptr %14, i32 -1
  store ptr %15, ptr %4, align 8, !tbaa !5
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = load i64, ptr %16, align 8, !tbaa !9
  store i64 %17, ptr %7, align 8, !tbaa !9
  store i64 1, ptr %11, align 8, !tbaa !9
  br label %18

18:                                               ; preds = %50, %3
  %19 = load i64, ptr %11, align 8, !tbaa !9
  %20 = load i64, ptr %7, align 8, !tbaa !9
  %21 = icmp sle i64 %19, %20
  br i1 %21, label %22, label %53

22:                                               ; preds = %18
  %23 = load i64, ptr %11, align 8, !tbaa !9
  store i64 %23, ptr %8, align 8, !tbaa !9
  %24 = load i64, ptr %11, align 8, !tbaa !9
  store i64 %24, ptr %9, align 8, !tbaa !9
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = load i64, ptr %8, align 8, !tbaa !9
  %27 = getelementptr inbounds %struct.complex, ptr %25, i64 %26
  %28 = getelementptr inbounds %struct.complex, ptr %27, i32 0, i32 0
  %29 = load float, ptr %28, align 4, !tbaa !11
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = load i64, ptr %9, align 8, !tbaa !9
  %32 = getelementptr inbounds %struct.complex, ptr %30, i64 %31
  %33 = getelementptr inbounds %struct.complex, ptr %32, i32 0, i32 0
  %34 = load float, ptr %33, align 4, !tbaa !11
  %35 = fcmp une float %29, %34
  br i1 %35, label %48, label %36

36:                                               ; preds = %22
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = load i64, ptr %8, align 8, !tbaa !9
  %39 = getelementptr inbounds %struct.complex, ptr %37, i64 %38
  %40 = getelementptr inbounds %struct.complex, ptr %39, i32 0, i32 1
  %41 = load float, ptr %40, align 4, !tbaa !14
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = load i64, ptr %9, align 8, !tbaa !9
  %44 = getelementptr inbounds %struct.complex, ptr %42, i64 %43
  %45 = getelementptr inbounds %struct.complex, ptr %44, i32 0, i32 1
  %46 = load float, ptr %45, align 4, !tbaa !14
  %47 = fcmp une float %41, %46
  br i1 %47, label %48, label %49

48:                                               ; preds = %36, %22
  br label %54

49:                                               ; preds = %36
  br label %50

50:                                               ; preds = %49
  %51 = load i64, ptr %11, align 8, !tbaa !9
  %52 = add nsw i64 %51, 1
  store i64 %52, ptr %11, align 8, !tbaa !9
  br label %18, !llvm.loop !15

53:                                               ; preds = %18
  store i64 1, ptr %10, align 8, !tbaa !9
  br label %55

54:                                               ; preds = %48
  store i64 0, ptr %10, align 8, !tbaa !9
  br label %55

55:                                               ; preds = %54, %53
  %56 = load i64, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  ret i64 %56
}

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

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 = !{!"long", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"", !13, i64 0, !13, i64 4}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !13, i64 4}
!15 = distinct !{!15, !16}
!16 = !{!"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"

%struct.complex = type { float, float }

; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local range(i64 0, 2) i64 @lce_(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %1, i64 -8
  %5 = getelementptr inbounds i8, ptr %0, i64 -8
  %6 = load i64, ptr %2, align 8, !tbaa !5
  %.not17 = icmp slt i64 %6, 1
  br i1 %.not17, label %._crit_edge, label %.lr.ph

7:                                                ; preds = %14
  %8 = add nuw i64 %.018, 1
  %exitcond.not = icmp eq i64 %.018, %6
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

.lr.ph:                                           ; preds = %3, %7
  %.018 = phi i64 [ %8, %7 ], [ 1, %3 ]
  %9 = getelementptr inbounds %struct.complex, ptr %5, i64 %.018
  %10 = load float, ptr %9, align 4, !tbaa !11
  %11 = getelementptr inbounds %struct.complex, ptr %4, i64 %.018
  %12 = load float, ptr %11, align 4, !tbaa !11
  %13 = fcmp une float %10, %12
  br i1 %13, label %._crit_edge, label %14

14:                                               ; preds = %.lr.ph
  %15 = getelementptr inbounds i8, ptr %9, i64 4
  %16 = load float, ptr %15, align 4, !tbaa !14
  %17 = getelementptr inbounds i8, ptr %11, i64 4
  %18 = load float, ptr %17, align 4, !tbaa !14
  %19 = fcmp une float %16, %18
  br i1 %19, label %._crit_edge, label %7

._crit_edge:                                      ; preds = %7, %.lr.ph, %14, %3
  %.016 = phi i64 [ 1, %3 ], [ 0, %14 ], [ 0, %.lr.ph ], [ 1, %7 ]
  ret i64 %.016
}

attributes #0 = { nofree norecurse nosync nounwind memory(argmem: read) 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !13, i64 0}
!12 = !{!"", !13, i64 0, !13, i64 4}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !13, i64 4}


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