; LLVM IR from wumo/vkg :: src/par/test (test_filecache)

; 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.6 = external hidden unnamed_addr constant [66 x i8], align 1
@_fileprefix = external hidden global [4096 x i8], align 16
@.str.8 = external hidden unnamed_addr constant [37 x i8], align 1
@__PRETTY_FUNCTION__.par_filecache_load = external hidden unnamed_addr constant [74 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [53 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: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #1

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

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

; Function Attrs: nounwind
declare ptr @strcat(ptr noundef, ptr noundef) #3

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

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @par_filecache_load(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4) #4 {
  %6 = alloca i1, align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca [4096 x i8], align 16
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i64, align 8
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4096, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = call i64 @strlen(ptr noundef %21) #8
  store i64 %22, ptr %13, align 8, !tbaa !11
  %23 = load i64, ptr %13, align 8, !tbaa !11
  %24 = icmp eq i64 %23, 0
  br i1 %24, label %25, label %26

25:                                               ; preds = %5
  store i1 false, ptr %6, align 1
  store i32 1, ptr %14, align 4
  br label %94

26:                                               ; preds = %5
  %27 = load i64, ptr %13, align 8, !tbaa !11
  %28 = call i64 @strlen(ptr noundef @_fileprefix) #8
  %29 = add i64 %27, %28
  %30 = icmp ult i64 %29, 4096
  br i1 %30, label %31, label %32

31:                                               ; preds = %26
  br label %33

32:                                               ; preds = %26
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.6, i32 noundef 190, ptr noundef @__PRETTY_FUNCTION__.par_filecache_load) #9
  unreachable

33:                                               ; preds = %31
  %34 = getelementptr inbounds [4096 x i8], ptr %12, i64 0, i64 0
  %35 = call ptr @strcpy(ptr noundef %34, ptr noundef @_fileprefix) #7
  %36 = getelementptr inbounds [4096 x i8], ptr %12, i64 0, i64 0
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = call ptr @strcat(ptr noundef %36, ptr noundef %37) #7
  %39 = getelementptr inbounds [4096 x i8], ptr %12, i64 0, i64 0
  %40 = call i32 @access(ptr noundef %39, i32 noundef 0) #7
  %41 = icmp eq i32 %40, -1
  br i1 %41, label %42, label %43

42:                                               ; preds = %33
  store i1 false, ptr %6, align 1
  store i32 1, ptr %14, align 4
  br label %94

43:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %44 = getelementptr inbounds [4096 x i8], ptr %12, i64 0, i64 0
  %45 = call noalias ptr @fopen(ptr noundef %44, ptr noundef @.str.9)
  store ptr %45, ptr %15, align 8, !tbaa !5
  %46 = load ptr, ptr %15, align 8, !tbaa !5
  %47 = icmp ne ptr %46, null
  br i1 %47, label %48, label %50

48:                                               ; preds = %43
  br i1 true, label %49, label %50

49:                                               ; preds = %48
  br label %51

50:                                               ; preds = %48, %43
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.6, i32 noundef 197, ptr noundef @__PRETTY_FUNCTION__.par_filecache_load) #9
  unreachable

51:                                               ; preds = %49
  %52 = load ptr, ptr %15, align 8, !tbaa !5
  %53 = call i32 @fseek(ptr noundef %52, i64 noundef 0, i32 noundef 2)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %54 = load ptr, ptr %15, align 8, !tbaa !5
  %55 = call i64 @ftell(ptr noundef %54)
  store i64 %55, ptr %16, align 8, !tbaa !11
  %56 = load ptr, ptr %15, align 8, !tbaa !5
  %57 = call i32 @fseek(ptr noundef %56, i64 noundef 0, i32 noundef 0)
  %58 = load i32, ptr %11, align 4, !tbaa !9
  %59 = icmp sgt i32 %58, 0
  br i1 %59, label %60, label %66

60:                                               ; preds = %51
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = load i32, ptr %11, align 4, !tbaa !9
  %63 = load ptr, ptr %15, align 8, !tbaa !5
  %64 = call zeroext i1 @par_filecache__read(ptr noundef %61, i32 noundef %62, ptr noundef %63)
  br i1 %64, label %66, label %65

65:                                               ; preds = %60
  store i1 false, ptr %6, align 1
  store i32 1, ptr %14, align 4
  br label %93

66:                                               ; preds = %60, %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %67 = load i64, ptr %16, align 8, !tbaa !11
  %68 = load i32, ptr %11, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = sub nsw i64 %67, %69
  store i64 %70, ptr %18, align 8, !tbaa !11
  %71 = load i64, ptr %18, align 8, !tbaa !11
  %72 = trunc i64 %71 to i32
  store i32 %72, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %73 = load i64, ptr %18, align 8, !tbaa !11
  %74 = call noalias ptr @malloc(i64 noundef %73) #10
  store ptr %74, ptr %19, align 8, !tbaa !5
  %75 = load ptr, ptr %19, align 8, !tbaa !5
  %76 = load i64, ptr %18, align 8, !tbaa !11
  %77 = trunc i64 %76 to i32
  %78 = load ptr, ptr %15, align 8, !tbaa !5
  %79 = call zeroext i1 @par_filecache__read(ptr noundef %75, i32 noundef %77, ptr noundef %78)
  br i1 %79, label %81, label %80

80:                                               ; preds = %66
  store i1 false, ptr %6, align 1
  store i32 1, ptr %14, align 4
  br label %92

81:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %82 = load ptr, ptr %19, align 8, !tbaa !5
  store ptr %82, ptr %20, align 8, !tbaa !5
  %83 = load ptr, ptr %15, align 8, !tbaa !5
  %84 = call i32 @fclose(ptr noundef %83)
  %85 = load ptr, ptr %20, align 8, !tbaa !5
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %85, ptr %86, align 8, !tbaa !5
  %87 = load i32, ptr %17, align 4, !tbaa !9
  %88 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %87, ptr %88, align 4, !tbaa !9
  %89 = load ptr, ptr %7, align 8, !tbaa !5
  %90 = load i64, ptr %18, align 8, !tbaa !11
  %91 = trunc i64 %90 to i32
  call void @_update_table(ptr noundef %89, i32 noundef %91)
  store i1 true, ptr %6, align 1
  store i32 1, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %92

92:                                               ; preds = %81, %80
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %93

93:                                               ; preds = %92, %65
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  br label %94

94:                                               ; preds = %93, %42, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4096, ptr %12) #7
  %95 = load i1, ptr %6, align 1
  ret i1 %95
}

; Function Attrs: nounwind
declare i32 @access(ptr noundef, i32 noundef) #3

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

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

declare i64 @ftell(ptr noundef) #5

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @par_filecache__read(ptr noundef, i32 noundef, ptr noundef) #4

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

declare i32 @fclose(ptr noundef) #5

; Function Attrs: nounwind uwtable
declare hidden void @_update_table(ptr noundef, i32 noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 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 = { "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 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind allocsize(0) }

!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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}


; 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.6 = external hidden unnamed_addr constant [66 x i8], align 1
@_fileprefix = external hidden global [4096 x i8], align 16
@.str.8 = external hidden unnamed_addr constant [37 x i8], align 1
@__PRETTY_FUNCTION__.par_filecache_load = external hidden unnamed_addr constant [74 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [53 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 nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #1

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

; 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 #3

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @par_filecache_load(ptr noundef %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef writeonly %2, ptr noundef %3, i32 noundef %4) local_unnamed_addr #4 {
  %6 = alloca [4096 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %6) #7
  %7 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #8
  %8 = icmp eq i64 %7, 0
  br i1 %8, label %37, label %9

9:                                                ; preds = %5
  %10 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @_fileprefix) #8
  %11 = add i64 %10, %7
  %12 = icmp ult i64 %11, 4096
  br i1 %12, label %14, label %13

13:                                               ; preds = %9
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.6, i32 noundef 190, ptr noundef nonnull @__PRETTY_FUNCTION__.par_filecache_load) #9
  unreachable

14:                                               ; preds = %9
  %15 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @_fileprefix) #7
  %16 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) %0) #7
  %17 = call i32 @access(ptr noundef nonnull %6, i32 noundef 0) #7
  %18 = icmp eq i32 %17, -1
  br i1 %18, label %37, label %19

19:                                               ; preds = %14
  %20 = call noalias ptr @fopen(ptr noundef nonnull %6, ptr noundef nonnull @.str.9)
  %.not = icmp eq ptr %20, null
  br i1 %.not, label %21, label %22

21:                                               ; preds = %19
  call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.6, i32 noundef 197, ptr noundef nonnull @__PRETTY_FUNCTION__.par_filecache_load) #9
  unreachable

22:                                               ; preds = %19
  %23 = call i32 @fseek(ptr noundef nonnull %20, i64 noundef 0, i32 noundef 2)
  %24 = call i64 @ftell(ptr noundef nonnull %20)
  %25 = call i32 @fseek(ptr noundef nonnull %20, i64 noundef 0, i32 noundef 0)
  %26 = icmp sgt i32 %4, 0
  br i1 %26, label %27, label %29

27:                                               ; preds = %22
  %28 = call zeroext i1 @par_filecache__read(ptr noundef %3, i32 noundef %4, ptr noundef nonnull %20)
  br i1 %28, label %29, label %37

29:                                               ; preds = %27, %22
  %30 = sext i32 %4 to i64
  %31 = sub nsw i64 %24, %30
  %32 = trunc i64 %31 to i32
  %33 = call noalias ptr @malloc(i64 noundef %31) #10
  %34 = call zeroext i1 @par_filecache__read(ptr noundef %33, i32 noundef %32, ptr noundef nonnull %20)
  br i1 %34, label %35, label %37

35:                                               ; preds = %29
  %36 = call i32 @fclose(ptr noundef nonnull %20)
  store ptr %33, ptr %1, align 8, !tbaa !5
  store i32 %32, ptr %2, align 4, !tbaa !9
  call void @_update_table(ptr noundef %0, i32 noundef %32)
  br label %37

37:                                               ; preds = %27, %29, %35, %14, %5
  %.2 = phi i1 [ false, %5 ], [ false, %14 ], [ false, %27 ], [ false, %29 ], [ true, %35 ]
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %6) #7
  ret i1 %.2
}

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @par_filecache__read(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #6

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

; Function Attrs: nounwind uwtable
declare hidden void @_update_table(ptr noundef, i32 noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 #4 = { 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 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind allocsize(0) }

!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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass