; LLVM IR from cselab/aphros :: src/inside (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.Inside = type { i32, ptr, ptr, ptr, %struct.anon }
%struct.anon = type { [2 x double], double, ptr, ptr, ptr, i32, i32 }
%struct.InsideInfo = type { double, i32, i32, i32, i32 }

; 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 uwtable
define dso_local i32 @inside_info(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #2
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.Inside, ptr %14, i32 0, i32 4
  %16 = getelementptr inbounds %struct.anon, ptr %15, i32 0, i32 5
  %17 = load i32, ptr %16, align 8, !tbaa !9
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.InsideInfo, ptr %18, i32 0, i32 1
  store i32 %17, ptr %19, align 8, !tbaa !14
  store i32 %17, ptr %5, align 4, !tbaa !16
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.Inside, ptr %20, i32 0, i32 4
  %22 = getelementptr inbounds %struct.anon, ptr %21, i32 0, i32 6
  %23 = load i32, ptr %22, align 4, !tbaa !17
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.InsideInfo, ptr %24, i32 0, i32 2
  store i32 %23, ptr %25, align 4, !tbaa !18
  store i32 %23, ptr %6, align 4, !tbaa !16
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.Inside, ptr %26, i32 0, i32 4
  %28 = getelementptr inbounds %struct.anon, ptr %27, i32 0, i32 1
  %29 = load double, ptr %28, align 8, !tbaa !19
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.InsideInfo, ptr %30, i32 0, i32 0
  store double %29, ptr %31, align 8, !tbaa !20
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.Inside, ptr %32, i32 0, i32 4
  %34 = getelementptr inbounds %struct.anon, ptr %33, i32 0, i32 3
  %35 = load ptr, ptr %34, align 8, !tbaa !21
  store ptr %35, ptr %13, align 8, !tbaa !5
  store i32 0, ptr %11, align 4, !tbaa !16
  store i32 2147483647, ptr %12, align 4, !tbaa !16
  store i32 0, ptr %7, align 4, !tbaa !16
  br label %36

36:                                               ; preds = %87, %2
  %37 = load i32, ptr %7, align 4, !tbaa !16
  %38 = load i32, ptr %5, align 4, !tbaa !16
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %40, label %90

40:                                               ; preds = %36
  store i32 0, ptr %8, align 4, !tbaa !16
  br label %41

41:                                               ; preds = %83, %40
  %42 = load i32, ptr %8, align 4, !tbaa !16
  %43 = load i32, ptr %6, align 4, !tbaa !16
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %45, label %86

45:                                               ; preds = %41
  %46 = load i32, ptr %7, align 4, !tbaa !16
  %47 = load i32, ptr %8, align 4, !tbaa !16
  %48 = load i32, ptr %5, align 4, !tbaa !16
  %49 = mul nsw i32 %47, %48
  %50 = add nsw i32 %46, %49
  store i32 %50, ptr %9, align 4, !tbaa !16
  %51 = load i32, ptr %9, align 4, !tbaa !16
  %52 = icmp slt i32 %51, 0
  br i1 %52, label %53, label %54

53:                                               ; preds = %45
  store i32 0, ptr %9, align 4, !tbaa !16
  br label %54

54:                                               ; preds = %53, %45
  %55 = load i32, ptr %9, align 4, !tbaa !16
  %56 = load i32, ptr %5, align 4, !tbaa !16
  %57 = load i32, ptr %6, align 4, !tbaa !16
  %58 = mul nsw i32 %56, %57
  %59 = icmp sge i32 %55, %58
  br i1 %59, label %60, label %65

60:                                               ; preds = %54
  %61 = load i32, ptr %5, align 4, !tbaa !16
  %62 = load i32, ptr %6, align 4, !tbaa !16
  %63 = mul nsw i32 %61, %62
  %64 = sub nsw i32 %63, 1
  store i32 %64, ptr %9, align 4, !tbaa !16
  br label %65

65:                                               ; preds = %60, %54
  %66 = load ptr, ptr %13, align 8, !tbaa !5
  %67 = load i32, ptr %9, align 4, !tbaa !16
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds i32, ptr %66, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !16
  store i32 %70, ptr %10, align 4, !tbaa !16
  %71 = load i32, ptr %10, align 4, !tbaa !16
  %72 = load i32, ptr %11, align 4, !tbaa !16
  %73 = icmp sgt i32 %71, %72
  br i1 %73, label %74, label %76

74:                                               ; preds = %65
  %75 = load i32, ptr %10, align 4, !tbaa !16
  store i32 %75, ptr %11, align 4, !tbaa !16
  br label %76

76:                                               ; preds = %74, %65
  %77 = load i32, ptr %10, align 4, !tbaa !16
  %78 = load i32, ptr %12, align 4, !tbaa !16
  %79 = icmp slt i32 %77, %78
  br i1 %79, label %80, label %82

80:                                               ; preds = %76
  %81 = load i32, ptr %10, align 4, !tbaa !16
  store i32 %81, ptr %12, align 4, !tbaa !16
  br label %82

82:                                               ; preds = %80, %76
  br label %83

83:                                               ; preds = %82
  %84 = load i32, ptr %8, align 4, !tbaa !16
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %8, align 4, !tbaa !16
  br label %41, !llvm.loop !22

86:                                               ; preds = %41
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %7, align 4, !tbaa !16
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %7, align 4, !tbaa !16
  br label %36, !llvm.loop !24

90:                                               ; preds = %36
  %91 = load i32, ptr %12, align 4, !tbaa !16
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.InsideInfo, ptr %92, i32 0, i32 4
  store i32 %91, ptr %93, align 4, !tbaa !25
  %94 = load i32, ptr %11, align 4, !tbaa !16
  %95 = load ptr, ptr %4, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.InsideInfo, ptr %95, i32 0, i32 3
  store i32 %94, ptr %96, align 8, !tbaa !26
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  ret i32 0
}

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 = { 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, !11, i64 80}
!10 = !{!"Inside", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !12, i64 32}
!11 = !{!"int", !7, i64 0}
!12 = !{!"", !7, i64 0, !13, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !11, i64 48, !11, i64 52}
!13 = !{!"double", !7, i64 0}
!14 = !{!15, !11, i64 8}
!15 = !{!"InsideInfo", !13, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!16 = !{!11, !11, i64 0}
!17 = !{!10, !11, i64 84}
!18 = !{!15, !11, i64 12}
!19 = !{!10, !13, i64 48}
!20 = !{!15, !13, i64 0}
!21 = !{!10, !6, i64 64}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}
!25 = !{!15, !11, i64 20}
!26 = !{!15, !11, i64 16}


; 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: nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local noundef i32 @inside_info(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 80
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 8
  store i32 %4, ptr %5, align 8, !tbaa !13
  %6 = getelementptr inbounds i8, ptr %0, i64 84
  %7 = load i32, ptr %6, align 4, !tbaa !15
  %8 = getelementptr inbounds i8, ptr %1, i64 12
  store i32 %7, ptr %8, align 4, !tbaa !16
  %9 = getelementptr inbounds i8, ptr %0, i64 48
  %10 = load double, ptr %9, align 8, !tbaa !17
  store double %10, ptr %1, align 8, !tbaa !18
  %11 = getelementptr inbounds i8, ptr %0, i64 64
  %12 = load ptr, ptr %11, align 8, !tbaa !19
  %13 = icmp sgt i32 %4, 0
  br i1 %13, label %.preheader.lr.ph, label %._crit_edge51

.preheader.lr.ph:                                 ; preds = %2
  %14 = icmp sgt i32 %7, 0
  %15 = mul nsw i32 %7, %4
  %16 = add nsw i32 %15, -1
  br i1 %14, label %.preheader.us.preheader, label %._crit_edge51

.preheader.us.preheader:                          ; preds = %.preheader.lr.ph
  %xtraiter = and i32 %7, 1
  %17 = icmp eq i32 %7, 1
  %unroll_iter = and i32 %7, 2147483646
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge.us
  %.050.us = phi i32 [ %35, %._crit_edge.us ], [ 0, %.preheader.us.preheader ]
  %.03349.us = phi i32 [ %.2.us.lcssa, %._crit_edge.us ], [ 2147483647, %.preheader.us.preheader ]
  %.03448.us = phi i32 [ %.236.us.lcssa, %._crit_edge.us ], [ 0, %.preheader.us.preheader ]
  br i1 %17, label %._crit_edge.us.unr-lcssa, label %.preheader.us.new

.preheader.us.new:                                ; preds = %.preheader.us, %.preheader.us.new
  %.146.us = phi i32 [ %.2.us.1, %.preheader.us.new ], [ %.03349.us, %.preheader.us ]
  %.13545.us = phi i32 [ %.236.us.1, %.preheader.us.new ], [ %.03448.us, %.preheader.us ]
  %.03744.us = phi i32 [ %29, %.preheader.us.new ], [ 0, %.preheader.us ]
  %niter = phi i32 [ %niter.next.1, %.preheader.us.new ], [ 0, %.preheader.us ]
  %18 = mul nuw nsw i32 %.03744.us, %4
  %19 = add nuw nsw i32 %18, %.050.us
  %.not.us = icmp slt i32 %19, %15
  %spec.select.us = select i1 %.not.us, i32 %19, i32 %16
  %20 = sext i32 %spec.select.us to i64
  %21 = getelementptr inbounds i32, ptr %12, i64 %20
  %22 = load i32, ptr %21, align 4, !tbaa !20
  %.236.us = tail call i32 @llvm.smax.i32(i32 %22, i32 %.13545.us)
  %.2.us = tail call i32 @llvm.smin.i32(i32 %22, i32 %.146.us)
  %23 = or disjoint i32 %.03744.us, 1
  %24 = mul nuw nsw i32 %23, %4
  %25 = add nuw nsw i32 %24, %.050.us
  %.not.us.1 = icmp slt i32 %25, %15
  %spec.select.us.1 = select i1 %.not.us.1, i32 %25, i32 %16
  %26 = sext i32 %spec.select.us.1 to i64
  %27 = getelementptr inbounds i32, ptr %12, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !20
  %.236.us.1 = tail call i32 @llvm.smax.i32(i32 %28, i32 %.236.us)
  %.2.us.1 = tail call i32 @llvm.smin.i32(i32 %28, i32 %.2.us)
  %29 = add nuw nsw i32 %.03744.us, 2
  %niter.next.1 = add i32 %niter, 2
  %niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.us.unr-lcssa, label %.preheader.us.new, !llvm.loop !21

._crit_edge.us.unr-lcssa:                         ; preds = %.preheader.us.new, %.preheader.us
  %.236.us.lcssa.ph = phi i32 [ poison, %.preheader.us ], [ %.236.us.1, %.preheader.us.new ]
  %.2.us.lcssa.ph = phi i32 [ poison, %.preheader.us ], [ %.2.us.1, %.preheader.us.new ]
  %.146.us.unr = phi i32 [ %.03349.us, %.preheader.us ], [ %.2.us.1, %.preheader.us.new ]
  %.13545.us.unr = phi i32 [ %.03448.us, %.preheader.us ], [ %.236.us.1, %.preheader.us.new ]
  %.03744.us.unr = phi i32 [ 0, %.preheader.us ], [ %29, %.preheader.us.new ]
  br i1 %lcmp.mod.not, label %._crit_edge.us, label %._crit_edge.us.epilog-lcssa

._crit_edge.us.epilog-lcssa:                      ; preds = %._crit_edge.us.unr-lcssa
  %30 = mul nuw nsw i32 %.03744.us.unr, %4
  %31 = add nuw nsw i32 %30, %.050.us
  %.not.us.epil = icmp slt i32 %31, %15
  %spec.select.us.epil = select i1 %.not.us.epil, i32 %31, i32 %16
  %32 = sext i32 %spec.select.us.epil to i64
  %33 = getelementptr inbounds i32, ptr %12, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !20
  %.236.us.epil = tail call i32 @llvm.smax.i32(i32 %34, i32 %.13545.us.unr)
  %.2.us.epil = tail call i32 @llvm.smin.i32(i32 %34, i32 %.146.us.unr)
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %._crit_edge.us.unr-lcssa, %._crit_edge.us.epilog-lcssa
  %.236.us.lcssa = phi i32 [ %.236.us.lcssa.ph, %._crit_edge.us.unr-lcssa ], [ %.236.us.epil, %._crit_edge.us.epilog-lcssa ]
  %.2.us.lcssa = phi i32 [ %.2.us.lcssa.ph, %._crit_edge.us.unr-lcssa ], [ %.2.us.epil, %._crit_edge.us.epilog-lcssa ]
  %35 = add nuw nsw i32 %.050.us, 1
  %exitcond56.not = icmp eq i32 %35, %4
  br i1 %exitcond56.not, label %._crit_edge51, label %.preheader.us, !llvm.loop !23

._crit_edge51:                                    ; preds = %._crit_edge.us, %.preheader.lr.ph, %2
  %.034.lcssa = phi i32 [ 0, %2 ], [ 0, %.preheader.lr.ph ], [ %.236.us.lcssa, %._crit_edge.us ]
  %.033.lcssa = phi i32 [ 2147483647, %2 ], [ 2147483647, %.preheader.lr.ph ], [ %.2.us.lcssa, %._crit_edge.us ]
  %36 = getelementptr inbounds i8, ptr %1, i64 20
  store i32 %.033.lcssa, ptr %36, align 4, !tbaa !24
  %37 = getelementptr inbounds i8, ptr %1, i64 16
  store i32 %.034.lcssa, ptr %37, align 8, !tbaa !25
  ret i32 0
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #1

attributes #0 = { nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !7, i64 80}
!6 = !{!"Inside", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !11, i64 32}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"", !8, i64 0, !12, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !7, i64 48, !7, i64 52}
!12 = !{!"double", !8, i64 0}
!13 = !{!14, !7, i64 8}
!14 = !{!"InsideInfo", !12, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!15 = !{!6, !7, i64 84}
!16 = !{!14, !7, i64 12}
!17 = !{!6, !12, i64 48}
!18 = !{!14, !12, i64 0}
!19 = !{!6, !10, i64 64}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = !{!14, !7, i64 20}
!25 = !{!14, !7, i64 16}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass