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

; 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.cilist = type { i64, i64, i64, ptr, i64 }
%struct.anon = type { i64, i64, i64, i64, i64, i64 }

@MAIN__.sfac = external hidden global double, align 8
@MAIN__.io___2 = external hidden global %struct.cilist, align 8
@MAIN__.io___4 = external hidden global %struct.cilist, align 8
@combla_ = external dso_local global %struct.anon, align 8
@.str = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @MAIN__() #0 {
  %1 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #3
  %2 = call i64 @s_wsfe(ptr noundef @MAIN__.io___2)
  %3 = call i64 @e_wsfe()
  store i64 1, ptr %1, align 8, !tbaa !5
  br label %4

4:                                                ; preds = %57, %0
  %5 = load i64, ptr %1, align 8, !tbaa !5
  %6 = icmp sle i64 %5, 10
  br i1 %6, label %7, label %60

7:                                                ; preds = %4
  %8 = load i64, ptr %1, align 8, !tbaa !5
  store i64 %8, ptr @combla_, align 8, !tbaa !9
  %9 = call i32 @header_()
  store i64 1, ptr getelementptr inbounds (%struct.anon, ptr @combla_, i32 0, i32 5), align 8, !tbaa !11
  store i64 9999, ptr getelementptr inbounds (%struct.anon, ptr @combla_, i32 0, i32 2), align 8, !tbaa !12
  store i64 9999, ptr getelementptr inbounds (%struct.anon, ptr @combla_, i32 0, i32 3), align 8, !tbaa !13
  store i64 9999, ptr getelementptr inbounds (%struct.anon, ptr @combla_, i32 0, i32 4), align 8, !tbaa !14
  %10 = load i64, ptr @combla_, align 8, !tbaa !9
  %11 = icmp eq i64 %10, 3
  br i1 %11, label %12, label %14

12:                                               ; preds = %7
  %13 = call i32 @check0_(ptr noundef @MAIN__.sfac)
  br label %50

14:                                               ; preds = %7
  %15 = load i64, ptr @combla_, align 8, !tbaa !9
  %16 = icmp eq i64 %15, 7
  br i1 %16, label %26, label %17

17:                                               ; preds = %14
  %18 = load i64, ptr @combla_, align 8, !tbaa !9
  %19 = icmp eq i64 %18, 8
  br i1 %19, label %26, label %20

20:                                               ; preds = %17
  %21 = load i64, ptr @combla_, align 8, !tbaa !9
  %22 = icmp eq i64 %21, 9
  br i1 %22, label %26, label %23

23:                                               ; preds = %20
  %24 = load i64, ptr @combla_, align 8, !tbaa !9
  %25 = icmp eq i64 %24, 10
  br i1 %25, label %26, label %28

26:                                               ; preds = %23, %20, %17, %14
  %27 = call i32 @check1_(ptr noundef @MAIN__.sfac)
  br label %49

28:                                               ; preds = %23
  %29 = load i64, ptr @combla_, align 8, !tbaa !9
  %30 = icmp eq i64 %29, 1
  br i1 %30, label %40, label %31

31:                                               ; preds = %28
  %32 = load i64, ptr @combla_, align 8, !tbaa !9
  %33 = icmp eq i64 %32, 2
  br i1 %33, label %40, label %34

34:                                               ; preds = %31
  %35 = load i64, ptr @combla_, align 8, !tbaa !9
  %36 = icmp eq i64 %35, 5
  br i1 %36, label %40, label %37

37:                                               ; preds = %34
  %38 = load i64, ptr @combla_, align 8, !tbaa !9
  %39 = icmp eq i64 %38, 6
  br i1 %39, label %40, label %42

40:                                               ; preds = %37, %34, %31, %28
  %41 = call i32 @check2_(ptr noundef @MAIN__.sfac)
  br label %48

42:                                               ; preds = %37
  %43 = load i64, ptr @combla_, align 8, !tbaa !9
  %44 = icmp eq i64 %43, 4
  br i1 %44, label %45, label %47

45:                                               ; preds = %42
  %46 = call i32 @check3_(ptr noundef @MAIN__.sfac)
  br label %47

47:                                               ; preds = %45, %42
  br label %48

48:                                               ; preds = %47, %40
  br label %49

49:                                               ; preds = %48, %26
  br label %50

50:                                               ; preds = %49, %12
  %51 = load i64, ptr getelementptr inbounds (%struct.anon, ptr @combla_, i32 0, i32 5), align 8, !tbaa !11
  %52 = icmp ne i64 %51, 0
  br i1 %52, label %53, label %56

53:                                               ; preds = %50
  %54 = call i64 @s_wsfe(ptr noundef @MAIN__.io___4)
  %55 = call i64 @e_wsfe()
  br label %56

56:                                               ; preds = %53, %50
  br label %57

57:                                               ; preds = %56
  %58 = load i64, ptr %1, align 8, !tbaa !5
  %59 = add nsw i64 %58, 1
  store i64 %59, ptr %1, align 8, !tbaa !5
  br label %4, !llvm.loop !15

60:                                               ; preds = %4
  %61 = call i32 @s_stop(ptr noundef @.str, i64 noundef 0)
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #3
  ret i32 0
}

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

declare i64 @s_wsfe(ptr noundef) #2

declare i64 @e_wsfe() #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @header_() #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @check0_(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @check1_(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @check2_(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @check3_(ptr noundef) #0

declare i32 @s_stop(ptr noundef, i64 noundef) #2

; 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 = { "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, !6, i64 0}
!10 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!11 = !{!10, !6, i64 40}
!12 = !{!10, !6, i64 16}
!13 = !{!10, !6, i64 24}
!14 = !{!10, !6, i64 32}
!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.cilist = type { i64, i64, i64, ptr, i64 }
%struct.anon = type { i64, i64, i64, i64, i64, i64 }

@MAIN__.sfac = external hidden global double, align 8
@MAIN__.io___2 = external hidden global %struct.cilist, align 8
@MAIN__.io___4 = external hidden global %struct.cilist, align 8
@combla_ = external dso_local local_unnamed_addr global %struct.anon, align 8
@.str = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @MAIN__() local_unnamed_addr #0 {
  %1 = tail call i64 @s_wsfe(ptr noundef nonnull @MAIN__.io___2) #2
  %2 = tail call i64 @e_wsfe() #2
  br label %3

3:                                                ; preds = %0, %27
  %.015 = phi i64 [ 1, %0 ], [ %28, %27 ]
  store i64 %.015, ptr @combla_, align 8, !tbaa !5
  %4 = tail call i32 @header_()
  store i64 1, ptr getelementptr inbounds (i8, ptr @combla_, i64 40), align 8, !tbaa !10
  store i64 9999, ptr getelementptr inbounds (i8, ptr @combla_, i64 16), align 8, !tbaa !11
  store i64 9999, ptr getelementptr inbounds (i8, ptr @combla_, i64 24), align 8, !tbaa !12
  store i64 9999, ptr getelementptr inbounds (i8, ptr @combla_, i64 32), align 8, !tbaa !13
  %5 = load i64, ptr @combla_, align 8
  %6 = icmp eq i64 %5, 3
  br i1 %6, label %7, label %9

7:                                                ; preds = %3
  %8 = tail call i32 @check0_(ptr noundef nonnull @MAIN__.sfac)
  br label %22

9:                                                ; preds = %3
  %10 = add i64 %5, -7
  %or.cond5 = icmp ult i64 %10, 4
  br i1 %or.cond5, label %11, label %13

11:                                               ; preds = %9
  %12 = tail call i32 @check1_(ptr noundef nonnull @MAIN__.sfac)
  br label %22

13:                                               ; preds = %9
  %14 = and i64 %5, -5
  %15 = add i64 %14, -1
  %or.cond11 = icmp ult i64 %15, 2
  br i1 %or.cond11, label %16, label %18

16:                                               ; preds = %13
  %17 = tail call i32 @check2_(ptr noundef nonnull @MAIN__.sfac)
  br label %22

18:                                               ; preds = %13
  %19 = icmp eq i64 %5, 4
  br i1 %19, label %20, label %22

20:                                               ; preds = %18
  %21 = tail call i32 @check3_(ptr noundef nonnull @MAIN__.sfac)
  br label %22

22:                                               ; preds = %11, %18, %20, %16, %7
  %23 = load i64, ptr getelementptr inbounds (i8, ptr @combla_, i64 40), align 8, !tbaa !10
  %.not = icmp eq i64 %23, 0
  br i1 %.not, label %27, label %24

24:                                               ; preds = %22
  %25 = tail call i64 @s_wsfe(ptr noundef nonnull @MAIN__.io___4) #2
  %26 = tail call i64 @e_wsfe() #2
  br label %27

27:                                               ; preds = %22, %24
  %28 = add nuw nsw i64 %.015, 1
  %exitcond.not = icmp eq i64 %28, 11
  br i1 %exitcond.not, label %29, label %3, !llvm.loop !14

29:                                               ; preds = %27
  %30 = tail call i32 @s_stop(ptr noundef nonnull @.str, i64 noundef 0) #2
  ret i32 0
}

declare i64 @s_wsfe(ptr noundef) local_unnamed_addr #1

declare i64 @e_wsfe() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @header_() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @check0_(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @check1_(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @check2_(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @check3_(ptr noundef) local_unnamed_addr #0

declare i32 @s_stop(ptr noundef, i64 noundef) local_unnamed_addr #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 = { "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, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 40}
!11 = !{!6, !7, i64 16}
!12 = !{!6, !7, i64 24}
!13 = !{!6, !7, i64 32}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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