; LLVM IR from freddiev4/dailyprogrammerchallenges :: Easy Challenges/Challenge 0022 Easy/solutions (solution)

; 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.my_struct = type { i32, i16, %struct.UT_hash_handle }
%struct.UT_hash_handle = type { ptr, ptr, ptr, ptr, ptr, ptr, i32, i32 }
%struct.UT_hash_table = type { ptr, i32, i32, i32, ptr, i64, i32, i32, i32, i32, i32 }
%struct.UT_hash_bucket = type { ptr, i32, i32 }

@users = external dso_local global ptr, align 8

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

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @free_all() #2 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #3
  %5 = load ptr, ptr @users, align 8, !tbaa !5
  store ptr %5, ptr %1, align 8, !tbaa !5
  %6 = load ptr, ptr @users, align 8, !tbaa !5
  %7 = icmp ne ptr %6, null
  br i1 %7, label %8, label %13

8:                                                ; preds = %0
  %9 = load ptr, ptr @users, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.my_struct, ptr %9, i32 0, i32 2
  %11 = getelementptr inbounds %struct.UT_hash_handle, ptr %10, i32 0, i32 2
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  br label %14

13:                                               ; preds = %0
  br label %14

14:                                               ; preds = %13, %8
  %15 = phi ptr [ %12, %8 ], [ null, %13 ]
  store ptr %15, ptr %2, align 8, !tbaa !5
  br label %16

16:                                               ; preds = %238, %14
  %17 = load ptr, ptr %1, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %240

19:                                               ; preds = %16
  br label %20

20:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %21 = load ptr, ptr %1, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.my_struct, ptr %21, i32 0, i32 2
  %23 = getelementptr inbounds %struct.UT_hash_handle, ptr %22, i32 0, i32 1
  %24 = load ptr, ptr %23, align 8, !tbaa !14
  %25 = icmp eq ptr %24, null
  br i1 %25, label %26, label %43

26:                                               ; preds = %20
  %27 = load ptr, ptr %1, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.my_struct, ptr %27, i32 0, i32 2
  %29 = getelementptr inbounds %struct.UT_hash_handle, ptr %28, i32 0, i32 2
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = icmp eq ptr %30, null
  br i1 %31, label %32, label %43

32:                                               ; preds = %26
  %33 = load ptr, ptr @users, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.my_struct, ptr %33, i32 0, i32 2
  %35 = getelementptr inbounds %struct.UT_hash_handle, ptr %34, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !15
  %37 = getelementptr inbounds %struct.UT_hash_table, ptr %36, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !16
  call void @free(ptr noundef %38) #3
  %39 = load ptr, ptr @users, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.my_struct, ptr %39, i32 0, i32 2
  %41 = getelementptr inbounds %struct.UT_hash_handle, ptr %40, i32 0, i32 0
  %42 = load ptr, ptr %41, align 8, !tbaa !15
  call void @free(ptr noundef %42) #3
  store ptr null, ptr @users, align 8, !tbaa !5
  br label %224

43:                                               ; preds = %26, %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %44 = load ptr, ptr %1, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.my_struct, ptr %44, i32 0, i32 2
  store ptr %45, ptr %3, align 8, !tbaa !5
  %46 = load ptr, ptr %1, align 8, !tbaa !5
  %47 = load ptr, ptr @users, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.my_struct, ptr %47, i32 0, i32 2
  %49 = getelementptr inbounds %struct.UT_hash_handle, ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !15
  %51 = getelementptr inbounds %struct.UT_hash_table, ptr %50, i32 0, i32 4
  %52 = load ptr, ptr %51, align 8, !tbaa !19
  %53 = load ptr, ptr @users, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.my_struct, ptr %53, i32 0, i32 2
  %55 = getelementptr inbounds %struct.UT_hash_handle, ptr %54, i32 0, i32 0
  %56 = load ptr, ptr %55, align 8, !tbaa !15
  %57 = getelementptr inbounds %struct.UT_hash_table, ptr %56, i32 0, i32 5
  %58 = load i64, ptr %57, align 8, !tbaa !20
  %59 = sub i64 0, %58
  %60 = getelementptr inbounds i8, ptr %52, i64 %59
  %61 = icmp eq ptr %46, %60
  br i1 %61, label %62, label %81

62:                                               ; preds = %43
  %63 = load ptr, ptr %1, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.my_struct, ptr %63, i32 0, i32 2
  %65 = getelementptr inbounds %struct.UT_hash_handle, ptr %64, i32 0, i32 1
  %66 = load ptr, ptr %65, align 8, !tbaa !14
  %67 = ptrtoint ptr %66 to i64
  %68 = load ptr, ptr @users, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.my_struct, ptr %68, i32 0, i32 2
  %70 = getelementptr inbounds %struct.UT_hash_handle, ptr %69, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8, !tbaa !15
  %72 = getelementptr inbounds %struct.UT_hash_table, ptr %71, i32 0, i32 5
  %73 = load i64, ptr %72, align 8, !tbaa !20
  %74 = add nsw i64 %67, %73
  %75 = inttoptr i64 %74 to ptr
  %76 = load ptr, ptr @users, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.my_struct, ptr %76, i32 0, i32 2
  %78 = getelementptr inbounds %struct.UT_hash_handle, ptr %77, i32 0, i32 0
  %79 = load ptr, ptr %78, align 8, !tbaa !15
  %80 = getelementptr inbounds %struct.UT_hash_table, ptr %79, i32 0, i32 4
  store ptr %75, ptr %80, align 8, !tbaa !19
  br label %81

81:                                               ; preds = %62, %43
  %82 = load ptr, ptr %1, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.my_struct, ptr %82, i32 0, i32 2
  %84 = getelementptr inbounds %struct.UT_hash_handle, ptr %83, i32 0, i32 1
  %85 = load ptr, ptr %84, align 8, !tbaa !14
  %86 = icmp ne ptr %85, null
  br i1 %86, label %87, label %106

87:                                               ; preds = %81
  %88 = load ptr, ptr %1, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.my_struct, ptr %88, i32 0, i32 2
  %90 = getelementptr inbounds %struct.UT_hash_handle, ptr %89, i32 0, i32 2
  %91 = load ptr, ptr %90, align 8, !tbaa !9
  %92 = load ptr, ptr %1, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.my_struct, ptr %92, i32 0, i32 2
  %94 = getelementptr inbounds %struct.UT_hash_handle, ptr %93, i32 0, i32 1
  %95 = load ptr, ptr %94, align 8, !tbaa !14
  %96 = ptrtoint ptr %95 to i64
  %97 = load ptr, ptr @users, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.my_struct, ptr %97, i32 0, i32 2
  %99 = getelementptr inbounds %struct.UT_hash_handle, ptr %98, i32 0, i32 0
  %100 = load ptr, ptr %99, align 8, !tbaa !15
  %101 = getelementptr inbounds %struct.UT_hash_table, ptr %100, i32 0, i32 5
  %102 = load i64, ptr %101, align 8, !tbaa !20
  %103 = add nsw i64 %96, %102
  %104 = inttoptr i64 %103 to ptr
  %105 = getelementptr inbounds %struct.UT_hash_handle, ptr %104, i32 0, i32 2
  store ptr %91, ptr %105, align 8, !tbaa !21
  br label %114

106:                                              ; preds = %81
  br label %107

107:                                              ; preds = %106
  %108 = load ptr, ptr %1, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.my_struct, ptr %108, i32 0, i32 2
  %110 = getelementptr inbounds %struct.UT_hash_handle, ptr %109, i32 0, i32 2
  %111 = load ptr, ptr %110, align 8, !tbaa !9
  store ptr %111, ptr @users, align 8, !tbaa !5
  br label %112

112:                                              ; preds = %107
  br label %113

113:                                              ; preds = %112
  br label %114

114:                                              ; preds = %113, %87
  %115 = load ptr, ptr %3, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.UT_hash_handle, ptr %115, i32 0, i32 2
  %117 = load ptr, ptr %116, align 8, !tbaa !21
  %118 = icmp ne ptr %117, null
  br i1 %118, label %119, label %136

119:                                              ; preds = %114
  %120 = load ptr, ptr %3, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.UT_hash_handle, ptr %120, i32 0, i32 1
  %122 = load ptr, ptr %121, align 8, !tbaa !22
  %123 = load ptr, ptr %3, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.UT_hash_handle, ptr %123, i32 0, i32 2
  %125 = load ptr, ptr %124, align 8, !tbaa !21
  %126 = ptrtoint ptr %125 to i64
  %127 = load ptr, ptr @users, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.my_struct, ptr %127, i32 0, i32 2
  %129 = getelementptr inbounds %struct.UT_hash_handle, ptr %128, i32 0, i32 0
  %130 = load ptr, ptr %129, align 8, !tbaa !15
  %131 = getelementptr inbounds %struct.UT_hash_table, ptr %130, i32 0, i32 5
  %132 = load i64, ptr %131, align 8, !tbaa !20
  %133 = add nsw i64 %126, %132
  %134 = inttoptr i64 %133 to ptr
  %135 = getelementptr inbounds %struct.UT_hash_handle, ptr %134, i32 0, i32 1
  store ptr %122, ptr %135, align 8, !tbaa !22
  br label %136

136:                                              ; preds = %119, %114
  br label %137

137:                                              ; preds = %136
  %138 = load ptr, ptr %3, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.UT_hash_handle, ptr %138, i32 0, i32 7
  %140 = load i32, ptr %139, align 4, !tbaa !23
  %141 = load ptr, ptr @users, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.my_struct, ptr %141, i32 0, i32 2
  %143 = getelementptr inbounds %struct.UT_hash_handle, ptr %142, i32 0, i32 0
  %144 = load ptr, ptr %143, align 8, !tbaa !15
  %145 = getelementptr inbounds %struct.UT_hash_table, ptr %144, i32 0, i32 1
  %146 = load i32, ptr %145, align 8, !tbaa !24
  %147 = sub i32 %146, 1
  %148 = and i32 %140, %147
  store i32 %148, ptr %4, align 4, !tbaa !25
  br label %149

149:                                              ; preds = %137
  br label %150

150:                                              ; preds = %149
  %151 = load ptr, ptr @users, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.my_struct, ptr %151, i32 0, i32 2
  %153 = getelementptr inbounds %struct.UT_hash_handle, ptr %152, i32 0, i32 0
  %154 = load ptr, ptr %153, align 8, !tbaa !15
  %155 = getelementptr inbounds %struct.UT_hash_table, ptr %154, i32 0, i32 0
  %156 = load ptr, ptr %155, align 8, !tbaa !16
  %157 = load i32, ptr %4, align 4, !tbaa !25
  %158 = zext i32 %157 to i64
  %159 = getelementptr inbounds %struct.UT_hash_bucket, ptr %156, i64 %158
  %160 = getelementptr inbounds %struct.UT_hash_bucket, ptr %159, i32 0, i32 1
  %161 = load i32, ptr %160, align 8, !tbaa !26
  %162 = add i32 %161, -1
  store i32 %162, ptr %160, align 8, !tbaa !26
  %163 = load ptr, ptr @users, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.my_struct, ptr %163, i32 0, i32 2
  %165 = getelementptr inbounds %struct.UT_hash_handle, ptr %164, i32 0, i32 0
  %166 = load ptr, ptr %165, align 8, !tbaa !15
  %167 = getelementptr inbounds %struct.UT_hash_table, ptr %166, i32 0, i32 0
  %168 = load ptr, ptr %167, align 8, !tbaa !16
  %169 = load i32, ptr %4, align 4, !tbaa !25
  %170 = zext i32 %169 to i64
  %171 = getelementptr inbounds %struct.UT_hash_bucket, ptr %168, i64 %170
  %172 = getelementptr inbounds %struct.UT_hash_bucket, ptr %171, i32 0, i32 0
  %173 = load ptr, ptr %172, align 8, !tbaa !28
  %174 = load ptr, ptr %3, align 8, !tbaa !5
  %175 = icmp eq ptr %173, %174
  br i1 %175, label %176, label %190

176:                                              ; preds = %150
  %177 = load ptr, ptr %3, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.UT_hash_handle, ptr %177, i32 0, i32 4
  %179 = load ptr, ptr %178, align 8, !tbaa !29
  %180 = load ptr, ptr @users, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.my_struct, ptr %180, i32 0, i32 2
  %182 = getelementptr inbounds %struct.UT_hash_handle, ptr %181, i32 0, i32 0
  %183 = load ptr, ptr %182, align 8, !tbaa !15
  %184 = getelementptr inbounds %struct.UT_hash_table, ptr %183, i32 0, i32 0
  %185 = load ptr, ptr %184, align 8, !tbaa !16
  %186 = load i32, ptr %4, align 4, !tbaa !25
  %187 = zext i32 %186 to i64
  %188 = getelementptr inbounds %struct.UT_hash_bucket, ptr %185, i64 %187
  %189 = getelementptr inbounds %struct.UT_hash_bucket, ptr %188, i32 0, i32 0
  store ptr %179, ptr %189, align 8, !tbaa !28
  br label %190

190:                                              ; preds = %176, %150
  %191 = load ptr, ptr %3, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.UT_hash_handle, ptr %191, i32 0, i32 3
  %193 = load ptr, ptr %192, align 8, !tbaa !30
  %194 = icmp ne ptr %193, null
  br i1 %194, label %195, label %203

195:                                              ; preds = %190
  %196 = load ptr, ptr %3, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.UT_hash_handle, ptr %196, i32 0, i32 4
  %198 = load ptr, ptr %197, align 8, !tbaa !29
  %199 = load ptr, ptr %3, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.UT_hash_handle, ptr %199, i32 0, i32 3
  %201 = load ptr, ptr %200, align 8, !tbaa !30
  %202 = getelementptr inbounds %struct.UT_hash_handle, ptr %201, i32 0, i32 4
  store ptr %198, ptr %202, align 8, !tbaa !29
  br label %203

203:                                              ; preds = %195, %190
  %204 = load ptr, ptr %3, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.UT_hash_handle, ptr %204, i32 0, i32 4
  %206 = load ptr, ptr %205, align 8, !tbaa !29
  %207 = icmp ne ptr %206, null
  br i1 %207, label %208, label %216

208:                                              ; preds = %203
  %209 = load ptr, ptr %3, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct.UT_hash_handle, ptr %209, i32 0, i32 3
  %211 = load ptr, ptr %210, align 8, !tbaa !30
  %212 = load ptr, ptr %3, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct.UT_hash_handle, ptr %212, i32 0, i32 4
  %214 = load ptr, ptr %213, align 8, !tbaa !29
  %215 = getelementptr inbounds %struct.UT_hash_handle, ptr %214, i32 0, i32 3
  store ptr %211, ptr %215, align 8, !tbaa !30
  br label %216

216:                                              ; preds = %208, %203
  %217 = load ptr, ptr @users, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct.my_struct, ptr %217, i32 0, i32 2
  %219 = getelementptr inbounds %struct.UT_hash_handle, ptr %218, i32 0, i32 0
  %220 = load ptr, ptr %219, align 8, !tbaa !15
  %221 = getelementptr inbounds %struct.UT_hash_table, ptr %220, i32 0, i32 3
  %222 = load i32, ptr %221, align 8, !tbaa !31
  %223 = add i32 %222, -1
  store i32 %223, ptr %221, align 8, !tbaa !31
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  br label %224

224:                                              ; preds = %216, %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  br label %225

225:                                              ; preds = %224
  br label %226

226:                                              ; preds = %225
  %227 = load ptr, ptr %1, align 8, !tbaa !5
  call void @free(ptr noundef %227) #3
  br label %228

228:                                              ; preds = %226
  %229 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %229, ptr %1, align 8, !tbaa !5
  %230 = load ptr, ptr %2, align 8, !tbaa !5
  %231 = icmp ne ptr %230, null
  br i1 %231, label %232, label %237

232:                                              ; preds = %228
  %233 = load ptr, ptr %2, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct.my_struct, ptr %233, i32 0, i32 2
  %235 = getelementptr inbounds %struct.UT_hash_handle, ptr %234, i32 0, i32 2
  %236 = load ptr, ptr %235, align 8, !tbaa !9
  br label %238

237:                                              ; preds = %228
  br label %238

238:                                              ; preds = %237, %232
  %239 = phi ptr [ %236, %232 ], [ null, %237 ]
  store ptr %239, ptr %2, align 8, !tbaa !5
  br label %16, !llvm.loop !32

240:                                              ; preds = %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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/C++ TBAA"}
!9 = !{!10, !6, i64 24}
!10 = !{!"my_struct", !11, i64 0, !12, i64 4, !13, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!"UT_hash_handle", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !11, i64 48, !11, i64 52}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 8}
!16 = !{!17, !6, i64 0}
!17 = !{!"UT_hash_table", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !6, i64 24, !18, i64 32, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56}
!18 = !{!"long", !7, i64 0}
!19 = !{!17, !6, i64 24}
!20 = !{!17, !18, i64 32}
!21 = !{!13, !6, i64 16}
!22 = !{!13, !6, i64 8}
!23 = !{!13, !11, i64 52}
!24 = !{!17, !11, i64 8}
!25 = !{!11, !11, i64 0}
!26 = !{!27, !11, i64 8}
!27 = !{!"UT_hash_bucket", !6, i64 0, !11, i64 8, !11, i64 12}
!28 = !{!27, !6, i64 0}
!29 = !{!13, !6, i64 32}
!30 = !{!13, !6, i64 24}
!31 = !{!17, !11, i64 16}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}


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

@users = external dso_local local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @free_all() local_unnamed_addr #1 {
  %1 = load ptr, ptr @users, align 8, !tbaa !5
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %0, %85
  %.sink51 = phi ptr [ %3, %85 ], [ %1, %0 ]
  %2 = getelementptr inbounds i8, ptr %.sink51, i64 24
  %3 = load ptr, ptr %2, align 8, !tbaa !9
  %4 = getelementptr inbounds i8, ptr %.sink51, i64 8
  %5 = getelementptr inbounds i8, ptr %.sink51, i64 16
  %6 = load ptr, ptr %5, align 8, !tbaa !14
  %7 = icmp eq ptr %6, null
  br i1 %7, label %8, label %.lr.ph._crit_edge

.lr.ph._crit_edge:                                ; preds = %.lr.ph
  %.pre = load ptr, ptr @users, align 8, !tbaa !5
  br label %19

8:                                                ; preds = %.lr.ph
  %9 = getelementptr inbounds i8, ptr %.sink51, i64 24
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = icmp eq ptr %10, null
  %.pre44 = load ptr, ptr @users, align 8, !tbaa !5
  br i1 %11, label %12, label %19

12:                                               ; preds = %8
  %13 = getelementptr inbounds i8, ptr %.pre44, i64 8
  %14 = load ptr, ptr %13, align 8, !tbaa !15
  %15 = load ptr, ptr %14, align 8, !tbaa !16
  tail call void @free(ptr noundef %15) #2
  %16 = load ptr, ptr @users, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %16, i64 8
  %18 = load ptr, ptr %17, align 8, !tbaa !15
  tail call void @free(ptr noundef %18) #2
  store ptr null, ptr @users, align 8, !tbaa !5
  br label %85

19:                                               ; preds = %.lr.ph._crit_edge, %8
  %20 = phi ptr [ %.pre, %.lr.ph._crit_edge ], [ %.pre44, %8 ]
  %21 = getelementptr inbounds i8, ptr %20, i64 8
  %22 = load ptr, ptr %21, align 8, !tbaa !15
  %23 = getelementptr inbounds i8, ptr %22, i64 24
  %24 = load ptr, ptr %23, align 8, !tbaa !19
  %25 = getelementptr inbounds i8, ptr %22, i64 32
  %26 = load i64, ptr %25, align 8, !tbaa !20
  %27 = sub i64 0, %26
  %28 = getelementptr inbounds i8, ptr %24, i64 %27
  %29 = icmp eq ptr %.sink51, %28
  br i1 %29, label %30, label %34

30:                                               ; preds = %19
  %31 = ptrtoint ptr %6 to i64
  %32 = add nsw i64 %26, %31
  %33 = inttoptr i64 %32 to ptr
  store ptr %33, ptr %23, align 8, !tbaa !19
  br label %34

34:                                               ; preds = %30, %19
  %35 = getelementptr inbounds i8, ptr %.sink51, i64 24
  %36 = load ptr, ptr %35, align 8, !tbaa !21
  %37 = ptrtoint ptr %6 to i64
  %38 = add nsw i64 %26, %37
  %39 = inttoptr i64 %38 to ptr
  %40 = getelementptr inbounds i8, ptr %39, i64 16
  %users.sink = select i1 %7, ptr @users, ptr %40
  %41 = select i1 %7, ptr %36, ptr %20
  store ptr %36, ptr %users.sink, align 8, !tbaa !5
  %.not37 = icmp eq ptr %36, null
  br i1 %.not37, label %._crit_edge45, label %42

._crit_edge45:                                    ; preds = %34
  %.phi.trans.insert = getelementptr inbounds i8, ptr %41, i64 8
  %.pre46 = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !15
  br label %52

42:                                               ; preds = %34
  %43 = load ptr, ptr %5, align 8, !tbaa !22
  %44 = ptrtoint ptr %36 to i64
  %45 = getelementptr inbounds i8, ptr %41, i64 8
  %46 = load ptr, ptr %45, align 8, !tbaa !15
  %47 = getelementptr inbounds i8, ptr %46, i64 32
  %48 = load i64, ptr %47, align 8, !tbaa !20
  %49 = add nsw i64 %48, %44
  %50 = inttoptr i64 %49 to ptr
  %51 = getelementptr inbounds i8, ptr %50, i64 8
  store ptr %43, ptr %51, align 8, !tbaa !22
  br label %52

52:                                               ; preds = %._crit_edge45, %42
  %53 = phi ptr [ %.pre46, %._crit_edge45 ], [ %46, %42 ]
  %54 = getelementptr inbounds i8, ptr %.sink51, i64 60
  %55 = load i32, ptr %54, align 4, !tbaa !23
  %56 = getelementptr inbounds i8, ptr %53, i64 8
  %57 = load i32, ptr %56, align 8, !tbaa !24
  %58 = add i32 %57, -1
  %59 = and i32 %58, %55
  %60 = load ptr, ptr %53, align 8, !tbaa !16
  %61 = zext i32 %59 to i64
  %62 = getelementptr inbounds %struct.UT_hash_bucket, ptr %60, i64 %61, i32 1
  %63 = load i32, ptr %62, align 8, !tbaa !25
  %64 = add i32 %63, -1
  store i32 %64, ptr %62, align 8, !tbaa !25
  %65 = getelementptr inbounds %struct.UT_hash_bucket, ptr %60, i64 %61
  %66 = load ptr, ptr %65, align 8, !tbaa !27
  %67 = icmp eq ptr %66, %4
  br i1 %67, label %68, label %71

68:                                               ; preds = %52
  %69 = getelementptr inbounds i8, ptr %.sink51, i64 40
  %70 = load ptr, ptr %69, align 8, !tbaa !28
  store ptr %70, ptr %65, align 8, !tbaa !27
  br label %71

71:                                               ; preds = %68, %52
  %72 = getelementptr inbounds i8, ptr %.sink51, i64 32
  %73 = load ptr, ptr %72, align 8, !tbaa !29
  %.not38 = icmp eq ptr %73, null
  %.phi.trans.insert48 = getelementptr inbounds i8, ptr %.sink51, i64 40
  %.pre49 = load ptr, ptr %.phi.trans.insert48, align 8, !tbaa !28
  br i1 %.not38, label %._crit_edge47, label %74

74:                                               ; preds = %71
  %75 = getelementptr inbounds i8, ptr %73, i64 32
  store ptr %.pre49, ptr %75, align 8, !tbaa !28
  br label %._crit_edge47

._crit_edge47:                                    ; preds = %71, %74
  %.not39 = icmp eq ptr %.pre49, null
  br i1 %.not39, label %78, label %76

76:                                               ; preds = %._crit_edge47
  %77 = getelementptr inbounds i8, ptr %.pre49, i64 24
  store ptr %73, ptr %77, align 8, !tbaa !29
  br label %78

78:                                               ; preds = %76, %._crit_edge47
  %79 = load ptr, ptr @users, align 8, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %79, i64 8
  %81 = load ptr, ptr %80, align 8, !tbaa !15
  %82 = getelementptr inbounds i8, ptr %81, i64 16
  %83 = load i32, ptr %82, align 8, !tbaa !30
  %84 = add i32 %83, -1
  store i32 %84, ptr %82, align 8, !tbaa !30
  br label %85

85:                                               ; preds = %78, %12
  tail call void @free(ptr noundef nonnull %.sink51) #2
  %.not40 = icmp eq ptr %3, null
  br i1 %.not40, label %._crit_edge, label %.lr.ph, !llvm.loop !31

._crit_edge:                                      ; preds = %85, %0
  ret void
}

attributes #0 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 #2 = { 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/C++ TBAA"}
!9 = !{!10, !6, i64 24}
!10 = !{!"my_struct", !11, i64 0, !12, i64 4, !13, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!"UT_hash_handle", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !11, i64 48, !11, i64 52}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 8}
!16 = !{!17, !6, i64 0}
!17 = !{!"UT_hash_table", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !6, i64 24, !18, i64 32, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56}
!18 = !{!"long", !7, i64 0}
!19 = !{!17, !6, i64 24}
!20 = !{!17, !18, i64 32}
!21 = !{!13, !6, i64 16}
!22 = !{!13, !6, i64 8}
!23 = !{!13, !11, i64 52}
!24 = !{!17, !11, i64 8}
!25 = !{!26, !11, i64 8}
!26 = !{!"UT_hash_bucket", !6, i64 0, !11, i64 8, !11, i64 12}
!27 = !{!26, !6, i64 0}
!28 = !{!13, !6, i64 32}
!29 = !{!13, !6, i64 24}
!30 = !{!17, !11, i64 16}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass