; LLVM IR from HRI-EU/Rcs :: src/RcsCore (Rcs_geometry)

; 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"

@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@RCS_GLOBAL_RLOG_CB = external global ptr, align 8
@RcsLogLevel = external global i32, align 4
@.str.6 = external hidden unnamed_addr constant [16 x i8], align 1
@__const.Math_pointInsideOrOnPolygon2D.rayDir = external hidden unnamed_addr constant [2 x double], align 16
@.str.10 = external hidden unnamed_addr constant [26 x i8], align 1
@__func__.Math_pointInsideOrOnPolygon2D = external hidden unnamed_addr constant [30 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [15 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: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

declare void @print_trace() #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @Math_pointInsideOrOnPolygon2D(ptr noundef %0, ptr noundef %1, i32 noundef %2) #4 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca [2 x double], align 16
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i8, align 1
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  %18 = load i32, ptr %7, align 4, !tbaa !9
  %19 = icmp ult i32 %18, 1
  br i1 %19, label %20, label %21

20:                                               ; preds = %3
  store i32 -1, ptr %4, align 4
  br label %207

21:                                               ; preds = %3
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds [2 x double], ptr %22, i64 0
  %24 = getelementptr inbounds [2 x double], ptr %23, i64 0, i64 0
  %25 = load double, ptr %24, align 8, !tbaa !11
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = load i32, ptr %7, align 4, !tbaa !9
  %28 = sub i32 %27, 1
  %29 = zext i32 %28 to i64
  %30 = getelementptr inbounds [2 x double], ptr %26, i64 %29
  %31 = getelementptr inbounds [2 x double], ptr %30, i64 0, i64 0
  %32 = load double, ptr %31, align 8, !tbaa !11
  %33 = fcmp oeq double %25, %32
  br i1 %33, label %34, label %50

34:                                               ; preds = %21
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds [2 x double], ptr %35, i64 0
  %37 = getelementptr inbounds [2 x double], ptr %36, i64 0, i64 1
  %38 = load double, ptr %37, align 8, !tbaa !11
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = load i32, ptr %7, align 4, !tbaa !9
  %41 = sub i32 %40, 1
  %42 = zext i32 %41 to i64
  %43 = getelementptr inbounds [2 x double], ptr %39, i64 %42
  %44 = getelementptr inbounds [2 x double], ptr %43, i64 0, i64 1
  %45 = load double, ptr %44, align 8, !tbaa !11
  %46 = fcmp oeq double %38, %45
  br i1 %46, label %47, label %50

47:                                               ; preds = %34
  %48 = load i32, ptr %7, align 4, !tbaa !9
  %49 = add i32 %48, -1
  store i32 %49, ptr %7, align 4, !tbaa !9
  br label %50

50:                                               ; preds = %47, %34, %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 10, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %9, ptr align 16 @__const.Math_pointInsideOrOnPolygon2D.rayDir, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %51

51:                                               ; preds = %143, %50
  %52 = load i32, ptr %10, align 4, !tbaa !9
  %53 = icmp ult i32 %52, 10
  br i1 %53, label %55, label %54

54:                                               ; preds = %51
  store i32 2, ptr %11, align 4
  br label %146

55:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #7
  store i8 1, ptr %13, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %56

56:                                               ; preds = %102, %55
  %57 = load i32, ptr %14, align 4, !tbaa !9
  %58 = load i32, ptr %7, align 4, !tbaa !9
  %59 = icmp ult i32 %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %105

61:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %62 = load i32, ptr %14, align 4, !tbaa !9
  %63 = load i32, ptr %7, align 4, !tbaa !9
  %64 = sub i32 %63, 1
  %65 = icmp eq i32 %62, %64
  br i1 %65, label %66, label %67

66:                                               ; preds = %61
  br label %70

67:                                               ; preds = %61
  %68 = load i32, ptr %14, align 4, !tbaa !9
  %69 = add i32 %68, 1
  br label %70

70:                                               ; preds = %67, %66
  %71 = phi i32 [ 0, %66 ], [ %69, %67 ]
  store i32 %71, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = getelementptr inbounds [2 x double], ptr %9, i64 0, i64 0
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = load i32, ptr %14, align 4, !tbaa !9
  %76 = zext i32 %75 to i64
  %77 = getelementptr inbounds [2 x double], ptr %74, i64 %76
  %78 = getelementptr inbounds [2 x double], ptr %77, i64 0, i64 0
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = load i32, ptr %15, align 4, !tbaa !9
  %81 = zext i32 %80 to i64
  %82 = getelementptr inbounds [2 x double], ptr %79, i64 %81
  %83 = getelementptr inbounds [2 x double], ptr %82, i64 0, i64 0
  %84 = call i32 @Math_intersectRayLineseg2D(ptr noundef %72, ptr noundef %73, ptr noundef %78, ptr noundef %83, ptr noundef null)
  store i32 %84, ptr %16, align 4, !tbaa !9
  %85 = load i32, ptr %16, align 4, !tbaa !9
  switch i32 %85, label %90 [
    i32 0, label %101
    i32 1, label %86
    i32 2, label %89
    i32 3, label %89
    i32 4, label %89
  ]

86:                                               ; preds = %70
  %87 = load i32, ptr %12, align 4, !tbaa !9
  %88 = add i32 %87, 1
  store i32 %88, ptr %12, align 4, !tbaa !9
  br label %101

89:                                               ; preds = %70, %70, %70
  store i8 0, ptr %13, align 1, !tbaa !13
  br label %101

90:                                               ; preds = %70
  br label %91

91:                                               ; preds = %90
  %92 = load ptr, ptr @stderr, align 8, !tbaa !5
  %93 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %92, ptr noundef @.str.10, ptr noundef @.str.1, ptr noundef @__func__.Math_pointInsideOrOnPolygon2D, i32 noundef 1472) #7
  %94 = load ptr, ptr @stderr, align 8, !tbaa !5
  %95 = load i32, ptr %16, align 4, !tbaa !9
  %96 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %94, ptr noundef @.str.11, i32 noundef %95) #7
  %97 = load ptr, ptr @stderr, align 8, !tbaa !5
  %98 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %97, ptr noundef @.str.4) #7
  call void @print_trace()
  call void @exit(i32 noundef 1) #8
  unreachable

99:                                               ; No predecessors!
  br label %100

100:                                              ; preds = %99
  br label %101

101:                                              ; preds = %100, %89, %86, %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %102

102:                                              ; preds = %101
  %103 = load i32, ptr %14, align 4, !tbaa !9
  %104 = add i32 %103, 1
  store i32 %104, ptr %14, align 4, !tbaa !9
  br label %56, !llvm.loop !15

105:                                              ; preds = %60
  %106 = load i8, ptr %13, align 1, !tbaa !13, !range !17, !noundef !18
  %107 = trunc i8 %106 to i1
  %108 = zext i1 %107 to i32
  %109 = icmp eq i32 %108, 1
  br i1 %109, label %110, label %112

110:                                              ; preds = %105
  %111 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %111, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %140

112:                                              ; preds = %105
  %113 = getelementptr inbounds [2 x double], ptr %9, i64 0, i64 0
  call void @VecNd_setRandom(ptr noundef %113, double noundef 1.000000e-01, double noundef 1.000000e+00, i32 noundef 2)
  %114 = getelementptr inbounds [2 x double], ptr %9, i64 0, i64 0
  %115 = call double @VecNd_normalizeSelf(ptr noundef %114, i32 noundef 2)
  %116 = load i32, ptr %10, align 4, !tbaa !9
  %117 = icmp uge i32 %116, 5
  br i1 %117, label %118, label %139

118:                                              ; preds = %112
  br label %119

119:                                              ; preds = %118
  %120 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %121 = icmp ne ptr %120, null
  br i1 %121, label %122, label %125

122:                                              ; preds = %119
  %123 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %124 = load i32, ptr %10, align 4, !tbaa !9
  call void (i32, ptr, ptr, i32, ptr, ...) %123(i32 noundef 4, ptr noundef @.str.1, ptr noundef @__func__.Math_pointInsideOrOnPolygon2D, i32 noundef 1492, ptr noundef @.str.12, i32 noundef %124)
  br label %125

125:                                              ; preds = %122, %119
  %126 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %127 = icmp sle i32 4, %126
  br i1 %127, label %128, label %136

128:                                              ; preds = %125
  %129 = load ptr, ptr @stderr, align 8, !tbaa !5
  %130 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %129, ptr noundef @.str.6, ptr noundef @.str.1, ptr noundef @__func__.Math_pointInsideOrOnPolygon2D, i32 noundef 1492) #7
  %131 = load ptr, ptr @stderr, align 8, !tbaa !5
  %132 = load i32, ptr %10, align 4, !tbaa !9
  %133 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %131, ptr noundef @.str.12, i32 noundef %132) #7
  %134 = load ptr, ptr @stderr, align 8, !tbaa !5
  %135 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %134, ptr noundef @.str.4) #7
  br label %136

136:                                              ; preds = %128, %125
  br label %137

137:                                              ; preds = %136
  br label %138

138:                                              ; preds = %137
  br label %139

139:                                              ; preds = %138, %112
  store i32 0, ptr %11, align 4
  br label %140

140:                                              ; preds = %139, %110
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  %141 = load i32, ptr %11, align 4
  switch i32 %141, label %146 [
    i32 0, label %142
  ]

142:                                              ; preds = %140
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %10, align 4, !tbaa !9
  %145 = add i32 %144, 1
  store i32 %145, ptr %10, align 4, !tbaa !9
  br label %51, !llvm.loop !19

146:                                              ; preds = %140, %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  %147 = load i32, ptr %11, align 4
  switch i32 %147, label %206 [
    i32 2, label %148
  ]

148:                                              ; preds = %146
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %149

149:                                              ; preds = %200, %148
  %150 = load i32, ptr %17, align 4, !tbaa !9
  %151 = load i32, ptr %7, align 4, !tbaa !9
  %152 = icmp ult i32 %150, %151
  br i1 %152, label %154, label %153

153:                                              ; preds = %149
  store i32 13, ptr %11, align 4
  br label %203

154:                                              ; preds = %149
  %155 = load ptr, ptr %5, align 8, !tbaa !5
  %156 = getelementptr inbounds double, ptr %155, i64 0
  %157 = load double, ptr %156, align 8, !tbaa !11
  %158 = load ptr, ptr %6, align 8, !tbaa !5
  %159 = load i32, ptr %17, align 4, !tbaa !9
  %160 = zext i32 %159 to i64
  %161 = getelementptr inbounds [2 x double], ptr %158, i64 %160
  %162 = getelementptr inbounds [2 x double], ptr %161, i64 0, i64 0
  %163 = load double, ptr %162, align 8, !tbaa !11
  %164 = fsub double %157, %163
  %165 = call double @llvm.fabs.f64(double %164)
  %166 = fcmp olt double %165, 0x3D719799812DEA11
  br i1 %166, label %167, label %199

167:                                              ; preds = %154
  %168 = load ptr, ptr %5, align 8, !tbaa !5
  %169 = getelementptr inbounds double, ptr %168, i64 1
  %170 = load double, ptr %169, align 8, !tbaa !11
  %171 = load ptr, ptr %6, align 8, !tbaa !5
  %172 = load i32, ptr %17, align 4, !tbaa !9
  %173 = zext i32 %172 to i64
  %174 = getelementptr inbounds [2 x double], ptr %171, i64 %173
  %175 = getelementptr inbounds [2 x double], ptr %174, i64 0, i64 1
  %176 = load double, ptr %175, align 8, !tbaa !11
  %177 = fsub double %170, %176
  %178 = call double @llvm.fabs.f64(double %177)
  %179 = fcmp olt double %178, 0x3D719799812DEA11
  br i1 %179, label %180, label %199

180:                                              ; preds = %167
  br label %181

181:                                              ; preds = %180
  %182 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %183 = icmp ne ptr %182, null
  br i1 %183, label %184, label %186

184:                                              ; preds = %181
  %185 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  call void (i32, ptr, ptr, i32, ptr, ...) %185(i32 noundef 4, ptr noundef @.str.1, ptr noundef @__func__.Math_pointInsideOrOnPolygon2D, i32 noundef 1507, ptr noundef @.str.13)
  br label %186

186:                                              ; preds = %184, %181
  %187 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %188 = icmp sle i32 4, %187
  br i1 %188, label %189, label %196

189:                                              ; preds = %186
  %190 = load ptr, ptr @stderr, align 8, !tbaa !5
  %191 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %190, ptr noundef @.str.6, ptr noundef @.str.1, ptr noundef @__func__.Math_pointInsideOrOnPolygon2D, i32 noundef 1507) #7
  %192 = load ptr, ptr @stderr, align 8, !tbaa !5
  %193 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %192, ptr noundef @.str.13) #7
  %194 = load ptr, ptr @stderr, align 8, !tbaa !5
  %195 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %194, ptr noundef @.str.4) #7
  br label %196

196:                                              ; preds = %189, %186
  br label %197

197:                                              ; preds = %196
  br label %198

198:                                              ; preds = %197
  store i32 1, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %203

199:                                              ; preds = %167, %154
  br label %200

200:                                              ; preds = %199
  %201 = load i32, ptr %17, align 4, !tbaa !9
  %202 = add i32 %201, 1
  store i32 %202, ptr %17, align 4, !tbaa !9
  br label %149, !llvm.loop !20

203:                                              ; preds = %198, %153
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  %204 = load i32, ptr %11, align 4
  switch i32 %204, label %206 [
    i32 13, label %205
  ]

205:                                              ; preds = %203
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %206

206:                                              ; preds = %205, %203, %146
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %207

207:                                              ; preds = %206, %20
  %208 = load i32, ptr %4, align 4
  ret i32 %208
}

declare double @VecNd_normalizeSelf(ptr noundef, i32 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #5

; Function Attrs: nounwind uwtable
declare dso_local i32 @Math_intersectRayLineseg2D(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #4

; 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) #6

declare void @VecNd_setRandom(ptr noundef, double noundef, double noundef, i32 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }
attributes #8 = { noreturn 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, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@RCS_GLOBAL_RLOG_CB = external local_unnamed_addr global ptr, align 8
@RcsLogLevel = external local_unnamed_addr global i32, align 4
@.str.6 = external hidden unnamed_addr constant [16 x i8], align 1
@__const.Math_pointInsideOrOnPolygon2D.rayDir = external hidden unnamed_addr constant [2 x double], align 16
@.str.10 = external hidden unnamed_addr constant [26 x i8], align 1
@__func__.Math_pointInsideOrOnPolygon2D = external hidden unnamed_addr constant [30 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [15 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: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

declare void @print_trace() local_unnamed_addr #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local i32 @Math_pointInsideOrOnPolygon2D(ptr noundef %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #4 {
  %4 = alloca [2 x double], align 16
  %5 = icmp eq i32 %2, 0
  br i1 %5, label %85, label %6

6:                                                ; preds = %3
  %7 = load double, ptr %1, align 8, !tbaa !5
  %8 = add i32 %2, -1
  %9 = zext i32 %8 to i64
  %10 = getelementptr inbounds [2 x double], ptr %1, i64 %9
  %11 = load double, ptr %10, align 8, !tbaa !5
  %12 = fcmp oeq double %7, %11
  br i1 %12, label %13, label %.thread

13:                                               ; preds = %6
  %14 = getelementptr inbounds i8, ptr %1, i64 8
  %15 = load double, ptr %14, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %10, i64 8
  %17 = load double, ptr %16, align 8, !tbaa !5
  %18 = fcmp oeq double %15, %17
  br i1 %18, label %19, label %.thread

.thread:                                          ; preds = %13, %6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %4, ptr noundef nonnull align 16 dereferenceable(16) @__const.Math_pointInsideOrOnPolygon2D.rayDir, i64 16, i1 false)
  br label %.preheader61.us.preheader

19:                                               ; preds = %13
  %.pre = add i32 %2, -2
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %4, ptr noundef nonnull align 16 dereferenceable(16) @__const.Math_pointInsideOrOnPolygon2D.rayDir, i64 16, i1 false)
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %.loopexit, label %.preheader61.us.preheader

.preheader61.us.preheader:                        ; preds = %.thread, %19
  %.04495 = phi i32 [ %2, %.thread ], [ %8, %19 ]
  %.pre-phi94 = phi i32 [ %8, %.thread ], [ %.pre, %19 ]
  %20 = zext i32 %.pre-phi94 to i64
  %wide.trip.count = zext i32 %.04495 to i64
  br label %.preheader61.us

.preheader61.us:                                  ; preds = %.preheader61.us.preheader, %37
  %21 = phi i1 [ %39, %37 ], [ false, %.preheader61.us.preheader ]
  %.05370.us = phi i32 [ %38, %37 ], [ 0, %.preheader61.us.preheader ]
  br label %.outer

.outer:                                           ; preds = %.thread99, %.preheader61.us
  %indvars.iv.ph = phi i64 [ %indvars.iv.next, %.thread99 ], [ 0, %.preheader61.us ]
  %.04667.us.ph = phi i1 [ false, %.thread99 ], [ true, %.preheader61.us ]
  %.04866.us.ph = phi i32 [ %.04866.us, %.thread99 ], [ 0, %.preheader61.us ]
  br label %40

._crit_edge.us.thread:                            ; preds = %.thread99, %._crit_edge.us
  %.149.us103107 = phi i32 [ %.149.us, %._crit_edge.us ], [ %.04866.us, %.thread99 ]
  call void @VecNd_setRandom(ptr noundef nonnull %4, double noundef 1.000000e-01, double noundef 1.000000e+00, i32 noundef 2) #7
  %22 = call double @VecNd_normalizeSelf(ptr noundef nonnull %4, i32 noundef 2) #7
  %23 = icmp ugt i32 %.05370.us, 4
  br i1 %23, label %24, label %37

24:                                               ; preds = %._crit_edge.us.thread
  %25 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  %.not.us = icmp eq ptr %25, null
  br i1 %.not.us, label %27, label %26

26:                                               ; preds = %24
  call void (i32, ptr, ptr, i32, ptr, ...) %25(i32 noundef 4, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.Math_pointInsideOrOnPolygon2D, i32 noundef 1492, ptr noundef nonnull @.str.12, i32 noundef %.05370.us) #7
  br label %27

27:                                               ; preds = %26, %24
  %28 = load i32, ptr @RcsLogLevel, align 4, !tbaa !11
  %29 = icmp sgt i32 %28, 3
  br i1 %29, label %30, label %37

30:                                               ; preds = %27
  %31 = load ptr, ptr @stderr, align 8, !tbaa !9
  %32 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.Math_pointInsideOrOnPolygon2D, i32 noundef 1492) #8
  %33 = load ptr, ptr @stderr, align 8, !tbaa !9
  %34 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef nonnull @.str.12, i32 noundef %.05370.us) #8
  %35 = load ptr, ptr @stderr, align 8, !tbaa !9
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef nonnull @.str.4) #8
  br label %37

37:                                               ; preds = %30, %27, %._crit_edge.us.thread
  %38 = add nuw nsw i32 %.05370.us, 1
  %39 = icmp ugt i32 %.05370.us, 8
  %exitcond85 = icmp eq i32 %38, 10
  br i1 %exitcond85, label %.split72.us, label %.preheader61.us, !llvm.loop !13

40:                                               ; preds = %.outer, %49
  %indvars.iv = phi i64 [ %indvars.iv.next, %49 ], [ %indvars.iv.ph, %.outer ]
  %.04866.us = phi i32 [ %.149.us, %49 ], [ %.04866.us.ph, %.outer ]
  %41 = icmp eq i64 %indvars.iv, %20
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %42 = and i64 %indvars.iv.next, 4294967295
  %43 = getelementptr inbounds [2 x double], ptr %1, i64 %indvars.iv
  %44 = select i1 %41, i64 0, i64 %42
  %45 = getelementptr inbounds [2 x double], ptr %1, i64 %44
  %46 = call i32 @Math_intersectRayLineseg2D(ptr noundef %0, ptr noundef nonnull %4, ptr noundef nonnull %43, ptr noundef nonnull %45, ptr noundef null)
  switch i32 %46, label %.split75.us [
    i32 0, label %49
    i32 1, label %47
    i32 2, label %.thread99
    i32 3, label %.thread99
    i32 4, label %.thread99
  ]

47:                                               ; preds = %40
  %48 = add i32 %.04866.us, 1
  br label %49

49:                                               ; preds = %47, %40
  %.149.us = phi i32 [ %48, %47 ], [ %.04866.us, %40 ]
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge.us, label %40, !llvm.loop !15

.thread99:                                        ; preds = %40, %40, %40
  %exitcond.not102 = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not102, label %._crit_edge.us.thread, label %.outer, !llvm.loop !15

._crit_edge.us:                                   ; preds = %49
  br i1 %.04667.us.ph, label %.split72.us, label %._crit_edge.us.thread

.split75.us:                                      ; preds = %40
  %50 = load ptr, ptr @stderr, align 8, !tbaa !9
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.Math_pointInsideOrOnPolygon2D, i32 noundef 1472) #8
  %52 = load ptr, ptr @stderr, align 8, !tbaa !9
  %53 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %52, ptr noundef nonnull @.str.11, i32 noundef %46) #8
  %54 = load ptr, ptr @stderr, align 8, !tbaa !9
  %55 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef nonnull @.str.4) #8
  call void @print_trace() #7
  call void @exit(i32 noundef 1) #9
  unreachable

.split72.us:                                      ; preds = %._crit_edge.us, %37
  %.us-phi = phi i1 [ %39, %37 ], [ %21, %._crit_edge.us ]
  %.us-phi73 = phi i32 [ %.149.us103107, %37 ], [ %.149.us, %._crit_edge.us ]
  %.us-phi73.mux = select i1 %.us-phi, i32 -1, i32 %.us-phi73
  br i1 %.us-phi, label %.lr.ph83, label %.loopexit

.lr.ph83:                                         ; preds = %.split72.us
  %56 = load double, ptr %0, align 8, !tbaa !5
  %57 = getelementptr inbounds i8, ptr %0, i64 8
  %wide.trip.count89 = zext i32 %.04495 to i64
  br label %58

58:                                               ; preds = %.lr.ph83, %84
  %indvars.iv86 = phi i64 [ 0, %.lr.ph83 ], [ %indvars.iv.next87, %84 ]
  %59 = getelementptr inbounds [2 x double], ptr %1, i64 %indvars.iv86
  %60 = load double, ptr %59, align 8, !tbaa !5
  %61 = fsub double %56, %60
  %62 = call double @llvm.fabs.f64(double %61)
  %63 = fcmp olt double %62, 0x3D719799812DEA11
  br i1 %63, label %64, label %84

64:                                               ; preds = %58
  %65 = load double, ptr %57, align 8, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %59, i64 8
  %67 = load double, ptr %66, align 8, !tbaa !5
  %68 = fsub double %65, %67
  %69 = call double @llvm.fabs.f64(double %68)
  %70 = fcmp olt double %69, 0x3D719799812DEA11
  br i1 %70, label %71, label %84

71:                                               ; preds = %64
  %72 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  %.not57 = icmp eq ptr %72, null
  br i1 %.not57, label %74, label %73

73:                                               ; preds = %71
  call void (i32, ptr, ptr, i32, ptr, ...) %72(i32 noundef 4, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.Math_pointInsideOrOnPolygon2D, i32 noundef 1507, ptr noundef nonnull @.str.13) #7
  br label %74

74:                                               ; preds = %73, %71
  %75 = load i32, ptr @RcsLogLevel, align 4, !tbaa !11
  %76 = icmp sgt i32 %75, 3
  br i1 %76, label %77, label %.loopexit

77:                                               ; preds = %74
  %78 = load ptr, ptr @stderr, align 8, !tbaa !9
  %79 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %78, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.Math_pointInsideOrOnPolygon2D, i32 noundef 1507) #8
  %80 = load ptr, ptr @stderr, align 8, !tbaa !9
  %81 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %80, ptr noundef nonnull @.str.13) #8
  %82 = load ptr, ptr @stderr, align 8, !tbaa !9
  %83 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %82, ptr noundef nonnull @.str.4) #8
  br label %.loopexit

84:                                               ; preds = %58, %64
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %exitcond90.not = icmp eq i64 %indvars.iv.next87, %wide.trip.count89
  br i1 %exitcond90.not, label %.loopexit, label %58, !llvm.loop !16

.loopexit:                                        ; preds = %84, %.split72.us, %19, %77, %74
  %.4 = phi i32 [ %.us-phi73.mux, %.split72.us ], [ 1, %77 ], [ 1, %74 ], [ 0, %19 ], [ -1, %84 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #7
  br label %85

85:                                               ; preds = %3, %.loopexit
  %.5 = phi i32 [ %.4, %.loopexit ], [ -1, %3 ]
  ret i32 %.5
}

declare double @VecNd_normalizeSelf(ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #5

; Function Attrs: nounwind uwtable
declare dso_local i32 @Math_intersectRayLineseg2D(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

; 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) #6

declare void @VecNd_setRandom(ptr noundef, double noundef, double noundef, i32 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 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 #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }
attributes #8 = { cold nounwind }
attributes #9 = { noreturn 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 = !{!"double", !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 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


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