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

; 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 [37 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
declare dso_local void @ECBdec(ptr noundef, i32 noundef, ptr noundef) #1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @read_tsc() #3

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

; Function Attrs: nounwind
declare double @sqrt(double noundef) #5

declare void @block_rndfill(ptr noundef, i64 noundef) #6

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #7

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #8

; Function Attrs: nounwind uwtable
define dso_local i32 @time_ecb_dec(i32 noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) #1 {
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca [32 x i8], align 16
  %18 = alloca [160000 x i8], align 16
  %19 = alloca [160000 x i8], align 16
  %20 = alloca [1 x %struct.aes_crypt_ctx], align 16
  %21 = alloca i32, align 4
  store i32 %0, ptr %6, align 4, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #9
  call void @llvm.lifetime.start.p0(i64 32, ptr %17) #9
  call void @llvm.lifetime.start.p0(i64 160000, ptr %18) #9
  call void @llvm.lifetime.start.p0(i64 160000, ptr %19) #9
  call void @llvm.lifetime.start.p0(i64 256, ptr %20) #9
  %22 = getelementptr inbounds [32 x i8], ptr %17, i64 0, i64 0
  call void @block_rndfill(ptr noundef %22, i64 noundef 32)
  %23 = getelementptr inbounds [32 x i8], ptr %17, i64 0, i64 0
  %24 = load i32, ptr %6, align 4, !tbaa !5
  %25 = getelementptr inbounds [1 x %struct.aes_crypt_ctx], ptr %20, i64 0, i64 0
  %26 = call i32 @aes_decrypt_key(ptr noundef %23, i32 noundef %24, ptr noundef %25)
  %27 = getelementptr inbounds [160000 x i8], ptr %19, i64 0, i64 0
  %28 = load i32, ptr %7, align 4, !tbaa !5
  %29 = mul nsw i32 %28, 16
  %30 = sext i32 %29 to i64
  call void @block_rndfill(ptr noundef %27, i64 noundef %30)
  %31 = getelementptr inbounds [160000 x i8], ptr %18, i64 0, i64 0
  %32 = getelementptr inbounds [160000 x i8], ptr %19, i64 0, i64 0
  %33 = load i32, ptr %7, align 4, !tbaa !5
  %34 = mul nsw i32 %33, 16
  %35 = sext i32 %34 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %31, ptr align 16 %32, i64 %35, i1 false)
  %36 = getelementptr inbounds [160000 x i8], ptr %19, i64 0, i64 0
  %37 = getelementptr inbounds [160000 x i8], ptr %19, i64 0, i64 0
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = mul nsw i32 %38, 16
  %40 = getelementptr inbounds [1 x %struct.aes_crypt_ctx], ptr %20, i64 0, i64 0
  %41 = call i32 @aes_ecb_decrypt(ptr noundef %36, ptr noundef %37, i32 noundef %39, ptr noundef %40)
  %42 = getelementptr inbounds [160000 x i8], ptr %18, i64 0, i64 0
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = mul nsw i32 %43, 16
  %45 = getelementptr inbounds [1 x %struct.aes_crypt_ctx], ptr %20, i64 0, i64 0
  call void @ECBdec(ptr noundef %42, i32 noundef %44, ptr noundef %45)
  %46 = getelementptr inbounds [160000 x i8], ptr %19, i64 0, i64 0
  %47 = getelementptr inbounds [160000 x i8], ptr %18, i64 0, i64 0
  %48 = load i32, ptr %7, align 4, !tbaa !5
  %49 = mul nsw i32 %48, 16
  %50 = sext i32 %49 to i64
  %51 = call i32 @memcmp(ptr noundef %46, ptr noundef %47, i64 noundef %50) #10
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %54

53:                                               ; preds = %4
  br label %230

54:                                               ; preds = %4
  store i32 10, ptr %11, align 4, !tbaa !5
  store i32 0, ptr %13, align 4, !tbaa !5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %228, %54
  %56 = load i32, ptr %13, align 4, !tbaa !5
  %57 = icmp ne i32 %56, 0
  %58 = xor i1 %57, true
  br i1 %58, label %59, label %229

59:                                               ; preds = %55
  store double 0.000000e+00, ptr %16, align 8, !tbaa !11
  store double 0.000000e+00, ptr %15, align 8, !tbaa !11
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %96, %59
  %61 = load i32, ptr %10, align 4, !tbaa !5
  %62 = icmp slt i32 %61, 1000
  br i1 %62, label %63, label %99

63:                                               ; preds = %60
  %64 = call i64 @read_tsc()
  %65 = uitofp i64 %64 to double
  store double %65, ptr %14, align 8, !tbaa !11
  %66 = getelementptr inbounds [160000 x i8], ptr %19, i64 0, i64 0
  %67 = getelementptr inbounds [160000 x i8], ptr %19, i64 0, i64 0
  %68 = load i32, ptr %7, align 4, !tbaa !5
  %69 = mul nsw i32 %68, 16
  %70 = getelementptr inbounds [1 x %struct.aes_crypt_ctx], ptr %20, i64 0, i64 0
  %71 = call i32 @aes_ecb_decrypt(ptr noundef %66, ptr noundef %67, i32 noundef %69, ptr noundef %70)
  %72 = call i64 @read_tsc()
  %73 = uitofp i64 %72 to double
  %74 = load double, ptr %14, align 8, !tbaa !11
  %75 = fsub double %73, %74
  store double %75, ptr %14, align 8, !tbaa !11
  %76 = load double, ptr %14, align 8, !tbaa !11
  %77 = load double, ptr %15, align 8, !tbaa !11
  %78 = fadd double %77, %76
  store double %78, ptr %15, align 8, !tbaa !11
  %79 = load double, ptr %14, align 8, !tbaa !11
  %80 = load double, ptr %14, align 8, !tbaa !11
  %81 = load double, ptr %16, align 8, !tbaa !11
  %82 = call double @llvm.fmuladd.f64(double %79, double %80, double %81)
  store double %82, ptr %16, align 8, !tbaa !11
  %83 = getelementptr inbounds [160000 x i8], ptr %18, i64 0, i64 0
  %84 = load i32, ptr %7, align 4, !tbaa !5
  %85 = mul nsw i32 %84, 16
  %86 = getelementptr inbounds [1 x %struct.aes_crypt_ctx], ptr %20, i64 0, i64 0
  call void @ECBdec(ptr noundef %83, i32 noundef %85, ptr noundef %86)
  %87 = getelementptr inbounds [160000 x i8], ptr %19, i64 0, i64 0
  %88 = getelementptr inbounds [160000 x i8], ptr %18, i64 0, i64 0
  %89 = load i32, ptr %7, align 4, !tbaa !5
  %90 = mul nsw i32 %89, 16
  %91 = sext i32 %90 to i64
  %92 = call i32 @memcmp(ptr noundef %87, ptr noundef %88, i64 noundef %91) #10
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %94, label %95

94:                                               ; preds = %63
  br label %230

95:                                               ; preds = %63
  br label %96

96:                                               ; preds = %95
  %97 = load i32, ptr %10, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %10, align 4, !tbaa !5
  br label %60, !llvm.loop !13

99:                                               ; preds = %60
  %100 = load double, ptr %15, align 8, !tbaa !11
  %101 = fdiv double %100, 1.000000e+03
  store double %101, ptr %15, align 8, !tbaa !11
  %102 = load double, ptr %16, align 8, !tbaa !11
  %103 = load double, ptr %15, align 8, !tbaa !11
  %104 = load double, ptr %15, align 8, !tbaa !11
  %105 = fmul double %103, %104
  %106 = fneg double %105
  %107 = call double @llvm.fmuladd.f64(double %106, double 1.000000e+03, double %102)
  %108 = fdiv double %107, 1.000000e+03
  %109 = call double @sqrt(double noundef %108) #9
  store double %109, ptr %16, align 8, !tbaa !11
  %110 = load double, ptr %16, align 8, !tbaa !11
  %111 = load double, ptr %15, align 8, !tbaa !11
  %112 = fmul double 5.000000e-02, %111
  %113 = fcmp olt double %110, %112
  br i1 %113, label %114, label %117

114:                                              ; preds = %99
  %115 = load double, ptr %15, align 8, !tbaa !11
  %116 = fmul double 5.000000e-02, %115
  br label %119

117:                                              ; preds = %99
  %118 = load double, ptr %16, align 8, !tbaa !11
  br label %119

119:                                              ; preds = %117, %114
  %120 = phi double [ %116, %114 ], [ %118, %117 ]
  store double %120, ptr %16, align 8, !tbaa !11
  %121 = load ptr, ptr %9, align 8, !tbaa !9
  store double 0.000000e+00, ptr %121, align 8, !tbaa !11
  %122 = load ptr, ptr %8, align 8, !tbaa !9
  store double 0.000000e+00, ptr %122, align 8, !tbaa !11
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %123

123:                                              ; preds = %176, %119
  %124 = load i32, ptr %10, align 4, !tbaa !5
  %125 = icmp slt i32 %124, 10000
  br i1 %125, label %126, label %179

126:                                              ; preds = %123
  %127 = call i64 @read_tsc()
  %128 = uitofp i64 %127 to double
  store double %128, ptr %14, align 8, !tbaa !11
  %129 = getelementptr inbounds [160000 x i8], ptr %19, i64 0, i64 0
  %130 = getelementptr inbounds [160000 x i8], ptr %19, i64 0, i64 0
  %131 = load i32, ptr %7, align 4, !tbaa !5
  %132 = mul nsw i32 %131, 16
  %133 = getelementptr inbounds [1 x %struct.aes_crypt_ctx], ptr %20, i64 0, i64 0
  %134 = call i32 @aes_ecb_decrypt(ptr noundef %129, ptr noundef %130, i32 noundef %132, ptr noundef %133)
  %135 = call i64 @read_tsc()
  %136 = uitofp i64 %135 to double
  %137 = load double, ptr %14, align 8, !tbaa !11
  %138 = fsub double %136, %137
  store double %138, ptr %14, align 8, !tbaa !11
  %139 = load double, ptr %14, align 8, !tbaa !11
  %140 = load double, ptr %15, align 8, !tbaa !11
  %141 = load double, ptr %16, align 8, !tbaa !11
  %142 = fsub double %140, %141
  %143 = fcmp ogt double %139, %142
  br i1 %143, label %144, label %162

144:                                              ; preds = %126
  %145 = load double, ptr %14, align 8, !tbaa !11
  %146 = load double, ptr %15, align 8, !tbaa !11
  %147 = load double, ptr %16, align 8, !tbaa !11
  %148 = fadd double %146, %147
  %149 = fcmp olt double %145, %148
  br i1 %149, label %150, label %162

150:                                              ; preds = %144
  %151 = load double, ptr %14, align 8, !tbaa !11
  %152 = load ptr, ptr %8, align 8, !tbaa !9
  %153 = load double, ptr %152, align 8, !tbaa !11
  %154 = fadd double %153, %151
  store double %154, ptr %152, align 8, !tbaa !11
  %155 = load double, ptr %14, align 8, !tbaa !11
  %156 = load double, ptr %14, align 8, !tbaa !11
  %157 = load ptr, ptr %9, align 8, !tbaa !9
  %158 = load double, ptr %157, align 8, !tbaa !11
  %159 = call double @llvm.fmuladd.f64(double %155, double %156, double %158)
  store double %159, ptr %157, align 8, !tbaa !11
  %160 = load i32, ptr %13, align 4, !tbaa !5
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %13, align 4, !tbaa !5
  br label %162

162:                                              ; preds = %150, %144, %126
  %163 = getelementptr inbounds [160000 x i8], ptr %18, i64 0, i64 0
  %164 = load i32, ptr %7, align 4, !tbaa !5
  %165 = mul nsw i32 %164, 16
  %166 = getelementptr inbounds [1 x %struct.aes_crypt_ctx], ptr %20, i64 0, i64 0
  call void @ECBdec(ptr noundef %163, i32 noundef %165, ptr noundef %166)
  %167 = getelementptr inbounds [160000 x i8], ptr %19, i64 0, i64 0
  %168 = getelementptr inbounds [160000 x i8], ptr %18, i64 0, i64 0
  %169 = load i32, ptr %7, align 4, !tbaa !5
  %170 = mul nsw i32 %169, 16
  %171 = sext i32 %170 to i64
  %172 = call i32 @memcmp(ptr noundef %167, ptr noundef %168, i64 noundef %171) #10
  %173 = icmp ne i32 %172, 0
  br i1 %173, label %174, label %175

174:                                              ; preds = %162
  br label %230

175:                                              ; preds = %162
  br label %176

176:                                              ; preds = %175
  %177 = load i32, ptr %10, align 4, !tbaa !5
  %178 = add nsw i32 %177, 1
  store i32 %178, ptr %10, align 4, !tbaa !5
  br label %123, !llvm.loop !15

179:                                              ; preds = %123
  %180 = load i32, ptr %13, align 4, !tbaa !5
  %181 = mul nsw i32 10, %180
  %182 = icmp sgt i32 %181, 90000
  br i1 %182, label %183, label %216

183:                                              ; preds = %179
  %184 = load i32, ptr %13, align 4, !tbaa !5
  %185 = sitofp i32 %184 to double
  %186 = load ptr, ptr %8, align 8, !tbaa !9
  %187 = load double, ptr %186, align 8, !tbaa !11
  %188 = fdiv double %187, %185
  store double %188, ptr %186, align 8, !tbaa !11
  %189 = load ptr, ptr %9, align 8, !tbaa !9
  %190 = load double, ptr %189, align 8, !tbaa !11
  %191 = load ptr, ptr %8, align 8, !tbaa !9
  %192 = load double, ptr %191, align 8, !tbaa !11
  %193 = load ptr, ptr %8, align 8, !tbaa !9
  %194 = load double, ptr %193, align 8, !tbaa !11
  %195 = fmul double %192, %194
  %196 = load i32, ptr %13, align 4, !tbaa !5
  %197 = sitofp i32 %196 to double
  %198 = fneg double %195
  %199 = call double @llvm.fmuladd.f64(double %198, double %197, double %190)
  %200 = load i32, ptr %13, align 4, !tbaa !5
  %201 = sitofp i32 %200 to double
  %202 = fdiv double %199, %201
  %203 = call double @sqrt(double noundef %202) #9
  %204 = load ptr, ptr %9, align 8, !tbaa !9
  store double %203, ptr %204, align 8, !tbaa !11
  %205 = load ptr, ptr %9, align 8, !tbaa !9
  %206 = load double, ptr %205, align 8, !tbaa !11
  %207 = load i32, ptr %11, align 4, !tbaa !5
  %208 = sitofp i32 %207 to double
  %209 = fdiv double %208, 1.000000e+02
  %210 = load ptr, ptr %8, align 8, !tbaa !9
  %211 = load double, ptr %210, align 8, !tbaa !11
  %212 = fmul double %209, %211
  %213 = fcmp ogt double %206, %212
  br i1 %213, label %214, label %215

214:                                              ; preds = %183
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %215

215:                                              ; preds = %214, %183
  br label %228

216:                                              ; preds = %179
  %217 = load i32, ptr %12, align 4, !tbaa !5
  %218 = add nsw i32 %217, 1
  store i32 %218, ptr %12, align 4, !tbaa !5
  %219 = icmp eq i32 %217, 10
  br i1 %219, label %220, label %227

220:                                              ; preds = %216
  store i32 0, ptr %12, align 4, !tbaa !5
  %221 = load i32, ptr %11, align 4, !tbaa !5
  %222 = add nsw i32 %221, 5
  store i32 %222, ptr %11, align 4, !tbaa !5
  %223 = load i32, ptr %11, align 4, !tbaa !5
  %224 = icmp sgt i32 %223, 30
  br i1 %224, label %225, label %226

225:                                              ; preds = %220
  store i32 0, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %232

226:                                              ; preds = %220
  br label %227

227:                                              ; preds = %226, %216
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %228

228:                                              ; preds = %227, %215
  br label %55, !llvm.loop !16

229:                                              ; preds = %55
  store i32 1, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %232

230:                                              ; preds = %174, %94, %53
  %231 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  call void @exit(i32 noundef 1) #11
  unreachable

232:                                              ; preds = %229, %225
  call void @llvm.lifetime.end.p0(i64 256, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 160000, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 160000, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  %233 = load i32, ptr %5, align 4
  ret i32 %233
}

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

declare i32 @aes_ecb_decrypt(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #6 = { "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 willreturn memory(read) "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 #8 = { noreturn 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 #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


; 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 [37 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
declare dso_local void @ECBdec(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @read_tsc() local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #5

declare void @block_rndfill(ptr noundef, i64 noundef) local_unnamed_addr #6

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #8

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @time_ecb_dec(i32 noundef %0, i32 noundef %1, ptr nocapture noundef %2, ptr nocapture noundef %3) local_unnamed_addr #1 {
  %5 = alloca [32 x i8], align 16
  %6 = alloca [160000 x i8], align 16
  %7 = alloca [160000 x i8], align 16
  %8 = alloca [1 x %struct.aes_crypt_ctx], align 16
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #10
  call void @llvm.lifetime.start.p0(i64 160000, ptr nonnull %6) #10
  call void @llvm.lifetime.start.p0(i64 160000, ptr nonnull %7) #10
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %8) #10
  call void @block_rndfill(ptr noundef nonnull %5, i64 noundef 32) #10
  %9 = call i32 @aes_decrypt_key(ptr noundef nonnull %5, i32 noundef %0, ptr noundef nonnull %8) #10
  %10 = shl nsw i32 %1, 4
  %11 = sext i32 %10 to i64
  call void @block_rndfill(ptr noundef nonnull %7, i64 noundef %11) #10
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %6, ptr nonnull align 16 %7, i64 %11, i1 false)
  %12 = call i32 @aes_ecb_decrypt(ptr noundef nonnull %7, ptr noundef nonnull %7, i32 noundef %10, ptr noundef nonnull %8) #10
  call void @ECBdec(ptr noundef nonnull %6, i32 noundef %10, ptr noundef nonnull %8)
  %bcmp = call i32 @bcmp(ptr nonnull %7, ptr nonnull %6, i64 %11)
  %.not = icmp eq i32 %bcmp, 0
  br i1 %.not, label %.preheader.outer.outer, label %.loopexit

.preheader.outer.outer:                           ; preds = %4, %74
  %.06690.ph.ph = phi i32 [ %75, %74 ], [ 10, %4 ]
  %13 = uitofp nneg i32 %.06690.ph.ph to double
  %14 = fdiv double %13, 1.000000e+02
  br label %.preheader.outer

.preheader.outer:                                 ; preds = %.preheader.outer.outer, %71
  %.06391.ph = phi i32 [ %72, %71 ], [ 0, %.preheader.outer.outer ]
  br label %.preheader

.preheader:                                       ; preds = %.preheader.outer, %58
  br label %15

15:                                               ; preds = %.preheader, %19
  %.087 = phi double [ 0.000000e+00, %.preheader ], [ %23, %19 ]
  %.06186 = phi double [ 0.000000e+00, %.preheader ], [ %24, %19 ]
  %.06985 = phi i32 [ 0, %.preheader ], [ %25, %19 ]
  %16 = call i64 @read_tsc()
  %17 = call i32 @aes_ecb_decrypt(ptr noundef nonnull %7, ptr noundef nonnull %7, i32 noundef %10, ptr noundef nonnull %8) #10
  %18 = call i64 @read_tsc()
  call void @ECBdec(ptr noundef nonnull %6, i32 noundef %10, ptr noundef nonnull %8)
  %bcmp77 = call i32 @bcmp(ptr nonnull %7, ptr nonnull %6, i64 %11)
  %.not78 = icmp eq i32 %bcmp77, 0
  br i1 %.not78, label %19, label %.loopexit

19:                                               ; preds = %15
  %20 = uitofp i64 %18 to double
  %21 = uitofp i64 %16 to double
  %22 = fsub double %20, %21
  %23 = call double @llvm.fmuladd.f64(double %22, double %22, double %.087)
  %24 = fadd double %.06186, %22
  %25 = add nuw nsw i32 %.06985, 1
  %exitcond.not = icmp eq i32 %25, 1000
  br i1 %exitcond.not, label %26, label %15, !llvm.loop !5

26:                                               ; preds = %19
  %27 = fdiv double %24, 1.000000e+03
  %28 = fneg double %27
  %29 = fmul double %27, %28
  %30 = call double @llvm.fmuladd.f64(double %29, double 1.000000e+03, double %23)
  %31 = fdiv double %30, 1.000000e+03
  %32 = call double @sqrt(double noundef %31) #10
  %33 = fmul double %27, 5.000000e-02
  %34 = fcmp olt double %32, %33
  %35 = select i1 %34, double %33, double %32
  store double 0.000000e+00, ptr %3, align 8, !tbaa !7
  store double 0.000000e+00, ptr %2, align 8, !tbaa !7
  %36 = fsub double %27, %35
  %37 = fadd double %27, %35
  br label %40

38:                                               ; preds = %55
  %39 = add nuw nsw i32 %.17088, 1
  %exitcond96.not = icmp eq i32 %39, 10000
  br i1 %exitcond96.not, label %56, label %40, !llvm.loop !11

40:                                               ; preds = %26, %38
  %.189 = phi i32 [ 0, %26 ], [ %.2, %38 ]
  %.17088 = phi i32 [ 0, %26 ], [ %39, %38 ]
  %41 = call i64 @read_tsc()
  %42 = uitofp i64 %41 to double
  %43 = call i32 @aes_ecb_decrypt(ptr noundef nonnull %7, ptr noundef nonnull %7, i32 noundef %10, ptr noundef nonnull %8) #10
  %44 = call i64 @read_tsc()
  %45 = uitofp i64 %44 to double
  %46 = fsub double %45, %42
  %47 = fcmp ogt double %46, %36
  %48 = fcmp olt double %46, %37
  %or.cond = and i1 %47, %48
  br i1 %or.cond, label %49, label %55

49:                                               ; preds = %40
  %50 = load double, ptr %2, align 8, !tbaa !7
  %51 = fadd double %46, %50
  store double %51, ptr %2, align 8, !tbaa !7
  %52 = load double, ptr %3, align 8, !tbaa !7
  %53 = call double @llvm.fmuladd.f64(double %46, double %46, double %52)
  store double %53, ptr %3, align 8, !tbaa !7
  %54 = add nsw i32 %.189, 1
  br label %55

55:                                               ; preds = %49, %40
  %.2 = phi i32 [ %54, %49 ], [ %.189, %40 ]
  call void @ECBdec(ptr noundef nonnull %6, i32 noundef %10, ptr noundef nonnull %8)
  %bcmp75 = call i32 @bcmp(ptr nonnull %7, ptr nonnull %6, i64 %11)
  %.not76 = icmp eq i32 %bcmp75, 0
  br i1 %.not76, label %38, label %.loopexit

56:                                               ; preds = %38
  %57 = icmp sgt i32 %.2, 9000
  br i1 %57, label %58, label %71

58:                                               ; preds = %56
  %59 = uitofp nneg i32 %.2 to double
  %60 = load double, ptr %2, align 8, !tbaa !7
  %61 = fdiv double %60, %59
  store double %61, ptr %2, align 8, !tbaa !7
  %62 = load double, ptr %3, align 8, !tbaa !7
  %63 = fneg double %61
  %64 = fmul double %61, %63
  %65 = call double @llvm.fmuladd.f64(double %64, double %59, double %62)
  %66 = fdiv double %65, %59
  %67 = call double @sqrt(double noundef %66) #10
  store double %67, ptr %3, align 8, !tbaa !7
  %68 = load double, ptr %2, align 8, !tbaa !7
  %69 = fmul double %14, %68
  %70 = fcmp ogt double %67, %69
  br i1 %70, label %.preheader, label %.thread, !llvm.loop !12

71:                                               ; preds = %56
  %72 = add nuw nsw i32 %.06391.ph, 1
  %73 = icmp eq i32 %.06391.ph, 10
  br i1 %73, label %74, label %.preheader.outer, !llvm.loop !12

74:                                               ; preds = %71
  %75 = add nuw nsw i32 %.06690.ph.ph, 5
  %76 = icmp ugt i32 %.06690.ph.ph, 25
  br i1 %76, label %.thread, label %.preheader.outer.outer, !llvm.loop !12

.loopexit:                                        ; preds = %15, %55, %4
  %77 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  call void @exit(i32 noundef 1) #11
  unreachable

.thread:                                          ; preds = %74, %58
  %.071 = phi i32 [ 1, %58 ], [ 0, %74 ]
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %8) #10
  call void @llvm.lifetime.end.p0(i64 160000, ptr nonnull %7) #10
  call void @llvm.lifetime.end.p0(i64 160000, ptr nonnull %6) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #10
  ret i32 %.071
}

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

declare i32 @aes_ecb_decrypt(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #6

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #9

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint 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 #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { mustprogress nofree nounwind willreturn memory(write) "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 = { "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 = { 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 #8 = { noreturn 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 #9 = { nofree nounwind willreturn memory(argmem: read) }
attributes #10 = { nounwind }
attributes #11 = { noreturn 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"double", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}


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