; LLVM IR from steps3d/graphics-book :: Code/Libs/SOIL (SOIL)

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

@result_string_pointer = external dso_local global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [30 x i8], align 1

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

declare ptr @stbi_failure_reason() #1

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

; Function Attrs: nounwind uwtable
declare dso_local void @SOIL_free_image_data(ptr noundef) #2

; 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 ptr @SOIL_load_image_from_memory(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @query_cubemap_capability() #2

; Function Attrs: nounwind uwtable
define dso_local i32 @SOIL_load_OGL_cubemap_from_memory(ptr noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, i32 noundef %5, ptr noundef %6, i32 noundef %7, ptr noundef %8, i32 noundef %9, ptr noundef %10, i32 noundef %11, i32 noundef %12, i32 noundef %13, i32 noundef %14) #2 {
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca ptr, align 8
  %26 = alloca i32, align 4
  %27 = alloca ptr, align 8
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  %32 = alloca ptr, align 8
  %33 = alloca i32, align 4
  %34 = alloca i32, align 4
  %35 = alloca i32, align 4
  %36 = alloca i32, align 4
  %37 = alloca i32, align 4
  store ptr %0, ptr %17, align 8, !tbaa !5
  store i32 %1, ptr %18, align 4, !tbaa !9
  store ptr %2, ptr %19, align 8, !tbaa !5
  store i32 %3, ptr %20, align 4, !tbaa !9
  store ptr %4, ptr %21, align 8, !tbaa !5
  store i32 %5, ptr %22, align 4, !tbaa !9
  store ptr %6, ptr %23, align 8, !tbaa !5
  store i32 %7, ptr %24, align 4, !tbaa !9
  store ptr %8, ptr %25, align 8, !tbaa !5
  store i32 %9, ptr %26, align 4, !tbaa !9
  store ptr %10, ptr %27, align 8, !tbaa !5
  store i32 %11, ptr %28, align 4, !tbaa !9
  store i32 %12, ptr %29, align 4, !tbaa !9
  store i32 %13, ptr %30, align 4, !tbaa !9
  store i32 %14, ptr %31, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #3
  %38 = load ptr, ptr %17, align 8, !tbaa !5
  %39 = icmp eq ptr %38, null
  br i1 %39, label %55, label %40

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

43:                                               ; preds = %40
  %44 = load ptr, ptr %21, align 8, !tbaa !5
  %45 = icmp eq ptr %44, null
  br i1 %45, label %55, label %46

46:                                               ; preds = %43
  %47 = load ptr, ptr %23, align 8, !tbaa !5
  %48 = icmp eq ptr %47, null
  br i1 %48, label %55, label %49

49:                                               ; preds = %46
  %50 = load ptr, ptr %25, align 8, !tbaa !5
  %51 = icmp eq ptr %50, null
  br i1 %51, label %55, label %52

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

55:                                               ; preds = %52, %49, %46, %43, %40, %15
  store ptr @.str.4, ptr @result_string_pointer, align 8, !tbaa !5
  store i32 0, ptr %16, align 4
  store i32 1, ptr %37, align 4
  br label %232

56:                                               ; preds = %52
  %57 = call i32 @query_cubemap_capability()
  %58 = icmp ne i32 %57, 1
  br i1 %58, label %59, label %60

59:                                               ; preds = %56
  store ptr @.str.3, ptr @result_string_pointer, align 8, !tbaa !5
  store i32 0, ptr %16, align 4
  store i32 1, ptr %37, align 4
  br label %232

60:                                               ; preds = %56
  %61 = load ptr, ptr %17, align 8, !tbaa !5
  %62 = load i32, ptr %18, align 4, !tbaa !9
  %63 = load i32, ptr %29, align 4, !tbaa !9
  %64 = call ptr @SOIL_load_image_from_memory(ptr noundef %61, i32 noundef %62, ptr noundef %33, ptr noundef %34, ptr noundef %35, i32 noundef %63)
  store ptr %64, ptr %32, align 8, !tbaa !5
  %65 = load i32, ptr %29, align 4, !tbaa !9
  %66 = icmp sge i32 %65, 1
  br i1 %66, label %67, label %72

67:                                               ; preds = %60
  %68 = load i32, ptr %29, align 4, !tbaa !9
  %69 = icmp sle i32 %68, 4
  br i1 %69, label %70, label %72

70:                                               ; preds = %67
  %71 = load i32, ptr %29, align 4, !tbaa !9
  store i32 %71, ptr %35, align 4, !tbaa !9
  br label %72

72:                                               ; preds = %70, %67, %60
  %73 = load ptr, ptr %32, align 8, !tbaa !5
  %74 = icmp eq ptr null, %73
  br i1 %74, label %75, label %77

75:                                               ; preds = %72
  %76 = call ptr @stbi_failure_reason()
  store ptr %76, ptr @result_string_pointer, align 8, !tbaa !5
  store i32 0, ptr %16, align 4
  store i32 1, ptr %37, align 4
  br label %232

77:                                               ; preds = %72
  %78 = load ptr, ptr %32, align 8, !tbaa !5
  %79 = load i32, ptr %33, align 4, !tbaa !9
  %80 = load i32, ptr %34, align 4, !tbaa !9
  %81 = load i32, ptr %35, align 4, !tbaa !9
  %82 = load i32, ptr %30, align 4, !tbaa !9
  %83 = load i32, ptr %31, align 4, !tbaa !9
  %84 = call i32 @SOIL_internal_create_OGL_texture(ptr noundef %78, i32 noundef %79, i32 noundef %80, i32 noundef %81, i32 noundef %82, i32 noundef %83, i32 noundef 34067, i32 noundef 34069, i32 noundef 34076)
  store i32 %84, ptr %36, align 4, !tbaa !9
  %85 = load ptr, ptr %32, align 8, !tbaa !5
  call void @SOIL_free_image_data(ptr noundef %85)
  %86 = load i32, ptr %36, align 4, !tbaa !9
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %88, label %114

88:                                               ; preds = %77
  %89 = load ptr, ptr %19, align 8, !tbaa !5
  %90 = load i32, ptr %20, align 4, !tbaa !9
  %91 = load i32, ptr %29, align 4, !tbaa !9
  %92 = call ptr @SOIL_load_image_from_memory(ptr noundef %89, i32 noundef %90, ptr noundef %33, ptr noundef %34, ptr noundef %35, i32 noundef %91)
  store ptr %92, ptr %32, align 8, !tbaa !5
  %93 = load i32, ptr %29, align 4, !tbaa !9
  %94 = icmp sge i32 %93, 1
  br i1 %94, label %95, label %100

95:                                               ; preds = %88
  %96 = load i32, ptr %29, align 4, !tbaa !9
  %97 = icmp sle i32 %96, 4
  br i1 %97, label %98, label %100

98:                                               ; preds = %95
  %99 = load i32, ptr %29, align 4, !tbaa !9
  store i32 %99, ptr %35, align 4, !tbaa !9
  br label %100

100:                                              ; preds = %98, %95, %88
  %101 = load ptr, ptr %32, align 8, !tbaa !5
  %102 = icmp eq ptr null, %101
  br i1 %102, label %103, label %105

103:                                              ; preds = %100
  %104 = call ptr @stbi_failure_reason()
  store ptr %104, ptr @result_string_pointer, align 8, !tbaa !5
  store i32 0, ptr %16, align 4
  store i32 1, ptr %37, align 4
  br label %232

105:                                              ; preds = %100
  %106 = load ptr, ptr %32, align 8, !tbaa !5
  %107 = load i32, ptr %33, align 4, !tbaa !9
  %108 = load i32, ptr %34, align 4, !tbaa !9
  %109 = load i32, ptr %35, align 4, !tbaa !9
  %110 = load i32, ptr %36, align 4, !tbaa !9
  %111 = load i32, ptr %31, align 4, !tbaa !9
  %112 = call i32 @SOIL_internal_create_OGL_texture(ptr noundef %106, i32 noundef %107, i32 noundef %108, i32 noundef %109, i32 noundef %110, i32 noundef %111, i32 noundef 34067, i32 noundef 34070, i32 noundef 34076)
  store i32 %112, ptr %36, align 4, !tbaa !9
  %113 = load ptr, ptr %32, align 8, !tbaa !5
  call void @SOIL_free_image_data(ptr noundef %113)
  br label %114

114:                                              ; preds = %105, %77
  %115 = load i32, ptr %36, align 4, !tbaa !9
  %116 = icmp ne i32 %115, 0
  br i1 %116, label %117, label %143

117:                                              ; preds = %114
  %118 = load ptr, ptr %21, align 8, !tbaa !5
  %119 = load i32, ptr %22, align 4, !tbaa !9
  %120 = load i32, ptr %29, align 4, !tbaa !9
  %121 = call ptr @SOIL_load_image_from_memory(ptr noundef %118, i32 noundef %119, ptr noundef %33, ptr noundef %34, ptr noundef %35, i32 noundef %120)
  store ptr %121, ptr %32, align 8, !tbaa !5
  %122 = load i32, ptr %29, align 4, !tbaa !9
  %123 = icmp sge i32 %122, 1
  br i1 %123, label %124, label %129

124:                                              ; preds = %117
  %125 = load i32, ptr %29, align 4, !tbaa !9
  %126 = icmp sle i32 %125, 4
  br i1 %126, label %127, label %129

127:                                              ; preds = %124
  %128 = load i32, ptr %29, align 4, !tbaa !9
  store i32 %128, ptr %35, align 4, !tbaa !9
  br label %129

129:                                              ; preds = %127, %124, %117
  %130 = load ptr, ptr %32, align 8, !tbaa !5
  %131 = icmp eq ptr null, %130
  br i1 %131, label %132, label %134

132:                                              ; preds = %129
  %133 = call ptr @stbi_failure_reason()
  store ptr %133, ptr @result_string_pointer, align 8, !tbaa !5
  store i32 0, ptr %16, align 4
  store i32 1, ptr %37, align 4
  br label %232

134:                                              ; preds = %129
  %135 = load ptr, ptr %32, align 8, !tbaa !5
  %136 = load i32, ptr %33, align 4, !tbaa !9
  %137 = load i32, ptr %34, align 4, !tbaa !9
  %138 = load i32, ptr %35, align 4, !tbaa !9
  %139 = load i32, ptr %36, align 4, !tbaa !9
  %140 = load i32, ptr %31, align 4, !tbaa !9
  %141 = call i32 @SOIL_internal_create_OGL_texture(ptr noundef %135, i32 noundef %136, i32 noundef %137, i32 noundef %138, i32 noundef %139, i32 noundef %140, i32 noundef 34067, i32 noundef 34071, i32 noundef 34076)
  store i32 %141, ptr %36, align 4, !tbaa !9
  %142 = load ptr, ptr %32, align 8, !tbaa !5
  call void @SOIL_free_image_data(ptr noundef %142)
  br label %143

143:                                              ; preds = %134, %114
  %144 = load i32, ptr %36, align 4, !tbaa !9
  %145 = icmp ne i32 %144, 0
  br i1 %145, label %146, label %172

146:                                              ; preds = %143
  %147 = load ptr, ptr %23, align 8, !tbaa !5
  %148 = load i32, ptr %24, align 4, !tbaa !9
  %149 = load i32, ptr %29, align 4, !tbaa !9
  %150 = call ptr @SOIL_load_image_from_memory(ptr noundef %147, i32 noundef %148, ptr noundef %33, ptr noundef %34, ptr noundef %35, i32 noundef %149)
  store ptr %150, ptr %32, align 8, !tbaa !5
  %151 = load i32, ptr %29, align 4, !tbaa !9
  %152 = icmp sge i32 %151, 1
  br i1 %152, label %153, label %158

153:                                              ; preds = %146
  %154 = load i32, ptr %29, align 4, !tbaa !9
  %155 = icmp sle i32 %154, 4
  br i1 %155, label %156, label %158

156:                                              ; preds = %153
  %157 = load i32, ptr %29, align 4, !tbaa !9
  store i32 %157, ptr %35, align 4, !tbaa !9
  br label %158

158:                                              ; preds = %156, %153, %146
  %159 = load ptr, ptr %32, align 8, !tbaa !5
  %160 = icmp eq ptr null, %159
  br i1 %160, label %161, label %163

161:                                              ; preds = %158
  %162 = call ptr @stbi_failure_reason()
  store ptr %162, ptr @result_string_pointer, align 8, !tbaa !5
  store i32 0, ptr %16, align 4
  store i32 1, ptr %37, align 4
  br label %232

163:                                              ; preds = %158
  %164 = load ptr, ptr %32, align 8, !tbaa !5
  %165 = load i32, ptr %33, align 4, !tbaa !9
  %166 = load i32, ptr %34, align 4, !tbaa !9
  %167 = load i32, ptr %35, align 4, !tbaa !9
  %168 = load i32, ptr %36, align 4, !tbaa !9
  %169 = load i32, ptr %31, align 4, !tbaa !9
  %170 = call i32 @SOIL_internal_create_OGL_texture(ptr noundef %164, i32 noundef %165, i32 noundef %166, i32 noundef %167, i32 noundef %168, i32 noundef %169, i32 noundef 34067, i32 noundef 34072, i32 noundef 34076)
  store i32 %170, ptr %36, align 4, !tbaa !9
  %171 = load ptr, ptr %32, align 8, !tbaa !5
  call void @SOIL_free_image_data(ptr noundef %171)
  br label %172

172:                                              ; preds = %163, %143
  %173 = load i32, ptr %36, align 4, !tbaa !9
  %174 = icmp ne i32 %173, 0
  br i1 %174, label %175, label %201

175:                                              ; preds = %172
  %176 = load ptr, ptr %25, align 8, !tbaa !5
  %177 = load i32, ptr %26, align 4, !tbaa !9
  %178 = load i32, ptr %29, align 4, !tbaa !9
  %179 = call ptr @SOIL_load_image_from_memory(ptr noundef %176, i32 noundef %177, ptr noundef %33, ptr noundef %34, ptr noundef %35, i32 noundef %178)
  store ptr %179, ptr %32, align 8, !tbaa !5
  %180 = load i32, ptr %29, align 4, !tbaa !9
  %181 = icmp sge i32 %180, 1
  br i1 %181, label %182, label %187

182:                                              ; preds = %175
  %183 = load i32, ptr %29, align 4, !tbaa !9
  %184 = icmp sle i32 %183, 4
  br i1 %184, label %185, label %187

185:                                              ; preds = %182
  %186 = load i32, ptr %29, align 4, !tbaa !9
  store i32 %186, ptr %35, align 4, !tbaa !9
  br label %187

187:                                              ; preds = %185, %182, %175
  %188 = load ptr, ptr %32, align 8, !tbaa !5
  %189 = icmp eq ptr null, %188
  br i1 %189, label %190, label %192

190:                                              ; preds = %187
  %191 = call ptr @stbi_failure_reason()
  store ptr %191, ptr @result_string_pointer, align 8, !tbaa !5
  store i32 0, ptr %16, align 4
  store i32 1, ptr %37, align 4
  br label %232

192:                                              ; preds = %187
  %193 = load ptr, ptr %32, align 8, !tbaa !5
  %194 = load i32, ptr %33, align 4, !tbaa !9
  %195 = load i32, ptr %34, align 4, !tbaa !9
  %196 = load i32, ptr %35, align 4, !tbaa !9
  %197 = load i32, ptr %36, align 4, !tbaa !9
  %198 = load i32, ptr %31, align 4, !tbaa !9
  %199 = call i32 @SOIL_internal_create_OGL_texture(ptr noundef %193, i32 noundef %194, i32 noundef %195, i32 noundef %196, i32 noundef %197, i32 noundef %198, i32 noundef 34067, i32 noundef 34073, i32 noundef 34076)
  store i32 %199, ptr %36, align 4, !tbaa !9
  %200 = load ptr, ptr %32, align 8, !tbaa !5
  call void @SOIL_free_image_data(ptr noundef %200)
  br label %201

201:                                              ; preds = %192, %172
  %202 = load i32, ptr %36, align 4, !tbaa !9
  %203 = icmp ne i32 %202, 0
  br i1 %203, label %204, label %230

204:                                              ; preds = %201
  %205 = load ptr, ptr %27, align 8, !tbaa !5
  %206 = load i32, ptr %28, align 4, !tbaa !9
  %207 = load i32, ptr %29, align 4, !tbaa !9
  %208 = call ptr @SOIL_load_image_from_memory(ptr noundef %205, i32 noundef %206, ptr noundef %33, ptr noundef %34, ptr noundef %35, i32 noundef %207)
  store ptr %208, ptr %32, align 8, !tbaa !5
  %209 = load i32, ptr %29, align 4, !tbaa !9
  %210 = icmp sge i32 %209, 1
  br i1 %210, label %211, label %216

211:                                              ; preds = %204
  %212 = load i32, ptr %29, align 4, !tbaa !9
  %213 = icmp sle i32 %212, 4
  br i1 %213, label %214, label %216

214:                                              ; preds = %211
  %215 = load i32, ptr %29, align 4, !tbaa !9
  store i32 %215, ptr %35, align 4, !tbaa !9
  br label %216

216:                                              ; preds = %214, %211, %204
  %217 = load ptr, ptr %32, align 8, !tbaa !5
  %218 = icmp eq ptr null, %217
  br i1 %218, label %219, label %221

219:                                              ; preds = %216
  %220 = call ptr @stbi_failure_reason()
  store ptr %220, ptr @result_string_pointer, align 8, !tbaa !5
  store i32 0, ptr %16, align 4
  store i32 1, ptr %37, align 4
  br label %232

221:                                              ; preds = %216
  %222 = load ptr, ptr %32, align 8, !tbaa !5
  %223 = load i32, ptr %33, align 4, !tbaa !9
  %224 = load i32, ptr %34, align 4, !tbaa !9
  %225 = load i32, ptr %35, align 4, !tbaa !9
  %226 = load i32, ptr %36, align 4, !tbaa !9
  %227 = load i32, ptr %31, align 4, !tbaa !9
  %228 = call i32 @SOIL_internal_create_OGL_texture(ptr noundef %222, i32 noundef %223, i32 noundef %224, i32 noundef %225, i32 noundef %226, i32 noundef %227, i32 noundef 34067, i32 noundef 34074, i32 noundef 34076)
  store i32 %228, ptr %36, align 4, !tbaa !9
  %229 = load ptr, ptr %32, align 8, !tbaa !5
  call void @SOIL_free_image_data(ptr noundef %229)
  br label %230

230:                                              ; preds = %221, %201
  %231 = load i32, ptr %36, align 4, !tbaa !9
  store i32 %231, ptr %16, align 4
  store i32 1, ptr %37, align 4
  br label %232

232:                                              ; preds = %230, %219, %190, %161, %132, %103, %75, %59, %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #3
  %233 = load i32, ptr %16, align 4
  ret i32 %233
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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}


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

@result_string_pointer = external dso_local local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [30 x i8], align 1

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

declare ptr @stbi_failure_reason() local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare dso_local void @SOIL_free_image_data(ptr noundef) local_unnamed_addr #2

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @query_cubemap_capability() local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local i32 @SOIL_load_OGL_cubemap_from_memory(ptr noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, i32 noundef %5, ptr noundef %6, i32 noundef %7, ptr noundef %8, i32 noundef %9, ptr noundef %10, i32 noundef %11, i32 noundef %12, i32 noundef %13, i32 noundef %14) local_unnamed_addr #2 {
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %16) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %17) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %18) #3
  %19 = insertelement <4 x ptr> poison, ptr %0, i64 0
  %20 = insertelement <4 x ptr> %19, ptr %2, i64 1
  %21 = insertelement <4 x ptr> %20, ptr %4, i64 2
  %22 = insertelement <4 x ptr> %21, ptr %6, i64 3
  %23 = icmp eq <4 x ptr> %22, zeroinitializer
  %24 = icmp eq ptr %8, null
  %25 = icmp eq ptr %10, null
  %26 = bitcast <4 x i1> %23 to i4
  %27 = icmp ne i4 %26, 0
  %op.rdx = or i1 %27, %24
  %op.rdx132 = or i1 %op.rdx, %25
  br i1 %op.rdx132, label %28, label %29

28:                                               ; preds = %15
  store ptr @.str.4, ptr @result_string_pointer, align 8, !tbaa !5
  br label %.thread129

29:                                               ; preds = %15
  %30 = tail call i32 @query_cubemap_capability()
  %.not = icmp eq i32 %30, 1
  br i1 %.not, label %32, label %31

31:                                               ; preds = %29
  store ptr @.str.3, ptr @result_string_pointer, align 8, !tbaa !5
  br label %.thread129

32:                                               ; preds = %29
  %33 = call ptr @SOIL_load_image_from_memory(ptr noundef nonnull %0, i32 noundef %1, ptr noundef nonnull %16, ptr noundef nonnull %17, ptr noundef nonnull %18, i32 noundef %12)
  %34 = add i32 %12, -1
  %or.cond11 = icmp ult i32 %34, 4
  br i1 %or.cond11, label %35, label %36

35:                                               ; preds = %32
  store i32 %12, ptr %18, align 4, !tbaa !9
  br label %36

36:                                               ; preds = %35, %32
  %37 = icmp eq ptr %33, null
  br i1 %37, label %38, label %40

38:                                               ; preds = %36
  %39 = call ptr @stbi_failure_reason() #3
  store ptr %39, ptr @result_string_pointer, align 8, !tbaa !5
  br label %.thread129

40:                                               ; preds = %36
  %41 = load i32, ptr %16, align 4, !tbaa !9
  %42 = load i32, ptr %17, align 4, !tbaa !9
  %43 = load i32, ptr %18, align 4, !tbaa !9
  %44 = call i32 @SOIL_internal_create_OGL_texture(ptr noundef nonnull %33, i32 noundef %41, i32 noundef %42, i32 noundef %43, i32 noundef %13, i32 noundef %14, i32 noundef 34067, i32 noundef 34069, i32 noundef 34076)
  call void @SOIL_free_image_data(ptr noundef nonnull %33)
  %.not114 = icmp eq i32 %44, 0
  br i1 %.not114, label %.thread129, label %45

45:                                               ; preds = %40
  %46 = call ptr @SOIL_load_image_from_memory(ptr noundef nonnull %2, i32 noundef %3, ptr noundef nonnull %16, ptr noundef nonnull %17, ptr noundef nonnull %18, i32 noundef %12)
  br i1 %or.cond11, label %47, label %48

47:                                               ; preds = %45
  store i32 %12, ptr %18, align 4, !tbaa !9
  br label %48

48:                                               ; preds = %47, %45
  %49 = icmp eq ptr %46, null
  br i1 %49, label %50, label %52

50:                                               ; preds = %48
  %51 = call ptr @stbi_failure_reason() #3
  store ptr %51, ptr @result_string_pointer, align 8, !tbaa !5
  br label %.thread129

52:                                               ; preds = %48
  %53 = load i32, ptr %16, align 4, !tbaa !9
  %54 = load i32, ptr %17, align 4, !tbaa !9
  %55 = load i32, ptr %18, align 4, !tbaa !9
  %56 = call i32 @SOIL_internal_create_OGL_texture(ptr noundef nonnull %46, i32 noundef %53, i32 noundef %54, i32 noundef %55, i32 noundef %44, i32 noundef %14, i32 noundef 34067, i32 noundef 34070, i32 noundef 34076)
  call void @SOIL_free_image_data(ptr noundef nonnull %46)
  %.not115 = icmp eq i32 %56, 0
  br i1 %.not115, label %.thread129, label %57

57:                                               ; preds = %52
  %58 = call ptr @SOIL_load_image_from_memory(ptr noundef nonnull %4, i32 noundef %5, ptr noundef nonnull %16, ptr noundef nonnull %17, ptr noundef nonnull %18, i32 noundef %12)
  br i1 %or.cond11, label %59, label %60

59:                                               ; preds = %57
  store i32 %12, ptr %18, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %59, %57
  %61 = icmp eq ptr %58, null
  br i1 %61, label %62, label %64

62:                                               ; preds = %60
  %63 = call ptr @stbi_failure_reason() #3
  store ptr %63, ptr @result_string_pointer, align 8, !tbaa !5
  br label %.thread129

64:                                               ; preds = %60
  %65 = load i32, ptr %16, align 4, !tbaa !9
  %66 = load i32, ptr %17, align 4, !tbaa !9
  %67 = load i32, ptr %18, align 4, !tbaa !9
  %68 = call i32 @SOIL_internal_create_OGL_texture(ptr noundef nonnull %58, i32 noundef %65, i32 noundef %66, i32 noundef %67, i32 noundef %56, i32 noundef %14, i32 noundef 34067, i32 noundef 34071, i32 noundef 34076)
  call void @SOIL_free_image_data(ptr noundef nonnull %58)
  %.not116 = icmp eq i32 %68, 0
  br i1 %.not116, label %.thread129, label %69

69:                                               ; preds = %64
  %70 = call ptr @SOIL_load_image_from_memory(ptr noundef nonnull %6, i32 noundef %7, ptr noundef nonnull %16, ptr noundef nonnull %17, ptr noundef nonnull %18, i32 noundef %12)
  br i1 %or.cond11, label %71, label %72

71:                                               ; preds = %69
  store i32 %12, ptr %18, align 4, !tbaa !9
  br label %72

72:                                               ; preds = %71, %69
  %73 = icmp eq ptr %70, null
  br i1 %73, label %74, label %76

74:                                               ; preds = %72
  %75 = call ptr @stbi_failure_reason() #3
  store ptr %75, ptr @result_string_pointer, align 8, !tbaa !5
  br label %.thread129

76:                                               ; preds = %72
  %77 = load i32, ptr %16, align 4, !tbaa !9
  %78 = load i32, ptr %17, align 4, !tbaa !9
  %79 = load i32, ptr %18, align 4, !tbaa !9
  %80 = call i32 @SOIL_internal_create_OGL_texture(ptr noundef nonnull %70, i32 noundef %77, i32 noundef %78, i32 noundef %79, i32 noundef %68, i32 noundef %14, i32 noundef 34067, i32 noundef 34072, i32 noundef 34076)
  call void @SOIL_free_image_data(ptr noundef nonnull %70)
  %.not117 = icmp eq i32 %80, 0
  br i1 %.not117, label %.thread129, label %81

81:                                               ; preds = %76
  %82 = call ptr @SOIL_load_image_from_memory(ptr noundef nonnull %8, i32 noundef %9, ptr noundef nonnull %16, ptr noundef nonnull %17, ptr noundef nonnull %18, i32 noundef %12)
  br i1 %or.cond11, label %83, label %84

83:                                               ; preds = %81
  store i32 %12, ptr %18, align 4, !tbaa !9
  br label %84

84:                                               ; preds = %83, %81
  %85 = icmp eq ptr %82, null
  br i1 %85, label %86, label %88

86:                                               ; preds = %84
  %87 = call ptr @stbi_failure_reason() #3
  store ptr %87, ptr @result_string_pointer, align 8, !tbaa !5
  br label %.thread129

88:                                               ; preds = %84
  %89 = load i32, ptr %16, align 4, !tbaa !9
  %90 = load i32, ptr %17, align 4, !tbaa !9
  %91 = load i32, ptr %18, align 4, !tbaa !9
  %92 = call i32 @SOIL_internal_create_OGL_texture(ptr noundef nonnull %82, i32 noundef %89, i32 noundef %90, i32 noundef %91, i32 noundef %80, i32 noundef %14, i32 noundef 34067, i32 noundef 34073, i32 noundef 34076)
  call void @SOIL_free_image_data(ptr noundef nonnull %82)
  %.not118 = icmp eq i32 %92, 0
  br i1 %.not118, label %.thread129, label %93

93:                                               ; preds = %88
  %94 = call ptr @SOIL_load_image_from_memory(ptr noundef nonnull %10, i32 noundef %11, ptr noundef nonnull %16, ptr noundef nonnull %17, ptr noundef nonnull %18, i32 noundef %12)
  br i1 %or.cond11, label %95, label %96

95:                                               ; preds = %93
  store i32 %12, ptr %18, align 4, !tbaa !9
  br label %96

96:                                               ; preds = %95, %93
  %97 = icmp eq ptr %94, null
  br i1 %97, label %98, label %100

98:                                               ; preds = %96
  %99 = call ptr @stbi_failure_reason() #3
  store ptr %99, ptr @result_string_pointer, align 8, !tbaa !5
  br label %.thread129

100:                                              ; preds = %96
  %101 = load i32, ptr %16, align 4, !tbaa !9
  %102 = load i32, ptr %17, align 4, !tbaa !9
  %103 = load i32, ptr %18, align 4, !tbaa !9
  %104 = call i32 @SOIL_internal_create_OGL_texture(ptr noundef nonnull %94, i32 noundef %101, i32 noundef %102, i32 noundef %103, i32 noundef %92, i32 noundef %14, i32 noundef 34067, i32 noundef 34074, i32 noundef 34076)
  call void @SOIL_free_image_data(ptr noundef nonnull %94)
  br label %.thread129

.thread129:                                       ; preds = %40, %52, %64, %76, %88, %100, %98, %86, %74, %62, %50, %38, %31, %28
  %.099 = phi i32 [ 0, %28 ], [ 0, %31 ], [ 0, %38 ], [ 0, %50 ], [ 0, %62 ], [ 0, %74 ], [ 0, %86 ], [ 0, %98 ], [ %104, %100 ], [ 0, %88 ], [ 0, %76 ], [ 0, %64 ], [ 0, %52 ], [ 0, %40 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %16) #3
  ret i32 %.099
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass