; LLVM IR from ChenyangZhang-cs/iMLBench :: KNN/co-run&zero-copy/clutils.ll (Z17cl_compileProgramPcS_b)

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

@_ZL6device = external hidden global ptr, align 8
@_ZL7context = external hidden global ptr, align 8
@.str.30 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [19 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z9cl_errChkiPKcb(i32 noundef, ptr noundef, i1 noundef zeroext) #1

declare noundef ptr @_Z5allocm(i64 noundef) #2

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #3

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare i32 @getchar() #5

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_Z17cl_compileProgramPcS_b(ptr noundef %0, ptr noundef %1, i1 noundef zeroext %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i64, align 8
  %18 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  %19 = zext i1 %2 to i8
  store i8 %19, ptr %7, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store ptr null, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store ptr null, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = call noalias ptr @fopen(ptr noundef %20, ptr noundef @.str.30)
  store ptr %21, ptr %9, align 8, !tbaa !5
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = icmp ne ptr %22, null
  br i1 %23, label %26, label %24

24:                                               ; preds = %3
  %25 = call i32 (ptr, ...) @printf(ptr noundef @.str.31)
  call void @exit(i32 noundef -1) #7
  unreachable

26:                                               ; preds = %3
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = call i32 @fseek(ptr noundef %27, i64 noundef 0, i32 noundef 2)
  store i32 %28, ptr %8, align 4, !tbaa !11
  %29 = load i32, ptr %8, align 4, !tbaa !11
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %33

31:                                               ; preds = %26
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str.32)
  call void @exit(i32 noundef -1) #7
  unreachable

33:                                               ; preds = %26
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = call i64 @ftell(ptr noundef %34)
  store i64 %35, ptr %11, align 8, !tbaa !13
  %36 = load i64, ptr %11, align 8, !tbaa !13
  %37 = icmp slt i64 %36, 0
  br i1 %37, label %38, label %40

38:                                               ; preds = %33
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str.33)
  call void @exit(i32 noundef -1) #7
  unreachable

40:                                               ; preds = %33
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  call void @rewind(ptr noundef %41)
  %42 = load i64, ptr %11, align 8, !tbaa !13
  %43 = add nsw i64 %42, 1
  %44 = call noundef ptr @_Z5allocm(i64 noundef %43)
  store ptr %44, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !11
  br label %45

45:                                               ; preds = %57, %40
  %46 = load i32, ptr %12, align 4, !tbaa !11
  %47 = sext i32 %46 to i64
  %48 = load i64, ptr %11, align 8, !tbaa !13
  %49 = add nsw i64 %48, 1
  %50 = icmp slt i64 %47, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %60

52:                                               ; preds = %45
  %53 = load ptr, ptr %10, align 8, !tbaa !5
  %54 = load i32, ptr %12, align 4, !tbaa !11
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i8, ptr %53, i64 %55
  store i8 0, ptr %56, align 1, !tbaa !15
  br label %57

57:                                               ; preds = %52
  %58 = load i32, ptr %12, align 4, !tbaa !11
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %12, align 4, !tbaa !11
  br label %45, !llvm.loop !16

60:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = load i64, ptr %11, align 8, !tbaa !13
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  %64 = call i64 @fread(ptr noundef %61, i64 noundef 1, i64 noundef %62, ptr noundef %63)
  store i64 %64, ptr %13, align 8, !tbaa !13
  %65 = load ptr, ptr %10, align 8, !tbaa !5
  %66 = load i64, ptr %11, align 8, !tbaa !13
  %67 = getelementptr inbounds i8, ptr %65, i64 %66
  store i8 0, ptr %67, align 1, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %68 = load ptr, ptr @_ZL7context, align 8, !tbaa !5
  %69 = call ptr @clCreateProgramWithSource(ptr noundef %68, i32 noundef 1, ptr noundef %10, ptr noundef null, ptr noundef %8)
  store ptr %69, ptr %14, align 8, !tbaa !5
  %70 = load i32, ptr %8, align 4, !tbaa !11
  %71 = call noundef i32 @_Z9cl_errChkiPKcb(i32 noundef %70, ptr noundef @.str.34, i1 noundef zeroext true)
  %72 = load ptr, ptr %10, align 8, !tbaa !5
  call void @free(ptr noundef %72) #6
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  %74 = call i32 @fclose(ptr noundef %73)
  %75 = load ptr, ptr %14, align 8, !tbaa !5
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = call i32 @clBuildProgram(ptr noundef %75, i32 noundef 0, ptr noundef null, ptr noundef %76, ptr noundef null, ptr noundef null)
  store i32 %77, ptr %8, align 4, !tbaa !11
  %78 = load i32, ptr %8, align 4, !tbaa !11
  %79 = call noundef i32 @_Z9cl_errChkiPKcb(i32 noundef %78, ptr noundef @.str.35, i1 noundef zeroext false)
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %86, label %81

81:                                               ; preds = %60
  %82 = load i8, ptr %7, align 1, !tbaa !9, !range !18, !noundef !19
  %83 = trunc i8 %82 to i1
  %84 = zext i1 %83 to i32
  %85 = icmp eq i32 %84, 1
  br i1 %85, label %86, label %126

86:                                               ; preds = %81, %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %87 = load ptr, ptr %14, align 8, !tbaa !5
  %88 = load ptr, ptr @_ZL6device, align 8, !tbaa !5
  %89 = call i32 @clGetProgramBuildInfo(ptr noundef %87, ptr noundef %88, i32 noundef 4481, i64 noundef 4, ptr noundef %15, ptr noundef null)
  %90 = load i32, ptr %15, align 4, !tbaa !11
  %91 = icmp eq i32 %90, 0
  br i1 %91, label %92, label %99

92:                                               ; preds = %86
  %93 = load i8, ptr %7, align 1, !tbaa !9, !range !18, !noundef !19
  %94 = trunc i8 %93 to i1
  %95 = zext i1 %94 to i32
  %96 = icmp eq i32 %95, 0
  br i1 %96, label %97, label %99

97:                                               ; preds = %92
  %98 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %98, ptr %4, align 8
  store i32 1, ptr %16, align 4
  br label %125

99:                                               ; preds = %92, %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %100 = load ptr, ptr @_ZL6device, align 8, !tbaa !5
  %101 = call i32 (ptr, ...) @printf(ptr noundef @.str.36, ptr noundef %100)
  %102 = load ptr, ptr %14, align 8, !tbaa !5
  %103 = load ptr, ptr @_ZL6device, align 8, !tbaa !5
  %104 = call i32 @clGetProgramBuildInfo(ptr noundef %102, ptr noundef %103, i32 noundef 4483, i64 noundef 0, ptr noundef null, ptr noundef %17)
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %105 = load i64, ptr %17, align 8, !tbaa !13
  %106 = add i64 %105, 1
  %107 = call noundef ptr @_Z5allocm(i64 noundef %106)
  store ptr %107, ptr %18, align 8, !tbaa !5
  %108 = load ptr, ptr %14, align 8, !tbaa !5
  %109 = load ptr, ptr @_ZL6device, align 8, !tbaa !5
  %110 = load i64, ptr %17, align 8, !tbaa !13
  %111 = add i64 %110, 1
  %112 = load ptr, ptr %18, align 8, !tbaa !5
  %113 = call i32 @clGetProgramBuildInfo(ptr noundef %108, ptr noundef %109, i32 noundef 4483, i64 noundef %111, ptr noundef %112, ptr noundef null)
  %114 = load ptr, ptr %18, align 8, !tbaa !5
  %115 = load i64, ptr %17, align 8, !tbaa !13
  %116 = getelementptr inbounds i8, ptr %114, i64 %115
  store i8 0, ptr %116, align 1, !tbaa !15
  %117 = load ptr, ptr %18, align 8, !tbaa !5
  %118 = call i32 (ptr, ...) @printf(ptr noundef @.str.37, ptr noundef %117)
  %119 = load i32, ptr %15, align 4, !tbaa !11
  %120 = icmp ne i32 %119, 0
  br i1 %120, label %121, label %123

121:                                              ; preds = %99
  %122 = call i32 @getchar()
  call void @exit(i32 noundef -1) #7
  unreachable

123:                                              ; preds = %99
  %124 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %124, ptr %4, align 8
  store i32 1, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %125

125:                                              ; preds = %123, %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %128

126:                                              ; preds = %81
  %127 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %127, ptr %4, align 8
  store i32 1, ptr %16, align 4
  br label %128

128:                                              ; preds = %126, %125
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  %129 = load ptr, ptr %4, align 8
  ret ptr %129
}

declare noalias ptr @fopen(ptr noundef, ptr noundef) #2

declare i32 @fseek(ptr noundef, i64 noundef, i32 noundef) #2

declare i64 @ftell(ptr noundef) #2

declare void @rewind(ptr noundef) #2

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #2

declare ptr @clCreateProgramWithSource(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @fclose(ptr noundef) #2

declare i32 @clBuildProgram(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @clGetProgramBuildInfo(ptr noundef, ptr noundef, i32 noundef, i64 noundef, ptr noundef, ptr noundef) #2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{i8 0, i8 2}
!19 = !{}


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

@_ZL6device = external hidden local_unnamed_addr global ptr, align 8
@_ZL7context = external hidden local_unnamed_addr global ptr, align 8
@.str.30 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [19 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z9cl_errChkiPKcb(i32 noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #1

declare noundef ptr @_Z5allocm(i64 noundef) local_unnamed_addr #2

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #4

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_Z17cl_compileProgramPcS_b(ptr nocapture noundef readonly %0, ptr noundef %1, i1 noundef zeroext %2) local_unnamed_addr #1 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %8 = tail call noalias ptr @fopen(ptr noundef %0, ptr noundef nonnull @.str.30)
  %.not = icmp eq ptr %8, null
  br i1 %.not, label %9, label %11

9:                                                ; preds = %3
  %10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.31)
  tail call void @exit(i32 noundef -1) #8
  unreachable

11:                                               ; preds = %3
  %12 = tail call i32 @fseek(ptr noundef nonnull %8, i64 noundef 0, i32 noundef 2)
  store i32 %12, ptr %4, align 4, !tbaa !5
  %.not31 = icmp eq i32 %12, 0
  br i1 %.not31, label %15, label %13

13:                                               ; preds = %11
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.32)
  tail call void @exit(i32 noundef -1) #8
  unreachable

15:                                               ; preds = %11
  %16 = tail call i64 @ftell(ptr noundef nonnull %8)
  %17 = icmp slt i64 %16, 0
  br i1 %17, label %18, label %iter.check

18:                                               ; preds = %15
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.33)
  tail call void @exit(i32 noundef -1) #8
  unreachable

iter.check:                                       ; preds = %15
  tail call void @rewind(ptr noundef nonnull %8)
  %20 = add nuw i64 %16, 1
  %21 = tail call noundef ptr @_Z5allocm(i64 noundef %20)
  store ptr %21, ptr %5, align 8, !tbaa !9
  %22 = add nuw i64 %16, 1
  %min.iters.check = icmp ult i64 %16, 7
  br i1 %min.iters.check, label %vec.epilog.scalar.ph.preheader, label %vector.main.loop.iter.check

vector.main.loop.iter.check:                      ; preds = %iter.check
  %min.iters.check39 = icmp ult i64 %16, 31
  br i1 %min.iters.check39, label %vec.epilog.ph, label %vector.ph

vector.ph:                                        ; preds = %vector.main.loop.iter.check
  %n.vec = and i64 %22, -32
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %23 = getelementptr inbounds i8, ptr %21, i64 %index
  %24 = getelementptr inbounds i8, ptr %23, i64 16
  store <16 x i8> zeroinitializer, ptr %23, align 1, !tbaa !11
  store <16 x i8> zeroinitializer, ptr %24, align 1, !tbaa !11
  %index.next = add nuw i64 %index, 32
  %25 = icmp eq i64 %index.next, %n.vec
  br i1 %25, label %middle.block, label %vector.body, !llvm.loop !12

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %22, %n.vec
  br i1 %cmp.n, label %.loopexit, label %vec.epilog.iter.check

vec.epilog.iter.check:                            ; preds = %middle.block
  %n.vec.remaining = and i64 %22, 24
  %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
  br i1 %min.epilog.iters.check, label %vec.epilog.scalar.ph.preheader, label %vec.epilog.ph

vec.epilog.scalar.ph.preheader:                   ; preds = %vec.epilog.middle.block, %iter.check, %vec.epilog.iter.check
  %indvars.iv.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec41, %vec.epilog.middle.block ]
  br label %vec.epilog.scalar.ph

vec.epilog.ph:                                    ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
  %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
  %n.vec41 = and i64 %22, -8
  br label %vec.epilog.vector.body

vec.epilog.vector.body:                           ; preds = %vec.epilog.vector.body, %vec.epilog.ph
  %index42 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next43, %vec.epilog.vector.body ]
  %26 = getelementptr inbounds i8, ptr %21, i64 %index42
  store <8 x i8> zeroinitializer, ptr %26, align 1, !tbaa !11
  %index.next43 = add nuw i64 %index42, 8
  %27 = icmp eq i64 %index.next43, %n.vec41
  br i1 %27, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !16

vec.epilog.middle.block:                          ; preds = %vec.epilog.vector.body
  %cmp.n44 = icmp eq i64 %22, %n.vec41
  br i1 %cmp.n44, label %.loopexit, label %vec.epilog.scalar.ph.preheader

.loopexit:                                        ; preds = %vec.epilog.scalar.ph, %vec.epilog.middle.block, %middle.block
  %28 = tail call i64 @fread(ptr noundef nonnull %21, i64 noundef 1, i64 noundef %16, ptr noundef nonnull %8)
  %29 = getelementptr inbounds i8, ptr %21, i64 %16
  store i8 0, ptr %29, align 1, !tbaa !11
  %30 = load ptr, ptr @_ZL7context, align 8, !tbaa !9
  %31 = call ptr @clCreateProgramWithSource(ptr noundef %30, i32 noundef 1, ptr noundef nonnull %5, ptr noundef null, ptr noundef nonnull %4)
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = call noundef i32 @_Z9cl_errChkiPKcb(i32 noundef %32, ptr noundef nonnull @.str.34, i1 noundef zeroext true)
  %34 = load ptr, ptr %5, align 8, !tbaa !9
  call void @free(ptr noundef %34) #7
  %35 = call i32 @fclose(ptr noundef nonnull %8)
  %36 = call i32 @clBuildProgram(ptr noundef %31, i32 noundef 0, ptr noundef null, ptr noundef %1, ptr noundef null, ptr noundef null)
  store i32 %36, ptr %4, align 4, !tbaa !5
  %37 = call noundef i32 @_Z9cl_errChkiPKcb(i32 noundef %36, ptr noundef nonnull @.str.35, i1 noundef zeroext false)
  %.not33 = icmp ne i32 %37, 0
  %brmerge = or i1 %.not33, %2
  br i1 %brmerge, label %39, label %64

vec.epilog.scalar.ph:                             ; preds = %vec.epilog.scalar.ph.preheader, %vec.epilog.scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %vec.epilog.scalar.ph ], [ %indvars.iv.ph, %vec.epilog.scalar.ph.preheader ]
  %38 = getelementptr inbounds i8, ptr %21, i64 %indvars.iv
  store i8 0, ptr %38, align 1, !tbaa !11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond = icmp eq i64 %indvars.iv, %16
  br i1 %exitcond, label %.loopexit, label %vec.epilog.scalar.ph, !llvm.loop !17

39:                                               ; preds = %.loopexit
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %40 = load ptr, ptr @_ZL6device, align 8, !tbaa !9
  %41 = call i32 @clGetProgramBuildInfo(ptr noundef %31, ptr noundef %40, i32 noundef 4481, i64 noundef 4, ptr noundef nonnull %6, ptr noundef null)
  %42 = load i32, ptr %6, align 4, !tbaa !5
  %43 = icmp ne i32 %42, 0
  %brmerge36 = or i1 %43, %2
  br i1 %brmerge36, label %44, label %63

44:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %45 = load ptr, ptr @_ZL6device, align 8, !tbaa !9
  %46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.36, ptr noundef %45)
  %47 = load ptr, ptr @_ZL6device, align 8, !tbaa !9
  %48 = call i32 @clGetProgramBuildInfo(ptr noundef %31, ptr noundef %47, i32 noundef 4483, i64 noundef 0, ptr noundef null, ptr noundef nonnull %7)
  %49 = load i64, ptr %7, align 8, !tbaa !18
  %50 = add i64 %49, 1
  %51 = call noundef ptr @_Z5allocm(i64 noundef %50)
  %52 = load ptr, ptr @_ZL6device, align 8, !tbaa !9
  %53 = load i64, ptr %7, align 8, !tbaa !18
  %54 = add i64 %53, 1
  %55 = call i32 @clGetProgramBuildInfo(ptr noundef %31, ptr noundef %52, i32 noundef 4483, i64 noundef %54, ptr noundef %51, ptr noundef null)
  %56 = load i64, ptr %7, align 8, !tbaa !18
  %57 = getelementptr inbounds i8, ptr %51, i64 %56
  store i8 0, ptr %57, align 1, !tbaa !11
  %58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.37, ptr noundef %51)
  %59 = load i32, ptr %6, align 4, !tbaa !5
  %.not34 = icmp eq i32 %59, 0
  br i1 %.not34, label %62, label %60

60:                                               ; preds = %44
  %61 = call i32 @getchar()
  call void @exit(i32 noundef -1) #8
  unreachable

62:                                               ; preds = %44
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  br label %63

63:                                               ; preds = %39, %62
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  br label %64

64:                                               ; preds = %.loopexit, %63
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  ret ptr %31
}

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @fseek(ptr nocapture noundef, i64 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i64 @ftell(ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare void @rewind(ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #3

declare ptr @clCreateProgramWithSource(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #3

declare i32 @clBuildProgram(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @clGetProgramBuildInfo(ptr noundef, ptr noundef, i32 noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13, !14, !15}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !13, !14, !15}
!17 = distinct !{!17, !13, !15, !14}
!18 = !{!19, !19, i64 0}
!19 = !{!"long", !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopLoadEliminationPass,LoopRotatePass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass