; LLVM IR from ytopt-team/ytopt :: ytopt-libe/xsbench/ytopt/xsbench (Main)

; 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.SimulationData = type { ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, ptr, i32, ptr, i32 }
%struct.Inputs = type { i32, i64, i64, i32, ptr, i32, i32, i32, i32, i32, i32 }

@.str.77 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.80 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.81 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.82 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.83 = external hidden unnamed_addr constant [90 x i8], align 1
@__PRETTY_FUNCTION__.binary_read = external hidden unnamed_addr constant [35 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

; Function Attrs: nounwind uwtable
define dso_local void @binary_read(ptr dead_on_unwind noalias writable sret(%struct.SimulationData) align 8 %0, ptr noundef byval(%struct.Inputs) align 8 %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  store ptr @.str.77, ptr %3, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  %6 = call i32 (ptr, ...) @printf(ptr noundef @.str.80, ptr noundef %5)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = call noalias ptr @fopen(ptr noundef %7, ptr noundef @.str.81)
  store ptr %8, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %11, label %12

11:                                               ; preds = %2
  br label %13

12:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.82, ptr noundef @.str.83, i32 noundef 604, ptr noundef @__PRETTY_FUNCTION__.binary_read) #6
  unreachable

13:                                               ; preds = %11
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = call i64 @fread(ptr noundef %0, i64 noundef 112, i64 noundef 1, ptr noundef %14)
  %16 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 6
  %17 = load i32, ptr %16, align 8, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = mul i64 %18, 4
  %20 = call noalias ptr @malloc(i64 noundef %19) #7
  %21 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 0
  store ptr %20, ptr %21, align 8, !tbaa !12
  %22 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 7
  %23 = load i32, ptr %22, align 4, !tbaa !13
  %24 = sext i32 %23 to i64
  %25 = mul i64 %24, 8
  %26 = call noalias ptr @malloc(i64 noundef %25) #7
  %27 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 1
  store ptr %26, ptr %27, align 8, !tbaa !14
  %28 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 8
  %29 = load i32, ptr %28, align 8, !tbaa !15
  %30 = sext i32 %29 to i64
  %31 = mul i64 %30, 4
  %32 = call noalias ptr @malloc(i64 noundef %31) #7
  %33 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 2
  store ptr %32, ptr %33, align 8, !tbaa !16
  %34 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 11
  %35 = load i32, ptr %34, align 4, !tbaa !17
  %36 = sext i32 %35 to i64
  %37 = mul i64 %36, 48
  %38 = call noalias ptr @malloc(i64 noundef %37) #7
  %39 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 5
  store ptr %38, ptr %39, align 8, !tbaa !18
  %40 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 10
  %41 = load i32, ptr %40, align 8, !tbaa !19
  %42 = sext i32 %41 to i64
  %43 = mul i64 %42, 4
  %44 = call noalias ptr @malloc(i64 noundef %43) #7
  %45 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 4
  store ptr %44, ptr %45, align 8, !tbaa !20
  %46 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 9
  %47 = load i32, ptr %46, align 4, !tbaa !21
  %48 = sext i32 %47 to i64
  %49 = mul i64 %48, 8
  %50 = call noalias ptr @malloc(i64 noundef %49) #7
  %51 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 3
  store ptr %50, ptr %51, align 8, !tbaa !22
  %52 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 0
  %53 = load ptr, ptr %52, align 8, !tbaa !12
  %54 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 6
  %55 = load i32, ptr %54, align 8, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = call i64 @fread(ptr noundef %53, i64 noundef 4, i64 noundef %56, ptr noundef %57)
  %59 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 1
  %60 = load ptr, ptr %59, align 8, !tbaa !14
  %61 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 7
  %62 = load i32, ptr %61, align 4, !tbaa !13
  %63 = sext i32 %62 to i64
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = call i64 @fread(ptr noundef %60, i64 noundef 8, i64 noundef %63, ptr noundef %64)
  %66 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 2
  %67 = load ptr, ptr %66, align 8, !tbaa !16
  %68 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 8
  %69 = load i32, ptr %68, align 8, !tbaa !15
  %70 = sext i32 %69 to i64
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = call i64 @fread(ptr noundef %67, i64 noundef 4, i64 noundef %70, ptr noundef %71)
  %73 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 5
  %74 = load ptr, ptr %73, align 8, !tbaa !18
  %75 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 11
  %76 = load i32, ptr %75, align 4, !tbaa !17
  %77 = sext i32 %76 to i64
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = call i64 @fread(ptr noundef %74, i64 noundef 48, i64 noundef %77, ptr noundef %78)
  %80 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 4
  %81 = load ptr, ptr %80, align 8, !tbaa !20
  %82 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 10
  %83 = load i32, ptr %82, align 8, !tbaa !19
  %84 = sext i32 %83 to i64
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = call i64 @fread(ptr noundef %81, i64 noundef 4, i64 noundef %84, ptr noundef %85)
  %87 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 3
  %88 = load ptr, ptr %87, align 8, !tbaa !22
  %89 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 9
  %90 = load i32, ptr %89, align 4, !tbaa !21
  %91 = sext i32 %90 to i64
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = call i64 @fread(ptr noundef %88, i64 noundef 8, i64 noundef %91, ptr noundef %92)
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = call i32 @fclose(ptr noundef %94)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret void
}

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

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

declare noalias ptr @fopen(ptr noundef, ptr noundef) #2

declare i32 @fclose(ptr noundef) #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #2

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

!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, !11, i64 48}
!10 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !6, i64 80, !11, i64 88, !6, i64 96, !11, i64 104}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 0}
!13 = !{!10, !11, i64 52}
!14 = !{!10, !6, i64 8}
!15 = !{!10, !11, i64 56}
!16 = !{!10, !6, i64 16}
!17 = !{!10, !11, i64 68}
!18 = !{!10, !6, i64 40}
!19 = !{!10, !11, i64 64}
!20 = !{!10, !6, i64 32}
!21 = !{!10, !11, i64 60}
!22 = !{!10, !6, i64 24}


; 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.SimulationData = type { ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, ptr, i32, ptr, i32 }
%struct.Inputs = type { i32, i64, i64, i32, ptr, i32, i32, i32, i32, i32, i32 }

@.str.77 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.80 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.81 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.82 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.83 = external hidden unnamed_addr constant [90 x i8], align 1
@__PRETTY_FUNCTION__.binary_read = external hidden unnamed_addr constant [35 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @binary_read(ptr dead_on_unwind noalias nocapture writable sret(%struct.SimulationData) align 8 %0, ptr nocapture noundef readnone byval(%struct.Inputs) align 8 %1) local_unnamed_addr #0 {
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.80, ptr noundef nonnull @.str.77)
  %4 = tail call noalias ptr @fopen(ptr noundef nonnull @.str.77, ptr noundef nonnull @.str.81)
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %5, label %6

5:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.82, ptr noundef nonnull @.str.83, i32 noundef 604, ptr noundef nonnull @__PRETTY_FUNCTION__.binary_read) #4
  unreachable

6:                                                ; preds = %2
  %7 = tail call i64 @fread(ptr noundef %0, i64 noundef 112, i64 noundef 1, ptr noundef nonnull %4)
  %8 = getelementptr inbounds i8, ptr %0, i64 48
  %9 = load i32, ptr %8, align 8, !tbaa !5
  %10 = sext i32 %9 to i64
  %11 = shl nsw i64 %10, 2
  %12 = tail call noalias ptr @malloc(i64 noundef %11) #5
  store ptr %12, ptr %0, align 8, !tbaa !11
  %13 = getelementptr inbounds i8, ptr %0, i64 52
  %14 = load i32, ptr %13, align 4, !tbaa !12
  %15 = sext i32 %14 to i64
  %16 = shl nsw i64 %15, 3
  %17 = tail call noalias ptr @malloc(i64 noundef %16) #5
  %18 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %17, ptr %18, align 8, !tbaa !13
  %19 = getelementptr inbounds i8, ptr %0, i64 56
  %20 = load i32, ptr %19, align 8, !tbaa !14
  %21 = sext i32 %20 to i64
  %22 = shl nsw i64 %21, 2
  %23 = tail call noalias ptr @malloc(i64 noundef %22) #5
  %24 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %23, ptr %24, align 8, !tbaa !15
  %25 = getelementptr inbounds i8, ptr %0, i64 68
  %26 = load i32, ptr %25, align 4, !tbaa !16
  %27 = sext i32 %26 to i64
  %28 = mul nsw i64 %27, 48
  %29 = tail call noalias ptr @malloc(i64 noundef %28) #5
  %30 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr %29, ptr %30, align 8, !tbaa !17
  %31 = getelementptr inbounds i8, ptr %0, i64 64
  %32 = load i32, ptr %31, align 8, !tbaa !18
  %33 = sext i32 %32 to i64
  %34 = shl nsw i64 %33, 2
  %35 = tail call noalias ptr @malloc(i64 noundef %34) #5
  %36 = getelementptr inbounds i8, ptr %0, i64 32
  store ptr %35, ptr %36, align 8, !tbaa !19
  %37 = getelementptr inbounds i8, ptr %0, i64 60
  %38 = load i32, ptr %37, align 4, !tbaa !20
  %39 = sext i32 %38 to i64
  %40 = shl nsw i64 %39, 3
  %41 = tail call noalias ptr @malloc(i64 noundef %40) #5
  %42 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr %41, ptr %42, align 8, !tbaa !21
  %43 = tail call i64 @fread(ptr noundef %12, i64 noundef 4, i64 noundef %10, ptr noundef nonnull %4)
  %44 = tail call i64 @fread(ptr noundef %17, i64 noundef 8, i64 noundef %15, ptr noundef nonnull %4)
  %45 = tail call i64 @fread(ptr noundef %23, i64 noundef 4, i64 noundef %21, ptr noundef nonnull %4)
  %46 = tail call i64 @fread(ptr noundef %29, i64 noundef 48, i64 noundef %27, ptr noundef nonnull %4)
  %47 = tail call i64 @fread(ptr noundef %35, i64 noundef 4, i64 noundef %33, ptr noundef nonnull %4)
  %48 = tail call i64 @fread(ptr noundef %41, i64 noundef 8, i64 noundef %39, ptr noundef nonnull %4)
  %49 = tail call i32 @fclose(ptr noundef nonnull %4)
  ret void
}

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #1

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 = { 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 #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(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 #3 = { noreturn 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 = { noreturn nounwind }
attributes #5 = { nounwind allocsize(0) }

!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 48}
!6 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !7, i64 80, !10, i64 88, !7, i64 96, !10, i64 104}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!6, !10, i64 52}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !10, i64 56}
!15 = !{!6, !7, i64 16}
!16 = !{!6, !10, i64 68}
!17 = !{!6, !7, i64 40}
!18 = !{!6, !10, i64 64}
!19 = !{!6, !7, i64 32}
!20 = !{!6, !10, i64 60}
!21 = !{!6, !7, i64 24}


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