; LLVM IR from cruppstahl/upscaledb :: tools (ups_info)

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

@.str = external hidden unnamed_addr constant [9 x i8], align 1
@_ZL4opts = external hidden global [6 x %struct.option_t], align 16
@.str.1 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [55 x i8], align 1
@_ZL5quiet = external hidden global i8, align 1
@.str.3 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [14 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i16, align 2
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca [1024 x i16], align 16
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store ptr null, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store ptr null, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2, ptr %10) #5
  store i16 -1, ptr %10, align 2, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2048, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 1024, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = load ptr, ptr %5, align 8, !tbaa !9
  call void @getopts_init(i32 noundef %20, ptr noundef %21, ptr noundef @.str)
  br label %22

22:                                               ; preds = %65, %2
  %23 = call i32 @getopts(ptr noundef @_ZL4opts, ptr noundef %7)
  store i32 %23, ptr %6, align 4, !tbaa !5
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %66

25:                                               ; preds = %22
  %26 = load i32, ptr %6, align 4, !tbaa !5
  switch i32 %26, label %62 [
    i32 2, label %27
    i32 3, label %45
    i32 4, label %46
    i32 5, label %47
    i32 -5, label %48
    i32 1, label %55
  ]

27:                                               ; preds = %25
  %28 = load ptr, ptr %7, align 8, !tbaa !9
  %29 = icmp ne ptr %28, null
  br i1 %29, label %32, label %30

30:                                               ; preds = %27
  %31 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %173

32:                                               ; preds = %27
  %33 = load ptr, ptr %7, align 8, !tbaa !9
  %34 = call i64 @strtoul(ptr noundef %33, ptr noundef %9, i32 noundef 0) #5
  %35 = trunc i64 %34 to i16
  store i16 %35, ptr %10, align 2, !tbaa !11
  %36 = load ptr, ptr %9, align 8, !tbaa !9
  %37 = icmp ne ptr %36, null
  br i1 %37, label %38, label %44

38:                                               ; preds = %32
  %39 = load ptr, ptr %9, align 8, !tbaa !9
  %40 = load i8, ptr %39, align 1, !tbaa !13
  %41 = icmp ne i8 %40, 0
  br i1 %41, label %42, label %44

42:                                               ; preds = %38
  %43 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %173

44:                                               ; preds = %38, %32
  br label %65

45:                                               ; preds = %25
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %65

46:                                               ; preds = %25
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %65

47:                                               ; preds = %25
  store i8 1, ptr @_ZL5quiet, align 1, !tbaa !14
  br label %65

48:                                               ; preds = %25
  %49 = load ptr, ptr %8, align 8, !tbaa !9
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %53

51:                                               ; preds = %48
  %52 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %173

53:                                               ; preds = %48
  %54 = load ptr, ptr %7, align 8, !tbaa !9
  store ptr %54, ptr %8, align 8, !tbaa !9
  br label %65

55:                                               ; preds = %25
  call void @print_banner(ptr noundef @.str)
  %56 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  %57 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  %58 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %59 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  %60 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  %61 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %173

62:                                               ; preds = %25
  %63 = load ptr, ptr %7, align 8, !tbaa !9
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, ptr noundef %63)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %173

65:                                               ; preds = %53, %47, %46, %45, %44
  br label %22, !llvm.loop !16

66:                                               ; preds = %22
  %67 = load ptr, ptr %8, align 8, !tbaa !9
  %68 = icmp ne ptr %67, null
  br i1 %68, label %71, label %69

69:                                               ; preds = %66
  %70 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %173

71:                                               ; preds = %66
  %72 = load ptr, ptr %8, align 8, !tbaa !9
  %73 = call i32 @ups_env_open(ptr noundef %17, ptr noundef %72, i32 noundef 6, ptr noundef null)
  store i32 %73, ptr %16, align 4, !tbaa !5
  %74 = load i32, ptr %16, align 4, !tbaa !5
  %75 = icmp eq i32 %74, -21
  br i1 %75, label %76, label %79

76:                                               ; preds = %71
  %77 = load ptr, ptr %8, align 8, !tbaa !9
  %78 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, ptr noundef %77)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %173

79:                                               ; preds = %71
  %80 = load i32, ptr %16, align 4, !tbaa !5
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %82, label %84

82:                                               ; preds = %79
  %83 = load i32, ptr %16, align 4, !tbaa !5
  call void @_ZL5errorPKci(ptr noundef @.str.13, i32 noundef %83)
  br label %84

84:                                               ; preds = %82, %79
  br label %85

85:                                               ; preds = %84
  %86 = load ptr, ptr %17, align 8, !tbaa !9
  call void @_ZL17print_environmentP9ups_env_t(ptr noundef %86)
  %87 = load ptr, ptr %17, align 8, !tbaa !9
  %88 = getelementptr inbounds [1024 x i16], ptr %13, i64 0, i64 0
  %89 = call i32 @ups_env_get_database_names(ptr noundef %87, ptr noundef %88, ptr noundef %15)
  store i32 %89, ptr %16, align 4, !tbaa !5
  %90 = load i32, ptr %16, align 4, !tbaa !5
  %91 = icmp ne i32 %90, 0
  br i1 %91, label %92, label %94

92:                                               ; preds = %85
  %93 = load i32, ptr %16, align 4, !tbaa !5
  call void @_ZL5errorPKci(ptr noundef @.str.14, i32 noundef %93)
  br label %94

94:                                               ; preds = %92, %85
  %95 = load i16, ptr %10, align 2, !tbaa !11
  %96 = zext i16 %95 to i32
  %97 = icmp ne i32 %96, 65535
  br i1 %97, label %98, label %129

98:                                               ; preds = %94
  %99 = load ptr, ptr %17, align 8, !tbaa !9
  %100 = load i16, ptr %10, align 2, !tbaa !11
  %101 = call i32 @ups_env_open_db(ptr noundef %99, ptr noundef %18, i16 noundef zeroext %100, i32 noundef 0, ptr noundef null)
  store i32 %101, ptr %16, align 4, !tbaa !5
  %102 = load i32, ptr %16, align 4, !tbaa !5
  %103 = icmp eq i32 %102, -200
  br i1 %103, label %104, label %110

104:                                              ; preds = %98
  %105 = load i16, ptr %10, align 2, !tbaa !11
  %106 = zext i16 %105 to i32
  %107 = load i16, ptr %10, align 2, !tbaa !11
  %108 = zext i16 %107 to i32
  %109 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, i32 noundef %106, i32 noundef %108)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %173

110:                                              ; preds = %98
  %111 = load i32, ptr %16, align 4, !tbaa !5
  %112 = icmp ne i32 %111, 0
  br i1 %112, label %113, label %115

113:                                              ; preds = %110
  %114 = load i32, ptr %16, align 4, !tbaa !5
  call void @_ZL5errorPKci(ptr noundef @.str.16, i32 noundef %114)
  br label %115

115:                                              ; preds = %113, %110
  br label %116

116:                                              ; preds = %115
  %117 = load ptr, ptr %17, align 8, !tbaa !9
  %118 = load ptr, ptr %18, align 8, !tbaa !9
  %119 = load i16, ptr %10, align 2, !tbaa !11
  %120 = load i32, ptr %11, align 4, !tbaa !5
  %121 = load i32, ptr %12, align 4, !tbaa !5
  call void @_ZL14print_databaseP9ups_env_tP8ups_db_ttii(ptr noundef %117, ptr noundef %118, i16 noundef zeroext %119, i32 noundef %120, i32 noundef %121)
  %122 = load ptr, ptr %18, align 8, !tbaa !9
  %123 = call i32 @ups_db_close(ptr noundef %122, i32 noundef 0)
  store i32 %123, ptr %16, align 4, !tbaa !5
  %124 = load i32, ptr %16, align 4, !tbaa !5
  %125 = icmp ne i32 %124, 0
  br i1 %125, label %126, label %128

126:                                              ; preds = %116
  %127 = load i32, ptr %16, align 4, !tbaa !5
  call void @_ZL5errorPKci(ptr noundef @.str.17, i32 noundef %127)
  br label %128

128:                                              ; preds = %126, %116
  br label %165

129:                                              ; preds = %94
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %130

130:                                              ; preds = %161, %129
  %131 = load i32, ptr %14, align 4, !tbaa !5
  %132 = load i32, ptr %15, align 4, !tbaa !5
  %133 = icmp ult i32 %131, %132
  br i1 %133, label %134, label %164

134:                                              ; preds = %130
  %135 = load ptr, ptr %17, align 8, !tbaa !9
  %136 = load i32, ptr %14, align 4, !tbaa !5
  %137 = zext i32 %136 to i64
  %138 = getelementptr inbounds [1024 x i16], ptr %13, i64 0, i64 %137
  %139 = load i16, ptr %138, align 2, !tbaa !11
  %140 = call i32 @ups_env_open_db(ptr noundef %135, ptr noundef %18, i16 noundef zeroext %139, i32 noundef 0, ptr noundef null)
  store i32 %140, ptr %16, align 4, !tbaa !5
  %141 = load i32, ptr %16, align 4, !tbaa !5
  %142 = icmp ne i32 %141, 0
  br i1 %142, label %143, label %145

143:                                              ; preds = %134
  %144 = load i32, ptr %16, align 4, !tbaa !5
  call void @_ZL5errorPKci(ptr noundef @.str.16, i32 noundef %144)
  br label %145

145:                                              ; preds = %143, %134
  %146 = load ptr, ptr %17, align 8, !tbaa !9
  %147 = load ptr, ptr %18, align 8, !tbaa !9
  %148 = load i32, ptr %14, align 4, !tbaa !5
  %149 = zext i32 %148 to i64
  %150 = getelementptr inbounds [1024 x i16], ptr %13, i64 0, i64 %149
  %151 = load i16, ptr %150, align 2, !tbaa !11
  %152 = load i32, ptr %11, align 4, !tbaa !5
  %153 = load i32, ptr %12, align 4, !tbaa !5
  call void @_ZL14print_databaseP9ups_env_tP8ups_db_ttii(ptr noundef %146, ptr noundef %147, i16 noundef zeroext %151, i32 noundef %152, i32 noundef %153)
  %154 = load ptr, ptr %18, align 8, !tbaa !9
  %155 = call i32 @ups_db_close(ptr noundef %154, i32 noundef 0)
  store i32 %155, ptr %16, align 4, !tbaa !5
  %156 = load i32, ptr %16, align 4, !tbaa !5
  %157 = icmp ne i32 %156, 0
  br i1 %157, label %158, label %160

158:                                              ; preds = %145
  %159 = load i32, ptr %16, align 4, !tbaa !5
  call void @_ZL5errorPKci(ptr noundef @.str.17, i32 noundef %159)
  br label %160

160:                                              ; preds = %158, %145
  br label %161

161:                                              ; preds = %160
  %162 = load i32, ptr %14, align 4, !tbaa !5
  %163 = add i32 %162, 1
  store i32 %163, ptr %14, align 4, !tbaa !5
  br label %130, !llvm.loop !18

164:                                              ; preds = %130
  br label %165

165:                                              ; preds = %164, %128
  %166 = load ptr, ptr %17, align 8, !tbaa !9
  %167 = call i32 @ups_env_close(ptr noundef %166, i32 noundef 0)
  store i32 %167, ptr %16, align 4, !tbaa !5
  %168 = load i32, ptr %16, align 4, !tbaa !5
  %169 = icmp ne i32 %168, 0
  br i1 %169, label %170, label %172

170:                                              ; preds = %165
  %171 = load i32, ptr %16, align 4, !tbaa !5
  call void @_ZL5errorPKci(ptr noundef @.str.18, i32 noundef %171)
  br label %172

172:                                              ; preds = %170, %165
  store i32 0, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %173

173:                                              ; preds = %172, %104, %76, %69, %62, %55, %51, %42, %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 2048, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 2, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %174 = load i32, ptr %3, align 4
  ret i32 %174
}

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

declare void @getopts_init(i32 noundef, ptr noundef, ptr noundef) #2

declare i32 @getopts(ptr noundef, ptr noundef) #2

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

; Function Attrs: nounwind
declare i64 @strtoul(ptr noundef, ptr noundef, i32 noundef) #3

declare void @print_banner(ptr noundef) #2

declare i32 @ups_env_open(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL5errorPKci(ptr noundef, i32 noundef) #4

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL17print_environmentP9ups_env_t(ptr noundef) #4

declare i32 @ups_env_get_database_names(ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @ups_env_open_db(ptr noundef, ptr noundef, i16 noundef zeroext, i32 noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL14print_databaseP9ups_env_tP8ups_db_ttii(ptr noundef, ptr noundef, i16 noundef zeroext, i32 noundef, i32 noundef) #4

declare i32 @ups_db_close(ptr noundef, i32 noundef) #2

declare i32 @ups_env_close(ptr noundef, i32 noundef) #2

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

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

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.option_t = type { i32, ptr, ptr, ptr, i32 }

@.str = external hidden unnamed_addr constant [9 x i8], align 1
@_ZL4opts = external hidden global [6 x %struct.option_t], align 16
@.str.1 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [55 x i8], align 1
@_ZL5quiet = external hidden local_unnamed_addr global i8, align 1
@.str.3 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [14 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef range(i32 -1, 1) i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [1024 x i16], align 16
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  store ptr null, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  store i32 1024, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  tail call void @getopts_init(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str)
  br label %.outer

.outer:                                           ; preds = %28, %2
  %.041.ph = phi ptr [ %29, %28 ], [ null, %2 ]
  %.039.ph = phi i16 [ %.039.ph151, %28 ], [ -1, %2 ]
  %.037.ph = phi i32 [ %.037.ph155, %28 ], [ 0, %2 ]
  %.036.ph = phi i32 [ %.036.ph158, %28 ], [ 0, %2 ]
  br label %.outer150

.outer150:                                        ; preds = %.outer150.backedge, %.outer
  %.039.ph151 = phi i16 [ %.039.ph, %.outer ], [ %17, %.outer150.backedge ]
  %.037.ph152 = phi i32 [ %.037.ph, %.outer ], [ %.037.ph155, %.outer150.backedge ]
  %.036.ph153 = phi i32 [ %.036.ph, %.outer ], [ %.036.ph158, %.outer150.backedge ]
  br label %.outer154

.outer154:                                        ; preds = %9, %.outer150
  %.037.ph155 = phi i32 [ %.037.ph152, %.outer150 ], [ 1, %9 ]
  %.036.ph156 = phi i32 [ %.036.ph153, %.outer150 ], [ %.036.ph158, %9 ]
  br label %.outer157

.outer157:                                        ; preds = %.outer154, %23
  %.036.ph158 = phi i32 [ %.036.ph156, %.outer154 ], [ 1, %23 ]
  br label %9

9:                                                ; preds = %.outer157, %24
  %10 = call i32 @getopts(ptr noundef nonnull @_ZL4opts, ptr noundef nonnull %3)
  switch i32 %10, label %37 [
    i32 0, label %40
    i32 2, label %11
    i32 3, label %.outer154
    i32 4, label %23
    i32 5, label %24
    i32 -5, label %25
    i32 1, label %30
  ], !llvm.loop !11

11:                                               ; preds = %9
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %.not65 = icmp eq ptr %12, null
  br i1 %.not65, label %13, label %15

13:                                               ; preds = %11
  %14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %87

15:                                               ; preds = %11
  %16 = call i64 @strtoul(ptr noundef nonnull %12, ptr noundef nonnull %4, i32 noundef 0) #6
  %17 = trunc i64 %16 to i16
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %.not66 = icmp eq ptr %18, null
  br i1 %.not66, label %.outer150.backedge, label %19

19:                                               ; preds = %15
  %20 = load i8, ptr %18, align 1, !tbaa !13
  %.not67 = icmp eq i8 %20, 0
  br i1 %.not67, label %.outer150.backedge, label %21

.outer150.backedge:                               ; preds = %19, %15
  br label %.outer150, !llvm.loop !11

21:                                               ; preds = %19
  %22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %87

23:                                               ; preds = %9
  br label %.outer157, !llvm.loop !11

24:                                               ; preds = %9
  store i8 1, ptr @_ZL5quiet, align 1, !tbaa !14
  br label %9, !llvm.loop !11

25:                                               ; preds = %9
  %.not64 = icmp eq ptr %.041.ph, null
  br i1 %.not64, label %28, label %26

26:                                               ; preds = %25
  %27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %87

28:                                               ; preds = %25
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  br label %.outer, !llvm.loop !11

30:                                               ; preds = %9
  call void @print_banner(ptr noundef nonnull @.str)
  %31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  %32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  %33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  %35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  %36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  br label %87

37:                                               ; preds = %9
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, ptr noundef %38)
  br label %87

40:                                               ; preds = %9
  %.not55 = icmp eq ptr %.041.ph, null
  br i1 %.not55, label %41, label %43

41:                                               ; preds = %40
  %42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  br label %87

43:                                               ; preds = %40
  %44 = call i32 @ups_env_open(ptr noundef nonnull %7, ptr noundef nonnull %.041.ph, i32 noundef 6, ptr noundef null)
  switch i32 %44, label %47 [
    i32 -21, label %45
    i32 0, label %48
  ]

45:                                               ; preds = %43
  %46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, ptr noundef nonnull %.041.ph)
  br label %87

47:                                               ; preds = %43
  call void @_ZL5errorPKci(ptr noundef nonnull @.str.13, i32 noundef %44)
  br label %48

48:                                               ; preds = %43, %47
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZL17print_environmentP9ups_env_t(ptr noundef %49)
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = call i32 @ups_env_get_database_names(ptr noundef %50, ptr noundef nonnull %5, ptr noundef nonnull %6)
  %.not57 = icmp eq i32 %51, 0
  br i1 %.not57, label %53, label %52

52:                                               ; preds = %48
  call void @_ZL5errorPKci(ptr noundef nonnull @.str.14, i32 noundef %51)
  br label %53

53:                                               ; preds = %52, %48
  %54 = zext i16 %.039.ph151 to i32
  %.not58 = icmp eq i16 %.039.ph151, -1
  br i1 %.not58, label %.preheader, label %56

.preheader:                                       ; preds = %53
  %55 = load i32, ptr %6, align 4, !tbaa !9
  %.not = icmp eq i32 %55, 0
  br i1 %.not, label %.loopexit, label %.lr.ph

56:                                               ; preds = %53
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = call i32 @ups_env_open_db(ptr noundef %57, ptr noundef nonnull %8, i16 noundef zeroext %.039.ph151, i32 noundef 0, ptr noundef null)
  switch i32 %58, label %61 [
    i32 -200, label %59
    i32 0, label %62
  ]

59:                                               ; preds = %56
  %60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, i32 noundef %54, i32 noundef %54)
  br label %87

61:                                               ; preds = %56
  call void @_ZL5errorPKci(ptr noundef nonnull @.str.16, i32 noundef %58)
  br label %62

62:                                               ; preds = %56, %61
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZL14print_databaseP9ups_env_tP8ups_db_ttii(ptr noundef %63, ptr noundef %64, i16 noundef zeroext %.039.ph151, i32 noundef %.037.ph155, i32 noundef %.036.ph158)
  %65 = load ptr, ptr %8, align 8, !tbaa !5
  %66 = call i32 @ups_db_close(ptr noundef %65, i32 noundef 0)
  %.not62 = icmp eq i32 %66, 0
  br i1 %.not62, label %.loopexit, label %67

67:                                               ; preds = %62
  call void @_ZL5errorPKci(ptr noundef nonnull @.str.17, i32 noundef %66)
  br label %.loopexit

.lr.ph:                                           ; preds = %.preheader, %80
  %indvars.iv = phi i64 [ %indvars.iv.next, %80 ], [ 0, %.preheader ]
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  %69 = getelementptr inbounds [1024 x i16], ptr %5, i64 0, i64 %indvars.iv
  %70 = load i16, ptr %69, align 2, !tbaa !16
  %71 = call i32 @ups_env_open_db(ptr noundef %68, ptr noundef nonnull %8, i16 noundef zeroext %70, i32 noundef 0, ptr noundef null)
  %.not59 = icmp eq i32 %71, 0
  br i1 %.not59, label %73, label %72

72:                                               ; preds = %.lr.ph
  call void @_ZL5errorPKci(ptr noundef nonnull @.str.16, i32 noundef %71)
  br label %73

73:                                               ; preds = %72, %.lr.ph
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = load ptr, ptr %8, align 8, !tbaa !5
  %76 = load i16, ptr %69, align 2, !tbaa !16
  call void @_ZL14print_databaseP9ups_env_tP8ups_db_ttii(ptr noundef %74, ptr noundef %75, i16 noundef zeroext %76, i32 noundef %.037.ph155, i32 noundef %.036.ph158)
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = call i32 @ups_db_close(ptr noundef %77, i32 noundef 0)
  %.not60 = icmp eq i32 %78, 0
  br i1 %.not60, label %80, label %79

79:                                               ; preds = %73
  call void @_ZL5errorPKci(ptr noundef nonnull @.str.17, i32 noundef %78)
  br label %80

80:                                               ; preds = %73, %79
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %81 = load i32, ptr %6, align 4, !tbaa !9
  %82 = zext i32 %81 to i64
  %83 = icmp ult i64 %indvars.iv.next, %82
  br i1 %83, label %.lr.ph, label %.loopexit, !llvm.loop !18

.loopexit:                                        ; preds = %80, %.preheader, %62, %67
  %84 = load ptr, ptr %7, align 8, !tbaa !5
  %85 = call i32 @ups_env_close(ptr noundef %84, i32 noundef 0)
  %.not63 = icmp eq i32 %85, 0
  br i1 %.not63, label %87, label %86

86:                                               ; preds = %.loopexit
  call void @_ZL5errorPKci(ptr noundef nonnull @.str.18, i32 noundef %85)
  br label %87

87:                                               ; preds = %.loopexit, %86, %59, %45, %41, %37, %30, %26, %21, %13
  %.043 = phi i32 [ -1, %37 ], [ 0, %30 ], [ -1, %26 ], [ -1, %21 ], [ -1, %13 ], [ -1, %45 ], [ -1, %59 ], [ -1, %41 ], [ 0, %86 ], [ 0, %.loopexit ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  ret i32 %.043
}

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

declare void @getopts_init(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @getopts(ptr noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtoul(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4

declare void @print_banner(ptr noundef) local_unnamed_addr #2

declare i32 @ups_env_open(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL5errorPKci(ptr noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL17print_environmentP9ups_env_t(ptr noundef) local_unnamed_addr #5

declare i32 @ups_env_get_database_names(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @ups_env_open_db(ptr noundef, ptr noundef, i16 noundef zeroext, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL14print_databaseP9ups_env_tP8ups_db_ttii(ptr noundef, ptr noundef, i16 noundef zeroext, i32 noundef, i32 noundef) local_unnamed_addr #5

declare i32 @ups_db_close(ptr noundef, i32 noundef) local_unnamed_addr #2

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress 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 #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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"short", !7, i64 0}
!18 = distinct !{!18, !12}


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