; LLVM IR from ANL-CESAR/XSBench :: opencl (io)

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

@.str.84 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.87 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.88 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.89 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.90 = external hidden unnamed_addr constant [63 x i8], align 1
@__PRETTY_FUNCTION__.binary_read = external hidden unnamed_addr constant [35 x i8], align 1

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

; 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

declare i32 @fclose(ptr noundef) #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) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  store ptr @.str.84, ptr %3, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  %6 = call i32 (ptr, ...) @printf(ptr noundef @.str.87, 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.88)
  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.89, ptr noundef @.str.90, i32 noundef 510, 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 !13
  %22 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 7
  %23 = load i32, ptr %22, align 4, !tbaa !14
  %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 !15
  %28 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 8
  %29 = load i32, ptr %28, align 8, !tbaa !16
  %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 !17
  %34 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 11
  %35 = load i32, ptr %34, align 8, !tbaa !18
  %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 !19
  %40 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 10
  %41 = load i64, ptr %40, align 8, !tbaa !20
  %42 = mul i64 %41, 4
  %43 = call noalias ptr @malloc(i64 noundef %42) #7
  %44 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 4
  store ptr %43, ptr %44, align 8, !tbaa !21
  %45 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 9
  %46 = load i32, ptr %45, align 4, !tbaa !22
  %47 = sext i32 %46 to i64
  %48 = mul i64 %47, 8
  %49 = call noalias ptr @malloc(i64 noundef %48) #7
  %50 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 3
  store ptr %49, ptr %50, align 8, !tbaa !23
  %51 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !13
  %53 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 6
  %54 = load i32, ptr %53, align 8, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = call i64 @fread(ptr noundef %52, i64 noundef 4, i64 noundef %55, ptr noundef %56)
  %58 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 1
  %59 = load ptr, ptr %58, align 8, !tbaa !15
  %60 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 7
  %61 = load i32, ptr %60, align 4, !tbaa !14
  %62 = sext i32 %61 to i64
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = call i64 @fread(ptr noundef %59, i64 noundef 8, i64 noundef %62, ptr noundef %63)
  %65 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 2
  %66 = load ptr, ptr %65, align 8, !tbaa !17
  %67 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 8
  %68 = load i32, ptr %67, align 8, !tbaa !16
  %69 = sext i32 %68 to i64
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = call i64 @fread(ptr noundef %66, i64 noundef 4, i64 noundef %69, ptr noundef %70)
  %72 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 5
  %73 = load ptr, ptr %72, align 8, !tbaa !19
  %74 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 11
  %75 = load i32, ptr %74, align 8, !tbaa !18
  %76 = sext i32 %75 to i64
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = call i64 @fread(ptr noundef %73, i64 noundef 48, i64 noundef %76, ptr noundef %77)
  %79 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 4
  %80 = load ptr, ptr %79, align 8, !tbaa !21
  %81 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 10
  %82 = load i64, ptr %81, align 8, !tbaa !20
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = call i64 @fread(ptr noundef %80, i64 noundef 4, i64 noundef %82, ptr noundef %83)
  %85 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 3
  %86 = load ptr, ptr %85, align 8, !tbaa !23
  %87 = getelementptr inbounds %struct.SimulationData, ptr %0, i32 0, i32 9
  %88 = load i32, ptr %87, align 4, !tbaa !22
  %89 = sext i32 %88 to i64
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = call i64 @fread(ptr noundef %86, i64 noundef 8, i64 noundef %89, ptr noundef %90)
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = call i32 @fclose(ptr noundef %92)
  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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

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

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

attributes #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 = { 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 = { 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 = { 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 #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, !12, i64 64, !11, i64 72, !11, i64 76, !6, i64 80, !11, i64 88, !6, i64 96, !11, i64 104}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!10, !6, i64 0}
!14 = !{!10, !11, i64 52}
!15 = !{!10, !6, i64 8}
!16 = !{!10, !11, i64 56}
!17 = !{!10, !6, i64 16}
!18 = !{!10, !11, i64 72}
!19 = !{!10, !6, i64 40}
!20 = !{!10, !12, i64 64}
!21 = !{!10, !6, i64 32}
!22 = !{!10, !11, i64 60}
!23 = !{!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, i64, i32, i32, ptr, i32, ptr, i32 }
%struct.Inputs = type { i32, i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }

@.str.84 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.87 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.88 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.89 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.90 = external hidden unnamed_addr constant [63 x i8], align 1
@__PRETTY_FUNCTION__.binary_read = external hidden unnamed_addr constant [35 x i8], align 1

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

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

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

; 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 #1 {
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.87, ptr noundef nonnull @.str.84)
  %4 = tail call noalias ptr @fopen(ptr noundef nonnull @.str.84, ptr noundef nonnull @.str.88)
  %.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.89, ptr noundef nonnull @.str.90, i32 noundef 510, 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 !12
  %13 = getelementptr inbounds i8, ptr %0, i64 52
  %14 = load i32, ptr %13, align 4, !tbaa !13
  %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 !14
  %19 = getelementptr inbounds i8, ptr %0, i64 56
  %20 = load i32, ptr %19, align 8, !tbaa !15
  %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 !16
  %25 = getelementptr inbounds i8, ptr %0, i64 72
  %26 = load i32, ptr %25, align 8, !tbaa !17
  %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 !18
  %31 = getelementptr inbounds i8, ptr %0, i64 64
  %32 = load i64, ptr %31, align 8, !tbaa !19
  %33 = shl i64 %32, 2
  %34 = tail call noalias ptr @malloc(i64 noundef %33) #5
  %35 = getelementptr inbounds i8, ptr %0, i64 32
  store ptr %34, ptr %35, align 8, !tbaa !20
  %36 = getelementptr inbounds i8, ptr %0, i64 60
  %37 = load i32, ptr %36, align 4, !tbaa !21
  %38 = sext i32 %37 to i64
  %39 = shl nsw i64 %38, 3
  %40 = tail call noalias ptr @malloc(i64 noundef %39) #5
  %41 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr %40, ptr %41, align 8, !tbaa !22
  %42 = tail call i64 @fread(ptr noundef %12, i64 noundef 4, i64 noundef %10, ptr noundef nonnull %4)
  %43 = tail call i64 @fread(ptr noundef %17, i64 noundef 8, i64 noundef %15, ptr noundef nonnull %4)
  %44 = tail call i64 @fread(ptr noundef %23, i64 noundef 4, i64 noundef %21, ptr noundef nonnull %4)
  %45 = tail call i64 @fread(ptr noundef %29, i64 noundef 48, i64 noundef %27, ptr noundef nonnull %4)
  %46 = tail call i64 @fread(ptr noundef %34, i64 noundef 4, i64 noundef %32, ptr noundef nonnull %4)
  %47 = tail call i64 @fread(ptr noundef %40, i64 noundef 8, i64 noundef %38, ptr noundef nonnull %4)
  %48 = tail call i32 @fclose(ptr noundef nonnull %4)
  ret void
}

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

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

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

attributes #0 = { 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 #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 = { 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 #3 = { 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 #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, !11, i64 64, !10, i64 72, !10, i64 76, !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 = !{!"long", !8, i64 0}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !10, i64 52}
!14 = !{!6, !7, i64 8}
!15 = !{!6, !10, i64 56}
!16 = !{!6, !7, i64 16}
!17 = !{!6, !10, i64 72}
!18 = !{!6, !7, i64 40}
!19 = !{!6, !11, i64 64}
!20 = !{!6, !7, i64 32}
!21 = !{!6, !10, i64 60}
!22 = !{!6, !7, i64 24}


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