; LLVM IR from intel/cryptography-primitives :: sources/ippcp (pcpaes_xtsdecrypt_direct)

; 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._cpRijndael128 = type { i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, [124 x i32] }

@RijEncSbox = external constant [256 x i8], align 64

; Function Attrs: nounwind uwtable
define dso_local i32 @ippsAESDecryptXTS_Direct(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5, i32 noundef %6, i32 noundef %7) #0 {
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca %struct._cpRijndael128, align 16
  %25 = alloca [16 x i8], align 16
  %26 = alloca [512 x i8], align 16
  %27 = alloca i32, align 4
  %28 = alloca ptr, align 8
  %29 = alloca i32, align 4
  %30 = alloca [16 x i8], align 16
  %31 = alloca [16 x i8], align 16
  %32 = alloca i8, align 1
  %33 = alloca i8, align 1
  %34 = alloca i8, align 1
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store i32 %2, ptr %12, align 4, !tbaa !9
  store i32 %3, ptr %13, align 4, !tbaa !9
  store ptr %4, ptr %14, align 8, !tbaa !5
  store ptr %5, ptr %15, align 8, !tbaa !5
  store i32 %6, ptr %16, align 4, !tbaa !9
  store i32 %7, ptr %17, align 4, !tbaa !9
  %35 = load i32, ptr %17, align 4, !tbaa !9
  %36 = icmp slt i32 %35, 128
  br i1 %36, label %37, label %38

37:                                               ; preds = %8
  store i32 -15, ptr %9, align 4
  br label %275

38:                                               ; preds = %8
  %39 = load ptr, ptr %15, align 8, !tbaa !5
  %40 = icmp eq ptr null, %39
  br i1 %40, label %41, label %42

41:                                               ; preds = %38
  store i32 -8, ptr %9, align 4
  br label %275

42:                                               ; preds = %38
  %43 = load i32, ptr %16, align 4, !tbaa !9
  %44 = icmp ne i32 256, %43
  br i1 %44, label %45, label %49

45:                                               ; preds = %42
  %46 = load i32, ptr %16, align 4, !tbaa !9
  %47 = icmp ne i32 512, %46
  br i1 %47, label %48, label %49

48:                                               ; preds = %45
  store i32 -15, ptr %9, align 4
  br label %275

49:                                               ; preds = %45, %42
  %50 = load ptr, ptr %14, align 8, !tbaa !5
  %51 = icmp eq ptr null, %50
  br i1 %51, label %52, label %53

52:                                               ; preds = %49
  store i32 -8, ptr %9, align 4
  br label %275

53:                                               ; preds = %49
  %54 = load ptr, ptr %10, align 8, !tbaa !5
  %55 = icmp eq ptr null, %54
  br i1 %55, label %56, label %57

56:                                               ; preds = %53
  store i32 -8, ptr %9, align 4
  br label %275

57:                                               ; preds = %53
  %58 = load ptr, ptr %11, align 8, !tbaa !5
  %59 = icmp eq ptr null, %58
  br i1 %59, label %60, label %61

60:                                               ; preds = %57
  store i32 -8, ptr %9, align 4
  br label %275

61:                                               ; preds = %57
  %62 = load i32, ptr %12, align 4, !tbaa !9
  %63 = icmp slt i32 %62, 128
  br i1 %63, label %64, label %65

64:                                               ; preds = %61
  store i32 -15, ptr %9, align 4
  br label %275

65:                                               ; preds = %61
  %66 = load i32, ptr %12, align 4, !tbaa !9
  %67 = icmp sgt i32 %66, 134217728
  br i1 %67, label %68, label %69

68:                                               ; preds = %65
  store i32 -5, ptr %9, align 4
  br label %275

69:                                               ; preds = %65
  %70 = load i32, ptr %17, align 4, !tbaa !9
  %71 = sdiv i32 %70, 128
  %72 = load i32, ptr %13, align 4, !tbaa !9
  %73 = icmp sle i32 %71, %72
  br i1 %73, label %77, label %74

74:                                               ; preds = %69
  %75 = load i32, ptr %13, align 4, !tbaa !9
  %76 = icmp sgt i32 0, %75
  br i1 %76, label %77, label %78

77:                                               ; preds = %74, %69
  store i32 -5, ptr %9, align 4
  br label %275

78:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %79 = load i32, ptr %16, align 4, !tbaa !9
  %80 = sdiv i32 %79, 2
  %81 = sdiv i32 %80, 8
  store i32 %81, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %82 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %82, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %83 = load ptr, ptr %15, align 8, !tbaa !5
  %84 = load i32, ptr %18, align 4, !tbaa !9
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds i8, ptr %83, i64 %85
  store ptr %86, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  store i32 0, ptr %21, align 4, !tbaa !9
  br label %87

87:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  %88 = load i32, ptr %12, align 4, !tbaa !9
  %89 = sdiv i32 %88, 128
  store i32 %89, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #4
  %90 = load i32, ptr %12, align 4, !tbaa !9
  %91 = srem i32 %90, 128
  store i32 %91, ptr %23, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 568, ptr %24) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %25) #4
  call void @llvm.lifetime.start.p0(i64 512, ptr %26) #4
  %92 = load ptr, ptr %20, align 8, !tbaa !5
  %93 = load i32, ptr %18, align 4, !tbaa !9
  %94 = call i32 @ippsAESInit(ptr noundef %92, i32 noundef %93, ptr noundef %24, i32 noundef 568)
  store i32 %94, ptr %21, align 4, !tbaa !9
  %95 = load i32, ptr %21, align 4, !tbaa !9
  %96 = icmp ne i32 0, %95
  br i1 %96, label %97, label %98

97:                                               ; preds = %87
  store i32 2, ptr %27, align 4
  br label %269

98:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #4
  %99 = getelementptr inbounds %struct._cpRijndael128, ptr %24, i32 0, i32 4
  %100 = load ptr, ptr %99, align 16, !tbaa !11
  store ptr %100, ptr %28, align 8, !tbaa !5
  %101 = load ptr, ptr %28, align 8, !tbaa !5
  %102 = load ptr, ptr %14, align 8, !tbaa !5
  %103 = getelementptr inbounds [16 x i8], ptr %25, i64 0, i64 0
  %104 = getelementptr inbounds %struct._cpRijndael128, ptr %24, i32 0, i32 3
  %105 = load i32, ptr %104, align 4, !tbaa !13
  %106 = getelementptr inbounds %struct._cpRijndael128, ptr %24, i32 0, i32 8
  %107 = load ptr, ptr %106, align 16, !tbaa !14
  call void %101(ptr noundef %102, ptr noundef %103, i32 noundef %105, ptr noundef %107, ptr noundef @RijEncSbox)
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #4
  %108 = load ptr, ptr %19, align 8, !tbaa !5
  %109 = load i32, ptr %18, align 4, !tbaa !9
  %110 = call i32 @ippsAESInit(ptr noundef %108, i32 noundef %109, ptr noundef %24, i32 noundef 568)
  store i32 %110, ptr %21, align 4, !tbaa !9
  %111 = load i32, ptr %21, align 4, !tbaa !9
  %112 = icmp ne i32 0, %111
  br i1 %112, label %113, label %114

113:                                              ; preds = %98
  store i32 2, ptr %27, align 4
  br label %269

114:                                              ; preds = %98
  br label %115

115:                                              ; preds = %120, %114
  %116 = load i32, ptr %13, align 4, !tbaa !9
  %117 = icmp sgt i32 %116, 0
  br i1 %117, label %118, label %123

118:                                              ; preds = %115
  %119 = getelementptr inbounds [16 x i8], ptr %25, i64 0, i64 0
  call void @gf_mul_by_primitive(ptr noundef %119)
  br label %120

120:                                              ; preds = %118
  %121 = load i32, ptr %13, align 4, !tbaa !9
  %122 = add nsw i32 %121, -1
  store i32 %122, ptr %13, align 4, !tbaa !9
  br label %115, !llvm.loop !15

123:                                              ; preds = %115
  %124 = load i32, ptr %23, align 4, !tbaa !9
  %125 = icmp ne i32 %124, 0
  br i1 %125, label %126, label %129

126:                                              ; preds = %123
  %127 = load i32, ptr %22, align 4, !tbaa !9
  %128 = add nsw i32 %127, -1
  store i32 %128, ptr %22, align 4, !tbaa !9
  br label %129

129:                                              ; preds = %126, %123
  br label %130

130:                                              ; preds = %154, %129
  %131 = load i32, ptr %22, align 4, !tbaa !9
  %132 = icmp sge i32 %131, 32
  br i1 %132, label %133, label %136

133:                                              ; preds = %130
  %134 = load i32, ptr %21, align 4, !tbaa !9
  %135 = icmp eq i32 0, %134
  br label %136

136:                                              ; preds = %133, %130
  %137 = phi i1 [ false, %130 ], [ %135, %133 ]
  br i1 %137, label %138, label %157

138:                                              ; preds = %136
  %139 = getelementptr inbounds [512 x i8], ptr %26, i64 0, i64 0
  %140 = getelementptr inbounds [16 x i8], ptr %25, i64 0, i64 0
  call void @cpXTSwhitening(ptr noundef %139, i32 noundef 32, ptr noundef %140)
  %141 = load ptr, ptr %11, align 8, !tbaa !5
  %142 = load ptr, ptr %10, align 8, !tbaa !5
  %143 = getelementptr inbounds [512 x i8], ptr %26, i64 0, i64 0
  call void @cpXTSxor16(ptr noundef %141, ptr noundef %142, ptr noundef %143, i32 noundef 32)
  %144 = load ptr, ptr %11, align 8, !tbaa !5
  %145 = load ptr, ptr %11, align 8, !tbaa !5
  %146 = call i32 @ippsAESDecryptECB(ptr noundef %144, ptr noundef %145, i32 noundef 512, ptr noundef %24)
  store i32 %146, ptr %21, align 4, !tbaa !9
  %147 = load ptr, ptr %11, align 8, !tbaa !5
  %148 = load ptr, ptr %11, align 8, !tbaa !5
  %149 = getelementptr inbounds [512 x i8], ptr %26, i64 0, i64 0
  call void @cpXTSxor16(ptr noundef %147, ptr noundef %148, ptr noundef %149, i32 noundef 32)
  %150 = load ptr, ptr %10, align 8, !tbaa !5
  %151 = getelementptr inbounds i8, ptr %150, i64 512
  store ptr %151, ptr %10, align 8, !tbaa !5
  %152 = load ptr, ptr %11, align 8, !tbaa !5
  %153 = getelementptr inbounds i8, ptr %152, i64 512
  store ptr %153, ptr %11, align 8, !tbaa !5
  br label %154

154:                                              ; preds = %138
  %155 = load i32, ptr %22, align 4, !tbaa !9
  %156 = sub nsw i32 %155, 32
  store i32 %156, ptr %22, align 4, !tbaa !9
  br label %130, !llvm.loop !17

157:                                              ; preds = %136
  %158 = load i32, ptr %21, align 4, !tbaa !9
  %159 = icmp ne i32 0, %158
  br i1 %159, label %160, label %161

160:                                              ; preds = %157
  store i32 2, ptr %27, align 4
  br label %269

161:                                              ; preds = %157
  %162 = load i32, ptr %22, align 4, !tbaa !9
  %163 = icmp ne i32 %162, 0
  br i1 %163, label %164, label %191

164:                                              ; preds = %161
  %165 = getelementptr inbounds [512 x i8], ptr %26, i64 0, i64 0
  %166 = load i32, ptr %22, align 4, !tbaa !9
  %167 = getelementptr inbounds [16 x i8], ptr %25, i64 0, i64 0
  call void @cpXTSwhitening(ptr noundef %165, i32 noundef %166, ptr noundef %167)
  %168 = load ptr, ptr %11, align 8, !tbaa !5
  %169 = load ptr, ptr %10, align 8, !tbaa !5
  %170 = getelementptr inbounds [512 x i8], ptr %26, i64 0, i64 0
  %171 = load i32, ptr %22, align 4, !tbaa !9
  call void @cpXTSxor16(ptr noundef %168, ptr noundef %169, ptr noundef %170, i32 noundef %171)
  %172 = load ptr, ptr %11, align 8, !tbaa !5
  %173 = load ptr, ptr %11, align 8, !tbaa !5
  %174 = load i32, ptr %22, align 4, !tbaa !9
  %175 = mul nsw i32 16, %174
  %176 = call i32 @ippsAESDecryptECB(ptr noundef %172, ptr noundef %173, i32 noundef %175, ptr noundef %24)
  %177 = load ptr, ptr %11, align 8, !tbaa !5
  %178 = load ptr, ptr %11, align 8, !tbaa !5
  %179 = getelementptr inbounds [512 x i8], ptr %26, i64 0, i64 0
  %180 = load i32, ptr %22, align 4, !tbaa !9
  call void @cpXTSxor16(ptr noundef %177, ptr noundef %178, ptr noundef %179, i32 noundef %180)
  %181 = load i32, ptr %22, align 4, !tbaa !9
  %182 = mul nsw i32 16, %181
  %183 = load ptr, ptr %10, align 8, !tbaa !5
  %184 = sext i32 %182 to i64
  %185 = getelementptr inbounds i8, ptr %183, i64 %184
  store ptr %185, ptr %10, align 8, !tbaa !5
  %186 = load i32, ptr %22, align 4, !tbaa !9
  %187 = mul nsw i32 16, %186
  %188 = load ptr, ptr %11, align 8, !tbaa !5
  %189 = sext i32 %187 to i64
  %190 = getelementptr inbounds i8, ptr %188, i64 %189
  store ptr %190, ptr %11, align 8, !tbaa !5
  br label %191

191:                                              ; preds = %164, %161
  %192 = load i32, ptr %23, align 4, !tbaa !9
  %193 = icmp ne i32 %192, 0
  br i1 %193, label %194, label %268

194:                                              ; preds = %191
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #4
  %195 = load i32, ptr %23, align 4, !tbaa !9
  %196 = sdiv i32 %195, 8
  store i32 %196, ptr %29, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %30) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %31) #4
  %197 = getelementptr inbounds [16 x i8], ptr %25, i64 0, i64 0
  %198 = getelementptr inbounds [16 x i8], ptr %30, i64 0, i64 0
  call void @CopyBlock16(ptr noundef %197, ptr noundef %198)
  %199 = getelementptr inbounds [16 x i8], ptr %30, i64 0, i64 0
  call void @gf_mul_by_primitive(ptr noundef %199)
  %200 = getelementptr inbounds [16 x i8], ptr %31, i64 0, i64 0
  %201 = load ptr, ptr %10, align 8, !tbaa !5
  %202 = getelementptr inbounds [16 x i8], ptr %30, i64 0, i64 0
  %203 = call i32 @cpAES_XTS_DecBlock(ptr noundef %200, ptr noundef %201, ptr noundef %202, ptr noundef %24)
  %204 = getelementptr inbounds [16 x i8], ptr %31, i64 0, i64 0
  %205 = getelementptr inbounds [16 x i8], ptr %30, i64 0, i64 0
  call void @CopyBlock16(ptr noundef %204, ptr noundef %205)
  %206 = load ptr, ptr %10, align 8, !tbaa !5
  %207 = getelementptr inbounds i8, ptr %206, i64 16
  %208 = getelementptr inbounds [16 x i8], ptr %30, i64 0, i64 0
  %209 = load i32, ptr %29, align 4, !tbaa !9
  call void @CopyBlock(ptr noundef %207, ptr noundef %208, i32 noundef %209)
  %210 = load i32, ptr %23, align 4, !tbaa !9
  %211 = srem i32 %210, 8
  store i32 %211, ptr %23, align 4, !tbaa !9
  %212 = load i32, ptr %23, align 4, !tbaa !9
  %213 = icmp ne i32 %212, 0
  br i1 %213, label %214, label %258

214:                                              ; preds = %194
  call void @llvm.lifetime.start.p0(i64 1, ptr %32) #4
  %215 = load i32, ptr %23, align 4, !tbaa !9
  %216 = sub nsw i32 8, %215
  %217 = srem i32 %216, 8
  %218 = shl i32 255, %217
  %219 = trunc i32 %218 to i8
  store i8 %219, ptr %32, align 1, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 1, ptr %33) #4
  %220 = load ptr, ptr %10, align 8, !tbaa !5
  %221 = load i32, ptr %29, align 4, !tbaa !9
  %222 = add nsw i32 16, %221
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds i8, ptr %220, i64 %223
  %225 = load i8, ptr %224, align 1, !tbaa !18
  store i8 %225, ptr %33, align 1, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 1, ptr %34) #4
  %226 = load i32, ptr %29, align 4, !tbaa !9
  %227 = sext i32 %226 to i64
  %228 = getelementptr inbounds [16 x i8], ptr %30, i64 0, i64 %227
  %229 = load i8, ptr %228, align 1, !tbaa !18
  store i8 %229, ptr %34, align 1, !tbaa !18
  %230 = load i8, ptr %33, align 1, !tbaa !18
  %231 = zext i8 %230 to i32
  %232 = load i8, ptr %32, align 1, !tbaa !18
  %233 = zext i8 %232 to i32
  %234 = and i32 %231, %233
  %235 = load i8, ptr %34, align 1, !tbaa !18
  %236 = zext i8 %235 to i32
  %237 = load i8, ptr %32, align 1, !tbaa !18
  %238 = zext i8 %237 to i32
  %239 = xor i32 %238, -1
  %240 = and i32 %236, %239
  %241 = or i32 %234, %240
  %242 = trunc i32 %241 to i8
  store i8 %242, ptr %33, align 1, !tbaa !18
  %243 = load i8, ptr %33, align 1, !tbaa !18
  %244 = load i32, ptr %29, align 4, !tbaa !9
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds [16 x i8], ptr %30, i64 0, i64 %245
  store i8 %243, ptr %246, align 1, !tbaa !18
  %247 = load i8, ptr %32, align 1, !tbaa !18
  %248 = zext i8 %247 to i32
  %249 = load i32, ptr %29, align 4, !tbaa !9
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds [16 x i8], ptr %31, i64 0, i64 %250
  %252 = load i8, ptr %251, align 1, !tbaa !18
  %253 = zext i8 %252 to i32
  %254 = and i32 %253, %248
  %255 = trunc i32 %254 to i8
  store i8 %255, ptr %251, align 1, !tbaa !18
  %256 = load i32, ptr %29, align 4, !tbaa !9
  %257 = add nsw i32 %256, 1
  store i32 %257, ptr %29, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, ptr %34) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %33) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %32) #4
  br label %258

258:                                              ; preds = %214, %194
  %259 = load ptr, ptr %11, align 8, !tbaa !5
  %260 = getelementptr inbounds [16 x i8], ptr %30, i64 0, i64 0
  %261 = getelementptr inbounds [16 x i8], ptr %25, i64 0, i64 0
  %262 = call i32 @cpAES_XTS_DecBlock(ptr noundef %259, ptr noundef %260, ptr noundef %261, ptr noundef %24)
  %263 = getelementptr inbounds [16 x i8], ptr %31, i64 0, i64 0
  %264 = load ptr, ptr %11, align 8, !tbaa !5
  %265 = getelementptr inbounds i8, ptr %264, i64 16
  %266 = load i32, ptr %29, align 4, !tbaa !9
  call void @CopyBlock(ptr noundef %263, ptr noundef %265, i32 noundef %266)
  %267 = getelementptr inbounds [16 x i8], ptr %31, i64 0, i64 0
  call void @PurgeBlock(ptr noundef %267, i32 noundef 16)
  call void @llvm.lifetime.end.p0(i64 16, ptr %31) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %30) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #4
  br label %268

268:                                              ; preds = %258, %191
  store i32 0, ptr %27, align 4
  br label %269

269:                                              ; preds = %268, %160, %113, %97
  call void @llvm.lifetime.end.p0(i64 512, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 568, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  %270 = load i32, ptr %27, align 4
  switch i32 %270, label %277 [
    i32 0, label %271
    i32 2, label %273
  ]

271:                                              ; preds = %269
  br label %272

272:                                              ; preds = %271
  br label %273

273:                                              ; preds = %272, %269
  %274 = load i32, ptr %21, align 4, !tbaa !9
  store i32 %274, ptr %9, align 4
  store i32 1, ptr %27, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %275

275:                                              ; preds = %273, %77, %68, %64, %60, %56, %52, %48, %41, %37
  %276 = load i32, ptr %9, align 4
  ret i32 %276

277:                                              ; preds = %269
  unreachable
}

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

declare i32 @ippsAESInit(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @gf_mul_by_primitive(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @cpXTSwhitening(ptr noundef, i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @cpXTSxor16(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #0

declare i32 @ippsAESDecryptECB(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @CopyBlock16(ptr noundef, ptr noundef) #3

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @CopyBlock(ptr noundef, ptr noundef, i32 noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @PurgeBlock(ptr noundef, i32 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 = { "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 = { 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 = { 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 = !{!12, !6, i64 16}
!12 = !{!"_cpRijndael128", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !10, i64 64, !10, i64 68, !7, i64 72}
!13 = !{!12, !10, i64 12}
!14 = !{!12, !6, i64 48}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = !{!7, !7, i64 0}


; 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._cpRijndael128 = type { i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, [124 x i32] }

@RijEncSbox = external constant [256 x i8], align 64

; Function Attrs: nounwind uwtable
define dso_local i32 @ippsAESDecryptXTS_Direct(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5, i32 noundef %6, i32 noundef %7) local_unnamed_addr #0 {
  %9 = alloca %struct._cpRijndael128, align 16
  %10 = alloca [16 x i8], align 16
  %11 = alloca [512 x i8], align 16
  %12 = alloca [16 x i8], align 16
  %13 = alloca [16 x i8], align 16
  %14 = icmp slt i32 %7, 128
  br i1 %14, label %92, label %15

15:                                               ; preds = %8
  %16 = icmp eq ptr %5, null
  br i1 %16, label %92, label %17

17:                                               ; preds = %15
  switch i32 %6, label %92 [
    i32 512, label %18
    i32 256, label %18
  ]

18:                                               ; preds = %17, %17
  %19 = icmp eq ptr %4, null
  %20 = icmp eq ptr %0, null
  %or.cond = or i1 %20, %19
  %21 = icmp eq ptr %1, null
  %or.cond109 = or i1 %21, %or.cond
  br i1 %or.cond109, label %92, label %22

22:                                               ; preds = %18
  %23 = icmp slt i32 %2, 128
  br i1 %23, label %92, label %24

24:                                               ; preds = %22
  %25 = icmp ult i32 %2, 134217729
  %26 = lshr i32 %7, 7
  %or.cond3.not = icmp ugt i32 %26, %3
  %or.cond110 = and i1 %25, %or.cond3.not
  br i1 %or.cond110, label %27, label %92

27:                                               ; preds = %24
  %28 = lshr exact i32 %6, 4
  %29 = zext nneg i32 %28 to i64
  %30 = getelementptr inbounds i8, ptr %5, i64 %29
  %31 = lshr i32 %2, 7
  %32 = and i32 %2, 127
  call void @llvm.lifetime.start.p0(i64 568, ptr nonnull %9) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #4
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %11) #4
  %33 = call i32 @ippsAESInit(ptr noundef nonnull %30, i32 noundef %28, ptr noundef nonnull %9, i32 noundef 568) #4
  %.not = icmp eq i32 %33, 0
  br i1 %.not, label %34, label %91

34:                                               ; preds = %27
  %35 = getelementptr inbounds i8, ptr %9, i64 16
  %36 = load ptr, ptr %35, align 16, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %9, i64 12
  %38 = load i32, ptr %37, align 4, !tbaa !11
  %39 = getelementptr inbounds i8, ptr %9, i64 48
  %40 = load ptr, ptr %39, align 16, !tbaa !12
  call void %36(ptr noundef nonnull %4, ptr noundef nonnull %10, i32 noundef %38, ptr noundef %40, ptr noundef nonnull @RijEncSbox) #4
  %41 = call i32 @ippsAESInit(ptr noundef nonnull %5, i32 noundef %28, ptr noundef nonnull %9, i32 noundef 568) #4
  %.not104 = icmp eq i32 %41, 0
  br i1 %.not104, label %.preheader, label %91

.preheader:                                       ; preds = %34
  %.not139 = icmp eq i32 %3, 0
  br i1 %.not139, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.088111 = phi i32 [ %42, %.lr.ph ], [ %3, %.preheader ]
  call void @gf_mul_by_primitive(ptr noundef nonnull %10)
  %42 = add nsw i32 %.088111, -1
  %43 = icmp ugt i32 %.088111, 1
  br i1 %43, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %.not105 = icmp ne i32 %32, 0
  %44 = sext i1 %.not105 to i32
  %spec.select = add nsw i32 %31, %44
  %45 = icmp sgt i32 %spec.select, 31
  br i1 %45, label %.lr.ph116, label %._crit_edge117.thread

.lr.ph116:                                        ; preds = %._crit_edge, %.lr.ph116
  %.084114 = phi ptr [ %47, %.lr.ph116 ], [ %0, %._crit_edge ]
  %.085113 = phi ptr [ %48, %.lr.ph116 ], [ %1, %._crit_edge ]
  %.190112 = phi i32 [ %49, %.lr.ph116 ], [ %spec.select, %._crit_edge ]
  call void @cpXTSwhitening(ptr noundef nonnull %11, i32 noundef 32, ptr noundef nonnull %10)
  call void @cpXTSxor16(ptr noundef nonnull %.085113, ptr noundef nonnull %.084114, ptr noundef nonnull %11, i32 noundef 32)
  %46 = call i32 @ippsAESDecryptECB(ptr noundef nonnull %.085113, ptr noundef nonnull %.085113, i32 noundef 512, ptr noundef nonnull %9) #4
  call void @cpXTSxor16(ptr noundef nonnull %.085113, ptr noundef nonnull %.085113, ptr noundef nonnull %11, i32 noundef 32)
  %47 = getelementptr inbounds i8, ptr %.084114, i64 512
  %48 = getelementptr inbounds i8, ptr %.085113, i64 512
  %49 = add nsw i32 %.190112, -32
  %50 = icmp ugt i32 %.190112, 63
  %51 = icmp eq i32 %46, 0
  %52 = select i1 %50, i1 %51, i1 false
  br i1 %52, label %.lr.ph116, label %._crit_edge117, !llvm.loop !15

._crit_edge117:                                   ; preds = %.lr.ph116
  br i1 %51, label %._crit_edge117.thread, label %91

._crit_edge117.thread:                            ; preds = %._crit_edge, %._crit_edge117
  %.084.lcssa134 = phi ptr [ %47, %._crit_edge117 ], [ %0, %._crit_edge ]
  %.085.lcssa133 = phi ptr [ %48, %._crit_edge117 ], [ %1, %._crit_edge ]
  %.190.lcssa132 = phi i32 [ %49, %._crit_edge117 ], [ %spec.select, %._crit_edge ]
  %.not107 = icmp eq i32 %.190.lcssa132, 0
  br i1 %.not107, label %59, label %53

53:                                               ; preds = %._crit_edge117.thread
  call void @cpXTSwhitening(ptr noundef nonnull %11, i32 noundef %.190.lcssa132, ptr noundef nonnull %10)
  call void @cpXTSxor16(ptr noundef nonnull %.085.lcssa133, ptr noundef nonnull %.084.lcssa134, ptr noundef nonnull %11, i32 noundef %.190.lcssa132)
  %54 = shl nuw nsw i32 %.190.lcssa132, 4
  %55 = call i32 @ippsAESDecryptECB(ptr noundef nonnull %.085.lcssa133, ptr noundef nonnull %.085.lcssa133, i32 noundef %54, ptr noundef nonnull %9) #4
  call void @cpXTSxor16(ptr noundef nonnull %.085.lcssa133, ptr noundef nonnull %.085.lcssa133, ptr noundef nonnull %11, i32 noundef %.190.lcssa132)
  %56 = zext nneg i32 %54 to i64
  %57 = getelementptr inbounds i8, ptr %.084.lcssa134, i64 %56
  %58 = getelementptr inbounds i8, ptr %.085.lcssa133, i64 %56
  br label %59

59:                                               ; preds = %53, %._crit_edge117.thread
  %.186 = phi ptr [ %58, %53 ], [ %.085.lcssa133, %._crit_edge117.thread ]
  %.1 = phi ptr [ %57, %53 ], [ %.084.lcssa134, %._crit_edge117.thread ]
  br i1 %.not105, label %60, label %91

60:                                               ; preds = %59
  %61 = lshr i32 %32, 3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %12) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %13) #4
  call void @CopyBlock16(ptr noundef nonnull %10, ptr noundef nonnull %12)
  call void @gf_mul_by_primitive(ptr noundef nonnull %12)
  %62 = call i32 @cpAES_XTS_DecBlock(ptr noundef nonnull %13, ptr noundef %.1, ptr noundef nonnull %12, ptr noundef nonnull %9)
  call void @CopyBlock16(ptr noundef nonnull %13, ptr noundef nonnull %12)
  %63 = getelementptr inbounds i8, ptr %.1, i64 16
  call void @CopyBlock(ptr noundef nonnull %63, ptr noundef nonnull %12, i32 noundef %61)
  %64 = and i32 %2, 7
  %.not108 = icmp eq i32 %64, 0
  br i1 %.not108, label %88, label %65

65:                                               ; preds = %60
  %66 = sub nsw i32 0, %2
  %67 = and i32 %66, 7
  %68 = shl nuw nsw i32 255, %67
  %69 = or disjoint i32 %61, 16
  %70 = zext nneg i32 %69 to i64
  %71 = getelementptr inbounds i8, ptr %.1, i64 %70
  %72 = load i8, ptr %71, align 1, !tbaa !16
  %73 = zext nneg i32 %61 to i64
  %74 = getelementptr inbounds [16 x i8], ptr %12, i64 0, i64 %73
  %75 = load i8, ptr %74, align 1, !tbaa !16
  %76 = zext i8 %72 to i32
  %77 = and i32 %68, %76
  %78 = zext i8 %75 to i32
  %79 = xor i32 %68, -1
  %80 = and i32 %78, %79
  %81 = or disjoint i32 %80, %77
  %82 = trunc nuw i32 %81 to i8
  store i8 %82, ptr %74, align 1, !tbaa !16
  %83 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 %73
  %84 = load i8, ptr %83, align 1, !tbaa !16
  %85 = trunc i32 %68 to i8
  %86 = and i8 %84, %85
  store i8 %86, ptr %83, align 1, !tbaa !16
  %87 = add nuw nsw i32 %61, 1
  br label %88

88:                                               ; preds = %65, %60
  %.087 = phi i32 [ %87, %65 ], [ %61, %60 ]
  %89 = call i32 @cpAES_XTS_DecBlock(ptr noundef %.186, ptr noundef nonnull %12, ptr noundef nonnull %10, ptr noundef nonnull %9)
  %90 = getelementptr inbounds i8, ptr %.186, i64 16
  call void @CopyBlock(ptr noundef nonnull %13, ptr noundef nonnull %90, i32 noundef %.087)
  call void @PurgeBlock(ptr noundef nonnull %13, i32 noundef 16)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %12) #4
  br label %91

91:                                               ; preds = %59, %88, %._crit_edge117, %34, %27
  %.192 = phi i32 [ %33, %27 ], [ %41, %34 ], [ %46, %._crit_edge117 ], [ 0, %88 ], [ 0, %59 ]
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 568, ptr nonnull %9) #4
  br label %92

92:                                               ; preds = %24, %22, %18, %17, %15, %8, %91
  %.0 = phi i32 [ %.192, %91 ], [ -15, %8 ], [ -8, %15 ], [ -15, %17 ], [ -8, %18 ], [ -15, %22 ], [ -5, %24 ]
  ret i32 %.0
}

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

declare i32 @ippsAESInit(ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @gf_mul_by_primitive(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @cpXTSwhitening(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @cpXTSxor16(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

declare i32 @ippsAESDecryptECB(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @CopyBlock16(ptr noundef, ptr noundef) local_unnamed_addr #3

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @CopyBlock(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @PurgeBlock(ptr noundef, i32 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 = { "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 = { 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 = { 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, !10, i64 16}
!6 = !{!"_cpRijndael128", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !7, i64 64, !7, i64 68, !8, i64 72}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 12}
!12 = !{!6, !10, i64 48}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!8, !8, i64 0}


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