; LLVM IR from zchrissirhcz/pixel :: src (px_image_io)

; 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.px_image_t = type { ptr, i32, i32, i32, i32 }

@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@stderr = external global ptr, align 8
@.str.12 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [5 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

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #2

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

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @px_write_image(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = call i64 @strlen(ptr noundef %12) #5
  %14 = icmp ult i64 %13, 5
  br i1 %14, label %15, label %22

15:                                               ; preds = %2
  br label %16

16:                                               ; preds = %15
  %17 = load ptr, ptr @stderr, align 8, !tbaa !5
  %18 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef @.str.14) #6
  %19 = load ptr, ptr @stderr, align 8, !tbaa !5
  %20 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef @.str.12) #6
  br label %21

21:                                               ; preds = %16
  store i1 false, ptr %3, align 1
  br label %160

22:                                               ; preds = %2
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = call i32 @px_get_file_or_directory_state(ptr noundef %23)
  %25 = icmp ne i32 %24, 3
  br i1 %25, label %26, label %33

26:                                               ; preds = %22
  br label %27

27:                                               ; preds = %26
  %28 = load ptr, ptr @stderr, align 8, !tbaa !5
  %29 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef @.str.15) #6
  %30 = load ptr, ptr @stderr, align 8, !tbaa !5
  %31 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef @.str.12) #6
  br label %32

32:                                               ; preds = %27
  br label %33

33:                                               ; preds = %32, %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = call i64 @strlen(ptr noundef %35) #5
  %37 = getelementptr inbounds i8, ptr %34, i64 %36
  %38 = getelementptr inbounds i8, ptr %37, i64 -4
  store ptr %38, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #6
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = call zeroext i1 @is_valid_image_extension(ptr noundef %39)
  %41 = zext i1 %40 to i8
  store i8 %41, ptr %7, align 1, !tbaa !9
  %42 = load i8, ptr %7, align 1, !tbaa !9, !range !11, !noundef !12
  %43 = trunc i8 %42 to i1
  br i1 %43, label %53, label %44

44:                                               ; preds = %33
  br label %45

45:                                               ; preds = %44
  %46 = load ptr, ptr @stderr, align 8, !tbaa !5
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef @.str.16, ptr noundef %47) #6
  %49 = load ptr, ptr @stderr, align 8, !tbaa !5
  %50 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef @.str.12) #6
  br label %51

51:                                               ; preds = %45
  br label %52

52:                                               ; preds = %51
  store i1 false, ptr %3, align 1
  store i32 1, ptr %8, align 4
  br label %159

53:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %54, ptr %9, align 8, !tbaa !5
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = call i32 @strcmp(ptr noundef %55, ptr noundef @.str.10) #5
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %58, label %72

58:                                               ; preds = %53
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.px_image_t, ptr %60, i32 0, i32 2
  %62 = load i32, ptr %61, align 4, !tbaa !13
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.px_image_t, ptr %63, i32 0, i32 1
  %65 = load i32, ptr %64, align 8, !tbaa !16
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.px_image_t, ptr %66, i32 0, i32 3
  %68 = load i32, ptr %67, align 8, !tbaa !17
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.px_image_t, ptr %69, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8, !tbaa !18
  call void @px_write_bmp(ptr noundef %59, i32 noundef %62, i32 noundef %65, i32 noundef %68, ptr noundef %71)
  br label %152

72:                                               ; preds = %53
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = call i32 @strcmp(ptr noundef %73, ptr noundef @.str.17) #5
  %75 = icmp eq i32 %74, 0
  br i1 %75, label %76, label %93

76:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 95, ptr %10, align 4, !tbaa !19
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = call ptr @transform_for_stb_order(ptr noundef %77)
  store ptr %78, ptr %9, align 8, !tbaa !5
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = load ptr, ptr %9, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.px_image_t, ptr %80, i32 0, i32 1
  %82 = load i32, ptr %81, align 8, !tbaa !16
  %83 = load ptr, ptr %9, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.px_image_t, ptr %83, i32 0, i32 2
  %85 = load i32, ptr %84, align 4, !tbaa !13
  %86 = load ptr, ptr %9, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.px_image_t, ptr %86, i32 0, i32 3
  %88 = load i32, ptr %87, align 8, !tbaa !17
  %89 = load ptr, ptr %9, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.px_image_t, ptr %89, i32 0, i32 0
  %91 = load ptr, ptr %90, align 8, !tbaa !18
  %92 = call i32 @stbi_write_jpg(ptr noundef %79, i32 noundef %82, i32 noundef %85, i32 noundef %88, ptr noundef %91, i32 noundef 95)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %151

93:                                               ; preds = %72
  %94 = load ptr, ptr %6, align 8, !tbaa !5
  %95 = call i32 @strcmp(ptr noundef %94, ptr noundef @.str.18) #5
  %96 = icmp eq i32 %95, 0
  br i1 %96, label %97, label %118

97:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %98 = load ptr, ptr %9, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.px_image_t, ptr %98, i32 0, i32 4
  %100 = load i32, ptr %99, align 4, !tbaa !20
  store i32 %100, ptr %11, align 4, !tbaa !19
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = call ptr @transform_for_stb_order(ptr noundef %101)
  store ptr %102, ptr %9, align 8, !tbaa !5
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = load ptr, ptr %9, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.px_image_t, ptr %104, i32 0, i32 1
  %106 = load i32, ptr %105, align 8, !tbaa !16
  %107 = load ptr, ptr %9, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.px_image_t, ptr %107, i32 0, i32 2
  %109 = load i32, ptr %108, align 4, !tbaa !13
  %110 = load ptr, ptr %9, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.px_image_t, ptr %110, i32 0, i32 3
  %112 = load i32, ptr %111, align 8, !tbaa !17
  %113 = load ptr, ptr %9, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.px_image_t, ptr %113, i32 0, i32 0
  %115 = load ptr, ptr %114, align 8, !tbaa !18
  %116 = load i32, ptr %11, align 4, !tbaa !19
  %117 = call i32 @stbi_write_png(ptr noundef %103, i32 noundef %106, i32 noundef %109, i32 noundef %112, ptr noundef %115, i32 noundef %116)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %150

118:                                              ; preds = %93
  %119 = load ptr, ptr %6, align 8, !tbaa !5
  %120 = call i32 @strcmp(ptr noundef %119, ptr noundef @.str.13) #5
  %121 = icmp eq i32 %120, 0
  br i1 %121, label %122, label %133

122:                                              ; preds = %118
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = load ptr, ptr %9, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.px_image_t, ptr %124, i32 0, i32 0
  %126 = load ptr, ptr %125, align 8, !tbaa !18
  %127 = load ptr, ptr %9, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.px_image_t, ptr %127, i32 0, i32 2
  %129 = load i32, ptr %128, align 4, !tbaa !13
  %130 = load ptr, ptr %9, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.px_image_t, ptr %130, i32 0, i32 1
  %132 = load i32, ptr %131, align 8, !tbaa !16
  call void @px_write_ppm(ptr noundef %123, ptr noundef %126, i32 noundef %129, i32 noundef %132)
  br label %149

133:                                              ; preds = %118
  %134 = load ptr, ptr %6, align 8, !tbaa !5
  %135 = call i32 @strcmp(ptr noundef %134, ptr noundef @.str.19) #5
  %136 = icmp eq i32 %135, 0
  br i1 %136, label %137, label %148

137:                                              ; preds = %133
  %138 = load ptr, ptr %5, align 8, !tbaa !5
  %139 = load ptr, ptr %9, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.px_image_t, ptr %139, i32 0, i32 0
  %141 = load ptr, ptr %140, align 8, !tbaa !18
  %142 = load ptr, ptr %9, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.px_image_t, ptr %142, i32 0, i32 2
  %144 = load i32, ptr %143, align 4, !tbaa !13
  %145 = load ptr, ptr %9, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.px_image_t, ptr %145, i32 0, i32 1
  %147 = load i32, ptr %146, align 8, !tbaa !16
  call void @px_write_pgm(ptr noundef %138, ptr noundef %141, i32 noundef %144, i32 noundef %147)
  br label %148

148:                                              ; preds = %137, %133
  br label %149

149:                                              ; preds = %148, %122
  br label %150

150:                                              ; preds = %149, %97
  br label %151

151:                                              ; preds = %150, %76
  br label %152

152:                                              ; preds = %151, %58
  %153 = load ptr, ptr %9, align 8, !tbaa !5
  %154 = load ptr, ptr %4, align 8, !tbaa !5
  %155 = icmp ne ptr %153, %154
  br i1 %155, label %156, label %158

156:                                              ; preds = %152
  %157 = load ptr, ptr %9, align 8, !tbaa !5
  call void @px_destroy_image(ptr noundef %157)
  br label %158

158:                                              ; preds = %156, %152
  store i1 true, ptr %3, align 1
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %159

159:                                              ; preds = %158, %52
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %160

160:                                              ; preds = %159, %21
  %161 = load i1, ptr %3, align 1
  ret i1 %161
}

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #2

declare i32 @px_get_file_or_directory_state(ptr noundef) #4

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @is_valid_image_extension(ptr noundef) #1

declare void @px_write_bmp(ptr noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #4

; Function Attrs: nounwind uwtable
declare hidden ptr @transform_for_stb_order(ptr noundef) #1

declare void @px_write_ppm(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #4

declare void @px_write_pgm(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #4

declare void @px_destroy_image(ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind willreturn memory(read) "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 "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 = { "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 willreturn memory(read) }
attributes #6 = { 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 = !{!"_Bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !15, i64 12}
!14 = !{!"px_image_t", !6, i64 0, !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20}
!15 = !{!"int", !7, i64 0}
!16 = !{!14, !15, i64 8}
!17 = !{!14, !15, i64 16}
!18 = !{!14, !6, i64 0}
!19 = !{!15, !15, i64 0}
!20 = !{!14, !15, i64 20}


; 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.10 = external hidden unnamed_addr constant [5 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.12 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [5 x i8], align 1

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @px_write_image(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #4
  %4 = icmp ult i64 %3, 5
  br i1 %4, label %5, label %10

5:                                                ; preds = %2
  %6 = load ptr, ptr @stderr, align 8, !tbaa !5
  %7 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %6, ptr noundef nonnull @.str.14) #5
  %8 = load ptr, ptr @stderr, align 8, !tbaa !5
  %9 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %8, ptr noundef nonnull @.str.12) #5
  br label %.thread

10:                                               ; preds = %2
  %11 = tail call i32 @px_get_file_or_directory_state(ptr noundef %1) #6
  %.not = icmp eq i32 %11, 3
  br i1 %.not, label %17, label %12

12:                                               ; preds = %10
  %13 = load ptr, ptr @stderr, align 8, !tbaa !5
  %14 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %13, ptr noundef nonnull @.str.15) #5
  %15 = load ptr, ptr @stderr, align 8, !tbaa !5
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef nonnull @.str.12) #5
  br label %17

17:                                               ; preds = %12, %10
  %18 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #4
  %19 = getelementptr inbounds i8, ptr %1, i64 %18
  %20 = getelementptr inbounds i8, ptr %19, i64 -4
  %21 = tail call zeroext i1 @is_valid_image_extension(ptr noundef nonnull %20)
  br i1 %21, label %27, label %22

22:                                               ; preds = %17
  %23 = load ptr, ptr @stderr, align 8, !tbaa !5
  %24 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef nonnull @.str.16, ptr noundef nonnull %20) #5
  %25 = load ptr, ptr @stderr, align 8, !tbaa !5
  %26 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str.12) #5
  br label %.thread

27:                                               ; preds = %17
  %28 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %20, ptr noundef nonnull dereferenceable(1) @.str.10) #4
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %30, label %38

30:                                               ; preds = %27
  %31 = getelementptr inbounds i8, ptr %0, i64 12
  %32 = load i32, ptr %31, align 4, !tbaa !9
  %33 = getelementptr inbounds i8, ptr %0, i64 8
  %34 = load i32, ptr %33, align 8, !tbaa !12
  %35 = getelementptr inbounds i8, ptr %0, i64 16
  %36 = load i32, ptr %35, align 8, !tbaa !13
  %37 = load ptr, ptr %0, align 8, !tbaa !14
  tail call void @px_write_bmp(ptr noundef %1, i32 noundef %32, i32 noundef %34, i32 noundef %36, ptr noundef %37) #6
  br label %.thread

38:                                               ; preds = %27
  %39 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %20, ptr noundef nonnull dereferenceable(1) @.str.17) #4
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %41, label %51

41:                                               ; preds = %38
  %42 = tail call ptr @transform_for_stb_order(ptr noundef %0)
  %43 = getelementptr inbounds i8, ptr %42, i64 8
  %44 = load i32, ptr %43, align 8, !tbaa !12
  %45 = getelementptr inbounds i8, ptr %42, i64 12
  %46 = load i32, ptr %45, align 4, !tbaa !9
  %47 = getelementptr inbounds i8, ptr %42, i64 16
  %48 = load i32, ptr %47, align 8, !tbaa !13
  %49 = load ptr, ptr %42, align 8, !tbaa !14
  %50 = tail call i32 @stbi_write_jpg(ptr noundef %1, i32 noundef %44, i32 noundef %46, i32 noundef %48, ptr noundef %49, i32 noundef 95)
  br label %84

51:                                               ; preds = %38
  %52 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %20, ptr noundef nonnull dereferenceable(1) @.str.18) #4
  %53 = icmp eq i32 %52, 0
  br i1 %53, label %54, label %66

54:                                               ; preds = %51
  %55 = getelementptr inbounds i8, ptr %0, i64 20
  %56 = load i32, ptr %55, align 4, !tbaa !15
  %57 = tail call ptr @transform_for_stb_order(ptr noundef %0)
  %58 = getelementptr inbounds i8, ptr %57, i64 8
  %59 = load i32, ptr %58, align 8, !tbaa !12
  %60 = getelementptr inbounds i8, ptr %57, i64 12
  %61 = load i32, ptr %60, align 4, !tbaa !9
  %62 = getelementptr inbounds i8, ptr %57, i64 16
  %63 = load i32, ptr %62, align 8, !tbaa !13
  %64 = load ptr, ptr %57, align 8, !tbaa !14
  %65 = tail call i32 @stbi_write_png(ptr noundef %1, i32 noundef %59, i32 noundef %61, i32 noundef %63, ptr noundef %64, i32 noundef %56)
  br label %84

66:                                               ; preds = %51
  %67 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %20, ptr noundef nonnull dereferenceable(1) @.str.13) #4
  %68 = icmp eq i32 %67, 0
  br i1 %68, label %69, label %75

69:                                               ; preds = %66
  %70 = load ptr, ptr %0, align 8, !tbaa !14
  %71 = getelementptr inbounds i8, ptr %0, i64 12
  %72 = load i32, ptr %71, align 4, !tbaa !9
  %73 = getelementptr inbounds i8, ptr %0, i64 8
  %74 = load i32, ptr %73, align 8, !tbaa !12
  tail call void @px_write_ppm(ptr noundef %1, ptr noundef %70, i32 noundef %72, i32 noundef %74) #6
  br label %.thread

75:                                               ; preds = %66
  %76 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %20, ptr noundef nonnull dereferenceable(1) @.str.19) #4
  %77 = icmp eq i32 %76, 0
  br i1 %77, label %78, label %.thread

78:                                               ; preds = %75
  %79 = load ptr, ptr %0, align 8, !tbaa !14
  %80 = getelementptr inbounds i8, ptr %0, i64 12
  %81 = load i32, ptr %80, align 4, !tbaa !9
  %82 = getelementptr inbounds i8, ptr %0, i64 8
  %83 = load i32, ptr %82, align 8, !tbaa !12
  tail call void @px_write_pgm(ptr noundef %1, ptr noundef %79, i32 noundef %81, i32 noundef %83) #6
  br label %.thread

84:                                               ; preds = %41, %54
  %.043 = phi ptr [ %42, %41 ], [ %57, %54 ]
  %.not44 = icmp eq ptr %.043, %0
  br i1 %.not44, label %.thread, label %85

85:                                               ; preds = %84
  tail call void @px_destroy_image(ptr noundef nonnull %.043) #6
  br label %.thread

.thread:                                          ; preds = %75, %78, %69, %30, %22, %85, %84, %5
  %.1 = phi i1 [ false, %5 ], [ true, %84 ], [ true, %85 ], [ false, %22 ], [ true, %30 ], [ true, %69 ], [ true, %78 ], [ true, %75 ]
  ret i1 %.1
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #1

declare i32 @px_get_file_or_directory_state(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @is_valid_image_extension(ptr noundef) local_unnamed_addr #0

declare void @px_write_bmp(ptr noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

declare void @px_write_ppm(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

declare void @px_write_pgm(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

declare void @px_destroy_image(ptr noundef) local_unnamed_addr #3

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { 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 = { nounwind willreturn memory(read) }
attributes #5 = { cold nounwind }
attributes #6 = { 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, !11, i64 12}
!10 = !{!"px_image_t", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!10, !11, i64 16}
!14 = !{!10, !6, i64 0}
!15 = !{!10, !11, i64 20}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass