; LLVM IR from jim-b/ECCSI-SAKKE :: src/data (userParameters)

; 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 [14 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [56 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 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #1

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

; 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) #2

declare signext i16 @msdb_userGetPVT(ptr noundef, i64 noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local ptr @user_getPVTx(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 ptr, align 8
  %8 = alloca [130 x i8], align 16
  %9 = alloca [65 x i8], align 16
  %10 = alloca [1200 x i8], align 16
  %11 = alloca [1200 x i8], align 16
  %12 = 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 8, ptr %7) #6
  store ptr null, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 130, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 65, ptr %9) #6
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = icmp eq ptr null, %13
  br i1 %14, label %15, label %21

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

21:                                               ; preds = %3
  %22 = load i64, ptr %5, align 8, !tbaa !9
  %23 = icmp eq i64 %22, 0
  br i1 %23, label %24, label %30

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

30:                                               ; preds = %21
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = icmp eq ptr null, %31
  br i1 %32, label %33, label %39

33:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 1200, ptr %12) #6
  %34 = getelementptr inbounds [1200 x i8], ptr %12, i64 0, i64 0
  %35 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %34, i64 noundef 1200, ptr noundef @.str, ptr noundef @.str.22) #6
  %36 = load ptr, ptr @stdout, align 8, !tbaa !5
  %37 = getelementptr inbounds [1200 x i8], ptr %12, i64 0, i64 0
  %38 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef @.str.2, ptr noundef %37) #6
  call void @llvm.lifetime.end.p0(i64 1200, ptr %12) #6
  br label %54

39:                                               ; preds = %30
  %40 = getelementptr inbounds [130 x i8], ptr %8, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %40, i8 0, i64 130, i1 false)
  %41 = getelementptr inbounds [65 x i8], ptr %9, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %41, i8 0, i64 65, i1 false)
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = load i64, ptr %5, align 8, !tbaa !9
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = call signext i16 @msdb_userGetPVT(ptr noundef %42, i64 noundef %43, ptr noundef %44, ptr noundef %8)
  %46 = icmp ne i16 %45, 0
  br i1 %46, label %53, label %47

47:                                               ; preds = %39
  %48 = getelementptr inbounds [65 x i8], ptr %9, i64 0, i64 0
  %49 = getelementptr inbounds [130 x i8], ptr %8, i64 0, i64 0
  %50 = getelementptr inbounds i8, ptr %49, i64 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %48, ptr align 1 %50, i64 64, i1 false)
  %51 = getelementptr inbounds [65 x i8], ptr %9, i64 0, i64 0
  %52 = call i32 @BN_hex2bn(ptr noundef %7, ptr noundef %51)
  br label %53

53:                                               ; preds = %47, %39
  br label %54

54:                                               ; preds = %53, %33
  br label %55

55:                                               ; preds = %54, %24
  br label %56

56:                                               ; preds = %55, %15
  %57 = getelementptr inbounds [130 x i8], ptr %8, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %57, i8 0, i64 130, i1 false)
  %58 = getelementptr inbounds [65 x i8], ptr %9, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %58, i8 0, i64 65, i1 false)
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 65, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 130, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  ret ptr %59
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

declare i32 @BN_hex2bn(ptr noundef, ptr noundef) #3

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"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}


; 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 [14 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [56 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 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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

; 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) #2

declare signext i16 @msdb_userGetPVT(ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local ptr @user_getPVTx(ptr noundef %0, i64 noundef %1, ptr noundef %2) local_unnamed_addr #4 {
  %4 = alloca ptr, align 8
  %5 = alloca [130 x i8], align 16
  %6 = alloca [65 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 8, ptr nonnull %4) #6
  store ptr null, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 130, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 65, ptr nonnull %6) #6
  %10 = icmp eq ptr %0, null
  br i1 %10, label %11, label %15

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

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

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

21:                                               ; preds = %15
  %22 = icmp eq ptr %2, null
  br i1 %22, label %23, label %27

23:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %9) #6
  %24 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %9, i64 noundef 1200, ptr noundef nonnull @.str, ptr noundef nonnull @.str.22) #6
  %25 = load ptr, ptr @stdout, align 8, !tbaa !5
  %26 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str.2, ptr noundef nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %9) #6
  br label %33

27:                                               ; preds = %21
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(130) %5, i8 0, i64 130, i1 false)
  %28 = getelementptr inbounds i8, ptr %6, i64 64
  store i8 0, ptr %28, align 16
  %29 = call signext i16 @msdb_userGetPVT(ptr noundef nonnull %0, i64 noundef %1, ptr noundef nonnull %2, ptr noundef nonnull %5) #6
  %.not = icmp eq i16 %29, 0
  br i1 %.not, label %30, label %33

30:                                               ; preds = %27
  %31 = getelementptr inbounds i8, ptr %5, i64 2
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %6, ptr noundef nonnull align 2 dereferenceable(64) %31, i64 64, i1 false)
  %32 = call i32 @BN_hex2bn(ptr noundef nonnull %4, ptr noundef nonnull %6) #6
  %.pre = load ptr, ptr %4, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %17, %27, %30, %23, %11
  %34 = phi ptr [ null, %17 ], [ null, %27 ], [ %.pre, %30 ], [ null, %23 ], [ null, %11 ]
  call void @llvm.lifetime.end.p0(i64 65, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 130, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  ret ptr %34
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

declare i32 @BN_hex2bn(ptr noundef, ptr noundef) local_unnamed_addr #3

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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