; 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.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

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

27:                                               ; preds = %4
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = icmp eq ptr null, %28
  br i1 %29, label %36, label %30

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

33:                                               ; preds = %30
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = icmp eq ptr null, %34
  br i1 %35, label %36, label %37

36:                                               ; preds = %33, %30, %27, %4
  store i32 -1, ptr %5, align 4
  br label %181

37:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = call noalias ptr @fopen(ptr noundef %38, ptr noundef @.str)
  store ptr %39, ptr %10, align 8, !tbaa !5
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = icmp eq ptr null, %40
  br i1 %41, label %42, label %45

42:                                               ; preds = %37
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = call i32 @fclose(ptr noundef %43)
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %180

45:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = call i32 @fgetc(ptr noundef %46)
  store i32 %47, ptr %12, align 4, !tbaa !9
  %48 = load i32, ptr %12, align 4, !tbaa !9
  %49 = icmp eq i32 %48, 1
  br i1 %49, label %50, label %176

50:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 20, ptr %13, align 4, !tbaa !9
  %51 = call ptr @llvm.stacksave.p0()
  store ptr %51, ptr %14, align 8
  %52 = alloca i8, i64 20, align 16
  call void @llvm.memset.p0.i64(ptr align 16 %52, i8 0, i64 20, i1 false)
  %53 = load ptr, ptr %10, align 8, !tbaa !5
  %54 = call i64 @fread(ptr noundef %52, i64 noundef 1, i64 noundef 20, ptr noundef %53)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %55 = getelementptr inbounds i8, ptr %52, i64 0
  %56 = load i8, ptr %55, align 16, !tbaa !11
  %57 = zext i8 %56 to i32
  %58 = shl i32 %57, 24
  %59 = and i32 %58, -16777216
  %60 = getelementptr inbounds i8, ptr %52, i64 1
  %61 = load i8, ptr %60, align 1, !tbaa !11
  %62 = zext i8 %61 to i32
  %63 = shl i32 %62, 16
  %64 = and i32 %63, 16711680
  %65 = or i32 %59, %64
  %66 = getelementptr inbounds i8, ptr %52, i64 2
  %67 = load i8, ptr %66, align 2, !tbaa !11
  %68 = zext i8 %67 to i32
  %69 = shl i32 %68, 8
  %70 = and i32 %69, 65280
  %71 = or i32 %65, %70
  %72 = getelementptr inbounds i8, ptr %52, i64 3
  %73 = load i8, ptr %72, align 1, !tbaa !11
  %74 = zext i8 %73 to i32
  %75 = and i32 %74, 255
  %76 = or i32 %71, %75
  store i32 %76, ptr %15, align 4, !tbaa !9
  %77 = load i32, ptr %15, align 4, !tbaa !9
  %78 = icmp sle i32 %77, 0
  br i1 %78, label %79, label %82

79:                                               ; preds = %50
  %80 = load ptr, ptr %10, align 8, !tbaa !5
  %81 = call i32 @fclose(ptr noundef %80)
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %174

82:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = call noalias ptr @fopen(ptr noundef %83, ptr noundef @.str.1)
  store ptr %84, ptr %16, align 8, !tbaa !5
  %85 = load ptr, ptr %16, align 8, !tbaa !5
  %86 = icmp eq ptr null, %85
  br i1 %86, label %87, label %90

87:                                               ; preds = %82
  %88 = load ptr, ptr %10, align 8, !tbaa !5
  %89 = call i32 @fclose(ptr noundef %88)
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %173

90:                                               ; preds = %82
  %91 = alloca i8, i64 16384, align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 0, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 192, ptr %18) #5
  %92 = load ptr, ptr %8, align 8, !tbaa !5
  %93 = load ptr, ptr %9, align 8, !tbaa !5
  call void @AES_init_ctx_iv(ptr noundef %18, ptr noundef %92, ptr noundef %93)
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  store i64 0, ptr %19, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #5
  store i8 1, ptr %20, align 1, !tbaa !14
  br label %94

94:                                               ; preds = %165, %90
  call void @llvm.memset.p0.i64(ptr align 16 %91, i8 0, i64 16384, i1 false)
  %95 = load ptr, ptr %10, align 8, !tbaa !5
  %96 = call i64 @fread(ptr noundef %91, i64 noundef 1, i64 noundef 16384, ptr noundef %95)
  %97 = trunc i64 %96 to i32
  store i32 %97, ptr %17, align 4, !tbaa !9
  %98 = load i32, ptr %17, align 4, !tbaa !9
  %99 = icmp sle i32 %98, 0
  br i1 %99, label %100, label %101

100:                                              ; preds = %94
  br label %168

101:                                              ; preds = %94
  %102 = load i32, ptr %17, align 4, !tbaa !9
  %103 = sext i32 %102 to i64
  %104 = load i64, ptr %19, align 8, !tbaa !12
  %105 = add nsw i64 %104, %103
  store i64 %105, ptr %19, align 8, !tbaa !12
  %106 = load i8, ptr %20, align 1, !tbaa !14, !range !16, !noundef !17
  %107 = trunc i8 %106 to i1
  br i1 %107, label %108, label %140

108:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  %109 = load i32, ptr %17, align 4, !tbaa !9
  %110 = sdiv i32 %109, 1024
  store i32 %110, ptr %21, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  store i32 0, ptr %22, align 4, !tbaa !9
  br label %111

111:                                              ; preds = %136, %108
  %112 = load i32, ptr %22, align 4, !tbaa !9
  %113 = load i32, ptr %21, align 4, !tbaa !9
  %114 = icmp slt i32 %112, %113
  br i1 %114, label %116, label %115

115:                                              ; preds = %111
  store i32 4, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  br label %139

116:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 1, ptr %23) #5
  %117 = load i32, ptr %22, align 4, !tbaa !9
  %118 = mul nsw i32 %117, 1024
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds i8, ptr %91, i64 %119
  %121 = load i8, ptr %120, align 1, !tbaa !11
  store i8 %121, ptr %23, align 1, !tbaa !11
  %122 = load i32, ptr %22, align 4, !tbaa !9
  %123 = add nsw i32 4, %122
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds i8, ptr %52, i64 %124
  %126 = load i8, ptr %125, align 1, !tbaa !11
  %127 = load i32, ptr %22, align 4, !tbaa !9
  %128 = mul nsw i32 %127, 1024
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds i8, ptr %91, i64 %129
  store i8 %126, ptr %130, align 1, !tbaa !11
  %131 = load i8, ptr %23, align 1, !tbaa !11
  %132 = load i32, ptr %22, align 4, !tbaa !9
  %133 = add nsw i32 4, %132
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds i8, ptr %52, i64 %134
  store i8 %131, ptr %135, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 1, ptr %23) #5
  br label %136

136:                                              ; preds = %116
  %137 = load i32, ptr %22, align 4, !tbaa !9
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %22, align 4, !tbaa !9
  br label %111, !llvm.loop !18

139:                                              ; preds = %115
  store i8 0, ptr %20, align 1, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  br label %140

140:                                              ; preds = %139, %101
  %141 = load i32, ptr %17, align 4, !tbaa !9
  call void @AES_CBC_decrypt_buffer(ptr noundef %18, ptr noundef %91, i32 noundef %141)
  %142 = load i64, ptr %19, align 8, !tbaa !12
  %143 = load i32, ptr %15, align 4, !tbaa !9
  %144 = sext i32 %143 to i64
  %145 = icmp slt i64 %142, %144
  br i1 %145, label %146, label %151

146:                                              ; preds = %140
  %147 = load i32, ptr %17, align 4, !tbaa !9
  %148 = sext i32 %147 to i64
  %149 = load ptr, ptr %16, align 8, !tbaa !5
  %150 = call i64 @fwrite(ptr noundef %91, i64 noundef 1, i64 noundef %148, ptr noundef %149)
  br label %164

151:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  %152 = load i32, ptr %17, align 4, !tbaa !9
  %153 = sext i32 %152 to i64
  %154 = load i64, ptr %19, align 8, !tbaa !12
  %155 = load i32, ptr %15, align 4, !tbaa !9
  %156 = sext i32 %155 to i64
  %157 = sub nsw i64 %154, %156
  %158 = sub nsw i64 %153, %157
  %159 = trunc i64 %158 to i32
  store i32 %159, ptr %24, align 4, !tbaa !9
  %160 = load i32, ptr %24, align 4, !tbaa !9
  %161 = sext i32 %160 to i64
  %162 = load ptr, ptr %16, align 8, !tbaa !5
  %163 = call i64 @fwrite(ptr noundef %91, i64 noundef 1, i64 noundef %161, ptr noundef %162)
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  br label %164

164:                                              ; preds = %151, %146
  br label %165

165:                                              ; preds = %164
  %166 = load i32, ptr %17, align 4, !tbaa !9
  %167 = icmp sgt i32 %166, 0
  br i1 %167, label %94, label %168, !llvm.loop !20

168:                                              ; preds = %165, %100
  %169 = load ptr, ptr %16, align 8, !tbaa !5
  %170 = call i32 @fclose(ptr noundef %169)
  %171 = load ptr, ptr %10, align 8, !tbaa !5
  %172 = call i32 @fclose(ptr noundef %171)
  store i32 0, ptr %5, align 4
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 192, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %173

173:                                              ; preds = %168, %87
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %174

174:                                              ; preds = %173, %79
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  %175 = load ptr, ptr %14, align 8
  call void @llvm.stackrestore.p0(ptr %175)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %179

176:                                              ; preds = %45
  %177 = load ptr, ptr %10, align 8, !tbaa !5
  %178 = call i32 @fclose(ptr noundef %177)
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %179

179:                                              ; preds = %176, %174
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %180

180:                                              ; preds = %179, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %181

181:                                              ; preds = %180, %36
  %182 = load i32, ptr %5, align 4
  ret i32 %182
}

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

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

declare i32 @fclose(ptr noundef) #2

declare i32 @fgetc(ptr noundef) #2

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

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

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

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

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

declare void @AES_CBC_decrypt_buffer(ptr noundef, ptr noundef, i32 noundef) #2

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { "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 = { nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}


; 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.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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @AOECrypto_decryptAoeFile_cbc(ptr noundef readonly %0, ptr noundef readonly %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #0 {
  %5 = alloca %struct.AES_ctx, align 1
  %6 = insertelement <4 x ptr> poison, ptr %0, i64 0
  %7 = insertelement <4 x ptr> %6, ptr %1, i64 1
  %8 = insertelement <4 x ptr> %7, ptr %2, i64 2
  %9 = insertelement <4 x ptr> %8, ptr %3, i64 3
  %10 = icmp eq <4 x ptr> %9, zeroinitializer
  %11 = bitcast <4 x i1> %10 to i4
  %.not73 = icmp eq i4 %11, 0
  br i1 %.not73, label %12, label %86

12:                                               ; preds = %4
  %13 = tail call noalias ptr @fopen(ptr noundef nonnull %0, ptr noundef nonnull @.str)
  %14 = icmp eq ptr %13, null
  br i1 %14, label %15, label %17

15:                                               ; preds = %12
  %16 = tail call i32 @fclose(ptr noundef null)
  br label %86

17:                                               ; preds = %12
  %18 = tail call i32 @fgetc(ptr noundef nonnull %13)
  %19 = icmp eq i32 %18, 1
  br i1 %19, label %20, label %84

20:                                               ; preds = %17
  %21 = tail call ptr @llvm.stacksave.p0()
  %22 = alloca [20 x i8], align 16
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(20) %22, i8 0, i64 20, i1 false)
  %23 = call i64 @fread(ptr noundef nonnull %22, i64 noundef 1, i64 noundef 20, ptr noundef nonnull %13)
  %24 = load i8, ptr %22, align 16, !tbaa !5
  %25 = zext i8 %24 to i32
  %26 = shl nuw i32 %25, 24
  %27 = getelementptr inbounds i8, ptr %22, i64 1
  %28 = load i8, ptr %27, align 1, !tbaa !5
  %29 = zext i8 %28 to i32
  %30 = shl nuw nsw i32 %29, 16
  %31 = or disjoint i32 %30, %26
  %32 = getelementptr inbounds i8, ptr %22, i64 2
  %33 = load i8, ptr %32, align 2, !tbaa !5
  %34 = zext i8 %33 to i32
  %35 = shl nuw nsw i32 %34, 8
  %36 = or disjoint i32 %31, %35
  %37 = getelementptr inbounds i8, ptr %22, i64 3
  %38 = load i8, ptr %37, align 1, !tbaa !5
  %39 = zext i8 %38 to i32
  %40 = or disjoint i32 %36, %39
  %41 = icmp slt i32 %40, 1
  br i1 %41, label %42, label %44

42:                                               ; preds = %20
  %43 = tail call i32 @fclose(ptr noundef nonnull %13)
  br label %83

44:                                               ; preds = %20
  %45 = tail call noalias ptr @fopen(ptr noundef nonnull %1, ptr noundef nonnull @.str.1)
  %46 = icmp eq ptr %45, null
  br i1 %46, label %47, label %49

47:                                               ; preds = %44
  %48 = tail call i32 @fclose(ptr noundef nonnull %13)
  br label %83

49:                                               ; preds = %44
  %50 = alloca [16384 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 192, ptr nonnull %5) #6
  call void @AES_init_ctx_iv(ptr noundef nonnull %5, ptr noundef nonnull %2, ptr noundef nonnull %3) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16384) %50, i8 0, i64 16384, i1 false)
  %51 = call i64 @fread(ptr noundef nonnull %50, i64 noundef 1, i64 noundef 16384, ptr noundef nonnull %13)
  %52 = trunc i64 %51 to i32
  %53 = icmp slt i32 %52, 1
  br i1 %53, label %._crit_edge, label %.lr.ph70

.lr.ph70:                                         ; preds = %49
  %invariant.gep = getelementptr inbounds i8, ptr %22, i64 4
  %54 = zext nneg i32 %40 to i64
  br label %55

55:                                               ; preds = %.lr.ph70, %.loopexit
  %56 = phi i32 [ %52, %.lr.ph70 ], [ %79, %.loopexit ]
  %57 = phi i64 [ %51, %.lr.ph70 ], [ %78, %.loopexit ]
  %.05269.not = phi i1 [ false, %.lr.ph70 ], [ true, %.loopexit ]
  %.05468 = phi i64 [ 0, %.lr.ph70 ], [ %59, %.loopexit ]
  %58 = and i64 %57, 2147483647
  %59 = add nuw nsw i64 %58, %.05468
  %.not = icmp ult i32 %56, 1024
  %or.cond72 = or i1 %.05269.not, %.not
  br i1 %or.cond72, label %.loopexit, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %55
  %60 = lshr i32 %56, 10
  %wide.trip.count = zext nneg i32 %60 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %61 = icmp eq i32 %60, 1
  br i1 %61, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph.preheader.new

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

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

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

.lr.ph.epil:                                      ; preds = %.loopexit.loopexit.unr-lcssa
  %70 = shl nsw i64 %indvars.iv.unr, 10
  %71 = getelementptr inbounds i8, ptr %50, i64 %70
  %72 = load i8, ptr %71, align 16, !tbaa !5
  %gep.epil = getelementptr inbounds i8, ptr %invariant.gep, i64 %indvars.iv.unr
  %73 = load i8, ptr %gep.epil, align 1, !tbaa !5
  store i8 %73, ptr %71, align 16, !tbaa !5
  store i8 %72, ptr %gep.epil, align 1, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph.epil, %.loopexit.loopexit.unr-lcssa, %55
  call void @AES_CBC_decrypt_buffer(ptr noundef nonnull %5, ptr noundef nonnull %50, i32 noundef %56) #6
  %74 = icmp ult i64 %59, %54
  %.neg = add i64 %57, %54
  %75 = sub i64 %.neg, %59
  %sext = shl i64 %75, 32
  %76 = ashr exact i64 %sext, 32
  %.sink = select i1 %74, i64 %58, i64 %76
  %77 = call i64 @fwrite(ptr noundef nonnull %50, i64 noundef 1, i64 noundef %.sink, ptr noundef nonnull %45)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16384) %50, i8 0, i64 16384, i1 false)
  %78 = call i64 @fread(ptr noundef nonnull %50, i64 noundef 1, i64 noundef 16384, ptr noundef nonnull %13)
  %79 = trunc i64 %78 to i32
  %80 = icmp slt i32 %79, 1
  br i1 %80, label %._crit_edge, label %55

._crit_edge:                                      ; preds = %.loopexit, %49
  %81 = call i32 @fclose(ptr noundef nonnull %45)
  %82 = call i32 @fclose(ptr noundef nonnull %13)
  call void @llvm.lifetime.end.p0(i64 192, ptr nonnull %5) #6
  br label %83

83:                                               ; preds = %47, %._crit_edge, %42
  %.1 = phi i32 [ -1, %42 ], [ -1, %47 ], [ 0, %._crit_edge ]
  call void @llvm.stackrestore.p0(ptr %21)
  br label %86

84:                                               ; preds = %17
  %85 = tail call i32 @fclose(ptr noundef nonnull %13)
  br label %86

86:                                               ; preds = %15, %84, %83, %4
  %.4 = phi i32 [ -1, %4 ], [ -1, %15 ], [ %.1, %83 ], [ -1, %84 ]
  ret i32 %.4
}

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

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #2

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

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

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

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

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

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

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

declare void @AES_CBC_decrypt_buffer(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #5

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { "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 = !{!"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,GlobalDCEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass