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

; 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.doublecomplex = type { double, double }

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

; 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 @ctest_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #1 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca [20 x double], align 16
  %15 = alloca [20 x double], align 16
  %16 = alloca [20 x double], align 16
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 160, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 160, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 160, ptr %16) #3
  %17 = load ptr, ptr %9, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.doublecomplex, ptr %17, i32 -1
  store ptr %18, ptr %9, align 8, !tbaa !5
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.doublecomplex, ptr %19, i32 -1
  store ptr %20, ptr %8, align 8, !tbaa !5
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.doublecomplex, ptr %21, i32 -1
  store ptr %22, ptr %7, align 8, !tbaa !5
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = load i64, ptr %23, align 8, !tbaa !9
  store i64 %24, ptr %11, align 8, !tbaa !9
  store i64 1, ptr %13, align 8, !tbaa !9
  br label %25

25:                                               ; preds = %84, %5
  %26 = load i64, ptr %13, align 8, !tbaa !9
  %27 = load i64, ptr %11, align 8, !tbaa !9
  %28 = icmp sle i64 %26, %27
  br i1 %28, label %29, label %87

29:                                               ; preds = %25
  %30 = load i64, ptr %13, align 8, !tbaa !9
  store i64 %30, ptr %12, align 8, !tbaa !9
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = load i64, ptr %12, align 8, !tbaa !9
  %33 = getelementptr inbounds %struct.doublecomplex, ptr %31, i64 %32
  %34 = getelementptr inbounds %struct.doublecomplex, ptr %33, i32 0, i32 0
  %35 = load double, ptr %34, align 8, !tbaa !11
  %36 = load i64, ptr %13, align 8, !tbaa !9
  %37 = shl i64 %36, 1
  %38 = sub nsw i64 %37, 2
  %39 = getelementptr inbounds [20 x double], ptr %14, i64 0, i64 %38
  store double %35, ptr %39, align 8, !tbaa !14
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = load i64, ptr %13, align 8, !tbaa !9
  %42 = getelementptr inbounds %struct.doublecomplex, ptr %40, i64 %41
  %43 = call double @d_imag(ptr noundef %42)
  %44 = load i64, ptr %13, align 8, !tbaa !9
  %45 = shl i64 %44, 1
  %46 = sub nsw i64 %45, 1
  %47 = getelementptr inbounds [20 x double], ptr %14, i64 0, i64 %46
  store double %43, ptr %47, align 8, !tbaa !14
  %48 = load i64, ptr %13, align 8, !tbaa !9
  store i64 %48, ptr %12, align 8, !tbaa !9
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = load i64, ptr %12, align 8, !tbaa !9
  %51 = getelementptr inbounds %struct.doublecomplex, ptr %49, i64 %50
  %52 = getelementptr inbounds %struct.doublecomplex, ptr %51, i32 0, i32 0
  %53 = load double, ptr %52, align 8, !tbaa !11
  %54 = load i64, ptr %13, align 8, !tbaa !9
  %55 = shl i64 %54, 1
  %56 = sub nsw i64 %55, 2
  %57 = getelementptr inbounds [20 x double], ptr %16, i64 0, i64 %56
  store double %53, ptr %57, align 8, !tbaa !14
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = load i64, ptr %13, align 8, !tbaa !9
  %60 = getelementptr inbounds %struct.doublecomplex, ptr %58, i64 %59
  %61 = call double @d_imag(ptr noundef %60)
  %62 = load i64, ptr %13, align 8, !tbaa !9
  %63 = shl i64 %62, 1
  %64 = sub nsw i64 %63, 1
  %65 = getelementptr inbounds [20 x double], ptr %16, i64 0, i64 %64
  store double %61, ptr %65, align 8, !tbaa !14
  %66 = load i64, ptr %13, align 8, !tbaa !9
  store i64 %66, ptr %12, align 8, !tbaa !9
  %67 = load ptr, ptr %9, align 8, !tbaa !5
  %68 = load i64, ptr %12, align 8, !tbaa !9
  %69 = getelementptr inbounds %struct.doublecomplex, ptr %67, i64 %68
  %70 = getelementptr inbounds %struct.doublecomplex, ptr %69, i32 0, i32 0
  %71 = load double, ptr %70, align 8, !tbaa !11
  %72 = load i64, ptr %13, align 8, !tbaa !9
  %73 = shl i64 %72, 1
  %74 = sub nsw i64 %73, 2
  %75 = getelementptr inbounds [20 x double], ptr %15, i64 0, i64 %74
  store double %71, ptr %75, align 8, !tbaa !14
  %76 = load ptr, ptr %9, align 8, !tbaa !5
  %77 = load i64, ptr %13, align 8, !tbaa !9
  %78 = getelementptr inbounds %struct.doublecomplex, ptr %76, i64 %77
  %79 = call double @d_imag(ptr noundef %78)
  %80 = load i64, ptr %13, align 8, !tbaa !9
  %81 = shl i64 %80, 1
  %82 = sub nsw i64 %81, 1
  %83 = getelementptr inbounds [20 x double], ptr %15, i64 0, i64 %82
  store double %79, ptr %83, align 8, !tbaa !14
  br label %84

84:                                               ; preds = %29
  %85 = load i64, ptr %13, align 8, !tbaa !9
  %86 = add nsw i64 %85, 1
  store i64 %86, ptr %13, align 8, !tbaa !9
  br label %25, !llvm.loop !15

87:                                               ; preds = %25
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  %89 = load i64, ptr %88, align 8, !tbaa !9
  %90 = shl i64 %89, 1
  store i64 %90, ptr %11, align 8, !tbaa !9
  %91 = getelementptr inbounds [20 x double], ptr %14, i64 0, i64 0
  %92 = getelementptr inbounds [20 x double], ptr %16, i64 0, i64 0
  %93 = getelementptr inbounds [20 x double], ptr %15, i64 0, i64 0
  %94 = load ptr, ptr %10, align 8, !tbaa !5
  %95 = call i32 @stest_(ptr noundef %11, ptr noundef %91, ptr noundef %92, ptr noundef %93, ptr noundef %94)
  call void @llvm.lifetime.end.p0(i64 160, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 160, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 160, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  ret i32 0
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @stest_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare double @d_imag(ptr noundef) #2

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 = { "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 = !{!"long", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"", !13, i64 0, !13, i64 8}
!13 = !{!"double", !7, i64 0}
!14 = !{!13, !13, i64 0}
!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.doublecomplex = type { double, double }

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

; Function Attrs: mustprogress 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 noundef i32 @ctest_(ptr nocapture noundef readonly %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #1 {
  %6 = alloca i64, align 8
  %7 = alloca [20 x double], align 16
  %8 = alloca [20 x double], align 16
  %9 = alloca [20 x double], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %9) #3
  %10 = getelementptr inbounds i8, ptr %3, i64 -16
  %11 = getelementptr inbounds i8, ptr %2, i64 -16
  %12 = getelementptr inbounds i8, ptr %1, i64 -16
  %13 = load i64, ptr %0, align 8, !tbaa !5
  %.not28 = icmp slt i64 %13, 1
  br i1 %.not28, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %5, %.lr.ph
  %.029 = phi i64 [ %32, %.lr.ph ], [ 1, %5 ]
  %14 = getelementptr inbounds %struct.doublecomplex, ptr %12, i64 %.029
  %15 = load double, ptr %14, align 8, !tbaa !9
  %16 = shl nuw i64 %.029, 1
  %17 = add nsw i64 %16, -2
  %18 = getelementptr inbounds [20 x double], ptr %7, i64 0, i64 %17
  store double %15, ptr %18, align 16, !tbaa !12
  %19 = tail call double @d_imag(ptr noundef nonnull %14) #3
  %20 = add nsw i64 %16, -1
  %21 = getelementptr inbounds [20 x double], ptr %7, i64 0, i64 %20
  store double %19, ptr %21, align 8, !tbaa !12
  %22 = getelementptr inbounds %struct.doublecomplex, ptr %11, i64 %.029
  %23 = load double, ptr %22, align 8, !tbaa !9
  %24 = getelementptr inbounds [20 x double], ptr %9, i64 0, i64 %17
  store double %23, ptr %24, align 16, !tbaa !12
  %25 = tail call double @d_imag(ptr noundef nonnull %22) #3
  %26 = getelementptr inbounds [20 x double], ptr %9, i64 0, i64 %20
  store double %25, ptr %26, align 8, !tbaa !12
  %27 = getelementptr inbounds %struct.doublecomplex, ptr %10, i64 %.029
  %28 = load double, ptr %27, align 8, !tbaa !9
  %29 = getelementptr inbounds [20 x double], ptr %8, i64 0, i64 %17
  store double %28, ptr %29, align 16, !tbaa !12
  %30 = tail call double @d_imag(ptr noundef nonnull %27) #3
  %31 = getelementptr inbounds [20 x double], ptr %8, i64 0, i64 %20
  store double %30, ptr %31, align 8, !tbaa !12
  %32 = add nuw i64 %.029, 1
  %exitcond.not = icmp eq i64 %.029, %13
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !13

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i64, ptr %0, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %5
  %33 = phi i64 [ %.pre, %._crit_edge.loopexit ], [ %13, %5 ]
  %34 = shl i64 %33, 1
  store i64 %34, ptr %6, align 8, !tbaa !5
  %35 = call i32 @stest_(ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %9, ptr noundef nonnull %8, ptr noundef %4)
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  ret i32 0
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @stest_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare double @d_imag(ptr noundef) local_unnamed_addr #2

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


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