; LLVM IR from kala13x/libxutils :: src/crypt (md5)

; 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 [81 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @XMD5_Compute(ptr noundef, i64 noundef, ptr noundef, i64 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: nounwind uwtable
define dso_local ptr @XMD5_Sum(ptr noundef %0, i64 noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca [16 x i8], align 16
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store i64 33, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %10 = load i64, ptr %6, align 8, !tbaa !9
  %11 = call noalias ptr @malloc(i64 noundef %10) #5
  store ptr %11, ptr %7, align 8, !tbaa !5
  %12 = load ptr, ptr %7, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %15, label %14

14:                                               ; preds = %2
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %72

15:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #4
  %16 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 0
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = load i64, ptr %5, align 8, !tbaa !9
  %19 = call i32 @XMD5_Compute(ptr noundef %16, i64 noundef 16, ptr noundef %17, i64 noundef %18)
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = load i64, ptr %6, align 8, !tbaa !9
  %22 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 0
  %23 = load i8, ptr %22, align 16, !tbaa !11
  %24 = zext i8 %23 to i32
  %25 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 1
  %26 = load i8, ptr %25, align 1, !tbaa !11
  %27 = zext i8 %26 to i32
  %28 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 2
  %29 = load i8, ptr %28, align 2, !tbaa !11
  %30 = zext i8 %29 to i32
  %31 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 3
  %32 = load i8, ptr %31, align 1, !tbaa !11
  %33 = zext i8 %32 to i32
  %34 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 4
  %35 = load i8, ptr %34, align 4, !tbaa !11
  %36 = zext i8 %35 to i32
  %37 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 5
  %38 = load i8, ptr %37, align 1, !tbaa !11
  %39 = zext i8 %38 to i32
  %40 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 6
  %41 = load i8, ptr %40, align 2, !tbaa !11
  %42 = zext i8 %41 to i32
  %43 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 7
  %44 = load i8, ptr %43, align 1, !tbaa !11
  %45 = zext i8 %44 to i32
  %46 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 8
  %47 = load i8, ptr %46, align 8, !tbaa !11
  %48 = zext i8 %47 to i32
  %49 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 9
  %50 = load i8, ptr %49, align 1, !tbaa !11
  %51 = zext i8 %50 to i32
  %52 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 10
  %53 = load i8, ptr %52, align 2, !tbaa !11
  %54 = zext i8 %53 to i32
  %55 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 11
  %56 = load i8, ptr %55, align 1, !tbaa !11
  %57 = zext i8 %56 to i32
  %58 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 12
  %59 = load i8, ptr %58, align 4, !tbaa !11
  %60 = zext i8 %59 to i32
  %61 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 13
  %62 = load i8, ptr %61, align 1, !tbaa !11
  %63 = zext i8 %62 to i32
  %64 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 14
  %65 = load i8, ptr %64, align 2, !tbaa !11
  %66 = zext i8 %65 to i32
  %67 = getelementptr inbounds [16 x i8], ptr %9, i64 0, i64 15
  %68 = load i8, ptr %67, align 1, !tbaa !11
  %69 = zext i8 %68 to i32
  %70 = call i64 (ptr, i64, ptr, ...) @xstrncpyf(ptr noundef %20, i64 noundef %21, ptr noundef @.str, i32 noundef %24, i32 noundef %27, i32 noundef %30, i32 noundef %33, i32 noundef %36, i32 noundef %39, i32 noundef %42, i32 noundef %45, i32 noundef %48, i32 noundef %51, i32 noundef %54, i32 noundef %57, i32 noundef %60, i32 noundef %63, i32 noundef %66, i32 noundef %69)
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %71, ptr %3, align 8
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #4
  br label %72

72:                                               ; preds = %15, %14
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %73 = load ptr, ptr %3, align 8
  ret ptr %73
}

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

declare i64 @xstrncpyf(ptr noundef, i64 noundef, ptr noundef, ...) #3

attributes #0 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind allocsize(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 = { "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 allocsize(0) }

!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 = !{!7, !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 [81 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @XMD5_Compute(ptr noundef, i64 noundef, ptr noundef, i64 noundef) 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: nounwind uwtable
define dso_local noundef ptr @XMD5_Sum(ptr noundef %0, i64 noundef %1) local_unnamed_addr #0 {
  %3 = alloca [16 x i8], align 16
  %4 = tail call noalias dereferenceable_or_null(33) ptr @malloc(i64 noundef 33) #4
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %55, label %5

5:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #5
  %6 = call i32 @XMD5_Compute(ptr noundef nonnull %3, i64 noundef 16, ptr noundef %0, i64 noundef %1)
  %7 = load i8, ptr %3, align 16, !tbaa !5
  %8 = zext i8 %7 to i32
  %9 = getelementptr inbounds i8, ptr %3, i64 1
  %10 = load i8, ptr %9, align 1, !tbaa !5
  %11 = zext i8 %10 to i32
  %12 = getelementptr inbounds i8, ptr %3, i64 2
  %13 = load i8, ptr %12, align 2, !tbaa !5
  %14 = zext i8 %13 to i32
  %15 = getelementptr inbounds i8, ptr %3, i64 3
  %16 = load i8, ptr %15, align 1, !tbaa !5
  %17 = zext i8 %16 to i32
  %18 = getelementptr inbounds i8, ptr %3, i64 4
  %19 = load i8, ptr %18, align 4, !tbaa !5
  %20 = zext i8 %19 to i32
  %21 = getelementptr inbounds i8, ptr %3, i64 5
  %22 = load i8, ptr %21, align 1, !tbaa !5
  %23 = zext i8 %22 to i32
  %24 = getelementptr inbounds i8, ptr %3, i64 6
  %25 = load i8, ptr %24, align 2, !tbaa !5
  %26 = zext i8 %25 to i32
  %27 = getelementptr inbounds i8, ptr %3, i64 7
  %28 = load i8, ptr %27, align 1, !tbaa !5
  %29 = zext i8 %28 to i32
  %30 = getelementptr inbounds i8, ptr %3, i64 8
  %31 = load i8, ptr %30, align 8, !tbaa !5
  %32 = zext i8 %31 to i32
  %33 = getelementptr inbounds i8, ptr %3, i64 9
  %34 = load i8, ptr %33, align 1, !tbaa !5
  %35 = zext i8 %34 to i32
  %36 = getelementptr inbounds i8, ptr %3, i64 10
  %37 = load i8, ptr %36, align 2, !tbaa !5
  %38 = zext i8 %37 to i32
  %39 = getelementptr inbounds i8, ptr %3, i64 11
  %40 = load i8, ptr %39, align 1, !tbaa !5
  %41 = zext i8 %40 to i32
  %42 = getelementptr inbounds i8, ptr %3, i64 12
  %43 = load i8, ptr %42, align 4, !tbaa !5
  %44 = zext i8 %43 to i32
  %45 = getelementptr inbounds i8, ptr %3, i64 13
  %46 = load i8, ptr %45, align 1, !tbaa !5
  %47 = zext i8 %46 to i32
  %48 = getelementptr inbounds i8, ptr %3, i64 14
  %49 = load i8, ptr %48, align 2, !tbaa !5
  %50 = zext i8 %49 to i32
  %51 = getelementptr inbounds i8, ptr %3, i64 15
  %52 = load i8, ptr %51, align 1, !tbaa !5
  %53 = zext i8 %52 to i32
  %54 = call i64 (ptr, i64, ptr, ...) @xstrncpyf(ptr noundef nonnull %4, i64 noundef 33, ptr noundef nonnull @.str, i32 noundef %8, i32 noundef %11, i32 noundef %14, i32 noundef %17, i32 noundef %20, i32 noundef %23, i32 noundef %26, i32 noundef %29, i32 noundef %32, i32 noundef %35, i32 noundef %38, i32 noundef %41, i32 noundef %44, i32 noundef %47, i32 noundef %50, i32 noundef %53) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #5
  br label %55

55:                                               ; preds = %2, %5
  ret ptr %4
}

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

declare i64 @xstrncpyf(ptr noundef, i64 noundef, ptr noundef, ...) local_unnamed_addr #3

attributes #0 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 allocsize(0) }
attributes #5 = { 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/C++ TBAA"}


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