; LLVM IR from MQCPack/mqcPack :: src (mqc_util)

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

@EndOfString = external dso_local global [8 x i8], align 1
@mqc_scratch_dir = external dso_local global [2048 x i8], align 16
@.str.23 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [8 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
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #1

declare void @mqc_error_i_c2f_0(ptr noundef, ptr noundef) #2

; 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 i32 @mqc_ASCII_or_Binary(ptr noundef %0, ptr noundef %1, i32 noundef %2) #3 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca [1024 x i8], align 16
  %9 = alloca ptr, align 8
  %10 = alloca [2048 x i8], align 16
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1024, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 2048, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store ptr null, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store ptr null, ptr %9, align 8, !tbaa !5
  %18 = call i32 @getpid() #4
  store i32 %18, ptr %14, align 4, !tbaa !9
  %19 = load i32, ptr %7, align 4, !tbaa !9
  call void @mqc_get_scratch_dir(i32 noundef %19)
  %20 = getelementptr inbounds [1024 x i8], ptr %8, i64 0, i64 0
  %21 = load i32, ptr %14, align 4, !tbaa !9
  %22 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %20, ptr noundef @.str.27, ptr noundef @mqc_scratch_dir, i32 noundef %21) #4
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds [1024 x i8], ptr %8, i64 0, i64 0
  %26 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %23, ptr noundef @.str.28, ptr noundef %24, ptr noundef %25) #4
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = call i32 @system(ptr noundef %27)
  store i32 %28, ptr %16, align 4, !tbaa !9
  %29 = load i32, ptr %16, align 4, !tbaa !9
  %30 = icmp eq i32 %29, -1
  br i1 %30, label %31, label %50

31:                                               ; preds = %3
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = call noalias ptr @fopen(ptr noundef %32, ptr noundef @.str.23)
  store ptr %33, ptr %12, align 8, !tbaa !5
  %34 = load ptr, ptr %12, align 8, !tbaa !5
  %35 = icmp eq ptr %34, null
  br i1 %35, label %36, label %40

36:                                               ; preds = %31
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %37, ptr noundef @.str.29, ptr noundef %38, ptr noundef @EndOfString) #4
  br label %44

40:                                               ; preds = %31
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %41, ptr noundef @.str.30, ptr noundef %42, ptr noundef @EndOfString) #4
  br label %44

44:                                               ; preds = %40, %36
  %45 = load ptr, ptr %12, align 8, !tbaa !5
  %46 = call i32 @fclose(ptr noundef %45)
  store i32 %46, ptr %13, align 4, !tbaa !9
  %47 = getelementptr inbounds [1024 x i8], ptr %8, i64 0, i64 0
  %48 = call i32 @unlink(ptr noundef %47) #4
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  call void @mqc_error_i_c2f_0(ptr noundef %49, ptr noundef %7)
  br label %50

50:                                               ; preds = %44, %3
  %51 = getelementptr inbounds [1024 x i8], ptr %8, i64 0, i64 0
  %52 = call noalias ptr @fopen(ptr noundef %51, ptr noundef @.str.23)
  store ptr %52, ptr %11, align 8, !tbaa !5
  %53 = load ptr, ptr %11, align 8, !tbaa !5
  %54 = icmp eq ptr %53, null
  br i1 %54, label %55, label %60

55:                                               ; preds = %50
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = getelementptr inbounds [1024 x i8], ptr %8, i64 0, i64 0
  %58 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %56, ptr noundef @.str.31, ptr noundef %57, ptr noundef @EndOfString) #4
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  call void @mqc_error_i_c2f_0(ptr noundef %59, ptr noundef %7)
  br label %60

60:                                               ; preds = %55, %50
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = load ptr, ptr %11, align 8, !tbaa !5
  %63 = call ptr @fgets(ptr noundef %61, i32 noundef 1024, ptr noundef %62)
  store ptr %63, ptr %9, align 8, !tbaa !5
  %64 = load ptr, ptr %11, align 8, !tbaa !5
  %65 = call i32 @fclose(ptr noundef %64)
  store i32 %65, ptr %13, align 4, !tbaa !9
  store ptr null, ptr %11, align 8, !tbaa !5
  %66 = getelementptr inbounds [1024 x i8], ptr %8, i64 0, i64 0
  %67 = call i32 @unlink(ptr noundef %66) #4
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = call i32 @mqc_FINDstrINline(ptr noundef @.str.32, ptr noundef %68)
  %70 = icmp eq i32 -1, %69
  br i1 %70, label %71, label %72

71:                                               ; preds = %60
  store i32 1, ptr %4, align 4
  store i32 1, ptr %17, align 4
  br label %73

72:                                               ; preds = %60
  store i32 0, ptr %4, align 4
  store i32 1, ptr %17, align 4
  br label %73

73:                                               ; preds = %72, %71
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 2048, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 1024, ptr %8) #4
  %74 = load i32, ptr %4, align 4
  ret i32 %74
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @mqc_FINDstrINline(ptr noundef, ptr noundef) #3

declare i32 @system(ptr noundef) #2

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

declare i32 @fclose(ptr noundef) #2

; Function Attrs: nounwind
declare i32 @getpid() #1

; Function Attrs: nounwind uwtable
declare dso_local void @mqc_get_scratch_dir(i32 noundef) #3

; Function Attrs: nounwind
declare i32 @unlink(ptr noundef) #1

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { "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 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 #4 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !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"

@EndOfString = external dso_local global [8 x i8], align 1
@mqc_scratch_dir = external dso_local global [2048 x i8], align 16
@.str.23 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [8 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: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

declare void @mqc_error_i_c2f_0(ptr noundef, ptr noundef) local_unnamed_addr #2

; 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 range(i32 0, 2) i32 @mqc_ASCII_or_Binary(ptr noundef %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #3 {
  %4 = alloca i32, align 4
  %5 = alloca [1024 x i8], align 16
  store i32 %2, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %5) #6
  %6 = tail call i32 @getpid() #6
  tail call void @mqc_get_scratch_dir(i32 noundef %2)
  %7 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %5, ptr noundef nonnull dereferenceable(1) @.str.27, ptr noundef nonnull @mqc_scratch_dir, i32 noundef %6) #6
  %8 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) @.str.28, ptr noundef %0, ptr noundef nonnull %5) #6
  %9 = call i32 @system(ptr noundef %1) #6
  %10 = icmp eq i32 %9, -1
  br i1 %10, label %11, label %17

11:                                               ; preds = %3
  %12 = call noalias ptr @fopen(ptr noundef %0, ptr noundef nonnull @.str.23)
  %13 = icmp eq ptr %12, null
  %.str.29..str.30 = select i1 %13, ptr @.str.29, ptr @.str.30
  %14 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %.str.29..str.30, ptr noundef %0, ptr noundef nonnull @EndOfString) #6
  %15 = call i32 @fclose(ptr noundef %12)
  %16 = call i32 @unlink(ptr noundef nonnull %5) #6
  call void @mqc_error_i_c2f_0(ptr noundef %1, ptr noundef nonnull %4) #6
  br label %17

17:                                               ; preds = %11, %3
  %18 = call noalias ptr @fopen(ptr noundef nonnull %5, ptr noundef nonnull @.str.23)
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %22

20:                                               ; preds = %17
  %21 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) @.str.31, ptr noundef nonnull %5, ptr noundef nonnull @EndOfString) #6
  call void @mqc_error_i_c2f_0(ptr noundef %1, ptr noundef nonnull %4) #6
  br label %22

22:                                               ; preds = %20, %17
  %23 = call ptr @fgets(ptr noundef %1, i32 noundef 1024, ptr noundef %18)
  %24 = call i32 @fclose(ptr noundef %18)
  %25 = call i32 @unlink(ptr noundef nonnull %5) #6
  %26 = call i32 @mqc_FINDstrINline(ptr noundef nonnull @.str.32, ptr noundef %1)
  %27 = icmp eq i32 %26, -1
  %. = zext i1 %27 to i32
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %5) #6
  ret i32 %.
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @mqc_FINDstrINline(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nofree
declare noundef i32 @system(ptr nocapture noundef readonly) local_unnamed_addr #4

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

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

; Function Attrs: nounwind
declare i32 @getpid() local_unnamed_addr #5

; Function Attrs: nounwind uwtable
declare dso_local void @mqc_get_scratch_dir(i32 noundef) local_unnamed_addr #3

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

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

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

!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/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass