; LLVM IR from BrunoLevy/learn-fpga :: LiteX/software/Doom/mc1-doom/src (p_floor)

; 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.sector_t = type { i32, i32, i16, i16, i16, i16, i16, i32, ptr, [4 x i32], %struct.degenmobj_t, i32, ptr, ptr, i32, ptr }
%struct.degenmobj_t = type { %struct.thinker_s, i32, i32, i32 }
%struct.thinker_s = type { ptr, ptr, %union.actionf_t }
%union.actionf_t = type { ptr }
%struct.floormove_t = type { %struct.thinker_s, i32, i32, ptr, i32, i32, i16, i32, i32 }
%struct.line_s = type { ptr, ptr, i32, i32, i16, i16, i16, [2 x i16], [4 x i32], i32, ptr, ptr, i32, ptr }

@sectors = external global ptr, align 8

; 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
declare dso_local void @T_MoveFloor(ptr noundef) #1

declare i32 @P_FindSectorFromLineTag(ptr noundef, i32 noundef) #2

declare ptr @Z_Malloc(i32 noundef, i32 noundef, ptr noundef) #2

declare void @P_AddThinker(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @EV_BuildStairs(ptr noundef %0, i32 noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %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 ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  store i32 -1, ptr %5, align 4, !tbaa !9
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %17

17:                                               ; preds = %172, %31, %2
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = load i32, ptr %5, align 4, !tbaa !9
  %20 = call i32 @P_FindSectorFromLineTag(ptr noundef %18, i32 noundef %19)
  store i32 %20, ptr %5, align 4, !tbaa !9
  %21 = icmp sge i32 %20, 0
  br i1 %21, label %22, label %173

22:                                               ; preds = %17
  %23 = load ptr, ptr @sectors, align 8, !tbaa !5
  %24 = load i32, ptr %5, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds %struct.sector_t, ptr %23, i64 %25
  store ptr %26, ptr %12, align 8, !tbaa !5
  %27 = load ptr, ptr %12, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.sector_t, ptr %27, i32 0, i32 13
  %29 = load ptr, ptr %28, align 8, !tbaa !11
  %30 = icmp ne ptr %29, null
  br i1 %30, label %31, label %32

31:                                               ; preds = %22
  br label %17, !llvm.loop !16

32:                                               ; preds = %22
  store i32 1, ptr %11, align 4, !tbaa !9
  %33 = call ptr @Z_Malloc(i32 noundef 64, i32 noundef 51, ptr noundef null)
  store ptr %33, ptr %14, align 8, !tbaa !5
  %34 = load ptr, ptr %14, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.floormove_t, ptr %34, i32 0, i32 0
  call void @P_AddThinker(ptr noundef %35)
  %36 = load ptr, ptr %14, align 8, !tbaa !5
  %37 = load ptr, ptr %12, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.sector_t, ptr %37, i32 0, i32 13
  store ptr %36, ptr %38, align 8, !tbaa !11
  %39 = load ptr, ptr %14, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.floormove_t, ptr %39, i32 0, i32 0
  %41 = getelementptr inbounds %struct.thinker_s, ptr %40, i32 0, i32 2
  store ptr @T_MoveFloor, ptr %41, align 8, !tbaa !18
  %42 = load ptr, ptr %14, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.floormove_t, ptr %42, i32 0, i32 4
  store i32 1, ptr %43, align 8, !tbaa !19
  %44 = load ptr, ptr %12, align 8, !tbaa !5
  %45 = load ptr, ptr %14, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.floormove_t, ptr %45, i32 0, i32 3
  store ptr %44, ptr %46, align 8, !tbaa !21
  %47 = load i32, ptr %4, align 4, !tbaa !9
  switch i32 %47, label %48 [
    i32 0, label %49
    i32 1, label %50
  ]

48:                                               ; preds = %32
  br label %49

49:                                               ; preds = %48, %32
  store i32 16384, ptr %16, align 4, !tbaa !9
  store i32 524288, ptr %15, align 4, !tbaa !9
  br label %51

50:                                               ; preds = %32
  store i32 262144, ptr %16, align 4, !tbaa !9
  store i32 1048576, ptr %15, align 4, !tbaa !9
  br label %51

51:                                               ; preds = %50, %49
  %52 = load i32, ptr %16, align 4, !tbaa !9
  %53 = load ptr, ptr %14, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.floormove_t, ptr %53, i32 0, i32 8
  store i32 %52, ptr %54, align 8, !tbaa !22
  %55 = load ptr, ptr %12, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.sector_t, ptr %55, i32 0, i32 0
  %57 = load i32, ptr %56, align 8, !tbaa !23
  %58 = load i32, ptr %15, align 4, !tbaa !9
  %59 = add nsw i32 %57, %58
  store i32 %59, ptr %6, align 4, !tbaa !9
  %60 = load i32, ptr %6, align 4, !tbaa !9
  %61 = load ptr, ptr %14, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.floormove_t, ptr %61, i32 0, i32 7
  store i32 %60, ptr %62, align 4, !tbaa !24
  %63 = load ptr, ptr %12, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.sector_t, ptr %63, i32 0, i32 2
  %65 = load i16, ptr %64, align 8, !tbaa !25
  %66 = sext i16 %65 to i32
  store i32 %66, ptr %9, align 4, !tbaa !9
  br label %67

67:                                               ; preds = %169, %51
  store i32 0, ptr %10, align 4, !tbaa !9
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %68

68:                                               ; preds = %165, %67
  %69 = load i32, ptr %7, align 4, !tbaa !9
  %70 = load ptr, ptr %12, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.sector_t, ptr %70, i32 0, i32 14
  %72 = load i32, ptr %71, align 8, !tbaa !26
  %73 = icmp slt i32 %69, %72
  br i1 %73, label %74, label %168

74:                                               ; preds = %68
  %75 = load ptr, ptr %12, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.sector_t, ptr %75, i32 0, i32 15
  %77 = load ptr, ptr %76, align 8, !tbaa !27
  %78 = load i32, ptr %7, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds ptr, ptr %77, i64 %79
  %81 = load ptr, ptr %80, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.line_s, ptr %81, i32 0, i32 4
  %83 = load i16, ptr %82, align 8, !tbaa !28
  %84 = sext i16 %83 to i32
  %85 = and i32 %84, 4
  %86 = icmp ne i32 %85, 0
  br i1 %86, label %88, label %87

87:                                               ; preds = %74
  br label %165

88:                                               ; preds = %74
  %89 = load ptr, ptr %12, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.sector_t, ptr %89, i32 0, i32 15
  %91 = load ptr, ptr %90, align 8, !tbaa !27
  %92 = load i32, ptr %7, align 4, !tbaa !9
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds ptr, ptr %91, i64 %93
  %95 = load ptr, ptr %94, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.line_s, ptr %95, i32 0, i32 10
  %97 = load ptr, ptr %96, align 8, !tbaa !30
  store ptr %97, ptr %13, align 8, !tbaa !5
  %98 = load ptr, ptr %13, align 8, !tbaa !5
  %99 = load ptr, ptr @sectors, align 8, !tbaa !5
  %100 = ptrtoint ptr %98 to i64
  %101 = ptrtoint ptr %99 to i64
  %102 = sub i64 %100, %101
  %103 = sdiv exact i64 %102, 128
  %104 = trunc i64 %103 to i32
  store i32 %104, ptr %8, align 4, !tbaa !9
  %105 = load i32, ptr %5, align 4, !tbaa !9
  %106 = load i32, ptr %8, align 4, !tbaa !9
  %107 = icmp ne i32 %105, %106
  br i1 %107, label %108, label %109

108:                                              ; preds = %88
  br label %165

109:                                              ; preds = %88
  %110 = load ptr, ptr %12, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.sector_t, ptr %110, i32 0, i32 15
  %112 = load ptr, ptr %111, align 8, !tbaa !27
  %113 = load i32, ptr %7, align 4, !tbaa !9
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds ptr, ptr %112, i64 %114
  %116 = load ptr, ptr %115, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.line_s, ptr %116, i32 0, i32 11
  %118 = load ptr, ptr %117, align 8, !tbaa !31
  store ptr %118, ptr %13, align 8, !tbaa !5
  %119 = load ptr, ptr %13, align 8, !tbaa !5
  %120 = load ptr, ptr @sectors, align 8, !tbaa !5
  %121 = ptrtoint ptr %119 to i64
  %122 = ptrtoint ptr %120 to i64
  %123 = sub i64 %121, %122
  %124 = sdiv exact i64 %123, 128
  %125 = trunc i64 %124 to i32
  store i32 %125, ptr %8, align 4, !tbaa !9
  %126 = load ptr, ptr %13, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.sector_t, ptr %126, i32 0, i32 2
  %128 = load i16, ptr %127, align 8, !tbaa !25
  %129 = sext i16 %128 to i32
  %130 = load i32, ptr %9, align 4, !tbaa !9
  %131 = icmp ne i32 %129, %130
  br i1 %131, label %132, label %133

132:                                              ; preds = %109
  br label %165

133:                                              ; preds = %109
  %134 = load i32, ptr %15, align 4, !tbaa !9
  %135 = load i32, ptr %6, align 4, !tbaa !9
  %136 = add nsw i32 %135, %134
  store i32 %136, ptr %6, align 4, !tbaa !9
  %137 = load ptr, ptr %13, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.sector_t, ptr %137, i32 0, i32 13
  %139 = load ptr, ptr %138, align 8, !tbaa !11
  %140 = icmp ne ptr %139, null
  br i1 %140, label %141, label %142

141:                                              ; preds = %133
  br label %165

142:                                              ; preds = %133
  %143 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %143, ptr %12, align 8, !tbaa !5
  %144 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %144, ptr %5, align 4, !tbaa !9
  %145 = call ptr @Z_Malloc(i32 noundef 64, i32 noundef 51, ptr noundef null)
  store ptr %145, ptr %14, align 8, !tbaa !5
  %146 = load ptr, ptr %14, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.floormove_t, ptr %146, i32 0, i32 0
  call void @P_AddThinker(ptr noundef %147)
  %148 = load ptr, ptr %14, align 8, !tbaa !5
  %149 = load ptr, ptr %12, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.sector_t, ptr %149, i32 0, i32 13
  store ptr %148, ptr %150, align 8, !tbaa !11
  %151 = load ptr, ptr %14, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.floormove_t, ptr %151, i32 0, i32 0
  %153 = getelementptr inbounds %struct.thinker_s, ptr %152, i32 0, i32 2
  store ptr @T_MoveFloor, ptr %153, align 8, !tbaa !18
  %154 = load ptr, ptr %14, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.floormove_t, ptr %154, i32 0, i32 4
  store i32 1, ptr %155, align 8, !tbaa !19
  %156 = load ptr, ptr %12, align 8, !tbaa !5
  %157 = load ptr, ptr %14, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.floormove_t, ptr %157, i32 0, i32 3
  store ptr %156, ptr %158, align 8, !tbaa !21
  %159 = load i32, ptr %16, align 4, !tbaa !9
  %160 = load ptr, ptr %14, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.floormove_t, ptr %160, i32 0, i32 8
  store i32 %159, ptr %161, align 8, !tbaa !22
  %162 = load i32, ptr %6, align 4, !tbaa !9
  %163 = load ptr, ptr %14, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.floormove_t, ptr %163, i32 0, i32 7
  store i32 %162, ptr %164, align 4, !tbaa !24
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %168

165:                                              ; preds = %141, %132, %108, %87
  %166 = load i32, ptr %7, align 4, !tbaa !9
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %7, align 4, !tbaa !9
  br label %68, !llvm.loop !32

168:                                              ; preds = %142, %68
  br label %169

169:                                              ; preds = %168
  %170 = load i32, ptr %10, align 4, !tbaa !9
  %171 = icmp ne i32 %170, 0
  br i1 %171, label %67, label %172, !llvm.loop !33

172:                                              ; preds = %169
  br label %17, !llvm.loop !16

173:                                              ; preds = %17
  %174 = load i32, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret i32 %174
}

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 }

!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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 104}
!12 = !{!"", !10, i64 0, !10, i64 4, !13, i64 8, !13, i64 10, !13, i64 12, !13, i64 14, !13, i64 16, !10, i64 20, !6, i64 24, !7, i64 32, !14, i64 48, !10, i64 88, !6, i64 96, !6, i64 104, !10, i64 112, !6, i64 120}
!13 = !{!"short", !7, i64 0}
!14 = !{!"", !15, i64 0, !10, i64 24, !10, i64 28, !10, i64 32}
!15 = !{!"thinker_s", !6, i64 0, !6, i64 8, !7, i64 16}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !10, i64 40}
!20 = !{!"", !15, i64 0, !10, i64 24, !10, i64 28, !6, i64 32, !10, i64 40, !10, i64 44, !13, i64 48, !10, i64 52, !10, i64 56}
!21 = !{!20, !6, i64 32}
!22 = !{!20, !10, i64 56}
!23 = !{!12, !10, i64 0}
!24 = !{!20, !10, i64 52}
!25 = !{!12, !13, i64 8}
!26 = !{!12, !10, i64 112}
!27 = !{!12, !6, i64 120}
!28 = !{!29, !13, i64 24}
!29 = !{!"line_s", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !13, i64 24, !13, i64 26, !13, i64 28, !7, i64 30, !7, i64 36, !10, i64 52, !6, i64 56, !6, i64 64, !10, i64 72, !6, i64 80}
!30 = !{!29, !6, i64 56}
!31 = !{!29, !6, i64 64}
!32 = distinct !{!32, !17}
!33 = distinct !{!33, !17}


; 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.sector_t = type { i32, i32, i16, i16, i16, i16, i16, i32, ptr, [4 x i32], %struct.degenmobj_t, i32, ptr, ptr, i32, ptr }
%struct.degenmobj_t = type { %struct.thinker_s, i32, i32, i32 }
%struct.thinker_s = type { ptr, ptr, %union.actionf_t }
%union.actionf_t = type { ptr }

@sectors = external local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
declare dso_local void @T_MoveFloor(ptr noundef) #0

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

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

declare void @P_AddThinker(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @EV_BuildStairs(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %cond = icmp eq i32 %1, 1
  %. = select i1 %cond, i32 1048576, i32 524288
  %.68 = select i1 %cond, i32 262144, i32 16384
  br label %.outer

.outer:                                           ; preds = %.outer.backedge, %2
  %.055.ph = phi i32 [ -1, %2 ], [ %.055.ph.be, %.outer.backedge ]
  %.053.ph = phi i32 [ 0, %2 ], [ 1, %.outer.backedge ]
  br label %3

3:                                                ; preds = %.outer, %6
  %.055 = phi i32 [ %4, %6 ], [ %.055.ph, %.outer ]
  %4 = tail call i32 @P_FindSectorFromLineTag(ptr noundef %0, i32 noundef %.055) #2
  %5 = icmp sgt i32 %4, -1
  br i1 %5, label %6, label %68

6:                                                ; preds = %3
  %7 = load ptr, ptr @sectors, align 8, !tbaa !5
  %8 = zext nneg i32 %4 to i64
  %9 = getelementptr inbounds %struct.sector_t, ptr %7, i64 %8
  %10 = getelementptr inbounds i8, ptr %9, i64 104
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %12, label %3, !llvm.loop !15

12:                                               ; preds = %6
  %13 = getelementptr inbounds i8, ptr %9, i64 104
  %14 = tail call ptr @Z_Malloc(i32 noundef 64, i32 noundef 51, ptr noundef null) #2
  tail call void @P_AddThinker(ptr noundef %14) #2
  store ptr %14, ptr %13, align 8, !tbaa !9
  %15 = getelementptr inbounds i8, ptr %14, i64 16
  store ptr @T_MoveFloor, ptr %15, align 8, !tbaa !17
  %16 = getelementptr inbounds i8, ptr %14, i64 40
  store i32 1, ptr %16, align 8, !tbaa !18
  %17 = getelementptr inbounds i8, ptr %14, i64 32
  store ptr %9, ptr %17, align 8, !tbaa !20
  %18 = getelementptr inbounds i8, ptr %14, i64 56
  store i32 %.68, ptr %18, align 8, !tbaa !21
  %19 = load i32, ptr %9, align 8, !tbaa !22
  %20 = add nsw i32 %19, %.
  %21 = getelementptr inbounds i8, ptr %14, i64 52
  store i32 %20, ptr %21, align 4, !tbaa !23
  %22 = getelementptr inbounds i8, ptr %9, i64 8
  %23 = load i16, ptr %22, align 8, !tbaa !24
  %24 = getelementptr inbounds i8, ptr %9, i64 112
  %25 = load i32, ptr %24, align 8, !tbaa !25
  %.not678489 = icmp sgt i32 %25, 0
  br i1 %.not678489, label %.lr.ph, label %.outer.backedge

.outer.backedge:                                  ; preds = %54, %53, %12
  %.055.ph.be = phi i32 [ %4, %12 ], [ %.15691, %53 ], [ %59, %54 ]
  br label %.outer, !llvm.loop !15

.lr.ph:                                           ; preds = %12, %54
  %26 = phi i32 [ %67, %54 ], [ %25, %12 ]
  %.05292 = phi ptr [ %46, %54 ], [ %9, %12 ]
  %.15691 = phi i32 [ %59, %54 ], [ %4, %12 ]
  %.05890 = phi i32 [ %50, %54 ], [ %20, %12 ]
  %27 = getelementptr inbounds i8, ptr %.05292, i64 120
  %28 = load ptr, ptr %27, align 8, !tbaa !26
  %29 = load ptr, ptr @sectors, align 8
  %30 = ptrtoint ptr %29 to i64
  %wide.trip.count = zext nneg i32 %26 to i64
  br label %31

31:                                               ; preds = %.lr.ph, %53
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %53 ]
  %.15985 = phi i32 [ %.05890, %.lr.ph ], [ %.260, %53 ]
  %32 = getelementptr inbounds ptr, ptr %28, i64 %indvars.iv
  %33 = load ptr, ptr %32, align 8, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %33, i64 24
  %35 = load i16, ptr %34, align 8, !tbaa !27
  %36 = and i16 %35, 4
  %.not62 = icmp eq i16 %36, 0
  br i1 %.not62, label %53, label %37

37:                                               ; preds = %31
  %38 = getelementptr inbounds i8, ptr %33, i64 56
  %39 = load ptr, ptr %38, align 8, !tbaa !29
  %40 = ptrtoint ptr %39 to i64
  %41 = sub i64 %40, %30
  %42 = lshr exact i64 %41, 7
  %43 = trunc i64 %42 to i32
  %.not63 = icmp eq i32 %.15691, %43
  br i1 %.not63, label %44, label %53

44:                                               ; preds = %37
  %45 = getelementptr inbounds i8, ptr %33, i64 64
  %46 = load ptr, ptr %45, align 8, !tbaa !30
  %47 = getelementptr inbounds i8, ptr %46, i64 8
  %48 = load i16, ptr %47, align 8, !tbaa !24
  %.not64 = icmp eq i16 %48, %23
  br i1 %.not64, label %49, label %53

49:                                               ; preds = %44
  %50 = add nsw i32 %.15985, %.
  %51 = getelementptr inbounds i8, ptr %46, i64 104
  %52 = load ptr, ptr %51, align 8, !tbaa !9
  %.not65 = icmp eq ptr %52, null
  br i1 %.not65, label %54, label %53

53:                                               ; preds = %49, %44, %37, %31
  %.260 = phi i32 [ %.15985, %37 ], [ %.15985, %44 ], [ %50, %49 ], [ %.15985, %31 ]
  %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 %.outer.backedge, label %31, !llvm.loop !31

54:                                               ; preds = %49
  %55 = getelementptr inbounds i8, ptr %46, i64 104
  %56 = ptrtoint ptr %46 to i64
  %57 = sub i64 %56, %30
  %58 = lshr exact i64 %57, 7
  %59 = trunc i64 %58 to i32
  %60 = tail call ptr @Z_Malloc(i32 noundef 64, i32 noundef 51, ptr noundef null) #2
  tail call void @P_AddThinker(ptr noundef %60) #2
  store ptr %60, ptr %55, align 8, !tbaa !9
  %61 = getelementptr inbounds i8, ptr %60, i64 16
  store ptr @T_MoveFloor, ptr %61, align 8, !tbaa !17
  %62 = getelementptr inbounds i8, ptr %60, i64 40
  store i32 1, ptr %62, align 8, !tbaa !18
  %63 = getelementptr inbounds i8, ptr %60, i64 32
  store ptr %46, ptr %63, align 8, !tbaa !20
  %64 = getelementptr inbounds i8, ptr %60, i64 56
  store i32 %.68, ptr %64, align 8, !tbaa !21
  %65 = getelementptr inbounds i8, ptr %60, i64 52
  store i32 %50, ptr %65, align 4, !tbaa !23
  %66 = getelementptr inbounds i8, ptr %46, i64 112
  %67 = load i32, ptr %66, align 8, !tbaa !25
  %.not6784 = icmp sgt i32 %67, 0
  br i1 %.not6784, label %.lr.ph, label %.outer.backedge, !llvm.loop !15

68:                                               ; preds = %3
  ret i32 %.053.ph
}

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 = { "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, !6, i64 104}
!10 = !{!"", !11, i64 0, !11, i64 4, !12, i64 8, !12, i64 10, !12, i64 12, !12, i64 14, !12, i64 16, !11, i64 20, !6, i64 24, !7, i64 32, !13, i64 48, !11, i64 88, !6, i64 96, !6, i64 104, !11, i64 112, !6, i64 120}
!11 = !{!"int", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!"", !14, i64 0, !11, i64 24, !11, i64 28, !11, i64 32}
!14 = !{!"thinker_s", !6, i64 0, !6, i64 8, !7, i64 16}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!7, !7, i64 0}
!18 = !{!19, !11, i64 40}
!19 = !{!"", !14, i64 0, !11, i64 24, !11, i64 28, !6, i64 32, !11, i64 40, !11, i64 44, !12, i64 48, !11, i64 52, !11, i64 56}
!20 = !{!19, !6, i64 32}
!21 = !{!19, !11, i64 56}
!22 = !{!10, !11, i64 0}
!23 = !{!19, !11, i64 52}
!24 = !{!10, !12, i64 8}
!25 = !{!10, !11, i64 112}
!26 = !{!10, !6, i64 120}
!27 = !{!28, !12, i64 24}
!28 = !{!"line_s", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !12, i64 24, !12, i64 26, !12, i64 28, !7, i64 30, !7, i64 36, !11, i64 52, !6, i64 56, !6, i64 64, !11, i64 72, !6, i64 80}
!29 = !{!28, !6, i64 56}
!30 = !{!28, !6, i64 64}
!31 = distinct !{!31, !16}


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