; LLVM IR from lzyrapx/Competitive-Programming :: BZOJ (BZOJ3112（对偶原则+单纯形）)

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

@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@a = external dso_local global [1001 x [10010 x double]], align 16
@b = external dso_local global [10010 x double], align 16
@c = external dso_local global [10010 x double], align 16
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_Z7simplexv() #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  %12 = call noundef i32 @_Z4readv()
  store i32 %12, ptr @N, align 4, !tbaa !5
  %13 = call noundef i32 @_Z4readv()
  store i32 %13, ptr @M, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %24, %2
  %15 = load i32, ptr %6, align 4, !tbaa !5
  %16 = load i32, ptr @N, align 4, !tbaa !5
  %17 = icmp sle i32 %15, %16
  br i1 %17, label %19, label %18

18:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %27

19:                                               ; preds = %14
  %20 = load i32, ptr %6, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [10010 x double], ptr @b, i64 0, i64 %21
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %22)
  br label %24

24:                                               ; preds = %19
  %25 = load i32, ptr %6, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %6, align 4, !tbaa !5
  br label %14, !llvm.loop !11

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

28:                                               ; preds = %57, %27
  %29 = load i32, ptr %7, align 4, !tbaa !5
  %30 = load i32, ptr @M, align 4, !tbaa !5
  %31 = icmp sle i32 %29, %30
  br i1 %31, label %33, label %32

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

33:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %34 = call noundef i32 @_Z4readv()
  store i32 %34, ptr %9, align 4, !tbaa !5
  %35 = call noundef i32 @_Z4readv()
  store i32 %35, ptr %10, align 4, !tbaa !5
  %36 = load i32, ptr %7, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [10010 x double], ptr @c, i64 0, i64 %37
  %39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %38)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %40 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %40, ptr %11, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %53, %33
  %42 = load i32, ptr %11, align 4, !tbaa !5
  %43 = load i32, ptr %10, align 4, !tbaa !5
  %44 = icmp sle i32 %42, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %41
  store i32 8, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %56

46:                                               ; preds = %41
  %47 = load i32, ptr %11, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [1001 x [10010 x double]], ptr @a, i64 0, i64 %48
  %50 = load i32, ptr %7, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [10010 x double], ptr %49, i64 0, i64 %51
  store double 1.000000e+00, ptr %52, align 8, !tbaa !13
  br label %53

53:                                               ; preds = %46
  %54 = load i32, ptr %11, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %11, align 4, !tbaa !5
  br label %41, !llvm.loop !15

56:                                               ; preds = %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %57

57:                                               ; preds = %56
  %58 = load i32, ptr %7, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %7, align 4, !tbaa !5
  br label %28, !llvm.loop !16

60:                                               ; preds = %32
  %61 = call noundef double @_Z7simplexv()
  %62 = fadd double %61, 5.000000e-01
  %63 = fptosi double %62 to i32
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %63)
  ret i32 0
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z4readv() #3

declare i32 @__isoc99_scanf(ptr noundef, ...) #4

declare i32 @printf(ptr noundef, ...) #4

attributes #0 = { mustprogress 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 = { mustprogress norecurse 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 = { inlinehint mustprogress 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 #4 = { "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 #5 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !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"

@N = external dso_local local_unnamed_addr global i32, align 4
@M = external dso_local local_unnamed_addr global i32, align 4
@a = external dso_local local_unnamed_addr global [1001 x [10010 x double]], align 16
@b = external dso_local global [10010 x double], align 16
@c = external dso_local global [10010 x double], align 16
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_Z7simplexv() local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #1 {
  %3 = tail call noundef i32 @_Z4readv()
  store i32 %3, ptr @N, align 4, !tbaa !5
  %4 = tail call noundef i32 @_Z4readv()
  store i32 %4, ptr @M, align 4, !tbaa !5
  %5 = load i32, ptr @N, align 4, !tbaa !5
  %.not16 = icmp slt i32 %5, 1
  br i1 %.not16, label %.preheader, label %.lr.ph

.preheader.loopexit:                              ; preds = %.lr.ph
  %.pre = load i32, ptr @M, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %2
  %6 = phi i32 [ %.pre, %.preheader.loopexit ], [ %4, %2 ]
  %.not1421 = icmp slt i32 %6, 1
  br i1 %.not1421, label %._crit_edge24, label %.lr.ph23

.lr.ph:                                           ; preds = %2, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %2 ]
  %7 = getelementptr inbounds [10010 x double], ptr @b, i64 0, i64 %indvars.iv
  %8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %7)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %9 = load i32, ptr @N, align 4, !tbaa !5
  %10 = sext i32 %9 to i64
  %.not.not = icmp slt i64 %indvars.iv, %10
  br i1 %.not.not, label %.lr.ph, label %.preheader.loopexit, !llvm.loop !9

._crit_edge24:                                    ; preds = %._crit_edge, %.preheader
  %11 = tail call noundef double @_Z7simplexv()
  %12 = fadd double %11, 5.000000e-01
  %13 = fptosi double %12 to i32
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13)
  ret i32 0

.lr.ph23:                                         ; preds = %.preheader, %._crit_edge
  %indvars.iv29 = phi i64 [ %indvars.iv.next30, %._crit_edge ], [ 1, %.preheader ]
  %15 = tail call noundef i32 @_Z4readv()
  %16 = tail call noundef i32 @_Z4readv()
  %17 = getelementptr inbounds [10010 x double], ptr @c, i64 0, i64 %indvars.iv29
  %18 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %17)
  %.not1518 = icmp sgt i32 %15, %16
  br i1 %.not1518, label %._crit_edge, label %.lr.ph20.preheader

.lr.ph20.preheader:                               ; preds = %.lr.ph23
  %19 = sext i32 %15 to i64
  %20 = add i32 %16, 1
  %21 = sub i32 %20, %15
  %22 = sub i32 %16, %15
  %xtraiter = and i32 %21, 3
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph20.prol.loopexit, label %.lr.ph20.prol

.lr.ph20.prol:                                    ; preds = %.lr.ph20.preheader, %.lr.ph20.prol
  %indvars.iv26.prol = phi i64 [ %indvars.iv.next27.prol, %.lr.ph20.prol ], [ %19, %.lr.ph20.preheader ]
  %prol.iter = phi i32 [ %prol.iter.next, %.lr.ph20.prol ], [ 0, %.lr.ph20.preheader ]
  %23 = getelementptr inbounds [1001 x [10010 x double]], ptr @a, i64 0, i64 %indvars.iv26.prol, i64 %indvars.iv29
  store double 1.000000e+00, ptr %23, align 8, !tbaa !11
  %indvars.iv.next27.prol = add nsw i64 %indvars.iv26.prol, 1
  %prol.iter.next = add i32 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph20.prol.loopexit, label %.lr.ph20.prol, !llvm.loop !13

.lr.ph20.prol.loopexit:                           ; preds = %.lr.ph20.prol, %.lr.ph20.preheader
  %indvars.iv26.unr = phi i64 [ %19, %.lr.ph20.preheader ], [ %indvars.iv.next27.prol, %.lr.ph20.prol ]
  %24 = icmp ult i32 %22, 3
  br i1 %24, label %._crit_edge, label %.lr.ph20

._crit_edge:                                      ; preds = %.lr.ph20.prol.loopexit, %.lr.ph20, %.lr.ph23
  %indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
  %25 = load i32, ptr @M, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %.not14.not = icmp slt i64 %indvars.iv29, %26
  br i1 %.not14.not, label %.lr.ph23, label %._crit_edge24, !llvm.loop !15

.lr.ph20:                                         ; preds = %.lr.ph20.prol.loopexit, %.lr.ph20
  %indvars.iv26 = phi i64 [ %indvars.iv.next27.3, %.lr.ph20 ], [ %indvars.iv26.unr, %.lr.ph20.prol.loopexit ]
  %27 = getelementptr inbounds [1001 x [10010 x double]], ptr @a, i64 0, i64 %indvars.iv26, i64 %indvars.iv29
  store double 1.000000e+00, ptr %27, align 8, !tbaa !11
  %indvars.iv.next27 = add nsw i64 %indvars.iv26, 1
  %28 = getelementptr inbounds [1001 x [10010 x double]], ptr @a, i64 0, i64 %indvars.iv.next27, i64 %indvars.iv29
  store double 1.000000e+00, ptr %28, align 8, !tbaa !11
  %indvars.iv.next27.1 = add nsw i64 %indvars.iv26, 2
  %29 = getelementptr inbounds [1001 x [10010 x double]], ptr @a, i64 0, i64 %indvars.iv.next27.1, i64 %indvars.iv29
  store double 1.000000e+00, ptr %29, align 8, !tbaa !11
  %indvars.iv.next27.2 = add nsw i64 %indvars.iv26, 3
  %30 = getelementptr inbounds [1001 x [10010 x double]], ptr @a, i64 0, i64 %indvars.iv.next27.2, i64 %indvars.iv29
  store double 1.000000e+00, ptr %30, align 8, !tbaa !11
  %indvars.iv.next27.3 = add nsw i64 %indvars.iv26, 4
  %lftr.wideiv.3 = trunc i64 %indvars.iv.next27.3 to i32
  %exitcond.not.3 = icmp eq i32 %20, %lftr.wideiv.3
  br i1 %exitcond.not.3, label %._crit_edge, label %.lr.ph20, !llvm.loop !16
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z4readv() local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

attributes #0 = { mustprogress 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 norecurse 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 = { inlinehint mustprogress 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 = { nofree nounwind "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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