; LLVM IR from tangjz/acm-icpc :: TDL_training/2015-11-29 (E - Furniture Factory - dby)

; 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.Edge = type { i32, i32, ptr, ptr }

@l = external dso_local global [830 x i32], align 16
@r = external dso_local global [830 x i32], align 16
@w = external dso_local global [830 x i32], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@S = external dso_local global i32, align 4
@T = external dso_local global i32, align 4
@pool = external dso_local global [518090 x %struct.Edge], align 16
@first = external dso_local global [830 x ptr], align 16
@mem = external dso_local global ptr, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5buildv() #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 uwtable
declare dso_local noundef i32 @_Z3augii(i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5printv() #2

declare i32 @puts(ptr noundef) #3

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %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 %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  br label %13

13:                                               ; preds = %154, %0
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = add nsw i32 %14, -1
  store i32 %15, ptr %2, align 4, !tbaa !5
  %16 = icmp ne i32 %14, 0
  br i1 %16, label %17, label %155

17:                                               ; preds = %13
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef @m, ptr noundef @n)
  store i32 0, ptr @S, align 4, !tbaa !5
  store i32 0, ptr @T, align 4, !tbaa !5
  %19 = load i32, ptr @S, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [830 x ptr], ptr @first, i64 0, i64 %20
  store ptr null, ptr %21, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  store ptr @pool, ptr @mem, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %65, %17
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = icmp sle i32 %23, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %68

27:                                               ; preds = %22
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [830 x ptr], ptr @first, i64 0, i64 %29
  store ptr null, ptr %30, align 8, !tbaa !9
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [830 x i32], ptr @l, i64 0, i64 %32
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [830 x i32], ptr @w, i64 0, i64 %35
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [830 x i32], ptr @r, i64 0, i64 %38
  %40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %33, ptr noundef %36, ptr noundef %39)
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [830 x i32], ptr @r, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = load i32, ptr @T, align 4, !tbaa !5
  %46 = icmp sgt i32 %44, %45
  br i1 %46, label %47, label %52

47:                                               ; preds = %27
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [830 x i32], ptr @r, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  store i32 %51, ptr @T, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %47, %27
  %53 = load i32, ptr @S, align 4, !tbaa !5
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = load i32, ptr %4, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [830 x i32], ptr @w, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  call void @_Z7addedgeiii(i32 noundef %53, i32 noundef %54, i32 noundef %58)
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [830 x i32], ptr @w, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = load i32, ptr %3, align 4, !tbaa !5
  %64 = add nsw i32 %63, %62
  store i32 %64, ptr %3, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %52
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %4, align 4, !tbaa !5
  br label %22, !llvm.loop !11

68:                                               ; preds = %26
  %69 = load i32, ptr @n, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  %71 = load i32, ptr @T, align 4, !tbaa !5
  %72 = add nsw i32 %71, %70
  store i32 %72, ptr @T, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %73 = load i32, ptr @n, align 4, !tbaa !5
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %5, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %84, %68
  %76 = load i32, ptr %5, align 4, !tbaa !5
  %77 = load i32, ptr @T, align 4, !tbaa !5
  %78 = icmp sle i32 %76, %77
  br i1 %78, label %80, label %79

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

80:                                               ; preds = %75
  %81 = load i32, ptr %5, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [830 x ptr], ptr @first, i64 0, i64 %82
  store ptr null, ptr %83, align 8, !tbaa !9
  br label %84

84:                                               ; preds = %80
  %85 = load i32, ptr %5, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %5, align 4, !tbaa !5
  br label %75, !llvm.loop !13

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

88:                                               ; preds = %116, %87
  %89 = load i32, ptr %6, align 4, !tbaa !5
  %90 = load i32, ptr @n, align 4, !tbaa !5
  %91 = icmp sle i32 %89, %90
  br i1 %91, label %93, label %92

92:                                               ; preds = %88
  store i32 10, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %119

93:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [830 x i32], ptr @r, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = sub nsw i32 %97, 1
  store i32 %98, ptr %8, align 4, !tbaa !5
  br label %99

99:                                               ; preds = %112, %93
  %100 = load i32, ptr %8, align 4, !tbaa !5
  %101 = load i32, ptr %6, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [830 x i32], ptr @l, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = icmp sge i32 %100, %104
  br i1 %105, label %107, label %106

106:                                              ; preds = %99
  store i32 13, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %115

107:                                              ; preds = %99
  %108 = load i32, ptr %6, align 4, !tbaa !5
  %109 = load i32, ptr @n, align 4, !tbaa !5
  %110 = load i32, ptr %8, align 4, !tbaa !5
  %111 = add nsw i32 %109, %110
  call void @_Z7addedgeiii(i32 noundef %108, i32 noundef %111, i32 noundef 1)
  br label %112

112:                                              ; preds = %107
  %113 = load i32, ptr %8, align 4, !tbaa !5
  %114 = add nsw i32 %113, -1
  store i32 %114, ptr %8, align 4, !tbaa !5
  br label %99, !llvm.loop !14

115:                                              ; preds = %106
  br label %116

116:                                              ; preds = %115
  %117 = load i32, ptr %6, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %6, align 4, !tbaa !5
  br label %88, !llvm.loop !15

119:                                              ; preds = %92
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %120 = load i32, ptr @n, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %9, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %131, %119
  %123 = load i32, ptr %9, align 4, !tbaa !5
  %124 = load i32, ptr @T, align 4, !tbaa !5
  %125 = icmp slt i32 %123, %124
  br i1 %125, label %127, label %126

126:                                              ; preds = %122
  store i32 16, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %134

127:                                              ; preds = %122
  %128 = load i32, ptr %9, align 4, !tbaa !5
  %129 = load i32, ptr @T, align 4, !tbaa !5
  %130 = load i32, ptr @m, align 4, !tbaa !5
  call void @_Z7addedgeiii(i32 noundef %128, i32 noundef %129, i32 noundef %130)
  br label %131

131:                                              ; preds = %127
  %132 = load i32, ptr %9, align 4, !tbaa !5
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %9, align 4, !tbaa !5
  br label %122, !llvm.loop !16

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

135:                                              ; preds = %146, %134
  %136 = call noundef zeroext i1 @_Z5buildv()
  br i1 %136, label %137, label %147

137:                                              ; preds = %135
  br label %138

138:                                              ; preds = %142, %137
  %139 = load i32, ptr @S, align 4, !tbaa !5
  %140 = call noundef i32 @_Z3augii(i32 noundef %139, i32 noundef 1073741823)
  store i32 %140, ptr %11, align 4, !tbaa !5
  %141 = icmp ne i32 %140, 0
  br i1 %141, label %142, label %146

142:                                              ; preds = %138
  %143 = load i32, ptr %11, align 4, !tbaa !5
  %144 = load i32, ptr %10, align 4, !tbaa !5
  %145 = add nsw i32 %144, %143
  store i32 %145, ptr %10, align 4, !tbaa !5
  br label %138, !llvm.loop !17

146:                                              ; preds = %138
  br label %135, !llvm.loop !18

147:                                              ; preds = %135
  %148 = load i32, ptr %10, align 4, !tbaa !5
  %149 = load i32, ptr %3, align 4, !tbaa !5
  %150 = icmp ne i32 %148, %149
  br i1 %150, label %151, label %153

151:                                              ; preds = %147
  %152 = call i32 @puts(ptr noundef @.str.5)
  br label %154

153:                                              ; preds = %147
  call void @_Z5printv()
  br label %154

154:                                              ; preds = %153, %151
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %13, !llvm.loop !19

155:                                              ; preds = %13
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %156 = load i32, ptr %1, align 4
  ret i32 %156
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z7addedgeiii(i32 noundef, i32 noundef, i32 noundef) #5

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 = { 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 = { "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 = { 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 #5 = { inlinehint 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 #6 = { 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 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !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"

%struct.Edge = type { i32, i32, ptr, ptr }

@l = external dso_local global [830 x i32], align 16
@r = external dso_local global [830 x i32], align 16
@w = external dso_local global [830 x i32], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@S = external dso_local local_unnamed_addr global i32, align 4
@T = external dso_local local_unnamed_addr global i32, align 4
@pool = external dso_local global [518090 x %struct.Edge], align 16
@first = external dso_local local_unnamed_addr global [830 x ptr], align 16
@mem = external dso_local local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5buildv() local_unnamed_addr #0

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5printv() local_unnamed_addr #2

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %3 = load i32, ptr %1, align 4, !tbaa !5
  %4 = add nsw i32 %3, -1
  store i32 %4, ptr %1, align 4, !tbaa !5
  %.not75 = icmp eq i32 %3, 0
  br i1 %.not75, label %._crit_edge78, label %.lr.ph77

.lr.ph77:                                         ; preds = %0, %58
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @m, ptr noundef nonnull @n)
  store i32 0, ptr @S, align 4, !tbaa !5
  store i32 0, ptr @T, align 4, !tbaa !5
  store ptr null, ptr @first, align 16, !tbaa !9
  store ptr @pool, ptr @mem, align 8, !tbaa !9
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %.not4252 = icmp slt i32 %6, 1
  br i1 %.not4252, label %._crit_edge, label %.lr.ph

._crit_edge.loopexit:                             ; preds = %25
  %.pre = load i32, ptr @T, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.lr.ph77
  %7 = phi i32 [ 0, %.lr.ph77 ], [ %.pre, %._crit_edge.loopexit ]
  %.036.lcssa = phi i32 [ 0, %.lr.ph77 ], [ %30, %._crit_edge.loopexit ]
  %8 = phi i32 [ %6, %.lr.ph77 ], [ %31, %._crit_edge.loopexit ]
  %9 = add nsw i32 %8, 1
  %10 = add nsw i32 %9, %7
  store i32 %10, ptr @T, align 4, !tbaa !5
  %.not43.not56 = icmp slt i32 %8, %10
  br i1 %.not43.not56, label %.lr.ph59.preheader, label %.preheader50

.lr.ph59.preheader:                               ; preds = %._crit_edge
  %11 = sext i32 %8 to i64
  %12 = shl nsw i64 %11, 3
  %scevgep = getelementptr i8, ptr getelementptr inbounds (i8, ptr @first, i64 8), i64 %12
  %13 = zext i32 %7 to i64
  %14 = shl nuw nsw i64 %13, 3
  %15 = add nuw nsw i64 %14, 8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(1) %scevgep, i8 0, i64 %15, i1 false), !tbaa !9
  br label %.preheader50

.lr.ph:                                           ; preds = %.lr.ph77, %25
  %indvars.iv = phi i64 [ %indvars.iv.next, %25 ], [ 1, %.lr.ph77 ]
  %.03653 = phi i32 [ %30, %25 ], [ 0, %.lr.ph77 ]
  %16 = getelementptr inbounds [830 x ptr], ptr @first, i64 0, i64 %indvars.iv
  store ptr null, ptr %16, align 8, !tbaa !9
  %17 = getelementptr inbounds [830 x i32], ptr @l, i64 0, i64 %indvars.iv
  %18 = getelementptr inbounds [830 x i32], ptr @w, i64 0, i64 %indvars.iv
  %19 = getelementptr inbounds [830 x i32], ptr @r, i64 0, i64 %indvars.iv
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %17, ptr noundef nonnull %18, ptr noundef nonnull %19)
  %21 = load i32, ptr %19, align 4, !tbaa !5
  %22 = load i32, ptr @T, align 4, !tbaa !5
  %23 = icmp sgt i32 %21, %22
  br i1 %23, label %24, label %25

24:                                               ; preds = %.lr.ph
  store i32 %21, ptr @T, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %24, %.lr.ph
  %26 = load i32, ptr @S, align 4, !tbaa !5
  %27 = load i32, ptr %18, align 4, !tbaa !5
  %28 = trunc nuw nsw i64 %indvars.iv to i32
  call void @_Z7addedgeiii(i32 noundef %26, i32 noundef %28, i32 noundef %27)
  %29 = load i32, ptr %18, align 4, !tbaa !5
  %30 = add nsw i32 %29, %.03653
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %31 = load i32, ptr @n, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %.not42.not = icmp slt i64 %indvars.iv, %32
  br i1 %.not42.not, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !11

.preheader50:                                     ; preds = %.lr.ph59.preheader, %._crit_edge
  %.not4465 = icmp slt i32 %8, 1
  br i1 %.not4465, label %.preheader49, label %.lr.ph67

.preheader49.loopexit:                            ; preds = %._crit_edge64
  %.pre90 = load i32, ptr @T, align 4, !tbaa !5
  %.pre91 = add nsw i32 %41, 1
  br label %.preheader49

.preheader49:                                     ; preds = %.preheader49.loopexit, %.preheader50
  %.03169.pre-phi = phi i32 [ %.pre91, %.preheader49.loopexit ], [ %9, %.preheader50 ]
  %33 = phi i32 [ %.pre90, %.preheader49.loopexit ], [ %10, %.preheader50 ]
  %34 = icmp slt i32 %.03169.pre-phi, %33
  br i1 %34, label %.lr.ph71, label %.preheader48

.lr.ph67:                                         ; preds = %.preheader50, %._crit_edge64
  %35 = phi i32 [ %41, %._crit_edge64 ], [ %8, %.preheader50 ]
  %indvars.iv86 = phi i64 [ %indvars.iv.next87, %._crit_edge64 ], [ 1, %.preheader50 ]
  %36 = getelementptr inbounds [830 x i32], ptr @r, i64 0, i64 %indvars.iv86
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = getelementptr inbounds [830 x i32], ptr @l, i64 0, i64 %indvars.iv86
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %.not47.not60 = icmp sgt i32 %37, %39
  br i1 %.not47.not60, label %.lr.ph63.preheader, label %._crit_edge64

.lr.ph63.preheader:                               ; preds = %.lr.ph67
  %40 = trunc nuw nsw i64 %indvars.iv86 to i32
  br label %.lr.ph63

._crit_edge64.loopexit:                           ; preds = %.lr.ph63
  %.pre89 = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge64

._crit_edge64:                                    ; preds = %._crit_edge64.loopexit, %.lr.ph67
  %41 = phi i32 [ %.pre89, %._crit_edge64.loopexit ], [ %35, %.lr.ph67 ]
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %42 = sext i32 %41 to i64
  %.not44.not = icmp slt i64 %indvars.iv86, %42
  br i1 %.not44.not, label %.lr.ph67, label %.preheader49.loopexit, !llvm.loop !13

.lr.ph63:                                         ; preds = %.lr.ph63.preheader, %.lr.ph63
  %.032.in61 = phi i32 [ %.032, %.lr.ph63 ], [ %37, %.lr.ph63.preheader ]
  %.032 = add nsw i32 %.032.in61, -1
  %43 = load i32, ptr @n, align 4, !tbaa !5
  %44 = add nsw i32 %43, %.032
  call void @_Z7addedgeiii(i32 noundef %40, i32 noundef %44, i32 noundef 1)
  %45 = load i32, ptr %38, align 4, !tbaa !5
  %.not47.not = icmp sgt i32 %.032, %45
  br i1 %.not47.not, label %.lr.ph63, label %._crit_edge64.loopexit, !llvm.loop !14

.preheader48:                                     ; preds = %.lr.ph71, %.preheader49
  %46 = call noundef zeroext i1 @_Z5buildv()
  br i1 %46, label %.preheader.outer, label %._crit_edge73

.lr.ph71:                                         ; preds = %.preheader49, %.lr.ph71
  %47 = phi i32 [ %49, %.lr.ph71 ], [ %33, %.preheader49 ]
  %.03170 = phi i32 [ %.031, %.lr.ph71 ], [ %.03169.pre-phi, %.preheader49 ]
  %48 = load i32, ptr @m, align 4, !tbaa !5
  call void @_Z7addedgeiii(i32 noundef %.03170, i32 noundef %47, i32 noundef %48)
  %.031 = add nsw i32 %.03170, 1
  %49 = load i32, ptr @T, align 4, !tbaa !5
  %50 = icmp slt i32 %.031, %49
  br i1 %50, label %.lr.ph71, label %.preheader48, !llvm.loop !15

.loopexit:                                        ; preds = %.preheader
  %51 = call noundef zeroext i1 @_Z5buildv()
  br i1 %51, label %.preheader, label %._crit_edge73, !llvm.loop !16

.preheader:                                       ; preds = %.preheader.outer, %.loopexit
  %52 = load i32, ptr @S, align 4, !tbaa !5
  %53 = call noundef i32 @_Z3augii(i32 noundef %52, i32 noundef 1073741823)
  %.not46 = icmp eq i32 %53, 0
  br i1 %.not46, label %.loopexit, label %.preheader.outer.loopexit

.preheader.outer.loopexit:                        ; preds = %.preheader
  %54 = add nsw i32 %53, %.1.ph
  br label %.preheader.outer, !llvm.loop !17

.preheader.outer:                                 ; preds = %.preheader48, %.preheader.outer.loopexit
  %.1.ph = phi i32 [ %54, %.preheader.outer.loopexit ], [ 0, %.preheader48 ]
  br label %.preheader

._crit_edge73:                                    ; preds = %.loopexit, %.preheader48
  %.0.lcssa = phi i32 [ 0, %.preheader48 ], [ %.1.ph, %.loopexit ]
  %.not45 = icmp eq i32 %.0.lcssa, %.036.lcssa
  br i1 %.not45, label %57, label %55

55:                                               ; preds = %._crit_edge73
  %56 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.5)
  br label %58

57:                                               ; preds = %._crit_edge73
  call void @_Z5printv()
  br label %58

58:                                               ; preds = %57, %55
  %59 = load i32, ptr %1, align 4, !tbaa !5
  %60 = add nsw i32 %59, -1
  store i32 %60, ptr %1, align 4, !tbaa !5
  %.not = icmp eq i32 %59, 0
  br i1 %.not, label %._crit_edge78, label %.lr.ph77, !llvm.loop !18

._crit_edge78:                                    ; preds = %58, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z7addedgeiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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" }
attributes #4 = { 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 #5 = { inlinehint 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass