; 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 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.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

declare noalias ptr @fopen(ptr noundef, ptr noundef) #1

declare i32 @fclose(ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

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

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #1

declare void @AES_init_ctx_iv(ptr noundef, 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

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

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

; Function Attrs: nounwind uwtable
define dso_local i32 @AOECrypto_encryptAoeFile_Version1(ptr noundef %0, ptr noundef %1) #5 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %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 [21 x i8], align 16
  %12 = alloca ptr, align 8
  %13 = alloca %struct.MD5_CTX, align 4
  %14 = alloca i32, align 4
  %15 = alloca %struct.AES_ctx, align 1
  %16 = alloca i8, align 1
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i8, align 1
  %21 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = icmp eq ptr null, %22
  br i1 %23, label %27, label %24

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

27:                                               ; preds = %24, %2
  store i32 -1, ptr %3, align 4
  br label %161

28:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = call noalias ptr @fopen(ptr noundef %29, ptr noundef @.str)
  store ptr %30, ptr %7, align 8, !tbaa !5
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = icmp eq ptr null, %31
  br i1 %32, label %33, label %34

33:                                               ; preds = %28
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %160

34:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = call noalias ptr @fopen(ptr noundef %35, ptr noundef @.str.1)
  store ptr %36, ptr %9, align 8, !tbaa !5
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = icmp eq ptr null, %37
  br i1 %38, label %39, label %42

39:                                               ; preds = %34
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = call i32 @fclose(ptr noundef %40)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %159

42:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 21, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 21, ptr %11) #6
  %43 = getelementptr inbounds [21 x i8], ptr %11, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %43, i8 0, i64 21, i1 false)
  %44 = getelementptr inbounds [21 x i8], ptr %11, i64 0, i64 0
  store i8 1, ptr %44, align 16, !tbaa !11
  %45 = call ptr @llvm.stacksave.p0()
  store ptr %45, ptr %12, align 8
  %46 = alloca i8, i64 16, align 16
  call void @llvm.lifetime.start.p0(i64 88, ptr %13) #6
  call void @MD5Init(ptr noundef %13)
  %47 = alloca i8, i64 16384, align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %48

48:                                               ; preds = %60, %42
  call void @llvm.memset.p0.i64(ptr align 16 %47, i8 0, i64 16384, i1 false)
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = call i64 @fread(ptr noundef %47, i64 noundef 1, i64 noundef 16384, ptr noundef %49)
  %51 = trunc i64 %50 to i32
  store i32 %51, ptr %14, align 4, !tbaa !9
  %52 = load i32, ptr %14, align 4, !tbaa !9
  %53 = icmp sle i32 %52, 0
  br i1 %53, label %54, label %55

54:                                               ; preds = %48
  br label %63

55:                                               ; preds = %48
  %56 = load i32, ptr %14, align 4, !tbaa !9
  %57 = load i32, ptr %6, align 4, !tbaa !9
  %58 = add nsw i32 %57, %56
  store i32 %58, ptr %6, align 4, !tbaa !9
  %59 = load i32, ptr %14, align 4, !tbaa !9
  call void @MD5Update(ptr noundef %13, ptr noundef %47, i32 noundef %59)
  br label %60

60:                                               ; preds = %55
  %61 = load i32, ptr %14, align 4, !tbaa !9
  %62 = icmp sgt i32 %61, 0
  br i1 %62, label %48, label %63, !llvm.loop !12

63:                                               ; preds = %60, %54
  call void @MD5Final(ptr noundef %13, ptr noundef %46)
  %64 = load i32, ptr %6, align 4, !tbaa !9
  %65 = ashr i32 %64, 24
  %66 = and i32 %65, 255
  %67 = trunc i32 %66 to i8
  %68 = getelementptr inbounds [21 x i8], ptr %11, i64 0, i64 1
  store i8 %67, ptr %68, align 1, !tbaa !11
  %69 = load i32, ptr %6, align 4, !tbaa !9
  %70 = ashr i32 %69, 16
  %71 = and i32 %70, 255
  %72 = trunc i32 %71 to i8
  %73 = getelementptr inbounds [21 x i8], ptr %11, i64 0, i64 2
  store i8 %72, ptr %73, align 2, !tbaa !11
  %74 = load i32, ptr %6, align 4, !tbaa !9
  %75 = ashr i32 %74, 8
  %76 = and i32 %75, 255
  %77 = trunc i32 %76 to i8
  %78 = getelementptr inbounds [21 x i8], ptr %11, i64 0, i64 3
  store i8 %77, ptr %78, align 1, !tbaa !11
  %79 = load i32, ptr %6, align 4, !tbaa !9
  %80 = and i32 %79, 255
  %81 = trunc i32 %80 to i8
  %82 = getelementptr inbounds [21 x i8], ptr %11, i64 0, i64 4
  store i8 %81, ptr %82, align 4, !tbaa !11
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = call i32 @fseek(ptr noundef %83, i64 noundef 0, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 192, ptr %15) #6
  call void @AES_init_ctx_iv(ptr noundef %15, ptr noundef @.str.2, ptr noundef @.str.3)
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #6
  store i8 1, ptr %16, align 1, !tbaa !14
  br label %85

85:                                               ; preds = %149, %63
  call void @llvm.memset.p0.i64(ptr align 16 %47, i8 0, i64 16384, i1 false)
  %86 = load ptr, ptr %7, align 8, !tbaa !5
  %87 = call i64 @fread(ptr noundef %47, i64 noundef 1, i64 noundef 16384, ptr noundef %86)
  %88 = trunc i64 %87 to i32
  store i32 %88, ptr %14, align 4, !tbaa !9
  %89 = load i32, ptr %14, align 4, !tbaa !9
  %90 = icmp sle i32 %89, 0
  br i1 %90, label %91, label %92

91:                                               ; preds = %85
  br label %152

92:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %93 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %93, ptr %17, align 4, !tbaa !9
  %94 = load i32, ptr %14, align 4, !tbaa !9
  %95 = srem i32 %94, 16
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %97, label %103

97:                                               ; preds = %92
  %98 = load i32, ptr %14, align 4, !tbaa !9
  %99 = load i32, ptr %14, align 4, !tbaa !9
  %100 = srem i32 %99, 16
  %101 = sub nsw i32 16, %100
  %102 = add nsw i32 %98, %101
  store i32 %102, ptr %17, align 4, !tbaa !9
  br label %103

103:                                              ; preds = %97, %92
  %104 = load i32, ptr %17, align 4, !tbaa !9
  call void @AES_CBC_encrypt_buffer(ptr noundef %15, ptr noundef %47, i32 noundef %104)
  %105 = load i8, ptr %16, align 1, !tbaa !14, !range !16, !noundef !17
  %106 = trunc i8 %105 to i1
  br i1 %106, label %107, label %144

107:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %108 = load i32, ptr %17, align 4, !tbaa !9
  %109 = sdiv i32 %108, 1024
  store i32 %109, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %110

110:                                              ; preds = %133, %107
  %111 = load i32, ptr %19, align 4, !tbaa !9
  %112 = load i32, ptr %18, align 4, !tbaa !9
  %113 = icmp slt i32 %111, %112
  br i1 %113, label %115, label %114

114:                                              ; preds = %110
  store i32 6, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %136

115:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #6
  %116 = load i32, ptr %19, align 4, !tbaa !9
  %117 = mul nsw i32 %116, 1024
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds i8, ptr %47, i64 %118
  %120 = load i8, ptr %119, align 1, !tbaa !11
  store i8 %120, ptr %20, align 1, !tbaa !11
  %121 = load i32, ptr %19, align 4, !tbaa !9
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds i8, ptr %46, i64 %122
  %124 = load i8, ptr %123, align 1, !tbaa !11
  %125 = load i32, ptr %19, align 4, !tbaa !9
  %126 = mul nsw i32 %125, 1024
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds i8, ptr %47, i64 %127
  store i8 %124, ptr %128, align 1, !tbaa !11
  %129 = load i8, ptr %20, align 1, !tbaa !11
  %130 = load i32, ptr %19, align 4, !tbaa !9
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds i8, ptr %46, i64 %131
  store i8 %129, ptr %132, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #6
  br label %133

133:                                              ; preds = %115
  %134 = load i32, ptr %19, align 4, !tbaa !9
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %19, align 4, !tbaa !9
  br label %110, !llvm.loop !18

136:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %137 = getelementptr inbounds [21 x i8], ptr %11, i64 0, i64 5
  store ptr %137, ptr %21, align 8, !tbaa !5
  %138 = load ptr, ptr %21, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %138, ptr align 16 %46, i64 16, i1 false)
  %139 = load ptr, ptr %9, align 8, !tbaa !5
  %140 = call i32 @fseek(ptr noundef %139, i64 noundef 0, i32 noundef 0)
  %141 = getelementptr inbounds [21 x i8], ptr %11, i64 0, i64 0
  %142 = load ptr, ptr %9, align 8, !tbaa !5
  %143 = call i64 @fwrite(ptr noundef %141, i64 noundef 1, i64 noundef 21, ptr noundef %142)
  store i8 0, ptr %16, align 1, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %144

144:                                              ; preds = %136, %103
  %145 = load i32, ptr %17, align 4, !tbaa !9
  %146 = sext i32 %145 to i64
  %147 = load ptr, ptr %9, align 8, !tbaa !5
  %148 = call i64 @fwrite(ptr noundef %47, i64 noundef 1, i64 noundef %146, ptr noundef %147)
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %149

149:                                              ; preds = %144
  %150 = load i32, ptr %14, align 4, !tbaa !9
  %151 = icmp sgt i32 %150, 0
  br i1 %151, label %85, label %152, !llvm.loop !19

152:                                              ; preds = %149, %91
  %153 = load ptr, ptr %9, align 8, !tbaa !5
  %154 = call i32 @fclose(ptr noundef %153)
  %155 = load ptr, ptr %7, align 8, !tbaa !5
  %156 = call i32 @fclose(ptr noundef %155)
  %157 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %157, ptr %3, align 4
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 192, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 88, ptr %13) #6
  %158 = load ptr, ptr %12, align 8
  call void @llvm.stackrestore.p0(ptr %158)
  call void @llvm.lifetime.end.p0(i64 21, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %159

159:                                              ; preds = %152, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %160

160:                                              ; preds = %159, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %161

161:                                              ; preds = %160, %27
  %162 = load i32, ptr %3, align 4
  ret i32 %162
}

declare void @MD5Init(ptr noundef) #1

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

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

declare i32 @fseek(ptr noundef, i64 noundef, i32 noundef) #1

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 nosync nounwind willreturn }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #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 = !{!"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 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.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: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

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

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #1

declare void @AES_init_ctx_iv(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

; 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 i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

; 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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, -2147483648) i32 @AOECrypto_encryptAoeFile_Version1(ptr noundef readonly %0, ptr noundef readonly %1) local_unnamed_addr #6 {
  %3 = alloca [21 x i8], align 16
  %4 = alloca %struct.MD5_CTX, align 4
  %5 = alloca %struct.AES_ctx, align 1
  %6 = icmp eq ptr %0, null
  %7 = icmp eq ptr %1, null
  %or.cond = or i1 %6, %7
  br i1 %or.cond, label %76, label %8

8:                                                ; preds = %2
  %9 = tail call noalias ptr @fopen(ptr noundef nonnull %0, ptr noundef nonnull @.str)
  %10 = icmp eq ptr %9, null
  br i1 %10, label %76, label %11

11:                                               ; preds = %8
  %12 = tail call noalias ptr @fopen(ptr noundef nonnull %1, ptr noundef nonnull @.str.1)
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %16

14:                                               ; preds = %11
  %15 = tail call i32 @fclose(ptr noundef nonnull %9)
  br label %76

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

.lr.ph:                                           ; preds = %16, %.lr.ph
  %23 = phi i32 [ %26, %.lr.ph ], [ %21, %16 ]
  %.04659 = phi i32 [ %24, %.lr.ph ], [ 0, %16 ]
  %24 = add nuw nsw i32 %23, %.04659
  call void @MD5Update(ptr noundef nonnull %4, ptr noundef nonnull %19, i32 noundef %23) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16384) %19, i8 0, i64 16384, i1 false)
  %25 = call i64 @fread(ptr noundef nonnull %19, i64 noundef 1, i64 noundef 16384, ptr noundef nonnull %9)
  %26 = trunc i64 %25 to i32
  %27 = icmp slt i32 %26, 1
  br i1 %27, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %16
  %.046.lcssa = phi i32 [ 0, %16 ], [ %24, %.lr.ph ]
  call void @MD5Final(ptr noundef nonnull %4, ptr noundef nonnull %18) #7
  %28 = lshr i32 %.046.lcssa, 24
  %29 = trunc nuw nsw i32 %28 to i8
  %30 = getelementptr inbounds i8, ptr %3, i64 1
  store i8 %29, ptr %30, align 1, !tbaa !5
  %31 = lshr i32 %.046.lcssa, 16
  %32 = trunc i32 %31 to i8
  %33 = getelementptr inbounds i8, ptr %3, i64 2
  store i8 %32, ptr %33, align 2, !tbaa !5
  %34 = lshr i32 %.046.lcssa, 8
  %35 = trunc i32 %34 to i8
  %36 = getelementptr inbounds i8, ptr %3, i64 3
  store i8 %35, ptr %36, align 1, !tbaa !5
  %37 = trunc i32 %.046.lcssa to i8
  %38 = getelementptr inbounds i8, ptr %3, i64 4
  store i8 %37, ptr %38, align 4, !tbaa !5
  %39 = call i32 @fseek(ptr noundef nonnull %9, i64 noundef 0, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 192, ptr nonnull %5) #7
  call void @AES_init_ctx_iv(ptr noundef nonnull %5, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16384) %19, i8 0, i64 16384, i1 false)
  %40 = call i64 @fread(ptr noundef nonnull %19, i64 noundef 1, i64 noundef 16384, ptr noundef nonnull %9)
  %41 = trunc i64 %40 to i32
  %42 = icmp slt i32 %41, 1
  br i1 %42, label %._crit_edge67, label %.lr.ph66

.lr.ph66:                                         ; preds = %._crit_edge
  %43 = getelementptr inbounds i8, ptr %3, i64 5
  br label %44

44:                                               ; preds = %.lr.ph66, %68
  %45 = phi i32 [ %41, %.lr.ph66 ], [ %72, %68 ]
  %.05064 = phi i1 [ true, %.lr.ph66 ], [ false, %68 ]
  %46 = and i32 %45, 15
  %.not = icmp eq i32 %46, 0
  %reass.sub = and i32 %45, 2147483632
  %47 = add nuw i32 %reass.sub, 16
  %.049 = select i1 %.not, i32 %45, i32 %47
  call void @AES_CBC_encrypt_buffer(ptr noundef nonnull %5, ptr noundef nonnull %19, i32 noundef %.049) #7
  br i1 %.05064, label %48, label %68

48:                                               ; preds = %44
  %.not68 = icmp ult i32 %.049, 1024
  br i1 %.not68, label %._crit_edge63, label %.lr.ph62.preheader

.lr.ph62.preheader:                               ; preds = %48
  %49 = lshr i32 %.049, 10
  %wide.trip.count = zext nneg i32 %49 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %50 = icmp eq i32 %49, 1
  br i1 %50, label %._crit_edge63.loopexit.unr-lcssa, label %.lr.ph62.preheader.new

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

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

.lr.ph62.epil:                                    ; preds = %._crit_edge63.loopexit.unr-lcssa
  %51 = shl nsw i64 %indvars.iv.unr, 10
  %52 = getelementptr inbounds i8, ptr %19, i64 %51
  %53 = load i8, ptr %52, align 16, !tbaa !5
  %54 = getelementptr inbounds i8, ptr %18, i64 %indvars.iv.unr
  %55 = load i8, ptr %54, align 1, !tbaa !5
  store i8 %55, ptr %52, align 16, !tbaa !5
  store i8 %53, ptr %54, align 1, !tbaa !5
  br label %._crit_edge63

._crit_edge63:                                    ; preds = %.lr.ph62.epil, %._crit_edge63.loopexit.unr-lcssa, %48
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(16) %43, ptr noundef nonnull align 16 dereferenceable(16) %18, i64 16, i1 false)
  %56 = call i32 @fseek(ptr noundef nonnull %12, i64 noundef 0, i32 noundef 0)
  %57 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 1, i64 noundef 21, ptr noundef nonnull %12)
  br label %68

.lr.ph62:                                         ; preds = %.lr.ph62, %.lr.ph62.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph62.preheader.new ], [ %indvars.iv.next.1, %.lr.ph62 ]
  %niter = phi i64 [ 0, %.lr.ph62.preheader.new ], [ %niter.next.1, %.lr.ph62 ]
  %58 = shl nsw i64 %indvars.iv, 10
  %59 = getelementptr inbounds i8, ptr %19, i64 %58
  %60 = load i8, ptr %59, align 16, !tbaa !5
  %61 = getelementptr inbounds i8, ptr %18, i64 %indvars.iv
  %62 = load i8, ptr %61, align 2, !tbaa !5
  store i8 %62, ptr %59, align 16, !tbaa !5
  store i8 %60, ptr %61, align 2, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %63 = shl nsw i64 %indvars.iv.next, 10
  %64 = getelementptr inbounds i8, ptr %19, i64 %63
  %65 = load i8, ptr %64, align 16, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %18, i64 %indvars.iv.next
  %67 = load i8, ptr %66, align 1, !tbaa !5
  store i8 %67, ptr %64, align 16, !tbaa !5
  store i8 %65, ptr %66, 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_edge63.loopexit.unr-lcssa, label %.lr.ph62, !llvm.loop !8

68:                                               ; preds = %._crit_edge63, %44
  %69 = zext nneg i32 %.049 to i64
  %70 = call i64 @fwrite(ptr noundef nonnull %19, i64 noundef 1, i64 noundef %69, ptr noundef nonnull %12)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16384) %19, i8 0, i64 16384, i1 false)
  %71 = call i64 @fread(ptr noundef nonnull %19, i64 noundef 1, i64 noundef 16384, ptr noundef nonnull %9)
  %72 = trunc i64 %71 to i32
  %73 = icmp slt i32 %72, 1
  br i1 %73, label %._crit_edge67, label %44

._crit_edge67:                                    ; preds = %68, %._crit_edge
  %74 = call i32 @fclose(ptr noundef nonnull %12)
  %75 = call i32 @fclose(ptr noundef nonnull %9)
  call void @llvm.lifetime.end.p0(i64 192, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %4) #7
  call void @llvm.stackrestore.p0(ptr %17)
  call void @llvm.lifetime.end.p0(i64 21, ptr nonnull %3) #7
  br label %76

76:                                               ; preds = %8, %._crit_edge67, %14, %2
  %.2 = phi i32 [ -1, %2 ], [ -1, %8 ], [ -1, %14 ], [ %.046.lcssa, %._crit_edge67 ]
  ret i32 %.2
}

declare void @MD5Init(ptr noundef) local_unnamed_addr #4

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @fseek(ptr nocapture noundef, i64 noundef, i32 noundef) local_unnamed_addr #1

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

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 nosync nounwind willreturn }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { "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 = { 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"}


; 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