; LLVM IR from ippeb/ACM-ICPC :: string_handling/c_string_functions (c_string_functions)

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

@.str = external hidden unnamed_addr constant [18 x i8], align 1
@c = external dso_local global i8, align 1
@.str.1 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [3 x i8], align 1
@A = external dso_local global [256 x i8], align 16
@.str.17 = external hidden unnamed_addr constant [22 x i8], align 1
@B = external dso_local global [256 x i8], align 16
@.str.18 = external hidden unnamed_addr constant [13 x i8], align 1
@T = external dso_local global [512 x i8], align 16
@.str.19 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  %11 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %12 = call i32 @getchar()
  %13 = trunc i32 %12 to i8
  store i8 %13, ptr @c, align 1, !tbaa !5
  %14 = call ptr @__ctype_b_loc() #8
  %15 = load ptr, ptr %14, align 8, !tbaa !8
  %16 = load i8, ptr @c, align 1, !tbaa !5
  %17 = sext i8 %16 to i32
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds i16, ptr %15, i64 %18
  %20 = load i16, ptr %19, align 2, !tbaa !10
  %21 = zext i16 %20 to i32
  %22 = and i32 %21, 1024
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %24, label %26

24:                                               ; preds = %0
  %25 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  br label %28

26:                                               ; preds = %0
  %27 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %28

28:                                               ; preds = %26, %24
  %29 = call ptr @__ctype_b_loc() #8
  %30 = load ptr, ptr %29, align 8, !tbaa !8
  %31 = load i8, ptr @c, align 1, !tbaa !5
  %32 = sext i8 %31 to i32
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds i16, ptr %30, i64 %33
  %35 = load i16, ptr %34, align 2, !tbaa !10
  %36 = zext i16 %35 to i32
  %37 = and i32 %36, 256
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %41

39:                                               ; preds = %28
  %40 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %63

41:                                               ; preds = %28
  %42 = load i8, ptr @c, align 1, !tbaa !5
  %43 = sext i8 %42 to i32
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #9
  %44 = call ptr @__ctype_toupper_loc() #8
  %45 = load ptr, ptr %44, align 8, !tbaa !8
  %46 = load i8, ptr @c, align 1, !tbaa !5
  %47 = sext i8 %46 to i32
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds i32, ptr %45, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !12
  store i32 %50, ptr %2, align 4, !tbaa !12
  %51 = load i32, ptr %2, align 4, !tbaa !12
  store i32 %51, ptr %3, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #9
  %52 = load i32, ptr %3, align 4, !tbaa !12
  %53 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %43, i32 noundef %52)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #9
  %54 = call ptr @__ctype_tolower_loc() #8
  %55 = load ptr, ptr %54, align 8, !tbaa !8
  %56 = load i8, ptr @c, align 1, !tbaa !5
  %57 = sext i8 %56 to i32
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds i32, ptr %55, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !12
  store i32 %60, ptr %4, align 4, !tbaa !12
  %61 = load i32, ptr %4, align 4, !tbaa !12
  store i32 %61, ptr %5, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #9
  %62 = load i32, ptr %5, align 4, !tbaa !12
  br label %63

63:                                               ; preds = %41, %39
  %64 = call ptr @__ctype_b_loc() #8
  %65 = load ptr, ptr %64, align 8, !tbaa !8
  %66 = load i8, ptr @c, align 1, !tbaa !5
  %67 = sext i8 %66 to i32
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds i16, ptr %65, i64 %68
  %70 = load i16, ptr %69, align 2, !tbaa !10
  %71 = zext i16 %70 to i32
  %72 = and i32 %71, 512
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %74, label %76

74:                                               ; preds = %63
  %75 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  br label %98

76:                                               ; preds = %63
  %77 = load i8, ptr @c, align 1, !tbaa !5
  %78 = sext i8 %77 to i32
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #9
  %79 = call ptr @__ctype_tolower_loc() #8
  %80 = load ptr, ptr %79, align 8, !tbaa !8
  %81 = load i8, ptr @c, align 1, !tbaa !5
  %82 = sext i8 %81 to i32
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds i32, ptr %80, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !12
  store i32 %85, ptr %6, align 4, !tbaa !12
  %86 = load i32, ptr %6, align 4, !tbaa !12
  store i32 %86, ptr %7, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  %87 = load i32, ptr %7, align 4, !tbaa !12
  %88 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %78, i32 noundef %87)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  %89 = call ptr @__ctype_toupper_loc() #8
  %90 = load ptr, ptr %89, align 8, !tbaa !8
  %91 = load i8, ptr @c, align 1, !tbaa !5
  %92 = sext i8 %91 to i32
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds i32, ptr %90, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !12
  store i32 %95, ptr %8, align 4, !tbaa !12
  %96 = load i32, ptr %8, align 4, !tbaa !12
  store i32 %96, ptr %9, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  %97 = load i32, ptr %9, align 4, !tbaa !12
  br label %98

98:                                               ; preds = %76, %74
  %99 = call ptr @__ctype_b_loc() #8
  %100 = load ptr, ptr %99, align 8, !tbaa !8
  %101 = load i8, ptr @c, align 1, !tbaa !5
  %102 = sext i8 %101 to i32
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds i16, ptr %100, i64 %103
  %105 = load i16, ptr %104, align 2, !tbaa !10
  %106 = zext i16 %105 to i32
  %107 = and i32 %106, 2048
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %109, label %111

109:                                              ; preds = %98
  %110 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  br label %113

111:                                              ; preds = %98
  %112 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  br label %113

113:                                              ; preds = %111, %109
  %114 = call ptr @__ctype_b_loc() #8
  %115 = load ptr, ptr %114, align 8, !tbaa !8
  %116 = load i8, ptr @c, align 1, !tbaa !5
  %117 = sext i8 %116 to i32
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds i16, ptr %115, i64 %118
  %120 = load i16, ptr %119, align 2, !tbaa !10
  %121 = zext i16 %120 to i32
  %122 = and i32 %121, 4
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %126

124:                                              ; preds = %113
  %125 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  br label %128

126:                                              ; preds = %113
  %127 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  br label %128

128:                                              ; preds = %126, %124
  %129 = call ptr @__ctype_b_loc() #8
  %130 = load ptr, ptr %129, align 8, !tbaa !8
  %131 = load i8, ptr @c, align 1, !tbaa !5
  %132 = sext i8 %131 to i32
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds i16, ptr %130, i64 %133
  %135 = load i16, ptr %134, align 2, !tbaa !10
  %136 = zext i16 %135 to i32
  %137 = and i32 %136, 4096
  %138 = icmp ne i32 %137, 0
  br i1 %138, label %139, label %141

139:                                              ; preds = %128
  %140 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  br label %143

141:                                              ; preds = %128
  %142 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  br label %143

143:                                              ; preds = %141, %139
  %144 = call ptr @__ctype_b_loc() #8
  %145 = load ptr, ptr %144, align 8, !tbaa !8
  %146 = load i8, ptr @c, align 1, !tbaa !5
  %147 = sext i8 %146 to i32
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds i16, ptr %145, i64 %148
  %150 = load i16, ptr %149, align 2, !tbaa !10
  %151 = zext i16 %150 to i32
  %152 = and i32 %151, 16384
  %153 = icmp ne i32 %152, 0
  br i1 %153, label %154, label %156

154:                                              ; preds = %143
  %155 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  br label %158

156:                                              ; preds = %143
  %157 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  br label %158

158:                                              ; preds = %156, %154
  %159 = call i32 (ptr, ...) @printf(ptr noundef @.str.15)
  %160 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.16, ptr noundef @A)
  %161 = call i32 (ptr, ...) @printf(ptr noundef @.str.17)
  %162 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.16, ptr noundef @B)
  %163 = call i32 (ptr, ...) @printf(ptr noundef @.str.18)
  %164 = call ptr @strcpy(ptr noundef @T, ptr noundef @A) #9
  %165 = call i64 @strlen(ptr noundef @B) #10
  %166 = call ptr @strncat(ptr noundef @T, ptr noundef @B, i64 noundef %165) #9
  %167 = call i32 (ptr, ...) @printf(ptr noundef @.str.19, ptr noundef %166)
  %168 = call i32 (ptr, ...) @printf(ptr noundef @.str.20)
  %169 = call i32 @strcmp(ptr noundef @A, ptr noundef @B) #10
  %170 = call i32 (ptr, ...) @printf(ptr noundef @.str.21, i32 noundef %169)
  %171 = call i32 (ptr, ...) @printf(ptr noundef @.str.22)
  call void @llvm.memset.p0.i64(ptr align 16 @T, i8 0, i64 512, i1 false)
  %172 = call i32 (ptr, ...) @printf(ptr noundef @.str.19, ptr noundef @T)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  %173 = call i32 (ptr, ...) @printf(ptr noundef @.str.23)
  %174 = call ptr @strstr(ptr noundef @A, ptr noundef @B) #10
  store ptr %174, ptr %10, align 8, !tbaa !8
  %175 = load ptr, ptr %10, align 8, !tbaa !8
  %176 = icmp ne ptr %175, null
  br i1 %176, label %177, label %193

177:                                              ; preds = %158
  %178 = call i32 (ptr, ...) @printf(ptr noundef @.str.24)
  br label %179

179:                                              ; preds = %184, %177
  %180 = load ptr, ptr %10, align 8, !tbaa !8
  %181 = load i8, ptr %180, align 1, !tbaa !5
  %182 = sext i8 %181 to i32
  %183 = icmp ne i32 %182, 0
  br i1 %183, label %184, label %191

184:                                              ; preds = %179
  %185 = load ptr, ptr %10, align 8, !tbaa !8
  %186 = load i8, ptr %185, align 1, !tbaa !5
  %187 = sext i8 %186 to i32
  %188 = call i32 (ptr, ...) @printf(ptr noundef @.str.25, i32 noundef %187)
  %189 = load ptr, ptr %10, align 8, !tbaa !8
  %190 = getelementptr inbounds i8, ptr %189, i32 1
  store ptr %190, ptr %10, align 8, !tbaa !8
  br label %179, !llvm.loop !14

191:                                              ; preds = %179
  %192 = call i32 @putchar(i32 noundef 10)
  br label %195

193:                                              ; preds = %158
  %194 = call i32 (ptr, ...) @printf(ptr noundef @.str.26)
  br label %195

195:                                              ; preds = %193, %191
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  %196 = load i32, ptr %1, align 4
  ret i32 %196
}

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

; Function Attrs: inlinehint nounwind uwtable
declare i32 @getchar() #2

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() #3

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_toupper_loc() #3

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_tolower_loc() #3

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

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #5

; Function Attrs: nounwind
declare ptr @strncat(ptr noundef, ptr noundef, i64 noundef) #5

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #6

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

; Function Attrs: nounwind willreturn memory(read)
declare ptr @strstr(ptr noundef, ptr noundef) #6

; Function Attrs: inlinehint nounwind uwtable
declare i32 @putchar(i32 noundef) #2

attributes #0 = { 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 = { "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 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind willreturn memory(none) "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = { 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind willreturn memory(none) }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !6, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !6, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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

@.str = external hidden unnamed_addr constant [18 x i8], align 1
@c = external dso_local local_unnamed_addr global i8, align 1
@.str.1 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [3 x i8], align 1
@A = external dso_local global [256 x i8], align 16
@.str.17 = external hidden unnamed_addr constant [22 x i8], align 1
@B = external dso_local global [256 x i8], align 16
@.str.18 = external hidden unnamed_addr constant [13 x i8], align 1
@T = external dso_local global [512 x i8], align 16
@.str.19 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %2 = tail call i32 @getchar()
  %3 = trunc i32 %2 to i8
  store i8 %3, ptr @c, align 1, !tbaa !5
  %4 = tail call ptr @__ctype_b_loc() #7
  %5 = load ptr, ptr %4, align 8, !tbaa !8
  %sext = shl i32 %2, 24
  %6 = ashr exact i32 %sext, 24
  %7 = sext i32 %6 to i64
  %8 = getelementptr inbounds i16, ptr %5, i64 %7
  %9 = load i16, ptr %8, align 2, !tbaa !10
  %10 = and i16 %9, 1024
  %.not = icmp eq i16 %10, 0
  %.str.2..str.1 = select i1 %.not, ptr @.str.2, ptr @.str.1
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.1)
  %12 = load ptr, ptr %4, align 8, !tbaa !8
  %13 = load i8, ptr @c, align 1, !tbaa !5
  %14 = sext i8 %13 to i64
  %15 = getelementptr inbounds i16, ptr %12, i64 %14
  %16 = load i16, ptr %15, align 2, !tbaa !10
  %17 = and i16 %16, 256
  %.not14 = icmp eq i16 %17, 0
  br i1 %.not14, label %20, label %18

18:                                               ; preds = %0
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %27

20:                                               ; preds = %0
  %21 = sext i8 %13 to i32
  %22 = tail call ptr @__ctype_toupper_loc() #7
  %23 = load ptr, ptr %22, align 8, !tbaa !8
  %24 = getelementptr inbounds i32, ptr %23, i64 %14
  %25 = load i32, ptr %24, align 4, !tbaa !12
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %21, i32 noundef %25)
  br label %27

27:                                               ; preds = %20, %18
  %28 = load ptr, ptr %4, align 8, !tbaa !8
  %29 = load i8, ptr @c, align 1, !tbaa !5
  %30 = sext i8 %29 to i64
  %31 = getelementptr inbounds i16, ptr %28, i64 %30
  %32 = load i16, ptr %31, align 2, !tbaa !10
  %33 = and i16 %32, 512
  %.not15 = icmp eq i16 %33, 0
  br i1 %.not15, label %36, label %34

34:                                               ; preds = %27
  %35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  br label %43

36:                                               ; preds = %27
  %37 = sext i8 %29 to i32
  %38 = tail call ptr @__ctype_tolower_loc() #7
  %39 = load ptr, ptr %38, align 8, !tbaa !8
  %40 = getelementptr inbounds i32, ptr %39, i64 %30
  %41 = load i32, ptr %40, align 4, !tbaa !12
  %42 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %37, i32 noundef %41)
  br label %43

43:                                               ; preds = %36, %34
  %44 = load ptr, ptr %4, align 8, !tbaa !8
  %45 = load i8, ptr @c, align 1, !tbaa !5
  %46 = sext i8 %45 to i64
  %47 = getelementptr inbounds i16, ptr %44, i64 %46
  %48 = load i16, ptr %47, align 2, !tbaa !10
  %49 = and i16 %48, 2048
  %.not16 = icmp eq i16 %49, 0
  %.str.8..str.7 = select i1 %.not16, ptr @.str.8, ptr @.str.7
  %50 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.8..str.7)
  %51 = load ptr, ptr %4, align 8, !tbaa !8
  %52 = load i8, ptr @c, align 1, !tbaa !5
  %53 = sext i8 %52 to i64
  %54 = getelementptr inbounds i16, ptr %51, i64 %53
  %55 = load i16, ptr %54, align 2, !tbaa !10
  %56 = and i16 %55, 4
  %.not17 = icmp eq i16 %56, 0
  %.str.10.sink = select i1 %.not17, ptr @.str.10, ptr @.str.9
  %57 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.10.sink)
  %58 = load ptr, ptr %4, align 8, !tbaa !8
  %59 = load i8, ptr @c, align 1, !tbaa !5
  %60 = sext i8 %59 to i64
  %61 = getelementptr inbounds i16, ptr %58, i64 %60
  %62 = load i16, ptr %61, align 2, !tbaa !10
  %63 = and i16 %62, 4096
  %.not18 = icmp eq i16 %63, 0
  %.str.12.sink = select i1 %.not18, ptr @.str.12, ptr @.str.11
  %64 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.12.sink)
  %65 = load ptr, ptr %4, align 8, !tbaa !8
  %66 = load i8, ptr @c, align 1, !tbaa !5
  %67 = sext i8 %66 to i64
  %68 = getelementptr inbounds i16, ptr %65, i64 %67
  %69 = load i16, ptr %68, align 2, !tbaa !10
  %70 = and i16 %69, 16384
  %.not19 = icmp eq i16 %70, 0
  %.str.14.sink = select i1 %.not19, ptr @.str.14, ptr @.str.13
  %71 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.14.sink)
  %72 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15)
  %73 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.16, ptr noundef nonnull @A)
  %74 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17)
  %75 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.16, ptr noundef nonnull @B)
  %76 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18)
  %77 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) @T, ptr noundef nonnull dereferenceable(1) @A) #8
  %78 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @B) #9
  %79 = tail call ptr @strncat(ptr noundef nonnull dereferenceable(1) @T, ptr noundef nonnull @B, i64 noundef %78) #8
  %80 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19, ptr noundef nonnull @T)
  %81 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20)
  %82 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) @A, ptr noundef nonnull dereferenceable(1) @B) #9
  %83 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21, i32 noundef %82)
  %84 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.22)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(512) @T, i8 0, i64 512, i1 false)
  %85 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19, ptr noundef nonnull @T)
  %86 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.23)
  %87 = tail call ptr @strstr(ptr noundef nonnull dereferenceable(1) @A, ptr noundef nonnull dereferenceable(1) @B) #9
  %.not20 = icmp eq ptr %87, null
  br i1 %.not20, label %97, label %88

88:                                               ; preds = %43
  %89 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.24)
  %90 = load i8, ptr %87, align 1, !tbaa !5
  %.not2122 = icmp eq i8 %90, 0
  br i1 %.not2122, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %88, %.lr.ph
  %91 = phi i8 [ %95, %.lr.ph ], [ %90, %88 ]
  %.023 = phi ptr [ %94, %.lr.ph ], [ %87, %88 ]
  %92 = sext i8 %91 to i32
  %93 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.25, i32 noundef %92)
  %94 = getelementptr inbounds i8, ptr %.023, i64 1
  %95 = load i8, ptr %94, align 1, !tbaa !5
  %.not21 = icmp eq i8 %95, 0
  br i1 %.not21, label %._crit_edge, label %.lr.ph, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph, %88
  %96 = tail call i32 @putchar(i32 noundef 10)
  br label %99

97:                                               ; preds = %43
  %98 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.26)
  br label %99

99:                                               ; preds = %97, %._crit_edge
  ret i32 0
}

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

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

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #3

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_toupper_loc() local_unnamed_addr #3

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_tolower_loc() local_unnamed_addr #3

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly, i64 noundef) local_unnamed_addr #4

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #5

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: inlinehint nofree nounwind uwtable
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { 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 #2 = { inlinehint 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 #3 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 = { 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !6, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !6, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass