; LLVM IR from lzyrapx/Competitive-Programming :: ACdream (1038（模拟）)

; 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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<char, std::pair<const char, int>, std::_Select1st<std::pair<const char, int>>, std::less<char>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<char, std::pair<const char, int>, std::_Select1st<std::pair<const char, int>>, std::less<char>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::map.0" = type { %"class.std::_Rb_tree.1" }
%"class.std::_Rb_tree.1" = type { %"struct.std::_Rb_tree<int, std::pair<const int, char>, std::_Select1st<std::pair<const int, char>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, char>, std::_Select1st<std::pair<const int, char>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"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" }

@s = external dso_local global [1000010 x i8], align 16
@source = external dso_local global [1000010 x i8], align 16
@target = external dso_local global [1000010 x i8], align 16
@ans = external dso_local global [1000010 x i8], align 16
@mps = external dso_local global %"class.std::map", align 8
@mpt = external dso_local global %"class.std::map.0", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z5q_powii(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
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 1, ptr %3, align 4, !tbaa !5
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %16 = call i32 @getchar()
  br label %17

17:                                               ; preds = %137, %135, %0
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = add nsw i32 %18, -1
  store i32 %19, ptr %2, align 4, !tbaa !5
  %20 = icmp ne i32 %18, 0
  br i1 %20, label %21, label %138

21:                                               ; preds = %17
  call void @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @mps) #7
  call void @_ZNSt3mapIicSt4lessIiESaISt4pairIKicEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @mpt) #7
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @s)
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @source)
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @target)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %25 = call i64 @strlen(ptr noundef @s) #8
  %26 = trunc i64 %25 to i32
  store i32 %26, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %27 = call i64 @strlen(ptr noundef @source) #8
  %28 = trunc i64 %27 to i32
  store i32 %28, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %29 = call i64 @strlen(ptr noundef @target) #8
  %30 = trunc i64 %29 to i32
  store i32 %30, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %42, %21
  %32 = load i32, ptr %7, align 4, !tbaa !5
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %45

36:                                               ; preds = %31
  %37 = load i32, ptr %7, align 4, !tbaa !5
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [1000010 x i8], ptr @source, i64 0, i64 %39
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @mps, ptr noundef nonnull align 1 dereferenceable(1) %40)
  store i32 %37, ptr %41, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %36
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %7, align 4, !tbaa !5
  br label %31, !llvm.loop !9

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

46:                                               ; preds = %57, %45
  %47 = load i32, ptr %8, align 4, !tbaa !5
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %60

51:                                               ; preds = %46
  %52 = load i32, ptr %8, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [1000010 x i8], ptr @target, i64 0, i64 %53
  %55 = load i8, ptr %54, align 1, !tbaa !11
  %56 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt3mapIicSt4lessIiESaISt4pairIKicEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @mpt, ptr noundef nonnull align 4 dereferenceable(4) %8)
  store i8 %55, ptr %56, align 1, !tbaa !11
  br label %57

57:                                               ; preds = %51
  %58 = load i32, ptr %8, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %8, align 4, !tbaa !5
  br label %46, !llvm.loop !12

60:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %61

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

65:                                               ; preds = %61
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %87

66:                                               ; preds = %61
  %67 = load i32, ptr %5, align 4, !tbaa !5
  %68 = load i32, ptr %10, align 4, !tbaa !5
  %69 = call noundef i64 @_Z5q_powii(i32 noundef %67, i32 noundef %68)
  %70 = load i32, ptr %4, align 4, !tbaa !5
  %71 = load i32, ptr %10, align 4, !tbaa !5
  %72 = sub nsw i32 %70, %71
  %73 = sub nsw i32 %72, 1
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1000010 x i8], ptr @s, i64 0, i64 %74
  %76 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @mps, ptr noundef nonnull align 1 dereferenceable(1) %75)
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = mul nsw i64 %69, %78
  %80 = load i32, ptr %9, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = add nsw i64 %81, %79
  %83 = trunc i64 %82 to i32
  store i32 %83, ptr %9, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %66
  %85 = load i32, ptr %10, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %10, align 4, !tbaa !5
  br label %61, !llvm.loop !13

87:                                               ; preds = %65
  %88 = load i32, ptr %9, align 4, !tbaa !5
  %89 = icmp eq i32 %88, 0
  br i1 %89, label %90, label %97

90:                                               ; preds = %87
  %91 = load i32, ptr %3, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %3, align 4, !tbaa !5
  %93 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %91)
  %94 = load i8, ptr @target, align 16, !tbaa !11
  %95 = sext i8 %94 to i32
  %96 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %95)
  store i32 2, ptr %11, align 4
  br label %135, !llvm.loop !14

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

98:                                               ; preds = %101, %97
  %99 = load i32, ptr %9, align 4, !tbaa !5
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %101, label %114

101:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %102 = load i32, ptr %9, align 4, !tbaa !5
  %103 = load i32, ptr %6, align 4, !tbaa !5
  %104 = srem i32 %102, %103
  store i32 %104, ptr %13, align 4, !tbaa !5
  %105 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt3mapIicSt4lessIiESaISt4pairIKicEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) @mpt, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %106 = load i8, ptr %105, align 1, !tbaa !11
  %107 = load i32, ptr %12, align 4, !tbaa !5
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %12, align 4, !tbaa !5
  %109 = sext i32 %107 to i64
  %110 = getelementptr inbounds [1000010 x i8], ptr @ans, i64 0, i64 %109
  store i8 %106, ptr %110, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  %111 = load i32, ptr %6, align 4, !tbaa !5
  %112 = load i32, ptr %9, align 4, !tbaa !5
  %113 = sdiv i32 %112, %111
  store i32 %113, ptr %9, align 4, !tbaa !5
  br label %98, !llvm.loop !15

114:                                              ; preds = %98
  %115 = load i32, ptr %3, align 4, !tbaa !5
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %3, align 4, !tbaa !5
  %117 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %115)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %118 = load i32, ptr %12, align 4, !tbaa !5
  %119 = sub nsw i32 %118, 1
  store i32 %119, ptr %14, align 4, !tbaa !5
  br label %120

120:                                              ; preds = %130, %114
  %121 = load i32, ptr %14, align 4, !tbaa !5
  %122 = icmp sge i32 %121, 0
  br i1 %122, label %124, label %123

123:                                              ; preds = %120
  store i32 15, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %133

124:                                              ; preds = %120
  %125 = load i32, ptr %14, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [1000010 x i8], ptr @ans, i64 0, i64 %126
  %128 = load i8, ptr %127, align 1, !tbaa !11
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %128)
  br label %130

130:                                              ; preds = %124
  %131 = load i32, ptr %14, align 4, !tbaa !5
  %132 = add nsw i32 %131, -1
  store i32 %132, ptr %14, align 4, !tbaa !5
  br label %120, !llvm.loop !16

133:                                              ; preds = %123
  %134 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  store i32 0, ptr %11, align 4
  br label %135

135:                                              ; preds = %133, %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  %136 = load i32, ptr %11, align 4
  switch i32 %136, label %140 [
    i32 0, label %137
    i32 2, label %17
  ]

137:                                              ; preds = %135
  br label %17, !llvm.loop !14

138:                                              ; preds = %17
  store i32 0, ptr %1, align 4
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %139 = load i32, ptr %1, align 4
  ret i32 %139

140:                                              ; preds = %135
  unreachable
}

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: inlinehint mustprogress uwtable
declare i32 @getchar() #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIicSt4lessIiESaISt4pairIKicEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48)) #0 align 2

declare i32 @__isoc99_scanf(ptr noundef, ...) #3

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 1 dereferenceable(1)) #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt3mapIicSt4lessIiESaISt4pairIKicEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #6 align 2

declare i32 @printf(ptr noundef, ...) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt3mapIicSt4lessIiESaISt4pairIKicEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #4

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #6 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 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 = { 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 willreturn memory(read) "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 = { 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }

!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}
!16 = distinct !{!16, !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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<char, std::pair<const char, int>, std::_Select1st<std::pair<const char, int>>, std::less<char>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<char, std::pair<const char, int>, std::_Select1st<std::pair<const char, int>>, std::less<char>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::map.0" = type { %"class.std::_Rb_tree.1" }
%"class.std::_Rb_tree.1" = type { %"struct.std::_Rb_tree<int, std::pair<const int, char>, std::_Select1st<std::pair<const int, char>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, char>, std::_Select1st<std::pair<const int, char>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"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" }

@s = external dso_local global [1000010 x i8], align 16
@source = external dso_local global [1000010 x i8], align 16
@target = external dso_local global [1000010 x i8], align 16
@ans = external dso_local local_unnamed_addr global [1000010 x i8], align 16
@mps = external dso_local global %"class.std::map", align 8
@mpt = external dso_local global %"class.std::map.0", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z5q_powii(i32 noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress 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() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #9
  %4 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %5 = call i32 @getchar()
  %6 = load i32, ptr %1, align 4, !tbaa !5
  %7 = add nsw i32 %6, -1
  store i32 %7, ptr %1, align 4, !tbaa !5
  %.not52 = icmp eq i32 %6, 0
  br i1 %.not52, label %._crit_edge56, label %.lr.ph55

.lr.ph55:                                         ; preds = %0, %62
  %.03253 = phi i32 [ %.133, %62 ], [ 1, %0 ]
  call void @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @mps) #9
  call void @_ZNSt3mapIicSt4lessIiESaISt4pairIKicEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @mpt) #9
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @s)
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @source)
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @target)
  %11 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) @s) #10
  %12 = trunc i64 %11 to i32
  %13 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) @source) #10
  %14 = trunc i64 %13 to i32
  %15 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) @target) #10
  %16 = trunc i64 %15 to i32
  %17 = icmp sgt i32 %14, 0
  br i1 %17, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.lr.ph55
  %wide.trip.count = and i64 %13, 2147483647
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph55
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #9
  store i32 0, ptr %2, align 4, !tbaa !5
  %18 = icmp sgt i32 %16, 0
  br i1 %18, label %.lr.ph42, label %._crit_edge43

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %19 = getelementptr inbounds [1000010 x i8], ptr @source, i64 0, i64 %indvars.iv
  %20 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @mps, ptr noundef nonnull align 1 dereferenceable(1) %19)
  %21 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %21, ptr %20, 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 !9

._crit_edge43:                                    ; preds = %.lr.ph42, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #9
  %22 = icmp sgt i32 %12, 0
  br i1 %22, label %.lr.ph47.preheader, label %._crit_edge48.thread

.lr.ph47.preheader:                               ; preds = %._crit_edge43
  %23 = and i64 %11, 2147483647
  %wide.trip.count62 = and i64 %11, 2147483647
  br label %.lr.ph47

.lr.ph42:                                         ; preds = %._crit_edge, %.lr.ph42
  %storemerge40 = phi i32 [ %29, %.lr.ph42 ], [ 0, %._crit_edge ]
  %24 = sext i32 %storemerge40 to i64
  %25 = getelementptr inbounds [1000010 x i8], ptr @target, i64 0, i64 %24
  %26 = load i8, ptr %25, align 1, !tbaa !11
  %27 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt3mapIicSt4lessIiESaISt4pairIKicEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @mpt, ptr noundef nonnull align 4 dereferenceable(4) %2)
  store i8 %26, ptr %27, align 1, !tbaa !11
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %2, align 4, !tbaa !5
  %30 = icmp slt i32 %29, %16
  br i1 %30, label %.lr.ph42, label %._crit_edge43, !llvm.loop !12

._crit_edge48:                                    ; preds = %.lr.ph47
  %31 = icmp eq i32 %41, 0
  br i1 %31, label %._crit_edge48.thread, label %.preheader

.lr.ph47:                                         ; preds = %.lr.ph47.preheader, %.lr.ph47
  %indvars.iv59 = phi i64 [ 0, %.lr.ph47.preheader ], [ %indvars.iv.next60, %.lr.ph47 ]
  %.03044 = phi i32 [ 0, %.lr.ph47.preheader ], [ %41, %.lr.ph47 ]
  %32 = trunc nuw nsw i64 %indvars.iv59 to i32
  %33 = call noundef i64 @_Z5q_powii(i32 noundef %14, i32 noundef %32)
  %34 = xor i64 %indvars.iv59, -1
  %35 = add nsw i64 %23, %34
  %36 = getelementptr inbounds [1000010 x i8], ptr @s, i64 0, i64 %35
  %37 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @mps, ptr noundef nonnull align 1 dereferenceable(1) %36)
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = trunc i64 %33 to i32
  %40 = mul i32 %38, %39
  %41 = add i32 %40, %.03044
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
  %exitcond63.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count62
  br i1 %exitcond63.not, label %._crit_edge48, label %.lr.ph47, !llvm.loop !13

._crit_edge48.thread:                             ; preds = %._crit_edge43, %._crit_edge48
  %42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.03253)
  %43 = load i8, ptr @target, align 16, !tbaa !11
  %44 = sext i8 %43 to i32
  %45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %44)
  br label %62, !llvm.loop !14

.preheader:                                       ; preds = %._crit_edge48, %.preheader
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %.preheader ], [ 1, %._crit_edge48 ]
  %indvars.iv64 = phi i64 [ %indvars.iv.next65, %.preheader ], [ 0, %._crit_edge48 ]
  %.149 = phi i32 [ %50, %.preheader ], [ %41, %._crit_edge48 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #9
  %46 = srem i32 %.149, %16
  store i32 %46, ptr %3, align 4, !tbaa !5
  %47 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt3mapIicSt4lessIiESaISt4pairIKicEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) @mpt, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %48 = load i8, ptr %47, align 1, !tbaa !11
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %49 = getelementptr inbounds [1000010 x i8], ptr @ans, i64 0, i64 %indvars.iv64
  store i8 %48, ptr %49, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #9
  %50 = sdiv i32 %.149, %16
  %.not38 = icmp eq i32 %50, 0
  %indvars.iv.next68 = add nuw i64 %indvars.iv67, 1
  br i1 %.not38, label %51, label %.preheader, !llvm.loop !15

51:                                               ; preds = %.preheader
  %52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.03253)
  br label %55

53:                                               ; preds = %55
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %62

55:                                               ; preds = %51, %55
  %indvars.iv69 = phi i64 [ %indvars.iv67, %51 ], [ %indvars.iv.next70, %55 ]
  %indvars.iv.next70 = add nsw i64 %indvars.iv69, -1
  %56 = and i64 %indvars.iv.next70, 4294967295
  %57 = getelementptr inbounds [1000010 x i8], ptr @ans, i64 0, i64 %56
  %58 = load i8, ptr %57, align 1, !tbaa !11
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %58)
  %60 = trunc nuw i64 %indvars.iv69 to i32
  %61 = icmp sgt i32 %60, 1
  br i1 %61, label %55, label %53, !llvm.loop !16

62:                                               ; preds = %53, %._crit_edge48.thread
  %.133 = add nuw nsw i32 %.03253, 1
  %63 = load i32, ptr %1, align 4, !tbaa !5
  %64 = add nsw i32 %63, -1
  store i32 %64, ptr %1, align 4, !tbaa !5
  %.not = icmp eq i32 %63, 0
  br i1 %.not, label %._crit_edge56, label %.lr.ph55

._crit_edge56:                                    ; preds = %62, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #9
  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 #3

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @getchar() local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIicSt4lessIiESaISt4pairIKicEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #0 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #7 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt3mapIicSt4lessIiESaISt4pairIKicEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #7 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt3mapIicSt4lessIiESaISt4pairIKicEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #7 align 2

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

; 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 #7 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)) #8

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 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 nofree 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 #5 = { 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 #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 #7 = { 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 #8 = { 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 #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(read) }

!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}
!16 = distinct !{!16, !10}


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