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

; 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.seg_t = type { ptr, ptr, i32, i32, ptr, ptr, ptr, ptr }
%struct.vertex_t = type { i32, i32 }
%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.side_t = type { i32, i32, i16, i16, i16, ptr }

@curline = external dso_local global ptr, align 8
@rw_angle1 = external global i32, align 4
@viewangle = external global i32, align 4
@clipangle = external global i32, align 4
@viewangletox = external global [4096 x i32], align 16
@backsector = external dso_local global ptr, align 8
@frontsector = external dso_local global ptr, align 8

; Function Attrs: nounwind uwtable
declare dso_local void @R_ClipSolidWallSegment(i32 noundef, i32 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

; Function Attrs: nounwind uwtable
declare dso_local void @R_ClipPassWallSegment(i32 noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @R_AddLine(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %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
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  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
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %10, ptr @curline, align 8, !tbaa !5
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.seg_t, ptr %11, i32 0, i32 0
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds %struct.vertex_t, ptr %13, i32 0, i32 0
  %15 = load i32, ptr %14, align 4, !tbaa !12
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.seg_t, ptr %16, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  %19 = getelementptr inbounds %struct.vertex_t, ptr %18, i32 0, i32 1
  %20 = load i32, ptr %19, align 4, !tbaa !14
  %21 = call i32 @R_PointToAngle(i32 noundef %15, i32 noundef %20)
  store i32 %21, ptr %5, align 4, !tbaa !15
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.seg_t, ptr %22, i32 0, i32 1
  %24 = load ptr, ptr %23, align 8, !tbaa !16
  %25 = getelementptr inbounds %struct.vertex_t, ptr %24, i32 0, i32 0
  %26 = load i32, ptr %25, align 4, !tbaa !12
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.seg_t, ptr %27, i32 0, i32 1
  %29 = load ptr, ptr %28, align 8, !tbaa !16
  %30 = getelementptr inbounds %struct.vertex_t, ptr %29, i32 0, i32 1
  %31 = load i32, ptr %30, align 4, !tbaa !14
  %32 = call i32 @R_PointToAngle(i32 noundef %26, i32 noundef %31)
  store i32 %32, ptr %6, align 4, !tbaa !15
  %33 = load i32, ptr %5, align 4, !tbaa !15
  %34 = load i32, ptr %6, align 4, !tbaa !15
  %35 = sub i32 %33, %34
  store i32 %35, ptr %7, align 4, !tbaa !15
  %36 = load i32, ptr %7, align 4, !tbaa !15
  %37 = icmp uge i32 %36, -2147483648
  br i1 %37, label %38, label %39

38:                                               ; preds = %1
  store i32 1, ptr %9, align 4
  br label %193

39:                                               ; preds = %1
  %40 = load i32, ptr %5, align 4, !tbaa !15
  store i32 %40, ptr @rw_angle1, align 4, !tbaa !15
  %41 = load i32, ptr @viewangle, align 4, !tbaa !15
  %42 = load i32, ptr %5, align 4, !tbaa !15
  %43 = sub i32 %42, %41
  store i32 %43, ptr %5, align 4, !tbaa !15
  %44 = load i32, ptr @viewangle, align 4, !tbaa !15
  %45 = load i32, ptr %6, align 4, !tbaa !15
  %46 = sub i32 %45, %44
  store i32 %46, ptr %6, align 4, !tbaa !15
  %47 = load i32, ptr %5, align 4, !tbaa !15
  %48 = load i32, ptr @clipangle, align 4, !tbaa !15
  %49 = add i32 %47, %48
  store i32 %49, ptr %8, align 4, !tbaa !15
  %50 = load i32, ptr %8, align 4, !tbaa !15
  %51 = load i32, ptr @clipangle, align 4, !tbaa !15
  %52 = mul i32 2, %51
  %53 = icmp ugt i32 %50, %52
  br i1 %53, label %54, label %65

54:                                               ; preds = %39
  %55 = load i32, ptr @clipangle, align 4, !tbaa !15
  %56 = mul i32 2, %55
  %57 = load i32, ptr %8, align 4, !tbaa !15
  %58 = sub i32 %57, %56
  store i32 %58, ptr %8, align 4, !tbaa !15
  %59 = load i32, ptr %8, align 4, !tbaa !15
  %60 = load i32, ptr %7, align 4, !tbaa !15
  %61 = icmp uge i32 %59, %60
  br i1 %61, label %62, label %63

62:                                               ; preds = %54
  store i32 1, ptr %9, align 4
  br label %193

63:                                               ; preds = %54
  %64 = load i32, ptr @clipangle, align 4, !tbaa !15
  store i32 %64, ptr %5, align 4, !tbaa !15
  br label %65

65:                                               ; preds = %63, %39
  %66 = load i32, ptr @clipangle, align 4, !tbaa !15
  %67 = load i32, ptr %6, align 4, !tbaa !15
  %68 = sub i32 %66, %67
  store i32 %68, ptr %8, align 4, !tbaa !15
  %69 = load i32, ptr %8, align 4, !tbaa !15
  %70 = load i32, ptr @clipangle, align 4, !tbaa !15
  %71 = mul i32 2, %70
  %72 = icmp ugt i32 %69, %71
  br i1 %72, label %73, label %85

73:                                               ; preds = %65
  %74 = load i32, ptr @clipangle, align 4, !tbaa !15
  %75 = mul i32 2, %74
  %76 = load i32, ptr %8, align 4, !tbaa !15
  %77 = sub i32 %76, %75
  store i32 %77, ptr %8, align 4, !tbaa !15
  %78 = load i32, ptr %8, align 4, !tbaa !15
  %79 = load i32, ptr %7, align 4, !tbaa !15
  %80 = icmp uge i32 %78, %79
  br i1 %80, label %81, label %82

81:                                               ; preds = %73
  store i32 1, ptr %9, align 4
  br label %193

82:                                               ; preds = %73
  %83 = load i32, ptr @clipangle, align 4, !tbaa !15
  %84 = sub i32 0, %83
  store i32 %84, ptr %6, align 4, !tbaa !15
  br label %85

85:                                               ; preds = %82, %65
  %86 = load i32, ptr %5, align 4, !tbaa !15
  %87 = add i32 %86, 1073741824
  %88 = lshr i32 %87, 19
  store i32 %88, ptr %5, align 4, !tbaa !15
  %89 = load i32, ptr %6, align 4, !tbaa !15
  %90 = add i32 %89, 1073741824
  %91 = lshr i32 %90, 19
  store i32 %91, ptr %6, align 4, !tbaa !15
  %92 = load i32, ptr %5, align 4, !tbaa !15
  %93 = zext i32 %92 to i64
  %94 = getelementptr inbounds [4096 x i32], ptr @viewangletox, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !15
  store i32 %95, ptr %3, align 4, !tbaa !15
  %96 = load i32, ptr %6, align 4, !tbaa !15
  %97 = zext i32 %96 to i64
  %98 = getelementptr inbounds [4096 x i32], ptr @viewangletox, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !15
  store i32 %99, ptr %4, align 4, !tbaa !15
  %100 = load i32, ptr %3, align 4, !tbaa !15
  %101 = load i32, ptr %4, align 4, !tbaa !15
  %102 = icmp eq i32 %100, %101
  br i1 %102, label %103, label %104

103:                                              ; preds = %85
  store i32 1, ptr %9, align 4
  br label %193

104:                                              ; preds = %85
  %105 = load ptr, ptr %2, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.seg_t, ptr %105, i32 0, i32 7
  %107 = load ptr, ptr %106, align 8, !tbaa !17
  store ptr %107, ptr @backsector, align 8, !tbaa !5
  %108 = load ptr, ptr @backsector, align 8, !tbaa !5
  %109 = icmp ne ptr %108, null
  br i1 %109, label %111, label %110

110:                                              ; preds = %104
  br label %189

111:                                              ; preds = %104
  %112 = load ptr, ptr @backsector, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.sector_t, ptr %112, i32 0, i32 1
  %114 = load i32, ptr %113, align 4, !tbaa !18
  %115 = load ptr, ptr @frontsector, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.sector_t, ptr %115, i32 0, i32 0
  %117 = load i32, ptr %116, align 8, !tbaa !23
  %118 = icmp sle i32 %114, %117
  br i1 %118, label %127, label %119

119:                                              ; preds = %111
  %120 = load ptr, ptr @backsector, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.sector_t, ptr %120, i32 0, i32 0
  %122 = load i32, ptr %121, align 8, !tbaa !23
  %123 = load ptr, ptr @frontsector, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.sector_t, ptr %123, i32 0, i32 1
  %125 = load i32, ptr %124, align 4, !tbaa !18
  %126 = icmp sge i32 %122, %125
  br i1 %126, label %127, label %128

127:                                              ; preds = %119, %111
  br label %189

128:                                              ; preds = %119
  %129 = load ptr, ptr @backsector, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.sector_t, ptr %129, i32 0, i32 1
  %131 = load i32, ptr %130, align 4, !tbaa !18
  %132 = load ptr, ptr @frontsector, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.sector_t, ptr %132, i32 0, i32 1
  %134 = load i32, ptr %133, align 4, !tbaa !18
  %135 = icmp ne i32 %131, %134
  br i1 %135, label %144, label %136

136:                                              ; preds = %128
  %137 = load ptr, ptr @backsector, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.sector_t, ptr %137, i32 0, i32 0
  %139 = load i32, ptr %138, align 8, !tbaa !23
  %140 = load ptr, ptr @frontsector, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.sector_t, ptr %140, i32 0, i32 0
  %142 = load i32, ptr %141, align 8, !tbaa !23
  %143 = icmp ne i32 %139, %142
  br i1 %143, label %144, label %145

144:                                              ; preds = %136, %128
  br label %185

145:                                              ; preds = %136
  %146 = load ptr, ptr @backsector, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.sector_t, ptr %146, i32 0, i32 3
  %148 = load i16, ptr %147, align 2, !tbaa !24
  %149 = sext i16 %148 to i32
  %150 = load ptr, ptr @frontsector, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.sector_t, ptr %150, i32 0, i32 3
  %152 = load i16, ptr %151, align 2, !tbaa !24
  %153 = sext i16 %152 to i32
  %154 = icmp eq i32 %149, %153
  br i1 %154, label %155, label %184

155:                                              ; preds = %145
  %156 = load ptr, ptr @backsector, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.sector_t, ptr %156, i32 0, i32 2
  %158 = load i16, ptr %157, align 8, !tbaa !25
  %159 = sext i16 %158 to i32
  %160 = load ptr, ptr @frontsector, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.sector_t, ptr %160, i32 0, i32 2
  %162 = load i16, ptr %161, align 8, !tbaa !25
  %163 = sext i16 %162 to i32
  %164 = icmp eq i32 %159, %163
  br i1 %164, label %165, label %184

165:                                              ; preds = %155
  %166 = load ptr, ptr @backsector, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.sector_t, ptr %166, i32 0, i32 4
  %168 = load i16, ptr %167, align 4, !tbaa !26
  %169 = sext i16 %168 to i32
  %170 = load ptr, ptr @frontsector, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.sector_t, ptr %170, i32 0, i32 4
  %172 = load i16, ptr %171, align 4, !tbaa !26
  %173 = sext i16 %172 to i32
  %174 = icmp eq i32 %169, %173
  br i1 %174, label %175, label %184

175:                                              ; preds = %165
  %176 = load ptr, ptr @curline, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.seg_t, ptr %176, i32 0, i32 4
  %178 = load ptr, ptr %177, align 8, !tbaa !27
  %179 = getelementptr inbounds %struct.side_t, ptr %178, i32 0, i32 4
  %180 = load i16, ptr %179, align 4, !tbaa !28
  %181 = sext i16 %180 to i32
  %182 = icmp eq i32 %181, 0
  br i1 %182, label %183, label %184

183:                                              ; preds = %175
  store i32 1, ptr %9, align 4
  br label %193

184:                                              ; preds = %175, %165, %155, %145
  br label %185

185:                                              ; preds = %184, %144
  %186 = load i32, ptr %3, align 4, !tbaa !15
  %187 = load i32, ptr %4, align 4, !tbaa !15
  %188 = sub nsw i32 %187, 1
  call void @R_ClipPassWallSegment(i32 noundef %186, i32 noundef %188)
  store i32 1, ptr %9, align 4
  br label %193

189:                                              ; preds = %127, %110
  %190 = load i32, ptr %3, align 4, !tbaa !15
  %191 = load i32, ptr %4, align 4, !tbaa !15
  %192 = sub nsw i32 %191, 1
  call void @R_ClipSolidWallSegment(i32 noundef %190, i32 noundef %192)
  store i32 0, ptr %9, align 4
  br label %193

193:                                              ; preds = %189, %185, %183, %103, %81, %62, %38
  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
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  %194 = load i32, ptr %9, align 4
  switch i32 %194, label %196 [
    i32 0, label %195
    i32 1, label %195
  ]

195:                                              ; preds = %193, %193
  ret void

196:                                              ; preds = %193
  unreachable
}

declare i32 @R_PointToAngle(i32 noundef, i32 noundef) #2

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 0}
!10 = !{!"", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 0}
!13 = !{!"", !11, i64 0, !11, i64 4}
!14 = !{!13, !11, i64 4}
!15 = !{!11, !11, i64 0}
!16 = !{!10, !6, i64 8}
!17 = !{!10, !6, i64 48}
!18 = !{!19, !11, i64 4}
!19 = !{!"", !11, i64 0, !11, i64 4, !20, i64 8, !20, i64 10, !20, i64 12, !20, i64 14, !20, i64 16, !11, i64 20, !6, i64 24, !7, i64 32, !21, i64 48, !11, i64 88, !6, i64 96, !6, i64 104, !11, i64 112, !6, i64 120}
!20 = !{!"short", !7, i64 0}
!21 = !{!"", !22, i64 0, !11, i64 24, !11, i64 28, !11, i64 32}
!22 = !{!"thinker_s", !6, i64 0, !6, i64 8, !7, i64 16}
!23 = !{!19, !11, i64 0}
!24 = !{!19, !20, i64 10}
!25 = !{!19, !20, i64 8}
!26 = !{!19, !20, i64 12}
!27 = !{!10, !6, i64 24}
!28 = !{!29, !20, i64 12}
!29 = !{!"", !11, i64 0, !11, i64 4, !20, i64 8, !20, i64 10, !20, i64 12, !6, 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"

@curline = external dso_local local_unnamed_addr global ptr, align 8
@rw_angle1 = external local_unnamed_addr global i32, align 4
@viewangle = external local_unnamed_addr global i32, align 4
@clipangle = external local_unnamed_addr global i32, align 4
@viewangletox = external local_unnamed_addr global [4096 x i32], align 16
@backsector = external dso_local local_unnamed_addr global ptr, align 8
@frontsector = external dso_local local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
declare dso_local void @R_ClipSolidWallSegment(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @R_ClipPassWallSegment(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @R_AddLine(ptr noundef %0) local_unnamed_addr #0 {
  store ptr %0, ptr @curline, align 8, !tbaa !5
  %2 = load ptr, ptr %0, align 8, !tbaa !9
  %3 = load i32, ptr %2, align 4, !tbaa !12
  %4 = getelementptr inbounds i8, ptr %2, i64 4
  %5 = load i32, ptr %4, align 4, !tbaa !14
  %6 = tail call i32 @R_PointToAngle(i32 noundef %3, i32 noundef %5) #2
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load ptr, ptr %7, align 8, !tbaa !15
  %9 = load i32, ptr %8, align 4, !tbaa !12
  %10 = getelementptr inbounds i8, ptr %8, i64 4
  %11 = load i32, ptr %10, align 4, !tbaa !14
  %12 = tail call i32 @R_PointToAngle(i32 noundef %9, i32 noundef %11) #2
  %13 = sub i32 %6, %12
  %14 = icmp slt i32 %13, 0
  br i1 %14, label %86, label %15

15:                                               ; preds = %1
  store i32 %6, ptr @rw_angle1, align 4, !tbaa !16
  %16 = load i32, ptr @viewangle, align 4, !tbaa !16
  %17 = sub i32 %6, %16
  %18 = sub i32 %12, %16
  %19 = load i32, ptr @clipangle, align 4, !tbaa !16
  %20 = add i32 %17, %19
  %21 = shl i32 %19, 1
  %22 = icmp ugt i32 %20, %21
  br i1 %22, label %23, label %25

23:                                               ; preds = %15
  %24 = sub i32 %20, %21
  %.not = icmp ult i32 %24, %13
  br i1 %.not, label %25, label %86

25:                                               ; preds = %23, %15
  %.0 = phi i32 [ %17, %15 ], [ %19, %23 ]
  %26 = sub i32 %19, %18
  %27 = icmp ugt i32 %26, %21
  br i1 %27, label %28, label %32

28:                                               ; preds = %25
  %29 = sub i32 %26, %21
  %.not44 = icmp ult i32 %29, %13
  br i1 %.not44, label %30, label %86

30:                                               ; preds = %28
  %31 = sub i32 0, %19
  br label %32

32:                                               ; preds = %30, %25
  %.031 = phi i32 [ %31, %30 ], [ %18, %25 ]
  %33 = add i32 %.0, 1073741824
  %34 = lshr i32 %33, 19
  %35 = add i32 %.031, 1073741824
  %36 = lshr i32 %35, 19
  %37 = zext nneg i32 %34 to i64
  %38 = getelementptr inbounds [4096 x i32], ptr @viewangletox, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !16
  %40 = zext nneg i32 %36 to i64
  %41 = getelementptr inbounds [4096 x i32], ptr @viewangletox, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !16
  %43 = icmp eq i32 %39, %42
  br i1 %43, label %86, label %44

44:                                               ; preds = %32
  %45 = getelementptr inbounds i8, ptr %0, i64 48
  %46 = load ptr, ptr %45, align 8, !tbaa !17
  store ptr %46, ptr @backsector, align 8, !tbaa !5
  %.not45 = icmp eq ptr %46, null
  br i1 %.not45, label %84, label %47

47:                                               ; preds = %44
  %48 = getelementptr inbounds i8, ptr %46, i64 4
  %49 = load i32, ptr %48, align 4, !tbaa !18
  %50 = load ptr, ptr @frontsector, align 8, !tbaa !5
  %51 = load i32, ptr %50, align 8, !tbaa !23
  %.not46 = icmp sgt i32 %49, %51
  br i1 %.not46, label %52, label %84

52:                                               ; preds = %47
  %53 = load i32, ptr %46, align 8, !tbaa !23
  %54 = getelementptr inbounds i8, ptr %50, i64 4
  %55 = load i32, ptr %54, align 4, !tbaa !18
  %.not47 = icmp slt i32 %53, %55
  br i1 %.not47, label %56, label %84

56:                                               ; preds = %52
  %.not48 = icmp eq i32 %49, %55
  %.not49 = icmp eq i32 %53, %51
  %or.cond = and i1 %.not49, %.not48
  br i1 %or.cond, label %57, label %82

57:                                               ; preds = %56
  %58 = getelementptr inbounds i8, ptr %46, i64 10
  %59 = load i16, ptr %58, align 2, !tbaa !24
  %60 = getelementptr inbounds i8, ptr %50, i64 10
  %61 = load i16, ptr %60, align 2, !tbaa !24
  %62 = icmp eq i16 %59, %61
  br i1 %62, label %63, label %82

63:                                               ; preds = %57
  %64 = getelementptr inbounds i8, ptr %46, i64 8
  %65 = load i16, ptr %64, align 8, !tbaa !25
  %66 = getelementptr inbounds i8, ptr %50, i64 8
  %67 = load i16, ptr %66, align 8, !tbaa !25
  %68 = icmp eq i16 %65, %67
  br i1 %68, label %69, label %82

69:                                               ; preds = %63
  %70 = getelementptr inbounds i8, ptr %46, i64 12
  %71 = load i16, ptr %70, align 4, !tbaa !26
  %72 = getelementptr inbounds i8, ptr %50, i64 12
  %73 = load i16, ptr %72, align 4, !tbaa !26
  %74 = icmp eq i16 %71, %73
  br i1 %74, label %75, label %82

75:                                               ; preds = %69
  %76 = load ptr, ptr @curline, align 8, !tbaa !5
  %77 = getelementptr inbounds i8, ptr %76, i64 24
  %78 = load ptr, ptr %77, align 8, !tbaa !27
  %79 = getelementptr inbounds i8, ptr %78, i64 12
  %80 = load i16, ptr %79, align 4, !tbaa !28
  %81 = icmp eq i16 %80, 0
  br i1 %81, label %86, label %82

82:                                               ; preds = %57, %63, %69, %75, %56
  %83 = add nsw i32 %42, -1
  tail call void @R_ClipPassWallSegment(i32 noundef %39, i32 noundef %83)
  br label %86

84:                                               ; preds = %47, %52, %44
  %85 = add nsw i32 %42, -1
  tail call void @R_ClipSolidWallSegment(i32 noundef %39, i32 noundef %85)
  br label %86

86:                                               ; preds = %75, %32, %28, %23, %1, %84, %82
  ret void
}

declare i32 @R_PointToAngle(i32 noundef, i32 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 = { "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 0}
!10 = !{!"", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 0}
!13 = !{!"", !11, i64 0, !11, i64 4}
!14 = !{!13, !11, i64 4}
!15 = !{!10, !6, i64 8}
!16 = !{!11, !11, i64 0}
!17 = !{!10, !6, i64 48}
!18 = !{!19, !11, i64 4}
!19 = !{!"", !11, i64 0, !11, i64 4, !20, i64 8, !20, i64 10, !20, i64 12, !20, i64 14, !20, i64 16, !11, i64 20, !6, i64 24, !7, i64 32, !21, i64 48, !11, i64 88, !6, i64 96, !6, i64 104, !11, i64 112, !6, i64 120}
!20 = !{!"short", !7, i64 0}
!21 = !{!"", !22, i64 0, !11, i64 24, !11, i64 28, !11, i64 32}
!22 = !{!"thinker_s", !6, i64 0, !6, i64 8, !7, i64 16}
!23 = !{!19, !11, i64 0}
!24 = !{!19, !20, i64 10}
!25 = !{!19, !20, i64 8}
!26 = !{!19, !20, i64 12}
!27 = !{!10, !6, i64 24}
!28 = !{!29, !20, i64 12}
!29 = !{!"", !11, i64 0, !11, i64 4, !20, i64 8, !20, i64 10, !20, i64 12, !6, i64 16}


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