; LLVM IR from brpapa/algorithms :: solutions/uva (11831)

; 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_istream" = type { ptr, i64, %"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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@R = external dso_local global i32, align 4
@C = external dso_local global i32, align 4
@I = external dso_local global i32, align 4
@grid = external dso_local global [110 x [110 x i8]], align 16
@instructions = external dso_local global [50050 x i8], align 16
@orientations = external dso_local global [4 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4walkiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #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 norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %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
  store i32 0, ptr %1, align 4
  br label %10

10:                                               ; preds = %112, %0
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @R)
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 4 dereferenceable(4) @C)
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 4 dereferenceable(4) @I)
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  %15 = getelementptr i8, ptr %14, i64 -24
  %16 = load i64, ptr %15, align 8
  %17 = getelementptr inbounds i8, ptr %13, i64 %16
  %18 = call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %17)
  br i1 %18, label %19, label %30

19:                                               ; preds = %10
  %20 = load i32, ptr @R, align 4, !tbaa !8
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %28, label %22

22:                                               ; preds = %19
  %23 = load i32, ptr @C, align 4, !tbaa !8
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %28, label %25

25:                                               ; preds = %22
  %26 = load i32, ptr @I, align 4, !tbaa !8
  %27 = icmp ne i32 %26, 0
  br label %28

28:                                               ; preds = %25, %22, %19
  %29 = phi i1 [ true, %22 ], [ true, %19 ], [ %27, %25 ]
  br label %30

30:                                               ; preds = %28, %10
  %31 = phi i1 [ false, %10 ], [ %29, %28 ]
  br i1 %31, label %32, label %119

32:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 -1, ptr %4, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !8
  br label %33

33:                                               ; preds = %95, %32
  %34 = load i32, ptr %5, align 4, !tbaa !8
  %35 = load i32, ptr @R, align 4, !tbaa !8
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  store i32 4, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %98

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !8
  br label %39

39:                                               ; preds = %91, %38
  %40 = load i32, ptr %7, align 4, !tbaa !8
  %41 = load i32, ptr @C, align 4, !tbaa !8
  %42 = icmp slt i32 %40, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %39
  store i32 7, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %94

44:                                               ; preds = %39
  %45 = load i32, ptr %5, align 4, !tbaa !8
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [110 x [110 x i8]], ptr @grid, i64 0, i64 %46
  %48 = load i32, ptr %7, align 4, !tbaa !8
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [110 x i8], ptr %47, i64 0, i64 %49
  %51 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %50)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !8
  br label %52

52:                                               ; preds = %87, %44
  %53 = load i32, ptr %8, align 4, !tbaa !8
  %54 = icmp slt i32 %53, 4
  br i1 %54, label %55, label %58

55:                                               ; preds = %52
  %56 = load i32, ptr %4, align 4, !tbaa !8
  %57 = icmp eq i32 %56, -1
  br label %58

58:                                               ; preds = %55, %52
  %59 = phi i1 [ false, %52 ], [ %57, %55 ]
  br i1 %59, label %61, label %60

60:                                               ; preds = %58
  store i32 10, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %90

61:                                               ; preds = %58
  %62 = load i32, ptr %5, align 4, !tbaa !8
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [110 x [110 x i8]], ptr @grid, i64 0, i64 %63
  %65 = load i32, ptr %7, align 4, !tbaa !8
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [110 x i8], ptr %64, i64 0, i64 %66
  %68 = load i8, ptr %67, align 1, !tbaa !11
  %69 = sext i8 %68 to i32
  %70 = load i32, ptr %8, align 4, !tbaa !8
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [4 x i8], ptr @orientations, i64 0, i64 %71
  %73 = load i8, ptr %72, align 1, !tbaa !11
  %74 = sext i8 %73 to i32
  %75 = icmp eq i32 %69, %74
  br i1 %75, label %76, label %86

76:                                               ; preds = %61
  %77 = load i32, ptr %5, align 4, !tbaa !8
  store i32 %77, ptr %2, align 4, !tbaa !8
  %78 = load i32, ptr %7, align 4, !tbaa !8
  store i32 %78, ptr %3, align 4, !tbaa !8
  %79 = load i32, ptr %8, align 4, !tbaa !8
  store i32 %79, ptr %4, align 4, !tbaa !8
  %80 = load i32, ptr %5, align 4, !tbaa !8
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [110 x [110 x i8]], ptr @grid, i64 0, i64 %81
  %83 = load i32, ptr %7, align 4, !tbaa !8
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [110 x i8], ptr %82, i64 0, i64 %84
  store i8 46, ptr %85, align 1, !tbaa !11
  br label %86

86:                                               ; preds = %76, %61
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %8, align 4, !tbaa !8
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %8, align 4, !tbaa !8
  br label %52, !llvm.loop !12

90:                                               ; preds = %60
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr %7, align 4, !tbaa !8
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %7, align 4, !tbaa !8
  br label %39, !llvm.loop !14

94:                                               ; preds = %43
  br label %95

95:                                               ; preds = %94
  %96 = load i32, ptr %5, align 4, !tbaa !8
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %5, align 4, !tbaa !8
  br label %33, !llvm.loop !15

98:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !8
  br label %99

99:                                               ; preds = %109, %98
  %100 = load i32, ptr %9, align 4, !tbaa !8
  %101 = load i32, ptr @I, align 4, !tbaa !8
  %102 = icmp slt i32 %100, %101
  br i1 %102, label %104, label %103

103:                                              ; preds = %99
  store i32 13, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %112

104:                                              ; preds = %99
  %105 = load i32, ptr %9, align 4, !tbaa !8
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [50050 x i8], ptr @instructions, i64 0, i64 %106
  %108 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %107)
  br label %109

109:                                              ; preds = %104
  %110 = load i32, ptr %9, align 4, !tbaa !8
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %9, align 4, !tbaa !8
  br label %99, !llvm.loop !16

112:                                              ; preds = %103
  %113 = load i32, ptr %2, align 4, !tbaa !8
  %114 = load i32, ptr %3, align 4, !tbaa !8
  %115 = load i32, ptr %4, align 4, !tbaa !8
  %116 = call noundef i32 @_Z4walkiiii(i32 noundef 0, i32 noundef %113, i32 noundef %114, i32 noundef %115)
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %116)
  %118 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %117, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  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
  br label %10, !llvm.loop !17

119:                                              ; preds = %30
  ret i32 0
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264)) #0 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) #3

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { 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 #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!10, !10, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}


; 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_istream" = type { ptr, i64, %"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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@R = external dso_local global i32, align 4
@C = external dso_local global i32, align 4
@I = external dso_local global i32, align 4
@grid = external dso_local global [110 x [110 x i8]], align 16
@instructions = external dso_local global [50050 x i8], align 16
@orientations = external dso_local local_unnamed_addr global [4 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4walkiiii(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 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @R)
  %2 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) @C)
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) @I)
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr i8, ptr %4, i64 -24
  %6 = load i64, ptr %5, align 8
  %7 = getelementptr inbounds i8, ptr %3, i64 %6
  %8 = tail call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %7)
  br i1 %8, label %.lr.ph71, label %.critedge

.lr.ph71:                                         ; preds = %0, %._crit_edge67
  %.03269 = phi i32 [ %.133.lcssa, %._crit_edge67 ], [ undef, %0 ]
  %.03668 = phi i32 [ %.137.lcssa, %._crit_edge67 ], [ undef, %0 ]
  %9 = load i32, ptr @R, align 4, !tbaa !8
  %10 = icmp ne i32 %9, 0
  %11 = load i32, ptr @C, align 4
  %12 = icmp ne i32 %11, 0
  %or.cond = select i1 %10, i1 true, i1 %12
  %13 = load i32, ptr @I, align 4
  %14 = icmp ne i32 %13, 0
  %or.cond5 = select i1 %or.cond, i1 true, i1 %14
  br i1 %or.cond5, label %.critedge3.preheader, label %.critedge

.critedge3.preheader:                             ; preds = %.lr.ph71
  %15 = icmp sgt i32 %9, 0
  %16 = icmp sgt i32 %11, 0
  %or.cond89 = select i1 %15, i1 %16, i1 false
  br i1 %or.cond89, label %.preheader, label %.preheader41

.preheader41.loopexit:                            ; preds = %.critedge3
  %.pre83 = load i32, ptr @I, align 4, !tbaa !8
  br label %.preheader41

.preheader41:                                     ; preds = %.preheader41.loopexit, %.critedge3.preheader
  %17 = phi i32 [ %13, %.critedge3.preheader ], [ %.pre83, %.preheader41.loopexit ]
  %.137.lcssa = phi i32 [ %.03668, %.critedge3.preheader ], [ %.238.lcssa, %.preheader41.loopexit ]
  %.133.lcssa = phi i32 [ %.03269, %.critedge3.preheader ], [ %.234.lcssa, %.preheader41.loopexit ]
  %.031.lcssa = phi i32 [ -1, %.critedge3.preheader ], [ %.1.lcssa, %.preheader41.loopexit ]
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph66, label %._crit_edge67

.preheader:                                       ; preds = %.critedge3.preheader, %.critedge3
  %19 = phi i32 [ %23, %.critedge3 ], [ %9, %.critedge3.preheader ]
  %20 = phi i32 [ %24, %.critedge3 ], [ %11, %.critedge3.preheader ]
  %indvars.iv77 = phi i64 [ %indvars.iv.next78, %.critedge3 ], [ 0, %.critedge3.preheader ]
  %.03158 = phi i32 [ %.1.lcssa, %.critedge3 ], [ -1, %.critedge3.preheader ]
  %.13357 = phi i32 [ %.234.lcssa, %.critedge3 ], [ %.03269, %.critedge3.preheader ]
  %.13756 = phi i32 [ %.238.lcssa, %.critedge3 ], [ %.03668, %.critedge3.preheader ]
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph51, label %.critedge3

.lr.ph51:                                         ; preds = %.preheader
  %22 = trunc nuw nsw i64 %indvars.iv77 to i32
  br label %27

.critedge3.loopexit:                              ; preds = %._crit_edge
  %.pre = load i32, ptr @R, align 4, !tbaa !8
  br label %.critedge3

.critedge3:                                       ; preds = %.critedge3.loopexit, %.preheader
  %23 = phi i32 [ %19, %.preheader ], [ %.pre, %.critedge3.loopexit ]
  %24 = phi i32 [ %20, %.preheader ], [ %34, %.critedge3.loopexit ]
  %.238.lcssa = phi i32 [ %.13756, %.preheader ], [ %.339.lcssa, %.critedge3.loopexit ]
  %.234.lcssa = phi i32 [ %.13357, %.preheader ], [ %.335.lcssa, %.critedge3.loopexit ]
  %.1.lcssa = phi i32 [ %.03158, %.preheader ], [ %.2.lcssa, %.critedge3.loopexit ]
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %25 = sext i32 %23 to i64
  %26 = icmp slt i64 %indvars.iv.next78, %25
  br i1 %26, label %.preheader, label %.preheader41.loopexit, !llvm.loop !11

27:                                               ; preds = %.lr.ph51, %._crit_edge
  %indvars.iv74 = phi i64 [ 0, %.lr.ph51 ], [ %indvars.iv.next75, %._crit_edge ]
  %.149 = phi i32 [ %.03158, %.lr.ph51 ], [ %.2.lcssa, %._crit_edge ]
  %.23448 = phi i32 [ %.13357, %.lr.ph51 ], [ %.335.lcssa, %._crit_edge ]
  %.23847 = phi i32 [ %.13756, %.lr.ph51 ], [ %.339.lcssa, %._crit_edge ]
  %28 = getelementptr inbounds [110 x [110 x i8]], ptr @grid, i64 0, i64 %indvars.iv77, i64 %indvars.iv74
  %29 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %28)
  %30 = icmp eq i32 %.149, -1
  br i1 %30, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %27
  %.promoted = load i8, ptr %28, align 1, !tbaa !14
  %31 = trunc nuw nsw i64 %indvars.iv74 to i32
  %32 = load i8, ptr @orientations, align 1, !tbaa !14
  %33 = icmp eq i8 %.promoted, %32
  br i1 %33, label %.thread, label %37

._crit_edge:                                      ; preds = %43, %.thread, %27
  %.339.lcssa = phi i32 [ %.23847, %27 ], [ %22, %.thread ], [ %.23847, %43 ]
  %.335.lcssa = phi i32 [ %.23448, %27 ], [ %31, %.thread ], [ %.23448, %43 ]
  %.2.lcssa = phi i32 [ %.149, %27 ], [ %indvars.iv.lcssa, %.thread ], [ -1, %43 ]
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %34 = load i32, ptr @C, align 4, !tbaa !8
  %35 = sext i32 %34 to i64
  %36 = icmp slt i64 %indvars.iv.next75, %35
  br i1 %36, label %27, label %.critedge3.loopexit, !llvm.loop !15

.thread:                                          ; preds = %43, %40, %37, %.lr.ph
  %indvars.iv.lcssa = phi i32 [ 0, %.lr.ph ], [ 1, %37 ], [ 2, %40 ], [ 3, %43 ]
  store i8 46, ptr %28, align 1, !tbaa !14
  br label %._crit_edge

37:                                               ; preds = %.lr.ph
  %38 = load i8, ptr getelementptr inbounds (i8, ptr @orientations, i64 1), align 1, !tbaa !14
  %39 = icmp eq i8 %.promoted, %38
  br i1 %39, label %.thread, label %40

40:                                               ; preds = %37
  %41 = load i8, ptr getelementptr inbounds (i8, ptr @orientations, i64 2), align 1, !tbaa !14
  %42 = icmp eq i8 %.promoted, %41
  br i1 %42, label %.thread, label %43

43:                                               ; preds = %40
  %44 = load i8, ptr getelementptr inbounds (i8, ptr @orientations, i64 3), align 1, !tbaa !14
  %45 = icmp eq i8 %.promoted, %44
  br i1 %45, label %.thread, label %._crit_edge

._crit_edge67:                                    ; preds = %.lr.ph66, %.preheader41
  %46 = tail call noundef i32 @_Z4walkiiii(i32 noundef 0, i32 noundef %.137.lcssa, i32 noundef %.133.lcssa, i32 noundef %.031.lcssa)
  %47 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %46)
  %48 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %47, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %49 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @R)
  %50 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %49, ptr noundef nonnull align 4 dereferenceable(4) @C)
  %51 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %50, ptr noundef nonnull align 4 dereferenceable(4) @I)
  %52 = load ptr, ptr %51, align 8, !tbaa !5
  %53 = getelementptr i8, ptr %52, i64 -24
  %54 = load i64, ptr %53, align 8
  %55 = getelementptr inbounds i8, ptr %51, i64 %54
  %56 = tail call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %55)
  br i1 %56, label %.lr.ph71, label %.critedge, !llvm.loop !16

.lr.ph66:                                         ; preds = %.preheader41, %.lr.ph66
  %indvars.iv80 = phi i64 [ %indvars.iv.next81, %.lr.ph66 ], [ 0, %.preheader41 ]
  %57 = getelementptr inbounds [50050 x i8], ptr @instructions, i64 0, i64 %indvars.iv80
  %58 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %57)
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %59 = load i32, ptr @I, align 4, !tbaa !8
  %60 = sext i32 %59 to i64
  %61 = icmp slt i64 %indvars.iv.next81, %60
  br i1 %61, label %.lr.ph66, label %._crit_edge67, !llvm.loop !17

.critedge:                                        ; preds = %._crit_edge67, %.lr.ph71, %0
  ret i32 0
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264)) local_unnamed_addr #0 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) 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 #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #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 = { "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" }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12, !13}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.unswitch.partial.disable"}
!14 = !{!10, !10, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass