; LLVM IR from cruppstahl/upscaledb :: samples (db5)

; 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.ups_parameter_t = type { i32, i64 }
%struct.ups_key_t = type { i16, ptr, i32, i32 }
%struct.ups_record_t = type { i32, ptr, i32 }

@__const.main.params = external hidden unnamed_addr constant [2 x %struct.ups_parameter_t], align 16
@.str = external hidden unnamed_addr constant [121 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [42 x i8], align 1
@stdin = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local 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 [4096 x i8], align 16
  %11 = alloca i32, align 4
  %12 = alloca %struct.ups_key_t, align 8
  %13 = alloca %struct.ups_record_t, align 8
  %14 = alloca [2 x %struct.ups_parameter_t], align 16
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  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) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4096, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %14, ptr align 16 @__const.main.params, i64 32, i1 false)
  call void @llvm.memset.p0.i64(ptr align 8 %12, i8 0, i64 24, i1 false)
  call void @llvm.memset.p0.i64(ptr align 8 %13, i8 0, i64 24, i1 false)
  %18 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %19 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  %20 = call i32 @ups_env_create(ptr noundef %7, ptr noundef null, i32 noundef 128, i32 noundef 436, ptr noundef null)
  store i32 %20, ptr %6, align 4, !tbaa !5
  %21 = load i32, ptr %6, align 4, !tbaa !5
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %26

23:                                               ; preds = %2
  %24 = load i32, ptr %6, align 4, !tbaa !5
  %25 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %24)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %111

26:                                               ; preds = %2
  %27 = load ptr, ptr %7, align 8, !tbaa !9
  %28 = getelementptr inbounds [2 x %struct.ups_parameter_t], ptr %14, i64 0, i64 0
  %29 = call i32 @ups_env_create_db(ptr noundef %27, ptr noundef %8, i16 noundef zeroext 1, i32 noundef 16384, ptr noundef %28)
  store i32 %29, ptr %6, align 4, !tbaa !5
  %30 = load i32, ptr %6, align 4, !tbaa !5
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %35

32:                                               ; preds = %26
  %33 = load i32, ptr %6, align 4, !tbaa !5
  %34 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %33)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %111

35:                                               ; preds = %26
  br label %36

36:                                               ; preds = %72, %35
  %37 = getelementptr inbounds [4096 x i8], ptr %10, i64 0, i64 0
  %38 = load ptr, ptr @stdin, align 8, !tbaa !9
  %39 = call ptr @fgets(ptr noundef %37, i32 noundef 4096, ptr noundef %38)
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %73

41:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %42 = getelementptr inbounds [4096 x i8], ptr %10, i64 0, i64 0
  store ptr %42, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %43 = load i32, ptr %11, align 4, !tbaa !5
  %44 = add i32 %43, 1
  store i32 %44, ptr %11, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %67, %41
  %46 = load ptr, ptr %16, align 8, !tbaa !9
  %47 = call ptr @strtok(ptr noundef %46, ptr noundef @.str.4) #7
  store ptr %47, ptr %17, align 8, !tbaa !9
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %69

49:                                               ; preds = %45
  %50 = load ptr, ptr %17, align 8, !tbaa !9
  %51 = getelementptr inbounds %struct.ups_key_t, ptr %12, i32 0, i32 1
  store ptr %50, ptr %51, align 8, !tbaa !11
  %52 = load ptr, ptr %17, align 8, !tbaa !9
  %53 = call i64 @strlen(ptr noundef %52) #8
  %54 = trunc i64 %53 to i32
  %55 = add i32 %54, 1
  %56 = trunc i32 %55 to i16
  %57 = getelementptr inbounds %struct.ups_key_t, ptr %12, i32 0, i32 0
  store i16 %56, ptr %57, align 8, !tbaa !14
  %58 = getelementptr inbounds %struct.ups_record_t, ptr %13, i32 0, i32 1
  store ptr %11, ptr %58, align 8, !tbaa !15
  %59 = getelementptr inbounds %struct.ups_record_t, ptr %13, i32 0, i32 0
  store i32 4, ptr %59, align 8, !tbaa !17
  %60 = load ptr, ptr %8, align 8, !tbaa !9
  %61 = call i32 @ups_db_insert(ptr noundef %60, ptr noundef null, ptr noundef %12, ptr noundef %13, i32 noundef 2)
  store i32 %61, ptr %6, align 4, !tbaa !5
  %62 = load i32, ptr %6, align 4, !tbaa !5
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %64, label %67

64:                                               ; preds = %49
  %65 = load i32, ptr %6, align 4, !tbaa !5
  %66 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %65)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %70

67:                                               ; preds = %49
  %68 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  store ptr null, ptr %16, align 8, !tbaa !9
  br label %45, !llvm.loop !18

69:                                               ; preds = %45
  store i32 0, ptr %15, align 4
  br label %70

70:                                               ; preds = %69, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  %71 = load i32, ptr %15, align 4
  switch i32 %71, label %111 [
    i32 0, label %72
  ]

72:                                               ; preds = %70
  br label %36, !llvm.loop !20

73:                                               ; preds = %36
  %74 = load ptr, ptr %8, align 8, !tbaa !9
  %75 = call i32 @ups_cursor_create(ptr noundef %9, ptr noundef %74, ptr noundef null, i32 noundef 0)
  store i32 %75, ptr %6, align 4, !tbaa !5
  %76 = load i32, ptr %6, align 4, !tbaa !5
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %81

78:                                               ; preds = %73
  %79 = load i32, ptr %6, align 4, !tbaa !5
  %80 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %79)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %111

81:                                               ; preds = %73
  br label %82

82:                                               ; preds = %95, %81
  br label %83

83:                                               ; preds = %82
  %84 = load ptr, ptr %9, align 8, !tbaa !9
  %85 = call i32 @ups_cursor_move(ptr noundef %84, ptr noundef %12, ptr noundef %13, i32 noundef 4)
  store i32 %85, ptr %6, align 4, !tbaa !5
  %86 = load i32, ptr %6, align 4, !tbaa !5
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %88, label %95

88:                                               ; preds = %83
  %89 = load i32, ptr %6, align 4, !tbaa !5
  %90 = icmp eq i32 %89, -11
  br i1 %90, label %91, label %92

91:                                               ; preds = %88
  br label %102

92:                                               ; preds = %88
  %93 = load i32, ptr %6, align 4, !tbaa !5
  %94 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, i32 noundef %93)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %111

95:                                               ; preds = %83
  %96 = getelementptr inbounds %struct.ups_key_t, ptr %12, i32 0, i32 1
  %97 = load ptr, ptr %96, align 8, !tbaa !11
  %98 = getelementptr inbounds %struct.ups_record_t, ptr %13, i32 0, i32 1
  %99 = load ptr, ptr %98, align 8, !tbaa !15
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, ptr noundef %97, i32 noundef %100)
  br label %82

102:                                              ; preds = %91
  %103 = load ptr, ptr %7, align 8, !tbaa !9
  %104 = call i32 @ups_env_close(ptr noundef %103, i32 noundef 1)
  store i32 %104, ptr %6, align 4, !tbaa !5
  %105 = load i32, ptr %6, align 4, !tbaa !5
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %110

107:                                              ; preds = %102
  %108 = load i32, ptr %6, align 4, !tbaa !5
  %109 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, i32 noundef %108)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %111

110:                                              ; preds = %102
  store i32 0, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %111

111:                                              ; preds = %110, %107, %92, %78, %70, %32, %23
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4096, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %112 = load i32, ptr %3, align 4
  ret i32 %112
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

declare i32 @ups_env_create(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #4

declare i32 @ups_env_create_db(ptr noundef, ptr noundef, i16 noundef zeroext, i32 noundef, ptr noundef) #4

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

; Function Attrs: nounwind
declare ptr @strtok(ptr noundef, ptr noundef) #5

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

declare i32 @ups_db_insert(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) #4

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

declare i32 @ups_cursor_create(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #4

declare i32 @ups_cursor_move(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #4

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 "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 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 #7 = { nounwind }
attributes #8 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"", !13, i64 0, !10, i64 8, !6, i64 16, !6, i64 20}
!13 = !{!"short", !7, i64 0}
!14 = !{!12, !13, i64 0}
!15 = !{!16, !10, i64 8}
!16 = !{!"", !6, i64 0, !10, i64 8, !6, i64 16}
!17 = !{!16, !6, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}


; 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.ups_parameter_t = type { i32, i64 }
%struct.ups_key_t = type { i16, ptr, i32, i32 }
%struct.ups_record_t = type { i32, ptr, i32 }

@__const.main.params = external hidden unnamed_addr constant [2 x %struct.ups_parameter_t], align 16
@.str = external hidden unnamed_addr constant [121 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [42 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca [4096 x i8], align 16
  %7 = alloca i32, align 4
  %8 = alloca %struct.ups_key_t, align 8
  %9 = alloca %struct.ups_record_t, align 8
  %10 = alloca [2 x %struct.ups_parameter_t], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %6) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #8
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %10) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %10, ptr noundef nonnull align 16 dereferenceable(32) @__const.main.params, i64 32, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %8, i8 0, i64 24, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %9, i8 0, i64 24, i1 false)
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %13 = call i32 @ups_env_create(ptr noundef nonnull %3, ptr noundef null, i32 noundef 128, i32 noundef 436, ptr noundef null) #8
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %16, label %14

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

16:                                               ; preds = %2
  %17 = load ptr, ptr %3, align 8, !tbaa !9
  %18 = call i32 @ups_env_create_db(ptr noundef %17, ptr noundef nonnull %4, i16 noundef zeroext 1, i32 noundef 16384, ptr noundef nonnull %10) #8
  %.not26 = icmp eq i32 %18, 0
  br i1 %.not26, label %.preheader34, label %23

.preheader34:                                     ; preds = %16
  %19 = load ptr, ptr @stdin, align 8, !tbaa !9
  %20 = call ptr @fgets(ptr noundef nonnull %6, i32 noundef 4096, ptr noundef %19)
  %.not2738 = icmp eq ptr %20, null
  br i1 %.not2738, label %._crit_edge, label %.lr.ph39

.lr.ph39:                                         ; preds = %.preheader34
  %21 = getelementptr inbounds i8, ptr %8, i64 8
  %22 = getelementptr inbounds i8, ptr %9, i64 8
  br label %27

23:                                               ; preds = %16
  %24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %18)
  br label %62

.loopexit:                                        ; preds = %38, %27
  %25 = load ptr, ptr @stdin, align 8, !tbaa !9
  %26 = call ptr @fgets(ptr noundef nonnull %6, i32 noundef 4096, ptr noundef %25)
  %.not27 = icmp eq ptr %26, null
  br i1 %.not27, label %._crit_edge, label %27, !llvm.loop !11

27:                                               ; preds = %.lr.ph39, %.loopexit
  %28 = load i32, ptr %7, align 4, !tbaa !5
  %29 = add i32 %28, 1
  store i32 %29, ptr %7, align 4, !tbaa !5
  %30 = call ptr @strtok(ptr noundef nonnull %6, ptr noundef nonnull @.str.4) #8
  %.not3137 = icmp eq ptr %30, null
  br i1 %.not3137, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %27, %38
  %31 = phi ptr [ %40, %38 ], [ %30, %27 ]
  store ptr %31, ptr %21, align 8, !tbaa !13
  %32 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %31) #9
  %33 = trunc i64 %32 to i16
  %34 = add i16 %33, 1
  store i16 %34, ptr %8, align 8, !tbaa !16
  store ptr %7, ptr %22, align 8, !tbaa !17
  store i32 4, ptr %9, align 8, !tbaa !19
  %35 = load ptr, ptr %4, align 8, !tbaa !9
  %36 = call i32 @ups_db_insert(ptr noundef %35, ptr noundef null, ptr noundef nonnull %8, ptr noundef nonnull %9, i32 noundef 2) #8
  %.not32 = icmp eq i32 %36, 0
  br i1 %.not32, label %38, label %.thread

.thread:                                          ; preds = %.lr.ph
  %37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %36)
  br label %62

38:                                               ; preds = %.lr.ph
  %39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %40 = call ptr @strtok(ptr noundef null, ptr noundef nonnull @.str.4) #8
  %.not31 = icmp eq ptr %40, null
  br i1 %.not31, label %.loopexit, label %.lr.ph, !llvm.loop !20

._crit_edge:                                      ; preds = %.loopexit, %.preheader34
  %41 = load ptr, ptr %4, align 8, !tbaa !9
  %42 = call i32 @ups_cursor_create(ptr noundef nonnull %5, ptr noundef %41, ptr noundef null, i32 noundef 0) #8
  %.not28 = icmp eq i32 %42, 0
  br i1 %.not28, label %.preheader, label %45

.preheader:                                       ; preds = %._crit_edge
  %43 = getelementptr inbounds i8, ptr %8, i64 8
  %44 = getelementptr inbounds i8, ptr %9, i64 8
  br label %47

45:                                               ; preds = %._crit_edge
  %46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %42)
  br label %62

47:                                               ; preds = %.preheader, %52
  %48 = load ptr, ptr %5, align 8, !tbaa !9
  %49 = call i32 @ups_cursor_move(ptr noundef %48, ptr noundef nonnull %8, ptr noundef nonnull %9, i32 noundef 4) #8
  switch i32 %49, label %50 [
    i32 0, label %52
    i32 -11, label %57
  ]

50:                                               ; preds = %47
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %49)
  br label %62

52:                                               ; preds = %47
  %53 = load ptr, ptr %43, align 8, !tbaa !13
  %54 = load ptr, ptr %44, align 8, !tbaa !17
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, ptr noundef %53, i32 noundef %55)
  br label %47

57:                                               ; preds = %47
  %58 = load ptr, ptr %3, align 8, !tbaa !9
  %59 = call i32 @ups_env_close(ptr noundef %58, i32 noundef 1) #8
  %.not30 = icmp eq i32 %59, 0
  br i1 %.not30, label %62, label %60

60:                                               ; preds = %57
  %61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, i32 noundef %59)
  br label %62

62:                                               ; preds = %.thread, %57, %60, %50, %45, %23, %14
  %.2 = phi i32 [ -1, %14 ], [ -1, %23 ], [ -1, %45 ], [ -1, %60 ], [ -1, %50 ], [ 0, %57 ], [ -1, %.thread ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  ret i32 %.2
}

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

declare i32 @ups_env_create(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #5

declare i32 @ups_env_create_db(ptr noundef, ptr noundef, i16 noundef zeroext, i32 noundef, ptr noundef) local_unnamed_addr #5

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

; Function Attrs: mustprogress nofree nounwind willreturn
declare ptr @strtok(ptr noundef, ptr nocapture noundef readonly) local_unnamed_addr #6

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

declare i32 @ups_db_insert(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #5

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

declare i32 @ups_cursor_create(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #5

declare i32 @ups_cursor_move(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #5

declare i32 @ups_env_close(ptr noundef, i32 noundef) local_unnamed_addr #5

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { "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 = { 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 #7 = { 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 #8 = { nounwind }
attributes #9 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !10, i64 8}
!14 = !{!"", !15, i64 0, !10, i64 8, !6, i64 16, !6, i64 20}
!15 = !{!"short", !7, i64 0}
!16 = !{!14, !15, i64 0}
!17 = !{!18, !10, i64 8}
!18 = !{!"", !6, i64 0, !10, i64 8, !6, i64 16}
!19 = !{!18, !6, i64 0}
!20 = distinct !{!20, !12}


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