; LLVM IR from AngelJumbo/lavat :: lavat (event_handler)

; 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.tb_event = type { i8, i8, i16, i32, i32, i32, i32, i32 }

@gradient1 = external dso_local global i16, align 2
@nballs = external hidden global i32, align 4
@maxX = external hidden global i32, align 4
@margin = external hidden global i32, align 4
@maxY = external hidden global i32, align 4
@custom = external hidden global ptr, align 8
@radius = external hidden global float, align 4
@sumConst = external hidden global float, align 4
@color2 = external hidden global i16, align 2
@rim = external hidden global i16, align 2
@sumConst2 = external hidden global float, align 4
@color = external hidden global i16, align 2
@party = external hidden global i16, align 2
@speed = external hidden global i32, align 4
@event = external hidden global %struct.tb_event, align 4
@speedMult = external hidden global i16, align 2
@radiusIn = external hidden global float, align 4
@contained = external hidden global i16, align 2

; Function Attrs: nounwind uwtable
declare dso_local i32 @tb_shutdown() #0

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

; Function Attrs: nounwind uwtable
define dso_local void @event_handler() #0 {
  %1 = load i8, ptr @event, align 4, !tbaa !5
  %2 = zext i8 %1 to i32
  %3 = icmp eq i32 %2, 2
  br i1 %3, label %4, label %12

4:                                                ; preds = %0
  br label %5

5:                                                ; preds = %7, %4
  %6 = call i32 @tb_peek_event(ptr noundef @event, i32 noundef 10)
  br label %7

7:                                                ; preds = %5
  %8 = load i8, ptr @event, align 4, !tbaa !5
  %9 = zext i8 %8 to i32
  %10 = icmp eq i32 %9, 2
  br i1 %10, label %5, label %11, !llvm.loop !11

11:                                               ; preds = %7
  call void @init_params()
  br label %208

12:                                               ; preds = %0
  %13 = load i8, ptr @event, align 4, !tbaa !5
  %14 = zext i8 %13 to i32
  %15 = icmp eq i32 %14, 1
  br i1 %15, label %16, label %207

16:                                               ; preds = %12
  %17 = load i16, ptr getelementptr inbounds (%struct.tb_event, ptr @event, i32 0, i32 2), align 2, !tbaa !13
  %18 = zext i16 %17 to i32
  %19 = icmp eq i32 %18, 3
  br i1 %19, label %24, label %20

20:                                               ; preds = %16
  %21 = load i16, ptr getelementptr inbounds (%struct.tb_event, ptr @event, i32 0, i32 2), align 2, !tbaa !13
  %22 = zext i16 %21 to i32
  %23 = icmp eq i32 %22, 27
  br i1 %23, label %24, label %26

24:                                               ; preds = %20, %16
  %25 = call i32 @tb_shutdown()
  call void @exit(i32 noundef 0) #3
  unreachable

26:                                               ; preds = %20
  %27 = load i32, ptr getelementptr inbounds (%struct.tb_event, ptr @event, i32 0, i32 3), align 4, !tbaa !14
  switch i32 %27, label %206 [
    i32 45, label %28
    i32 95, label %28
    i32 43, label %47
    i32 61, label %47
    i32 109, label %66
    i32 77, label %66
    i32 108, label %74
    i32 76, label %74
    i32 105, label %82
    i32 100, label %108
    i32 73, label %134
    i32 68, label %163
    i32 99, label %192
    i32 107, label %195
    i32 112, label %198
    i32 113, label %204
    i32 81, label %204
  ]

28:                                               ; preds = %26, %26
  %29 = load i16, ptr @speedMult, align 2, !tbaa !15
  %30 = sext i16 %29 to i32
  %31 = icmp slt i32 %30, 10
  br i1 %31, label %32, label %46

32:                                               ; preds = %28
  %33 = load i16, ptr @speedMult, align 2, !tbaa !15
  %34 = add i16 %33, 1
  store i16 %34, ptr @speedMult, align 2, !tbaa !15
  %35 = load i32, ptr @maxX, align 4, !tbaa !16
  %36 = load i32, ptr @maxY, align 4, !tbaa !16
  %37 = add nsw i32 %35, %36
  %38 = sitofp i32 %37 to float
  %39 = fdiv float 1.000000e+00, %38
  %40 = call float @llvm.fmuladd.f32(float %39, float 1.000000e+06, float 1.000000e+04)
  %41 = load i16, ptr @speedMult, align 2, !tbaa !15
  %42 = sext i16 %41 to i32
  %43 = sitofp i32 %42 to float
  %44 = fmul float %40, %43
  %45 = fptosi float %44 to i32
  store i32 %45, ptr @speed, align 4, !tbaa !16
  br label %46

46:                                               ; preds = %32, %28
  br label %206

47:                                               ; preds = %26, %26
  %48 = load i16, ptr @speedMult, align 2, !tbaa !15
  %49 = sext i16 %48 to i32
  %50 = icmp sgt i32 %49, 1
  br i1 %50, label %51, label %65

51:                                               ; preds = %47
  %52 = load i16, ptr @speedMult, align 2, !tbaa !15
  %53 = add i16 %52, -1
  store i16 %53, ptr @speedMult, align 2, !tbaa !15
  %54 = load i32, ptr @maxX, align 4, !tbaa !16
  %55 = load i32, ptr @maxY, align 4, !tbaa !16
  %56 = add nsw i32 %54, %55
  %57 = sitofp i32 %56 to float
  %58 = fdiv float 1.000000e+00, %57
  %59 = call float @llvm.fmuladd.f32(float %58, float 1.000000e+06, float 1.000000e+04)
  %60 = load i16, ptr @speedMult, align 2, !tbaa !15
  %61 = sext i16 %60 to i32
  %62 = sitofp i32 %61 to float
  %63 = fmul float %59, %62
  %64 = fptosi float %63 to i32
  store i32 %64, ptr @speed, align 4, !tbaa !16
  br label %65

65:                                               ; preds = %51, %47
  br label %206

66:                                               ; preds = %26, %26
  %67 = load i32, ptr @nballs, align 4, !tbaa !16
  %68 = add nsw i32 %67, 1
  %69 = icmp sle i32 %68, 20
  br i1 %69, label %70, label %73

70:                                               ; preds = %66
  %71 = load i32, ptr @nballs, align 4, !tbaa !16
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr @nballs, align 4, !tbaa !16
  br label %73

73:                                               ; preds = %70, %66
  br label %206

74:                                               ; preds = %26, %26
  %75 = load i32, ptr @nballs, align 4, !tbaa !16
  %76 = sub nsw i32 %75, 1
  %77 = icmp sge i32 %76, 5
  br i1 %77, label %78, label %81

78:                                               ; preds = %74
  %79 = load i32, ptr @nballs, align 4, !tbaa !16
  %80 = add nsw i32 %79, -1
  store i32 %80, ptr @nballs, align 4, !tbaa !16
  br label %81

81:                                               ; preds = %78, %74
  br label %206

82:                                               ; preds = %26
  %83 = load float, ptr @radiusIn, align 4, !tbaa !17
  %84 = fadd float %83, 5.000000e+00
  %85 = fcmp ole float %84, 1.500000e+02
  br i1 %85, label %86, label %107

86:                                               ; preds = %82
  %87 = load float, ptr @radiusIn, align 4, !tbaa !17
  %88 = fadd float %87, 5.000000e+00
  store float %88, ptr @radiusIn, align 4, !tbaa !17
  %89 = load float, ptr @radiusIn, align 4, !tbaa !17
  %90 = load float, ptr @radiusIn, align 4, !tbaa !17
  %91 = load i32, ptr @maxX, align 4, !tbaa !16
  %92 = load i32, ptr @maxY, align 4, !tbaa !16
  %93 = mul nsw i32 %91, %92
  %94 = sitofp i32 %93 to float
  %95 = call float @llvm.fmuladd.f32(float %89, float %90, float %94)
  %96 = fdiv float %95, 1.500000e+04
  store float %96, ptr @radius, align 4, !tbaa !17
  %97 = load i16, ptr @contained, align 2, !tbaa !15
  %98 = sext i16 %97 to i32
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %100, label %103

100:                                              ; preds = %86
  %101 = load float, ptr @radius, align 4, !tbaa !17
  %102 = fmul float %101, 1.000000e+01
  br label %104

103:                                              ; preds = %86
  br label %104

104:                                              ; preds = %103, %100
  %105 = phi float [ %102, %100 ], [ 0.000000e+00, %103 ]
  %106 = fptosi float %105 to i32
  store i32 %106, ptr @margin, align 4, !tbaa !16
  br label %107

107:                                              ; preds = %104, %82
  br label %206

108:                                              ; preds = %26
  %109 = load float, ptr @radiusIn, align 4, !tbaa !17
  %110 = fsub float %109, 5.000000e+00
  %111 = fcmp oge float %110, 1.000000e+02
  br i1 %111, label %112, label %133

112:                                              ; preds = %108
  %113 = load float, ptr @radiusIn, align 4, !tbaa !17
  %114 = fsub float %113, 5.000000e+00
  store float %114, ptr @radiusIn, align 4, !tbaa !17
  %115 = load float, ptr @radiusIn, align 4, !tbaa !17
  %116 = load float, ptr @radiusIn, align 4, !tbaa !17
  %117 = load i32, ptr @maxX, align 4, !tbaa !16
  %118 = load i32, ptr @maxY, align 4, !tbaa !16
  %119 = mul nsw i32 %117, %118
  %120 = sitofp i32 %119 to float
  %121 = call float @llvm.fmuladd.f32(float %115, float %116, float %120)
  %122 = fdiv float %121, 1.500000e+04
  store float %122, ptr @radius, align 4, !tbaa !17
  %123 = load i16, ptr @contained, align 2, !tbaa !15
  %124 = sext i16 %123 to i32
  %125 = icmp ne i32 %124, 0
  br i1 %125, label %126, label %129

126:                                              ; preds = %112
  %127 = load float, ptr @radius, align 4, !tbaa !17
  %128 = fmul float %127, 1.000000e+01
  br label %130

129:                                              ; preds = %112
  br label %130

130:                                              ; preds = %129, %126
  %131 = phi float [ %128, %126 ], [ 0.000000e+00, %129 ]
  %132 = fptosi float %131 to i32
  store i32 %132, ptr @margin, align 4, !tbaa !16
  br label %133

133:                                              ; preds = %130, %108
  br label %206

134:                                              ; preds = %26
  %135 = load i16, ptr @color, align 2, !tbaa !15
  %136 = sext i16 %135 to i32
  %137 = icmp ne i32 %136, 8
  br i1 %137, label %145, label %138

138:                                              ; preds = %134
  %139 = load ptr, ptr @custom, align 8, !tbaa !19
  %140 = icmp ne ptr %139, null
  br i1 %140, label %145, label %141

141:                                              ; preds = %138
  %142 = load i16, ptr @gradient1, align 2, !tbaa !15
  %143 = sext i16 %142 to i32
  %144 = icmp ne i32 %143, 0
  br i1 %144, label %145, label %162

145:                                              ; preds = %141, %138, %134
  %146 = load i16, ptr @rim, align 2, !tbaa !15
  %147 = sext i16 %146 to i32
  %148 = add nsw i32 %147, 1
  %149 = icmp sle i32 %148, 5
  br i1 %149, label %150, label %161

150:                                              ; preds = %145
  %151 = load i16, ptr @rim, align 2, !tbaa !15
  %152 = add i16 %151, 1
  store i16 %152, ptr @rim, align 2, !tbaa !15
  %153 = load float, ptr @sumConst, align 4, !tbaa !17
  %154 = load i16, ptr @rim, align 2, !tbaa !15
  %155 = sext i16 %154 to i32
  %156 = sitofp i32 %155 to double
  %157 = fmul double 2.500000e-01, %156
  %158 = fptrunc double %157 to float
  %159 = fadd float 1.000000e+00, %158
  %160 = fmul float %153, %159
  store float %160, ptr @sumConst2, align 4, !tbaa !17
  br label %161

161:                                              ; preds = %150, %145
  br label %162

162:                                              ; preds = %161, %141
  br label %206

163:                                              ; preds = %26
  %164 = load i16, ptr @color, align 2, !tbaa !15
  %165 = sext i16 %164 to i32
  %166 = icmp ne i32 %165, 8
  br i1 %166, label %174, label %167

167:                                              ; preds = %163
  %168 = load ptr, ptr @custom, align 8, !tbaa !19
  %169 = icmp ne ptr %168, null
  br i1 %169, label %174, label %170

170:                                              ; preds = %167
  %171 = load i16, ptr @gradient1, align 2, !tbaa !15
  %172 = sext i16 %171 to i32
  %173 = icmp ne i32 %172, 0
  br i1 %173, label %174, label %191

174:                                              ; preds = %170, %167, %163
  %175 = load i16, ptr @rim, align 2, !tbaa !15
  %176 = sext i16 %175 to i32
  %177 = sub nsw i32 %176, 1
  %178 = icmp sge i32 %177, 0
  br i1 %178, label %179, label %190

179:                                              ; preds = %174
  %180 = load i16, ptr @rim, align 2, !tbaa !15
  %181 = add i16 %180, -1
  store i16 %181, ptr @rim, align 2, !tbaa !15
  %182 = load float, ptr @sumConst, align 4, !tbaa !17
  %183 = load i16, ptr @rim, align 2, !tbaa !15
  %184 = sext i16 %183 to i32
  %185 = sitofp i32 %184 to double
  %186 = fmul double 2.500000e-01, %185
  %187 = fptrunc double %186 to float
  %188 = fadd float 1.000000e+00, %187
  %189 = fmul float %182, %188
  store float %189, ptr @sumConst2, align 4, !tbaa !17
  br label %190

190:                                              ; preds = %179, %174
  br label %191

191:                                              ; preds = %190, %170
  br label %206

192:                                              ; preds = %26
  %193 = load i16, ptr @color, align 2, !tbaa !15
  %194 = call signext i16 @next_color(i16 noundef signext %193)
  store i16 %194, ptr @color, align 2, !tbaa !15
  call void @fix_rim_color()
  br label %206

195:                                              ; preds = %26
  %196 = load i16, ptr @color2, align 2, !tbaa !15
  %197 = call signext i16 @next_color(i16 noundef signext %196)
  store i16 %197, ptr @color2, align 2, !tbaa !15
  call void @fix_rim_color()
  br label %206

198:                                              ; preds = %26
  %199 = load i16, ptr @party, align 2, !tbaa !15
  %200 = sext i16 %199 to i32
  %201 = add nsw i32 %200, 1
  %202 = srem i32 %201, 4
  %203 = trunc i32 %202 to i16
  store i16 %203, ptr @party, align 2, !tbaa !15
  br label %206

204:                                              ; preds = %26, %26
  %205 = call i32 @tb_shutdown()
  call void @exit(i32 noundef 0) #3
  unreachable

206:                                              ; preds = %198, %195, %192, %191, %162, %133, %107, %81, %73, %65, %46, %26
  br label %207

207:                                              ; preds = %206, %12
  br label %208

208:                                              ; preds = %207, %11
  ret void
}

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; Function Attrs: nounwind uwtable
declare dso_local signext i16 @next_color(i16 noundef signext) #0

; Function Attrs: nounwind uwtable
declare dso_local void @init_params() #0

; Function Attrs: nounwind uwtable
declare dso_local void @fix_rim_color() #0

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 = { 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 #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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, !7, i64 0}
!6 = !{!"tb_event", !7, i64 0, !7, i64 1, !9, i64 2, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"short", !7, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!6, !9, i64 2}
!14 = !{!6, !10, i64 4}
!15 = !{!9, !9, i64 0}
!16 = !{!10, !10, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"float", !7, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"any pointer", !7, i64 0}


; 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.tb_event = type { i8, i8, i16, i32, i32, i32, i32, i32 }

@gradient1 = external dso_local local_unnamed_addr global i16, align 2
@nballs = external hidden local_unnamed_addr global i32, align 4
@maxX = external hidden local_unnamed_addr global i32, align 4
@margin = external hidden local_unnamed_addr global i32, align 4
@maxY = external hidden local_unnamed_addr global i32, align 4
@custom = external hidden local_unnamed_addr global ptr, align 8
@radius = external hidden local_unnamed_addr global float, align 4
@sumConst = external hidden local_unnamed_addr global float, align 4
@color2 = external hidden local_unnamed_addr global i16, align 2
@rim = external hidden local_unnamed_addr global i16, align 2
@sumConst2 = external hidden local_unnamed_addr global float, align 4
@color = external hidden local_unnamed_addr global i16, align 2
@party = external hidden local_unnamed_addr global i16, align 2
@speed = external hidden local_unnamed_addr global i32, align 4
@event = external hidden global %struct.tb_event, align 4
@speedMult = external hidden local_unnamed_addr global i16, align 2
@radiusIn = external hidden local_unnamed_addr global float, align 4
@contained = external hidden local_unnamed_addr global i16, align 2

; Function Attrs: nounwind uwtable
declare dso_local i32 @tb_shutdown() local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local void @event_handler() local_unnamed_addr #0 {
  %1 = load i8, ptr @event, align 4, !tbaa !5
  switch i8 %1, label %130 [
    i8 2, label %.preheader
    i8 1, label %6
  ]

.preheader:                                       ; preds = %0, %.preheader
  %2 = tail call i32 @tb_peek_event(ptr noundef nonnull @event, i32 noundef 10)
  %3 = load i8, ptr @event, align 4, !tbaa !5
  %4 = icmp eq i8 %3, 2
  br i1 %4, label %.preheader, label %5, !llvm.loop !11

5:                                                ; preds = %.preheader
  tail call void @init_params()
  br label %130

6:                                                ; preds = %0
  %7 = load i16, ptr getelementptr inbounds (i8, ptr @event, i64 2), align 2
  switch i16 %7, label %10 [
    i16 27, label %8
    i16 3, label %8
  ]

8:                                                ; preds = %6, %6
  %9 = tail call i32 @tb_shutdown()
  tail call void @exit(i32 noundef 0) #3
  unreachable

10:                                               ; preds = %6
  %11 = load i32, ptr getelementptr inbounds (i8, ptr @event, i64 4), align 4, !tbaa !13
  switch i32 %11, label %130 [
    i32 45, label %12
    i32 95, label %12
    i32 43, label %26
    i32 61, label %26
    i32 109, label %40
    i32 77, label %40
    i32 108, label %45
    i32 76, label %45
    i32 105, label %50
    i32 100, label %65
    i32 73, label %80
    i32 68, label %98
    i32 99, label %116
    i32 107, label %119
    i32 112, label %122
    i32 113, label %128
    i32 81, label %128
  ]

12:                                               ; preds = %10, %10
  %13 = load i16, ptr @speedMult, align 2, !tbaa !14
  %14 = icmp slt i16 %13, 10
  br i1 %14, label %15, label %130

15:                                               ; preds = %12
  %16 = add nsw i16 %13, 1
  store i16 %16, ptr @speedMult, align 2, !tbaa !14
  %17 = load i32, ptr @maxX, align 4, !tbaa !15
  %18 = load i32, ptr @maxY, align 4, !tbaa !15
  %19 = add nsw i32 %18, %17
  %20 = sitofp i32 %19 to float
  %21 = fdiv float 1.000000e+00, %20
  %22 = tail call float @llvm.fmuladd.f32(float %21, float 1.000000e+06, float 1.000000e+04)
  %23 = sitofp i16 %16 to float
  %24 = fmul float %22, %23
  %25 = fptosi float %24 to i32
  store i32 %25, ptr @speed, align 4, !tbaa !15
  br label %130

26:                                               ; preds = %10, %10
  %27 = load i16, ptr @speedMult, align 2, !tbaa !14
  %28 = icmp sgt i16 %27, 1
  br i1 %28, label %29, label %130

29:                                               ; preds = %26
  %30 = add nsw i16 %27, -1
  store i16 %30, ptr @speedMult, align 2, !tbaa !14
  %31 = load i32, ptr @maxX, align 4, !tbaa !15
  %32 = load i32, ptr @maxY, align 4, !tbaa !15
  %33 = add nsw i32 %32, %31
  %34 = sitofp i32 %33 to float
  %35 = fdiv float 1.000000e+00, %34
  %36 = tail call float @llvm.fmuladd.f32(float %35, float 1.000000e+06, float 1.000000e+04)
  %37 = uitofp nneg i16 %30 to float
  %38 = fmul float %36, %37
  %39 = fptosi float %38 to i32
  store i32 %39, ptr @speed, align 4, !tbaa !15
  br label %130

40:                                               ; preds = %10, %10
  %41 = load i32, ptr @nballs, align 4, !tbaa !15
  %42 = icmp slt i32 %41, 20
  br i1 %42, label %43, label %130

43:                                               ; preds = %40
  %44 = add nsw i32 %41, 1
  store i32 %44, ptr @nballs, align 4, !tbaa !15
  br label %130

45:                                               ; preds = %10, %10
  %46 = load i32, ptr @nballs, align 4, !tbaa !15
  %47 = icmp sgt i32 %46, 5
  br i1 %47, label %48, label %130

48:                                               ; preds = %45
  %49 = add nsw i32 %46, -1
  store i32 %49, ptr @nballs, align 4, !tbaa !15
  br label %130

50:                                               ; preds = %10
  %51 = load float, ptr @radiusIn, align 4, !tbaa !16
  %52 = fadd float %51, 5.000000e+00
  %53 = fcmp ugt float %52, 1.500000e+02
  br i1 %53, label %130, label %54

54:                                               ; preds = %50
  store float %52, ptr @radiusIn, align 4, !tbaa !16
  %55 = load i32, ptr @maxX, align 4, !tbaa !15
  %56 = load i32, ptr @maxY, align 4, !tbaa !15
  %57 = mul nsw i32 %56, %55
  %58 = sitofp i32 %57 to float
  %59 = tail call float @llvm.fmuladd.f32(float %52, float %52, float %58)
  %60 = fdiv float %59, 1.500000e+04
  store float %60, ptr @radius, align 4, !tbaa !16
  %61 = load i16, ptr @contained, align 2, !tbaa !14
  %.not16 = icmp eq i16 %61, 0
  %62 = fmul float %60, 1.000000e+01
  %63 = fptosi float %62 to i32
  %64 = select i1 %.not16, i32 0, i32 %63
  store i32 %64, ptr @margin, align 4, !tbaa !15
  br label %130

65:                                               ; preds = %10
  %66 = load float, ptr @radiusIn, align 4, !tbaa !16
  %67 = fadd float %66, -5.000000e+00
  %68 = fcmp ult float %67, 1.000000e+02
  br i1 %68, label %130, label %69

69:                                               ; preds = %65
  store float %67, ptr @radiusIn, align 4, !tbaa !16
  %70 = load i32, ptr @maxX, align 4, !tbaa !15
  %71 = load i32, ptr @maxY, align 4, !tbaa !15
  %72 = mul nsw i32 %71, %70
  %73 = sitofp i32 %72 to float
  %74 = tail call float @llvm.fmuladd.f32(float %67, float %67, float %73)
  %75 = fdiv float %74, 1.500000e+04
  store float %75, ptr @radius, align 4, !tbaa !16
  %76 = load i16, ptr @contained, align 2, !tbaa !14
  %.not = icmp eq i16 %76, 0
  %77 = fmul float %75, 1.000000e+01
  %78 = fptosi float %77 to i32
  %79 = select i1 %.not, i32 0, i32 %78
  store i32 %79, ptr @margin, align 4, !tbaa !15
  br label %130

80:                                               ; preds = %10
  %81 = load i16, ptr @color, align 2, !tbaa !14
  %82 = icmp ne i16 %81, 8
  %83 = load ptr, ptr @custom, align 8
  %84 = icmp ne ptr %83, null
  %or.cond4 = select i1 %82, i1 true, i1 %84
  %85 = load i16, ptr @gradient1, align 2
  %86 = icmp ne i16 %85, 0
  %or.cond7 = select i1 %or.cond4, i1 true, i1 %86
  br i1 %or.cond7, label %87, label %130

87:                                               ; preds = %80
  %88 = load i16, ptr @rim, align 2, !tbaa !14
  %89 = icmp slt i16 %88, 5
  br i1 %89, label %90, label %130

90:                                               ; preds = %87
  %91 = add nsw i16 %88, 1
  store i16 %91, ptr @rim, align 2, !tbaa !14
  %92 = load float, ptr @sumConst, align 4, !tbaa !16
  %93 = sitofp i16 %91 to double
  %94 = fmul double %93, 2.500000e-01
  %95 = fptrunc double %94 to float
  %96 = fadd float %95, 1.000000e+00
  %97 = fmul float %96, %92
  store float %97, ptr @sumConst2, align 4, !tbaa !16
  br label %130

98:                                               ; preds = %10
  %99 = load i16, ptr @color, align 2, !tbaa !14
  %100 = icmp ne i16 %99, 8
  %101 = load ptr, ptr @custom, align 8
  %102 = icmp ne ptr %101, null
  %or.cond9 = select i1 %100, i1 true, i1 %102
  %103 = load i16, ptr @gradient1, align 2
  %104 = icmp ne i16 %103, 0
  %or.cond12 = select i1 %or.cond9, i1 true, i1 %104
  br i1 %or.cond12, label %105, label %130

105:                                              ; preds = %98
  %106 = load i16, ptr @rim, align 2, !tbaa !14
  %107 = icmp sgt i16 %106, 0
  br i1 %107, label %108, label %130

108:                                              ; preds = %105
  %109 = add nsw i16 %106, -1
  store i16 %109, ptr @rim, align 2, !tbaa !14
  %110 = load float, ptr @sumConst, align 4, !tbaa !16
  %111 = uitofp nneg i16 %109 to double
  %112 = fmul double %111, 2.500000e-01
  %113 = fptrunc double %112 to float
  %114 = fadd float %113, 1.000000e+00
  %115 = fmul float %114, %110
  store float %115, ptr @sumConst2, align 4, !tbaa !16
  br label %130

116:                                              ; preds = %10
  %117 = load i16, ptr @color, align 2, !tbaa !14
  %118 = tail call signext i16 @next_color(i16 noundef signext %117)
  store i16 %118, ptr @color, align 2, !tbaa !14
  tail call void @fix_rim_color()
  br label %130

119:                                              ; preds = %10
  %120 = load i16, ptr @color2, align 2, !tbaa !14
  %121 = tail call signext i16 @next_color(i16 noundef signext %120)
  store i16 %121, ptr @color2, align 2, !tbaa !14
  tail call void @fix_rim_color()
  br label %130

122:                                              ; preds = %10
  %123 = load i16, ptr @party, align 2, !tbaa !14
  %124 = sext i16 %123 to i32
  %125 = add nsw i32 %124, 1
  %126 = srem i32 %125, 4
  %127 = trunc nsw i32 %126 to i16
  store i16 %127, ptr @party, align 2, !tbaa !14
  br label %130

128:                                              ; preds = %10, %10
  %129 = tail call i32 @tb_shutdown()
  tail call void @exit(i32 noundef 0) #3
  unreachable

130:                                              ; preds = %0, %98, %108, %105, %80, %90, %87, %65, %69, %50, %54, %45, %48, %40, %43, %26, %29, %12, %15, %122, %119, %116, %10, %5
  ret void
}

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; Function Attrs: nounwind uwtable
declare dso_local signext i16 @next_color(i16 noundef signext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @init_params() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @fix_rim_color() local_unnamed_addr #0

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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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, !7, i64 0}
!6 = !{!"tb_event", !7, i64 0, !7, i64 1, !9, i64 2, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"short", !7, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!6, !10, i64 4}
!14 = !{!9, !9, i64 0}
!15 = !{!10, !10, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"float", !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SimplifyCFGPass,TailCallElimPass