; LLVM IR from Dynmi/AlexNet :: src (data)

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

@.str.4 = external hidden unnamed_addr constant [6 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: inlinehint nounwind uwtable
declare dso_local void @make_image(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare dso_local void @load_image(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @get_next_batch(i32 noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, ptr noundef %7) #3 {
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca %struct.image, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca [256 x i8], align 16
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca %struct.image, align 8
  store i32 %0, ptr %9, align 4, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !9
  store ptr %2, ptr %11, align 8, !tbaa !9
  store i32 %3, ptr %12, align 4, !tbaa !5
  store i32 %4, ptr %13, align 4, !tbaa !5
  store i32 %5, ptr %14, align 4, !tbaa !5
  store i32 %6, ptr %15, align 4, !tbaa !5
  store ptr %7, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #6
  %24 = load i32, ptr %12, align 4, !tbaa !5
  %25 = load i32, ptr %13, align 4, !tbaa !5
  %26 = load i32, ptr %14, align 4, !tbaa !5
  call void @make_image(ptr noundef %17, i32 noundef %24, i32 noundef %25, i32 noundef %26)
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.start.p0(i64 256, ptr %20) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  %27 = load i32, ptr %12, align 4, !tbaa !5
  %28 = load i32, ptr %13, align 4, !tbaa !5
  %29 = mul nsw i32 %27, %28
  %30 = load i32, ptr %14, align 4, !tbaa !5
  %31 = mul nsw i32 %29, %30
  store i32 %31, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 0, ptr %22, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %67, %8
  %33 = load i32, ptr %22, align 4, !tbaa !5
  %34 = load i32, ptr %9, align 4, !tbaa !5
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  br label %70

37:                                               ; preds = %32
  %38 = load ptr, ptr %16, align 8, !tbaa !9
  %39 = call i32 @feof(ptr noundef %38) #6
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %43

41:                                               ; preds = %37
  %42 = load ptr, ptr %16, align 8, !tbaa !9
  call void @rewind(ptr noundef %42)
  br label %43

43:                                               ; preds = %41, %37
  %44 = load ptr, ptr %16, align 8, !tbaa !9
  %45 = getelementptr inbounds [256 x i8], ptr %20, i64 0, i64 0
  %46 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %44, ptr noundef @.str.4, ptr noundef %18, ptr noundef %45)
  %47 = load i32, ptr %18, align 4, !tbaa !5
  %48 = load ptr, ptr %11, align 8, !tbaa !9
  %49 = load i32, ptr %22, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i32, ptr %48, i64 %50
  store i32 %47, ptr %51, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %23) #6
  %52 = getelementptr inbounds [256 x i8], ptr %20, i64 0, i64 0
  %53 = load i32, ptr %12, align 4, !tbaa !5
  %54 = load i32, ptr %13, align 4, !tbaa !5
  %55 = load i32, ptr %14, align 4, !tbaa !5
  call void @load_image(ptr dead_on_unwind writable sret(%struct.image) align 8 %23, ptr noundef %52, i32 noundef %53, i32 noundef %54, i32 noundef %55, i32 noundef 0)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %17, ptr align 8 %23, i64 24, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 24, ptr %23) #6
  %56 = load ptr, ptr %10, align 8, !tbaa !9
  %57 = load i32, ptr %22, align 4, !tbaa !5
  %58 = load i32, ptr %21, align 4, !tbaa !5
  %59 = mul nsw i32 %57, %58
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds float, ptr %56, i64 %60
  %62 = getelementptr inbounds %struct.image, ptr %17, i32 0, i32 3
  %63 = load ptr, ptr %62, align 8, !tbaa !12
  %64 = load i32, ptr %21, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = mul i64 %65, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %61, ptr align 4 %63, i64 %66, i1 false)
  br label %67

67:                                               ; preds = %43
  %68 = load i32, ptr %22, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %22, align 4, !tbaa !5
  br label %32, !llvm.loop !14

70:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 256, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #6
  ret void
}

; Function Attrs: nounwind
declare i32 @feof(ptr noundef) #4

declare void @rewind(ptr noundef) #5

declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 = { "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 #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5, i64 16, i64 8, !9}
!12 = !{!13, !10, i64 16}
!13 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !10, i64 16}
!14 = distinct !{!14, !15}
!15 = !{!"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.image = type { i32, i32, i32, ptr }

@.str.4 = external hidden unnamed_addr constant [6 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

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

; Function Attrs: inlinehint nounwind uwtable
declare dso_local void @make_image(ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare dso_local void @load_image(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @get_next_batch(i32 noundef %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef writeonly %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, ptr noundef %7) local_unnamed_addr #3 {
  %9 = alloca %struct.image, align 8
  %10 = alloca i32, align 4
  %11 = alloca [256 x i8], align 16
  %12 = alloca %struct.image, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #6
  call void @make_image(ptr noundef nonnull %9, i32 noundef %3, i32 noundef %4, i32 noundef %5)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #6
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %11) #6
  %13 = icmp sgt i32 %0, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %8
  %14 = mul nsw i32 %4, %3
  %15 = mul nsw i32 %14, %5
  %16 = getelementptr inbounds i8, ptr %9, i64 16
  %17 = sext i32 %15 to i64
  %18 = shl nsw i64 %17, 2
  %wide.trip.count = zext nneg i32 %0 to i64
  br label %19

._crit_edge:                                      ; preds = %22, %8
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #6
  ret void

19:                                               ; preds = %.lr.ph, %22
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %22 ]
  %20 = call i32 @feof(ptr noundef %7) #6
  %.not = icmp eq i32 %20, 0
  br i1 %.not, label %22, label %21

21:                                               ; preds = %19
  call void @rewind(ptr noundef %7)
  br label %22

22:                                               ; preds = %21, %19
  %23 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %7, ptr noundef nonnull @.str.4, ptr noundef nonnull %10, ptr noundef nonnull %11) #6
  %24 = load i32, ptr %10, align 4, !tbaa !5
  %25 = getelementptr inbounds i32, ptr %2, i64 %indvars.iv
  store i32 %24, ptr %25, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %12) #6
  call void @load_image(ptr dead_on_unwind nonnull writable sret(%struct.image) align 8 %12, ptr noundef nonnull %11, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef 0)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(24) %12, i64 24, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #6
  %26 = mul nsw i64 %indvars.iv, %17
  %27 = getelementptr inbounds float, ptr %1, i64 %26
  %28 = load ptr, ptr %16, align 8, !tbaa !12
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %27, ptr align 4 %28, i64 %18, i1 false)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %19, !llvm.loop !14
}

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

; Function Attrs: nofree nounwind
declare void @rewind(ptr nocapture noundef) local_unnamed_addr #4

declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) local_unnamed_addr #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { "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 #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5, i64 16, i64 8, !10}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!13, !11, i64 16}
!13 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !11, i64 16}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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