; LLVM IR from cvitatma/DSA :: 01-preliminaries/preliminaries.ll (Z8pointersv)

; 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.17 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5pausev() #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z8pointersv() #2 {
  %1 = alloca ptr, align 8
  %2 = alloca i8, align 1
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i8, align 1
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = call i32 (ptr, ...) @printf(ptr noundef @.str.17)
  %9 = call i32 (ptr, ...) @printf(ptr noundef @.str.28, i64 noundef 8)
  %10 = call i32 (ptr, ...) @printf(ptr noundef @.str.29, i64 noundef 8)
  %11 = call i32 (ptr, ...) @printf(ptr noundef @.str.30, i64 noundef 8)
  %12 = call i32 (ptr, ...) @printf(ptr noundef @.str.31, i64 noundef 8)
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str.32, i64 noundef 8)
  call void @_Z5pausev()
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %2) #3
  store i8 97, ptr %2, align 1, !tbaa !5
  store ptr %2, ptr %1, align 8, !tbaa !8
  %14 = load i8, ptr %2, align 1, !tbaa !5
  %15 = sext i8 %14 to i32
  %16 = load ptr, ptr %1, align 8, !tbaa !8
  %17 = load i8, ptr %16, align 1, !tbaa !5
  %18 = sext i8 %17 to i32
  %19 = call i32 (ptr, ...) @printf(ptr noundef @.str.33, i32 noundef %15, i32 noundef %18)
  store ptr null, ptr %1, align 8, !tbaa !8
  %20 = load ptr, ptr %1, align 8, !tbaa !8
  %21 = icmp ne ptr %20, null
  br i1 %21, label %24, label %22

22:                                               ; preds = %0
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str.34)
  br label %24

24:                                               ; preds = %22, %0
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 10, ptr %4, align 4, !tbaa !10
  store ptr %4, ptr %3, align 8, !tbaa !8
  store ptr %2, ptr %3, align 8, !tbaa !8
  store ptr %2, ptr %1, align 8, !tbaa !8
  %25 = load i32, ptr %4, align 4, !tbaa !10
  %26 = trunc i32 %25 to i8
  store i8 %26, ptr %2, align 1, !tbaa !5
  store ptr %2, ptr %1, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #3
  store i8 109, ptr %5, align 1, !tbaa !5
  store ptr %5, ptr %1, align 8, !tbaa !8
  %27 = load ptr, ptr %1, align 8, !tbaa !8
  %28 = load i8, ptr %27, align 1, !tbaa !5
  %29 = sext i8 %28 to i32
  %30 = call i32 (ptr, ...) @printf(ptr noundef @.str.35, i32 noundef %29)
  %31 = load ptr, ptr %1, align 8, !tbaa !8
  store i8 109, ptr %31, align 1, !tbaa !5
  %32 = load ptr, ptr %1, align 8, !tbaa !8
  %33 = load i8, ptr %32, align 1, !tbaa !5
  %34 = sext i8 %33 to i32
  %35 = call i32 (ptr, ...) @printf(ptr noundef @.str.36, i32 noundef %34)
  %36 = load ptr, ptr %1, align 8, !tbaa !8
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str.37, ptr noundef %36)
  %38 = call i32 (ptr, ...) @printf(ptr noundef @.str.38, ptr noundef %1)
  call void @_Z5pausev()
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store ptr null, ptr %6, align 8, !tbaa !8
  store ptr %2, ptr %6, align 8, !tbaa !8
  store ptr @.str.39, ptr %6, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store ptr %2, ptr %7, align 8, !tbaa !8
  %39 = load ptr, ptr %7, align 8, !tbaa !8
  store i8 114, ptr %39, align 1, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #3
  ret void
}

attributes #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 = { 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 #3 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, 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.17 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [28 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5pausev() local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z8pointersv() local_unnamed_addr #2 {
  %1 = alloca ptr, align 8
  %2 = alloca i8, align 1
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17)
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.28, i64 noundef 8)
  %5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.29, i64 noundef 8)
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.30, i64 noundef 8)
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.31, i64 noundef 8)
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.32, i64 noundef 8)
  tail call void @_Z5pausev()
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #3
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.33, i32 noundef 97, i32 noundef 97)
  %10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.34)
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #3
  store i8 109, ptr %2, align 1, !tbaa !5
  store ptr %2, ptr %1, align 8, !tbaa !8
  %11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.35, i32 noundef 109)
  store i8 109, ptr %2, align 1, !tbaa !5
  %12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.36, i32 noundef 109)
  %13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.37, ptr noundef nonnull %2)
  %14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.38, ptr noundef nonnull %1)
  call void @_Z5pausev()
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #3
  ret void
}

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}


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