; LLVM IR from guanzhi/GmSSL :: src (kyber)

; 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.KYBER_CPA_PUBLIC_KEY = type { [2 x [384 x i8]], [32 x i8] }
%struct.KYBER_CPA_CIPHERTEXT = type { [2 x [320 x i8]], [128 x i8] }

; 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 @kyber_poly_set_zero(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @kyber_poly_uniform_sample(ptr noundef, ptr noundef, i8 noundef zeroext, i8 noundef zeroext) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @kyber_poly_cbd_sample(ptr noundef, i32 noundef, ptr noundef, i8 noundef zeroext) #1

declare void @gmssl_secure_clear(ptr noundef, i64 noundef) #2

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

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

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

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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @kyber_cpa_encrypt(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #1 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca [2 x [2 x [256 x i16]]], align 16
  %10 = alloca [2 x [256 x i16]], align 16
  %11 = alloca [2 x [256 x i16]], align 16
  %12 = alloca [2 x [256 x i16]], align 16
  %13 = alloca [2 x [256 x i16]], align 16
  %14 = alloca [256 x i16], align 16
  %15 = alloca [256 x i16], align 16
  %16 = alloca [256 x i16], align 16
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca [256 x i16], align 16
  %21 = alloca [256 x i16], align 16
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2048, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 1024, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 1024, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 1024, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 1024, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 512, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 512, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 512, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  store i32 0, ptr %19, align 4, !tbaa !9
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %37, %4
  %23 = load i32, ptr %17, align 4, !tbaa !9
  %24 = icmp slt i32 %23, 2
  br i1 %24, label %25, label %40

25:                                               ; preds = %22
  %26 = load i32, ptr %17, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [2 x [256 x i16]], ptr %10, i64 0, i64 %27
  %29 = getelementptr inbounds [256 x i16], ptr %28, i64 0, i64 0
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.KYBER_CPA_PUBLIC_KEY, ptr %30, i32 0, i32 0
  %32 = load i32, ptr %17, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [2 x [384 x i8]], ptr %31, i64 0, i64 %33
  %35 = getelementptr inbounds [384 x i8], ptr %34, i64 0, i64 0
  %36 = call i32 @kyber_poly_decode12(ptr noundef %29, ptr noundef %35)
  br label %37

37:                                               ; preds = %25
  %38 = load i32, ptr %17, align 4, !tbaa !9
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %17, align 4, !tbaa !9
  br label %22, !llvm.loop !11

40:                                               ; preds = %22
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %68, %40
  %42 = load i32, ptr %17, align 4, !tbaa !9
  %43 = icmp slt i32 %42, 2
  br i1 %43, label %44, label %71

44:                                               ; preds = %41
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %45

45:                                               ; preds = %64, %44
  %46 = load i32, ptr %18, align 4, !tbaa !9
  %47 = icmp slt i32 %46, 2
  br i1 %47, label %48, label %67

48:                                               ; preds = %45
  %49 = load i32, ptr %17, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [2 x [2 x [256 x i16]]], ptr %9, i64 0, i64 %50
  %52 = load i32, ptr %18, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [2 x [256 x i16]], ptr %51, i64 0, i64 %53
  %55 = getelementptr inbounds [256 x i16], ptr %54, i64 0, i64 0
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.KYBER_CPA_PUBLIC_KEY, ptr %56, i32 0, i32 1
  %58 = getelementptr inbounds [32 x i8], ptr %57, i64 0, i64 0
  %59 = load i32, ptr %17, align 4, !tbaa !9
  %60 = trunc i32 %59 to i8
  %61 = load i32, ptr %18, align 4, !tbaa !9
  %62 = trunc i32 %61 to i8
  %63 = call i32 @kyber_poly_uniform_sample(ptr noundef %55, ptr noundef %58, i8 noundef zeroext %60, i8 noundef zeroext %62)
  br label %64

64:                                               ; preds = %48
  %65 = load i32, ptr %18, align 4, !tbaa !9
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %18, align 4, !tbaa !9
  br label %45, !llvm.loop !13

67:                                               ; preds = %45
  br label %68

68:                                               ; preds = %67
  %69 = load i32, ptr %17, align 4, !tbaa !9
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %17, align 4, !tbaa !9
  br label %41, !llvm.loop !14

71:                                               ; preds = %41
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %72

72:                                               ; preds = %86, %71
  %73 = load i32, ptr %17, align 4, !tbaa !9
  %74 = icmp slt i32 %73, 2
  br i1 %74, label %75, label %89

75:                                               ; preds = %72
  %76 = load i32, ptr %17, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [2 x [256 x i16]], ptr %11, i64 0, i64 %77
  %79 = getelementptr inbounds [256 x i16], ptr %78, i64 0, i64 0
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = load i32, ptr %19, align 4, !tbaa !9
  %82 = trunc i32 %81 to i8
  %83 = call i32 @kyber_poly_cbd_sample(ptr noundef %79, i32 noundef 3, ptr noundef %80, i8 noundef zeroext %82)
  %84 = load i32, ptr %19, align 4, !tbaa !9
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %19, align 4, !tbaa !9
  br label %86

86:                                               ; preds = %75
  %87 = load i32, ptr %17, align 4, !tbaa !9
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %17, align 4, !tbaa !9
  br label %72, !llvm.loop !15

89:                                               ; preds = %72
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %90

90:                                               ; preds = %104, %89
  %91 = load i32, ptr %17, align 4, !tbaa !9
  %92 = icmp slt i32 %91, 2
  br i1 %92, label %93, label %107

93:                                               ; preds = %90
  %94 = load i32, ptr %17, align 4, !tbaa !9
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [2 x [256 x i16]], ptr %13, i64 0, i64 %95
  %97 = getelementptr inbounds [256 x i16], ptr %96, i64 0, i64 0
  %98 = load ptr, ptr %7, align 8, !tbaa !5
  %99 = load i32, ptr %19, align 4, !tbaa !9
  %100 = trunc i32 %99 to i8
  %101 = call i32 @kyber_poly_cbd_sample(ptr noundef %97, i32 noundef 2, ptr noundef %98, i8 noundef zeroext %100)
  %102 = load i32, ptr %19, align 4, !tbaa !9
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %19, align 4, !tbaa !9
  br label %104

104:                                              ; preds = %93
  %105 = load i32, ptr %17, align 4, !tbaa !9
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %17, align 4, !tbaa !9
  br label %90, !llvm.loop !16

107:                                              ; preds = %90
  %108 = getelementptr inbounds [256 x i16], ptr %14, i64 0, i64 0
  %109 = load ptr, ptr %7, align 8, !tbaa !5
  %110 = load i32, ptr %19, align 4, !tbaa !9
  %111 = trunc i32 %110 to i8
  %112 = call i32 @kyber_poly_cbd_sample(ptr noundef %108, i32 noundef 2, ptr noundef %109, i8 noundef zeroext %111)
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %113

113:                                              ; preds = %122, %107
  %114 = load i32, ptr %17, align 4, !tbaa !9
  %115 = icmp slt i32 %114, 2
  br i1 %115, label %116, label %125

116:                                              ; preds = %113
  %117 = load i32, ptr %17, align 4, !tbaa !9
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [2 x [256 x i16]], ptr %11, i64 0, i64 %118
  %120 = getelementptr inbounds [256 x i16], ptr %119, i64 0, i64 0
  %121 = call i32 @kyber_poly_ntt(ptr noundef %120)
  br label %122

122:                                              ; preds = %116
  %123 = load i32, ptr %17, align 4, !tbaa !9
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %17, align 4, !tbaa !9
  br label %113, !llvm.loop !17

125:                                              ; preds = %113
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %126

126:                                              ; preds = %134, %125
  %127 = load i32, ptr %17, align 4, !tbaa !9
  %128 = icmp slt i32 %127, 2
  br i1 %128, label %129, label %137

129:                                              ; preds = %126
  %130 = load i32, ptr %17, align 4, !tbaa !9
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [2 x [256 x i16]], ptr %12, i64 0, i64 %131
  %133 = getelementptr inbounds [256 x i16], ptr %132, i64 0, i64 0
  call void @kyber_poly_set_zero(ptr noundef %133)
  br label %134

134:                                              ; preds = %129
  %135 = load i32, ptr %17, align 4, !tbaa !9
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %17, align 4, !tbaa !9
  br label %126, !llvm.loop !18

137:                                              ; preds = %126
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %138

138:                                              ; preds = %189, %137
  %139 = load i32, ptr %17, align 4, !tbaa !9
  %140 = icmp slt i32 %139, 2
  br i1 %140, label %141, label %192

141:                                              ; preds = %138
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %142

142:                                              ; preds = %168, %141
  %143 = load i32, ptr %18, align 4, !tbaa !9
  %144 = icmp slt i32 %143, 2
  br i1 %144, label %145, label %171

145:                                              ; preds = %142
  call void @llvm.lifetime.start.p0(i64 512, ptr %20) #3
  %146 = getelementptr inbounds [256 x i16], ptr %20, i64 0, i64 0
  %147 = load i32, ptr %17, align 4, !tbaa !9
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [2 x [2 x [256 x i16]]], ptr %9, i64 0, i64 %148
  %150 = load i32, ptr %18, align 4, !tbaa !9
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [2 x [256 x i16]], ptr %149, i64 0, i64 %151
  %153 = getelementptr inbounds [256 x i16], ptr %152, i64 0, i64 0
  %154 = load i32, ptr %18, align 4, !tbaa !9
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [2 x [256 x i16]], ptr %11, i64 0, i64 %155
  %157 = getelementptr inbounds [256 x i16], ptr %156, i64 0, i64 0
  %158 = call i32 @kyber_poly_ntt_mul(ptr noundef %146, ptr noundef %153, ptr noundef %157)
  %159 = load i32, ptr %17, align 4, !tbaa !9
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [2 x [256 x i16]], ptr %12, i64 0, i64 %160
  %162 = getelementptr inbounds [256 x i16], ptr %161, i64 0, i64 0
  %163 = load i32, ptr %17, align 4, !tbaa !9
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [2 x [256 x i16]], ptr %12, i64 0, i64 %164
  %166 = getelementptr inbounds [256 x i16], ptr %165, i64 0, i64 0
  %167 = getelementptr inbounds [256 x i16], ptr %20, i64 0, i64 0
  call void @kyber_poly_add(ptr noundef %162, ptr noundef %166, ptr noundef %167)
  call void @llvm.lifetime.end.p0(i64 512, ptr %20) #3
  br label %168

168:                                              ; preds = %145
  %169 = load i32, ptr %18, align 4, !tbaa !9
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr %18, align 4, !tbaa !9
  br label %142, !llvm.loop !19

171:                                              ; preds = %142
  %172 = load i32, ptr %17, align 4, !tbaa !9
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [2 x [256 x i16]], ptr %12, i64 0, i64 %173
  %175 = getelementptr inbounds [256 x i16], ptr %174, i64 0, i64 0
  %176 = call i32 @kyber_poly_inv_ntt(ptr noundef %175)
  %177 = load i32, ptr %17, align 4, !tbaa !9
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [2 x [256 x i16]], ptr %12, i64 0, i64 %178
  %180 = getelementptr inbounds [256 x i16], ptr %179, i64 0, i64 0
  %181 = load i32, ptr %17, align 4, !tbaa !9
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [2 x [256 x i16]], ptr %12, i64 0, i64 %182
  %184 = getelementptr inbounds [256 x i16], ptr %183, i64 0, i64 0
  %185 = load i32, ptr %17, align 4, !tbaa !9
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [2 x [256 x i16]], ptr %13, i64 0, i64 %186
  %188 = getelementptr inbounds [256 x i16], ptr %187, i64 0, i64 0
  call void @kyber_poly_add(ptr noundef %180, ptr noundef %184, ptr noundef %188)
  br label %189

189:                                              ; preds = %171
  %190 = load i32, ptr %17, align 4, !tbaa !9
  %191 = add nsw i32 %190, 1
  store i32 %191, ptr %17, align 4, !tbaa !9
  br label %138, !llvm.loop !20

192:                                              ; preds = %138
  %193 = getelementptr inbounds [256 x i16], ptr %15, i64 0, i64 0
  call void @kyber_poly_set_zero(ptr noundef %193)
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %194

194:                                              ; preds = %211, %192
  %195 = load i32, ptr %17, align 4, !tbaa !9
  %196 = icmp slt i32 %195, 2
  br i1 %196, label %197, label %214

197:                                              ; preds = %194
  call void @llvm.lifetime.start.p0(i64 512, ptr %21) #3
  %198 = getelementptr inbounds [256 x i16], ptr %21, i64 0, i64 0
  %199 = load i32, ptr %17, align 4, !tbaa !9
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [2 x [256 x i16]], ptr %10, i64 0, i64 %200
  %202 = getelementptr inbounds [256 x i16], ptr %201, i64 0, i64 0
  %203 = load i32, ptr %17, align 4, !tbaa !9
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [2 x [256 x i16]], ptr %11, i64 0, i64 %204
  %206 = getelementptr inbounds [256 x i16], ptr %205, i64 0, i64 0
  %207 = call i32 @kyber_poly_ntt_mul(ptr noundef %198, ptr noundef %202, ptr noundef %206)
  %208 = getelementptr inbounds [256 x i16], ptr %15, i64 0, i64 0
  %209 = getelementptr inbounds [256 x i16], ptr %15, i64 0, i64 0
  %210 = getelementptr inbounds [256 x i16], ptr %21, i64 0, i64 0
  call void @kyber_poly_add(ptr noundef %208, ptr noundef %209, ptr noundef %210)
  call void @llvm.lifetime.end.p0(i64 512, ptr %21) #3
  br label %211

211:                                              ; preds = %197
  %212 = load i32, ptr %17, align 4, !tbaa !9
  %213 = add nsw i32 %212, 1
  store i32 %213, ptr %17, align 4, !tbaa !9
  br label %194, !llvm.loop !21

214:                                              ; preds = %194
  %215 = getelementptr inbounds [256 x i16], ptr %15, i64 0, i64 0
  %216 = call i32 @kyber_poly_inv_ntt(ptr noundef %215)
  %217 = getelementptr inbounds [256 x i16], ptr %15, i64 0, i64 0
  %218 = getelementptr inbounds [256 x i16], ptr %15, i64 0, i64 0
  %219 = getelementptr inbounds [256 x i16], ptr %14, i64 0, i64 0
  call void @kyber_poly_add(ptr noundef %217, ptr noundef %218, ptr noundef %219)
  %220 = getelementptr inbounds [256 x i16], ptr %16, i64 0, i64 0
  %221 = load ptr, ptr %6, align 8, !tbaa !5
  call void @kyber_poly_decode1(ptr noundef %220, ptr noundef %221)
  %222 = getelementptr inbounds [256 x i16], ptr %16, i64 0, i64 0
  %223 = getelementptr inbounds [256 x i16], ptr %16, i64 0, i64 0
  %224 = call i32 @kyber_poly_decompress(ptr noundef %222, i32 noundef 1, ptr noundef %223)
  %225 = getelementptr inbounds [256 x i16], ptr %15, i64 0, i64 0
  %226 = getelementptr inbounds [256 x i16], ptr %15, i64 0, i64 0
  %227 = getelementptr inbounds [256 x i16], ptr %16, i64 0, i64 0
  call void @kyber_poly_add(ptr noundef %225, ptr noundef %226, ptr noundef %227)
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %228

228:                                              ; preds = %252, %214
  %229 = load i32, ptr %17, align 4, !tbaa !9
  %230 = icmp slt i32 %229, 2
  br i1 %230, label %231, label %255

231:                                              ; preds = %228
  %232 = load i32, ptr %17, align 4, !tbaa !9
  %233 = sext i32 %232 to i64
  %234 = getelementptr inbounds [2 x [256 x i16]], ptr %12, i64 0, i64 %233
  %235 = getelementptr inbounds [256 x i16], ptr %234, i64 0, i64 0
  %236 = load i32, ptr %17, align 4, !tbaa !9
  %237 = sext i32 %236 to i64
  %238 = getelementptr inbounds [2 x [256 x i16]], ptr %12, i64 0, i64 %237
  %239 = getelementptr inbounds [256 x i16], ptr %238, i64 0, i64 0
  %240 = call i32 @kyber_poly_compress(ptr noundef %235, i32 noundef 10, ptr noundef %239)
  %241 = load i32, ptr %17, align 4, !tbaa !9
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds [2 x [256 x i16]], ptr %12, i64 0, i64 %242
  %244 = getelementptr inbounds [256 x i16], ptr %243, i64 0, i64 0
  %245 = load ptr, ptr %8, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct.KYBER_CPA_CIPHERTEXT, ptr %245, i32 0, i32 0
  %247 = load i32, ptr %17, align 4, !tbaa !9
  %248 = sext i32 %247 to i64
  %249 = getelementptr inbounds [2 x [320 x i8]], ptr %246, i64 0, i64 %248
  %250 = getelementptr inbounds [320 x i8], ptr %249, i64 0, i64 0
  %251 = call i32 @kyber_poly_encode10(ptr noundef %244, ptr noundef %250)
  br label %252

252:                                              ; preds = %231
  %253 = load i32, ptr %17, align 4, !tbaa !9
  %254 = add nsw i32 %253, 1
  store i32 %254, ptr %17, align 4, !tbaa !9
  br label %228, !llvm.loop !22

255:                                              ; preds = %228
  %256 = getelementptr inbounds [256 x i16], ptr %15, i64 0, i64 0
  %257 = getelementptr inbounds [256 x i16], ptr %15, i64 0, i64 0
  %258 = call i32 @kyber_poly_compress(ptr noundef %256, i32 noundef 4, ptr noundef %257)
  %259 = getelementptr inbounds [256 x i16], ptr %15, i64 0, i64 0
  %260 = load ptr, ptr %8, align 8, !tbaa !5
  %261 = getelementptr inbounds %struct.KYBER_CPA_CIPHERTEXT, ptr %260, i32 0, i32 1
  %262 = getelementptr inbounds [128 x i8], ptr %261, i64 0, i64 0
  %263 = call i32 @kyber_poly_encode4(ptr noundef %259, ptr noundef %262)
  %264 = getelementptr inbounds [256 x i16], ptr %16, i64 0, i64 0
  call void @gmssl_secure_clear(ptr noundef %264, i64 noundef 512)
  %265 = getelementptr inbounds [2 x [256 x i16]], ptr %11, i64 0, i64 0
  call void @gmssl_secure_clear(ptr noundef %265, i64 noundef 1024)
  %266 = getelementptr inbounds [2 x [256 x i16]], ptr %13, i64 0, i64 0
  call void @gmssl_secure_clear(ptr noundef %266, i64 noundef 1024)
  %267 = getelementptr inbounds [256 x i16], ptr %14, i64 0, i64 0
  call void @gmssl_secure_clear(ptr noundef %267, i64 noundef 512)
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 512, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 512, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 512, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 1024, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 1024, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 1024, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 1024, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 2048, ptr %9) #3
  ret i32 1
}

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 = { "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 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}


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

; 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 @kyber_poly_set_zero(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @kyber_poly_uniform_sample(ptr noundef, ptr noundef, i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @kyber_poly_cbd_sample(ptr noundef, i32 noundef, ptr noundef, i8 noundef zeroext) local_unnamed_addr #1

declare void @gmssl_secure_clear(ptr noundef, i64 noundef) local_unnamed_addr #2

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

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

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

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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @kyber_cpa_encrypt(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #1 {
.preheader68:
  %4 = alloca [2 x [2 x [256 x i16]]], align 16
  %5 = alloca [2 x [256 x i16]], align 16
  %6 = alloca [2 x [256 x i16]], align 16
  %7 = alloca [2 x [256 x i16]], align 16
  %8 = alloca [2 x [256 x i16]], align 16
  %9 = alloca [256 x i16], align 16
  %10 = alloca [256 x i16], align 16
  %11 = alloca [256 x i16], align 16
  %12 = alloca [256 x i16], align 16
  %13 = alloca [256 x i16], align 16
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %9) #3
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %10) #3
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %11) #3
  %14 = call i32 @kyber_poly_decode12(ptr noundef nonnull %5, ptr noundef %0)
  %15 = getelementptr inbounds i8, ptr %5, i64 512
  %16 = getelementptr inbounds i8, ptr %0, i64 384
  %17 = call i32 @kyber_poly_decode12(ptr noundef nonnull %15, ptr noundef nonnull %16)
  %18 = getelementptr inbounds i8, ptr %0, i64 768
  %19 = call i32 @kyber_poly_uniform_sample(ptr noundef nonnull %4, ptr noundef nonnull %18, i8 noundef zeroext 0, i8 noundef zeroext 0)
  %20 = getelementptr inbounds i8, ptr %4, i64 512
  %21 = call i32 @kyber_poly_uniform_sample(ptr noundef nonnull %20, ptr noundef nonnull %18, i8 noundef zeroext 0, i8 noundef zeroext 1)
  %22 = getelementptr inbounds i8, ptr %4, i64 1024
  %23 = call i32 @kyber_poly_uniform_sample(ptr noundef nonnull %22, ptr noundef nonnull %18, i8 noundef zeroext 1, i8 noundef zeroext 0)
  %24 = getelementptr inbounds i8, ptr %4, i64 1536
  %25 = call i32 @kyber_poly_uniform_sample(ptr noundef nonnull %24, ptr noundef nonnull %18, i8 noundef zeroext 1, i8 noundef zeroext 1)
  %26 = call i32 @kyber_poly_cbd_sample(ptr noundef nonnull %6, i32 noundef 3, ptr noundef %2, i8 noundef zeroext 0)
  %27 = getelementptr inbounds i8, ptr %6, i64 512
  %28 = call i32 @kyber_poly_cbd_sample(ptr noundef nonnull %27, i32 noundef 3, ptr noundef %2, i8 noundef zeroext 1)
  %29 = call i32 @kyber_poly_cbd_sample(ptr noundef nonnull %8, i32 noundef 2, ptr noundef %2, i8 noundef zeroext 2)
  %30 = getelementptr inbounds i8, ptr %8, i64 512
  %31 = call i32 @kyber_poly_cbd_sample(ptr noundef nonnull %30, i32 noundef 2, ptr noundef %2, i8 noundef zeroext 3)
  %32 = call i32 @kyber_poly_cbd_sample(ptr noundef nonnull %9, i32 noundef 2, ptr noundef %2, i8 noundef zeroext 4)
  %33 = call i32 @kyber_poly_ntt(ptr noundef nonnull %6)
  %34 = call i32 @kyber_poly_ntt(ptr noundef nonnull %27)
  call void @kyber_poly_set_zero(ptr noundef nonnull %7)
  %35 = getelementptr inbounds i8, ptr %7, i64 512
  call void @kyber_poly_set_zero(ptr noundef nonnull %35)
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %12) #3
  %36 = call i32 @kyber_poly_ntt_mul(ptr noundef nonnull %12, ptr noundef nonnull %4, ptr noundef nonnull %6)
  call void @kyber_poly_add(ptr noundef nonnull %7, ptr noundef nonnull %7, ptr noundef nonnull %12)
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %12) #3
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %12) #3
  %37 = call i32 @kyber_poly_ntt_mul(ptr noundef nonnull %12, ptr noundef nonnull %20, ptr noundef nonnull %27)
  call void @kyber_poly_add(ptr noundef nonnull %7, ptr noundef nonnull %7, ptr noundef nonnull %12)
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %12) #3
  %38 = call i32 @kyber_poly_inv_ntt(ptr noundef nonnull %7)
  call void @kyber_poly_add(ptr noundef nonnull %7, ptr noundef nonnull %7, ptr noundef nonnull %8)
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %12) #3
  %39 = call i32 @kyber_poly_ntt_mul(ptr noundef nonnull %12, ptr noundef nonnull %22, ptr noundef nonnull %6)
  call void @kyber_poly_add(ptr noundef nonnull %35, ptr noundef nonnull %35, ptr noundef nonnull %12)
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %12) #3
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %12) #3
  %40 = call i32 @kyber_poly_ntt_mul(ptr noundef nonnull %12, ptr noundef nonnull %24, ptr noundef nonnull %27)
  call void @kyber_poly_add(ptr noundef nonnull %35, ptr noundef nonnull %35, ptr noundef nonnull %12)
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %12) #3
  %41 = call i32 @kyber_poly_inv_ntt(ptr noundef nonnull %35)
  call void @kyber_poly_add(ptr noundef nonnull %35, ptr noundef nonnull %35, ptr noundef nonnull %30)
  call void @kyber_poly_set_zero(ptr noundef nonnull %10)
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %13) #3
  %42 = call i32 @kyber_poly_ntt_mul(ptr noundef nonnull %13, ptr noundef nonnull %5, ptr noundef nonnull %6)
  call void @kyber_poly_add(ptr noundef nonnull %10, ptr noundef nonnull %10, ptr noundef nonnull %13)
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %13) #3
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %13) #3
  %43 = call i32 @kyber_poly_ntt_mul(ptr noundef nonnull %13, ptr noundef nonnull %15, ptr noundef nonnull %27)
  call void @kyber_poly_add(ptr noundef nonnull %10, ptr noundef nonnull %10, ptr noundef nonnull %13)
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %13) #3
  %44 = call i32 @kyber_poly_inv_ntt(ptr noundef nonnull %10)
  call void @kyber_poly_add(ptr noundef nonnull %10, ptr noundef nonnull %10, ptr noundef nonnull %9)
  call void @kyber_poly_decode1(ptr noundef nonnull %11, ptr noundef %1)
  %45 = call i32 @kyber_poly_decompress(ptr noundef nonnull %11, i32 noundef 1, ptr noundef nonnull %11)
  call void @kyber_poly_add(ptr noundef nonnull %10, ptr noundef nonnull %10, ptr noundef nonnull %11)
  %46 = call i32 @kyber_poly_compress(ptr noundef nonnull %7, i32 noundef 10, ptr noundef nonnull %7)
  %47 = call i32 @kyber_poly_encode10(ptr noundef nonnull %7, ptr noundef %3)
  %48 = call i32 @kyber_poly_compress(ptr noundef nonnull %35, i32 noundef 10, ptr noundef nonnull %35)
  %49 = getelementptr inbounds i8, ptr %3, i64 320
  %50 = call i32 @kyber_poly_encode10(ptr noundef nonnull %35, ptr noundef nonnull %49)
  %51 = call i32 @kyber_poly_compress(ptr noundef nonnull %10, i32 noundef 4, ptr noundef nonnull %10)
  %52 = getelementptr inbounds i8, ptr %3, i64 640
  %53 = call i32 @kyber_poly_encode4(ptr noundef nonnull %10, ptr noundef nonnull %52)
  call void @gmssl_secure_clear(ptr noundef nonnull %11, i64 noundef 512) #3
  call void @gmssl_secure_clear(ptr noundef nonnull %6, i64 noundef 1024) #3
  call void @gmssl_secure_clear(ptr noundef nonnull %8, i64 noundef 1024) #3
  call void @gmssl_secure_clear(ptr noundef nonnull %9, i64 noundef 512) #3
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %4) #3
  ret i32 1
}

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 = { "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 = { 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)"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass