; LLVM IR from tangjz/acm-icpc :: codeforces/complete/1466C.ll (Z5solvev)

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

@_ZZ5solvevE3buf = external hidden global [100001 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca [2 x [4 x i32]], align 16
  %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
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #6
  store i32 1061109567, ptr %1, align 4, !tbaa !5
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @_ZZ5solvevE3buf)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  %15 = call i64 @strlen(ptr noundef @_ZZ5solvevE3buf) #7
  %16 = trunc i64 %15 to i32
  store i32 %16, ptr %2, align 4, !tbaa !5
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = icmp sle i32 %17, 2
  br i1 %18, label %19, label %34

19:                                               ; preds = %0
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = icmp eq i32 %20, 2
  br i1 %21, label %22, label %29

22:                                               ; preds = %19
  %23 = load i8, ptr @_ZZ5solvevE3buf, align 16, !tbaa !9
  %24 = sext i8 %23 to i32
  %25 = load i8, ptr getelementptr inbounds ([100001 x i8], ptr @_ZZ5solvevE3buf, i64 0, i64 1), align 1, !tbaa !9
  %26 = sext i8 %25 to i32
  %27 = icmp eq i32 %24, %26
  br i1 %27, label %28, label %29

28:                                               ; preds = %22
  br label %30

29:                                               ; preds = %22, %19
  br label %30

30:                                               ; preds = %29, %28
  %31 = phi ptr [ @.str.2, %28 ], [ @.str.3, %29 ]
  %32 = getelementptr inbounds [2 x i8], ptr %31, i64 0, i64 0
  %33 = call i32 @puts(ptr noundef %32)
  store i32 1, ptr %3, align 4
  br label %188

34:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 32, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 1, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  %35 = load i8, ptr @_ZZ5solvevE3buf, align 16, !tbaa !9
  %36 = sext i8 %35 to i32
  %37 = load i8, ptr getelementptr inbounds ([100001 x i8], ptr @_ZZ5solvevE3buf, i64 0, i64 1), align 1, !tbaa !9
  %38 = sext i8 %37 to i32
  %39 = icmp eq i32 %36, %38
  %40 = zext i1 %39 to i64
  %41 = select i1 %39, i32 1061109567, i32 0
  %42 = load i32, ptr %5, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [2 x [4 x i32]], ptr %4, i64 0, i64 %43
  %45 = getelementptr inbounds [4 x i32], ptr %44, i64 0, i64 0
  store i32 %41, ptr %45, align 16, !tbaa !5
  %46 = load i32, ptr %5, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [2 x [4 x i32]], ptr %4, i64 0, i64 %47
  %49 = getelementptr inbounds [4 x i32], ptr %48, i64 0, i64 2
  store i32 1, ptr %49, align 8, !tbaa !5
  %50 = load i32, ptr %5, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [2 x [4 x i32]], ptr %4, i64 0, i64 %51
  %53 = getelementptr inbounds [4 x i32], ptr %52, i64 0, i64 1
  store i32 1, ptr %53, align 4, !tbaa !5
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [2 x [4 x i32]], ptr %4, i64 0, i64 %55
  %57 = getelementptr inbounds [4 x i32], ptr %56, i64 0, i64 3
  store i32 2, ptr %57, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 2, ptr %7, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %165, %34
  %59 = load i32, ptr %7, align 4, !tbaa !5
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %61 = icmp slt i32 %59, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %168

63:                                               ; preds = %58
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6) #6
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [2 x [4 x i32]], ptr %4, i64 0, i64 %65
  %67 = getelementptr inbounds [4 x i32], ptr %66, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %67, i8 63, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %161, %63
  %69 = load i32, ptr %8, align 4, !tbaa !5
  %70 = icmp slt i32 %69, 4
  br i1 %70, label %72, label %71

71:                                               ; preds = %68
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %164

72:                                               ; preds = %68
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [2 x [4 x i32]], ptr %4, i64 0, i64 %74
  %76 = load i32, ptr %8, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [4 x i32], ptr %75, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = icmp eq i32 %79, 1061109567
  br i1 %80, label %81, label %82

81:                                               ; preds = %72
  br label %161

82:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %157, %82
  %84 = load i32, ptr %9, align 4, !tbaa !5
  %85 = icmp slt i32 %84, 2
  br i1 %85, label %87, label %86

86:                                               ; preds = %83
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %160

87:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %88 = load i32, ptr %8, align 4, !tbaa !5
  %89 = shl i32 %88, 1
  %90 = load i32, ptr %9, align 4, !tbaa !5
  %91 = or i32 %89, %90
  %92 = and i32 %91, 3
  store i32 %92, ptr %10, align 4, !tbaa !5
  %93 = load i32, ptr %9, align 4, !tbaa !5
  %94 = icmp ne i32 %93, 0
  br i1 %94, label %130, label %95

95:                                               ; preds = %87
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = sub nsw i32 %96, 1
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [100001 x i8], ptr @_ZZ5solvevE3buf, i64 0, i64 %98
  %100 = load i8, ptr %99, align 1, !tbaa !9
  %101 = sext i8 %100 to i32
  %102 = load i32, ptr %7, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [100001 x i8], ptr @_ZZ5solvevE3buf, i64 0, i64 %103
  %105 = load i8, ptr %104, align 1, !tbaa !9
  %106 = sext i8 %105 to i32
  %107 = icmp eq i32 %101, %106
  br i1 %107, label %108, label %112

108:                                              ; preds = %95
  %109 = load i32, ptr %8, align 4, !tbaa !5
  %110 = and i32 %109, 1
  %111 = icmp ne i32 %110, 0
  br i1 %111, label %112, label %129

112:                                              ; preds = %108, %95
  %113 = load i32, ptr %7, align 4, !tbaa !5
  %114 = sub nsw i32 %113, 2
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [100001 x i8], ptr @_ZZ5solvevE3buf, i64 0, i64 %115
  %117 = load i8, ptr %116, align 1, !tbaa !9
  %118 = sext i8 %117 to i32
  %119 = load i32, ptr %7, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [100001 x i8], ptr @_ZZ5solvevE3buf, i64 0, i64 %120
  %122 = load i8, ptr %121, align 1, !tbaa !9
  %123 = sext i8 %122 to i32
  %124 = icmp eq i32 %118, %123
  br i1 %124, label %125, label %130

125:                                              ; preds = %112
  %126 = load i32, ptr %8, align 4, !tbaa !5
  %127 = and i32 %126, 2
  %128 = icmp ne i32 %127, 0
  br i1 %128, label %130, label %129

129:                                              ; preds = %125, %108
  store i32 10, ptr %3, align 4
  br label %154

130:                                              ; preds = %125, %112, %87
  %131 = load i32, ptr %5, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [2 x [4 x i32]], ptr %4, i64 0, i64 %132
  %134 = load i32, ptr %10, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [4 x i32], ptr %133, i64 0, i64 %135
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %137 = load i32, ptr %6, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [2 x [4 x i32]], ptr %4, i64 0, i64 %138
  %140 = load i32, ptr %8, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [4 x i32], ptr %139, i64 0, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = load i32, ptr %9, align 4, !tbaa !5
  %145 = add nsw i32 %143, %144
  store i32 %145, ptr %11, align 4, !tbaa !5
  %146 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %136, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %147 = load i32, ptr %146, align 4, !tbaa !5
  %148 = load i32, ptr %5, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [2 x [4 x i32]], ptr %4, i64 0, i64 %149
  %151 = load i32, ptr %10, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [4 x i32], ptr %150, i64 0, i64 %152
  store i32 %147, ptr %153, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  store i32 0, ptr %3, align 4
  br label %154

154:                                              ; preds = %130, %129
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  %155 = load i32, ptr %3, align 4
  switch i32 %155, label %191 [
    i32 0, label %156
    i32 10, label %157
  ]

156:                                              ; preds = %154
  br label %157

157:                                              ; preds = %156, %154
  %158 = load i32, ptr %9, align 4, !tbaa !5
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %9, align 4, !tbaa !5
  br label %83, !llvm.loop !10

160:                                              ; preds = %86
  br label %161

161:                                              ; preds = %160, %81
  %162 = load i32, ptr %8, align 4, !tbaa !5
  %163 = add nsw i32 %162, 1
  store i32 %163, ptr %8, align 4, !tbaa !5
  br label %68, !llvm.loop !12

164:                                              ; preds = %71
  br label %165

165:                                              ; preds = %164
  %166 = load i32, ptr %7, align 4, !tbaa !5
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %7, align 4, !tbaa !5
  br label %58, !llvm.loop !13

168:                                              ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 1061109567, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %169

169:                                              ; preds = %182, %168
  %170 = load i32, ptr %13, align 4, !tbaa !5
  %171 = icmp slt i32 %170, 4
  br i1 %171, label %173, label %172

172:                                              ; preds = %169
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %185

173:                                              ; preds = %169
  %174 = load i32, ptr %5, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [2 x [4 x i32]], ptr %4, i64 0, i64 %175
  %177 = load i32, ptr %13, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [4 x i32], ptr %176, i64 0, i64 %178
  %180 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %179)
  %181 = load i32, ptr %180, align 4, !tbaa !5
  store i32 %181, ptr %12, align 4, !tbaa !5
  br label %182

182:                                              ; preds = %173
  %183 = load i32, ptr %13, align 4, !tbaa !5
  %184 = add nsw i32 %183, 1
  store i32 %184, ptr %13, align 4, !tbaa !5
  br label %169, !llvm.loop !14

185:                                              ; preds = %172
  %186 = load i32, ptr %12, align 4, !tbaa !5
  %187 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %186)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #6
  store i32 0, ptr %3, align 4
  br label %188

188:                                              ; preds = %185, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #6
  %189 = load i32, ptr %3, align 4
  switch i32 %189, label %191 [
    i32 0, label %190
    i32 1, label %190
  ]

190:                                              ; preds = %188, %188
  ret void

191:                                              ; preds = %188, %154
  unreachable
}

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

declare i32 @puts(ptr noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

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

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

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 = { "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 willreturn memory(read) "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 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}


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

@_ZZ5solvevE3buf = external hidden global [100001 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca [2 x [4 x i32]], align 16
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @_ZZ5solvevE3buf)
  %7 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @_ZZ5solvevE3buf) #6
  %8 = trunc i64 %7 to i32
  %9 = icmp slt i32 %8, 3
  br i1 %9, label %10, label %20

10:                                               ; preds = %0
  %11 = icmp eq i32 %8, 2
  br i1 %11, label %12, label %16

12:                                               ; preds = %10
  %13 = load i8, ptr @_ZZ5solvevE3buf, align 16, !tbaa !5
  %14 = load i8, ptr getelementptr inbounds (i8, ptr @_ZZ5solvevE3buf, i64 1), align 1, !tbaa !5
  %15 = icmp eq i8 %13, %14
  br i1 %15, label %17, label %16

16:                                               ; preds = %12, %10
  br label %17

17:                                               ; preds = %12, %16
  %18 = phi ptr [ @.str.3, %16 ], [ @.str.2, %12 ]
  %19 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %18)
  br label %177

20:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  store i32 1, ptr %2, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  store i32 0, ptr %3, align 4, !tbaa !8
  %21 = load i8, ptr @_ZZ5solvevE3buf, align 16, !tbaa !5
  %22 = load i8, ptr getelementptr inbounds (i8, ptr @_ZZ5solvevE3buf, i64 1), align 1, !tbaa !5
  %23 = icmp eq i8 %21, %22
  %24 = select i1 %23, i32 1061109567, i32 0
  %25 = getelementptr inbounds i8, ptr %1, i64 16
  store i32 %24, ptr %25, align 16, !tbaa !8
  %26 = getelementptr inbounds i8, ptr %1, i64 24
  store i32 1, ptr %26, align 8, !tbaa !8
  %27 = getelementptr inbounds i8, ptr %1, i64 20
  store i32 1, ptr %27, align 4, !tbaa !8
  %28 = getelementptr inbounds i8, ptr %1, i64 28
  store i32 2, ptr %28, align 4, !tbaa !8
  %wide.trip.count = and i64 %7, 2147483647
  br label %.peel.begin

29:                                               ; preds = %.loopexit64
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  store i32 1061109567, ptr %5, align 4, !tbaa !8
  %30 = sext i32 %174 to i64
  %31 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %30, i64 0
  %32 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %31)
  %33 = load i32, ptr %32, align 4, !tbaa !8
  store i32 %33, ptr %5, align 4, !tbaa !8
  %34 = load i32, ptr %2, align 4, !tbaa !8
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %35, i64 1
  %37 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %36)
  %38 = load i32, ptr %37, align 4, !tbaa !8
  store i32 %38, ptr %5, align 4, !tbaa !8
  %39 = load i32, ptr %2, align 4, !tbaa !8
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %40, i64 2
  %42 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %41)
  %43 = load i32, ptr %42, align 4, !tbaa !8
  store i32 %43, ptr %5, align 4, !tbaa !8
  %44 = load i32, ptr %2, align 4, !tbaa !8
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %45, i64 3
  %47 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %46)
  %48 = load i32, ptr %47, align 4, !tbaa !8
  store i32 %48, ptr %5, align 4, !tbaa !8
  %49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %48)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #7
  br label %177

.peel.begin:                                      ; preds = %20, %.loopexit64
  %indvars.iv40 = phi i64 [ 2, %20 ], [ %indvars.iv.next41, %.loopexit64 ]
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3) #7
  %50 = load i32, ptr %2, align 4, !tbaa !8
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %51
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %52, i8 63, i64 16, i1 false)
  %53 = add nsw i64 %indvars.iv40, -1
  %54 = getelementptr inbounds [100001 x i8], ptr @_ZZ5solvevE3buf, i64 0, i64 %53
  %55 = getelementptr inbounds [100001 x i8], ptr @_ZZ5solvevE3buf, i64 0, i64 %indvars.iv40
  %56 = add nsw i64 %indvars.iv40, -2
  %57 = getelementptr inbounds [100001 x i8], ptr @_ZZ5solvevE3buf, i64 0, i64 %56
  %58 = load i32, ptr %3, align 4, !tbaa !8
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %59, i64 0
  %61 = load i32, ptr %60, align 16, !tbaa !8
  %62 = icmp eq i32 %61, 1061109567
  br i1 %62, label %.peel.next, label %.preheader.split.preheader.peel

.preheader.split.preheader.peel:                  ; preds = %.peel.begin
  %63 = load i8, ptr %54, align 1, !tbaa !5
  %64 = load i8, ptr %55, align 1, !tbaa !5
  %65 = icmp eq i8 %63, %64
  br i1 %65, label %.loopexit.loopexit.peel, label %66

66:                                               ; preds = %.preheader.split.preheader.peel
  %67 = load i8, ptr %57, align 1, !tbaa !5
  %68 = icmp eq i8 %67, %64
  br i1 %68, label %.loopexit.loopexit.peel, label %69

69:                                               ; preds = %66
  %70 = sext i32 %50 to i64
  %71 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %70, i64 0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  store i32 %61, ptr %4, align 4, !tbaa !8
  %72 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %71, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %73 = load i32, ptr %72, align 4, !tbaa !8
  %74 = load i32, ptr %2, align 4, !tbaa !8
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %75, i64 0
  store i32 %73, ptr %76, align 16, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  br label %.loopexit.loopexit.peel

.loopexit.loopexit.peel:                          ; preds = %69, %66, %.preheader.split.preheader.peel
  %77 = phi i32 [ %50, %.preheader.split.preheader.peel ], [ %50, %66 ], [ %74, %69 ]
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %78, i64 1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %80 = load i32, ptr %3, align 4, !tbaa !8
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %81, i64 0
  %83 = load i32, ptr %82, align 16, !tbaa !8
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %4, align 4, !tbaa !8
  %85 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %79, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %86 = load i32, ptr %85, align 4, !tbaa !8
  %87 = load i32, ptr %2, align 4, !tbaa !8
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %88, i64 1
  store i32 %86, ptr %89, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  br label %.peel.next

.peel.next:                                       ; preds = %.loopexit.loopexit.peel, %.peel.begin
  %90 = phi i32 [ %87, %.loopexit.loopexit.peel ], [ %50, %.peel.begin ]
  %91 = load i32, ptr %3, align 4, !tbaa !8
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %92, i64 1
  %94 = load i32, ptr %93, align 4, !tbaa !8
  %95 = icmp eq i32 %94, 1061109567
  br i1 %95, label %.peel.newph, label %.preheader.split.us.preheader.peel54

.preheader.split.us.preheader.peel54:             ; preds = %.peel.next
  %96 = load i8, ptr %55, align 1, !tbaa !5
  %97 = load i8, ptr %57, align 1, !tbaa !5
  %98 = icmp eq i8 %97, %96
  br i1 %98, label %.loopexit.loopexit37.peel56, label %99

99:                                               ; preds = %.preheader.split.us.preheader.peel54
  %100 = sext i32 %90 to i64
  %101 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %100, i64 2
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  store i32 %94, ptr %4, align 4, !tbaa !8
  %102 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %101, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %103 = load i32, ptr %102, align 4, !tbaa !8
  %104 = load i32, ptr %2, align 4, !tbaa !8
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %105, i64 2
  store i32 %103, ptr %106, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  br label %.loopexit.loopexit37.peel56

.loopexit.loopexit37.peel56:                      ; preds = %99, %.preheader.split.us.preheader.peel54
  %107 = phi i32 [ %104, %99 ], [ %90, %.preheader.split.us.preheader.peel54 ]
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %108, i64 3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %110 = load i32, ptr %3, align 4, !tbaa !8
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %111, i64 1
  %113 = load i32, ptr %112, align 4, !tbaa !8
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %4, align 4, !tbaa !8
  %115 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %109, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %116 = load i32, ptr %115, align 4, !tbaa !8
  %117 = load i32, ptr %2, align 4, !tbaa !8
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %118, i64 3
  store i32 %116, ptr %119, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  br label %.peel.newph

.peel.newph:                                      ; preds = %.peel.next, %.loopexit.loopexit37.peel56
  %120 = phi i32 [ %117, %.loopexit.loopexit37.peel56 ], [ %90, %.peel.next ]
  br label %121

.loopexit64:                                      ; preds = %.loopexit
  %indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
  %exitcond43.not = icmp eq i64 %indvars.iv.next41, %wide.trip.count
  br i1 %exitcond43.not, label %29, label %.peel.begin, !llvm.loop !10

121:                                              ; preds = %.peel.newph, %.loopexit
  %122 = phi i32 [ %120, %.peel.newph ], [ %174, %.loopexit ]
  %123 = phi i32 [ %120, %.peel.newph ], [ %175, %.loopexit ]
  %124 = phi i32 [ %120, %.peel.newph ], [ %176, %.loopexit ]
  %indvars.iv = phi i64 [ 2, %.peel.newph ], [ %indvars.iv.next, %.loopexit ]
  %125 = load i32, ptr %3, align 4, !tbaa !8
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %126, i64 %indvars.iv
  %128 = load i32, ptr %127, align 4, !tbaa !8
  %129 = icmp eq i32 %128, 1061109567
  br i1 %129, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %121
  %130 = and i64 %indvars.iv, 1
  %.not30 = icmp eq i64 %130, 0
  br i1 %.not30, label %.preheader.split.preheader, label %.preheader.split.us.preheader

.preheader.split.us.preheader:                    ; preds = %.preheader
  %131 = sext i32 %124 to i64
  %132 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %131, i64 2
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  store i32 %128, ptr %4, align 4, !tbaa !8
  %133 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %132, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %134 = load i32, ptr %133, align 4, !tbaa !8
  %135 = load i32, ptr %2, align 4, !tbaa !8
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %136, i64 2
  store i32 %134, ptr %137, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  %138 = sext i32 %135 to i64
  %139 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %138, i64 3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %140 = load i32, ptr %3, align 4, !tbaa !8
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %141, i64 %indvars.iv
  %143 = load i32, ptr %142, align 4, !tbaa !8
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %4, align 4, !tbaa !8
  %145 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %139, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %146 = load i32, ptr %145, align 4, !tbaa !8
  %147 = load i32, ptr %2, align 4, !tbaa !8
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %148, i64 3
  store i32 %146, ptr %149, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  br label %.loopexit

.preheader.split.preheader:                       ; preds = %.preheader
  %150 = load i8, ptr %54, align 1, !tbaa !5
  %151 = load i8, ptr %55, align 1, !tbaa !5
  %152 = icmp eq i8 %150, %151
  br i1 %152, label %.loopexit.loopexit, label %153

153:                                              ; preds = %.preheader.split.preheader
  %154 = sext i32 %123 to i64
  %155 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %154, i64 0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  store i32 %128, ptr %4, align 4, !tbaa !8
  %156 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %155, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %157 = load i32, ptr %156, align 4, !tbaa !8
  %158 = load i32, ptr %2, align 4, !tbaa !8
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %159, i64 0
  store i32 %157, ptr %160, align 16, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  br label %.loopexit.loopexit

.loopexit.loopexit:                               ; preds = %153, %.preheader.split.preheader
  %161 = phi i32 [ %122, %.preheader.split.preheader ], [ %158, %153 ]
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %162, i64 1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %164 = load i32, ptr %3, align 4, !tbaa !8
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %165, i64 %indvars.iv
  %167 = load i32, ptr %166, align 4, !tbaa !8
  %168 = add nsw i32 %167, 1
  store i32 %168, ptr %4, align 4, !tbaa !8
  %169 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %163, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %170 = load i32, ptr %169, align 4, !tbaa !8
  %171 = load i32, ptr %2, align 4, !tbaa !8
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [2 x [4 x i32]], ptr %1, i64 0, i64 %172, i64 1
  store i32 %170, ptr %173, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  br label %.loopexit

.loopexit:                                        ; preds = %.preheader.split.us.preheader, %.loopexit.loopexit, %121
  %174 = phi i32 [ %147, %.preheader.split.us.preheader ], [ %171, %.loopexit.loopexit ], [ %122, %121 ]
  %175 = phi i32 [ %147, %.preheader.split.us.preheader ], [ %171, %.loopexit.loopexit ], [ %123, %121 ]
  %176 = phi i32 [ %147, %.preheader.split.us.preheader ], [ %171, %.loopexit.loopexit ], [ %124, %121 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 4
  br i1 %exitcond.not, label %.loopexit64, label %121, !llvm.loop !12

177:                                              ; preds = %29, %17
  ret void
}

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) 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) #1

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

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 = { 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 #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind willreturn memory(read) }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11, !13}
!13 = !{!"llvm.loop.peeled.count", i32 2}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass