; LLVM IR from sfu-dis/mosaicdb :: benchmarks/egen/EGenVersion.ll (ZN4TPCE20GetEGenVersionStringEPcm)

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

@_ZN4TPCEL17iEGenMajorVersionE = external hidden global i32, align 4
@_ZN4TPCEL17iEGenMinorVersionE = external hidden global i32, align 4
@_ZN4TPCEL19iEGenRevisionNumberE = external hidden global i32, align 4
@_ZN4TPCEL14iEGenBetaLevelE = external hidden global i32, align 4
@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4TPCE20GetEGenVersionStringEPcm(ptr noundef %0, i64 noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  %5 = load i32, ptr @_ZN4TPCEL14iEGenBetaLevelE, align 4, !tbaa !11
  %6 = icmp eq i32 %5, 0
  br i1 %6, label %7, label %14

7:                                                ; preds = %2
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = load i64, ptr %4, align 8, !tbaa !9
  %10 = load i32, ptr @_ZN4TPCEL17iEGenMajorVersionE, align 4, !tbaa !11
  %11 = load i32, ptr @_ZN4TPCEL17iEGenMinorVersionE, align 4, !tbaa !11
  %12 = load i32, ptr @_ZN4TPCEL19iEGenRevisionNumberE, align 4, !tbaa !11
  %13 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %8, i64 noundef %9, ptr noundef @.str, i32 noundef %10, i32 noundef %11, i32 noundef %12) #2
  br label %22

14:                                               ; preds = %2
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = load i64, ptr %4, align 8, !tbaa !9
  %17 = load i32, ptr @_ZN4TPCEL17iEGenMajorVersionE, align 4, !tbaa !11
  %18 = load i32, ptr @_ZN4TPCEL17iEGenMinorVersionE, align 4, !tbaa !11
  %19 = load i32, ptr @_ZN4TPCEL19iEGenRevisionNumberE, align 4, !tbaa !11
  %20 = load i32, ptr @_ZN4TPCEL14iEGenBetaLevelE, align 4, !tbaa !11
  %21 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %15, i64 noundef %16, ptr noundef @.str.1, i32 noundef %17, i32 noundef %18, i32 noundef %19, i32 noundef %20) #2
  br label %22

22:                                               ; preds = %14, %7
  ret void
}

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #1

attributes #0 = { mustprogress 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 = { 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 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"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"

@_ZN4TPCEL17iEGenMajorVersionE = external hidden local_unnamed_addr global i32, align 4
@_ZN4TPCEL17iEGenMinorVersionE = external hidden local_unnamed_addr global i32, align 4
@_ZN4TPCEL19iEGenRevisionNumberE = external hidden local_unnamed_addr global i32, align 4
@_ZN4TPCEL14iEGenBetaLevelE = external hidden local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: mustprogress nofree nounwind uwtable
define dso_local void @_ZN4TPCE20GetEGenVersionStringEPcm(ptr nocapture noundef writeonly %0, i64 noundef %1) local_unnamed_addr #0 {
  %3 = load i32, ptr @_ZN4TPCEL14iEGenBetaLevelE, align 4, !tbaa !5
  %4 = icmp eq i32 %3, 0
  %5 = load i32, ptr @_ZN4TPCEL17iEGenMajorVersionE, align 4, !tbaa !5
  %6 = load i32, ptr @_ZN4TPCEL17iEGenMinorVersionE, align 4, !tbaa !5
  %7 = load i32, ptr @_ZN4TPCEL19iEGenRevisionNumberE, align 4, !tbaa !5
  br i1 %4, label %8, label %10

8:                                                ; preds = %2
  %9 = tail call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %0, i64 noundef %1, ptr noundef nonnull @.str, i32 noundef %5, i32 noundef %6, i32 noundef %7) #2
  br label %12

10:                                               ; preds = %2
  %11 = tail call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %0, i64 noundef %1, ptr noundef nonnull @.str.1, i32 noundef %5, i32 noundef %6, i32 noundef %7, i32 noundef %3) #2
  br label %12

12:                                               ; preds = %10, %8
  ret void
}

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

attributes #0 = { 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 #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 = { 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"}


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