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

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

@.str = external hidden unnamed_addr constant [42 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [45 x i8], align 1
@stdin = external global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.12 = 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 %struct.ups_key_t, align 8
  %12 = alloca %struct.ups_record_t, align 8
  %13 = alloca [3 x %struct.ups_parameter_t], align 16
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = 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) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4096, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #6
  call void @llvm.memset.p0.i64(ptr align 8 %11, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #6
  call void @llvm.memset.p0.i64(ptr align 8 %12, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 48, ptr %13) #6
  call void @llvm.memset.p0.i64(ptr align 16 %13, i8 0, i64 48, i1 false)
  %17 = getelementptr inbounds [3 x %struct.ups_parameter_t], ptr %13, i32 0, i32 0
  %18 = getelementptr inbounds %struct.ups_parameter_t, ptr %17, i32 0, i32 0
  store i32 260, ptr %18, align 16
  %19 = getelementptr inbounds %struct.ups_parameter_t, ptr %17, i32 0, i32 1
  store i64 1, ptr %19, align 8
  %20 = getelementptr inbounds [3 x %struct.ups_parameter_t], ptr %13, i32 0, i32 1
  %21 = getelementptr inbounds %struct.ups_parameter_t, ptr %20, i32 0, i32 0
  store i32 264, ptr %21, align 16
  %22 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  %24 = call i32 @ups_env_create(ptr noundef %7, ptr noundef @.str.2, i32 noundef 0, i32 noundef 436, ptr noundef null)
  store i32 %24, ptr %6, align 4, !tbaa !5
  %25 = load i32, ptr %6, align 4, !tbaa !5
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %27, label %30

27:                                               ; preds = %2
  %28 = load i32, ptr %6, align 4, !tbaa !5
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %28)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %119

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

36:                                               ; preds = %30
  %37 = load i32, ptr %6, align 4, !tbaa !5
  %38 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %37)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %119

39:                                               ; preds = %30
  %40 = load ptr, ptr %8, align 8, !tbaa !9
  %41 = call i32 @ups_db_set_compare_func(ptr noundef %40, ptr noundef @my_string_compare)
  store i32 %41, ptr %6, align 4, !tbaa !5
  %42 = load i32, ptr %6, align 4, !tbaa !5
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %47

44:                                               ; preds = %39
  %45 = load i32, ptr %6, align 4, !tbaa !5
  %46 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %45)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %119

47:                                               ; preds = %39
  br label %48

48:                                               ; preds = %83, %47
  %49 = getelementptr inbounds [4096 x i8], ptr %10, i64 0, i64 0
  %50 = load ptr, ptr @stdin, align 8, !tbaa !9
  %51 = call ptr @fgets(ptr noundef %49, i32 noundef 4096, ptr noundef %50)
  %52 = icmp ne ptr %51, null
  br i1 %52, label %53, label %84

53:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %54 = getelementptr inbounds [4096 x i8], ptr %10, i64 0, i64 0
  store ptr %54, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  br label %55

55:                                               ; preds = %78, %53
  %56 = load ptr, ptr %15, align 8, !tbaa !9
  %57 = call ptr @strtok(ptr noundef %56, ptr noundef @.str.6) #6
  store ptr %57, ptr %16, align 8, !tbaa !9
  %58 = icmp ne ptr %57, null
  br i1 %58, label %59, label %80

59:                                               ; preds = %55
  %60 = load ptr, ptr %16, align 8, !tbaa !9
  %61 = getelementptr inbounds %struct.ups_key_t, ptr %11, i32 0, i32 1
  store ptr %60, ptr %61, align 8, !tbaa !11
  %62 = load ptr, ptr %16, align 8, !tbaa !9
  %63 = call i64 @strlen(ptr noundef %62) #7
  %64 = trunc i64 %63 to i32
  %65 = add i32 %64, 1
  %66 = trunc i32 %65 to i16
  %67 = getelementptr inbounds %struct.ups_key_t, ptr %11, i32 0, i32 0
  store i16 %66, ptr %67, align 8, !tbaa !14
  %68 = load ptr, ptr %8, align 8, !tbaa !9
  %69 = call i32 @ups_db_insert(ptr noundef %68, ptr noundef null, ptr noundef %11, ptr noundef %12, i32 noundef 0)
  store i32 %69, ptr %6, align 4, !tbaa !5
  %70 = load i32, ptr %6, align 4, !tbaa !5
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %78

72:                                               ; preds = %59
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = icmp ne i32 %73, -12
  br i1 %74, label %75, label %78

75:                                               ; preds = %72
  %76 = load i32, ptr %6, align 4, !tbaa !5
  %77 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %76)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %81

78:                                               ; preds = %72, %59
  %79 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  store ptr null, ptr %15, align 8, !tbaa !9
  br label %55, !llvm.loop !15

80:                                               ; preds = %55
  store i32 0, ptr %14, align 4
  br label %81

81:                                               ; preds = %80, %75
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  %82 = load i32, ptr %14, align 4
  switch i32 %82, label %119 [
    i32 0, label %83
  ]

83:                                               ; preds = %81
  br label %48, !llvm.loop !17

84:                                               ; preds = %48
  %85 = load ptr, ptr %8, align 8, !tbaa !9
  %86 = call i32 @ups_cursor_create(ptr noundef %9, ptr noundef %85, ptr noundef null, i32 noundef 0)
  store i32 %86, ptr %6, align 4, !tbaa !5
  %87 = load i32, ptr %6, align 4, !tbaa !5
  %88 = icmp ne i32 %87, 0
  br i1 %88, label %89, label %92

89:                                               ; preds = %84
  %90 = load i32, ptr %6, align 4, !tbaa !5
  %91 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, i32 noundef %90)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %119

92:                                               ; preds = %84
  br label %93

93:                                               ; preds = %106, %92
  br label %94

94:                                               ; preds = %93
  %95 = load ptr, ptr %9, align 8, !tbaa !9
  %96 = call i32 @ups_cursor_move(ptr noundef %95, ptr noundef %11, ptr noundef %12, i32 noundef 4)
  store i32 %96, ptr %6, align 4, !tbaa !5
  %97 = load i32, ptr %6, align 4, !tbaa !5
  %98 = icmp ne i32 %97, 0
  br i1 %98, label %99, label %106

99:                                               ; preds = %94
  %100 = load i32, ptr %6, align 4, !tbaa !5
  %101 = icmp eq i32 %100, -11
  br i1 %101, label %102, label %103

102:                                              ; preds = %99
  br label %110

103:                                              ; preds = %99
  %104 = load i32, ptr %6, align 4, !tbaa !5
  %105 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, i32 noundef %104)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %119

106:                                              ; preds = %94
  %107 = getelementptr inbounds %struct.ups_key_t, ptr %11, i32 0, i32 1
  %108 = load ptr, ptr %107, align 8, !tbaa !11
  %109 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, ptr noundef %108)
  br label %93

110:                                              ; preds = %102
  %111 = load ptr, ptr %7, align 8, !tbaa !9
  %112 = call i32 @ups_env_close(ptr noundef %111, i32 noundef 1)
  store i32 %112, ptr %6, align 4, !tbaa !5
  %113 = load i32, ptr %6, align 4, !tbaa !5
  %114 = icmp ne i32 %113, 0
  br i1 %114, label %115, label %118

115:                                              ; preds = %110
  %116 = load i32, ptr %6, align 4, !tbaa !5
  %117 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, i32 noundef %116)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %119

118:                                              ; preds = %110
  store i32 0, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %119

119:                                              ; preds = %118, %115, %103, %89, %81, %44, %36, %27
  call void @llvm.lifetime.end.p0(i64 48, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4096, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %120 = load i32, ptr %3, align 4
  ret i32 %120
}

; 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: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @my_string_compare(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) #0

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

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

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

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

; 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) #3

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

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

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


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

@.str = external hidden unnamed_addr constant [42 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [45 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.12 = 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 %struct.ups_key_t, align 8
  %8 = alloca %struct.ups_record_t, align 8
  %9 = alloca [3 x %struct.ups_parameter_t], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %7, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %8, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %9) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %9, i8 0, i64 48, i1 false)
  store i32 260, ptr %9, align 16
  %10 = getelementptr inbounds i8, ptr %9, i64 8
  store i64 1, ptr %10, align 8
  %11 = getelementptr inbounds i8, ptr %9, i64 16
  store i32 264, ptr %11, align 16
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %14 = call i32 @ups_env_create(ptr noundef nonnull %3, ptr noundef nonnull @.str.2, i32 noundef 0, i32 noundef 436, ptr noundef null) #7
  %.not = icmp eq i32 %14, 0
  br i1 %.not, label %17, label %15

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

17:                                               ; preds = %2
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = call i32 @ups_env_create_db(ptr noundef %18, ptr noundef nonnull %4, i16 noundef zeroext 1, i32 noundef 16384, ptr noundef nonnull %9) #7
  %.not31 = icmp eq i32 %19, 0
  br i1 %.not31, label %22, label %20

20:                                               ; preds = %17
  %21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %19)
  br label %61

22:                                               ; preds = %17
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = call i32 @ups_db_set_compare_func(ptr noundef %23, ptr noundef nonnull @my_string_compare) #7
  %.not32 = icmp eq i32 %24, 0
  br i1 %.not32, label %.preheader40, label %28

.preheader40:                                     ; preds = %22
  %25 = load ptr, ptr @stdin, align 8, !tbaa !5
  %26 = call ptr @fgets(ptr noundef nonnull %6, i32 noundef 4096, ptr noundef %25)
  %.not3344 = icmp eq ptr %26, null
  br i1 %.not3344, label %._crit_edge, label %.preheader39.lr.ph

.preheader39.lr.ph:                               ; preds = %.preheader40
  %27 = getelementptr inbounds i8, ptr %7, i64 8
  br label %.preheader39

28:                                               ; preds = %22
  %29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %24)
  br label %61

.loopexit:                                        ; preds = %40, %.preheader39
  %30 = load ptr, ptr @stdin, align 8, !tbaa !5
  %31 = call ptr @fgets(ptr noundef nonnull %6, i32 noundef 4096, ptr noundef %30)
  %.not33 = icmp eq ptr %31, null
  br i1 %.not33, label %._crit_edge, label %.preheader39, !llvm.loop !9

.preheader39:                                     ; preds = %.preheader39.lr.ph, %.loopexit
  %32 = call ptr @strtok(ptr noundef nonnull %6, ptr noundef nonnull @.str.6) #7
  %.not3743 = icmp eq ptr %32, null
  br i1 %.not3743, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader39, %40
  %33 = phi ptr [ %42, %40 ], [ %32, %.preheader39 ]
  store ptr %33, ptr %27, align 8, !tbaa !11
  %34 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %33) #8
  %35 = trunc i64 %34 to i16
  %36 = add i16 %35, 1
  store i16 %36, ptr %7, align 8, !tbaa !15
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = call i32 @ups_db_insert(ptr noundef %37, ptr noundef null, ptr noundef nonnull %7, ptr noundef nonnull %8, i32 noundef 0) #7
  switch i32 %38, label %.thread [
    i32 -12, label %40
    i32 0, label %40
  ]

.thread:                                          ; preds = %.lr.ph
  %39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %38)
  br label %61

40:                                               ; preds = %.lr.ph, %.lr.ph
  %41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  %42 = call ptr @strtok(ptr noundef null, ptr noundef nonnull @.str.6) #7
  %.not37 = icmp eq ptr %42, null
  br i1 %.not37, label %.loopexit, label %.lr.ph, !llvm.loop !16

._crit_edge:                                      ; preds = %.loopexit, %.preheader40
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = call i32 @ups_cursor_create(ptr noundef nonnull %5, ptr noundef %43, ptr noundef null, i32 noundef 0) #7
  %.not34 = icmp eq i32 %44, 0
  br i1 %.not34, label %.preheader, label %46

.preheader:                                       ; preds = %._crit_edge
  %45 = getelementptr inbounds i8, ptr %7, i64 8
  br label %48

46:                                               ; preds = %._crit_edge
  %47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, i32 noundef %44)
  br label %61

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

51:                                               ; preds = %48
  %52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, i32 noundef %50)
  br label %61

53:                                               ; preds = %48
  %54 = load ptr, ptr %45, align 8, !tbaa !11
  %55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, ptr noundef %54)
  br label %48

56:                                               ; preds = %48
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = call i32 @ups_env_close(ptr noundef %57, i32 noundef 1) #7
  %.not36 = icmp eq i32 %58, 0
  br i1 %.not36, label %61, label %59

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

61:                                               ; preds = %.thread, %56, %59, %51, %46, %28, %20, %15
  %.2 = phi i32 [ -1, %15 ], [ -1, %20 ], [ -1, %28 ], [ -1, %46 ], [ -1, %59 ], [ -1, %51 ], [ 0, %56 ], [ -1, %.thread ]
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  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: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

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

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

declare i32 @ups_db_set_compare_func(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare hidden i32 @my_string_compare(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) #0

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

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

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

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

; 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 #4

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

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


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