; LLVM IR from bytecodealliance/sightglass :: benchmarks/shootout/src (ctype)

; 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 [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [93 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [55 x i8], align 1
@black_box = external hidden global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #10
  store i64 50000, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #10
  %13 = load i64, ptr %2, align 8, !tbaa !5
  %14 = call noalias ptr @malloc(i64 noundef %13) #11
  store ptr %14, ptr %3, align 8, !tbaa !9
  %15 = load ptr, ptr %3, align 8, !tbaa !9
  %16 = icmp ne ptr %15, null
  br i1 %16, label %17, label %18

17:                                               ; preds = %0
  br label %19

18:                                               ; preds = %0
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 15, ptr noundef @__PRETTY_FUNCTION__.main) #12
  unreachable

19:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #10
  store i64 0, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #10
  %20 = load i64, ptr %2, align 8, !tbaa !5
  %21 = icmp uge i64 %20, 2
  br i1 %21, label %22, label %23

22:                                               ; preds = %19
  br label %24

23:                                               ; preds = %19
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 20, ptr noundef @__PRETTY_FUNCTION__.main) #12
  unreachable

24:                                               ; preds = %22
  %25 = load ptr, ptr %3, align 8, !tbaa !9
  %26 = load i64, ptr %2, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 1 %25, i8 120, i64 %26, i1 false)
  %27 = load ptr, ptr %3, align 8, !tbaa !9
  %28 = load i64, ptr %2, align 8, !tbaa !5
  %29 = sub i64 %28, 1
  %30 = getelementptr inbounds i8, ptr %27, i64 %29
  store i8 0, ptr %30, align 1, !tbaa !11
  %31 = load i64, ptr %2, align 8, !tbaa !5
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %31, i32 noundef 1000)
  call void (...) @bench_start()
  store i32 0, ptr %6, align 4, !tbaa !12
  br label %33

33:                                               ; preds = %237, %24
  %34 = load i32, ptr %6, align 4, !tbaa !12
  %35 = icmp slt i32 %34, 1000
  br i1 %35, label %36, label %240

36:                                               ; preds = %33
  %37 = load volatile ptr, ptr @black_box, align 8, !tbaa !9
  call void %37(ptr noundef %3)
  store i64 0, ptr %5, align 8, !tbaa !5
  br label %38

38:                                               ; preds = %233, %36
  %39 = load i64, ptr %5, align 8, !tbaa !5
  %40 = load i64, ptr %2, align 8, !tbaa !5
  %41 = icmp ult i64 %39, %40
  br i1 %41, label %42, label %236

42:                                               ; preds = %38
  %43 = call ptr @__ctype_b_loc() #13
  %44 = load ptr, ptr %43, align 8, !tbaa !9
  %45 = load ptr, ptr %3, align 8, !tbaa !9
  %46 = load i64, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %45, i64 %46
  %48 = load i8, ptr %47, align 1, !tbaa !11
  %49 = zext i8 %48 to i32
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i16, ptr %44, i64 %50
  %52 = load i16, ptr %51, align 2, !tbaa !14
  %53 = zext i16 %52 to i32
  %54 = and i32 %53, 1024
  %55 = sext i32 %54 to i64
  %56 = load i64, ptr %4, align 8, !tbaa !5
  %57 = add i64 %56, %55
  store i64 %57, ptr %4, align 8, !tbaa !5
  %58 = call ptr @__ctype_b_loc() #13
  %59 = load ptr, ptr %58, align 8, !tbaa !9
  %60 = load ptr, ptr %3, align 8, !tbaa !9
  %61 = load i64, ptr %5, align 8, !tbaa !5
  %62 = getelementptr inbounds i8, ptr %60, i64 %61
  %63 = load i8, ptr %62, align 1, !tbaa !11
  %64 = zext i8 %63 to i32
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds i16, ptr %59, i64 %65
  %67 = load i16, ptr %66, align 2, !tbaa !14
  %68 = zext i16 %67 to i32
  %69 = and i32 %68, 8
  %70 = sext i32 %69 to i64
  %71 = load i64, ptr %4, align 8, !tbaa !5
  %72 = add i64 %71, %70
  store i64 %72, ptr %4, align 8, !tbaa !5
  %73 = call ptr @__ctype_b_loc() #13
  %74 = load ptr, ptr %73, align 8, !tbaa !9
  %75 = load ptr, ptr %3, align 8, !tbaa !9
  %76 = load i64, ptr %5, align 8, !tbaa !5
  %77 = getelementptr inbounds i8, ptr %75, i64 %76
  %78 = load i8, ptr %77, align 1, !tbaa !11
  %79 = zext i8 %78 to i32
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds i16, ptr %74, i64 %80
  %82 = load i16, ptr %81, align 2, !tbaa !14
  %83 = zext i16 %82 to i32
  %84 = and i32 %83, 2048
  %85 = sext i32 %84 to i64
  %86 = load i64, ptr %4, align 8, !tbaa !5
  %87 = add i64 %86, %85
  store i64 %87, ptr %4, align 8, !tbaa !5
  %88 = call ptr @__ctype_b_loc() #13
  %89 = load ptr, ptr %88, align 8, !tbaa !9
  %90 = load ptr, ptr %3, align 8, !tbaa !9
  %91 = load i64, ptr %5, align 8, !tbaa !5
  %92 = getelementptr inbounds i8, ptr %90, i64 %91
  %93 = load i8, ptr %92, align 1, !tbaa !11
  %94 = zext i8 %93 to i32
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds i16, ptr %89, i64 %95
  %97 = load i16, ptr %96, align 2, !tbaa !14
  %98 = zext i16 %97 to i32
  %99 = and i32 %98, 8192
  %100 = sext i32 %99 to i64
  %101 = load i64, ptr %4, align 8, !tbaa !5
  %102 = add i64 %101, %100
  store i64 %102, ptr %4, align 8, !tbaa !5
  %103 = call ptr @__ctype_b_loc() #13
  %104 = load ptr, ptr %103, align 8, !tbaa !9
  %105 = load ptr, ptr %3, align 8, !tbaa !9
  %106 = load i64, ptr %5, align 8, !tbaa !5
  %107 = getelementptr inbounds i8, ptr %105, i64 %106
  %108 = load i8, ptr %107, align 1, !tbaa !11
  %109 = zext i8 %108 to i32
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds i16, ptr %104, i64 %110
  %112 = load i16, ptr %111, align 2, !tbaa !14
  %113 = zext i16 %112 to i32
  %114 = and i32 %113, 16384
  %115 = sext i32 %114 to i64
  %116 = load i64, ptr %4, align 8, !tbaa !5
  %117 = add i64 %116, %115
  store i64 %117, ptr %4, align 8, !tbaa !5
  %118 = call ptr @__ctype_b_loc() #13
  %119 = load ptr, ptr %118, align 8, !tbaa !9
  %120 = load ptr, ptr %3, align 8, !tbaa !9
  %121 = load i64, ptr %5, align 8, !tbaa !5
  %122 = getelementptr inbounds i8, ptr %120, i64 %121
  %123 = load i8, ptr %122, align 1, !tbaa !11
  %124 = zext i8 %123 to i32
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds i16, ptr %119, i64 %125
  %127 = load i16, ptr %126, align 2, !tbaa !14
  %128 = zext i16 %127 to i32
  %129 = and i32 %128, 256
  %130 = icmp ne i32 %129, 0
  br i1 %130, label %131, label %174

131:                                              ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #10
  %132 = load ptr, ptr %3, align 8, !tbaa !9
  %133 = load i64, ptr %5, align 8, !tbaa !5
  %134 = getelementptr inbounds i8, ptr %132, i64 %133
  %135 = load i8, ptr %134, align 1, !tbaa !11
  %136 = zext i8 %135 to i32
  %137 = call i1 @llvm.is.constant.i32(i32 %136)
  br i1 %137, label %138, label %160

138:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #10
  %139 = load ptr, ptr %3, align 8, !tbaa !9
  %140 = load i64, ptr %5, align 8, !tbaa !5
  %141 = getelementptr inbounds i8, ptr %139, i64 %140
  %142 = load i8, ptr %141, align 1, !tbaa !11
  %143 = zext i8 %142 to i32
  store i32 %143, ptr %8, align 4, !tbaa !12
  %144 = load i32, ptr %8, align 4, !tbaa !12
  %145 = icmp slt i32 %144, -128
  br i1 %145, label %149, label %146

146:                                              ; preds = %138
  %147 = load i32, ptr %8, align 4, !tbaa !12
  %148 = icmp sgt i32 %147, 255
  br i1 %148, label %149, label %151

149:                                              ; preds = %146, %138
  %150 = load i32, ptr %8, align 4, !tbaa !12
  br label %158

151:                                              ; preds = %146
  %152 = call ptr @__ctype_tolower_loc() #13
  %153 = load ptr, ptr %152, align 8, !tbaa !9
  %154 = load i32, ptr %8, align 4, !tbaa !12
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds i32, ptr %153, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !12
  br label %158

158:                                              ; preds = %151, %149
  %159 = phi i32 [ %150, %149 ], [ %157, %151 ]
  store i32 %159, ptr %7, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #10
  br label %167

160:                                              ; preds = %131
  %161 = load ptr, ptr %3, align 8, !tbaa !9
  %162 = load i64, ptr %5, align 8, !tbaa !5
  %163 = getelementptr inbounds i8, ptr %161, i64 %162
  %164 = load i8, ptr %163, align 1, !tbaa !11
  %165 = zext i8 %164 to i32
  %166 = call i32 @tolower(i32 noundef %165) #14
  store i32 %166, ptr %7, align 4, !tbaa !12
  br label %167

167:                                              ; preds = %160, %158
  %168 = load i32, ptr %7, align 4, !tbaa !12
  store i32 %168, ptr %9, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #10
  %169 = load i32, ptr %9, align 4, !tbaa !12
  %170 = trunc i32 %169 to i8
  %171 = load ptr, ptr %3, align 8, !tbaa !9
  %172 = load i64, ptr %5, align 8, !tbaa !5
  %173 = getelementptr inbounds i8, ptr %171, i64 %172
  store i8 %170, ptr %173, align 1, !tbaa !11
  br label %232

174:                                              ; preds = %42
  %175 = call ptr @__ctype_b_loc() #13
  %176 = load ptr, ptr %175, align 8, !tbaa !9
  %177 = load ptr, ptr %3, align 8, !tbaa !9
  %178 = load i64, ptr %5, align 8, !tbaa !5
  %179 = getelementptr inbounds i8, ptr %177, i64 %178
  %180 = load i8, ptr %179, align 1, !tbaa !11
  %181 = zext i8 %180 to i32
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds i16, ptr %176, i64 %182
  %184 = load i16, ptr %183, align 2, !tbaa !14
  %185 = zext i16 %184 to i32
  %186 = and i32 %185, 512
  %187 = icmp ne i32 %186, 0
  br i1 %187, label %188, label %231

188:                                              ; preds = %174
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #10
  %189 = load ptr, ptr %3, align 8, !tbaa !9
  %190 = load i64, ptr %5, align 8, !tbaa !5
  %191 = getelementptr inbounds i8, ptr %189, i64 %190
  %192 = load i8, ptr %191, align 1, !tbaa !11
  %193 = zext i8 %192 to i32
  %194 = call i1 @llvm.is.constant.i32(i32 %193)
  br i1 %194, label %195, label %217

195:                                              ; preds = %188
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #10
  %196 = load ptr, ptr %3, align 8, !tbaa !9
  %197 = load i64, ptr %5, align 8, !tbaa !5
  %198 = getelementptr inbounds i8, ptr %196, i64 %197
  %199 = load i8, ptr %198, align 1, !tbaa !11
  %200 = zext i8 %199 to i32
  store i32 %200, ptr %11, align 4, !tbaa !12
  %201 = load i32, ptr %11, align 4, !tbaa !12
  %202 = icmp slt i32 %201, -128
  br i1 %202, label %206, label %203

203:                                              ; preds = %195
  %204 = load i32, ptr %11, align 4, !tbaa !12
  %205 = icmp sgt i32 %204, 255
  br i1 %205, label %206, label %208

206:                                              ; preds = %203, %195
  %207 = load i32, ptr %11, align 4, !tbaa !12
  br label %215

208:                                              ; preds = %203
  %209 = call ptr @__ctype_toupper_loc() #13
  %210 = load ptr, ptr %209, align 8, !tbaa !9
  %211 = load i32, ptr %11, align 4, !tbaa !12
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds i32, ptr %210, i64 %212
  %214 = load i32, ptr %213, align 4, !tbaa !12
  br label %215

215:                                              ; preds = %208, %206
  %216 = phi i32 [ %207, %206 ], [ %214, %208 ]
  store i32 %216, ptr %10, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #10
  br label %224

217:                                              ; preds = %188
  %218 = load ptr, ptr %3, align 8, !tbaa !9
  %219 = load i64, ptr %5, align 8, !tbaa !5
  %220 = getelementptr inbounds i8, ptr %218, i64 %219
  %221 = load i8, ptr %220, align 1, !tbaa !11
  %222 = zext i8 %221 to i32
  %223 = call i32 @toupper(i32 noundef %222) #14
  store i32 %223, ptr %10, align 4, !tbaa !12
  br label %224

224:                                              ; preds = %217, %215
  %225 = load i32, ptr %10, align 4, !tbaa !12
  store i32 %225, ptr %12, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #10
  %226 = load i32, ptr %12, align 4, !tbaa !12
  %227 = trunc i32 %226 to i8
  %228 = load ptr, ptr %3, align 8, !tbaa !9
  %229 = load i64, ptr %5, align 8, !tbaa !5
  %230 = getelementptr inbounds i8, ptr %228, i64 %229
  store i8 %227, ptr %230, align 1, !tbaa !11
  br label %231

231:                                              ; preds = %224, %174
  br label %232

232:                                              ; preds = %231, %167
  br label %233

233:                                              ; preds = %232
  %234 = load i64, ptr %5, align 8, !tbaa !5
  %235 = add i64 %234, 1
  store i64 %235, ptr %5, align 8, !tbaa !5
  br label %38, !llvm.loop !16

236:                                              ; preds = %38
  br label %237

237:                                              ; preds = %236
  %238 = load i32, ptr %6, align 4, !tbaa !12
  %239 = add nsw i32 %238, 1
  store i32 %239, ptr %6, align 4, !tbaa !12
  br label %33, !llvm.loop !18

240:                                              ; preds = %33
  call void (...) @bench_end()
  %241 = load ptr, ptr %3, align 8, !tbaa !9
  %242 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, ptr noundef %241)
  %243 = load ptr, ptr %3, align 8, !tbaa !9
  call void @free(ptr noundef %243) #10
  %244 = load volatile ptr, ptr @black_box, align 8, !tbaa !9
  call void %244(ptr noundef %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #10
  %245 = load i32, ptr %1, align 4
  ret i32 %245
}

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

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

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

declare void @bench_start(...) #5

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

; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)
declare i1 @llvm.is.constant.i32(i32) #7

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

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @tolower(i32 noundef) #8

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @toupper(i32 noundef) #8

declare void @bench_end(...) #5

; Function Attrs: nounwind
declare void @free(ptr noundef) #9

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


; 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 [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [93 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [55 x i8], align 1
@black_box = external hidden global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca ptr, align 8
  %2 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #11
  %3 = tail call noalias dereferenceable_or_null(50000) ptr @malloc(i64 noundef 50000) #12
  store ptr %3, ptr %1, align 8, !tbaa !5
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %4, label %5

4:                                                ; preds = %0
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 15, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #13
  unreachable

5:                                                ; preds = %0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #11
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(50000) %3, i8 120, i64 49999, i1 false)
  %6 = getelementptr inbounds i8, ptr %3, i64 49999
  store i8 0, ptr %6, align 1, !tbaa !9
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef 50000, i32 noundef 1000)
  tail call void (...) @bench_start() #11
  br label %8

8:                                                ; preds = %5, %40
  %9 = phi i64 [ 0, %5 ], [ %op.rdx49, %40 ]
  %.04147 = phi i32 [ 0, %5 ], [ %41, %40 ]
  %10 = load volatile ptr, ptr @black_box, align 8, !tbaa !5
  call void %10(ptr noundef nonnull %1) #11
  %11 = tail call ptr @__ctype_b_loc() #14
  br label %12

12:                                               ; preds = %8, %38
  %13 = phi i64 [ %9, %8 ], [ %op.rdx49, %38 ]
  %.046 = phi i64 [ 0, %8 ], [ %39, %38 ]
  %14 = load ptr, ptr %11, align 8, !tbaa !5
  %15 = load ptr, ptr %1, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %15, i64 %.046
  %17 = load i8, ptr %16, align 1, !tbaa !9
  %18 = zext i8 %17 to i64
  %19 = getelementptr inbounds i16, ptr %14, i64 %18
  %20 = load i16, ptr %19, align 2, !tbaa !10
  %21 = insertelement <4 x i16> poison, i16 %20, i64 0
  %22 = shufflevector <4 x i16> %21, <4 x i16> poison, <4 x i32> zeroinitializer
  %23 = and <4 x i16> %22, <i16 1024, i16 8, i16 2048, i16 8192>
  %24 = and i16 %20, 16384
  %25 = zext nneg i16 %24 to i64
  %26 = zext nneg <4 x i16> %23 to <4 x i64>
  %27 = call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %26)
  %op.rdx = add i64 %27, %25
  %op.rdx49 = add i64 %op.rdx, %13
  store i64 %op.rdx49, ptr %2, align 8, !tbaa !12
  %28 = zext i8 %17 to i32
  %29 = zext i16 %20 to i32
  %30 = and i32 %29, 256
  %.not44 = icmp eq i32 %30, 0
  br i1 %.not44, label %33, label %31

31:                                               ; preds = %12
  %32 = call i32 @tolower(i32 noundef %28) #15
  br label %.sink.split

33:                                               ; preds = %12
  %34 = and i32 %29, 512
  %.not45 = icmp eq i32 %34, 0
  br i1 %.not45, label %38, label %35

35:                                               ; preds = %33
  %36 = call i32 @toupper(i32 noundef %28) #15
  br label %.sink.split

.sink.split:                                      ; preds = %35, %31
  %.043.sink = phi i32 [ %32, %31 ], [ %36, %35 ]
  %37 = trunc i32 %.043.sink to i8
  store i8 %37, ptr %16, align 1, !tbaa !9
  br label %38

38:                                               ; preds = %.sink.split, %33
  %39 = add nuw nsw i64 %.046, 1
  %exitcond.not = icmp eq i64 %39, 50000
  br i1 %exitcond.not, label %40, label %12, !llvm.loop !14

40:                                               ; preds = %38
  %41 = add nuw nsw i32 %.04147, 1
  %exitcond48.not = icmp eq i32 %41, 1000
  br i1 %exitcond48.not, label %42, label %8, !llvm.loop !16

42:                                               ; preds = %40
  call void (...) @bench_end() #11
  %43 = load ptr, ptr %1, align 8, !tbaa !5
  %44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef %43)
  %45 = load ptr, ptr %1, align 8, !tbaa !5
  call void @free(ptr noundef %45) #11
  %46 = load volatile ptr, ptr @black_box, align 8, !tbaa !5
  call void %46(ptr noundef nonnull %2) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #11
  ret i32 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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

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

declare void @bench_start(...) local_unnamed_addr #6

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

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @tolower(i32 noundef) local_unnamed_addr #8

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @toupper(i32 noundef) local_unnamed_addr #8

declare void @bench_end(...) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #9

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v4i64(<4 x i64>) #10

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { noreturn 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { "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 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 #8 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #10 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #11 = { nounwind }
attributes #12 = { nounwind allocsize(0) }
attributes #13 = { noreturn nounwind }
attributes #14 = { nounwind willreturn memory(none) }
attributes #15 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopRotatePass,LoopUnrollPass,LowerConstantIntrinsicsPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass