; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/World Cup 2016/World Cup/Problem D (D)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@cnt = external dso_local global i32, align 4
@p = external dso_local global [30 x i32], align 16
@s = external dso_local global [20 x [20 x i8]], align 16
@g = external dso_local global [20 x [20 x i32]], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2goiii(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
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  store i32 1, ptr @p, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %25, %0
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = icmp slt i32 %12, 30
  br i1 %13, label %15, label %14

14:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %28

15:                                               ; preds = %11
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = sub nsw i32 %16, 1
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [30 x i32], ptr @p, i64 0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = mul nsw i32 %20, 2
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [30 x i32], ptr @p, i64 0, i64 %23
  store i32 %21, ptr %24, align 4, !tbaa !5
  br label %25

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

28:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %66, %28
  %30 = load i32, ptr %3, align 4, !tbaa !5
  %31 = load i32, ptr @n, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %34, label %33

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

34:                                               ; preds = %29
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [20 x [20 x i8]], ptr @s, i64 0, i64 %36
  %38 = getelementptr inbounds [20 x i8], ptr %37, i64 0, i64 0
  %39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %38)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %62, %34
  %41 = load i32, ptr %5, align 4, !tbaa !5
  %42 = load i32, ptr @m, align 4, !tbaa !5
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %65

45:                                               ; preds = %40
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [20 x [20 x i8]], ptr @s, i64 0, i64 %47
  %49 = load i32, ptr %5, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [20 x i8], ptr %48, i64 0, i64 %50
  %52 = load i8, ptr %51, align 1, !tbaa !11
  %53 = sext i8 %52 to i32
  %54 = icmp eq i32 %53, 46
  %55 = zext i1 %54 to i32
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [20 x [20 x i32]], ptr @g, i64 0, i64 %57
  %59 = load i32, ptr %5, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [20 x i32], ptr %58, i64 0, i64 %60
  store i32 %55, ptr %61, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %45
  %63 = load i32, ptr %5, align 4, !tbaa !5
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %5, align 4, !tbaa !5
  br label %40, !llvm.loop !12

65:                                               ; preds = %44
  br label %66

66:                                               ; preds = %65
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %3, align 4, !tbaa !5
  br label %29, !llvm.loop !13

69:                                               ; preds = %33
  %70 = load i32, ptr @n, align 4, !tbaa !5
  %71 = icmp eq i32 %70, 1
  br i1 %71, label %72, label %95

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

73:                                               ; preds = %88, %72
  %74 = load i32, ptr %6, align 4, !tbaa !5
  %75 = load i32, ptr @m, align 4, !tbaa !5
  %76 = icmp slt i32 %74, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %73
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %91

78:                                               ; preds = %73
  %79 = load i32, ptr %6, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [20 x i32], ptr @g, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = icmp ne i32 %82, 0
  br i1 %83, label %84, label %87

84:                                               ; preds = %78
  %85 = load i32, ptr @cnt, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr @cnt, align 4, !tbaa !5
  br label %87

87:                                               ; preds = %84, %78
  br label %88

88:                                               ; preds = %87
  %89 = load i32, ptr %6, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %6, align 4, !tbaa !5
  br label %73, !llvm.loop !14

91:                                               ; preds = %77
  %92 = load i32, ptr @cnt, align 4, !tbaa !5
  %93 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %92)
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %93, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  br label %128

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

96:                                               ; preds = %121, %95
  %97 = load i32, ptr %7, align 4, !tbaa !5
  %98 = load i32, ptr @m, align 4, !tbaa !5
  %99 = icmp slt i32 %97, %98
  br i1 %99, label %101, label %100

100:                                              ; preds = %96
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %124

101:                                              ; preds = %96
  %102 = load i32, ptr %7, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [20 x i32], ptr @g, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %120

107:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  %108 = load i32, ptr @n, align 4, !tbaa !5
  %109 = load i32, ptr %7, align 4, !tbaa !5
  %110 = sub nsw i32 %108, %109
  %111 = shl i32 1, %110
  %112 = load i32, ptr %8, align 4, !tbaa !5
  %113 = or i32 %112, %111
  store i32 %113, ptr %8, align 4, !tbaa !5
  %114 = load i32, ptr %7, align 4, !tbaa !5
  %115 = shl i32 1, %114
  %116 = load i32, ptr %9, align 4, !tbaa !5
  %117 = or i32 %116, %115
  store i32 %117, ptr %9, align 4, !tbaa !5
  %118 = load i32, ptr %8, align 4, !tbaa !5
  %119 = load i32, ptr %9, align 4, !tbaa !5
  call void @_Z2goiii(i32 noundef 1, i32 noundef %118, i32 noundef %119)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %120

120:                                              ; preds = %107, %101
  br label %121

121:                                              ; preds = %120
  %122 = load i32, ptr %7, align 4, !tbaa !5
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %7, align 4, !tbaa !5
  br label %96, !llvm.loop !15

124:                                              ; preds = %100
  %125 = load i32, ptr @cnt, align 4, !tbaa !5
  %126 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %125)
  %127 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %126, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  br label %128

128:                                              ; preds = %124, %91
  %129 = load i32, ptr %1, align 4
  ret i32 %129
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@cnt = external dso_local local_unnamed_addr global i32, align 4
@p = external dso_local local_unnamed_addr global [30 x i32], align 16
@s = external dso_local global [20 x [20 x i8]], align 16
@g = external dso_local local_unnamed_addr global [20 x [20 x i32]], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2goiii(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 {
.preheader33:
  %0 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  store <4 x i32> <i32 1, i32 2, i32 4, i32 8>, ptr @p, align 16, !tbaa !5
  store <4 x i32> <i32 16, i32 32, i32 64, i32 128>, ptr getelementptr inbounds (i8, ptr @p, i64 16), align 16, !tbaa !5
  store <4 x i32> <i32 256, i32 512, i32 1024, i32 2048>, ptr getelementptr inbounds (i8, ptr @p, i64 32), align 16, !tbaa !5
  store <4 x i32> <i32 4096, i32 8192, i32 16384, i32 32768>, ptr getelementptr inbounds (i8, ptr @p, i64 48), align 16, !tbaa !5
  store <4 x i32> <i32 65536, i32 131072, i32 262144, i32 524288>, ptr getelementptr inbounds (i8, ptr @p, i64 64), align 16, !tbaa !5
  store <4 x i32> <i32 1048576, i32 2097152, i32 4194304, i32 8388608>, ptr getelementptr inbounds (i8, ptr @p, i64 80), align 16, !tbaa !5
  store <4 x i32> <i32 16777216, i32 33554432, i32 67108864, i32 134217728>, ptr getelementptr inbounds (i8, ptr @p, i64 96), align 16, !tbaa !5
  store i32 268435456, ptr getelementptr inbounds (i8, ptr @p, i64 112), align 16, !tbaa !5
  store i32 536870912, ptr getelementptr inbounds (i8, ptr @p, i64 116), align 4, !tbaa !5
  %1 = load i32, ptr @n, align 4, !tbaa !5
  %2 = icmp sgt i32 %1, 0
  br i1 %2, label %.lr.ph37, label %.preheader32

._crit_edge38:                                    ; preds = %._crit_edge
  %3 = icmp eq i32 %22, 1
  br i1 %3, label %.preheader, label %.preheader32

.preheader32:                                     ; preds = %.preheader33, %._crit_edge38
  %4 = load i32, ptr @m, align 4, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph40, label %._crit_edge41

.preheader:                                       ; preds = %._crit_edge38
  %6 = load i32, ptr @m, align 4, !tbaa !5
  %cnt.promoted = load i32, ptr @cnt, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph43.preheader, label %._crit_edge44

.lr.ph43.preheader:                               ; preds = %.preheader
  %wide.trip.count57 = zext nneg i32 %6 to i64
  %xtraiter = and i64 %wide.trip.count57, 1
  %8 = icmp eq i32 %6, 1
  br i1 %8, label %._crit_edge44.loopexit.unr-lcssa, label %.lr.ph43.preheader.new

.lr.ph43.preheader.new:                           ; preds = %.lr.ph43.preheader
  %unroll_iter = and i64 %wide.trip.count57, 2147483646
  br label %.lr.ph43

.lr.ph37:                                         ; preds = %.preheader33, %._crit_edge
  %indvars.iv48 = phi i64 [ %indvars.iv.next49, %._crit_edge ], [ 0, %.preheader33 ]
  %9 = getelementptr inbounds [20 x [20 x i8]], ptr @s, i64 0, i64 %indvars.iv48
  %10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %9)
  %11 = load i32, ptr @m, align 4, !tbaa !5
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.lr.ph37
  %wide.trip.count = zext nneg i32 %11 to i64
  %min.iters.check = icmp ult i32 %11, 8
  br i1 %min.iters.check, label %.lr.ph.preheader64, label %vector.ph

.lr.ph.preheader64:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %13 = getelementptr inbounds [20 x [20 x i8]], ptr @s, i64 0, i64 %indvars.iv48, i64 %index
  %14 = getelementptr inbounds i8, ptr %13, i64 4
  %wide.load = load <4 x i8>, ptr %13, align 4, !tbaa !9
  %wide.load63 = load <4 x i8>, ptr %14, align 4, !tbaa !9
  %15 = icmp eq <4 x i8> %wide.load, <i8 46, i8 46, i8 46, i8 46>
  %16 = icmp eq <4 x i8> %wide.load63, <i8 46, i8 46, i8 46, i8 46>
  %17 = zext <4 x i1> %15 to <4 x i32>
  %18 = zext <4 x i1> %16 to <4 x i32>
  %19 = getelementptr inbounds [20 x [20 x i32]], ptr @g, i64 0, i64 %indvars.iv48, i64 %index
  %20 = getelementptr inbounds i8, ptr %19, i64 16
  store <4 x i32> %17, ptr %19, align 16, !tbaa !5
  store <4 x i32> %18, ptr %20, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %21 = icmp eq i64 %index.next, %n.vec
  br i1 %21, label %middle.block, label %vector.body, !llvm.loop !10

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader64

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %.lr.ph37
  %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = icmp slt i64 %indvars.iv.next49, %23
  br i1 %24, label %.lr.ph37, label %._crit_edge38, !llvm.loop !14

.lr.ph:                                           ; preds = %.lr.ph.preheader64, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader64 ]
  %25 = getelementptr inbounds [20 x [20 x i8]], ptr @s, i64 0, i64 %indvars.iv48, i64 %indvars.iv
  %26 = load i8, ptr %25, align 1, !tbaa !9
  %27 = icmp eq i8 %26, 46
  %28 = zext i1 %27 to i32
  %29 = getelementptr inbounds [20 x [20 x i32]], ptr @g, i64 0, i64 %indvars.iv48, i64 %indvars.iv
  store i32 %28, ptr %29, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !15

.lr.ph43:                                         ; preds = %40, %.lr.ph43.preheader.new
  %indvars.iv54 = phi i64 [ 0, %.lr.ph43.preheader.new ], [ %indvars.iv.next55.1, %40 ]
  %30 = phi i32 [ %cnt.promoted, %.lr.ph43.preheader.new ], [ %41, %40 ]
  %niter = phi i64 [ 0, %.lr.ph43.preheader.new ], [ %niter.next.1, %40 ]
  %31 = getelementptr inbounds [20 x i32], ptr @g, i64 0, i64 %indvars.iv54
  %32 = load i32, ptr %31, align 8, !tbaa !5
  %.not31 = icmp eq i32 %32, 0
  br i1 %.not31, label %.lr.ph43.1, label %33

33:                                               ; preds = %.lr.ph43
  %34 = add nsw i32 %30, 1
  store i32 %34, ptr @cnt, align 4, !tbaa !5
  br label %.lr.ph43.1

.lr.ph43.1:                                       ; preds = %.lr.ph43, %33
  %35 = phi i32 [ %30, %.lr.ph43 ], [ %34, %33 ]
  %indvars.iv.next55 = or disjoint i64 %indvars.iv54, 1
  %36 = getelementptr inbounds [20 x i32], ptr @g, i64 0, i64 %indvars.iv.next55
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %.not31.1 = icmp eq i32 %37, 0
  br i1 %.not31.1, label %40, label %38

38:                                               ; preds = %.lr.ph43.1
  %39 = add nsw i32 %35, 1
  store i32 %39, ptr @cnt, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %38, %.lr.ph43.1
  %41 = phi i32 [ %35, %.lr.ph43.1 ], [ %39, %38 ]
  %indvars.iv.next55.1 = add nuw nsw i64 %indvars.iv54, 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 %._crit_edge44.loopexit.unr-lcssa, label %.lr.ph43, !llvm.loop !16

._crit_edge41:                                    ; preds = %52, %.preheader32
  %42 = load i32, ptr @cnt, align 4, !tbaa !5
  br label %._crit_edge44

.lr.ph40:                                         ; preds = %.preheader32, %52
  %43 = phi i32 [ %53, %52 ], [ %4, %.preheader32 ]
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %52 ], [ 0, %.preheader32 ]
  %44 = getelementptr inbounds [20 x i32], ptr @g, i64 0, i64 %indvars.iv51
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %.not = icmp eq i32 %45, 0
  br i1 %.not, label %52, label %46

46:                                               ; preds = %.lr.ph40
  %47 = load i32, ptr @n, align 4, !tbaa !5
  %48 = trunc nuw nsw i64 %indvars.iv51 to i32
  %49 = sub nsw i32 %47, %48
  %50 = shl nuw i32 1, %49
  %51 = shl nuw i32 1, %48
  tail call void @_Z2goiii(i32 noundef 1, i32 noundef %50, i32 noundef %51)
  %.pre = load i32, ptr @m, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %.lr.ph40, %46
  %53 = phi i32 [ %43, %.lr.ph40 ], [ %.pre, %46 ]
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %54 = sext i32 %53 to i64
  %55 = icmp slt i64 %indvars.iv.next52, %54
  br i1 %55, label %.lr.ph40, label %._crit_edge41, !llvm.loop !17

._crit_edge44.loopexit.unr-lcssa:                 ; preds = %40, %.lr.ph43.preheader
  %.lcssa.ph = phi i32 [ poison, %.lr.ph43.preheader ], [ %41, %40 ]
  %indvars.iv54.unr = phi i64 [ 0, %.lr.ph43.preheader ], [ %indvars.iv.next55.1, %40 ]
  %.unr = phi i32 [ %cnt.promoted, %.lr.ph43.preheader ], [ %41, %40 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge44, label %.lr.ph43.epil

.lr.ph43.epil:                                    ; preds = %._crit_edge44.loopexit.unr-lcssa
  %56 = getelementptr inbounds [20 x i32], ptr @g, i64 0, i64 %indvars.iv54.unr
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %.not31.epil = icmp eq i32 %57, 0
  br i1 %.not31.epil, label %._crit_edge44, label %58

58:                                               ; preds = %.lr.ph43.epil
  %59 = add nsw i32 %.unr, 1
  store i32 %59, ptr @cnt, align 4, !tbaa !5
  br label %._crit_edge44

._crit_edge44:                                    ; preds = %._crit_edge44.loopexit.unr-lcssa, %58, %.lr.ph43.epil, %.preheader, %._crit_edge41
  %.sink61 = phi i32 [ %42, %._crit_edge41 ], [ %cnt.promoted, %.preheader ], [ %.lcssa.ph, %._crit_edge44.loopexit.unr-lcssa ], [ %.unr, %.lr.ph43.epil ], [ %59, %58 ]
  %60 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.sink61)
  %61 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %60, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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: 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)) #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 = { 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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11, !13, !12}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass