; LLVM IR from jim-b/ECCSI-SAKKE :: 4u2change (msdb)

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

%struct.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@stdout = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.79 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.80 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.88 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.89 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.90 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.91 = external hidden unnamed_addr constant [57 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: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #2

; Function Attrs: nounwind
declare i32 @fprintf(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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: nounwind
declare i32 @stat(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind
declare i32 @remove(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local signext i16 @msdb_userDelete(ptr noundef %0, i64 noundef %1, ptr noundef %2) #4 {
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i16, align 2
  %8 = alloca [1024 x i8], align 16
  %9 = alloca %struct.stat, align 8
  %10 = alloca [1200 x i8], align 16
  %11 = alloca [1200 x i8], align 16
  %12 = alloca [1200 x i8], align 16
  %13 = alloca [1200 x i8], align 16
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr %7) #5
  store i16 1, ptr %7, align 2, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1024, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 144, ptr %9) #5
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = icmp eq ptr null, %14
  br i1 %15, label %16, label %22

16:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 1200, ptr %10) #5
  %17 = getelementptr inbounds [1200 x i8], ptr %10, i64 0, i64 0
  %18 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %17, i64 noundef 1200, ptr noundef @.str, ptr noundef @.str.88) #5
  %19 = load ptr, ptr @stdout, align 8, !tbaa !5
  %20 = getelementptr inbounds [1200 x i8], ptr %10, i64 0, i64 0
  %21 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef @.str.2, ptr noundef %20) #5
  call void @llvm.lifetime.end.p0(i64 1200, ptr %10) #5
  br label %92

22:                                               ; preds = %3
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = icmp eq ptr null, %23
  br i1 %24, label %25, label %31

25:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 1200, ptr %11) #5
  %26 = getelementptr inbounds [1200 x i8], ptr %11, i64 0, i64 0
  %27 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %26, i64 noundef 1200, ptr noundef @.str, ptr noundef @.str.89) #5
  %28 = load ptr, ptr @stdout, align 8, !tbaa !5
  %29 = getelementptr inbounds [1200 x i8], ptr %11, i64 0, i64 0
  %30 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef @.str.2, ptr noundef %29) #5
  call void @llvm.lifetime.end.p0(i64 1200, ptr %11) #5
  br label %91

31:                                               ; preds = %22
  %32 = load i64, ptr %5, align 8, !tbaa !9
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = call i64 @strlen(ptr noundef %33) #6
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = call i64 @strlen(ptr noundef %36) #6
  %38 = getelementptr inbounds i8, ptr %35, i64 %37
  %39 = getelementptr inbounds i8, ptr %38, i64 1
  %40 = call i64 @strlen(ptr noundef %39) #6
  %41 = add i64 %34, %40
  %42 = add i64 %41, 2
  %43 = icmp ne i64 %32, %42
  br i1 %43, label %44, label %50

44:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 1200, ptr %12) #5
  %45 = getelementptr inbounds [1200 x i8], ptr %12, i64 0, i64 0
  %46 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %45, i64 noundef 1200, ptr noundef @.str, ptr noundef @.str.90) #5
  %47 = load ptr, ptr @stdout, align 8, !tbaa !5
  %48 = getelementptr inbounds [1200 x i8], ptr %12, i64 0, i64 0
  %49 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef @.str.2, ptr noundef %48) #5
  call void @llvm.lifetime.end.p0(i64 1200, ptr %12) #5
  br label %90

50:                                               ; preds = %31
  %51 = getelementptr inbounds [1024 x i8], ptr %8, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %51, i8 0, i64 1024, i1 false)
  %52 = getelementptr inbounds [1024 x i8], ptr %8, i64 0, i64 0
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = call i64 @strlen(ptr noundef %55) #6
  %57 = add i64 %56, 1
  %58 = getelementptr inbounds i8, ptr %54, i64 %57
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %52, i64 noundef 1024, ptr noundef @.str.79, ptr noundef @.str.80, ptr noundef %53, ptr noundef %58, ptr noundef %59) #5
  %61 = getelementptr inbounds [1024 x i8], ptr %8, i64 0, i64 0
  %62 = call i32 @stat(ptr noundef %61, ptr noundef %9) #5
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %88, label %64

64:                                               ; preds = %50
  %65 = getelementptr inbounds %struct.stat, ptr %9, i32 0, i32 3
  %66 = load i32, ptr %65, align 8, !tbaa !13
  %67 = and i32 %66, 61440
  %68 = icmp eq i32 %67, 32768
  br i1 %68, label %69, label %88

69:                                               ; preds = %64
  %70 = getelementptr inbounds [1024 x i8], ptr %8, i64 0, i64 0
  %71 = call i32 @remove(ptr noundef %70) #5
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %74, label %73

73:                                               ; preds = %69
  store i16 0, ptr %7, align 2, !tbaa !11
  br label %87

74:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 1200, ptr %13) #5
  %75 = getelementptr inbounds [1200 x i8], ptr %13, i64 0, i64 0
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = call i64 @strlen(ptr noundef %78) #6
  %80 = add i64 %79, 1
  %81 = getelementptr inbounds i8, ptr %77, i64 %80
  %82 = load ptr, ptr %6, align 8, !tbaa !5
  %83 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %75, i64 noundef 1200, ptr noundef @.str.91, ptr noundef %76, ptr noundef %81, ptr noundef %82) #5
  %84 = load ptr, ptr @stdout, align 8, !tbaa !5
  %85 = getelementptr inbounds [1200 x i8], ptr %13, i64 0, i64 0
  %86 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %84, ptr noundef @.str.2, ptr noundef %85) #5
  call void @llvm.lifetime.end.p0(i64 1200, ptr %13) #5
  br label %87

87:                                               ; preds = %74, %73
  br label %89

88:                                               ; preds = %64, %50
  store i16 0, ptr %7, align 2, !tbaa !11
  br label %89

89:                                               ; preds = %88, %87
  br label %90

90:                                               ; preds = %89, %44
  br label %91

91:                                               ; preds = %90, %25
  br label %92

92:                                               ; preds = %91, %16
  %93 = load i16, ptr %7, align 2, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 144, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 1024, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 2, ptr %7) #5
  ret i16 %93
}

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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!14, !15, i64 24}
!14 = !{!"stat", !10, i64 0, !10, i64 8, !10, i64 16, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !16, i64 72, !16, i64 88, !16, i64 104, !7, i64 120}
!15 = !{!"int", !7, i64 0}
!16 = !{!"timespec", !10, i64 0, !10, i64 8}


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

%struct.stat = type { i64, i64, i64, i32, i32, i32, i32, i64, i64, i64, i64, %struct.timespec, %struct.timespec, %struct.timespec, [3 x i64] }
%struct.timespec = type { i64, i64 }

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.79 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.80 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.88 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.89 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.90 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.91 = external hidden unnamed_addr constant [57 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: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

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

; Function Attrs: nofree nounwind uwtable
define dso_local signext range(i16 0, 2) i16 @msdb_userDelete(ptr noundef %0, i64 noundef %1, ptr noundef %2) local_unnamed_addr #4 {
  %4 = alloca [1024 x i8], align 16
  %5 = alloca %struct.stat, align 8
  %6 = alloca [1200 x i8], align 16
  %7 = alloca [1200 x i8], align 16
  %8 = alloca [1200 x i8], align 16
  %9 = alloca [1200 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %5) #5
  %10 = icmp eq ptr %2, null
  br i1 %10, label %11, label %15

11:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %6) #5
  %12 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %6, i64 noundef 1200, ptr noundef nonnull @.str, ptr noundef nonnull @.str.88) #5
  %13 = load ptr, ptr @stdout, align 8, !tbaa !5
  %14 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %13, ptr noundef nonnull @.str.2, ptr noundef nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %6) #5
  br label %49

15:                                               ; preds = %3
  %16 = icmp eq ptr %0, null
  br i1 %16, label %17, label %21

17:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %7) #5
  %18 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %7, i64 noundef 1200, ptr noundef nonnull @.str, ptr noundef nonnull @.str.89) #5
  %19 = load ptr, ptr @stdout, align 8, !tbaa !5
  %20 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.2, ptr noundef nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %7) #5
  br label %49

21:                                               ; preds = %15
  %22 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #6
  %23 = getelementptr inbounds i8, ptr %0, i64 %22
  %24 = getelementptr inbounds i8, ptr %23, i64 1
  %25 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %24) #6
  %26 = add i64 %22, 2
  %27 = add i64 %26, %25
  %.not = icmp eq i64 %27, %1
  br i1 %.not, label %32, label %28

28:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %8) #5
  %29 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %8, i64 noundef 1200, ptr noundef nonnull @.str, ptr noundef nonnull @.str.90) #5
  %30 = load ptr, ptr @stdout, align 8, !tbaa !5
  %31 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef nonnull @.str.2, ptr noundef nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %8) #5
  br label %49

32:                                               ; preds = %21
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %4, i8 0, i64 1024, i1 false)
  %33 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %4, i64 noundef 1024, ptr noundef nonnull @.str.79, ptr noundef nonnull @.str.80, ptr noundef nonnull %0, ptr noundef nonnull %24, ptr noundef nonnull %2) #5
  %34 = call i32 @stat(ptr noundef nonnull %4, ptr noundef nonnull %5) #5
  %.not16 = icmp eq i32 %34, 0
  br i1 %.not16, label %35, label %49

35:                                               ; preds = %32
  %36 = getelementptr inbounds i8, ptr %5, i64 24
  %37 = load i32, ptr %36, align 8, !tbaa !9
  %38 = and i32 %37, 61440
  %39 = icmp eq i32 %38, 32768
  br i1 %39, label %40, label %49

40:                                               ; preds = %35
  %41 = call i32 @remove(ptr noundef nonnull %4) #5
  %.not17 = icmp eq i32 %41, 0
  br i1 %.not17, label %49, label %42

42:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %9) #5
  %43 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #6
  %44 = getelementptr i8, ptr %0, i64 %43
  %45 = getelementptr i8, ptr %44, i64 1
  %46 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %9, i64 noundef 1200, ptr noundef nonnull @.str.91, ptr noundef nonnull %0, ptr noundef %45, ptr noundef nonnull %2) #5
  %47 = load ptr, ptr @stdout, align 8, !tbaa !5
  %48 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef nonnull @.str.2, ptr noundef nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %9) #5
  br label %49

49:                                               ; preds = %32, %35, %40, %17, %42, %28, %11
  %.0 = phi i16 [ 1, %11 ], [ 1, %17 ], [ 1, %28 ], [ 1, %42 ], [ 0, %40 ], [ 0, %35 ], [ 0, %32 ]
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %4) #5
  ret i16 %.0
}

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 = { 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }

!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, !12, i64 24}
!10 = !{!"stat", !11, i64 0, !11, i64 8, !11, i64 16, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !13, i64 72, !13, i64 88, !13, i64 104, !7, i64 120}
!11 = !{!"long", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"timespec", !11, i64 0, !11, i64 8}


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