; LLVM IR from didi/AoE :: linux/src/plugin (AOECrypto)

; 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.MD5_CTX = type { [2 x i32], [4 x i32], [64 x i8] }
%struct.AES_ctx = type { [176 x i8], [16 x i8] }

@.str.2 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [17 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: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #1

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

declare void @AES_init_ctx_iv(ptr noundef, ptr noundef, ptr noundef) #3

; 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 nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #1

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

; 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 void @MD5Init(ptr noundef) #3

declare void @MD5Update(ptr noundef, ptr noundef, i32 noundef) #3

declare void @MD5Final(ptr noundef, ptr noundef) #3

declare void @AES_CBC_encrypt_buffer(ptr noundef, ptr noundef, i32 noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @AOECrypto_encryptAoeDataToData_Version1(ptr noundef %0, i32 noundef %1, ptr noundef %2) #6 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca %struct.MD5_CTX, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca %struct.AES_ctx, align 1
  %20 = alloca i8, align 1
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i8, align 1
  %25 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = icmp eq ptr null, %26
  br i1 %27, label %34, label %28

28:                                               ; preds = %3
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = icmp eq ptr null, %29
  br i1 %30, label %34, label %31

31:                                               ; preds = %28
  %32 = load i32, ptr %6, align 4, !tbaa !9
  %33 = icmp sle i32 %32, 0
  br i1 %33, label %34, label %35

34:                                               ; preds = %31, %28, %3
  store i32 -1, ptr %4, align 4
  br label %192

35:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %36 = load i32, ptr %6, align 4, !tbaa !9
  %37 = add nsw i32 21, %36
  store i32 %37, ptr %8, align 4, !tbaa !9
  %38 = load i32, ptr %6, align 4, !tbaa !9
  %39 = srem i32 %38, 16
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %47

41:                                               ; preds = %35
  %42 = load i32, ptr %6, align 4, !tbaa !9
  %43 = srem i32 %42, 16
  %44 = sub nsw i32 16, %43
  %45 = load i32, ptr %8, align 4, !tbaa !9
  %46 = add nsw i32 %45, %44
  store i32 %46, ptr %8, align 4, !tbaa !9
  br label %47

47:                                               ; preds = %41, %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %48 = load i32, ptr %8, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = call noalias ptr @malloc(i64 noundef %49) #8
  store ptr %50, ptr %9, align 8, !tbaa !5
  %51 = load ptr, ptr %9, align 8, !tbaa !5
  %52 = icmp eq ptr null, %51
  br i1 %52, label %53, label %54

53:                                               ; preds = %47
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %191

54:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %55, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %56 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %56, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 21, ptr %13, align 4, !tbaa !9
  %57 = call ptr @llvm.stacksave.p0()
  store ptr %57, ptr %14, align 8
  %58 = alloca i8, i64 21, align 16
  call void @llvm.memset.p0.i64(ptr align 16 %58, i8 0, i64 21, i1 false)
  %59 = getelementptr inbounds i8, ptr %58, i64 0
  store i8 1, ptr %59, align 16, !tbaa !11
  %60 = alloca i8, i64 16, align 16
  call void @llvm.lifetime.start.p0(i64 88, ptr %15) #7
  call void @MD5Init(ptr noundef %15)
  %61 = alloca i8, i64 16384, align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %62 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %62, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %63, ptr %18, align 8, !tbaa !5
  br label %64

64:                                               ; preds = %73, %54
  %65 = load i32, ptr %17, align 4, !tbaa !9
  %66 = icmp sgt i32 %65, 0
  br i1 %66, label %67, label %86

67:                                               ; preds = %64
  call void @llvm.memset.p0.i64(ptr align 16 %61, i8 0, i64 16384, i1 false)
  %68 = load i32, ptr %17, align 4, !tbaa !9
  %69 = icmp slt i32 %68, 16384
  br i1 %69, label %70, label %72

70:                                               ; preds = %67
  %71 = load i32, ptr %17, align 4, !tbaa !9
  br label %73

72:                                               ; preds = %67
  br label %73

73:                                               ; preds = %72, %70
  %74 = phi i32 [ %71, %70 ], [ 16384, %72 ]
  store i32 %74, ptr %16, align 4, !tbaa !9
  %75 = load ptr, ptr %18, align 8, !tbaa !5
  %76 = load i32, ptr %16, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %61, ptr align 1 %75, i64 %77, i1 false)
  %78 = load i32, ptr %16, align 4, !tbaa !9
  call void @MD5Update(ptr noundef %15, ptr noundef %61, i32 noundef %78)
  %79 = load i32, ptr %16, align 4, !tbaa !9
  %80 = load i32, ptr %17, align 4, !tbaa !9
  %81 = sub nsw i32 %80, %79
  store i32 %81, ptr %17, align 4, !tbaa !9
  %82 = load i32, ptr %16, align 4, !tbaa !9
  %83 = load ptr, ptr %18, align 8, !tbaa !5
  %84 = sext i32 %82 to i64
  %85 = getelementptr inbounds i8, ptr %83, i64 %84
  store ptr %85, ptr %18, align 8, !tbaa !5
  br label %64, !llvm.loop !12

86:                                               ; preds = %64
  call void @MD5Final(ptr noundef %15, ptr noundef %60)
  %87 = load i32, ptr %12, align 4, !tbaa !9
  %88 = ashr i32 %87, 24
  %89 = and i32 %88, 255
  %90 = trunc i32 %89 to i8
  %91 = getelementptr inbounds i8, ptr %58, i64 1
  store i8 %90, ptr %91, align 1, !tbaa !11
  %92 = load i32, ptr %12, align 4, !tbaa !9
  %93 = ashr i32 %92, 16
  %94 = and i32 %93, 255
  %95 = trunc i32 %94 to i8
  %96 = getelementptr inbounds i8, ptr %58, i64 2
  store i8 %95, ptr %96, align 2, !tbaa !11
  %97 = load i32, ptr %12, align 4, !tbaa !9
  %98 = ashr i32 %97, 8
  %99 = and i32 %98, 255
  %100 = trunc i32 %99 to i8
  %101 = getelementptr inbounds i8, ptr %58, i64 3
  store i8 %100, ptr %101, align 1, !tbaa !11
  %102 = load i32, ptr %12, align 4, !tbaa !9
  %103 = and i32 %102, 255
  %104 = trunc i32 %103 to i8
  %105 = getelementptr inbounds i8, ptr %58, i64 4
  store i8 %104, ptr %105, align 4, !tbaa !11
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %106, ptr %18, align 8, !tbaa !5
  %107 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %107, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 192, ptr %19) #7
  call void @AES_init_ctx_iv(ptr noundef %19, ptr noundef @.str.2, ptr noundef @.str.3)
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #7
  store i8 1, ptr %20, align 1, !tbaa !14
  br label %108

108:                                              ; preds = %178, %86
  %109 = load i32, ptr %17, align 4, !tbaa !9
  %110 = icmp sgt i32 %109, 0
  br i1 %110, label %111, label %186

111:                                              ; preds = %108
  call void @llvm.memset.p0.i64(ptr align 16 %61, i8 0, i64 16384, i1 false)
  %112 = load i32, ptr %17, align 4, !tbaa !9
  %113 = icmp slt i32 %112, 16384
  br i1 %113, label %114, label %116

114:                                              ; preds = %111
  %115 = load i32, ptr %17, align 4, !tbaa !9
  br label %117

116:                                              ; preds = %111
  br label %117

117:                                              ; preds = %116, %114
  %118 = phi i32 [ %115, %114 ], [ 16384, %116 ]
  store i32 %118, ptr %16, align 4, !tbaa !9
  %119 = load ptr, ptr %18, align 8, !tbaa !5
  %120 = load i32, ptr %16, align 4, !tbaa !9
  %121 = sext i32 %120 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %61, ptr align 1 %119, i64 %121, i1 false)
  %122 = load i32, ptr %16, align 4, !tbaa !9
  %123 = load i32, ptr %17, align 4, !tbaa !9
  %124 = sub nsw i32 %123, %122
  store i32 %124, ptr %17, align 4, !tbaa !9
  %125 = load i32, ptr %16, align 4, !tbaa !9
  %126 = load ptr, ptr %18, align 8, !tbaa !5
  %127 = sext i32 %125 to i64
  %128 = getelementptr inbounds i8, ptr %126, i64 %127
  store ptr %128, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %129 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %129, ptr %21, align 4, !tbaa !9
  %130 = load i32, ptr %16, align 4, !tbaa !9
  %131 = srem i32 %130, 16
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %139

133:                                              ; preds = %117
  %134 = load i32, ptr %16, align 4, !tbaa !9
  %135 = load i32, ptr %16, align 4, !tbaa !9
  %136 = srem i32 %135, 16
  %137 = sub nsw i32 16, %136
  %138 = add nsw i32 %134, %137
  store i32 %138, ptr %21, align 4, !tbaa !9
  br label %139

139:                                              ; preds = %133, %117
  %140 = load i32, ptr %21, align 4, !tbaa !9
  call void @AES_CBC_encrypt_buffer(ptr noundef %19, ptr noundef %61, i32 noundef %140)
  %141 = load i8, ptr %20, align 1, !tbaa !14, !range !16, !noundef !17
  %142 = trunc i8 %141 to i1
  br i1 %142, label %143, label %178

143:                                              ; preds = %139
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  %144 = load i32, ptr %21, align 4, !tbaa !9
  %145 = sdiv i32 %144, 1024
  store i32 %145, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  store i32 0, ptr %23, align 4, !tbaa !9
  br label %146

146:                                              ; preds = %169, %143
  %147 = load i32, ptr %23, align 4, !tbaa !9
  %148 = load i32, ptr %22, align 4, !tbaa !9
  %149 = icmp slt i32 %147, %148
  br i1 %149, label %151, label %150

150:                                              ; preds = %146
  store i32 6, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  br label %172

151:                                              ; preds = %146
  call void @llvm.lifetime.start.p0(i64 1, ptr %24) #7
  %152 = load i32, ptr %23, align 4, !tbaa !9
  %153 = mul nsw i32 %152, 1024
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds i8, ptr %61, i64 %154
  %156 = load i8, ptr %155, align 1, !tbaa !11
  store i8 %156, ptr %24, align 1, !tbaa !11
  %157 = load i32, ptr %23, align 4, !tbaa !9
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds i8, ptr %60, i64 %158
  %160 = load i8, ptr %159, align 1, !tbaa !11
  %161 = load i32, ptr %23, align 4, !tbaa !9
  %162 = mul nsw i32 %161, 1024
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds i8, ptr %61, i64 %163
  store i8 %160, ptr %164, align 1, !tbaa !11
  %165 = load i8, ptr %24, align 1, !tbaa !11
  %166 = load i32, ptr %23, align 4, !tbaa !9
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds i8, ptr %60, i64 %167
  store i8 %165, ptr %168, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 1, ptr %24) #7
  br label %169

169:                                              ; preds = %151
  %170 = load i32, ptr %23, align 4, !tbaa !9
  %171 = add nsw i32 %170, 1
  store i32 %171, ptr %23, align 4, !tbaa !9
  br label %146, !llvm.loop !18

172:                                              ; preds = %150
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  %173 = getelementptr inbounds i8, ptr %58, i64 5
  store ptr %173, ptr %25, align 8, !tbaa !5
  %174 = load ptr, ptr %25, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %174, ptr align 16 %60, i64 16, i1 false)
  %175 = load ptr, ptr %11, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %175, ptr align 16 %58, i64 21, i1 false)
  %176 = load ptr, ptr %11, align 8, !tbaa !5
  %177 = getelementptr inbounds i8, ptr %176, i64 21
  store ptr %177, ptr %11, align 8, !tbaa !5
  store i8 0, ptr %20, align 1, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %178

178:                                              ; preds = %172, %139
  %179 = load ptr, ptr %11, align 8, !tbaa !5
  %180 = load i32, ptr %21, align 4, !tbaa !9
  %181 = sext i32 %180 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %179, ptr align 16 %61, i64 %181, i1 false)
  %182 = load i32, ptr %21, align 4, !tbaa !9
  %183 = load ptr, ptr %11, align 8, !tbaa !5
  %184 = sext i32 %182 to i64
  %185 = getelementptr inbounds i8, ptr %183, i64 %184
  store ptr %185, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %108, !llvm.loop !19

186:                                              ; preds = %108
  %187 = load ptr, ptr %9, align 8, !tbaa !5
  %188 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %187, ptr %188, align 8, !tbaa !5
  %189 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %189, ptr %4, align 4
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 192, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 88, ptr %15) #7
  %190 = load ptr, ptr %14, align 8
  call void @llvm.stackrestore.p0(ptr %190)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %191

191:                                              ; preds = %186, %53
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %192

192:                                              ; preds = %191, %34
  %193 = load i32, ptr %4, align 4
  ret i32 %193
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn }
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 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { nounwind }
attributes #8 = { 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 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !15, i64 0}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13}


; 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.MD5_CTX = type { [2 x i32], [4 x i32], [64 x i8] }
%struct.AES_ctx = type { [176 x i8], [16 x i8] }

@.str.2 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [17 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 nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #1

; 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 void @AES_init_ctx_iv(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; 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 nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #1

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

; 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 void @MD5Init(ptr noundef) local_unnamed_addr #3

declare void @MD5Update(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

declare void @MD5Final(ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @AES_CBC_encrypt_buffer(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, -2147483648) i32 @AOECrypto_encryptAoeDataToData_Version1(ptr noundef readonly %0, i32 noundef %1, ptr noundef writeonly %2) local_unnamed_addr #6 {
  %4 = alloca %struct.MD5_CTX, align 4
  %5 = alloca %struct.AES_ctx, align 1
  %6 = icmp eq ptr %0, null
  %7 = icmp eq ptr %2, null
  %or.cond = or i1 %6, %7
  %8 = icmp slt i32 %1, 1
  %or.cond3 = or i1 %8, %or.cond
  br i1 %or.cond3, label %68, label %9

9:                                                ; preds = %3
  %10 = add nuw nsw i32 %1, 21
  %11 = and i32 %1, 15
  %.not = icmp eq i32 %11, 0
  %12 = and i32 %1, 2147483632
  %13 = add nuw i32 %12, 37
  %.067 = select i1 %.not, i32 %10, i32 %13
  %14 = zext nneg i32 %.067 to i64
  %15 = tail call noalias ptr @malloc(i64 noundef %14) #8
  %16 = icmp eq ptr %15, null
  br i1 %16, label %68, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %9
  %17 = tail call ptr @llvm.stacksave.p0()
  %18 = alloca [21 x i8], align 16
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(21) %18, i8 0, i64 21, i1 false)
  store i8 1, ptr %18, align 16, !tbaa !5
  %19 = alloca [16 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %4) #9
  call void @MD5Init(ptr noundef nonnull %4) #9
  %20 = alloca [16384 x i8], align 16
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.07286 = phi ptr [ %24, %.lr.ph ], [ %0, %.lr.ph.preheader ]
  %.07485 = phi i32 [ %23, %.lr.ph ], [ %1, %.lr.ph.preheader ]
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16384) %20, i8 0, i64 16384, i1 false)
  %21 = call i32 @llvm.umin.i32(i32 %.07485, i32 16384)
  %22 = zext nneg i32 %21 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %20, ptr noundef nonnull align 1 dereferenceable(1) %.07286, i64 %22, i1 false)
  call void @MD5Update(ptr noundef nonnull %4, ptr noundef nonnull %20, i32 noundef %21) #9
  %23 = sub nsw i32 %.07485, %21
  %24 = getelementptr inbounds i8, ptr %.07286, i64 %22
  %25 = icmp sgt i32 %23, 0
  br i1 %25, label %.lr.ph, label %.lr.ph96, !llvm.loop !8

.lr.ph96:                                         ; preds = %.lr.ph
  call void @MD5Final(ptr noundef nonnull %4, ptr noundef nonnull %19) #9
  %26 = lshr i32 %1, 24
  %27 = trunc nuw nsw i32 %26 to i8
  %28 = getelementptr inbounds i8, ptr %18, i64 1
  store i8 %27, ptr %28, align 1, !tbaa !5
  %29 = lshr i32 %1, 16
  %30 = trunc i32 %29 to i8
  %31 = getelementptr inbounds i8, ptr %18, i64 2
  store i8 %30, ptr %31, align 2, !tbaa !5
  %32 = lshr i32 %1, 8
  %33 = trunc i32 %32 to i8
  %34 = getelementptr inbounds i8, ptr %18, i64 3
  store i8 %33, ptr %34, align 1, !tbaa !5
  %35 = trunc i32 %1 to i8
  %36 = getelementptr inbounds i8, ptr %18, i64 4
  store i8 %35, ptr %36, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 192, ptr nonnull %5) #9
  call void @AES_init_ctx_iv(ptr noundef nonnull %5, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3) #9
  %37 = getelementptr inbounds i8, ptr %18, i64 5
  br label %38

38:                                               ; preds = %.lr.ph96, %64
  %.07094 = phi i1 [ true, %.lr.ph96 ], [ false, %64 ]
  %.17393 = phi ptr [ %0, %.lr.ph96 ], [ %42, %64 ]
  %.17592 = phi i32 [ %1, %.lr.ph96 ], [ %41, %64 ]
  %.07691 = phi ptr [ %15, %.lr.ph96 ], [ %66, %64 ]
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16384) %20, i8 0, i64 16384, i1 false)
  %39 = call i32 @llvm.umin.i32(i32 %.17592, i32 16384)
  %40 = zext nneg i32 %39 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %20, ptr align 1 %.17393, i64 %40, i1 false)
  %41 = sub nsw i32 %.17592, %39
  %42 = getelementptr inbounds i8, ptr %.17393, i64 %40
  %43 = and i32 %39, 15
  %.not84 = icmp eq i32 %43, 0
  %reass.sub = and i32 %39, 32752
  %44 = add nuw nsw i32 %reass.sub, 16
  %.069 = select i1 %.not84, i32 %39, i32 %44
  call void @AES_CBC_encrypt_buffer(ptr noundef nonnull %5, ptr noundef nonnull %20, i32 noundef %.069) #9
  br i1 %.07094, label %45, label %64

45:                                               ; preds = %38
  %.not98 = icmp ult i32 %.069, 1024
  br i1 %.not98, label %._crit_edge90, label %.lr.ph89.preheader

.lr.ph89.preheader:                               ; preds = %45
  %46 = lshr i32 %.069, 10
  %wide.trip.count = zext nneg i32 %46 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %47 = icmp eq i32 %46, 1
  br i1 %47, label %._crit_edge90.loopexit.unr-lcssa, label %.lr.ph89.preheader.new

.lr.ph89.preheader.new:                           ; preds = %.lr.ph89.preheader
  %unroll_iter = and i64 %wide.trip.count, 62
  br label %.lr.ph89

._crit_edge90.loopexit.unr-lcssa:                 ; preds = %.lr.ph89, %.lr.ph89.preheader
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph89.preheader ], [ %indvars.iv.next.1, %.lr.ph89 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge90, label %.lr.ph89.epil

.lr.ph89.epil:                                    ; preds = %._crit_edge90.loopexit.unr-lcssa
  %48 = shl nsw i64 %indvars.iv.unr, 10
  %49 = getelementptr inbounds i8, ptr %20, i64 %48
  %50 = load i8, ptr %49, align 16, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %19, i64 %indvars.iv.unr
  %52 = load i8, ptr %51, align 1, !tbaa !5
  store i8 %52, ptr %49, align 16, !tbaa !5
  store i8 %50, ptr %51, align 1, !tbaa !5
  br label %._crit_edge90

._crit_edge90:                                    ; preds = %.lr.ph89.epil, %._crit_edge90.loopexit.unr-lcssa, %45
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(16) %37, ptr noundef nonnull align 16 dereferenceable(16) %19, i64 16, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(21) %.07691, ptr noundef nonnull align 16 dereferenceable(21) %18, i64 21, i1 false)
  %53 = getelementptr inbounds i8, ptr %.07691, i64 21
  br label %64

.lr.ph89:                                         ; preds = %.lr.ph89, %.lr.ph89.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph89.preheader.new ], [ %indvars.iv.next.1, %.lr.ph89 ]
  %niter = phi i64 [ 0, %.lr.ph89.preheader.new ], [ %niter.next.1, %.lr.ph89 ]
  %54 = shl nsw i64 %indvars.iv, 10
  %55 = getelementptr inbounds i8, ptr %20, i64 %54
  %56 = load i8, ptr %55, align 16, !tbaa !5
  %57 = getelementptr inbounds i8, ptr %19, i64 %indvars.iv
  %58 = load i8, ptr %57, align 2, !tbaa !5
  store i8 %58, ptr %55, align 16, !tbaa !5
  store i8 %56, ptr %57, align 2, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %59 = shl nsw i64 %indvars.iv.next, 10
  %60 = getelementptr inbounds i8, ptr %20, i64 %59
  %61 = load i8, ptr %60, align 16, !tbaa !5
  %62 = getelementptr inbounds i8, ptr %19, i64 %indvars.iv.next
  %63 = load i8, ptr %62, align 1, !tbaa !5
  store i8 %63, ptr %60, align 16, !tbaa !5
  store i8 %61, ptr %62, align 1, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge90.loopexit.unr-lcssa, label %.lr.ph89, !llvm.loop !10

64:                                               ; preds = %._crit_edge90, %38
  %.177 = phi ptr [ %53, %._crit_edge90 ], [ %.07691, %38 ]
  %65 = zext nneg i32 %.069 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %.177, ptr nonnull align 16 %20, i64 %65, i1 false)
  %66 = getelementptr inbounds i8, ptr %.177, i64 %65
  %67 = icmp sgt i32 %41, 0
  br i1 %67, label %38, label %._crit_edge97, !llvm.loop !11

._crit_edge97:                                    ; preds = %64
  store ptr %15, ptr %2, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 192, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %4) #9
  call void @llvm.stackrestore.p0(ptr %17)
  br label %68

68:                                               ; preds = %._crit_edge97, %9, %3
  %.1 = phi i32 [ -1, %3 ], [ %.067, %._crit_edge97 ], [ -1, %9 ]
  ret i32 %.1
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = { 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { 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"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = distinct !{!11, !9}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !6, i64 0}


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass