; 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.transfer_workspace = type { %struct.HypersphericalInterpolationStructure, i32, ptr, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, double, i32, double, i16 }
%struct.HypersphericalInterpolationStructure = type { i32, double, double, i32, i32, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr }
%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] }

@.str = external hidden unnamed_addr constant [18 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.142 = external hidden unnamed_addr constant [56 x i8], align 1
@__func__.transfer_workspace_free = external hidden unnamed_addr constant [24 x i8], align 1

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

declare void @class_protect_sprintf(ptr noundef, ptr noundef, ...) #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @transfer_workspace_free(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca [2048 x i8], align 16
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %7 = load ptr, ptr %5, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.transfer_workspace, ptr %7, i32 0, i32 1
  %9 = load i32, ptr %8, align 8, !tbaa !9
  %10 = icmp eq i32 %9, 1
  br i1 %10, label %11, label %29

11:                                               ; preds = %2
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.transfer_workspace, ptr %12, i32 0, i32 0
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.transfers, ptr %14, i32 0, i32 52
  %16 = getelementptr inbounds [2048 x i8], ptr %15, i64 0, i64 0
  %17 = call i32 @hyperspherical_HIS_free(ptr noundef %13, ptr noundef %16)
  %18 = icmp eq i32 %17, 1
  br i1 %18, label %19, label %28

19:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 2048, ptr %6) #4
  %20 = getelementptr inbounds [2048 x i8], ptr %6, i64 0, i64 0
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.transfers, ptr %21, i32 0, i32 52
  %23 = getelementptr inbounds [2048 x i8], ptr %22, i64 0, i64 0
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %20, ptr noundef @.str, ptr noundef @.str.142, ptr noundef %23)
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.transfers, ptr %24, i32 0, i32 52
  %26 = getelementptr inbounds [2048 x i8], ptr %25, i64 0, i64 0
  %27 = getelementptr inbounds [2048 x i8], ptr %6, i64 0, i64 0
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %26, ptr noundef @.str.2, ptr noundef @__func__.transfer_workspace_free, i32 noundef 4305, ptr noundef %27)
  call void @llvm.lifetime.end.p0(i64 2048, ptr %6) #4
  store i32 1, ptr %3, align 4
  br label %52

28:                                               ; preds = %11
  br label %29

29:                                               ; preds = %28, %2
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.transfer_workspace, ptr %30, i32 0, i32 6
  %32 = load ptr, ptr %31, align 8, !tbaa !15
  call void @free(ptr noundef %32) #4
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.transfer_workspace, ptr %33, i32 0, i32 7
  %35 = load ptr, ptr %34, align 8, !tbaa !16
  call void @free(ptr noundef %35) #4
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.transfer_workspace, ptr %36, i32 0, i32 8
  %38 = load ptr, ptr %37, align 8, !tbaa !17
  call void @free(ptr noundef %38) #4
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.transfer_workspace, ptr %39, i32 0, i32 9
  %41 = load ptr, ptr %40, align 8, !tbaa !18
  call void @free(ptr noundef %41) #4
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.transfer_workspace, ptr %42, i32 0, i32 10
  %44 = load ptr, ptr %43, align 8, !tbaa !19
  call void @free(ptr noundef %44) #4
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.transfer_workspace, ptr %45, i32 0, i32 11
  %47 = load ptr, ptr %46, align 8, !tbaa !20
  call void @free(ptr noundef %47) #4
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.transfer_workspace, ptr %48, i32 0, i32 12
  %50 = load ptr, ptr %49, align 8, !tbaa !21
  call void @free(ptr noundef %50) #4
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %51) #4
  store i32 0, ptr %3, align 4
  br label %52

52:                                               ; preds = %29, %19
  %53 = load i32, ptr %3, align 4
  ret i32 %53
}

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

declare i32 @hyperspherical_HIS_free(ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 "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 }

!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 96}
!10 = !{!"transfer_workspace", !11, i64 0, !12, i64 96, !6, i64 104, !12, i64 112, !12, i64 116, !12, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !13, i64 184, !12, i64 192, !13, i64 200, !14, i64 208}
!11 = !{!"HypersphericalInterpolationStructure", !12, i64 0, !13, i64 8, !13, i64 16, !12, i64 24, !12, i64 28, !6, i64 32, !6, i64 40, !12, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88}
!12 = !{!"int", !7, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{!10, !6, i64 128}
!16 = !{!10, !6, i64 136}
!17 = !{!10, !6, i64 144}
!18 = !{!10, !6, i64 152}
!19 = !{!10, !6, i64 160}
!20 = !{!10, !6, i64 168}
!21 = !{!10, !6, i64 176}


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

@.str = external hidden unnamed_addr constant [18 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.142 = external hidden unnamed_addr constant [56 x i8], align 1
@__func__.transfer_workspace_free = external hidden unnamed_addr constant [24 x i8], align 1

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

declare void @class_protect_sprintf(ptr noundef, ptr noundef, ...) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @transfer_workspace_free(ptr noundef %0, ptr noundef %1) local_unnamed_addr #2 {
  %3 = alloca [2048 x i8], align 16
  %4 = getelementptr inbounds i8, ptr %1, i64 96
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %6 = icmp eq i32 %5, 1
  br i1 %6, label %7, label %12

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %0, i64 2380
  %9 = tail call i32 @hyperspherical_HIS_free(ptr noundef nonnull %1, ptr noundef nonnull %8) #4
  %10 = icmp eq i32 %9, 1
  br i1 %10, label %11, label %12

11:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %3) #4
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef nonnull %3, ptr noundef nonnull @.str, ptr noundef nonnull @.str.142, ptr noundef nonnull %8) #4
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef nonnull %8, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__.transfer_workspace_free, i32 noundef 4305, ptr noundef nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %3) #4
  br label %27

12:                                               ; preds = %7, %2
  %13 = getelementptr inbounds i8, ptr %1, i64 128
  %14 = load ptr, ptr %13, align 8, !tbaa !14
  tail call void @free(ptr noundef %14) #4
  %15 = getelementptr inbounds i8, ptr %1, i64 136
  %16 = load ptr, ptr %15, align 8, !tbaa !15
  tail call void @free(ptr noundef %16) #4
  %17 = getelementptr inbounds i8, ptr %1, i64 144
  %18 = load ptr, ptr %17, align 8, !tbaa !16
  tail call void @free(ptr noundef %18) #4
  %19 = getelementptr inbounds i8, ptr %1, i64 152
  %20 = load ptr, ptr %19, align 8, !tbaa !17
  tail call void @free(ptr noundef %20) #4
  %21 = getelementptr inbounds i8, ptr %1, i64 160
  %22 = load ptr, ptr %21, align 8, !tbaa !18
  tail call void @free(ptr noundef %22) #4
  %23 = getelementptr inbounds i8, ptr %1, i64 168
  %24 = load ptr, ptr %23, align 8, !tbaa !19
  tail call void @free(ptr noundef %24) #4
  %25 = getelementptr inbounds i8, ptr %1, i64 176
  %26 = load ptr, ptr %25, align 8, !tbaa !20
  tail call void @free(ptr noundef %26) #4
  tail call void @free(ptr noundef nonnull %1) #4
  br label %27

27:                                               ; preds = %12, %11
  %.0 = phi i32 [ 1, %11 ], [ 0, %12 ]
  ret i32 %.0
}

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

declare i32 @hyperspherical_HIS_free(ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 #4 = { 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, !8, i64 96}
!6 = !{!"transfer_workspace", !7, i64 0, !8, i64 96, !12, i64 104, !8, i64 112, !8, i64 116, !8, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !12, i64 152, !12, i64 160, !12, i64 168, !12, i64 176, !11, i64 184, !8, i64 192, !11, i64 200, !13, i64 208}
!7 = !{!"HypersphericalInterpolationStructure", !8, i64 0, !11, i64 8, !11, i64 16, !8, i64 24, !8, i64 28, !12, i64 32, !12, i64 40, !8, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"double", !9, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!"short", !9, i64 0}
!14 = !{!6, !12, i64 128}
!15 = !{!6, !12, i64 136}
!16 = !{!6, !12, i64 144}
!17 = !{!6, !12, i64 152}
!18 = !{!6, !12, i64 160}
!19 = !{!6, !12, i64 168}
!20 = !{!6, !12, i64 176}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass