; LLVM IR from reworks-org/galaxy :: deps/sfml_deps/flac-src/src/libFLAC/md5.ll_FLAC (MD5Final)

; 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.FLAC__MD5Context = type { [16 x i32], [4 x i32], [2 x i32], %union.FLAC__multibyte, i64 }
%union.FLAC__multibyte = type { ptr }

; Function Attrs: nounwind uwtable
define dso_local void @FLAC__MD5Final(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.FLAC__MD5Context, ptr %7, i32 0, i32 2
  %9 = getelementptr inbounds [2 x i32], ptr %8, i64 0, i64 0
  %10 = load i32, ptr %9, align 8, !tbaa !9
  %11 = and i32 %10, 63
  store i32 %11, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.FLAC__MD5Context, ptr %12, i32 0, i32 0
  %14 = getelementptr inbounds [16 x i32], ptr %13, i64 0, i64 0
  %15 = load i32, ptr %5, align 4, !tbaa !9
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds i8, ptr %14, i64 %16
  store ptr %17, ptr %6, align 8, !tbaa !5
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %18, i32 1
  store ptr %19, ptr %6, align 8, !tbaa !5
  store i8 -128, ptr %18, align 1, !tbaa !11
  %20 = load i32, ptr %5, align 4, !tbaa !9
  %21 = sub nsw i32 55, %20
  store i32 %21, ptr %5, align 4, !tbaa !9
  %22 = load i32, ptr %5, align 4, !tbaa !9
  %23 = icmp slt i32 %22, 0
  br i1 %23, label %24, label %38

24:                                               ; preds = %2
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = add nsw i32 %26, 8
  %28 = sext i32 %27 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %25, i8 0, i64 %28, i1 false)
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.FLAC__MD5Context, ptr %29, i32 0, i32 1
  %31 = getelementptr inbounds [4 x i32], ptr %30, i64 0, i64 0
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.FLAC__MD5Context, ptr %32, i32 0, i32 0
  %34 = getelementptr inbounds [16 x i32], ptr %33, i64 0, i64 0
  call void @FLAC__MD5Transform(ptr noundef %31, ptr noundef %34)
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.FLAC__MD5Context, ptr %35, i32 0, i32 0
  %37 = getelementptr inbounds [16 x i32], ptr %36, i64 0, i64 0
  store ptr %37, ptr %6, align 8, !tbaa !5
  store i32 56, ptr %5, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %24, %2
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = load i32, ptr %5, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %39, i8 0, i64 %41, i1 false)
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.FLAC__MD5Context, ptr %42, i32 0, i32 2
  %44 = getelementptr inbounds [2 x i32], ptr %43, i64 0, i64 0
  %45 = load i32, ptr %44, align 8, !tbaa !9
  %46 = shl i32 %45, 3
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.FLAC__MD5Context, ptr %47, i32 0, i32 0
  %49 = getelementptr inbounds [16 x i32], ptr %48, i64 0, i64 14
  store i32 %46, ptr %49, align 8, !tbaa !9
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.FLAC__MD5Context, ptr %50, i32 0, i32 2
  %52 = getelementptr inbounds [2 x i32], ptr %51, i64 0, i64 1
  %53 = load i32, ptr %52, align 4, !tbaa !9
  %54 = shl i32 %53, 3
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.FLAC__MD5Context, ptr %55, i32 0, i32 2
  %57 = getelementptr inbounds [2 x i32], ptr %56, i64 0, i64 0
  %58 = load i32, ptr %57, align 8, !tbaa !9
  %59 = lshr i32 %58, 29
  %60 = or i32 %54, %59
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.FLAC__MD5Context, ptr %61, i32 0, i32 0
  %63 = getelementptr inbounds [16 x i32], ptr %62, i64 0, i64 15
  store i32 %60, ptr %63, align 4, !tbaa !9
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.FLAC__MD5Context, ptr %64, i32 0, i32 1
  %66 = getelementptr inbounds [4 x i32], ptr %65, i64 0, i64 0
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.FLAC__MD5Context, ptr %67, i32 0, i32 0
  %69 = getelementptr inbounds [16 x i32], ptr %68, i64 0, i64 0
  call void @FLAC__MD5Transform(ptr noundef %66, ptr noundef %69)
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.FLAC__MD5Context, ptr %71, i32 0, i32 1
  %73 = getelementptr inbounds [4 x i32], ptr %72, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %70, ptr align 8 %73, i64 16, i1 false)
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.FLAC__MD5Context, ptr %74, i32 0, i32 3
  %76 = load ptr, ptr %75, align 8, !tbaa !11
  %77 = icmp ne ptr null, %76
  br i1 %77, label %78, label %86

78:                                               ; preds = %38
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.FLAC__MD5Context, ptr %79, i32 0, i32 3
  %81 = load ptr, ptr %80, align 8, !tbaa !11
  call void @free(ptr noundef %81) #5
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.FLAC__MD5Context, ptr %82, i32 0, i32 3
  store ptr null, ptr %83, align 8, !tbaa !11
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.FLAC__MD5Context, ptr %84, i32 0, i32 4
  store i64 0, ptr %85, align 8, !tbaa !12
  br label %86

86:                                               ; preds = %78, %38
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %87, i8 0, i64 104, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret void
}

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

; Function Attrs: nounwind uwtable
declare hidden void @FLAC__MD5Transform(ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

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

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !14, i64 96}
!13 = !{!"", !7, i64 0, !7, i64 64, !7, i64 80, !7, i64 88, !14, i64 96}
!14 = !{!"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"

; Function Attrs: nounwind uwtable
define dso_local void @FLAC__MD5Final(ptr nocapture noundef writeonly %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %1, i64 80
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = and i32 %4, 63
  %6 = zext nneg i32 %5 to i64
  %7 = getelementptr inbounds i8, ptr %1, i64 %6
  %8 = getelementptr inbounds i8, ptr %7, i64 1
  store i8 -128, ptr %7, align 1, !tbaa !9
  %9 = sub nuw nsw i32 55, %5
  %10 = icmp ugt i32 %5, 55
  br i1 %10, label %11, label %15

11:                                               ; preds = %2
  %12 = xor i32 %5, 63
  %13 = zext nneg i32 %12 to i64
  tail call void @llvm.memset.p0.i64(ptr nonnull align 1 %8, i8 0, i64 %13, i1 false)
  %14 = getelementptr inbounds i8, ptr %1, i64 64
  tail call void @FLAC__MD5Transform(ptr noundef nonnull %14, ptr noundef nonnull %1)
  br label %15

15:                                               ; preds = %11, %2
  %.026 = phi i32 [ 56, %11 ], [ %9, %2 ]
  %.0 = phi ptr [ %1, %11 ], [ %8, %2 ]
  %16 = zext nneg i32 %.026 to i64
  tail call void @llvm.memset.p0.i64(ptr nonnull align 1 %.0, i8 0, i64 %16, i1 false)
  %17 = load i32, ptr %3, align 8, !tbaa !5
  %18 = shl i32 %17, 3
  %19 = getelementptr inbounds i8, ptr %1, i64 56
  store i32 %18, ptr %19, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %1, i64 84
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = tail call i32 @llvm.fshl.i32(i32 %21, i32 %17, i32 3)
  %23 = getelementptr inbounds i8, ptr %1, i64 60
  store i32 %22, ptr %23, align 4, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %1, i64 64
  tail call void @FLAC__MD5Transform(ptr noundef nonnull %24, ptr noundef nonnull %1)
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %24, i64 16, i1 false)
  %25 = getelementptr inbounds i8, ptr %1, i64 88
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  %.not = icmp eq ptr %26, null
  br i1 %.not, label %28, label %27

27:                                               ; preds = %15
  tail call void @free(ptr noundef nonnull %26) #5
  br label %28

28:                                               ; preds = %27, %15
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %1, i8 0, i64 104, i1 false)
  ret void
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
declare hidden void @FLAC__MD5Transform(ptr noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.fshl.i32(i32, i32, i32) #4

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 nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass