; LLVM IR from christoskaramou/PhasmaEngine :: PhasmaEditor/Include/TinyFileDialogs (tinyfiledialogs)

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

@tinyfd_verbose = external dso_local global i32, align 4
@tinyfd_response = external dso_local global [1024 x i8], align 16
@.str.8 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.58 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.60 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.66 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.125 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.177 = external hidden unnamed_addr constant [1 x i8], align 1
@_ZZ18tinyfd_arrayDialogE5lBuff = external hidden global [1024 x i8], align 16
@.str.349 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.350 = external hidden unnamed_addr constant [12 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: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #1

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #2

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

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

declare noalias ptr @popen(ptr noundef, ptr noundef) #3

declare i32 @pclose(ptr noundef) #3

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

; Function Attrs: nounwind
declare ptr @strcat(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL13zenityPresentv() #4

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL17matedialogPresentv() #4

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL20shellementaryPresentv() #4

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL12qarmaPresentv() #4

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL14zenity3Presentv() #4

; Function Attrs: nounwind
declare ptr @getenv(ptr noundef) #2

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

; Function Attrs: mustprogress uwtable
define dso_local ptr @tinyfd_arrayDialog(ptr noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4) #4 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca [1024 x i8], align 16
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i32 %3, ptr %10, align 4, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1024, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i8 0, ptr @_ZZ18tinyfd_arrayDialogE5lBuff, align 16, !tbaa !11
  %16 = call noundef i32 @_ZL13zenityPresentv()
  %17 = icmp ne i32 %16, 0
  br i1 %17, label %27, label %18

18:                                               ; preds = %5
  %19 = call noundef i32 @_ZL17matedialogPresentv()
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %27, label %21

21:                                               ; preds = %18
  %22 = call noundef i32 @_ZL20shellementaryPresentv()
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %27, label %24

24:                                               ; preds = %21
  %25 = call noundef i32 @_ZL12qarmaPresentv()
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %27, label %177

27:                                               ; preds = %24, %21, %18, %5
  %28 = call noundef i32 @_ZL13zenityPresentv()
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %51

30:                                               ; preds = %27
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = icmp ne ptr %31, null
  br i1 %32, label %33, label %39

33:                                               ; preds = %30
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = call i32 @strcmp(ptr noundef %34, ptr noundef @.str.10) #6
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %39, label %37

37:                                               ; preds = %33
  %38 = call ptr @strcpy(ptr noundef @tinyfd_response, ptr noundef @.str.52) #5
  store ptr inttoptr (i64 1 to ptr), ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %222

39:                                               ; preds = %33, %30
  %40 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %41 = call ptr @strcpy(ptr noundef %40, ptr noundef @.str.52) #5
  %42 = call noundef i32 @_ZL14zenity3Presentv()
  %43 = icmp sge i32 %42, 4
  br i1 %43, label %44, label %50

44:                                               ; preds = %39
  %45 = call ptr @getenv(ptr noundef @.str.54) #5
  %46 = icmp ne ptr %45, null
  br i1 %46, label %50, label %47

47:                                               ; preds = %44
  %48 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %49 = call ptr @strcat(ptr noundef %48, ptr noundef @.str.55) #5
  br label %50

50:                                               ; preds = %47, %44, %39
  br label %101

51:                                               ; preds = %27
  %52 = call noundef i32 @_ZL17matedialogPresentv()
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %66

54:                                               ; preds = %51
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = icmp ne ptr %55, null
  br i1 %56, label %57, label %63

57:                                               ; preds = %54
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = call i32 @strcmp(ptr noundef %58, ptr noundef @.str.10) #6
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %63, label %61

61:                                               ; preds = %57
  %62 = call ptr @strcpy(ptr noundef @tinyfd_response, ptr noundef @.str.56) #5
  store ptr inttoptr (i64 1 to ptr), ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %222

63:                                               ; preds = %57, %54
  %64 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %65 = call ptr @strcpy(ptr noundef %64, ptr noundef @.str.56) #5
  br label %100

66:                                               ; preds = %51
  %67 = call noundef i32 @_ZL20shellementaryPresentv()
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %81

69:                                               ; preds = %66
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = icmp ne ptr %70, null
  br i1 %71, label %72, label %78

72:                                               ; preds = %69
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = call i32 @strcmp(ptr noundef %73, ptr noundef @.str.10) #6
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %78, label %76

76:                                               ; preds = %72
  %77 = call ptr @strcpy(ptr noundef @tinyfd_response, ptr noundef @.str.58) #5
  store ptr inttoptr (i64 1 to ptr), ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %222

78:                                               ; preds = %72, %69
  %79 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %80 = call ptr @strcpy(ptr noundef %79, ptr noundef @.str.58) #5
  br label %99

81:                                               ; preds = %66
  %82 = load ptr, ptr %7, align 8, !tbaa !5
  %83 = icmp ne ptr %82, null
  br i1 %83, label %84, label %90

84:                                               ; preds = %81
  %85 = load ptr, ptr %7, align 8, !tbaa !5
  %86 = call i32 @strcmp(ptr noundef %85, ptr noundef @.str.10) #6
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %90, label %88

88:                                               ; preds = %84
  %89 = call ptr @strcpy(ptr noundef @tinyfd_response, ptr noundef @.str.60) #5
  store ptr inttoptr (i64 1 to ptr), ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %222

90:                                               ; preds = %84, %81
  %91 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %92 = call ptr @strcpy(ptr noundef %91, ptr noundef @.str.60) #5
  %93 = call ptr @getenv(ptr noundef @.str.54) #5
  %94 = icmp ne ptr %93, null
  br i1 %94, label %98, label %95

95:                                               ; preds = %90
  %96 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %97 = call ptr @strcat(ptr noundef %96, ptr noundef @.str.42) #5
  br label %98

98:                                               ; preds = %95, %90
  br label %99

99:                                               ; preds = %98, %78
  br label %100

100:                                              ; preds = %99, %63
  br label %101

101:                                              ; preds = %100, %50
  %102 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %103 = call ptr @strcat(ptr noundef %102, ptr noundef @.str.349) #5
  %104 = load ptr, ptr %7, align 8, !tbaa !5
  %105 = icmp ne ptr %104, null
  br i1 %105, label %106, label %118

106:                                              ; preds = %101
  %107 = load ptr, ptr %7, align 8, !tbaa !5
  %108 = call i64 @strlen(ptr noundef %107) #6
  %109 = icmp ne i64 %108, 0
  br i1 %109, label %110, label %118

110:                                              ; preds = %106
  %111 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %112 = call ptr @strcat(ptr noundef %111, ptr noundef @.str.66) #5
  %113 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %114 = load ptr, ptr %7, align 8, !tbaa !5
  %115 = call ptr @strcat(ptr noundef %113, ptr noundef %114) #5
  %116 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %117 = call ptr @strcat(ptr noundef %116, ptr noundef @.str.47) #5
  br label %118

118:                                              ; preds = %110, %106, %101
  %119 = load ptr, ptr %9, align 8, !tbaa !5
  %120 = icmp ne ptr %119, null
  br i1 %120, label %121, label %145

121:                                              ; preds = %118
  %122 = load i32, ptr %8, align 4, !tbaa !9
  %123 = icmp sgt i32 %122, 0
  br i1 %123, label %124, label %145

124:                                              ; preds = %121
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %125

125:                                              ; preds = %141, %124
  %126 = load i32, ptr %14, align 4, !tbaa !9
  %127 = load i32, ptr %8, align 4, !tbaa !9
  %128 = icmp slt i32 %126, %127
  br i1 %128, label %129, label %144

129:                                              ; preds = %125
  %130 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %131 = call ptr @strcat(ptr noundef %130, ptr noundef @.str.350) #5
  %132 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %133 = load ptr, ptr %9, align 8, !tbaa !5
  %134 = load i32, ptr %14, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds ptr, ptr %133, i64 %135
  %137 = load ptr, ptr %136, align 8, !tbaa !5
  %138 = call ptr @strcat(ptr noundef %132, ptr noundef %137) #5
  %139 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %140 = call ptr @strcat(ptr noundef %139, ptr noundef @.str.47) #5
  br label %141

141:                                              ; preds = %129
  %142 = load i32, ptr %14, align 4, !tbaa !9
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %14, align 4, !tbaa !9
  br label %125, !llvm.loop !12

144:                                              ; preds = %125
  br label %145

145:                                              ; preds = %144, %121, %118
  %146 = load ptr, ptr %11, align 8, !tbaa !5
  %147 = icmp ne ptr %146, null
  br i1 %147, label %148, label %176

148:                                              ; preds = %145
  %149 = load i32, ptr %10, align 4, !tbaa !9
  %150 = icmp sgt i32 %149, 0
  br i1 %150, label %151, label %176

151:                                              ; preds = %148
  %152 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %153 = call ptr @strcat(ptr noundef %152, ptr noundef @.str.125) #5
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %154

154:                                              ; preds = %172, %151
  %155 = load i32, ptr %14, align 4, !tbaa !9
  %156 = load i32, ptr %10, align 4, !tbaa !9
  %157 = load i32, ptr %8, align 4, !tbaa !9
  %158 = mul nsw i32 %156, %157
  %159 = icmp slt i32 %155, %158
  br i1 %159, label %160, label %175

160:                                              ; preds = %154
  %161 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %162 = call ptr @strcat(ptr noundef %161, ptr noundef @.str.47) #5
  %163 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %164 = load ptr, ptr %11, align 8, !tbaa !5
  %165 = load i32, ptr %14, align 4, !tbaa !9
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds ptr, ptr %164, i64 %166
  %168 = load ptr, ptr %167, align 8, !tbaa !5
  %169 = call ptr @strcat(ptr noundef %163, ptr noundef %168) #5
  %170 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %171 = call ptr @strcat(ptr noundef %170, ptr noundef @.str.15) #5
  br label %172

172:                                              ; preds = %160
  %173 = load i32, ptr %14, align 4, !tbaa !9
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %14, align 4, !tbaa !9
  br label %154, !llvm.loop !14

175:                                              ; preds = %154
  br label %176

176:                                              ; preds = %175, %148, %145
  br label %187

177:                                              ; preds = %24
  %178 = load ptr, ptr %7, align 8, !tbaa !5
  %179 = icmp ne ptr %178, null
  br i1 %179, label %180, label %186

180:                                              ; preds = %177
  %181 = load ptr, ptr %7, align 8, !tbaa !5
  %182 = call i32 @strcmp(ptr noundef %181, ptr noundef @.str.10) #6
  %183 = icmp ne i32 %182, 0
  br i1 %183, label %186, label %184

184:                                              ; preds = %180
  %185 = call ptr @strcpy(ptr noundef @tinyfd_response, ptr noundef @.str.177) #5
  store ptr null, ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %222

186:                                              ; preds = %180, %177
  store ptr null, ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %222

187:                                              ; preds = %176
  %188 = load i32, ptr @tinyfd_verbose, align 4, !tbaa !9
  %189 = icmp ne i32 %188, 0
  br i1 %189, label %190, label %193

190:                                              ; preds = %187
  %191 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %192 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, ptr noundef %191)
  br label %193

193:                                              ; preds = %190, %187
  %194 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  %195 = call noalias ptr @popen(ptr noundef %194, ptr noundef @.str.9)
  store ptr %195, ptr %13, align 8, !tbaa !5
  %196 = icmp ne ptr %195, null
  br i1 %196, label %198, label %197

197:                                              ; preds = %193
  store ptr null, ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %222

198:                                              ; preds = %193
  br label %199

199:                                              ; preds = %203, %198
  %200 = load ptr, ptr %13, align 8, !tbaa !5
  %201 = call ptr @fgets(ptr noundef @_ZZ18tinyfd_arrayDialogE5lBuff, i32 noundef 1024, ptr noundef %200)
  %202 = icmp ne ptr %201, null
  br i1 %202, label %203, label %204

203:                                              ; preds = %199
  br label %199, !llvm.loop !15

204:                                              ; preds = %199
  %205 = load ptr, ptr %13, align 8, !tbaa !5
  %206 = call i32 @pclose(ptr noundef %205)
  %207 = call i64 @strlen(ptr noundef @_ZZ18tinyfd_arrayDialogE5lBuff) #6
  %208 = sub i64 %207, 1
  %209 = getelementptr inbounds [1024 x i8], ptr @_ZZ18tinyfd_arrayDialogE5lBuff, i64 0, i64 %208
  %210 = load i8, ptr %209, align 1, !tbaa !11
  %211 = sext i8 %210 to i32
  %212 = icmp eq i32 %211, 10
  br i1 %212, label %213, label %217

213:                                              ; preds = %204
  %214 = call i64 @strlen(ptr noundef @_ZZ18tinyfd_arrayDialogE5lBuff) #6
  %215 = sub i64 %214, 1
  %216 = getelementptr inbounds [1024 x i8], ptr @_ZZ18tinyfd_arrayDialogE5lBuff, i64 0, i64 %215
  store i8 0, ptr %216, align 1, !tbaa !11
  br label %217

217:                                              ; preds = %213, %204
  %218 = call i64 @strlen(ptr noundef @_ZZ18tinyfd_arrayDialogE5lBuff) #6
  %219 = icmp ne i64 %218, 0
  br i1 %219, label %221, label %220

220:                                              ; preds = %217
  store ptr null, ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %222

221:                                              ; preds = %217
  store ptr @_ZZ18tinyfd_arrayDialogE5lBuff, ptr %6, align 8
  store i32 1, ptr %15, align 4
  br label %222

222:                                              ; preds = %221, %220, %197, %186, %184, %88, %76, %61, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 1024, ptr %12) #5
  %223 = load ptr, ptr %6, align 8
  ret ptr %223
}

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

!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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}


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

@tinyfd_verbose = external dso_local local_unnamed_addr global i32, align 4
@tinyfd_response = external dso_local global [1024 x i8], align 16
@.str.8 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.58 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.60 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.66 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.125 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.177 = external hidden unnamed_addr constant [1 x i8], align 1
@_ZZ18tinyfd_arrayDialogE5lBuff = external hidden global [1024 x i8], align 16
@.str.349 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.350 = external hidden unnamed_addr constant [12 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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) 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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noalias noundef ptr @popen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @pclose(ptr nocapture noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL13zenityPresentv() local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL17matedialogPresentv() local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL20shellementaryPresentv() local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL12qarmaPresentv() local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL14zenity3Presentv() local_unnamed_addr #4

; Function Attrs: nofree nounwind memory(read)
declare noundef ptr @getenv(ptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local ptr @tinyfd_arrayDialog(ptr noundef readonly %0, i32 noundef %1, ptr noundef readonly %2, i32 noundef %3, ptr noundef readonly %4) local_unnamed_addr #4 {
  %6 = alloca [1024 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %6) #6
  store i8 0, ptr @_ZZ18tinyfd_arrayDialogE5lBuff, align 16, !tbaa !5
  %7 = tail call noundef i32 @_ZL13zenityPresentv()
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %8, label %14

8:                                                ; preds = %5
  %9 = tail call noundef i32 @_ZL17matedialogPresentv()
  %.not40 = icmp eq i32 %9, 0
  br i1 %.not40, label %10, label %14

10:                                               ; preds = %8
  %11 = tail call noundef i32 @_ZL20shellementaryPresentv()
  %.not41 = icmp eq i32 %11, 0
  br i1 %.not41, label %12, label %14

12:                                               ; preds = %10
  %13 = tail call noundef i32 @_ZL12qarmaPresentv()
  %.not42 = icmp eq i32 %13, 0
  br i1 %.not42, label %83, label %14

14:                                               ; preds = %12, %10, %8, %5
  %15 = tail call noundef i32 @_ZL13zenityPresentv()
  %.not45 = icmp eq i32 %15, 0
  br i1 %.not45, label %29, label %16

16:                                               ; preds = %14
  %.not55 = icmp eq ptr %0, null
  br i1 %.not55, label %21, label %17

17:                                               ; preds = %16
  %18 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) @.str.10) #7
  %.not56 = icmp eq i32 %18, 0
  br i1 %.not56, label %19, label %21

19:                                               ; preds = %17
  %20 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) @tinyfd_response, ptr noundef nonnull dereferenceable(1) @.str.52) #6
  br label %103

21:                                               ; preds = %17, %16
  %22 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.52) #6
  %23 = call noundef i32 @_ZL14zenity3Presentv()
  %24 = icmp sgt i32 %23, 3
  br i1 %24, label %25, label %57

25:                                               ; preds = %21
  %26 = call ptr @getenv(ptr noundef nonnull @.str.54) #6
  %.not57 = icmp eq ptr %26, null
  br i1 %.not57, label %27, label %57

27:                                               ; preds = %25
  %28 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.55) #6
  br label %57

29:                                               ; preds = %14
  %30 = tail call noundef i32 @_ZL17matedialogPresentv()
  %.not46 = icmp eq i32 %30, 0
  br i1 %.not46, label %38, label %31

31:                                               ; preds = %29
  %.not53 = icmp eq ptr %0, null
  br i1 %.not53, label %36, label %32

32:                                               ; preds = %31
  %33 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) @.str.10) #7
  %.not54 = icmp eq i32 %33, 0
  br i1 %.not54, label %34, label %36

34:                                               ; preds = %32
  %35 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) @tinyfd_response, ptr noundef nonnull dereferenceable(1) @.str.56) #6
  br label %103

36:                                               ; preds = %32, %31
  %37 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.56) #6
  br label %57

38:                                               ; preds = %29
  %39 = tail call noundef i32 @_ZL20shellementaryPresentv()
  %.not47 = icmp eq i32 %39, 0
  %.not48 = icmp eq ptr %0, null
  br i1 %.not47, label %47, label %40

40:                                               ; preds = %38
  br i1 %.not48, label %45, label %41

41:                                               ; preds = %40
  %42 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) @.str.10) #7
  %.not52 = icmp eq i32 %42, 0
  br i1 %.not52, label %43, label %45

43:                                               ; preds = %41
  %44 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) @tinyfd_response, ptr noundef nonnull dereferenceable(1) @.str.58) #6
  br label %103

45:                                               ; preds = %41, %40
  %46 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.58) #6
  br label %57

47:                                               ; preds = %38
  br i1 %.not48, label %52, label %48

48:                                               ; preds = %47
  %49 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) @.str.10) #7
  %.not49 = icmp eq i32 %49, 0
  br i1 %.not49, label %50, label %52

50:                                               ; preds = %48
  %51 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) @tinyfd_response, ptr noundef nonnull dereferenceable(1) @.str.60) #6
  br label %103

52:                                               ; preds = %48, %47
  %53 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.60) #6
  %54 = call ptr @getenv(ptr noundef nonnull @.str.54) #6
  %.not50 = icmp eq ptr %54, null
  br i1 %.not50, label %55, label %57

55:                                               ; preds = %52
  %56 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.42) #6
  br label %57

57:                                               ; preds = %36, %52, %55, %45, %21, %25, %27
  %58 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.349) #6
  %.not58 = icmp eq ptr %0, null
  br i1 %.not58, label %64, label %59

59:                                               ; preds = %57
  %char0 = load i8, ptr %0, align 1
  %.not59 = icmp eq i8 %char0, 0
  br i1 %.not59, label %64, label %60

60:                                               ; preds = %59
  %61 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.66) #6
  %62 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) %0) #6
  %63 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.47) #6
  br label %64

64:                                               ; preds = %60, %59, %57
  %65 = icmp ne ptr %2, null
  %66 = icmp sgt i32 %1, 0
  %or.cond = and i1 %66, %65
  br i1 %or.cond, label %.preheader65.preheader, label %.loopexit66

.preheader65.preheader:                           ; preds = %64
  %wide.trip.count = zext nneg i32 %1 to i64
  br label %.preheader65

.preheader65:                                     ; preds = %.preheader65.preheader, %.preheader65
  %indvars.iv = phi i64 [ 0, %.preheader65.preheader ], [ %indvars.iv.next, %.preheader65 ]
  %67 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.350) #6
  %68 = getelementptr inbounds ptr, ptr %2, i64 %indvars.iv
  %69 = load ptr, ptr %68, align 8, !tbaa !8
  %70 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) %69) #6
  %71 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.47) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit66, label %.preheader65, !llvm.loop !10

.loopexit66:                                      ; preds = %.preheader65, %64
  %72 = icmp ne ptr %4, null
  %73 = icmp sgt i32 %3, 0
  %or.cond3 = and i1 %73, %72
  br i1 %or.cond3, label %74, label %.loopexit

74:                                               ; preds = %.loopexit66
  %75 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.125) #6
  %76 = mul nsw i32 %3, %1
  %77 = icmp sgt i32 %76, 0
  br i1 %77, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %74
  %wide.trip.count73 = zext nneg i32 %76 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv70 = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next71, %.lr.ph ]
  %78 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.47) #6
  %79 = getelementptr inbounds ptr, ptr %4, i64 %indvars.iv70
  %80 = load ptr, ptr %79, align 8, !tbaa !8
  %81 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) %80) #6
  %82 = call ptr @strcat(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.15) #6
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %exitcond74.not = icmp eq i64 %indvars.iv.next71, %wide.trip.count73
  br i1 %exitcond74.not, label %.loopexit, label %.lr.ph, !llvm.loop !12

83:                                               ; preds = %12
  %.not43 = icmp eq ptr %0, null
  br i1 %.not43, label %103, label %84

84:                                               ; preds = %83
  %85 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) @.str.10) #7
  %.not44 = icmp eq i32 %85, 0
  br i1 %.not44, label %86, label %103

86:                                               ; preds = %84
  %87 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) @tinyfd_response, ptr noundef nonnull dereferenceable(1) @.str.177) #6
  br label %103

.loopexit:                                        ; preds = %.lr.ph, %74, %.loopexit66
  %88 = load i32, ptr @tinyfd_verbose, align 4, !tbaa !13
  %.not60 = icmp eq i32 %88, 0
  br i1 %.not60, label %91, label %89

89:                                               ; preds = %.loopexit
  %90 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef nonnull %6)
  br label %91

91:                                               ; preds = %89, %.loopexit
  %92 = call noalias ptr @popen(ptr noundef nonnull %6, ptr noundef nonnull @.str.9)
  %.not61 = icmp eq ptr %92, null
  br i1 %.not61, label %103, label %.preheader

.preheader:                                       ; preds = %91, %.preheader
  %93 = call ptr @fgets(ptr noundef nonnull @_ZZ18tinyfd_arrayDialogE5lBuff, i32 noundef 1024, ptr noundef nonnull %92)
  %.not62 = icmp eq ptr %93, null
  br i1 %.not62, label %94, label %.preheader, !llvm.loop !15

94:                                               ; preds = %.preheader
  %95 = call i32 @pclose(ptr noundef nonnull %92)
  %96 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) @_ZZ18tinyfd_arrayDialogE5lBuff) #7
  %97 = add i64 %96, -1
  %98 = getelementptr inbounds [1024 x i8], ptr @_ZZ18tinyfd_arrayDialogE5lBuff, i64 0, i64 %97
  %99 = load i8, ptr %98, align 1, !tbaa !5
  %100 = icmp eq i8 %99, 10
  br i1 %100, label %101, label %102

101:                                              ; preds = %94
  store i8 0, ptr %98, align 1, !tbaa !5
  br label %102

102:                                              ; preds = %101, %94
  %char063 = load i8, ptr @_ZZ18tinyfd_arrayDialogE5lBuff, align 16
  %.not64 = icmp eq i8 %char063, 0
  %._ZZ18tinyfd_arrayDialogE5lBuff = select i1 %.not64, ptr null, ptr @_ZZ18tinyfd_arrayDialogE5lBuff
  br label %103

103:                                              ; preds = %102, %91, %83, %84, %86, %50, %43, %34, %19
  %.033 = phi ptr [ inttoptr (i64 1 to ptr), %19 ], [ inttoptr (i64 1 to ptr), %34 ], [ inttoptr (i64 1 to ptr), %43 ], [ inttoptr (i64 1 to ptr), %50 ], [ null, %86 ], [ null, %84 ], [ null, %83 ], [ null, %91 ], [ %._ZZ18tinyfd_arrayDialogE5lBuff, %102 ]
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %6) #6
  ret ptr %.033
}

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

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !6, i64 0}
!15 = distinct !{!15, !11}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass