; LLVM IR from square/subzero :: core/external-crypto/aes (aesxam)

; 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_crypt_ctx = type { [60 x i32], %union.aes_inf, [12 x i8] }
%union.aes_inf = type { i32 }

@.str = external hidden unnamed_addr constant [57 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @fopen_s(ptr noundef, ptr noundef, ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @encfile(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @decfile(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  %10 = alloca [32 x i8], align 16
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca [1 x %struct.aes_crypt_ctx], align 16
  %24 = alloca [1 x %struct.aes_crypt_ctx], align 16
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store ptr null, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store ptr null, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 0, ptr %14, align 4, !tbaa !5
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = icmp ne i32 %25, 5
  br i1 %26, label %55, label %27

27:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %28 = call ptr @__ctype_toupper_loc() #5
  %29 = load ptr, ptr %28, align 8, !tbaa !9
  %30 = load ptr, ptr %5, align 8, !tbaa !9
  %31 = getelementptr inbounds ptr, ptr %30, i64 3
  %32 = load ptr, ptr %31, align 8, !tbaa !9
  %33 = load i8, ptr %32, align 1, !tbaa !11
  %34 = sext i8 %33 to i32
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds i32, ptr %29, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !5
  store i32 %37, ptr %15, align 4, !tbaa !5
  %38 = load i32, ptr %15, align 4, !tbaa !5
  store i32 %38, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  %39 = load i32, ptr %16, align 4, !tbaa !5
  %40 = icmp ne i32 %39, 68
  br i1 %40, label %41, label %57

41:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %42 = call ptr @__ctype_toupper_loc() #5
  %43 = load ptr, ptr %42, align 8, !tbaa !9
  %44 = load ptr, ptr %5, align 8, !tbaa !9
  %45 = getelementptr inbounds ptr, ptr %44, i64 3
  %46 = load ptr, ptr %45, align 8, !tbaa !9
  %47 = load i8, ptr %46, align 1, !tbaa !11
  %48 = sext i8 %47 to i32
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i32, ptr %43, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  store i32 %51, ptr %17, align 4, !tbaa !5
  %52 = load i32, ptr %17, align 4, !tbaa !5
  store i32 %52, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  %53 = load i32, ptr %18, align 4, !tbaa !5
  %54 = icmp ne i32 %53, 69
  br i1 %54, label %55, label %57

55:                                               ; preds = %41, %2
  %56 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  store i32 -1, ptr %14, align 4, !tbaa !5
  br label %206

57:                                               ; preds = %41, %27
  %58 = call i32 @aes_init()
  %59 = load ptr, ptr %5, align 8, !tbaa !9
  %60 = getelementptr inbounds ptr, ptr %59, i64 4
  %61 = load ptr, ptr %60, align 8, !tbaa !9
  store ptr %61, ptr %8, align 8, !tbaa !9
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %132, %57
  %63 = load i32, ptr %11, align 4, !tbaa !5
  %64 = icmp slt i32 %63, 64
  br i1 %64, label %65, label %70

65:                                               ; preds = %62
  %66 = load ptr, ptr %8, align 8, !tbaa !9
  %67 = load i8, ptr %66, align 1, !tbaa !11
  %68 = sext i8 %67 to i32
  %69 = icmp ne i32 %68, 0
  br label %70

70:                                               ; preds = %65, %62
  %71 = phi i1 [ false, %62 ], [ %69, %65 ]
  br i1 %71, label %72, label %133

72:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %73 = call ptr @__ctype_toupper_loc() #5
  %74 = load ptr, ptr %73, align 8, !tbaa !9
  %75 = load ptr, ptr %8, align 8, !tbaa !9
  %76 = getelementptr inbounds i8, ptr %75, i32 1
  store ptr %76, ptr %8, align 8, !tbaa !9
  %77 = load i8, ptr %75, align 1, !tbaa !11
  %78 = sext i8 %77 to i32
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds i32, ptr %74, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  store i32 %81, ptr %19, align 4, !tbaa !5
  %82 = load i32, ptr %19, align 4, !tbaa !5
  store i32 %82, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  %83 = load i32, ptr %20, align 4, !tbaa !5
  %84 = trunc i32 %83 to i8
  store i8 %84, ptr %9, align 1, !tbaa !11
  %85 = load i8, ptr %9, align 1, !tbaa !11
  %86 = sext i8 %85 to i32
  %87 = icmp sge i32 %86, 48
  br i1 %87, label %88, label %99

88:                                               ; preds = %72
  %89 = load i8, ptr %9, align 1, !tbaa !11
  %90 = sext i8 %89 to i32
  %91 = icmp sle i32 %90, 57
  br i1 %91, label %92, label %99

92:                                               ; preds = %88
  %93 = load i32, ptr %12, align 4, !tbaa !5
  %94 = shl i32 %93, 4
  %95 = load i8, ptr %9, align 1, !tbaa !11
  %96 = sext i8 %95 to i32
  %97 = add nsw i32 %94, %96
  %98 = sub nsw i32 %97, 48
  store i32 %98, ptr %12, align 4, !tbaa !5
  br label %118

99:                                               ; preds = %88, %72
  %100 = load i8, ptr %9, align 1, !tbaa !11
  %101 = sext i8 %100 to i32
  %102 = icmp sge i32 %101, 65
  br i1 %102, label %103, label %115

103:                                              ; preds = %99
  %104 = load i8, ptr %9, align 1, !tbaa !11
  %105 = sext i8 %104 to i32
  %106 = icmp sle i32 %105, 70
  br i1 %106, label %107, label %115

107:                                              ; preds = %103
  %108 = load i32, ptr %12, align 4, !tbaa !5
  %109 = shl i32 %108, 4
  %110 = load i8, ptr %9, align 1, !tbaa !11
  %111 = sext i8 %110 to i32
  %112 = add nsw i32 %109, %111
  %113 = sub nsw i32 %112, 65
  %114 = add nsw i32 %113, 10
  store i32 %114, ptr %12, align 4, !tbaa !5
  br label %117

115:                                              ; preds = %103, %99
  %116 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 -2, ptr %14, align 4, !tbaa !5
  br label %206

117:                                              ; preds = %107
  br label %118

118:                                              ; preds = %117, %92
  %119 = load i32, ptr %11, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %11, align 4, !tbaa !5
  %121 = and i32 %119, 1
  %122 = icmp ne i32 %121, 0
  br i1 %122, label %123, label %132

123:                                              ; preds = %118
  %124 = load i32, ptr %12, align 4, !tbaa !5
  %125 = and i32 %124, 255
  %126 = trunc i32 %125 to i8
  %127 = load i32, ptr %11, align 4, !tbaa !5
  %128 = sdiv i32 %127, 2
  %129 = sub nsw i32 %128, 1
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [32 x i8], ptr %10, i64 0, i64 %130
  store i8 %126, ptr %131, align 1, !tbaa !11
  br label %132

132:                                              ; preds = %123, %118
  br label %62, !llvm.loop !12

133:                                              ; preds = %70
  %134 = load ptr, ptr %8, align 8, !tbaa !9
  %135 = load i8, ptr %134, align 1, !tbaa !11
  %136 = icmp ne i8 %135, 0
  br i1 %136, label %137, label %139

137:                                              ; preds = %133
  %138 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  store i32 -3, ptr %14, align 4, !tbaa !5
  br label %206

139:                                              ; preds = %133
  %140 = load i32, ptr %11, align 4, !tbaa !5
  %141 = icmp slt i32 %140, 32
  br i1 %141, label %146, label %142

142:                                              ; preds = %139
  %143 = load i32, ptr %11, align 4, !tbaa !5
  %144 = and i32 %143, 15
  %145 = icmp ne i32 %144, 0
  br i1 %145, label %146, label %148

146:                                              ; preds = %142, %139
  %147 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  store i32 -4, ptr %14, align 4, !tbaa !5
  br label %206

148:                                              ; preds = %142
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr %11, align 4, !tbaa !5
  %151 = sdiv i32 %150, 2
  store i32 %151, ptr %13, align 4, !tbaa !5
  %152 = load ptr, ptr %5, align 8, !tbaa !9
  %153 = getelementptr inbounds ptr, ptr %152, i64 1
  %154 = load ptr, ptr %153, align 8, !tbaa !9
  %155 = call i32 @fopen_s(ptr noundef %6, ptr noundef %154, ptr noundef @.str.4)
  %156 = icmp ne i32 %155, 0
  br i1 %156, label %157, label %162

157:                                              ; preds = %149
  %158 = load ptr, ptr %5, align 8, !tbaa !9
  %159 = getelementptr inbounds ptr, ptr %158, i64 1
  %160 = load ptr, ptr %159, align 8, !tbaa !9
  %161 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, ptr noundef %160)
  store i32 -5, ptr %14, align 4, !tbaa !5
  br label %206

162:                                              ; preds = %149
  %163 = load ptr, ptr %5, align 8, !tbaa !9
  %164 = getelementptr inbounds ptr, ptr %163, i64 2
  %165 = load ptr, ptr %164, align 8, !tbaa !9
  %166 = call i32 @fopen_s(ptr noundef %7, ptr noundef %165, ptr noundef @.str.6)
  %167 = icmp ne i32 %166, 0
  br i1 %167, label %168, label %173

168:                                              ; preds = %162
  %169 = load ptr, ptr %5, align 8, !tbaa !9
  %170 = getelementptr inbounds ptr, ptr %169, i64 2
  %171 = load ptr, ptr %170, align 8, !tbaa !9
  %172 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, ptr noundef %171)
  store i32 -6, ptr %14, align 4, !tbaa !5
  br label %206

173:                                              ; preds = %162
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %174 = call ptr @__ctype_toupper_loc() #5
  %175 = load ptr, ptr %174, align 8, !tbaa !9
  %176 = load ptr, ptr %5, align 8, !tbaa !9
  %177 = getelementptr inbounds ptr, ptr %176, i64 3
  %178 = load ptr, ptr %177, align 8, !tbaa !9
  %179 = load i8, ptr %178, align 1, !tbaa !11
  %180 = sext i8 %179 to i32
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds i32, ptr %175, i64 %181
  %183 = load i32, ptr %182, align 4, !tbaa !5
  store i32 %183, ptr %21, align 4, !tbaa !5
  %184 = load i32, ptr %21, align 4, !tbaa !5
  store i32 %184, ptr %22, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  %185 = load i32, ptr %22, align 4, !tbaa !5
  %186 = icmp eq i32 %185, 69
  br i1 %186, label %187, label %196

187:                                              ; preds = %173
  call void @llvm.lifetime.start.p0(i64 256, ptr %23) #4
  %188 = getelementptr inbounds [32 x i8], ptr %10, i64 0, i64 0
  %189 = load i32, ptr %13, align 4, !tbaa !5
  %190 = getelementptr inbounds [1 x %struct.aes_crypt_ctx], ptr %23, i64 0, i64 0
  %191 = call i32 @aes_encrypt_key(ptr noundef %188, i32 noundef %189, ptr noundef %190)
  %192 = load ptr, ptr %6, align 8, !tbaa !9
  %193 = load ptr, ptr %7, align 8, !tbaa !9
  %194 = getelementptr inbounds [1 x %struct.aes_crypt_ctx], ptr %23, i64 0, i64 0
  %195 = call i32 @encfile(ptr noundef %192, ptr noundef %193, ptr noundef %194)
  store i32 %195, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 256, ptr %23) #4
  br label %205

196:                                              ; preds = %173
  call void @llvm.lifetime.start.p0(i64 256, ptr %24) #4
  %197 = getelementptr inbounds [32 x i8], ptr %10, i64 0, i64 0
  %198 = load i32, ptr %13, align 4, !tbaa !5
  %199 = getelementptr inbounds [1 x %struct.aes_crypt_ctx], ptr %24, i64 0, i64 0
  %200 = call i32 @aes_decrypt_key(ptr noundef %197, i32 noundef %198, ptr noundef %199)
  %201 = load ptr, ptr %6, align 8, !tbaa !9
  %202 = load ptr, ptr %7, align 8, !tbaa !9
  %203 = getelementptr inbounds [1 x %struct.aes_crypt_ctx], ptr %24, i64 0, i64 0
  %204 = call i32 @decfile(ptr noundef %201, ptr noundef %202, ptr noundef %203)
  store i32 %204, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 256, ptr %24) #4
  br label %205

205:                                              ; preds = %196, %187
  br label %206

206:                                              ; preds = %205, %168, %157, %146, %137, %115, %55
  %207 = load i32, ptr %14, align 4, !tbaa !5
  %208 = icmp eq i32 %207, -7
  br i1 %208, label %209, label %214

209:                                              ; preds = %206
  %210 = load ptr, ptr %5, align 8, !tbaa !9
  %211 = getelementptr inbounds ptr, ptr %210, i64 1
  %212 = load ptr, ptr %211, align 8, !tbaa !9
  %213 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, ptr noundef %212)
  br label %214

214:                                              ; preds = %209, %206
  %215 = load i32, ptr %14, align 4, !tbaa !5
  %216 = icmp eq i32 %215, -8
  br i1 %216, label %217, label %222

217:                                              ; preds = %214
  %218 = load ptr, ptr %5, align 8, !tbaa !9
  %219 = getelementptr inbounds ptr, ptr %218, i64 2
  %220 = load ptr, ptr %219, align 8, !tbaa !9
  %221 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, ptr noundef %220)
  br label %222

222:                                              ; preds = %217, %214
  %223 = load ptr, ptr %7, align 8, !tbaa !9
  %224 = icmp ne ptr %223, null
  br i1 %224, label %225, label %228

225:                                              ; preds = %222
  %226 = load ptr, ptr %7, align 8, !tbaa !9
  %227 = call i32 @fclose(ptr noundef %226)
  br label %228

228:                                              ; preds = %225, %222
  %229 = load ptr, ptr %6, align 8, !tbaa !9
  %230 = icmp ne ptr %229, null
  br i1 %230, label %231, label %234

231:                                              ; preds = %228
  %232 = load ptr, ptr %6, align 8, !tbaa !9
  %233 = call i32 @fclose(ptr noundef %232)
  br label %234

234:                                              ; preds = %231, %228
  %235 = load i32, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  ret i32 %235
}

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_toupper_loc() #2

declare i32 @printf(ptr noundef, ...) #3

declare i32 @aes_init() #3

declare i32 @aes_encrypt_key(ptr noundef, i32 noundef, ptr noundef) #3

declare i32 @aes_decrypt_key(ptr noundef, i32 noundef, ptr noundef) #3

declare i32 @fclose(ptr noundef) #3

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(none) }

!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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


; 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_crypt_ctx = type { [60 x i32], %union.aes_inf, [12 x i8] }
%union.aes_inf = type { i32 }

@.str = external hidden unnamed_addr constant [57 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @fopen_s(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @encfile(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @decfile(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [32 x i8], align 16
  %6 = alloca [1 x %struct.aes_crypt_ctx], align 16
  %7 = alloca [1 x %struct.aes_crypt_ctx], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  store ptr null, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  store ptr null, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #5
  %.not = icmp eq i32 %0, 5
  br i1 %.not, label %8, label %18

8:                                                ; preds = %2
  %9 = tail call ptr @__ctype_toupper_loc() #6
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %1, i64 24
  %12 = load ptr, ptr %11, align 8, !tbaa !5
  %13 = load i8, ptr %12, align 1, !tbaa !9
  %14 = sext i8 %13 to i64
  %15 = getelementptr inbounds i32, ptr %10, i64 %14
  %16 = load i32, ptr %15, align 4, !tbaa !10
  %17 = and i32 %16, -2
  %switch = icmp eq i32 %17, 68
  br i1 %switch, label %20, label %18

18:                                               ; preds = %8, %2
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  br label %.thread

20:                                               ; preds = %8
  %21 = tail call i32 @aes_init() #5
  %22 = getelementptr inbounds i8, ptr %1, i64 32
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  br label %24

24:                                               ; preds = %20, %49
  %.075 = phi ptr [ %23, %20 ], [ %28, %49 ]
  %.04674 = phi i32 [ 0, %20 ], [ %41, %49 ]
  %.04773 = phi i32 [ 0, %20 ], [ %.1, %49 ]
  %25 = load i8, ptr %.075, align 1, !tbaa !9
  %.not56 = icmp eq i8 %25, 0
  br i1 %.not56, label %.critedge.thread, label %26

26:                                               ; preds = %24
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %.075, i64 1
  %29 = sext i8 %25 to i64
  %30 = getelementptr inbounds i32, ptr %27, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !10
  %sext = shl i32 %31, 24
  %32 = ashr exact i32 %sext, 24
  %33 = add nsw i32 %32, -48
  %or.cond = icmp ult i32 %33, 10
  br i1 %or.cond, label %38, label %34

34:                                               ; preds = %26
  %35 = add nsw i32 %32, -65
  %or.cond5 = icmp ult i32 %35, 6
  br i1 %or.cond5, label %38, label %36

36:                                               ; preds = %34
  %37 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %.thread

38:                                               ; preds = %34, %26
  %.sink83 = phi i32 [ -48, %26 ], [ -55, %34 ]
  %39 = shl i32 %.04773, 4
  %40 = add i32 %39, %.sink83
  %.1 = add i32 %40, %32
  %41 = add nuw nsw i32 %.04674, 1
  %42 = and i32 %.04674, 1
  %.not61 = icmp eq i32 %42, 0
  br i1 %.not61, label %49, label %43

43:                                               ; preds = %38
  %44 = trunc i32 %.1 to i8
  %45 = lshr exact i32 %41, 1
  %46 = add nsw i32 %45, -1
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [32 x i8], ptr %5, i64 0, i64 %47
  store i8 %44, ptr %48, align 1, !tbaa !9
  br label %49

49:                                               ; preds = %43, %38
  %exitcond.not = icmp eq i32 %41, 64
  br i1 %exitcond.not, label %.critedge, label %24, !llvm.loop !12

.critedge:                                        ; preds = %49
  %.pr = load i8, ptr %28, align 1, !tbaa !9
  %.not57 = icmp eq i8 %.pr, 0
  br i1 %.not57, label %.critedge.thread, label %50

50:                                               ; preds = %.critedge
  %51 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %.thread

.critedge.thread:                                 ; preds = %24, %.critedge
  %.04672 = phi i32 [ 64, %.critedge ], [ %.04674, %24 ]
  %52 = icmp ugt i32 %.04672, 31
  %53 = and i32 %.04672, 15
  %.not58 = icmp eq i32 %53, 0
  %or.cond64 = and i1 %52, %.not58
  br i1 %or.cond64, label %56, label %54

54:                                               ; preds = %.critedge.thread
  %55 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %.thread

56:                                               ; preds = %.critedge.thread
  %57 = lshr exact i32 %.04672, 1
  %58 = getelementptr inbounds i8, ptr %1, i64 8
  %59 = load ptr, ptr %58, align 8, !tbaa !5
  %60 = call i32 @fopen_s(ptr noundef nonnull %3, ptr noundef %59, ptr noundef nonnull @.str.4)
  %.not59 = icmp eq i32 %60, 0
  br i1 %.not59, label %64, label %61

61:                                               ; preds = %56
  %62 = load ptr, ptr %58, align 8, !tbaa !5
  %63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, ptr noundef %62)
  br label %.thread

64:                                               ; preds = %56
  %65 = getelementptr inbounds i8, ptr %1, i64 16
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  %67 = call i32 @fopen_s(ptr noundef nonnull %4, ptr noundef %66, ptr noundef nonnull @.str.6)
  %.not60 = icmp eq i32 %67, 0
  br i1 %.not60, label %71, label %68

68:                                               ; preds = %64
  %69 = load ptr, ptr %65, align 8, !tbaa !5
  %70 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, ptr noundef %69)
  br label %.thread

71:                                               ; preds = %64
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = load ptr, ptr %11, align 8, !tbaa !5
  %74 = load i8, ptr %73, align 1, !tbaa !9
  %75 = sext i8 %74 to i64
  %76 = getelementptr inbounds i32, ptr %72, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !10
  %78 = icmp eq i32 %77, 69
  br i1 %78, label %79, label %84

79:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %6) #5
  %80 = call i32 @aes_encrypt_key(ptr noundef nonnull %5, i32 noundef %57, ptr noundef nonnull %6) #5
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = call i32 @encfile(ptr noundef %81, ptr noundef %82, ptr noundef nonnull %6)
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %6) #5
  br label %89

84:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %7) #5
  %85 = call i32 @aes_decrypt_key(ptr noundef nonnull %5, i32 noundef %57, ptr noundef nonnull %7) #5
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = call i32 @decfile(ptr noundef %86, ptr noundef %87, ptr noundef nonnull %7)
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %7) #5
  br label %89

89:                                               ; preds = %79, %84
  %.048 = phi i32 [ %83, %79 ], [ %88, %84 ]
  switch i32 %.048, label %.thread [
    i32 -7, label %90
    i32 -8, label %93
  ]

90:                                               ; preds = %89
  %91 = load ptr, ptr %58, align 8, !tbaa !5
  %92 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef %91)
  br label %.thread

93:                                               ; preds = %89
  %94 = load ptr, ptr %65, align 8, !tbaa !5
  %95 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, ptr noundef %94)
  br label %.thread

.thread:                                          ; preds = %68, %61, %54, %50, %36, %18, %90, %89, %93
  %.04867 = phi i32 [ -7, %90 ], [ %.048, %89 ], [ -8, %93 ], [ -6, %68 ], [ -5, %61 ], [ -4, %54 ], [ -3, %50 ], [ -2, %36 ], [ -1, %18 ]
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %.not62 = icmp eq ptr %96, null
  br i1 %.not62, label %99, label %97

97:                                               ; preds = %.thread
  %98 = call i32 @fclose(ptr noundef nonnull %96)
  br label %99

99:                                               ; preds = %97, %.thread
  %100 = load ptr, ptr %3, align 8, !tbaa !5
  %.not63 = icmp eq ptr %100, null
  br i1 %.not63, label %103, label %101

101:                                              ; preds = %99
  %102 = call i32 @fclose(ptr noundef nonnull %100)
  br label %103

103:                                              ; preds = %101, %99
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  ret i32 %.04867
}

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_toupper_loc() local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

declare i32 @aes_init() local_unnamed_addr #4

declare i32 @aes_encrypt_key(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

declare i32 @aes_decrypt_key(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 = { 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 #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 = { nounwind }
attributes #6 = { nounwind willreturn memory(none) }

!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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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