; LLVM IR from PRiME-project/PRiMEStereoMatch :: src/oclUtil.ll (Z16openCLdevicepollv)

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

@.str = external hidden unnamed_addr constant [31 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z16openCLdevicepollv() #0 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  store ptr null, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %17 = call i32 @clGetPlatformIDs(i32 noundef 0, ptr noundef null, ptr noundef %4)
  %18 = load i32, ptr %4, align 4, !tbaa !9
  %19 = icmp ne i32 %18, 0
  br i1 %19, label %22, label %20

20:                                               ; preds = %0
  %21 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %13, align 4
  br label %259

22:                                               ; preds = %0
  %23 = load i32, ptr %4, align 4, !tbaa !9
  %24 = zext i32 %23 to i64
  %25 = mul i64 8, %24
  %26 = call noalias ptr @malloc(i64 noundef %25) #6
  store ptr %26, ptr %5, align 8, !tbaa !5
  %27 = load i32, ptr %4, align 4, !tbaa !9
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = call i32 @clGetPlatformIDs(i32 noundef %27, ptr noundef %28, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %252, %22
  %31 = load i32, ptr %14, align 4, !tbaa !9
  %32 = load i32, ptr %4, align 4, !tbaa !9
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  store i32 2, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %255

35:                                               ; preds = %30
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = load i32, ptr %14, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds ptr, ptr %36, i64 %38
  %40 = load ptr, ptr %39, align 8, !tbaa !5
  %41 = call i32 @clGetDeviceIDs(ptr noundef %40, i64 noundef 4294967295, i32 noundef 0, ptr noundef null, ptr noundef %6)
  %42 = load i32, ptr %6, align 4, !tbaa !9
  %43 = zext i32 %42 to i64
  %44 = mul i64 8, %43
  %45 = call noalias ptr @malloc(i64 noundef %44) #6
  store ptr %45, ptr %7, align 8, !tbaa !5
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = load i32, ptr %14, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds ptr, ptr %46, i64 %48
  %50 = load ptr, ptr %49, align 8, !tbaa !5
  %51 = load i32, ptr %6, align 4, !tbaa !9
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = call i32 @clGetDeviceIDs(ptr noundef %50, i64 noundef 4294967295, i32 noundef %51, ptr noundef %52, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %54

54:                                               ; preds = %247, %35
  %55 = load i32, ptr %15, align 4, !tbaa !9
  %56 = load i32, ptr %6, align 4, !tbaa !9
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %54
  store i32 5, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %250

59:                                               ; preds = %54
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = load i32, ptr %15, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds ptr, ptr %60, i64 %62
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = call i32 @clGetDeviceInfo(ptr noundef %64, i32 noundef 4139, i64 noundef 0, ptr noundef null, ptr noundef %3)
  %66 = load i64, ptr %3, align 8, !tbaa !11
  %67 = call noalias ptr @malloc(i64 noundef %66) #6
  store ptr %67, ptr %2, align 8, !tbaa !5
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  %69 = load i32, ptr %15, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds ptr, ptr %68, i64 %70
  %72 = load ptr, ptr %71, align 8, !tbaa !5
  %73 = load i64, ptr %3, align 8, !tbaa !11
  %74 = load ptr, ptr %2, align 8, !tbaa !5
  %75 = call i32 @clGetDeviceInfo(ptr noundef %72, i32 noundef 4139, i64 noundef %73, ptr noundef %74, ptr noundef null)
  %76 = load i32, ptr %15, align 4, !tbaa !9
  %77 = add nsw i32 %76, 1
  %78 = load ptr, ptr %2, align 8, !tbaa !5
  %79 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %77, ptr noundef %78)
  %80 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %80) #5
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = load i32, ptr %15, align 4, !tbaa !9
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds ptr, ptr %81, i64 %83
  %85 = load ptr, ptr %84, align 8, !tbaa !5
  %86 = call i32 @clGetDeviceInfo(ptr noundef %85, i32 noundef 4096, i64 noundef 0, ptr noundef null, ptr noundef %3)
  %87 = load i64, ptr %3, align 8, !tbaa !11
  %88 = call noalias ptr @malloc(i64 noundef %87) #6
  store ptr %88, ptr %2, align 8, !tbaa !5
  %89 = load ptr, ptr %7, align 8, !tbaa !5
  %90 = load i32, ptr %15, align 4, !tbaa !9
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds ptr, ptr %89, i64 %91
  %93 = load ptr, ptr %92, align 8, !tbaa !5
  %94 = load i64, ptr %3, align 8, !tbaa !11
  %95 = load ptr, ptr %2, align 8, !tbaa !5
  %96 = call i32 @clGetDeviceInfo(ptr noundef %93, i32 noundef 4096, i64 noundef %94, ptr noundef %95, ptr noundef null)
  %97 = load ptr, ptr %2, align 8, !tbaa !5
  %98 = load i8, ptr %97, align 1, !tbaa !13
  %99 = sext i8 %98 to i32
  %100 = icmp eq i32 %99, 2
  br i1 %100, label %101, label %105

101:                                              ; preds = %59
  %102 = load i32, ptr %15, align 4, !tbaa !9
  %103 = add nsw i32 %102, 1
  %104 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %103, i32 noundef 0, ptr noundef @.str.4)
  br label %129

105:                                              ; preds = %59
  %106 = load ptr, ptr %2, align 8, !tbaa !5
  %107 = load i8, ptr %106, align 1, !tbaa !13
  %108 = sext i8 %107 to i32
  %109 = icmp eq i32 %108, 4
  br i1 %109, label %110, label %114

110:                                              ; preds = %105
  %111 = load i32, ptr %15, align 4, !tbaa !9
  %112 = add nsw i32 %111, 1
  %113 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %112, i32 noundef 0, ptr noundef @.str.5)
  br label %128

114:                                              ; preds = %105
  %115 = load ptr, ptr %2, align 8, !tbaa !5
  %116 = load i8, ptr %115, align 1, !tbaa !13
  %117 = sext i8 %116 to i32
  %118 = icmp eq i32 %117, 8
  br i1 %118, label %119, label %123

119:                                              ; preds = %114
  %120 = load i32, ptr %15, align 4, !tbaa !9
  %121 = add nsw i32 %120, 1
  %122 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %121, i32 noundef 0, ptr noundef @.str.6)
  br label %127

123:                                              ; preds = %114
  %124 = load i32, ptr %15, align 4, !tbaa !9
  %125 = add nsw i32 %124, 1
  %126 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %125, i32 noundef 0, ptr noundef @.str.7)
  br label %127

127:                                              ; preds = %123, %119
  br label %128

128:                                              ; preds = %127, %110
  br label %129

129:                                              ; preds = %128, %101
  %130 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %130) #5
  %131 = load ptr, ptr %7, align 8, !tbaa !5
  %132 = load i32, ptr %15, align 4, !tbaa !9
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds ptr, ptr %131, i64 %133
  %135 = load ptr, ptr %134, align 8, !tbaa !5
  %136 = call i32 @clGetDeviceInfo(ptr noundef %135, i32 noundef 4143, i64 noundef 0, ptr noundef null, ptr noundef %3)
  %137 = load i64, ptr %3, align 8, !tbaa !11
  %138 = call noalias ptr @malloc(i64 noundef %137) #6
  store ptr %138, ptr %2, align 8, !tbaa !5
  %139 = load ptr, ptr %7, align 8, !tbaa !5
  %140 = load i32, ptr %15, align 4, !tbaa !9
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds ptr, ptr %139, i64 %141
  %143 = load ptr, ptr %142, align 8, !tbaa !5
  %144 = load i64, ptr %3, align 8, !tbaa !11
  %145 = load ptr, ptr %2, align 8, !tbaa !5
  %146 = call i32 @clGetDeviceInfo(ptr noundef %143, i32 noundef 4143, i64 noundef %144, ptr noundef %145, ptr noundef null)
  %147 = load i32, ptr %15, align 4, !tbaa !9
  %148 = add nsw i32 %147, 1
  %149 = load ptr, ptr %2, align 8, !tbaa !5
  %150 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, i32 noundef %148, i32 noundef 1, ptr noundef %149)
  %151 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %151) #5
  %152 = load ptr, ptr %7, align 8, !tbaa !5
  %153 = load i32, ptr %15, align 4, !tbaa !9
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds ptr, ptr %152, i64 %154
  %156 = load ptr, ptr %155, align 8, !tbaa !5
  %157 = call i32 @clGetDeviceInfo(ptr noundef %156, i32 noundef 4141, i64 noundef 0, ptr noundef null, ptr noundef %3)
  %158 = load i64, ptr %3, align 8, !tbaa !11
  %159 = call noalias ptr @malloc(i64 noundef %158) #6
  store ptr %159, ptr %2, align 8, !tbaa !5
  %160 = load ptr, ptr %7, align 8, !tbaa !5
  %161 = load i32, ptr %15, align 4, !tbaa !9
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds ptr, ptr %160, i64 %162
  %164 = load ptr, ptr %163, align 8, !tbaa !5
  %165 = load i64, ptr %3, align 8, !tbaa !11
  %166 = load ptr, ptr %2, align 8, !tbaa !5
  %167 = call i32 @clGetDeviceInfo(ptr noundef %164, i32 noundef 4141, i64 noundef %165, ptr noundef %166, ptr noundef null)
  %168 = load i32, ptr %15, align 4, !tbaa !9
  %169 = add nsw i32 %168, 1
  %170 = load ptr, ptr %2, align 8, !tbaa !5
  %171 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, i32 noundef %169, i32 noundef 2, ptr noundef %170)
  %172 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %172) #5
  %173 = load ptr, ptr %7, align 8, !tbaa !5
  %174 = load i32, ptr %15, align 4, !tbaa !9
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds ptr, ptr %173, i64 %175
  %177 = load ptr, ptr %176, align 8, !tbaa !5
  %178 = call i32 @clGetDeviceInfo(ptr noundef %177, i32 noundef 4157, i64 noundef 0, ptr noundef null, ptr noundef %3)
  %179 = load i64, ptr %3, align 8, !tbaa !11
  %180 = call noalias ptr @malloc(i64 noundef %179) #6
  store ptr %180, ptr %2, align 8, !tbaa !5
  %181 = load ptr, ptr %7, align 8, !tbaa !5
  %182 = load i32, ptr %15, align 4, !tbaa !9
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds ptr, ptr %181, i64 %183
  %185 = load ptr, ptr %184, align 8, !tbaa !5
  %186 = load i64, ptr %3, align 8, !tbaa !11
  %187 = load ptr, ptr %2, align 8, !tbaa !5
  %188 = call i32 @clGetDeviceInfo(ptr noundef %185, i32 noundef 4157, i64 noundef %186, ptr noundef %187, ptr noundef null)
  %189 = load i32, ptr %15, align 4, !tbaa !9
  %190 = add nsw i32 %189, 1
  %191 = load ptr, ptr %2, align 8, !tbaa !5
  %192 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, i32 noundef %190, i32 noundef 3, ptr noundef %191)
  %193 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %193) #5
  %194 = load ptr, ptr %7, align 8, !tbaa !5
  %195 = load i32, ptr %15, align 4, !tbaa !9
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds ptr, ptr %194, i64 %196
  %198 = load ptr, ptr %197, align 8, !tbaa !5
  %199 = call i32 @clGetDeviceInfo(ptr noundef %198, i32 noundef 4098, i64 noundef 4, ptr noundef %8, ptr noundef null)
  %200 = load i32, ptr %15, align 4, !tbaa !9
  %201 = add nsw i32 %200, 1
  %202 = load i32, ptr %8, align 4, !tbaa !9
  %203 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, i32 noundef %201, i32 noundef 4, i32 noundef %202)
  %204 = load ptr, ptr %7, align 8, !tbaa !5
  %205 = load i32, ptr %15, align 4, !tbaa !9
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds ptr, ptr %204, i64 %206
  %208 = load ptr, ptr %207, align 8, !tbaa !5
  %209 = call i32 @clGetDeviceInfo(ptr noundef %208, i32 noundef 4100, i64 noundef 4, ptr noundef %9, ptr noundef null)
  %210 = load i32, ptr %15, align 4, !tbaa !9
  %211 = add nsw i32 %210, 1
  %212 = load i32, ptr %9, align 4, !tbaa !9
  %213 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, i32 noundef %211, i32 noundef 5, i32 noundef %212)
  %214 = load ptr, ptr %7, align 8, !tbaa !5
  %215 = load i32, ptr %15, align 4, !tbaa !9
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds ptr, ptr %214, i64 %216
  %218 = load ptr, ptr %217, align 8, !tbaa !5
  %219 = call i32 @clGetDeviceInfo(ptr noundef %218, i32 noundef 4099, i64 noundef 4, ptr noundef %10, ptr noundef null)
  %220 = load i32, ptr %15, align 4, !tbaa !9
  %221 = add nsw i32 %220, 1
  %222 = load i32, ptr %10, align 4, !tbaa !9
  %223 = call i32 (ptr, ...) @printf(ptr noundef @.str.13, i32 noundef %221, i32 noundef 6, i32 noundef %222)
  %224 = load ptr, ptr %7, align 8, !tbaa !5
  %225 = load i32, ptr %15, align 4, !tbaa !9
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds ptr, ptr %224, i64 %226
  %228 = load ptr, ptr %227, align 8, !tbaa !5
  %229 = call i32 @clGetDeviceInfo(ptr noundef %228, i32 noundef 4127, i64 noundef 8, ptr noundef %11, ptr noundef null)
  %230 = load i32, ptr %15, align 4, !tbaa !9
  %231 = add nsw i32 %230, 1
  %232 = load i64, ptr %11, align 8, !tbaa !14
  %233 = call i32 (ptr, ...) @printf(ptr noundef @.str.14, i32 noundef %231, i32 noundef 7, i64 noundef %232)
  %234 = load ptr, ptr %7, align 8, !tbaa !5
  %235 = load i32, ptr %15, align 4, !tbaa !9
  %236 = sext i32 %235 to i64
  %237 = getelementptr inbounds ptr, ptr %234, i64 %236
  %238 = load ptr, ptr %237, align 8, !tbaa !5
  %239 = call i32 @clGetDeviceInfo(ptr noundef %238, i32 noundef 4118, i64 noundef 4, ptr noundef %12, ptr noundef null)
  %240 = load i32, ptr %15, align 4, !tbaa !9
  %241 = add nsw i32 %240, 1
  %242 = load i32, ptr %12, align 4, !tbaa !9
  %243 = icmp ne i32 %242, 0
  %244 = zext i1 %243 to i64
  %245 = select i1 %243, ptr @.str.16, ptr @.str.17
  %246 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, i32 noundef %241, i32 noundef 8, ptr noundef %245)
  br label %247

247:                                              ; preds = %129
  %248 = load i32, ptr %15, align 4, !tbaa !9
  %249 = add nsw i32 %248, 1
  store i32 %249, ptr %15, align 4, !tbaa !9
  br label %54, !llvm.loop !16

250:                                              ; preds = %58
  %251 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %251) #5
  br label %252

252:                                              ; preds = %250
  %253 = load i32, ptr %14, align 4, !tbaa !9
  %254 = add nsw i32 %253, 1
  store i32 %254, ptr %14, align 4, !tbaa !9
  br label %30, !llvm.loop !18

255:                                              ; preds = %34
  %256 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %256) #5
  %257 = call i32 (ptr, ...) @printf(ptr noundef @.str.18)
  %258 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %258, ptr %1, align 4
  store i32 1, ptr %13, align 4
  br label %259

259:                                              ; preds = %255, %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  %260 = load i32, ptr %1, align 4
  ret i32 %260
}

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

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

declare i32 @clGetPlatformIDs(i32 noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

declare i32 @clGetDeviceIDs(ptr noundef, i64 noundef, i32 noundef, ptr noundef, ptr noundef) #1

declare i32 @clGetDeviceInfo(ptr noundef, i32 noundef, i64 noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

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

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

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


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

@.str = external hidden unnamed_addr constant [31 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [2 x i8], align 1
@switch.table._Z16openCLdevicepollv = private unnamed_addr constant [7 x ptr] [ptr @.str.4, ptr @.str.7, ptr @.str.5, ptr @.str.7, ptr @.str.7, ptr @.str.7, ptr @.str.6], align 8

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z16openCLdevicepollv() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  %10 = call i32 @clGetPlatformIDs(i32 noundef 0, ptr noundef null, ptr noundef nonnull %2)
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %.not = icmp eq i32 %11, 0
  br i1 %.not, label %12, label %14

12:                                               ; preds = %0
  %13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %102

14:                                               ; preds = %0
  %15 = zext i32 %11 to i64
  %16 = shl nuw nsw i64 %15, 3
  %17 = call noalias ptr @malloc(i64 noundef %16) #7
  %18 = call i32 @clGetPlatformIDs(i32 noundef %11, ptr noundef %17, ptr noundef null)
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph80, label %._crit_edge81

._crit_edge81:                                    ; preds = %._crit_edge, %14
  call void @free(ptr noundef %17) #6
  %21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18)
  %22 = load i32, ptr %3, align 4, !tbaa !5
  br label %102

.lr.ph80:                                         ; preds = %14, %._crit_edge
  %indvars.iv83 = phi i64 [ %indvars.iv.next84, %._crit_edge ], [ 0, %14 ]
  %23 = getelementptr inbounds ptr, ptr %17, i64 %indvars.iv83
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = call i32 @clGetDeviceIDs(ptr noundef %24, i64 noundef 4294967295, i32 noundef 0, ptr noundef null, ptr noundef nonnull %3)
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = zext i32 %26 to i64
  %28 = shl nuw nsw i64 %27, 3
  %29 = call noalias ptr @malloc(i64 noundef %28) #7
  %30 = load ptr, ptr %23, align 8, !tbaa !9
  %31 = call i32 @clGetDeviceIDs(ptr noundef %30, i64 noundef 4294967295, i32 noundef %26, ptr noundef %29, ptr noundef null)
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = icmp sgt i32 %32, 0
  br i1 %33, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %55, %.lr.ph80
  call void @free(ptr noundef %29) #6
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = icmp slt i64 %indvars.iv.next84, %35
  br i1 %36, label %.lr.ph80, label %._crit_edge81, !llvm.loop !11

.lr.ph:                                           ; preds = %.lr.ph80, %55
  %indvars.iv = phi i64 [ %indvars.iv.next, %55 ], [ 0, %.lr.ph80 ]
  %37 = getelementptr inbounds ptr, ptr %29, i64 %indvars.iv
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  %39 = call i32 @clGetDeviceInfo(ptr noundef %38, i32 noundef 4139, i64 noundef 0, ptr noundef null, ptr noundef nonnull %1)
  %40 = load i64, ptr %1, align 8, !tbaa !13
  %41 = call noalias ptr @malloc(i64 noundef %40) #7
  %42 = load ptr, ptr %37, align 8, !tbaa !9
  %43 = call i32 @clGetDeviceInfo(ptr noundef %42, i32 noundef 4139, i64 noundef %40, ptr noundef %41, ptr noundef null)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %44 = trunc nuw nsw i64 %indvars.iv.next to i32
  %45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %44, ptr noundef %41)
  call void @free(ptr noundef %41) #6
  %46 = load ptr, ptr %37, align 8, !tbaa !9
  %47 = call i32 @clGetDeviceInfo(ptr noundef %46, i32 noundef 4096, i64 noundef 0, ptr noundef null, ptr noundef nonnull %1)
  %48 = load i64, ptr %1, align 8, !tbaa !13
  %49 = call noalias ptr @malloc(i64 noundef %48) #7
  %50 = load ptr, ptr %37, align 8, !tbaa !9
  %51 = call i32 @clGetDeviceInfo(ptr noundef %50, i32 noundef 4096, i64 noundef %48, ptr noundef %49, ptr noundef null)
  %52 = load i8, ptr %49, align 1, !tbaa !15
  %switch.tableidx = add i8 %52, -2
  %53 = icmp ult i8 %switch.tableidx, 7
  br i1 %53, label %switch.lookup, label %55

switch.lookup:                                    ; preds = %.lr.ph
  %54 = zext nneg i8 %switch.tableidx to i64
  %switch.gep = getelementptr inbounds [7 x ptr], ptr @switch.table._Z16openCLdevicepollv, i64 0, i64 %54
  %switch.load = load ptr, ptr %switch.gep, align 8
  br label %55

55:                                               ; preds = %.lr.ph, %switch.lookup
  %.str.5.sink = phi ptr [ %switch.load, %switch.lookup ], [ @.str.7, %.lr.ph ]
  %56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %44, i32 noundef 0, ptr noundef nonnull %.str.5.sink)
  call void @free(ptr noundef nonnull %49) #6
  %57 = load ptr, ptr %37, align 8, !tbaa !9
  %58 = call i32 @clGetDeviceInfo(ptr noundef %57, i32 noundef 4143, i64 noundef 0, ptr noundef null, ptr noundef nonnull %1)
  %59 = load i64, ptr %1, align 8, !tbaa !13
  %60 = call noalias ptr @malloc(i64 noundef %59) #7
  %61 = load ptr, ptr %37, align 8, !tbaa !9
  %62 = call i32 @clGetDeviceInfo(ptr noundef %61, i32 noundef 4143, i64 noundef %59, ptr noundef %60, ptr noundef null)
  %63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %44, i32 noundef 1, ptr noundef %60)
  call void @free(ptr noundef %60) #6
  %64 = load ptr, ptr %37, align 8, !tbaa !9
  %65 = call i32 @clGetDeviceInfo(ptr noundef %64, i32 noundef 4141, i64 noundef 0, ptr noundef null, ptr noundef nonnull %1)
  %66 = load i64, ptr %1, align 8, !tbaa !13
  %67 = call noalias ptr @malloc(i64 noundef %66) #7
  %68 = load ptr, ptr %37, align 8, !tbaa !9
  %69 = call i32 @clGetDeviceInfo(ptr noundef %68, i32 noundef 4141, i64 noundef %66, ptr noundef %67, ptr noundef null)
  %70 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, i32 noundef %44, i32 noundef 2, ptr noundef %67)
  call void @free(ptr noundef %67) #6
  %71 = load ptr, ptr %37, align 8, !tbaa !9
  %72 = call i32 @clGetDeviceInfo(ptr noundef %71, i32 noundef 4157, i64 noundef 0, ptr noundef null, ptr noundef nonnull %1)
  %73 = load i64, ptr %1, align 8, !tbaa !13
  %74 = call noalias ptr @malloc(i64 noundef %73) #7
  %75 = load ptr, ptr %37, align 8, !tbaa !9
  %76 = call i32 @clGetDeviceInfo(ptr noundef %75, i32 noundef 4157, i64 noundef %73, ptr noundef %74, ptr noundef null)
  %77 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, i32 noundef %44, i32 noundef 3, ptr noundef %74)
  call void @free(ptr noundef %74) #6
  %78 = load ptr, ptr %37, align 8, !tbaa !9
  %79 = call i32 @clGetDeviceInfo(ptr noundef %78, i32 noundef 4098, i64 noundef 4, ptr noundef nonnull %4, ptr noundef null)
  %80 = load i32, ptr %4, align 4, !tbaa !5
  %81 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, i32 noundef %44, i32 noundef 4, i32 noundef %80)
  %82 = load ptr, ptr %37, align 8, !tbaa !9
  %83 = call i32 @clGetDeviceInfo(ptr noundef %82, i32 noundef 4100, i64 noundef 4, ptr noundef nonnull %5, ptr noundef null)
  %84 = load i32, ptr %5, align 4, !tbaa !5
  %85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, i32 noundef %44, i32 noundef 5, i32 noundef %84)
  %86 = load ptr, ptr %37, align 8, !tbaa !9
  %87 = call i32 @clGetDeviceInfo(ptr noundef %86, i32 noundef 4099, i64 noundef 4, ptr noundef nonnull %6, ptr noundef null)
  %88 = load i32, ptr %6, align 4, !tbaa !5
  %89 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, i32 noundef %44, i32 noundef 6, i32 noundef %88)
  %90 = load ptr, ptr %37, align 8, !tbaa !9
  %91 = call i32 @clGetDeviceInfo(ptr noundef %90, i32 noundef 4127, i64 noundef 8, ptr noundef nonnull %7, ptr noundef null)
  %92 = load i64, ptr %7, align 8, !tbaa !16
  %93 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14, i32 noundef %44, i32 noundef 7, i64 noundef %92)
  %94 = load ptr, ptr %37, align 8, !tbaa !9
  %95 = call i32 @clGetDeviceInfo(ptr noundef %94, i32 noundef 4118, i64 noundef 4, ptr noundef nonnull %8, ptr noundef null)
  %96 = load i32, ptr %8, align 4, !tbaa !5
  %.not76 = icmp eq i32 %96, 0
  %97 = select i1 %.not76, ptr @.str.17, ptr @.str.16
  %98 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, i32 noundef %44, i32 noundef 8, ptr noundef nonnull %97)
  %99 = load i32, ptr %3, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = icmp slt i64 %indvars.iv.next, %100
  br i1 %101, label %.lr.ph, label %._crit_edge, !llvm.loop !18

102:                                              ; preds = %._crit_edge81, %12
  %.073 = phi i32 [ %22, %._crit_edge81 ], [ 0, %12 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret i32 %.073
}

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

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

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4

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

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5

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

attributes #0 = { mustprogress 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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

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

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


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