; LLVM IR from CLASS-SZ/class_sz :: class-sz/source (transfer)

; 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.transfers = type { double, double, double, [100 x double], [100 x double], i16, i16, [256 x i8], i32, ptr, ptr, ptr, i16, i16, [256 x i8], i32, ptr, ptr, ptr, ptr, i16, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, i32, ptr, double, i64, ptr, ptr, i32, ptr, i16, i16, [2048 x i8] }

; 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 i32 @transfer_free(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  %5 = getelementptr inbounds %struct.transfers, ptr %4, i32 0, i32 20
  %6 = load i16, ptr %5, align 8, !tbaa !9
  %7 = sext i16 %6 to i32
  %8 = icmp eq i32 %7, 1
  br i1 %8, label %9, label %96

9:                                                ; preds = %1
  store i32 0, ptr %3, align 4, !tbaa !15
  br label %10

10:                                               ; preds = %38, %9
  %11 = load i32, ptr %3, align 4, !tbaa !15
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.transfers, ptr %12, i32 0, i32 21
  %14 = load i32, ptr %13, align 4, !tbaa !16
  %15 = icmp slt i32 %11, %14
  br i1 %15, label %16, label %41

16:                                               ; preds = %10
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.transfers, ptr %17, i32 0, i32 40
  %19 = load ptr, ptr %18, align 8, !tbaa !17
  %20 = load i32, ptr %3, align 4, !tbaa !15
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds ptr, ptr %19, i64 %21
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  call void @free(ptr noundef %23) #3
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.transfers, ptr %24, i32 0, i32 49
  %26 = load ptr, ptr %25, align 8, !tbaa !18
  %27 = load i32, ptr %3, align 4, !tbaa !15
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds ptr, ptr %26, i64 %28
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  call void @free(ptr noundef %30) #3
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.transfers, ptr %31, i32 0, i32 47
  %33 = load ptr, ptr %32, align 8, !tbaa !19
  %34 = load i32, ptr %3, align 4, !tbaa !15
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds ptr, ptr %33, i64 %35
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  call void @free(ptr noundef %37) #3
  br label %38

38:                                               ; preds = %16
  %39 = load i32, ptr %3, align 4, !tbaa !15
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %3, align 4, !tbaa !15
  br label %10, !llvm.loop !20

41:                                               ; preds = %10
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.transfers, ptr %42, i32 0, i32 39
  %44 = load ptr, ptr %43, align 8, !tbaa !22
  call void @free(ptr noundef %44) #3
  %45 = load ptr, ptr %2, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.transfers, ptr %45, i32 0, i32 40
  %47 = load ptr, ptr %46, align 8, !tbaa !17
  call void @free(ptr noundef %47) #3
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.transfers, ptr %48, i32 0, i32 41
  %50 = load ptr, ptr %49, align 8, !tbaa !23
  call void @free(ptr noundef %50) #3
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.transfers, ptr %51, i32 0, i32 43
  %53 = load ptr, ptr %52, align 8, !tbaa !24
  call void @free(ptr noundef %53) #3
  %54 = load ptr, ptr %2, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.transfers, ptr %54, i32 0, i32 46
  %56 = load ptr, ptr %55, align 8, !tbaa !25
  call void @free(ptr noundef %56) #3
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.transfers, ptr %57, i32 0, i32 47
  %59 = load ptr, ptr %58, align 8, !tbaa !19
  call void @free(ptr noundef %59) #3
  %60 = load ptr, ptr %2, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.transfers, ptr %60, i32 0, i32 49
  %62 = load ptr, ptr %61, align 8, !tbaa !18
  call void @free(ptr noundef %62) #3
  %63 = load ptr, ptr %2, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.transfers, ptr %63, i32 0, i32 8
  %65 = load i32, ptr %64, align 4, !tbaa !26
  %66 = icmp sgt i32 %65, 0
  br i1 %66, label %67, label %77

67:                                               ; preds = %41
  %68 = load ptr, ptr %2, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.transfers, ptr %68, i32 0, i32 9
  %70 = load ptr, ptr %69, align 8, !tbaa !27
  call void @free(ptr noundef %70) #3
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.transfers, ptr %71, i32 0, i32 10
  %73 = load ptr, ptr %72, align 8, !tbaa !28
  call void @free(ptr noundef %73) #3
  %74 = load ptr, ptr %2, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.transfers, ptr %74, i32 0, i32 11
  %76 = load ptr, ptr %75, align 8, !tbaa !29
  call void @free(ptr noundef %76) #3
  br label %77

77:                                               ; preds = %67, %41
  %78 = load ptr, ptr %2, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.transfers, ptr %78, i32 0, i32 15
  %80 = load i32, ptr %79, align 4, !tbaa !30
  %81 = icmp sgt i32 %80, 0
  br i1 %81, label %82, label %95

82:                                               ; preds = %77
  %83 = load ptr, ptr %2, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.transfers, ptr %83, i32 0, i32 16
  %85 = load ptr, ptr %84, align 8, !tbaa !31
  call void @free(ptr noundef %85) #3
  %86 = load ptr, ptr %2, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.transfers, ptr %86, i32 0, i32 17
  %88 = load ptr, ptr %87, align 8, !tbaa !32
  call void @free(ptr noundef %88) #3
  %89 = load ptr, ptr %2, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.transfers, ptr %89, i32 0, i32 18
  %91 = load ptr, ptr %90, align 8, !tbaa !33
  call void @free(ptr noundef %91) #3
  %92 = load ptr, ptr %2, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.transfers, ptr %92, i32 0, i32 19
  %94 = load ptr, ptr %93, align 8, !tbaa !34
  call void @free(ptr noundef %94) #3
  br label %95

95:                                               ; preds = %82, %77
  br label %96

96:                                               ; preds = %95, %1
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret i32 0
}

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, !12, i64 2208}
!10 = !{!"transfers", !11, i64 0, !11, i64 8, !11, i64 16, !7, i64 24, !7, i64 824, !12, i64 1624, !12, i64 1626, !7, i64 1628, !13, i64 1884, !6, i64 1888, !6, i64 1896, !6, i64 1904, !12, i64 1912, !12, i64 1914, !7, i64 1916, !13, i64 2172, !6, i64 2176, !6, i64 2184, !6, i64 2192, !6, i64 2200, !12, i64 2208, !13, i64 2212, !13, i64 2216, !13, i64 2220, !13, i64 2224, !13, i64 2228, !13, i64 2232, !13, i64 2236, !13, i64 2240, !13, i64 2244, !13, i64 2248, !13, i64 2252, !13, i64 2256, !13, i64 2260, !13, i64 2264, !13, i64 2268, !13, i64 2272, !13, i64 2276, !13, i64 2280, !6, i64 2288, !6, i64 2296, !6, i64 2304, !13, i64 2312, !6, i64 2320, !11, i64 2328, !14, i64 2336, !6, i64 2344, !6, i64 2352, !13, i64 2360, !6, i64 2368, !12, i64 2376, !12, i64 2378, !7, i64 2380}
!11 = !{!"double", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!13, !13, i64 0}
!16 = !{!10, !13, i64 2212}
!17 = !{!10, !6, i64 2296}
!18 = !{!10, !6, i64 2368}
!19 = !{!10, !6, i64 2352}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!10, !6, i64 2288}
!23 = !{!10, !6, i64 2304}
!24 = !{!10, !6, i64 2320}
!25 = !{!10, !6, i64 2344}
!26 = !{!10, !13, i64 1884}
!27 = !{!10, !6, i64 1888}
!28 = !{!10, !6, i64 1896}
!29 = !{!10, !6, i64 1904}
!30 = !{!10, !13, i64 2172}
!31 = !{!10, !6, i64 2176}
!32 = !{!10, !6, i64 2184}
!33 = !{!10, !6, i64 2192}
!34 = !{!10, !6, i64 2200}


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

; 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 noundef i32 @transfer_free(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 2208
  %3 = load i16, ptr %2, align 8, !tbaa !5
  %4 = icmp eq i16 %3, 1
  br i1 %4, label %.preheader, label %61

.preheader:                                       ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 2212
  %6 = load i32, ptr %5, align 4, !tbaa !14
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader
  %8 = getelementptr inbounds i8, ptr %0, i64 2296
  %9 = getelementptr inbounds i8, ptr %0, i64 2368
  %10 = getelementptr inbounds i8, ptr %0, i64 2352
  br label %11

11:                                               ; preds = %.lr.ph, %11
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %11 ]
  %12 = load ptr, ptr %8, align 8, !tbaa !15
  %13 = getelementptr inbounds ptr, ptr %12, i64 %indvars.iv
  %14 = load ptr, ptr %13, align 8, !tbaa !16
  tail call void @free(ptr noundef %14) #2
  %15 = load ptr, ptr %9, align 8, !tbaa !17
  %16 = getelementptr inbounds ptr, ptr %15, i64 %indvars.iv
  %17 = load ptr, ptr %16, align 8, !tbaa !16
  tail call void @free(ptr noundef %17) #2
  %18 = load ptr, ptr %10, align 8, !tbaa !18
  %19 = getelementptr inbounds ptr, ptr %18, i64 %indvars.iv
  %20 = load ptr, ptr %19, align 8, !tbaa !16
  tail call void @free(ptr noundef %20) #2
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %21 = load i32, ptr %5, align 4, !tbaa !14
  %22 = sext i32 %21 to i64
  %23 = icmp slt i64 %indvars.iv.next, %22
  br i1 %23, label %11, label %._crit_edge, !llvm.loop !19

._crit_edge:                                      ; preds = %11, %.preheader
  %24 = getelementptr inbounds i8, ptr %0, i64 2288
  %25 = load ptr, ptr %24, align 8, !tbaa !21
  tail call void @free(ptr noundef %25) #2
  %26 = getelementptr inbounds i8, ptr %0, i64 2296
  %27 = load ptr, ptr %26, align 8, !tbaa !15
  tail call void @free(ptr noundef %27) #2
  %28 = getelementptr inbounds i8, ptr %0, i64 2304
  %29 = load ptr, ptr %28, align 8, !tbaa !22
  tail call void @free(ptr noundef %29) #2
  %30 = getelementptr inbounds i8, ptr %0, i64 2320
  %31 = load ptr, ptr %30, align 8, !tbaa !23
  tail call void @free(ptr noundef %31) #2
  %32 = getelementptr inbounds i8, ptr %0, i64 2344
  %33 = load ptr, ptr %32, align 8, !tbaa !24
  tail call void @free(ptr noundef %33) #2
  %34 = getelementptr inbounds i8, ptr %0, i64 2352
  %35 = load ptr, ptr %34, align 8, !tbaa !18
  tail call void @free(ptr noundef %35) #2
  %36 = getelementptr inbounds i8, ptr %0, i64 2368
  %37 = load ptr, ptr %36, align 8, !tbaa !17
  tail call void @free(ptr noundef %37) #2
  %38 = getelementptr inbounds i8, ptr %0, i64 1884
  %39 = load i32, ptr %38, align 4, !tbaa !25
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %41, label %48

41:                                               ; preds = %._crit_edge
  %42 = getelementptr inbounds i8, ptr %0, i64 1888
  %43 = load ptr, ptr %42, align 8, !tbaa !26
  tail call void @free(ptr noundef %43) #2
  %44 = getelementptr inbounds i8, ptr %0, i64 1896
  %45 = load ptr, ptr %44, align 8, !tbaa !27
  tail call void @free(ptr noundef %45) #2
  %46 = getelementptr inbounds i8, ptr %0, i64 1904
  %47 = load ptr, ptr %46, align 8, !tbaa !28
  tail call void @free(ptr noundef %47) #2
  br label %48

48:                                               ; preds = %41, %._crit_edge
  %49 = getelementptr inbounds i8, ptr %0, i64 2172
  %50 = load i32, ptr %49, align 4, !tbaa !29
  %51 = icmp sgt i32 %50, 0
  br i1 %51, label %52, label %61

52:                                               ; preds = %48
  %53 = getelementptr inbounds i8, ptr %0, i64 2176
  %54 = load ptr, ptr %53, align 8, !tbaa !30
  tail call void @free(ptr noundef %54) #2
  %55 = getelementptr inbounds i8, ptr %0, i64 2184
  %56 = load ptr, ptr %55, align 8, !tbaa !31
  tail call void @free(ptr noundef %56) #2
  %57 = getelementptr inbounds i8, ptr %0, i64 2192
  %58 = load ptr, ptr %57, align 8, !tbaa !32
  tail call void @free(ptr noundef %58) #2
  %59 = getelementptr inbounds i8, ptr %0, i64 2200
  %60 = load ptr, ptr %59, align 8, !tbaa !33
  tail call void @free(ptr noundef %60) #2
  br label %61

61:                                               ; preds = %48, %52, %1
  ret i32 0
}

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, !10, i64 2208}
!6 = !{!"transfers", !7, i64 0, !7, i64 8, !7, i64 16, !8, i64 24, !8, i64 824, !10, i64 1624, !10, i64 1626, !8, i64 1628, !11, i64 1884, !12, i64 1888, !12, i64 1896, !12, i64 1904, !10, i64 1912, !10, i64 1914, !8, i64 1916, !11, i64 2172, !12, i64 2176, !12, i64 2184, !12, i64 2192, !12, i64 2200, !10, i64 2208, !11, i64 2212, !11, i64 2216, !11, i64 2220, !11, i64 2224, !11, i64 2228, !11, i64 2232, !11, i64 2236, !11, i64 2240, !11, i64 2244, !11, i64 2248, !11, i64 2252, !11, i64 2256, !11, i64 2260, !11, i64 2264, !11, i64 2268, !11, i64 2272, !11, i64 2276, !11, i64 2280, !12, i64 2288, !12, i64 2296, !12, i64 2304, !11, i64 2312, !12, i64 2320, !7, i64 2328, !13, i64 2336, !12, i64 2344, !12, i64 2352, !11, i64 2360, !12, i64 2368, !10, i64 2376, !10, i64 2378, !8, i64 2380}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"short", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"long", !8, i64 0}
!14 = !{!6, !11, i64 2212}
!15 = !{!6, !12, i64 2296}
!16 = !{!12, !12, i64 0}
!17 = !{!6, !12, i64 2368}
!18 = !{!6, !12, i64 2352}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!6, !12, i64 2288}
!22 = !{!6, !12, i64 2304}
!23 = !{!6, !12, i64 2320}
!24 = !{!6, !12, i64 2344}
!25 = !{!6, !11, i64 1884}
!26 = !{!6, !12, i64 1888}
!27 = !{!6, !12, i64 1896}
!28 = !{!6, !12, i64 1904}
!29 = !{!6, !11, i64 2172}
!30 = !{!6, !12, i64 2176}
!31 = !{!6, !12, i64 2184}
!32 = !{!6, !12, i64 2192}
!33 = !{!6, !12, i64 2200}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass