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

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

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [60 x i8], align 1
@__FUNCTION__.sm4_cl_ctr32_encrypt_blocks = external hidden unnamed_addr constant [28 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1

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

29:                                               ; preds = %5
  br label %30

30:                                               ; preds = %29
  %31 = load ptr, ptr @stderr, align 8, !tbaa !5
  %32 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 259, ptr noundef @__FUNCTION__.sm4_cl_ctr32_encrypt_blocks) #5
  br label %33

33:                                               ; preds = %30
  br label %34

34:                                               ; preds = %33
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %21, align 4
  br label %287

35:                                               ; preds = %5
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %36, i64 0
  %38 = load i8, ptr %37, align 1, !tbaa !13
  %39 = zext i8 %38 to i32
  %40 = shl i32 %39, 24
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %41, i64 1
  %43 = load i8, ptr %42, align 1, !tbaa !13
  %44 = zext i8 %43 to i32
  %45 = shl i32 %44, 16
  %46 = or i32 %40, %45
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %47, i64 2
  %49 = load i8, ptr %48, align 1, !tbaa !13
  %50 = zext i8 %49 to i32
  %51 = shl i32 %50, 8
  %52 = or i32 %46, %51
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = getelementptr inbounds i8, ptr %53, i64 3
  %55 = load i8, ptr %54, align 1, !tbaa !13
  %56 = zext i8 %55 to i32
  %57 = or i32 %52, %56
  %58 = getelementptr inbounds [4 x i32], ptr %14, i64 0, i64 0
  store i32 %57, ptr %58, align 16, !tbaa !11
  %59 = load ptr, ptr %8, align 8, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %59, i64 4
  %61 = getelementptr inbounds i8, ptr %60, i64 0
  %62 = load i8, ptr %61, align 1, !tbaa !13
  %63 = zext i8 %62 to i32
  %64 = shl i32 %63, 24
  %65 = load ptr, ptr %8, align 8, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %65, i64 4
  %67 = getelementptr inbounds i8, ptr %66, i64 1
  %68 = load i8, ptr %67, align 1, !tbaa !13
  %69 = zext i8 %68 to i32
  %70 = shl i32 %69, 16
  %71 = or i32 %64, %70
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = getelementptr inbounds i8, ptr %72, i64 4
  %74 = getelementptr inbounds i8, ptr %73, i64 2
  %75 = load i8, ptr %74, align 1, !tbaa !13
  %76 = zext i8 %75 to i32
  %77 = shl i32 %76, 8
  %78 = or i32 %71, %77
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %79, i64 4
  %81 = getelementptr inbounds i8, ptr %80, i64 3
  %82 = load i8, ptr %81, align 1, !tbaa !13
  %83 = zext i8 %82 to i32
  %84 = or i32 %78, %83
  %85 = getelementptr inbounds [4 x i32], ptr %14, i64 0, i64 1
  store i32 %84, ptr %85, align 4, !tbaa !11
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  %87 = getelementptr inbounds i8, ptr %86, i64 8
  %88 = getelementptr inbounds i8, ptr %87, i64 0
  %89 = load i8, ptr %88, align 1, !tbaa !13
  %90 = zext i8 %89 to i32
  %91 = shl i32 %90, 24
  %92 = load ptr, ptr %8, align 8, !tbaa !5
  %93 = getelementptr inbounds i8, ptr %92, i64 8
  %94 = getelementptr inbounds i8, ptr %93, i64 1
  %95 = load i8, ptr %94, align 1, !tbaa !13
  %96 = zext i8 %95 to i32
  %97 = shl i32 %96, 16
  %98 = or i32 %91, %97
  %99 = load ptr, ptr %8, align 8, !tbaa !5
  %100 = getelementptr inbounds i8, ptr %99, i64 8
  %101 = getelementptr inbounds i8, ptr %100, i64 2
  %102 = load i8, ptr %101, align 1, !tbaa !13
  %103 = zext i8 %102 to i32
  %104 = shl i32 %103, 8
  %105 = or i32 %98, %104
  %106 = load ptr, ptr %8, align 8, !tbaa !5
  %107 = getelementptr inbounds i8, ptr %106, i64 8
  %108 = getelementptr inbounds i8, ptr %107, i64 3
  %109 = load i8, ptr %108, align 1, !tbaa !13
  %110 = zext i8 %109 to i32
  %111 = or i32 %105, %110
  %112 = getelementptr inbounds [4 x i32], ptr %14, i64 0, i64 2
  store i32 %111, ptr %112, align 8, !tbaa !11
  %113 = load ptr, ptr %8, align 8, !tbaa !5
  %114 = getelementptr inbounds i8, ptr %113, i64 12
  %115 = getelementptr inbounds i8, ptr %114, i64 0
  %116 = load i8, ptr %115, align 1, !tbaa !13
  %117 = zext i8 %116 to i32
  %118 = shl i32 %117, 24
  %119 = load ptr, ptr %8, align 8, !tbaa !5
  %120 = getelementptr inbounds i8, ptr %119, i64 12
  %121 = getelementptr inbounds i8, ptr %120, i64 1
  %122 = load i8, ptr %121, align 1, !tbaa !13
  %123 = zext i8 %122 to i32
  %124 = shl i32 %123, 16
  %125 = or i32 %118, %124
  %126 = load ptr, ptr %8, align 8, !tbaa !5
  %127 = getelementptr inbounds i8, ptr %126, i64 12
  %128 = getelementptr inbounds i8, ptr %127, i64 2
  %129 = load i8, ptr %128, align 1, !tbaa !13
  %130 = zext i8 %129 to i32
  %131 = shl i32 %130, 8
  %132 = or i32 %125, %131
  %133 = load ptr, ptr %8, align 8, !tbaa !5
  %134 = getelementptr inbounds i8, ptr %133, i64 12
  %135 = getelementptr inbounds i8, ptr %134, i64 3
  %136 = load i8, ptr %135, align 1, !tbaa !13
  %137 = zext i8 %136 to i32
  %138 = or i32 %132, %137
  %139 = getelementptr inbounds [4 x i32], ptr %14, i64 0, i64 3
  store i32 %138, ptr %139, align 4, !tbaa !11
  %140 = load ptr, ptr %7, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.SM4_CL_CTX, ptr %140, i32 0, i32 1
  %142 = load ptr, ptr %141, align 8, !tbaa !14
  %143 = getelementptr inbounds [4 x i32], ptr %14, i64 0, i64 0
  %144 = call ptr @clCreateBuffer(ptr noundef %142, i64 noundef 12, i64 noundef 16, ptr noundef %143, ptr noundef %13)
  store ptr %144, ptr %15, align 8, !tbaa !5
  %145 = icmp ne ptr %144, null
  br i1 %145, label %154, label %146

146:                                              ; preds = %35
  br label %147

147:                                              ; preds = %146
  %148 = load ptr, ptr @stderr, align 8, !tbaa !5
  %149 = load i32, ptr %13, align 4, !tbaa !11
  %150 = call ptr @clErrorString(i32 noundef %149)
  %151 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %148, ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 269, ptr noundef %150) #5
  br label %152

152:                                              ; preds = %147
  br label %153

153:                                              ; preds = %152
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %21, align 4
  br label %287

154:                                              ; preds = %35
  %155 = load ptr, ptr %7, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.SM4_CL_CTX, ptr %155, i32 0, i32 4
  %157 = load ptr, ptr %156, align 8, !tbaa !16
  %158 = call i32 @clSetKernelArg(ptr noundef %157, i32 noundef 1, i64 noundef 8, ptr noundef %15)
  store i32 %158, ptr %13, align 4, !tbaa !11
  %159 = icmp ne i32 %158, 0
  br i1 %159, label %160, label %168

160:                                              ; preds = %154
  br label %161

161:                                              ; preds = %160
  %162 = load ptr, ptr @stderr, align 8, !tbaa !5
  %163 = load i32, ptr %13, align 4, !tbaa !11
  %164 = call ptr @clErrorString(i32 noundef %163)
  %165 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %162, ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 273, ptr noundef %164) #5
  br label %166

166:                                              ; preds = %161
  br label %167

167:                                              ; preds = %166
  br label %273

168:                                              ; preds = %154
  %169 = load ptr, ptr %11, align 8, !tbaa !5
  %170 = load ptr, ptr %9, align 8, !tbaa !5
  %171 = icmp ne ptr %169, %170
  br i1 %171, label %172, label %176

172:                                              ; preds = %168
  %173 = load ptr, ptr %11, align 8, !tbaa !5
  %174 = load ptr, ptr %9, align 8, !tbaa !5
  %175 = load i64, ptr %16, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %173, ptr align 1 %174, i64 %175, i1 false)
  br label %176

176:                                              ; preds = %172, %168
  %177 = load ptr, ptr %7, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.SM4_CL_CTX, ptr %177, i32 0, i32 1
  %179 = load ptr, ptr %178, align 8, !tbaa !14
  %180 = load i64, ptr %16, align 8, !tbaa !9
  %181 = load ptr, ptr %11, align 8, !tbaa !5
  %182 = call ptr @clCreateBuffer(ptr noundef %179, i64 noundef 9, i64 noundef %180, ptr noundef %181, ptr noundef %13)
  store ptr %182, ptr %17, align 8, !tbaa !5
  %183 = icmp ne ptr %182, null
  br i1 %183, label %192, label %184

184:                                              ; preds = %176
  br label %185

185:                                              ; preds = %184
  %186 = load ptr, ptr @stderr, align 8, !tbaa !5
  %187 = load i32, ptr %13, align 4, !tbaa !11
  %188 = call ptr @clErrorString(i32 noundef %187)
  %189 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %186, ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 281, ptr noundef %188) #5
  br label %190

190:                                              ; preds = %185
  br label %191

191:                                              ; preds = %190
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %21, align 4
  br label %287

192:                                              ; preds = %176
  %193 = load ptr, ptr %7, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.SM4_CL_CTX, ptr %193, i32 0, i32 4
  %195 = load ptr, ptr %194, align 8, !tbaa !16
  %196 = call i32 @clSetKernelArg(ptr noundef %195, i32 noundef 2, i64 noundef 8, ptr noundef %17)
  store i32 %196, ptr %13, align 4, !tbaa !11
  %197 = icmp ne i32 %196, 0
  br i1 %197, label %198, label %206

198:                                              ; preds = %192
  br label %199

199:                                              ; preds = %198
  %200 = load ptr, ptr @stderr, align 8, !tbaa !5
  %201 = load i32, ptr %13, align 4, !tbaa !11
  %202 = call ptr @clErrorString(i32 noundef %201)
  %203 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %200, ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 285, ptr noundef %202) #5
  br label %204

204:                                              ; preds = %199
  br label %205

205:                                              ; preds = %204
  br label %273

206:                                              ; preds = %192
  %207 = load ptr, ptr %7, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.SM4_CL_CTX, ptr %207, i32 0, i32 2
  %209 = load ptr, ptr %208, align 8, !tbaa !17
  %210 = load ptr, ptr %7, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.SM4_CL_CTX, ptr %210, i32 0, i32 4
  %212 = load ptr, ptr %211, align 8, !tbaa !16
  %213 = load i32, ptr %18, align 4, !tbaa !11
  %214 = call i32 @clEnqueueNDRangeKernel(ptr noundef %209, ptr noundef %212, i32 noundef %213, ptr noundef null, ptr noundef %19, ptr noundef %20, i32 noundef 0, ptr noundef null, ptr noundef null)
  store i32 %214, ptr %13, align 4, !tbaa !11
  %215 = icmp ne i32 %214, 0
  br i1 %215, label %216, label %224

216:                                              ; preds = %206
  br label %217

217:                                              ; preds = %216
  %218 = load ptr, ptr @stderr, align 8, !tbaa !5
  %219 = load i32, ptr %13, align 4, !tbaa !11
  %220 = call ptr @clErrorString(i32 noundef %219)
  %221 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %218, ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 294, ptr noundef %220) #5
  br label %222

222:                                              ; preds = %217
  br label %223

223:                                              ; preds = %222
  br label %273

224:                                              ; preds = %206
  %225 = load ptr, ptr %7, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.SM4_CL_CTX, ptr %225, i32 0, i32 2
  %227 = load ptr, ptr %226, align 8, !tbaa !17
  %228 = load ptr, ptr %17, align 8, !tbaa !5
  %229 = load i64, ptr %16, align 8, !tbaa !9
  %230 = call ptr @clEnqueueMapBuffer(ptr noundef %227, ptr noundef %228, i32 noundef 1, i64 noundef 0, i64 noundef 0, i64 noundef %229, i32 noundef 0, ptr noundef null, ptr noundef null, ptr noundef %13)
  %231 = icmp ne ptr %230, null
  br i1 %231, label %240, label %232

232:                                              ; preds = %224
  br label %233

233:                                              ; preds = %232
  %234 = load ptr, ptr @stderr, align 8, !tbaa !5
  %235 = load i32, ptr %13, align 4, !tbaa !11
  %236 = call ptr @clErrorString(i32 noundef %235)
  %237 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %234, ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 298, ptr noundef %236) #5
  br label %238

238:                                              ; preds = %233
  br label %239

239:                                              ; preds = %238
  br label %273

240:                                              ; preds = %224
  %241 = load i64, ptr %10, align 8, !tbaa !9
  %242 = trunc i64 %241 to i32
  %243 = getelementptr inbounds [4 x i32], ptr %14, i64 0, i64 3
  %244 = load i32, ptr %243, align 4, !tbaa !11
  %245 = add i32 %244, %242
  store i32 %245, ptr %243, align 4, !tbaa !11
  %246 = getelementptr inbounds [4 x i32], ptr %14, i64 0, i64 3
  %247 = load i32, ptr %246, align 4, !tbaa !11
  %248 = lshr i32 %247, 24
  %249 = trunc i32 %248 to i8
  %250 = load ptr, ptr %8, align 8, !tbaa !5
  %251 = getelementptr inbounds i8, ptr %250, i64 12
  %252 = getelementptr inbounds i8, ptr %251, i64 0
  store i8 %249, ptr %252, align 1, !tbaa !13
  %253 = getelementptr inbounds [4 x i32], ptr %14, i64 0, i64 3
  %254 = load i32, ptr %253, align 4, !tbaa !11
  %255 = lshr i32 %254, 16
  %256 = trunc i32 %255 to i8
  %257 = load ptr, ptr %8, align 8, !tbaa !5
  %258 = getelementptr inbounds i8, ptr %257, i64 12
  %259 = getelementptr inbounds i8, ptr %258, i64 1
  store i8 %256, ptr %259, align 1, !tbaa !13
  %260 = getelementptr inbounds [4 x i32], ptr %14, i64 0, i64 3
  %261 = load i32, ptr %260, align 4, !tbaa !11
  %262 = lshr i32 %261, 8
  %263 = trunc i32 %262 to i8
  %264 = load ptr, ptr %8, align 8, !tbaa !5
  %265 = getelementptr inbounds i8, ptr %264, i64 12
  %266 = getelementptr inbounds i8, ptr %265, i64 2
  store i8 %263, ptr %266, align 1, !tbaa !13
  %267 = getelementptr inbounds [4 x i32], ptr %14, i64 0, i64 3
  %268 = load i32, ptr %267, align 4, !tbaa !11
  %269 = trunc i32 %268 to i8
  %270 = load ptr, ptr %8, align 8, !tbaa !5
  %271 = getelementptr inbounds i8, ptr %270, i64 12
  %272 = getelementptr inbounds i8, ptr %271, i64 3
  store i8 %269, ptr %272, align 1, !tbaa !13
  store i32 1, ptr %12, align 4, !tbaa !11
  br label %273

273:                                              ; preds = %240, %239, %223, %205, %167
  %274 = load ptr, ptr %15, align 8, !tbaa !5
  %275 = icmp ne ptr %274, null
  br i1 %275, label %276, label %279

276:                                              ; preds = %273
  %277 = load ptr, ptr %15, align 8, !tbaa !5
  %278 = call i32 @clReleaseMemObject(ptr noundef %277)
  br label %279

279:                                              ; preds = %276, %273
  %280 = load ptr, ptr %17, align 8, !tbaa !5
  %281 = icmp ne ptr %280, null
  br i1 %281, label %282, label %285

282:                                              ; preds = %279
  %283 = load ptr, ptr %17, align 8, !tbaa !5
  %284 = call i32 @clReleaseMemObject(ptr noundef %283)
  br label %285

285:                                              ; preds = %282, %279
  %286 = load i32, ptr %12, align 4, !tbaa !11
  store i32 %286, ptr %6, align 4
  store i32 1, ptr %21, align 4
  br label %287

287:                                              ; preds = %285, %191, %153, %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %288 = load i32, ptr %6, align 4
  ret i32 %288
}

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

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

declare ptr @clCreateBuffer(ptr noundef, i64 noundef, i64 noundef, ptr noundef, ptr noundef) #3

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

declare i32 @clSetKernelArg(ptr noundef, i32 noundef, i64 noundef, ptr noundef) #3

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

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

declare ptr @clEnqueueMapBuffer(ptr noundef, ptr noundef, i32 noundef, i64 noundef, i64 noundef, i64 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #3

declare i32 @clReleaseMemObject(ptr noundef) #3

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

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

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

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


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [60 x i8], align 1
@__FUNCTION__.sm4_cl_ctr32_encrypt_blocks = external hidden unnamed_addr constant [28 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 2) i32 @sm4_cl_ctr32_encrypt_blocks(ptr nocapture noundef readonly %0, ptr nocapture noundef %1, ptr noundef readonly %2, i64 noundef %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = alloca i32, align 4
  %7 = alloca [4 x i32], align 16
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  %12 = shl i64 %3, 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #5
  store ptr null, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #5
  store i64 %3, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #5
  store i64 32, ptr %11, align 8, !tbaa !9
  %13 = and i64 %3, 31
  %.not = icmp eq i64 %13, 0
  br i1 %.not, label %17, label %14

14:                                               ; preds = %5
  %15 = load ptr, ptr @stderr, align 8, !tbaa !5
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 259, ptr noundef nonnull @__FUNCTION__.sm4_cl_ctr32_encrypt_blocks) #6
  br label %162

17:                                               ; preds = %5
  %18 = load i8, ptr %1, align 1, !tbaa !11
  %19 = zext i8 %18 to i32
  %20 = shl nuw i32 %19, 24
  %21 = getelementptr inbounds i8, ptr %1, i64 1
  %22 = load i8, ptr %21, align 1, !tbaa !11
  %23 = zext i8 %22 to i32
  %24 = shl nuw nsw i32 %23, 16
  %25 = or disjoint i32 %24, %20
  %26 = getelementptr inbounds i8, ptr %1, i64 2
  %27 = load i8, ptr %26, align 1, !tbaa !11
  %28 = zext i8 %27 to i32
  %29 = shl nuw nsw i32 %28, 8
  %30 = or disjoint i32 %25, %29
  %31 = getelementptr inbounds i8, ptr %1, i64 3
  %32 = load i8, ptr %31, align 1, !tbaa !11
  %33 = zext i8 %32 to i32
  %34 = or disjoint i32 %30, %33
  store i32 %34, ptr %7, align 16, !tbaa !12
  %35 = getelementptr inbounds i8, ptr %1, i64 4
  %36 = load i8, ptr %35, align 1, !tbaa !11
  %37 = zext i8 %36 to i32
  %38 = shl nuw i32 %37, 24
  %39 = getelementptr inbounds i8, ptr %1, i64 5
  %40 = load i8, ptr %39, align 1, !tbaa !11
  %41 = zext i8 %40 to i32
  %42 = shl nuw nsw i32 %41, 16
  %43 = or disjoint i32 %42, %38
  %44 = getelementptr inbounds i8, ptr %1, i64 6
  %45 = load i8, ptr %44, align 1, !tbaa !11
  %46 = zext i8 %45 to i32
  %47 = shl nuw nsw i32 %46, 8
  %48 = or disjoint i32 %43, %47
  %49 = getelementptr inbounds i8, ptr %1, i64 7
  %50 = load i8, ptr %49, align 1, !tbaa !11
  %51 = zext i8 %50 to i32
  %52 = or disjoint i32 %48, %51
  %53 = getelementptr inbounds i8, ptr %7, i64 4
  store i32 %52, ptr %53, align 4, !tbaa !12
  %54 = getelementptr inbounds i8, ptr %1, i64 8
  %55 = load i8, ptr %54, align 1, !tbaa !11
  %56 = zext i8 %55 to i32
  %57 = shl nuw i32 %56, 24
  %58 = getelementptr inbounds i8, ptr %1, i64 9
  %59 = load i8, ptr %58, align 1, !tbaa !11
  %60 = zext i8 %59 to i32
  %61 = shl nuw nsw i32 %60, 16
  %62 = or disjoint i32 %61, %57
  %63 = getelementptr inbounds i8, ptr %1, i64 10
  %64 = load i8, ptr %63, align 1, !tbaa !11
  %65 = zext i8 %64 to i32
  %66 = shl nuw nsw i32 %65, 8
  %67 = or disjoint i32 %62, %66
  %68 = getelementptr inbounds i8, ptr %1, i64 11
  %69 = load i8, ptr %68, align 1, !tbaa !11
  %70 = zext i8 %69 to i32
  %71 = or disjoint i32 %67, %70
  %72 = getelementptr inbounds i8, ptr %7, i64 8
  store i32 %71, ptr %72, align 8, !tbaa !12
  %73 = getelementptr inbounds i8, ptr %1, i64 12
  %74 = load i8, ptr %73, align 1, !tbaa !11
  %75 = zext i8 %74 to i32
  %76 = shl nuw i32 %75, 24
  %77 = getelementptr inbounds i8, ptr %1, i64 13
  %78 = load i8, ptr %77, align 1, !tbaa !11
  %79 = zext i8 %78 to i32
  %80 = shl nuw nsw i32 %79, 16
  %81 = or disjoint i32 %80, %76
  %82 = getelementptr inbounds i8, ptr %1, i64 14
  %83 = load i8, ptr %82, align 1, !tbaa !11
  %84 = zext i8 %83 to i32
  %85 = shl nuw nsw i32 %84, 8
  %86 = or disjoint i32 %81, %85
  %87 = getelementptr inbounds i8, ptr %1, i64 15
  %88 = load i8, ptr %87, align 1, !tbaa !11
  %89 = zext i8 %88 to i32
  %90 = or disjoint i32 %86, %89
  %91 = getelementptr inbounds i8, ptr %7, i64 12
  store i32 %90, ptr %91, align 4, !tbaa !12
  %92 = getelementptr inbounds i8, ptr %0, i64 128
  %93 = load ptr, ptr %92, align 8, !tbaa !14
  %94 = call ptr @clCreateBuffer(ptr noundef %93, i64 noundef 12, i64 noundef 16, ptr noundef nonnull %7, ptr noundef nonnull %6) #5
  store ptr %94, ptr %8, align 8, !tbaa !5
  %.not48 = icmp eq ptr %94, null
  br i1 %.not48, label %95, label %100

95:                                               ; preds = %17
  %96 = load ptr, ptr @stderr, align 8, !tbaa !5
  %97 = load i32, ptr %6, align 4, !tbaa !12
  %98 = call ptr @clErrorString(i32 noundef %97)
  %99 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %96, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 269, ptr noundef %98) #6
  br label %162

100:                                              ; preds = %17
  %101 = getelementptr inbounds i8, ptr %0, i64 152
  %102 = load ptr, ptr %101, align 8, !tbaa !16
  %103 = call i32 @clSetKernelArg(ptr noundef %102, i32 noundef 1, i64 noundef 8, ptr noundef nonnull %8) #5
  store i32 %103, ptr %6, align 4, !tbaa !12
  %.not49 = icmp eq i32 %103, 0
  br i1 %.not49, label %108, label %104

104:                                              ; preds = %100
  %105 = load ptr, ptr @stderr, align 8, !tbaa !5
  %106 = call ptr @clErrorString(i32 noundef %103)
  %107 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %105, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 273, ptr noundef %106) #6
  br label %154

108:                                              ; preds = %100
  %.not50 = icmp eq ptr %4, %2
  br i1 %.not50, label %110, label %109

109:                                              ; preds = %108
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %4, ptr align 1 %2, i64 %12, i1 false)
  br label %110

110:                                              ; preds = %109, %108
  %111 = load ptr, ptr %92, align 8, !tbaa !14
  %112 = call ptr @clCreateBuffer(ptr noundef %111, i64 noundef 9, i64 noundef %12, ptr noundef %4, ptr noundef nonnull %6) #5
  store ptr %112, ptr %9, align 8, !tbaa !5
  %.not51 = icmp eq ptr %112, null
  br i1 %.not51, label %113, label %118

113:                                              ; preds = %110
  %114 = load ptr, ptr @stderr, align 8, !tbaa !5
  %115 = load i32, ptr %6, align 4, !tbaa !12
  %116 = call ptr @clErrorString(i32 noundef %115)
  %117 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %114, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 281, ptr noundef %116) #6
  br label %162

118:                                              ; preds = %110
  %119 = load ptr, ptr %101, align 8, !tbaa !16
  %120 = call i32 @clSetKernelArg(ptr noundef %119, i32 noundef 2, i64 noundef 8, ptr noundef nonnull %9) #5
  store i32 %120, ptr %6, align 4, !tbaa !12
  %.not52 = icmp eq i32 %120, 0
  br i1 %.not52, label %125, label %121

121:                                              ; preds = %118
  %122 = load ptr, ptr @stderr, align 8, !tbaa !5
  %123 = call ptr @clErrorString(i32 noundef %120)
  %124 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %122, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 285, ptr noundef %123) #6
  br label %154

125:                                              ; preds = %118
  %126 = getelementptr inbounds i8, ptr %0, i64 136
  %127 = load ptr, ptr %126, align 8, !tbaa !17
  %128 = load ptr, ptr %101, align 8, !tbaa !16
  %129 = call i32 @clEnqueueNDRangeKernel(ptr noundef %127, ptr noundef %128, i32 noundef 1, ptr noundef null, ptr noundef nonnull %10, ptr noundef nonnull %11, i32 noundef 0, ptr noundef null, ptr noundef null) #5
  store i32 %129, ptr %6, align 4, !tbaa !12
  %.not53 = icmp eq i32 %129, 0
  br i1 %.not53, label %134, label %130

130:                                              ; preds = %125
  %131 = load ptr, ptr @stderr, align 8, !tbaa !5
  %132 = call ptr @clErrorString(i32 noundef %129)
  %133 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %131, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 294, ptr noundef %132) #6
  br label %154

134:                                              ; preds = %125
  %135 = load ptr, ptr %126, align 8, !tbaa !17
  %136 = load ptr, ptr %9, align 8, !tbaa !5
  %137 = call ptr @clEnqueueMapBuffer(ptr noundef %135, ptr noundef %136, i32 noundef 1, i64 noundef 0, i64 noundef 0, i64 noundef %12, i32 noundef 0, ptr noundef null, ptr noundef null, ptr noundef nonnull %6) #5
  %.not54 = icmp eq ptr %137, null
  br i1 %.not54, label %138, label %143

138:                                              ; preds = %134
  %139 = load ptr, ptr @stderr, align 8, !tbaa !5
  %140 = load i32, ptr %6, align 4, !tbaa !12
  %141 = call ptr @clErrorString(i32 noundef %140)
  %142 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %139, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 298, ptr noundef %141) #6
  br label %154

143:                                              ; preds = %134
  %144 = trunc i64 %3 to i32
  %145 = load i32, ptr %91, align 4, !tbaa !12
  %146 = add i32 %145, %144
  store i32 %146, ptr %91, align 4, !tbaa !12
  %147 = lshr i32 %146, 24
  %148 = trunc nuw i32 %147 to i8
  store i8 %148, ptr %73, align 1, !tbaa !11
  %149 = lshr i32 %146, 16
  %150 = trunc i32 %149 to i8
  store i8 %150, ptr %77, align 1, !tbaa !11
  %151 = lshr i32 %146, 8
  %152 = trunc i32 %151 to i8
  store i8 %152, ptr %82, align 1, !tbaa !11
  %153 = trunc i32 %146 to i8
  store i8 %153, ptr %87, align 1, !tbaa !11
  br label %154

154:                                              ; preds = %143, %138, %130, %121, %104
  %.040 = phi i32 [ -1, %104 ], [ -1, %121 ], [ -1, %130 ], [ 1, %143 ], [ -1, %138 ]
  %155 = load ptr, ptr %8, align 8, !tbaa !5
  %.not55 = icmp eq ptr %155, null
  br i1 %.not55, label %158, label %156

156:                                              ; preds = %154
  %157 = call i32 @clReleaseMemObject(ptr noundef nonnull %155) #5
  br label %158

158:                                              ; preds = %156, %154
  %159 = load ptr, ptr %9, align 8, !tbaa !5
  %.not56 = icmp eq ptr %159, null
  br i1 %.not56, label %162, label %160

160:                                              ; preds = %158
  %161 = call i32 @clReleaseMemObject(ptr noundef nonnull %159) #5
  br label %162

162:                                              ; preds = %158, %160, %113, %95, %14
  %.0 = phi i32 [ -1, %14 ], [ -1, %113 ], [ -1, %95 ], [ %.040, %160 ], [ %.040, %158 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  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

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

declare ptr @clCreateBuffer(ptr noundef, i64 noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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

declare i32 @clSetKernelArg(ptr noundef, i32 noundef, i64 noundef, ptr noundef) local_unnamed_addr #3

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

declare i32 @clEnqueueNDRangeKernel(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare ptr @clEnqueueMapBuffer(ptr noundef, ptr noundef, i32 noundef, i64 noundef, i64 noundef, i64 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @clReleaseMemObject(ptr noundef) local_unnamed_addr #3

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "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 nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
attributes #6 = { cold 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 = !{!"long", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 128}
!15 = !{!"", !7, i64 0, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168}
!16 = !{!15, !6, i64 152}
!17 = !{!15, !6, i64 136}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass