; LLVM IR from ritikbanger/Hacktoberfest2022-DSA :: 24. Cryptography (Railfence_cipher)

; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #0

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9push_backEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z18decryption_fuctionNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8 %0, ptr noundef %1, i32 noundef %2) #3 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i1, align 1
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %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
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %24 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #4
  %25 = trunc i64 %24 to i32
  store i32 %25, ptr %7, align 4, !tbaa !9
  store i1 false, ptr %8, align 1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #4
  %26 = load i32, ptr %6, align 4, !tbaa !9
  %27 = zext i32 %26 to i64
  %28 = load i32, ptr %7, align 4, !tbaa !9
  %29 = zext i32 %28 to i64
  %30 = call ptr @llvm.stacksave.p0()
  store ptr %30, ptr %9, align 8
  %31 = mul nuw i64 %27, %29
  %32 = alloca i8, i64 %31, align 16
  store i64 %27, ptr %10, align 8
  store i64 %29, ptr %11, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %33

33:                                               ; preds = %56, %3
  %34 = load i32, ptr %12, align 4, !tbaa !9
  %35 = load i32, ptr %6, align 4, !tbaa !9
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  store i32 2, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %59

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

39:                                               ; preds = %52, %38
  %40 = load i32, ptr %14, align 4, !tbaa !9
  %41 = load i32, ptr %7, align 4, !tbaa !9
  %42 = icmp slt i32 %40, %41
  br i1 %42, label %44, label %43

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

44:                                               ; preds = %39
  %45 = load i32, ptr %12, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = mul nsw i64 %46, %29
  %48 = getelementptr inbounds i8, ptr %32, i64 %47
  %49 = load i32, ptr %14, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i8, ptr %48, i64 %50
  store i8 45, ptr %51, align 1, !tbaa !11
  br label %52

52:                                               ; preds = %44
  %53 = load i32, ptr %14, align 4, !tbaa !9
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %14, align 4, !tbaa !9
  br label %39, !llvm.loop !12

55:                                               ; preds = %43
  br label %56

56:                                               ; preds = %55
  %57 = load i32, ptr %12, align 4, !tbaa !9
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %12, align 4, !tbaa !9
  br label %33, !llvm.loop !14

59:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 0, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %93, %59
  %61 = load i32, ptr %17, align 4, !tbaa !9
  %62 = load i32, ptr %7, align 4, !tbaa !9
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %60
  store i32 8, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %96

65:                                               ; preds = %60
  %66 = load i32, ptr %15, align 4, !tbaa !9
  %67 = sext i32 %66 to i64
  %68 = mul nsw i64 %67, %29
  %69 = getelementptr inbounds i8, ptr %32, i64 %68
  %70 = load i32, ptr %17, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds i8, ptr %69, i64 %71
  store i8 48, ptr %72, align 1, !tbaa !11
  %73 = load i32, ptr %15, align 4, !tbaa !9
  %74 = load i32, ptr %6, align 4, !tbaa !9
  %75 = sub nsw i32 %74, 1
  %76 = icmp eq i32 %73, %75
  br i1 %76, label %77, label %78

77:                                               ; preds = %65
  store i32 1, ptr %16, align 4, !tbaa !9
  br label %83

78:                                               ; preds = %65
  %79 = load i32, ptr %15, align 4, !tbaa !9
  %80 = icmp eq i32 %79, 0
  br i1 %80, label %81, label %82

81:                                               ; preds = %78
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %81, %78
  br label %83

83:                                               ; preds = %82, %77
  %84 = load i32, ptr %16, align 4, !tbaa !9
  %85 = icmp eq i32 %84, 0
  br i1 %85, label %86, label %89

86:                                               ; preds = %83
  %87 = load i32, ptr %15, align 4, !tbaa !9
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %15, align 4, !tbaa !9
  br label %92

89:                                               ; preds = %83
  %90 = load i32, ptr %15, align 4, !tbaa !9
  %91 = add nsw i32 %90, -1
  store i32 %91, ptr %15, align 4, !tbaa !9
  br label %92

92:                                               ; preds = %89, %86
  br label %93

93:                                               ; preds = %92
  %94 = load i32, ptr %17, align 4, !tbaa !9
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %17, align 4, !tbaa !9
  br label %60, !llvm.loop !15

96:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  store i32 0, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %97

97:                                               ; preds = %143, %96
  %98 = load i32, ptr %19, align 4, !tbaa !9
  %99 = load i32, ptr %6, align 4, !tbaa !9
  %100 = icmp slt i32 %98, %99
  br i1 %100, label %102, label %101

101:                                              ; preds = %97
  store i32 11, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %146

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

103:                                              ; preds = %139, %102
  %104 = load i32, ptr %20, align 4, !tbaa !9
  %105 = load i32, ptr %7, align 4, !tbaa !9
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %103
  store i32 14, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %142

108:                                              ; preds = %103
  %109 = load i32, ptr %19, align 4, !tbaa !9
  %110 = sext i32 %109 to i64
  %111 = mul nsw i64 %110, %29
  %112 = getelementptr inbounds i8, ptr %32, i64 %111
  %113 = load i32, ptr %20, align 4, !tbaa !9
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds i8, ptr %112, i64 %114
  %116 = load i8, ptr %115, align 1, !tbaa !11
  %117 = sext i8 %116 to i32
  %118 = icmp eq i32 %117, 48
  br i1 %118, label %119, label %138

119:                                              ; preds = %108
  %120 = load i32, ptr %18, align 4, !tbaa !9
  %121 = sext i32 %120 to i64
  %122 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %121)
          to label %123 unwind label %134

123:                                              ; preds = %119
  %124 = load i8, ptr %122, align 1, !tbaa !11
  %125 = load i32, ptr %19, align 4, !tbaa !9
  %126 = sext i32 %125 to i64
  %127 = mul nsw i64 %126, %29
  %128 = getelementptr inbounds i8, ptr %32, i64 %127
  %129 = load i32, ptr %20, align 4, !tbaa !9
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds i8, ptr %128, i64 %130
  store i8 %124, ptr %131, align 1, !tbaa !11
  %132 = load i32, ptr %18, align 4, !tbaa !9
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %18, align 4, !tbaa !9
  br label %138

134:                                              ; preds = %119
  %135 = landingpad { ptr, i32 }
          cleanup
  %136 = extractvalue { ptr, i32 } %135, 0
  store ptr %136, ptr %21, align 8
  %137 = extractvalue { ptr, i32 } %135, 1
  store i32 %137, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %192

138:                                              ; preds = %123, %108
  br label %139

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

142:                                              ; preds = %107
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %19, align 4, !tbaa !9
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %19, align 4, !tbaa !9
  br label %97, !llvm.loop !17

146:                                              ; preds = %101
  store i32 0, ptr %16, align 4, !tbaa !9
  store i32 0, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #4
  store i32 0, ptr %23, align 4, !tbaa !9
  br label %147

147:                                              ; preds = %186, %146
  %148 = load i32, ptr %23, align 4, !tbaa !9
  %149 = load i32, ptr %7, align 4, !tbaa !9
  %150 = icmp slt i32 %148, %149
  br i1 %150, label %152, label %151

151:                                              ; preds = %147
  store i32 17, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  br label %189

152:                                              ; preds = %147
  %153 = load i32, ptr %15, align 4, !tbaa !9
  %154 = sext i32 %153 to i64
  %155 = mul nsw i64 %154, %29
  %156 = getelementptr inbounds i8, ptr %32, i64 %155
  %157 = load i32, ptr %23, align 4, !tbaa !9
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds i8, ptr %156, i64 %158
  %160 = load i8, ptr %159, align 1, !tbaa !11
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9push_backEc(ptr noundef nonnull align 8 dereferenceable(32) %0, i8 noundef signext %160)
          to label %161 unwind label %167

161:                                              ; preds = %152
  %162 = load i32, ptr %15, align 4, !tbaa !9
  %163 = load i32, ptr %6, align 4, !tbaa !9
  %164 = sub nsw i32 %163, 1
  %165 = icmp eq i32 %162, %164
  br i1 %165, label %166, label %171

166:                                              ; preds = %161
  store i32 1, ptr %16, align 4, !tbaa !9
  br label %176

167:                                              ; preds = %152
  %168 = landingpad { ptr, i32 }
          cleanup
  %169 = extractvalue { ptr, i32 } %168, 0
  store ptr %169, ptr %21, align 8
  %170 = extractvalue { ptr, i32 } %168, 1
  store i32 %170, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  br label %192

171:                                              ; preds = %161
  %172 = load i32, ptr %15, align 4, !tbaa !9
  %173 = icmp eq i32 %172, 0
  br i1 %173, label %174, label %175

174:                                              ; preds = %171
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %175

175:                                              ; preds = %174, %171
  br label %176

176:                                              ; preds = %175, %166
  %177 = load i32, ptr %16, align 4, !tbaa !9
  %178 = icmp eq i32 %177, 0
  br i1 %178, label %179, label %182

179:                                              ; preds = %176
  %180 = load i32, ptr %15, align 4, !tbaa !9
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %15, align 4, !tbaa !9
  br label %185

182:                                              ; preds = %176
  %183 = load i32, ptr %15, align 4, !tbaa !9
  %184 = add nsw i32 %183, -1
  store i32 %184, ptr %15, align 4, !tbaa !9
  br label %185

185:                                              ; preds = %182, %179
  br label %186

186:                                              ; preds = %185
  %187 = load i32, ptr %23, align 4, !tbaa !9
  %188 = add nsw i32 %187, 1
  store i32 %188, ptr %23, align 4, !tbaa !9
  br label %147, !llvm.loop !18

189:                                              ; preds = %151
  store i1 true, ptr %8, align 1
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  %190 = load ptr, ptr %9, align 8
  call void @llvm.stackrestore.p0(ptr %190)
  %191 = load i1, ptr %8, align 1
  br i1 %191, label %194, label %193

192:                                              ; preds = %167, %134
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %195

193:                                              ; preds = %189
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #4
  br label %194

194:                                              ; preds = %193, %189
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret void

195:                                              ; preds = %192
  %196 = load ptr, ptr %21, align 8
  %197 = load i32, ptr %22, align 4
  %198 = insertvalue { ptr, i32 } poison, ptr %196, 0
  %199 = insertvalue { ptr, i32 } %198, i32 %197, 1
  resume { ptr, i32 } %199
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn }
attributes #1 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!7, !7, 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}
!18 = distinct !{!18, !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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9push_backEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z18decryption_fuctionNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8 %0, ptr noundef nonnull %1, i32 noundef %2) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %4 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #3
  %5 = trunc i64 %4 to i32
  tail call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #3
  %6 = zext i32 %2 to i64
  %7 = and i64 %4, 4294967295
  %8 = mul nuw i64 %7, %6
  %9 = alloca i8, i64 %8, align 16
  %10 = icmp sgt i32 %2, 0
  %11 = icmp sgt i32 %5, 0
  br i1 %10, label %.preheader66.lr.ph, label %.preheader65

.preheader66.lr.ph:                               ; preds = %3
  br i1 %11, label %.preheader65.thread, label %._crit_edge

.preheader65.thread:                              ; preds = %.preheader66.lr.ph
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %9, i8 45, i64 %8, i1 false), !tbaa !5
  br label %.lr.ph

.preheader65:                                     ; preds = %3
  br i1 %11, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader65.thread, %.preheader65
  %12 = add nsw i32 %2, -1
  %wide.trip.count = and i64 %4, 2147483647
  %xtraiter = and i64 %4, 1
  %13 = icmp eq i64 %wide.trip.count, 1
  br i1 %13, label %.preheader64.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = sub nsw i64 %wide.trip.count, %xtraiter
  br label %30

.preheader64.unr-lcssa.loopexit:                  ; preds = %30
  %14 = sext i32 %.156.1 to i64
  br label %.preheader64.unr-lcssa

.preheader64.unr-lcssa:                           ; preds = %.preheader64.unr-lcssa.loopexit, %.lr.ph
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next.1, %.preheader64.unr-lcssa.loopexit ]
  %.05569.unr = phi i64 [ 0, %.lr.ph ], [ %14, %.preheader64.unr-lcssa.loopexit ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader64, label %.preheader64.epilog-lcssa

.preheader64.epilog-lcssa:                        ; preds = %.preheader64.unr-lcssa
  %15 = mul nsw i64 %7, %.05569.unr
  %16 = getelementptr inbounds i8, ptr %9, i64 %15
  %17 = getelementptr inbounds i8, ptr %16, i64 %indvars.iv.unr
  store i8 48, ptr %17, align 1, !tbaa !5
  br label %.preheader64

.preheader64:                                     ; preds = %.preheader64.unr-lcssa, %.preheader64.epilog-lcssa
  br i1 %10, label %.preheader63.us.preheader, label %.lr.ph81

.preheader63.us.preheader:                        ; preds = %.preheader64
  %wide.trip.count90 = and i64 %4, 2147483647
  br label %.preheader63.us

.preheader63.us:                                  ; preds = %.preheader63.us.preheader, %._crit_edge.us77
  %indvars.iv92 = phi i64 [ 0, %.preheader63.us.preheader ], [ %indvars.iv.next93, %._crit_edge.us77 ]
  %.05075.us = phi i32 [ 0, %.preheader63.us.preheader ], [ %.2.us, %._crit_edge.us77 ]
  %18 = mul nuw nsw i64 %7, %indvars.iv92
  %19 = getelementptr inbounds i8, ptr %9, i64 %18
  br label %20

20:                                               ; preds = %.preheader63.us, %29
  %indvars.iv87 = phi i64 [ 0, %.preheader63.us ], [ %indvars.iv.next88, %29 ]
  %.172.us = phi i32 [ %.05075.us, %.preheader63.us ], [ %.2.us, %29 ]
  %21 = getelementptr inbounds i8, ptr %19, i64 %indvars.iv87
  %22 = load i8, ptr %21, align 1, !tbaa !5
  %23 = icmp eq i8 %22, 48
  br i1 %23, label %24, label %29

24:                                               ; preds = %20
  %25 = sext i32 %.172.us to i64
  %26 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %25)
  %27 = load i8, ptr %26, align 1, !tbaa !5
  store i8 %27, ptr %21, align 1, !tbaa !5
  %28 = add nsw i32 %.172.us, 1
  br label %29

29:                                               ; preds = %24, %20
  %.2.us = phi i32 [ %28, %24 ], [ %.172.us, %20 ]
  %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
  %exitcond91.not = icmp eq i64 %indvars.iv.next88, %wide.trip.count90
  br i1 %exitcond91.not, label %._crit_edge.us77, label %20, !llvm.loop !8

._crit_edge.us77:                                 ; preds = %29
  %indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
  %exitcond96.not = icmp eq i64 %indvars.iv.next93, %6
  br i1 %exitcond96.not, label %.lr.ph81, label %.preheader63.us, !llvm.loop !10

30:                                               ; preds = %30, %.lr.ph.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.new ], [ %indvars.iv.next.1, %30 ]
  %.05270 = phi i32 [ 0, %.lr.ph.new ], [ %.153.1, %30 ]
  %.05569 = phi i32 [ 0, %.lr.ph.new ], [ %.156.1, %30 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %30 ]
  %31 = sext i32 %.05569 to i64
  %32 = mul nsw i64 %7, %31
  %33 = getelementptr inbounds i8, ptr %9, i64 %32
  %34 = getelementptr inbounds i8, ptr %33, i64 %indvars.iv
  store i8 48, ptr %34, align 1, !tbaa !5
  %35 = icmp eq i32 %.05569, %12
  %36 = icmp eq i32 %.05569, 0
  %spec.select = select i1 %36, i32 0, i32 %.05270
  %.153 = select i1 %35, i32 1, i32 %spec.select
  %37 = icmp eq i32 %.153, 0
  %.156.v = select i1 %37, i32 1, i32 -1
  %.156 = add nsw i32 %.156.v, %.05569
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %38 = sext i32 %.156 to i64
  %39 = mul nsw i64 %7, %38
  %40 = getelementptr inbounds i8, ptr %9, i64 %39
  %41 = getelementptr inbounds i8, ptr %40, i64 %indvars.iv.next
  store i8 48, ptr %41, align 1, !tbaa !5
  %42 = icmp eq i32 %.156, %12
  %43 = icmp eq i32 %.156, 0
  %spec.select.1 = select i1 %43, i32 0, i32 %.153
  %.153.1 = select i1 %42, i32 1, i32 %spec.select.1
  %44 = icmp eq i32 %.153.1, 0
  %.156.v.1 = select i1 %44, i32 1, i32 -1
  %.156.1 = add nsw i32 %.156.v.1, %.156
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 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 %.preheader64.unr-lcssa.loopexit, label %30, !llvm.loop !11

.lr.ph81:                                         ; preds = %._crit_edge.us77, %.preheader64
  %45 = add nsw i32 %2, -1
  %wide.trip.count100 = and i64 %4, 2147483647
  br label %46

._crit_edge:                                      ; preds = %52, %.preheader65, %.preheader66.lr.ph
  ret void

46:                                               ; preds = %.lr.ph81, %52
  %indvars.iv97 = phi i64 [ 0, %.lr.ph81 ], [ %indvars.iv.next98, %52 ]
  %.25479 = phi i32 [ 0, %.lr.ph81 ], [ %.3, %52 ]
  %.25778 = phi i32 [ 0, %.lr.ph81 ], [ %.358, %52 ]
  %47 = sext i32 %.25778 to i64
  %48 = mul nsw i64 %7, %47
  %49 = getelementptr inbounds i8, ptr %9, i64 %48
  %50 = getelementptr inbounds i8, ptr %49, i64 %indvars.iv97
  %51 = load i8, ptr %50, align 1, !tbaa !5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9push_backEc(ptr noundef nonnull align 8 dereferenceable(32) %0, i8 noundef signext %51)
          to label %52 unwind label %56

52:                                               ; preds = %46
  %53 = icmp eq i32 %.25778, %45
  %54 = icmp eq i32 %.25778, 0
  %spec.select62 = select i1 %54, i32 0, i32 %.25479
  %.3 = select i1 %53, i32 1, i32 %spec.select62
  %55 = icmp eq i32 %.3, 0
  %.358.v = select i1 %55, i32 1, i32 -1
  %.358 = add nsw i32 %.358.v, %.25778
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  %exitcond101.not = icmp eq i64 %indvars.iv.next98, %wide.trip.count100
  br i1 %exitcond101.not, label %._crit_edge, label %46, !llvm.loop !12

56:                                               ; preds = %46
  %57 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #3
  resume { ptr, i32 } %57
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 align 2

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

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

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

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


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