; LLVM IR from eyangch/competitive-programming :: USACOtraining/4.1 (nuggets)

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

@N = external dso_local global i32, align 4
@a = external dso_local global [10 x i32], align 16
@pos = external dso_local global [257 x i8], align 16
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %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 i8, align 1
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %11 = load ptr, ptr @stdin, align 8, !tbaa !5
  %12 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %11)
  %13 = load ptr, ptr @stdout, align 8, !tbaa !5
  %14 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %13)
  %15 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %16 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !9
  %17 = getelementptr i8, ptr %16, i64 -24
  %18 = load i64, ptr %17, align 8
  %19 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %18
  %20 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %19, ptr noundef null)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !11
  br label %22

22:                                               ; preds = %32, %0
  %23 = load i32, ptr %2, align 4, !tbaa !11
  %24 = load i32, ptr @N, align 4, !tbaa !11
  %25 = icmp slt i32 %23, %24
  br i1 %25, label %27, label %26

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

27:                                               ; preds = %22
  %28 = load i32, ptr %2, align 4, !tbaa !11
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %29
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %30)
  br label %32

32:                                               ; preds = %27
  %33 = load i32, ptr %2, align 4, !tbaa !11
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %2, align 4, !tbaa !11
  br label %22, !llvm.loop !13

35:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !11
  br label %36

36:                                               ; preds = %51, %35
  %37 = load i32, ptr %3, align 4, !tbaa !11
  %38 = load i32, ptr @N, align 4, !tbaa !11
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  store i32 5, ptr %4, align 4
  br label %54

41:                                               ; preds = %36
  %42 = load i32, ptr %3, align 4, !tbaa !11
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !11
  %46 = icmp eq i32 %45, 1
  br i1 %46, label %47, label %50

47:                                               ; preds = %41
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef 0)
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %48, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %54

50:                                               ; preds = %41
  br label %51

51:                                               ; preds = %50
  %52 = load i32, ptr %3, align 4, !tbaa !11
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %3, align 4, !tbaa !11
  br label %36, !llvm.loop !15

54:                                               ; preds = %47, %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  %55 = load i32, ptr %4, align 4
  switch i32 %55, label %149 [
    i32 5, label %56
    i32 1, label %147
  ]

56:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 2, ptr %5, align 4, !tbaa !11
  br label %57

57:                                               ; preds = %90, %56
  %58 = load i32, ptr %5, align 4, !tbaa !11
  %59 = icmp sle i32 %58, 256
  br i1 %59, label %61, label %60

60:                                               ; preds = %57
  store i32 8, ptr %4, align 4
  br label %93

61:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #6
  store i8 1, ptr %6, align 1, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !11
  br label %62

62:                                               ; preds = %76, %61
  %63 = load i32, ptr %7, align 4, !tbaa !11
  %64 = icmp slt i32 %63, 10
  br i1 %64, label %66, label %65

65:                                               ; preds = %62
  store i32 11, ptr %4, align 4
  br label %79

66:                                               ; preds = %62
  %67 = load i32, ptr %7, align 4, !tbaa !11
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !11
  %71 = load i32, ptr %5, align 4, !tbaa !11
  %72 = srem i32 %70, %71
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %74, label %75

74:                                               ; preds = %66
  store i8 0, ptr %6, align 1, !tbaa !16
  store i32 11, ptr %4, align 4
  br label %79

75:                                               ; preds = %66
  br label %76

76:                                               ; preds = %75
  %77 = load i32, ptr %7, align 4, !tbaa !11
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %7, align 4, !tbaa !11
  br label %62, !llvm.loop !18

79:                                               ; preds = %74, %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %80

80:                                               ; preds = %79
  %81 = load i8, ptr %6, align 1, !tbaa !16, !range !19, !noundef !20
  %82 = trunc i8 %81 to i1
  br i1 %82, label %83, label %86

83:                                               ; preds = %80
  %84 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef 0)
  %85 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %84, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %87

86:                                               ; preds = %80
  store i32 0, ptr %4, align 4
  br label %87

87:                                               ; preds = %86, %83
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #6
  %88 = load i32, ptr %4, align 4
  switch i32 %88, label %93 [
    i32 0, label %89
  ]

89:                                               ; preds = %87
  br label %90

90:                                               ; preds = %89
  %91 = load i32, ptr %5, align 4, !tbaa !11
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %5, align 4, !tbaa !11
  br label %57, !llvm.loop !21

93:                                               ; preds = %87, %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  %94 = load i32, ptr %4, align 4
  switch i32 %94, label %149 [
    i32 8, label %95
    i32 1, label %147
  ]

95:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !11
  store i8 1, ptr @pos, align 16, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !11
  br label %96

96:                                               ; preds = %139, %95
  br i1 true, label %98, label %97

97:                                               ; preds = %96
  store i32 14, ptr %4, align 4
  br label %142

98:                                               ; preds = %96
  %99 = load i32, ptr %9, align 4, !tbaa !11
  %100 = load i32, ptr %8, align 4, !tbaa !11
  %101 = sub nsw i32 %99, %100
  %102 = icmp sgt i32 %101, 257
  br i1 %102, label %103, label %104

103:                                              ; preds = %98
  store i32 14, ptr %4, align 4
  br label %142

104:                                              ; preds = %98
  %105 = load i32, ptr %9, align 4, !tbaa !11
  %106 = srem i32 %105, 257
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [257 x i8], ptr @pos, i64 0, i64 %107
  %109 = load i8, ptr %108, align 1, !tbaa !16, !range !19, !noundef !20
  %110 = trunc i8 %109 to i1
  br i1 %110, label %111, label %136

111:                                              ; preds = %104
  %112 = load i32, ptr %9, align 4, !tbaa !11
  %113 = srem i32 %112, 257
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [257 x i8], ptr @pos, i64 0, i64 %114
  store i8 0, ptr %115, align 1, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !11
  br label %116

116:                                              ; preds = %132, %111
  %117 = load i32, ptr %10, align 4, !tbaa !11
  %118 = load i32, ptr @N, align 4, !tbaa !11
  %119 = icmp slt i32 %117, %118
  br i1 %119, label %121, label %120

120:                                              ; preds = %116
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %135

121:                                              ; preds = %116
  %122 = load i32, ptr %9, align 4, !tbaa !11
  %123 = srem i32 %122, 257
  %124 = load i32, ptr %10, align 4, !tbaa !11
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !11
  %128 = add nsw i32 %123, %127
  %129 = srem i32 %128, 257
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [257 x i8], ptr @pos, i64 0, i64 %130
  store i8 1, ptr %131, align 1, !tbaa !16
  br label %132

132:                                              ; preds = %121
  %133 = load i32, ptr %10, align 4, !tbaa !11
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %10, align 4, !tbaa !11
  br label %116, !llvm.loop !22

135:                                              ; preds = %120
  br label %138

136:                                              ; preds = %104
  %137 = load i32, ptr %9, align 4, !tbaa !11
  store i32 %137, ptr %8, align 4, !tbaa !11
  br label %138

138:                                              ; preds = %136, %135
  br label %139

139:                                              ; preds = %138
  %140 = load i32, ptr %9, align 4, !tbaa !11
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %9, align 4, !tbaa !11
  br label %96, !llvm.loop !23

142:                                              ; preds = %103, %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %8, align 4, !tbaa !11
  %145 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %144)
  %146 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %145, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %147

147:                                              ; preds = %143, %93, %54
  %148 = load i32, ptr %1, align 4
  ret i32 %148

149:                                              ; preds = %93, %54
  unreachable
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4 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)) #5

attributes #0 = { 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 #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = { 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 #6 = { nounwind }

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

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


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

@N = external dso_local global i32, align 4
@a = external dso_local global [10 x i32], align 16
@pos = external dso_local local_unnamed_addr global [257 x i8], align 16
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = load ptr, ptr @stdin, align 8, !tbaa !5
  %2 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %1)
  %3 = load ptr, ptr @stdout, align 8, !tbaa !5
  %4 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %3)
  %5 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %6 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !9
  %7 = getelementptr i8, ptr %6, i64 -24
  %8 = load i64, ptr %7, align 8
  %9 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %8
  %10 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %9, ptr noundef null)
  %11 = 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) @N)
  %12 = load i32, ptr @N, align 4
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph, label %.preheader53

.preheader53:                                     ; preds = %.lr.ph, %0
  %14 = phi i32 [ %12, %0 ], [ %18, %.lr.ph ]
  %.fr65 = freeze i32 %14
  %15 = icmp sgt i32 %.fr65, 0
  br i1 %15, label %.lr.ph56.preheader, label %.preheader52

.lr.ph56.preheader:                               ; preds = %.preheader53
  %wide.trip.count = zext nneg i32 %.fr65 to i64
  br label %.lr.ph56

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %16 = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %indvars.iv
  %17 = 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) %16)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %18 = load i32, ptr @N, align 4
  %19 = sext i32 %18 to i64
  %20 = icmp slt i64 %indvars.iv.next, %19
  br i1 %20, label %.lr.ph, label %.preheader53, !llvm.loop !11

21:                                               ; preds = %.lr.ph56
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next70, %wide.trip.count
  br i1 %exitcond.not, label %.preheader52, label %.lr.ph56, !llvm.loop !13

.preheader52:                                     ; preds = %21, %.preheader53
  %.pre = load i32, ptr @a, align 16, !tbaa !14
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4
  %23 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 8), align 8
  %24 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 12), align 4
  %25 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 16), align 16
  %26 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 20), align 4
  %27 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 24), align 8
  %28 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 28), align 4
  %29 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 32), align 16
  %30 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 36), align 4
  br label %.preheader

.lr.ph56:                                         ; preds = %.lr.ph56.preheader, %21
  %indvars.iv69 = phi i64 [ 0, %.lr.ph56.preheader ], [ %indvars.iv.next70, %21 ]
  %31 = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %indvars.iv69
  %32 = load i32, ptr %31, align 4, !tbaa !14
  %33 = icmp eq i32 %32, 1
  br i1 %33, label %.thread, label %21

.preheader:                                       ; preds = %.preheader52, %.critedge41
  %.03258 = phi i32 [ 2, %.preheader52 ], [ %53, %.critedge41 ]
  %34 = srem i32 %.pre, %.03258
  %.not = icmp eq i32 %34, 0
  br i1 %.not, label %35, label %.critedge41

35:                                               ; preds = %.preheader
  %36 = srem i32 %22, %.03258
  %.not.1 = icmp eq i32 %36, 0
  br i1 %.not.1, label %37, label %.critedge41

37:                                               ; preds = %35
  %38 = srem i32 %23, %.03258
  %.not.2 = icmp eq i32 %38, 0
  br i1 %.not.2, label %39, label %.critedge41

39:                                               ; preds = %37
  %40 = srem i32 %24, %.03258
  %.not.3 = icmp eq i32 %40, 0
  br i1 %.not.3, label %41, label %.critedge41

41:                                               ; preds = %39
  %42 = srem i32 %25, %.03258
  %.not.4 = icmp eq i32 %42, 0
  br i1 %.not.4, label %43, label %.critedge41

43:                                               ; preds = %41
  %44 = srem i32 %26, %.03258
  %.not.5 = icmp eq i32 %44, 0
  br i1 %.not.5, label %45, label %.critedge41

45:                                               ; preds = %43
  %46 = srem i32 %27, %.03258
  %.not.6 = icmp eq i32 %46, 0
  br i1 %.not.6, label %47, label %.critedge41

47:                                               ; preds = %45
  %48 = srem i32 %28, %.03258
  %.not.7 = icmp eq i32 %48, 0
  br i1 %.not.7, label %49, label %.critedge41

49:                                               ; preds = %47
  %50 = srem i32 %29, %.03258
  %.not.8 = icmp eq i32 %50, 0
  br i1 %.not.8, label %51, label %.critedge41

51:                                               ; preds = %49
  %52 = srem i32 %30, %.03258
  %.not.9 = icmp eq i32 %52, 0
  br i1 %.not.9, label %.thread, label %.critedge41

.critedge41:                                      ; preds = %51, %49, %47, %45, %43, %41, %39, %37, %35, %.preheader
  %53 = add nuw nsw i32 %.03258, 1
  %exitcond76.not = icmp eq i32 %53, 257
  br i1 %exitcond76.not, label %54, label %.preheader, !llvm.loop !16

54:                                               ; preds = %.critedge41
  store i8 1, ptr @pos, align 16, !tbaa !17
  %55 = icmp sgt i32 %.fr65, 0
  br i1 %55, label %.split.us.preheader, label %.split

.split.us.preheader:                              ; preds = %54
  %wide.trip.count80 = zext nneg i32 %.fr65 to i64
  %xtraiter = and i64 %wide.trip.count80, 1
  %56 = icmp eq i32 %.fr65, 1
  %unroll_iter = and i64 %wide.trip.count80, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.split.us

.split.us:                                        ; preds = %.split.us.preheader, %..loopexit_crit_edge.us
  %.02862.us = phi i32 [ %68, %..loopexit_crit_edge.us ], [ 0, %.split.us.preheader ]
  %.02961.us = phi i32 [ %.1.us, %..loopexit_crit_edge.us ], [ 0, %.split.us.preheader ]
  %57 = urem i32 %.02862.us, 257
  %58 = zext nneg i32 %57 to i64
  %59 = getelementptr inbounds [257 x i8], ptr @pos, i64 0, i64 %58
  %60 = load i8, ptr %59, align 1, !tbaa !17, !range !19, !noundef !20
  %61 = trunc nuw i8 %60 to i1
  br i1 %61, label %.lr.ph60.us, label %..loopexit_crit_edge.us

.lr.ph60.us:                                      ; preds = %.split.us
  store i8 0, ptr %59, align 1, !tbaa !17
  br i1 %56, label %..loopexit_crit_edge.us.loopexit.unr-lcssa, label %.lr.ph60.us.new

..loopexit_crit_edge.us.loopexit.unr-lcssa:       ; preds = %.lr.ph60.us.new, %.lr.ph60.us
  %indvars.iv77.unr = phi i64 [ 0, %.lr.ph60.us ], [ %indvars.iv.next78.1, %.lr.ph60.us.new ]
  br i1 %lcmp.mod.not, label %..loopexit_crit_edge.us, label %..loopexit_crit_edge.us.loopexit.epilog-lcssa

..loopexit_crit_edge.us.loopexit.epilog-lcssa:    ; preds = %..loopexit_crit_edge.us.loopexit.unr-lcssa
  %62 = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %indvars.iv77.unr
  %63 = load i32, ptr %62, align 4, !tbaa !14
  %64 = add nsw i32 %63, %57
  %65 = srem i32 %64, 257
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [257 x i8], ptr @pos, i64 0, i64 %66
  store i8 1, ptr %67, align 1, !tbaa !17
  br label %..loopexit_crit_edge.us

..loopexit_crit_edge.us:                          ; preds = %..loopexit_crit_edge.us.loopexit.epilog-lcssa, %..loopexit_crit_edge.us.loopexit.unr-lcssa, %.split.us
  %.1.us = phi i32 [ %.02862.us, %.split.us ], [ %.02961.us, %..loopexit_crit_edge.us.loopexit.unr-lcssa ], [ %.02961.us, %..loopexit_crit_edge.us.loopexit.epilog-lcssa ]
  %68 = add nuw nsw i32 %.02862.us, 1
  %69 = sub nsw i32 %68, %.1.us
  %70 = icmp sgt i32 %69, 257
  br i1 %70, label %.thread, label %.split.us, !llvm.loop !21

.lr.ph60.us.new:                                  ; preds = %.lr.ph60.us, %.lr.ph60.us.new
  %indvars.iv77 = phi i64 [ %indvars.iv.next78.1, %.lr.ph60.us.new ], [ 0, %.lr.ph60.us ]
  %niter = phi i64 [ %niter.next.1, %.lr.ph60.us.new ], [ 0, %.lr.ph60.us ]
  %71 = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %indvars.iv77
  %72 = load i32, ptr %71, align 8, !tbaa !14
  %73 = add nsw i32 %72, %57
  %74 = srem i32 %73, 257
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [257 x i8], ptr @pos, i64 0, i64 %75
  store i8 1, ptr %76, align 1, !tbaa !17
  %indvars.iv.next78 = or disjoint i64 %indvars.iv77, 1
  %77 = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %indvars.iv.next78
  %78 = load i32, ptr %77, align 4, !tbaa !14
  %79 = add nsw i32 %78, %57
  %80 = srem i32 %79, 257
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [257 x i8], ptr @pos, i64 0, i64 %81
  store i8 1, ptr %82, align 1, !tbaa !17
  %indvars.iv.next78.1 = add nuw nsw i64 %indvars.iv77, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %..loopexit_crit_edge.us.loopexit.unr-lcssa, label %.lr.ph60.us.new, !llvm.loop !22

.split:                                           ; preds = %54, %88
  %.02862 = phi i32 [ %89, %88 ], [ 0, %54 ]
  %.02961 = phi i32 [ %.1, %88 ], [ 0, %54 ]
  %83 = urem i32 %.02862, 257
  %84 = zext nneg i32 %83 to i64
  %85 = getelementptr inbounds [257 x i8], ptr @pos, i64 0, i64 %84
  %86 = load i8, ptr %85, align 1, !tbaa !17, !range !19, !noundef !20
  %87 = trunc nuw i8 %86 to i1
  br i1 %87, label %.loopexit, label %88

.loopexit:                                        ; preds = %.split
  store i8 0, ptr %85, align 1, !tbaa !17
  br label %88

88:                                               ; preds = %.loopexit, %.split
  %.1 = phi i32 [ %.02862, %.split ], [ %.02961, %.loopexit ]
  %89 = add nuw nsw i32 %.02862, 1
  %90 = sub nsw i32 %89, %.1
  %91 = icmp sgt i32 %90, 257
  br i1 %91, label %.thread, label %.split, !llvm.loop !21

.thread:                                          ; preds = %.lr.ph56, %51, %88, %..loopexit_crit_edge.us
  %.sink83 = phi i32 [ %.1.us, %..loopexit_crit_edge.us ], [ %.1, %88 ], [ 0, %51 ], [ 0, %.lr.ph56 ]
  %92 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.sink83)
  %93 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %92, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #1

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

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

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

; 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 #3 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 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 #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 = { 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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = distinct !{!16, !12}
!17 = !{!18, !18, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}


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