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

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

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

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

25:                                               ; preds = %2
  %26 = load ptr, ptr %7, align 8, !tbaa !9
  %27 = call i32 @ups_env_create_db(ptr noundef %26, ptr noundef %8, i16 noundef zeroext 1, i32 noundef 4096, ptr noundef null)
  store i32 %27, ptr %6, align 4, !tbaa !5
  %28 = load i32, ptr %6, align 4, !tbaa !5
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %33

30:                                               ; preds = %25
  %31 = load i32, ptr %6, align 4, !tbaa !5
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %31)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %113

33:                                               ; preds = %25
  br label %34

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

39:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %40 = getelementptr inbounds [4096 x i8], ptr %10, i64 0, i64 0
  store ptr %40, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  br label %41

41:                                               ; preds = %70, %39
  %42 = load ptr, ptr %14, align 8, !tbaa !9
  %43 = call ptr @strtok(ptr noundef %42, ptr noundef @.str.5) #6
  store ptr %43, ptr %15, align 8, !tbaa !9
  %44 = icmp ne ptr %43, null
  br i1 %44, label %45, label %71

45:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %46 = getelementptr inbounds %struct.ups_key_t, ptr %11, i32 0, i32 2
  store i32 1, ptr %46, align 8, !tbaa !11
  %47 = getelementptr inbounds %struct.ups_key_t, ptr %11, i32 0, i32 1
  store ptr %16, ptr %47, align 8, !tbaa !14
  %48 = getelementptr inbounds %struct.ups_key_t, ptr %11, i32 0, i32 0
  store i16 4, ptr %48, align 8, !tbaa !15
  %49 = load ptr, ptr %15, align 8, !tbaa !9
  %50 = getelementptr inbounds %struct.ups_record_t, ptr %12, i32 0, i32 1
  store ptr %49, ptr %50, align 8, !tbaa !16
  %51 = load ptr, ptr %15, align 8, !tbaa !9
  %52 = call i64 @strlen(ptr noundef %51) #7
  %53 = trunc i64 %52 to i32
  %54 = add i32 %53, 1
  %55 = getelementptr inbounds %struct.ups_record_t, ptr %12, i32 0, i32 0
  store i32 %54, ptr %55, align 8, !tbaa !18
  %56 = load ptr, ptr %8, align 8, !tbaa !9
  %57 = call i32 @ups_db_insert(ptr noundef %56, ptr noundef null, ptr noundef %11, ptr noundef %12, i32 noundef 0)
  store i32 %57, ptr %6, align 4, !tbaa !5
  %58 = load i32, ptr %6, align 4, !tbaa !5
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %66

60:                                               ; preds = %45
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = icmp ne i32 %61, -12
  br i1 %62, label %63, label %66

63:                                               ; preds = %60
  %64 = load i32, ptr %6, align 4, !tbaa !5
  %65 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %64)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %68

66:                                               ; preds = %60, %45
  %67 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  store ptr null, ptr %14, align 8, !tbaa !9
  store i32 0, ptr %13, align 4
  br label %68

68:                                               ; preds = %66, %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  %69 = load i32, ptr %13, align 4
  switch i32 %69, label %72 [
    i32 0, label %70
  ]

70:                                               ; preds = %68
  br label %41, !llvm.loop !19

71:                                               ; preds = %41
  store i32 0, ptr %13, align 4
  br label %72

72:                                               ; preds = %71, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  %73 = load i32, ptr %13, align 4
  switch i32 %73, label %113 [
    i32 0, label %74
  ]

74:                                               ; preds = %72
  br label %34, !llvm.loop !21

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

80:                                               ; preds = %75
  %81 = load i32, ptr %6, align 4, !tbaa !5
  %82 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, i32 noundef %81)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %113

83:                                               ; preds = %75
  call void @llvm.memset.p0.i64(ptr align 8 %11, i8 0, i64 24, i1 false)
  br label %84

84:                                               ; preds = %97, %83
  br label %85

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

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

93:                                               ; preds = %90
  br label %104

94:                                               ; preds = %90
  %95 = load i32, ptr %6, align 4, !tbaa !5
  %96 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, i32 noundef %95)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %113

97:                                               ; preds = %85
  %98 = getelementptr inbounds %struct.ups_key_t, ptr %11, i32 0, i32 1
  %99 = load ptr, ptr %98, align 8, !tbaa !14
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = getelementptr inbounds %struct.ups_record_t, ptr %12, i32 0, i32 1
  %102 = load ptr, ptr %101, align 8, !tbaa !16
  %103 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, i32 noundef %100, ptr noundef %102)
  br label %84

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

109:                                              ; preds = %104
  %110 = load i32, ptr %6, align 4, !tbaa !5
  %111 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, i32 noundef %110)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %113

112:                                              ; preds = %104
  store i32 0, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %113

113:                                              ; preds = %112, %109, %94, %80, %72, %30, %22
  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
  %114 = load i32, ptr %3, align 4
  ret i32 %114
}

; 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 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, !6, i64 16}
!12 = !{!"", !13, i64 0, !10, i64 8, !6, i64 16, !6, i64 20}
!13 = !{!"short", !7, i64 0}
!14 = !{!12, !10, i64 8}
!15 = !{!12, !13, i64 0}
!16 = !{!17, !10, i64 8}
!17 = !{!"", !6, i64 0, !10, i64 8, !6, i64 16}
!18 = !{!17, !6, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}


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

%struct.ups_key_t = type { i16, ptr, i32, i32 }
%struct.ups_record_t = type { i32, ptr, i32 }

@.str = external hidden unnamed_addr constant [69 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
@stdin = external local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.11 = 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 i32, align 4
  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.lifetime.start.p0(i64 24, ptr nonnull %8) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %7, i8 0, i64 24, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %8, i8 0, i64 24, i1 false)
  %10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %12 = 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 %12, 0
  br i1 %.not, label %15, label %13

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

15:                                               ; preds = %2
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = call i32 @ups_env_create_db(ptr noundef %16, ptr noundef nonnull %4, i16 noundef zeroext 1, i32 noundef 4096, ptr noundef null) #7
  %.not32 = icmp eq i32 %17, 0
  br i1 %.not32, label %.preheader41, label %23

.preheader41:                                     ; preds = %15
  %18 = load ptr, ptr @stdin, align 8, !tbaa !5
  %19 = call ptr @fgets(ptr noundef nonnull %6, i32 noundef 4096, ptr noundef %18)
  %.not3347 = icmp eq ptr %19, null
  br i1 %.not3347, label %._crit_edge, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %.preheader41
  %20 = getelementptr inbounds i8, ptr %7, i64 16
  %21 = getelementptr inbounds i8, ptr %7, i64 8
  %22 = getelementptr inbounds i8, ptr %8, i64 8
  br label %.preheader

23:                                               ; preds = %15
  %24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %17)
  br label %.thread

.loopexit:                                        ; preds = %.backedge, %.preheader
  %.1.lcssa = phi i32 [ %.048, %.preheader ], [ %.2, %.backedge ]
  %25 = load ptr, ptr @stdin, align 8, !tbaa !5
  %26 = call ptr @fgets(ptr noundef nonnull %6, i32 noundef 4096, ptr noundef %25)
  %.not33 = icmp eq ptr %26, null
  br i1 %.not33, label %._crit_edge, label %.preheader, !llvm.loop !9

.preheader:                                       ; preds = %.preheader.lr.ph, %.loopexit
  %.048 = phi i32 [ 0, %.preheader.lr.ph ], [ %.1.lcssa, %.loopexit ]
  %27 = call ptr @strtok(ptr noundef nonnull %6, ptr noundef nonnull @.str.5) #7
  %.not3744 = icmp eq ptr %27, null
  br i1 %.not3744, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %.backedge
  %28 = phi ptr [ %39, %.backedge ], [ %27, %.preheader ]
  %.146 = phi i32 [ %.2, %.backedge ], [ %.048, %.preheader ]
  %.02145 = phi ptr [ %.122, %.backedge ], [ %6, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  store i32 1, ptr %20, align 8, !tbaa !11
  store ptr %9, ptr %21, align 8, !tbaa !15
  store i16 4, ptr %7, align 8, !tbaa !16
  store ptr %28, ptr %22, align 8, !tbaa !17
  %29 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %28) #8
  %30 = trunc i64 %29 to i32
  %31 = add i32 %30, 1
  store i32 %31, ptr %8, align 8, !tbaa !19
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = call i32 @ups_db_insert(ptr noundef %32, ptr noundef null, ptr noundef nonnull %7, ptr noundef nonnull %8, i32 noundef 0) #7
  switch i32 %33, label %34 [
    i32 -12, label %36
    i32 0, label %36
  ]

34:                                               ; preds = %.lr.ph
  %35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %33)
  br label %38

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

38:                                               ; preds = %36, %34
  %.122 = phi ptr [ %.02145, %34 ], [ null, %36 ]
  %.2 = phi i32 [ -1, %34 ], [ %.146, %36 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  switch i32 %33, label %.thread [
    i32 -12, label %.backedge
    i32 0, label %.backedge
  ]

.backedge:                                        ; preds = %38, %38
  %39 = call ptr @strtok(ptr noundef %.122, ptr noundef nonnull @.str.5) #7
  %.not37 = icmp eq ptr %39, null
  br i1 %.not37, label %.loopexit, label %.lr.ph

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

42:                                               ; preds = %._crit_edge
  %43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %41)
  br label %.thread

44:                                               ; preds = %._crit_edge
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %7, i8 0, i64 24, i1 false)
  %45 = getelementptr inbounds i8, ptr %7, i64 8
  %46 = getelementptr inbounds i8, ptr %8, i64 8
  br label %47

47:                                               ; preds = %52, %44
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = call i32 @ups_cursor_move(ptr noundef %48, ptr noundef nonnull %7, ptr noundef nonnull %8, i32 noundef 4) #7
  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.9, i32 noundef %49)
  br label %.thread

52:                                               ; preds = %47
  %53 = load ptr, ptr %45, align 8, !tbaa !15
  %54 = load i32, ptr %53, align 4, !tbaa !20
  %55 = load ptr, ptr %46, align 8, !tbaa !17
  %56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, i32 noundef %54, ptr noundef %55)
  br label %47

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

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

.thread:                                          ; preds = %38, %57, %60, %50, %42, %23, %13
  %.4 = phi i32 [ -1, %13 ], [ -1, %23 ], [ -1, %42 ], [ -1, %60 ], [ -1, %50 ], [ 0, %57 ], [ %.2, %38 ]
  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 %.4
}

; 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

; 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, !14, i64 16}
!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, !6, i64 8}
!16 = !{!12, !13, i64 0}
!17 = !{!18, !6, i64 8}
!18 = !{!"", !14, i64 0, !6, i64 8, !14, i64 16}
!19 = !{!18, !14, i64 0}
!20 = !{!14, !14, i64 0}


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