; LLVM IR from tangjz/acm-icpc :: lydsy/4751.ll (Z6solve1ii)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z7addLineiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z6solve1ii(i32 noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  %7 = load i32, ptr %3, align 4, !tbaa !5
  %8 = load i32, ptr %4, align 4, !tbaa !5
  %9 = icmp sle i32 %7, %8
  br i1 %9, label %10, label %33

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

11:                                               ; preds = %29, %10
  %12 = load i32, ptr %5, align 4, !tbaa !5
  %13 = load i32, ptr %3, align 4, !tbaa !5
  %14 = icmp sle i32 %12, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  br label %32

16:                                               ; preds = %11
  %17 = load i32, ptr %5, align 4, !tbaa !5
  %18 = load i32, ptr %5, align 4, !tbaa !5
  %19 = load i32, ptr %4, align 4, !tbaa !5
  call void @_Z7addLineiiii(i32 noundef %17, i32 noundef 1, i32 noundef %18, i32 noundef %19)
  %20 = load i32, ptr %5, align 4, !tbaa !5
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = icmp slt i32 %20, %21
  br i1 %22, label %23, label %28

23:                                               ; preds = %16
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = load i32, ptr %5, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  call void @_Z7addLineiiii(i32 noundef %24, i32 noundef %25, i32 noundef %27, i32 noundef 1)
  br label %28

28:                                               ; preds = %23, %16
  br label %29

29:                                               ; preds = %28
  %30 = load i32, ptr %5, align 4, !tbaa !5
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %5, align 4, !tbaa !5
  br label %11, !llvm.loop !9

32:                                               ; preds = %15
  br label %56

33:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %52, %33
  %35 = load i32, ptr %6, align 4, !tbaa !5
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = icmp sle i32 %35, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  br label %55

39:                                               ; preds = %34
  %40 = load i32, ptr %6, align 4, !tbaa !5
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = load i32, ptr %6, align 4, !tbaa !5
  call void @_Z7addLineiiii(i32 noundef 1, i32 noundef %40, i32 noundef %41, i32 noundef %42)
  %43 = load i32, ptr %6, align 4, !tbaa !5
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %46, label %51

46:                                               ; preds = %39
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = load i32, ptr %6, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  call void @_Z7addLineiiii(i32 noundef %47, i32 noundef %48, i32 noundef 1, i32 noundef %50)
  br label %51

51:                                               ; preds = %46, %39
  br label %52

52:                                               ; preds = %51
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %6, align 4, !tbaa !5
  br label %34, !llvm.loop !11

55:                                               ; preds = %38
  br label %56

56:                                               ; preds = %55, %32
  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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

attributes #0 = { mustprogress 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 }

!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 = distinct !{!11, !10}


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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z7addLineiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z6solve1ii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %.not = icmp sgt i32 %0, %1
  br i1 %.not, label %.preheader, label %.preheader29

.preheader29:                                     ; preds = %2
  %.not2831 = icmp slt i32 %0, 1
  br i1 %.not2831, label %.loopexit, label %.lr.ph

.preheader:                                       ; preds = %2
  %.not2733 = icmp slt i32 %1, 1
  br i1 %.not2733, label %.loopexit, label %.lr.ph35

.lr.ph:                                           ; preds = %.preheader29, %.lr.ph._crit_edge
  %.02432 = phi i32 [ %4, %.lr.ph._crit_edge ], [ 1, %.preheader29 ]
  tail call void @_Z7addLineiiii(i32 noundef %.02432, i32 noundef 1, i32 noundef %.02432, i32 noundef %1)
  %3 = icmp slt i32 %.02432, %0
  %4 = add nuw i32 %.02432, 1
  br i1 %3, label %5, label %.lr.ph._crit_edge

5:                                                ; preds = %.lr.ph
  tail call void @_Z7addLineiiii(i32 noundef %.02432, i32 noundef %1, i32 noundef %4, i32 noundef 1)
  br label %.lr.ph._crit_edge

.lr.ph._crit_edge:                                ; preds = %.lr.ph, %5
  %exitcond.not = icmp eq i32 %.02432, %0
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph, !llvm.loop !5

.lr.ph35:                                         ; preds = %.preheader, %.lr.ph35._crit_edge
  %.034 = phi i32 [ %7, %.lr.ph35._crit_edge ], [ 1, %.preheader ]
  tail call void @_Z7addLineiiii(i32 noundef 1, i32 noundef %.034, i32 noundef %0, i32 noundef %.034)
  %6 = icmp slt i32 %.034, %1
  %7 = add nuw i32 %.034, 1
  br i1 %6, label %8, label %.lr.ph35._crit_edge

8:                                                ; preds = %.lr.ph35
  tail call void @_Z7addLineiiii(i32 noundef %0, i32 noundef %.034, i32 noundef 1, i32 noundef %7)
  br label %.lr.ph35._crit_edge

.lr.ph35._crit_edge:                              ; preds = %.lr.ph35, %8
  %exitcond37.not = icmp eq i32 %.034, %1
  br i1 %exitcond37.not, label %.loopexit, label %.lr.ph35, !llvm.loop !7

.loopexit:                                        ; preds = %.lr.ph._crit_edge, %.lr.ph35._crit_edge, %.preheader29, %.preheader
  ret void
}

attributes #0 = { mustprogress 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" }

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}


; Effective O3 passes: CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass