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

@.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.83 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.103 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.104 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.105 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.106 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.107 = external hidden unnamed_addr constant [44 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

declare i32 @fclose(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden signext i16 @parseDataAttribute(ptr noundef, ptr noundef, ptr noundef) #4

; Function Attrs: nounwind uwtable
declare hidden ptr @openUserFile(ptr noundef, i64 noundef, ptr noundef) #4

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

18:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 1200, ptr %11) #5
  %19 = getelementptr inbounds [1200 x i8], ptr %11, i64 0, i64 0
  %20 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %19, i64 noundef 1200, ptr noundef @.str, ptr noundef @.str.103) #5
  %21 = load ptr, ptr @stdout, align 8, !tbaa !5
  %22 = getelementptr inbounds [1200 x i8], ptr %11, i64 0, i64 0
  %23 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef @.str.2, ptr noundef %22) #5
  call void @llvm.lifetime.end.p0(i64 1200, ptr %11) #5
  br label %83

24:                                               ; preds = %4
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = icmp eq ptr null, %25
  br i1 %26, label %27, label %33

27:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 1200, ptr %12) #5
  %28 = getelementptr inbounds [1200 x i8], ptr %12, i64 0, i64 0
  %29 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %28, i64 noundef 1200, ptr noundef @.str, ptr noundef @.str.104) #5
  %30 = load ptr, ptr @stdout, align 8, !tbaa !5
  %31 = getelementptr inbounds [1200 x i8], ptr %12, i64 0, i64 0
  %32 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef @.str.2, ptr noundef %31) #5
  call void @llvm.lifetime.end.p0(i64 1200, ptr %12) #5
  br label %82

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

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

52:                                               ; preds = %33
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = load i64, ptr %6, align 8, !tbaa !9
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = call ptr @openUserFile(ptr noundef %53, i64 noundef %54, ptr noundef %55)
  store ptr %56, ptr %9, align 8, !tbaa !5
  %57 = icmp ne ptr null, %56
  br i1 %57, label %58, label %74

58:                                               ; preds = %52
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = call signext i16 @parseDataAttribute(ptr noundef %59, ptr noundef @.str.83, ptr noundef %60)
  %62 = icmp ne i16 %61, 0
  br i1 %62, label %64, label %63

63:                                               ; preds = %58
  store i16 0, ptr %10, align 2, !tbaa !11
  br label %71

64:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 1200, ptr %14) #5
  %65 = getelementptr inbounds [1200 x i8], ptr %14, i64 0, i64 0
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %65, i64 noundef 1200, ptr noundef @.str.106, ptr noundef %66) #5
  %68 = load ptr, ptr @stdout, align 8, !tbaa !5
  %69 = getelementptr inbounds [1200 x i8], ptr %14, i64 0, i64 0
  %70 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef @.str.2, ptr noundef %69) #5
  call void @llvm.lifetime.end.p0(i64 1200, ptr %14) #5
  br label %71

71:                                               ; preds = %64, %63
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = call i32 @fclose(ptr noundef %72)
  br label %80

74:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 1200, ptr %15) #5
  %75 = getelementptr inbounds [1200 x i8], ptr %15, i64 0, i64 0
  %76 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %75, i64 noundef 1200, ptr noundef @.str, ptr noundef @.str.107) #5
  %77 = load ptr, ptr @stdout, align 8, !tbaa !5
  %78 = getelementptr inbounds [1200 x i8], ptr %15, i64 0, i64 0
  %79 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef @.str.2, ptr noundef %78) #5
  call void @llvm.lifetime.end.p0(i64 1200, ptr %15) #5
  br label %80

80:                                               ; preds = %74, %71
  br label %81

81:                                               ; preds = %80, %46
  br label %82

82:                                               ; preds = %81, %27
  br label %83

83:                                               ; preds = %82, %18
  %84 = load i16, ptr %10, align 2, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 2, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  ret i16 %84
}

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


; 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 = 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.83 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.103 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.104 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.105 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.106 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.107 = external hidden unnamed_addr constant [44 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: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden signext i16 @parseDataAttribute(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden ptr @openUserFile(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local signext range(i16 0, 2) i16 @msdb_userGetHash(ptr noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #3 {
  %5 = alloca [1200 x i8], align 16
  %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
  %10 = icmp eq ptr %2, null
  br i1 %10, label %11, label %15

11:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %5) #4
  %12 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %5, i64 noundef 1200, ptr noundef nonnull @.str, ptr noundef nonnull @.str.103) #4
  %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 %5) #4
  call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %5) #4
  br label %46

15:                                               ; preds = %4
  %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 %6) #4
  %18 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %6, i64 noundef 1200, ptr noundef nonnull @.str, ptr noundef nonnull @.str.104) #4
  %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 %6) #4
  call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %6) #4
  br label %46

21:                                               ; preds = %15
  %22 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #5
  %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) #5
  %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 %7) #4
  %29 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %7, i64 noundef 1200, ptr noundef nonnull @.str, ptr noundef nonnull @.str.105) #4
  %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 %7) #4
  call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %7) #4
  br label %46

32:                                               ; preds = %21
  %33 = tail call ptr @openUserFile(ptr noundef nonnull %0, i64 noundef %1, ptr noundef nonnull %2)
  %.not17 = icmp eq ptr %33, null
  br i1 %.not17, label %42, label %34

34:                                               ; preds = %32
  %35 = tail call signext i16 @parseDataAttribute(ptr noundef nonnull %33, ptr noundef nonnull @.str.83, ptr noundef %3)
  %.not18 = icmp eq i16 %35, 0
  br i1 %.not18, label %40, label %36

36:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %8) #4
  %37 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %8, i64 noundef 1200, ptr noundef nonnull @.str.106, ptr noundef nonnull %2) #4
  %38 = load ptr, ptr @stdout, align 8, !tbaa !5
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str.2, ptr noundef nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %8) #4
  br label %40

40:                                               ; preds = %34, %36
  %.0 = phi i16 [ 1, %36 ], [ 0, %34 ]
  %41 = call i32 @fclose(ptr noundef nonnull %33)
  br label %46

42:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %9) #4
  %43 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %9, i64 noundef 1200, ptr noundef nonnull @.str, ptr noundef nonnull @.str.107) #4
  %44 = load ptr, ptr @stdout, align 8, !tbaa !5
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef nonnull @.str.2, ptr noundef nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %9) #4
  br label %46

46:                                               ; preds = %17, %40, %42, %28, %11
  %.1 = phi i16 [ 1, %11 ], [ 1, %17 ], [ 1, %28 ], [ %.0, %40 ], [ 1, %42 ]
  ret i16 %.1
}

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


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