; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ (1992 (2)（状压dp）)

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

@dp = external dso_local global [1005 x [16 x i32]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %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
  store i32 0, ptr %1, align 4
  call void @llvm.memset.p0.i64(ptr align 16 @dp, i8 0, i64 64320, i1 false)
  store i32 1, ptr @dp, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %7

7:                                                ; preds = %31, %0
  %8 = load i32, ptr %2, align 4, !tbaa !5
  %9 = icmp slt i32 %8, 22
  br i1 %9, label %10, label %34

10:                                               ; preds = %7
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %11

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

14:                                               ; preds = %11
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %16
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [16 x i32], ptr %17, i64 0, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %26

23:                                               ; preds = %14
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = load i32, ptr %3, align 4, !tbaa !5
  call void @_Z3dfsiiii(i32 noundef %24, i32 noundef 0, i32 noundef %25, i32 noundef 0)
  br label %26

26:                                               ; preds = %23, %14
  br label %27

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

30:                                               ; preds = %11
  br label %31

31:                                               ; preds = %30
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %2, align 4, !tbaa !5
  br label %7, !llvm.loop !11

34:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !5
  %35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %4)
  br label %36

36:                                               ; preds = %40, %34
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = add nsw i32 %37, -1
  store i32 %38, ptr %4, align 4, !tbaa !5
  %39 = icmp ne i32 %37, 0
  br i1 %39, label %40, label %50

40:                                               ; preds = %36
  %41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %5)
  %42 = load i32, ptr %6, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %6, align 4, !tbaa !5
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %45
  %47 = getelementptr inbounds [16 x i32], ptr %46, i64 0, i64 0
  %48 = load i32, ptr %47, align 16, !tbaa !5
  %49 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %42, i32 noundef %48)
  br label %36, !llvm.loop !12

50:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  ret i32 0
}

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !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"

@dp = external dso_local local_unnamed_addr global [1005 x [16 x i32]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(64320) @dp, i8 0, i64 64320, i1 false)
  store i32 1, ptr @dp, align 16, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %0, %82
  %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %82 ]
  %3 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 0
  %4 = load i32, ptr %3, align 16, !tbaa !5
  %.not11 = icmp eq i32 %4, 0
  br i1 %.not11, label %7, label %5

5:                                                ; preds = %.preheader
  %6 = trunc nuw nsw i64 %indvars.iv to i32
  tail call void @_Z3dfsiiii(i32 noundef %6, i32 noundef 0, i32 noundef 0, i32 noundef 0)
  br label %7

7:                                                ; preds = %.preheader, %5
  %8 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 1
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %.not11.1 = icmp eq i32 %9, 0
  br i1 %.not11.1, label %12, label %10

10:                                               ; preds = %7
  %11 = trunc nuw nsw i64 %indvars.iv to i32
  tail call void @_Z3dfsiiii(i32 noundef %11, i32 noundef 0, i32 noundef 1, i32 noundef 0)
  br label %12

12:                                               ; preds = %10, %7
  %13 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 2
  %14 = load i32, ptr %13, align 8, !tbaa !5
  %.not11.2 = icmp eq i32 %14, 0
  br i1 %.not11.2, label %17, label %15

15:                                               ; preds = %12
  %16 = trunc nuw nsw i64 %indvars.iv to i32
  tail call void @_Z3dfsiiii(i32 noundef %16, i32 noundef 0, i32 noundef 2, i32 noundef 0)
  br label %17

17:                                               ; preds = %15, %12
  %18 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 3
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %.not11.3 = icmp eq i32 %19, 0
  br i1 %.not11.3, label %22, label %20

20:                                               ; preds = %17
  %21 = trunc nuw nsw i64 %indvars.iv to i32
  tail call void @_Z3dfsiiii(i32 noundef %21, i32 noundef 0, i32 noundef 3, i32 noundef 0)
  br label %22

22:                                               ; preds = %20, %17
  %23 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 4
  %24 = load i32, ptr %23, align 16, !tbaa !5
  %.not11.4 = icmp eq i32 %24, 0
  br i1 %.not11.4, label %27, label %25

25:                                               ; preds = %22
  %26 = trunc nuw nsw i64 %indvars.iv to i32
  tail call void @_Z3dfsiiii(i32 noundef %26, i32 noundef 0, i32 noundef 4, i32 noundef 0)
  br label %27

27:                                               ; preds = %25, %22
  %28 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 5
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %.not11.5 = icmp eq i32 %29, 0
  br i1 %.not11.5, label %32, label %30

30:                                               ; preds = %27
  %31 = trunc nuw nsw i64 %indvars.iv to i32
  tail call void @_Z3dfsiiii(i32 noundef %31, i32 noundef 0, i32 noundef 5, i32 noundef 0)
  br label %32

32:                                               ; preds = %30, %27
  %33 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 6
  %34 = load i32, ptr %33, align 8, !tbaa !5
  %.not11.6 = icmp eq i32 %34, 0
  br i1 %.not11.6, label %37, label %35

35:                                               ; preds = %32
  %36 = trunc nuw nsw i64 %indvars.iv to i32
  tail call void @_Z3dfsiiii(i32 noundef %36, i32 noundef 0, i32 noundef 6, i32 noundef 0)
  br label %37

37:                                               ; preds = %35, %32
  %38 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 7
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %.not11.7 = icmp eq i32 %39, 0
  br i1 %.not11.7, label %42, label %40

40:                                               ; preds = %37
  %41 = trunc nuw nsw i64 %indvars.iv to i32
  tail call void @_Z3dfsiiii(i32 noundef %41, i32 noundef 0, i32 noundef 7, i32 noundef 0)
  br label %42

42:                                               ; preds = %40, %37
  %43 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 8
  %44 = load i32, ptr %43, align 16, !tbaa !5
  %.not11.8 = icmp eq i32 %44, 0
  br i1 %.not11.8, label %47, label %45

45:                                               ; preds = %42
  %46 = trunc nuw nsw i64 %indvars.iv to i32
  tail call void @_Z3dfsiiii(i32 noundef %46, i32 noundef 0, i32 noundef 8, i32 noundef 0)
  br label %47

47:                                               ; preds = %45, %42
  %48 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 9
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %.not11.9 = icmp eq i32 %49, 0
  br i1 %.not11.9, label %52, label %50

50:                                               ; preds = %47
  %51 = trunc nuw nsw i64 %indvars.iv to i32
  tail call void @_Z3dfsiiii(i32 noundef %51, i32 noundef 0, i32 noundef 9, i32 noundef 0)
  br label %52

52:                                               ; preds = %50, %47
  %53 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 10
  %54 = load i32, ptr %53, align 8, !tbaa !5
  %.not11.10 = icmp eq i32 %54, 0
  br i1 %.not11.10, label %57, label %55

55:                                               ; preds = %52
  %56 = trunc nuw nsw i64 %indvars.iv to i32
  tail call void @_Z3dfsiiii(i32 noundef %56, i32 noundef 0, i32 noundef 10, i32 noundef 0)
  br label %57

57:                                               ; preds = %55, %52
  %58 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 11
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %.not11.11 = icmp eq i32 %59, 0
  br i1 %.not11.11, label %62, label %60

60:                                               ; preds = %57
  %61 = trunc nuw nsw i64 %indvars.iv to i32
  tail call void @_Z3dfsiiii(i32 noundef %61, i32 noundef 0, i32 noundef 11, i32 noundef 0)
  br label %62

62:                                               ; preds = %60, %57
  %63 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 12
  %64 = load i32, ptr %63, align 16, !tbaa !5
  %.not11.12 = icmp eq i32 %64, 0
  br i1 %.not11.12, label %67, label %65

65:                                               ; preds = %62
  %66 = trunc nuw nsw i64 %indvars.iv to i32
  tail call void @_Z3dfsiiii(i32 noundef %66, i32 noundef 0, i32 noundef 12, i32 noundef 0)
  br label %67

67:                                               ; preds = %65, %62
  %68 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 13
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %.not11.13 = icmp eq i32 %69, 0
  br i1 %.not11.13, label %72, label %70

70:                                               ; preds = %67
  %71 = trunc nuw nsw i64 %indvars.iv to i32
  tail call void @_Z3dfsiiii(i32 noundef %71, i32 noundef 0, i32 noundef 13, i32 noundef 0)
  br label %72

72:                                               ; preds = %70, %67
  %73 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 14
  %74 = load i32, ptr %73, align 8, !tbaa !5
  %.not11.14 = icmp eq i32 %74, 0
  br i1 %.not11.14, label %77, label %75

75:                                               ; preds = %72
  %76 = trunc nuw nsw i64 %indvars.iv to i32
  tail call void @_Z3dfsiiii(i32 noundef %76, i32 noundef 0, i32 noundef 14, i32 noundef 0)
  br label %77

77:                                               ; preds = %75, %72
  %78 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 15
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %.not11.15 = icmp eq i32 %79, 0
  br i1 %.not11.15, label %82, label %80

80:                                               ; preds = %77
  %81 = trunc nuw nsw i64 %indvars.iv to i32
  tail call void @_Z3dfsiiii(i32 noundef %81, i32 noundef 0, i32 noundef 15, i32 noundef 0)
  br label %82

82:                                               ; preds = %80, %77
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 22
  br i1 %exitcond.not, label %83, label %.preheader, !llvm.loop !9

83:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %84 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %85 = load i32, ptr %1, align 4, !tbaa !5
  %86 = add nsw i32 %85, -1
  store i32 %86, ptr %1, align 4, !tbaa !5
  %.not14 = icmp eq i32 %85, 0
  br i1 %.not14, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %83, %.lr.ph
  %.015 = phi i32 [ %88, %.lr.ph ], [ 1, %83 ]
  %87 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  %88 = add nuw nsw i32 %.015, 1
  %89 = load i32, ptr %2, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [1005 x [16 x i32]], ptr @dp, i64 0, i64 %90
  %92 = load i32, ptr %91, align 16, !tbaa !5
  %93 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.015, i32 noundef %92)
  %94 = load i32, ptr %1, align 4, !tbaa !5
  %95 = add nsw i32 %94, -1
  store i32 %95, ptr %1, align 4, !tbaa !5
  %.not = icmp eq i32 %94, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph, %83
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0
}

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

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

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


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