; LLVM IR from ritikbanger/Hacktoberfest2022-DSA :: 07. Matrix/zigzagmatrix.ll (Z12zigZagMatrixPA3_iii)

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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12zigZagMatrixPA3_iii(ptr noundef %0, i32 noundef %1, i32 noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i8, align 1
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #5
  store i8 0, ptr %9, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %18 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %19 = load i32, ptr %18, align 4, !tbaa !9
  store i32 %19, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 1, ptr %11, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %80, %3
  %21 = load i32, ptr %11, align 4, !tbaa !9
  %22 = load i32, ptr %10, align 4, !tbaa !9
  %23 = icmp sle i32 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  store i32 2, ptr %12, align 4
  br label %83

25:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %61, %25
  %27 = load i32, ptr %13, align 4, !tbaa !9
  %28 = load i32, ptr %11, align 4, !tbaa !9
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  store i32 5, ptr %12, align 4
  br label %64

31:                                               ; preds = %26
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = load i32, ptr %7, align 4, !tbaa !9
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [3 x i32], ptr %32, i64 %34
  %36 = load i32, ptr %8, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [3 x i32], ptr %35, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !9
  %40 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %39)
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %40, ptr noundef @.str)
  %42 = load i32, ptr %13, align 4, !tbaa !9
  %43 = add nsw i32 %42, 1
  %44 = load i32, ptr %11, align 4, !tbaa !9
  %45 = icmp eq i32 %43, %44
  br i1 %45, label %46, label %47

46:                                               ; preds = %31
  store i32 5, ptr %12, align 4
  br label %64

47:                                               ; preds = %31
  %48 = load i8, ptr %9, align 1, !tbaa !11, !range !13, !noundef !14
  %49 = trunc i8 %48 to i1
  br i1 %49, label %50, label %55

50:                                               ; preds = %47
  %51 = load i32, ptr %7, align 4, !tbaa !9
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %7, align 4, !tbaa !9
  %53 = load i32, ptr %8, align 4, !tbaa !9
  %54 = add nsw i32 %53, -1
  store i32 %54, ptr %8, align 4, !tbaa !9
  br label %60

55:                                               ; preds = %47
  %56 = load i32, ptr %7, align 4, !tbaa !9
  %57 = add nsw i32 %56, -1
  store i32 %57, ptr %7, align 4, !tbaa !9
  %58 = load i32, ptr %8, align 4, !tbaa !9
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %8, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %55, %50
  br label %61

61:                                               ; preds = %60
  %62 = load i32, ptr %13, align 4, !tbaa !9
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %13, align 4, !tbaa !9
  br label %26, !llvm.loop !15

64:                                               ; preds = %46, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %65

65:                                               ; preds = %64
  %66 = load i32, ptr %11, align 4, !tbaa !9
  %67 = load i32, ptr %10, align 4, !tbaa !9
  %68 = icmp eq i32 %66, %67
  br i1 %68, label %69, label %70

69:                                               ; preds = %65
  store i32 2, ptr %12, align 4
  br label %83

70:                                               ; preds = %65
  %71 = load i8, ptr %9, align 1, !tbaa !11, !range !13, !noundef !14
  %72 = trunc i8 %71 to i1
  br i1 %72, label %73, label %76

73:                                               ; preds = %70
  %74 = load i32, ptr %7, align 4, !tbaa !9
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %7, align 4, !tbaa !9
  store i8 0, ptr %9, align 1, !tbaa !11
  br label %79

76:                                               ; preds = %70
  %77 = load i32, ptr %8, align 4, !tbaa !9
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %8, align 4, !tbaa !9
  store i8 1, ptr %9, align 1, !tbaa !11
  br label %79

79:                                               ; preds = %76, %73
  br label %80

80:                                               ; preds = %79
  %81 = load i32, ptr %11, align 4, !tbaa !9
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %11, align 4, !tbaa !9
  br label %20, !llvm.loop !17

83:                                               ; preds = %69, %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %84

84:                                               ; preds = %83
  %85 = load i32, ptr %7, align 4, !tbaa !9
  %86 = icmp eq i32 %85, 0
  br i1 %86, label %87, label %99

87:                                               ; preds = %84
  %88 = load i32, ptr %8, align 4, !tbaa !9
  %89 = load i32, ptr %6, align 4, !tbaa !9
  %90 = sub nsw i32 %89, 1
  %91 = icmp eq i32 %88, %90
  br i1 %91, label %92, label %95

92:                                               ; preds = %87
  %93 = load i32, ptr %7, align 4, !tbaa !9
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %7, align 4, !tbaa !9
  br label %98

95:                                               ; preds = %87
  %96 = load i32, ptr %8, align 4, !tbaa !9
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %8, align 4, !tbaa !9
  br label %98

98:                                               ; preds = %95, %92
  store i8 1, ptr %9, align 1, !tbaa !11
  br label %111

99:                                               ; preds = %84
  %100 = load i32, ptr %7, align 4, !tbaa !9
  %101 = load i32, ptr %5, align 4, !tbaa !9
  %102 = sub nsw i32 %101, 1
  %103 = icmp eq i32 %100, %102
  br i1 %103, label %104, label %107

104:                                              ; preds = %99
  %105 = load i32, ptr %8, align 4, !tbaa !9
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %8, align 4, !tbaa !9
  br label %110

107:                                              ; preds = %99
  %108 = load i32, ptr %7, align 4, !tbaa !9
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %7, align 4, !tbaa !9
  br label %110

110:                                              ; preds = %107, %104
  store i8 0, ptr %9, align 1, !tbaa !11
  br label %111

111:                                              ; preds = %110, %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %112 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %113 = load i32, ptr %112, align 4, !tbaa !9
  %114 = sub nsw i32 %113, 1
  store i32 %114, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %115 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %115, ptr %16, align 4, !tbaa !9
  br label %116

116:                                              ; preds = %210, %111
  %117 = load i32, ptr %16, align 4, !tbaa !9
  %118 = icmp sgt i32 %117, 0
  br i1 %118, label %120, label %119

119:                                              ; preds = %116
  store i32 8, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %213

120:                                              ; preds = %116
  %121 = load i32, ptr %16, align 4, !tbaa !9
  %122 = load i32, ptr %10, align 4, !tbaa !9
  %123 = icmp sgt i32 %121, %122
  br i1 %123, label %124, label %126

124:                                              ; preds = %120
  %125 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %125, ptr %15, align 4, !tbaa !9
  br label %128

126:                                              ; preds = %120
  %127 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %127, ptr %15, align 4, !tbaa !9
  br label %128

128:                                              ; preds = %126, %124
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %129

129:                                              ; preds = %164, %128
  %130 = load i32, ptr %17, align 4, !tbaa !9
  %131 = load i32, ptr %15, align 4, !tbaa !9
  %132 = icmp slt i32 %130, %131
  br i1 %132, label %134, label %133

133:                                              ; preds = %129
  store i32 11, ptr %12, align 4
  br label %167

134:                                              ; preds = %129
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  %136 = load i32, ptr %7, align 4, !tbaa !9
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [3 x i32], ptr %135, i64 %137
  %139 = load i32, ptr %8, align 4, !tbaa !9
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [3 x i32], ptr %138, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !9
  %143 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %142)
  %144 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %143, ptr noundef @.str)
  %145 = load i32, ptr %17, align 4, !tbaa !9
  %146 = add nsw i32 %145, 1
  %147 = load i32, ptr %15, align 4, !tbaa !9
  %148 = icmp eq i32 %146, %147
  br i1 %148, label %149, label %150

149:                                              ; preds = %134
  store i32 11, ptr %12, align 4
  br label %167

150:                                              ; preds = %134
  %151 = load i8, ptr %9, align 1, !tbaa !11, !range !13, !noundef !14
  %152 = trunc i8 %151 to i1
  br i1 %152, label %153, label %158

153:                                              ; preds = %150
  %154 = load i32, ptr %7, align 4, !tbaa !9
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %7, align 4, !tbaa !9
  %156 = load i32, ptr %8, align 4, !tbaa !9
  %157 = add nsw i32 %156, -1
  store i32 %157, ptr %8, align 4, !tbaa !9
  br label %163

158:                                              ; preds = %150
  %159 = load i32, ptr %8, align 4, !tbaa !9
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %8, align 4, !tbaa !9
  %161 = load i32, ptr %7, align 4, !tbaa !9
  %162 = add nsw i32 %161, -1
  store i32 %162, ptr %7, align 4, !tbaa !9
  br label %163

163:                                              ; preds = %158, %153
  br label %164

164:                                              ; preds = %163
  %165 = load i32, ptr %17, align 4, !tbaa !9
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %17, align 4, !tbaa !9
  br label %129, !llvm.loop !18

167:                                              ; preds = %149, %133
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %168

168:                                              ; preds = %167
  %169 = load i32, ptr %7, align 4, !tbaa !9
  %170 = icmp eq i32 %169, 0
  br i1 %170, label %176, label %171

171:                                              ; preds = %168
  %172 = load i32, ptr %8, align 4, !tbaa !9
  %173 = load i32, ptr %6, align 4, !tbaa !9
  %174 = sub nsw i32 %173, 1
  %175 = icmp eq i32 %172, %174
  br i1 %175, label %176, label %188

176:                                              ; preds = %171, %168
  %177 = load i32, ptr %8, align 4, !tbaa !9
  %178 = load i32, ptr %6, align 4, !tbaa !9
  %179 = sub nsw i32 %178, 1
  %180 = icmp eq i32 %177, %179
  br i1 %180, label %181, label %184

181:                                              ; preds = %176
  %182 = load i32, ptr %7, align 4, !tbaa !9
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr %7, align 4, !tbaa !9
  br label %187

184:                                              ; preds = %176
  %185 = load i32, ptr %8, align 4, !tbaa !9
  %186 = add nsw i32 %185, 1
  store i32 %186, ptr %8, align 4, !tbaa !9
  br label %187

187:                                              ; preds = %184, %181
  store i8 1, ptr %9, align 1, !tbaa !11
  br label %209

188:                                              ; preds = %171
  %189 = load i32, ptr %8, align 4, !tbaa !9
  %190 = icmp eq i32 %189, 0
  br i1 %190, label %196, label %191

191:                                              ; preds = %188
  %192 = load i32, ptr %7, align 4, !tbaa !9
  %193 = load i32, ptr %5, align 4, !tbaa !9
  %194 = sub nsw i32 %193, 1
  %195 = icmp eq i32 %192, %194
  br i1 %195, label %196, label %208

196:                                              ; preds = %191, %188
  %197 = load i32, ptr %7, align 4, !tbaa !9
  %198 = load i32, ptr %5, align 4, !tbaa !9
  %199 = sub nsw i32 %198, 1
  %200 = icmp eq i32 %197, %199
  br i1 %200, label %201, label %204

201:                                              ; preds = %196
  %202 = load i32, ptr %8, align 4, !tbaa !9
  %203 = add nsw i32 %202, 1
  store i32 %203, ptr %8, align 4, !tbaa !9
  br label %207

204:                                              ; preds = %196
  %205 = load i32, ptr %7, align 4, !tbaa !9
  %206 = add nsw i32 %205, 1
  store i32 %206, ptr %7, align 4, !tbaa !9
  br label %207

207:                                              ; preds = %204, %201
  store i8 0, ptr %9, align 1, !tbaa !11
  br label %208

208:                                              ; preds = %207, %191
  br label %209

209:                                              ; preds = %208, %187
  br label %210

210:                                              ; preds = %209
  %211 = load i32, ptr %16, align 4, !tbaa !9
  %212 = add nsw i32 %211, -1
  store i32 %212, ptr %16, align 4, !tbaa !9
  br label %116, !llvm.loop !19

213:                                              ; preds = %119
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  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: 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)) #2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #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 = { 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 #3 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}


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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12zigZagMatrixPA3_iii(ptr nocapture noundef readonly %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store i32 %1, ptr %4, align 4, !tbaa !5
  store i32 %2, ptr %5, align 4, !tbaa !5
  %6 = 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) %4)
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %.not94 = icmp slt i32 %7, 1
  br i1 %.not94, label %._crit_edge.thread, label %.preheader

.preheader:                                       ; preds = %3, %29
  %indvars.iv123 = phi i32 [ %indvars.iv.next124, %29 ], [ 0, %3 ]
  %.05998 = phi i32 [ %.3, %29 ], [ 0, %3 ]
  %.06197 = phi i32 [ %32, %29 ], [ 1, %3 ]
  %.06296 = phi i32 [ %.365, %29 ], [ 0, %3 ]
  %indvars128 = trunc i32 %indvars.iv123 to i1
  %.264.v = select i1 %indvars128, i32 -1, i32 1
  %.2.v = select i1 %indvars128, i32 1, i32 -1
  %8 = sext i32 %.05998 to i64
  %9 = sext i32 %.2.v to i64
  %10 = sext i32 %.06296 to i64
  %11 = sext i32 %.264.v to i64
  %12 = mul i32 %.264.v, %indvars.iv123
  %13 = add i32 %.06296, %12
  %14 = mul i32 %.2.v, %indvars.iv123
  %15 = add i32 %.05998, %14
  %16 = getelementptr inbounds [3 x i32], ptr %0, i64 %8, i64 %10
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %17)
  %19 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef nonnull @.str)
  %20 = icmp eq i32 %.06197, 1
  br i1 %20, label %split, label %.lr.ph153

.lr.ph153:                                        ; preds = %.preheader, %.lr.ph153
  %21 = phi i32 [ %26, %.lr.ph153 ], [ 1, %.preheader ]
  %indvars.iv152 = phi i64 [ %indvars.iv.next, %.lr.ph153 ], [ %8, %.preheader ]
  %indvars.iv121151 = phi i64 [ %indvars.iv.next122, %.lr.ph153 ], [ %10, %.preheader ]
  %indvars.iv.next122 = add nsw i64 %indvars.iv121151, %11
  %indvars.iv.next = add nsw i64 %indvars.iv152, %9
  %22 = getelementptr inbounds [3 x i32], ptr %0, i64 %indvars.iv.next, i64 %indvars.iv.next122
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %23)
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef nonnull @.str)
  %26 = add nuw nsw i32 %21, 1
  %27 = icmp eq i32 %26, %.06197
  br i1 %27, label %split, label %.lr.ph153

split:                                            ; preds = %.lr.ph153, %.preheader
  %28 = icmp eq i32 %.06197, %7
  br i1 %28, label %._crit_edge, label %29

29:                                               ; preds = %split
  %indvars.iv.next124 = add nuw nsw i32 %indvars.iv123, 1
  %not..076 = and i32 %indvars.iv123, 1
  %30 = xor i32 %not..076, 1
  %.365 = add nsw i32 %13, %30
  %31 = and i32 %indvars.iv123, 1
  %.3 = add nsw i32 %15, %31
  %32 = add nuw nsw i32 %.06197, 1
  br label %.preheader

._crit_edge:                                      ; preds = %split
  %33 = icmp eq i32 %15, 0
  br i1 %33, label %._crit_edge.thread, label %37

._crit_edge.thread:                               ; preds = %3, %._crit_edge
  %.466146 = phi i32 [ %13, %._crit_edge ], [ 0, %3 ]
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = add nsw i32 %34, -1
  %36 = icmp ne i32 %.466146, %35
  %not.87 = xor i1 %36, true
  %.5 = zext i1 %not.87 to i32
  br label %42

37:                                               ; preds = %._crit_edge
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = add nsw i32 %38, -1
  %40 = icmp eq i32 %15, %39
  %not.85 = xor i1 %40, true
  %41 = zext i1 %not.85 to i32
  %.6 = add nsw i32 %15, %41
  br label %42

42:                                               ; preds = %37, %._crit_edge.thread
  %43 = phi i1 [ true, %._crit_edge.thread ], [ false, %37 ]
  %.466147 = phi i32 [ %.466146, %._crit_edge.thread ], [ %13, %37 ]
  %.pn.in = phi i1 [ %36, %._crit_edge.thread ], [ %40, %37 ]
  %.7 = phi i32 [ %.5, %._crit_edge.thread ], [ %.6, %37 ]
  %44 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = icmp sgt i32 %45, 1
  br i1 %46, label %.lr.ph119.preheader, label %._crit_edge120

.lr.ph119.preheader:                              ; preds = %42
  %.pn = zext i1 %.pn.in to i32
  %.769 = add nsw i32 %.466147, %.pn
  br label %.lr.ph119

._crit_edge120:                                   ; preds = %80, %42
  ret void

.lr.ph119:                                        ; preds = %.lr.ph119.preheader, %80
  %indvars.iv133.in = phi i32 [ %45, %.lr.ph119.preheader ], [ %indvars.iv133, %80 ]
  %.057117.in = phi i32 [ %45, %.lr.ph119.preheader ], [ %.057117, %80 ]
  %.8116 = phi i32 [ %.7, %.lr.ph119.preheader ], [ %.13, %80 ]
  %.870115 = phi i32 [ %.769, %.lr.ph119.preheader ], [ %.1375, %80 ]
  %.379114 = phi i1 [ %43, %.lr.ph119.preheader ], [ %.480, %80 ]
  %indvars.iv133 = add nsw i32 %indvars.iv133.in, -1
  %.057117 = add nsw i32 %.057117.in, -1
  %..057 = call i32 @llvm.smin.i32(i32 %.057117, i32 %7)
  %47 = icmp sgt i32 %..057, 0
  br i1 %47, label %.lr.ph, label %._crit_edge107

.lr.ph:                                           ; preds = %.lr.ph119
  %smin = call i32 @llvm.smin.i32(i32 %7, i32 %indvars.iv133)
  %48 = add i32 %smin, -1
  %.1072.v = select i1 %.379114, i32 -1, i32 1
  %.10.v = select i1 %.379114, i32 1, i32 -1
  %49 = sext i32 %.8116 to i64
  %50 = sext i32 %.10.v to i64
  %51 = sext i32 %.870115 to i64
  %52 = sext i32 %.1072.v to i64
  %53 = mul i32 %.1072.v, %48
  %54 = add i32 %.870115, %53
  %55 = mul i32 %.10.v, %48
  %56 = add i32 %.8116, %55
  %57 = getelementptr inbounds [3 x i32], ptr %0, i64 %49, i64 %51
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %58)
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %59, ptr noundef nonnull @.str)
  %61 = icmp eq i32 %..057, 1
  br i1 %61, label %._crit_edge107, label %.lr.ph156

.lr.ph156:                                        ; preds = %.lr.ph, %.lr.ph156
  %62 = phi i32 [ %67, %.lr.ph156 ], [ 1, %.lr.ph ]
  %indvars.iv129155 = phi i64 [ %indvars.iv.next130, %.lr.ph156 ], [ %49, %.lr.ph ]
  %indvars.iv131154 = phi i64 [ %indvars.iv.next132, %.lr.ph156 ], [ %51, %.lr.ph ]
  %indvars.iv.next132 = add nsw i64 %indvars.iv131154, %52
  %indvars.iv.next130 = add nsw i64 %indvars.iv129155, %50
  %63 = getelementptr inbounds [3 x i32], ptr %0, i64 %indvars.iv.next130, i64 %indvars.iv.next132
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %64)
  %66 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %65, ptr noundef nonnull @.str)
  %67 = add nuw nsw i32 %62, 1
  %68 = icmp eq i32 %67, %..057
  br i1 %68, label %._crit_edge107, label %.lr.ph156

._crit_edge107:                                   ; preds = %.lr.ph156, %.lr.ph, %.lr.ph119
  %.971.lcssa = phi i32 [ %.870115, %.lr.ph119 ], [ %54, %.lr.ph ], [ %54, %.lr.ph156 ]
  %.9.lcssa = phi i32 [ %.8116, %.lr.ph119 ], [ %56, %.lr.ph ], [ %56, %.lr.ph156 ]
  %69 = icmp eq i32 %.9.lcssa, 0
  %.pre139 = load i32, ptr %5, align 4, !tbaa !5
  %.pre141 = add nsw i32 %.pre139, -1
  %70 = icmp eq i32 %.971.lcssa, %.pre141
  %or.cond = select i1 %69, i1 true, i1 %70
  br i1 %or.cond, label %._crit_edge107._crit_edge, label %74

._crit_edge107._crit_edge:                        ; preds = %._crit_edge107
  %71 = icmp ne i32 %.971.lcssa, %.pre141
  %72 = zext i1 %71 to i32
  %.1173 = add nsw i32 %.971.lcssa, %72
  %not.90 = xor i1 %71, true
  %73 = zext i1 %not.90 to i32
  %.11 = add nsw i32 %.9.lcssa, %73
  br label %80

74:                                               ; preds = %._crit_edge107
  %75 = icmp eq i32 %.971.lcssa, 0
  %.pre = load i32, ptr %4, align 4, !tbaa !5
  %.pre142 = add nsw i32 %.pre, -1
  %76 = icmp eq i32 %.9.lcssa, %.pre142
  %or.cond149 = select i1 %75, i1 true, i1 %76
  br i1 %or.cond149, label %._crit_edge140, label %80

._crit_edge140:                                   ; preds = %74
  %77 = icmp eq i32 %.9.lcssa, %.pre142
  %78 = zext i1 %77 to i32
  %.1274 = add nsw i32 %.971.lcssa, %78
  %not.88 = xor i1 %77, true
  %79 = zext i1 %not.88 to i32
  %.12 = add nsw i32 %.9.lcssa, %79
  br label %80

80:                                               ; preds = %74, %._crit_edge107._crit_edge, %._crit_edge140
  %.480 = phi i1 [ true, %._crit_edge107._crit_edge ], [ false, %._crit_edge140 ], [ %.379114, %74 ]
  %.1375 = phi i32 [ %.1173, %._crit_edge107._crit_edge ], [ %.1274, %._crit_edge140 ], [ %.971.lcssa, %74 ]
  %.13 = phi i32 [ %.11, %._crit_edge107._crit_edge ], [ %.12, %._crit_edge140 ], [ %.9.lcssa, %74 ]
  %81 = icmp sgt i32 %.057117.in, 2
  br i1 %81, label %.lr.ph119, label %._crit_edge120, !llvm.loop !9
}

; 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 #1

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #2 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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"}


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