; LLVM IR from LeoVen/C-Macro-Collections :: examples (ice_cream)

; 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.queue_fval = type { ptr, ptr, ptr, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [7 x i8], align 1
@stderr = external global ptr, align 8
@.str.12 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [55 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @q_new(i64 noundef, ptr 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @q_enqueue(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @q_dequeue(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @q_empty(ptr noundef) #0

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca %struct.queue_fval, align 8
  %5 = alloca i8, align 1
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  %10 = call i64 @time(ptr noundef null) #5
  %11 = trunc i64 %10 to i32
  call void @srand(i32 noundef %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  store i64 20, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  call void @llvm.memset.p0.i64(ptr align 8 %4, i8 0, i64 48, i1 false)
  %12 = getelementptr inbounds %struct.queue_fval, ptr %4, i32 0, i32 0
  %13 = getelementptr inbounds %struct.queue_fval, ptr %4, i32 0, i32 1
  %14 = getelementptr inbounds %struct.queue_fval, ptr %4, i32 0, i32 2
  %15 = getelementptr inbounds %struct.queue_fval, ptr %4, i32 0, i32 3
  %16 = getelementptr inbounds %struct.queue_fval, ptr %4, i32 0, i32 4
  %17 = getelementptr inbounds %struct.queue_fval, ptr %4, i32 0, i32 5
  %18 = call ptr @q_new(i64 noundef 10, ptr noundef %4)
  store ptr %18, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #5
  store i8 1, ptr %5, align 1, !tbaa !11
  %19 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %20 = trunc i8 %19 to i1
  br i1 %20, label %21, label %24

21:                                               ; preds = %0
  %22 = load ptr, ptr %3, align 8, !tbaa !9
  %23 = call zeroext i1 @q_enqueue(ptr noundef %22, ptr noundef @.str)
  br label %24

24:                                               ; preds = %21, %0
  %25 = phi i1 [ false, %0 ], [ %23, %21 ]
  %26 = zext i1 %25 to i8
  store i8 %26, ptr %5, align 1, !tbaa !11
  %27 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %28 = trunc i8 %27 to i1
  br i1 %28, label %29, label %32

29:                                               ; preds = %24
  %30 = load ptr, ptr %3, align 8, !tbaa !9
  %31 = call zeroext i1 @q_enqueue(ptr noundef %30, ptr noundef @.str.1)
  br label %32

32:                                               ; preds = %29, %24
  %33 = phi i1 [ false, %24 ], [ %31, %29 ]
  %34 = zext i1 %33 to i8
  store i8 %34, ptr %5, align 1, !tbaa !11
  %35 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %36 = trunc i8 %35 to i1
  br i1 %36, label %37, label %40

37:                                               ; preds = %32
  %38 = load ptr, ptr %3, align 8, !tbaa !9
  %39 = call zeroext i1 @q_enqueue(ptr noundef %38, ptr noundef @.str.2)
  br label %40

40:                                               ; preds = %37, %32
  %41 = phi i1 [ false, %32 ], [ %39, %37 ]
  %42 = zext i1 %41 to i8
  store i8 %42, ptr %5, align 1, !tbaa !11
  %43 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %44 = trunc i8 %43 to i1
  br i1 %44, label %45, label %48

45:                                               ; preds = %40
  %46 = load ptr, ptr %3, align 8, !tbaa !9
  %47 = call zeroext i1 @q_enqueue(ptr noundef %46, ptr noundef @.str.3)
  br label %48

48:                                               ; preds = %45, %40
  %49 = phi i1 [ false, %40 ], [ %47, %45 ]
  %50 = zext i1 %49 to i8
  store i8 %50, ptr %5, align 1, !tbaa !11
  %51 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %52 = trunc i8 %51 to i1
  br i1 %52, label %53, label %56

53:                                               ; preds = %48
  %54 = load ptr, ptr %3, align 8, !tbaa !9
  %55 = call zeroext i1 @q_enqueue(ptr noundef %54, ptr noundef @.str.4)
  br label %56

56:                                               ; preds = %53, %48
  %57 = phi i1 [ false, %48 ], [ %55, %53 ]
  %58 = zext i1 %57 to i8
  store i8 %58, ptr %5, align 1, !tbaa !11
  %59 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %60 = trunc i8 %59 to i1
  br i1 %60, label %61, label %64

61:                                               ; preds = %56
  %62 = load ptr, ptr %3, align 8, !tbaa !9
  %63 = call zeroext i1 @q_enqueue(ptr noundef %62, ptr noundef @.str.5)
  br label %64

64:                                               ; preds = %61, %56
  %65 = phi i1 [ false, %56 ], [ %63, %61 ]
  %66 = zext i1 %65 to i8
  store i8 %66, ptr %5, align 1, !tbaa !11
  %67 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %68 = trunc i8 %67 to i1
  br i1 %68, label %69, label %72

69:                                               ; preds = %64
  %70 = load ptr, ptr %3, align 8, !tbaa !9
  %71 = call zeroext i1 @q_enqueue(ptr noundef %70, ptr noundef @.str.6)
  br label %72

72:                                               ; preds = %69, %64
  %73 = phi i1 [ false, %64 ], [ %71, %69 ]
  %74 = zext i1 %73 to i8
  store i8 %74, ptr %5, align 1, !tbaa !11
  %75 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %76 = trunc i8 %75 to i1
  br i1 %76, label %77, label %80

77:                                               ; preds = %72
  %78 = load ptr, ptr %3, align 8, !tbaa !9
  %79 = call zeroext i1 @q_enqueue(ptr noundef %78, ptr noundef @.str.7)
  br label %80

80:                                               ; preds = %77, %72
  %81 = phi i1 [ false, %72 ], [ %79, %77 ]
  %82 = zext i1 %81 to i8
  store i8 %82, ptr %5, align 1, !tbaa !11
  %83 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %84 = trunc i8 %83 to i1
  br i1 %84, label %85, label %88

85:                                               ; preds = %80
  %86 = load ptr, ptr %3, align 8, !tbaa !9
  %87 = call zeroext i1 @q_enqueue(ptr noundef %86, ptr noundef @.str.8)
  br label %88

88:                                               ; preds = %85, %80
  %89 = phi i1 [ false, %80 ], [ %87, %85 ]
  %90 = zext i1 %89 to i8
  store i8 %90, ptr %5, align 1, !tbaa !11
  %91 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %92 = trunc i8 %91 to i1
  br i1 %92, label %93, label %96

93:                                               ; preds = %88
  %94 = load ptr, ptr %3, align 8, !tbaa !9
  %95 = call zeroext i1 @q_enqueue(ptr noundef %94, ptr noundef @.str.9)
  br label %96

96:                                               ; preds = %93, %88
  %97 = phi i1 [ false, %88 ], [ %95, %93 ]
  %98 = zext i1 %97 to i8
  store i8 %98, ptr %5, align 1, !tbaa !11
  %99 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %100 = trunc i8 %99 to i1
  br i1 %100, label %101, label %104

101:                                              ; preds = %96
  %102 = load ptr, ptr %3, align 8, !tbaa !9
  %103 = call zeroext i1 @q_enqueue(ptr noundef %102, ptr noundef @.str.10)
  br label %104

104:                                              ; preds = %101, %96
  %105 = phi i1 [ false, %96 ], [ %103, %101 ]
  %106 = zext i1 %105 to i8
  store i8 %106, ptr %5, align 1, !tbaa !11
  %107 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %108 = trunc i8 %107 to i1
  br i1 %108, label %109, label %112

109:                                              ; preds = %104
  %110 = load ptr, ptr %3, align 8, !tbaa !9
  %111 = call zeroext i1 @q_enqueue(ptr noundef %110, ptr noundef @.str.11)
  br label %112

112:                                              ; preds = %109, %104
  %113 = phi i1 [ false, %104 ], [ %111, %109 ]
  %114 = zext i1 %113 to i8
  store i8 %114, ptr %5, align 1, !tbaa !11
  %115 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %116 = trunc i8 %115 to i1
  br i1 %116, label %120, label %117

117:                                              ; preds = %112
  %118 = load ptr, ptr @stderr, align 8, !tbaa !9
  %119 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %118, ptr noundef @.str.12) #5
  store i32 1, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %176

120:                                              ; preds = %112
  br label %121

121:                                              ; preds = %149, %120
  %122 = load i64, ptr %2, align 8, !tbaa !5
  %123 = icmp ugt i64 %122, 0
  br i1 %123, label %124, label %150

124:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %125 = call i32 @rand() #5
  %126 = srem i32 %125, 5
  %127 = sext i32 %126 to i64
  store i64 %127, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %128 = load ptr, ptr %3, align 8, !tbaa !9
  %129 = call ptr @q_peek(ptr noundef %128)
  store ptr %129, ptr %8, align 8, !tbaa !9
  %130 = load ptr, ptr %3, align 8, !tbaa !9
  %131 = call zeroext i1 @q_dequeue(ptr noundef %130)
  br i1 %131, label %133, label %132

132:                                              ; preds = %124
  store i32 3, ptr %6, align 4
  br label %147

133:                                              ; preds = %124
  %134 = load ptr, ptr %8, align 8, !tbaa !9
  %135 = load i64, ptr %7, align 8, !tbaa !5
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.13, ptr noundef %134, i64 noundef %135)
  %137 = load i64, ptr %7, align 8, !tbaa !5
  %138 = load i64, ptr %2, align 8, !tbaa !5
  %139 = icmp ugt i64 %137, %138
  br i1 %139, label %140, label %141

140:                                              ; preds = %133
  br label %145

141:                                              ; preds = %133
  %142 = load i64, ptr %2, align 8, !tbaa !5
  %143 = load i64, ptr %7, align 8, !tbaa !5
  %144 = sub i64 %142, %143
  br label %145

145:                                              ; preds = %141, %140
  %146 = phi i64 [ 0, %140 ], [ %144, %141 ]
  store i64 %146, ptr %2, align 8, !tbaa !5
  store i32 0, ptr %6, align 4
  br label %147

147:                                              ; preds = %145, %132
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  %148 = load i32, ptr %6, align 4
  switch i32 %148, label %178 [
    i32 0, label %149
    i32 3, label %150
  ]

149:                                              ; preds = %147
  br label %121, !llvm.loop !15

150:                                              ; preds = %147, %121
  %151 = load ptr, ptr %3, align 8, !tbaa !9
  %152 = call zeroext i1 @q_empty(ptr noundef %151)
  br i1 %152, label %167, label %153

153:                                              ; preds = %150
  %154 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  br label %155

155:                                              ; preds = %159, %153
  %156 = load ptr, ptr %3, align 8, !tbaa !9
  %157 = call zeroext i1 @q_empty(ptr noundef %156)
  %158 = xor i1 %157, true
  br i1 %158, label %159, label %166

159:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %160 = load ptr, ptr %3, align 8, !tbaa !9
  %161 = call ptr @q_peek(ptr noundef %160)
  store ptr %161, ptr %9, align 8, !tbaa !9
  %162 = load ptr, ptr %3, align 8, !tbaa !9
  %163 = call zeroext i1 @q_dequeue(ptr noundef %162)
  %164 = load ptr, ptr %9, align 8, !tbaa !9
  %165 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, ptr noundef %164)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %155, !llvm.loop !17

166:                                              ; preds = %155
  br label %174

167:                                              ; preds = %150
  %168 = load i64, ptr %2, align 8, !tbaa !5
  %169 = icmp ugt i64 %168, 0
  br i1 %169, label %170, label %173

170:                                              ; preds = %167
  %171 = load i64, ptr %2, align 8, !tbaa !5
  %172 = call i32 (ptr, ...) @printf(ptr noundef @.str.16, i64 noundef %171)
  br label %173

173:                                              ; preds = %170, %167
  br label %174

174:                                              ; preds = %173, %166
  %175 = load ptr, ptr %3, align 8, !tbaa !9
  call void @q_free(ptr noundef %175)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %176

176:                                              ; preds = %174, %117
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  %177 = load i32, ptr %1, align 4
  ret i32 %177

178:                                              ; preds = %147
  unreachable
}

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

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #3

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

; Function Attrs: nounwind
declare i32 @rand() #3

declare i32 @printf(ptr noundef, ...) #4

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 = { "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 = { 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 = !{!"long", !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 = !{!"_Bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !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"

%struct.queue_fval = type { ptr, ptr, ptr, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [7 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.12 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [55 x i8], align 1

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @q_enqueue(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @q_dequeue(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @q_empty(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main() local_unnamed_addr #0 {
  %1 = alloca %struct.queue_fval, align 8
  %2 = tail call i64 @time(ptr noundef null) #5
  %3 = trunc i64 %2 to i32
  tail call void @srand(i32 noundef %3) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %1, i8 0, i64 48, i1 false)
  %4 = call ptr @q_new(i64 noundef 10, ptr noundef nonnull %1)
  %5 = call zeroext i1 @q_enqueue(ptr noundef %4, ptr noundef nonnull @.str)
  br i1 %5, label %6, label %.critedge55

6:                                                ; preds = %0
  %7 = call zeroext i1 @q_enqueue(ptr noundef %4, ptr noundef nonnull @.str.1)
  br i1 %7, label %.critedge, label %.critedge55

.critedge:                                        ; preds = %6
  %8 = call zeroext i1 @q_enqueue(ptr noundef %4, ptr noundef nonnull @.str.2)
  br i1 %8, label %.critedge46, label %.critedge55

.critedge46:                                      ; preds = %.critedge
  %9 = call zeroext i1 @q_enqueue(ptr noundef %4, ptr noundef nonnull @.str.3)
  br i1 %9, label %.critedge47, label %.critedge55

.critedge47:                                      ; preds = %.critedge46
  %10 = call zeroext i1 @q_enqueue(ptr noundef %4, ptr noundef nonnull @.str.4)
  br i1 %10, label %.critedge48, label %.critedge55

.critedge48:                                      ; preds = %.critedge47
  %11 = call zeroext i1 @q_enqueue(ptr noundef %4, ptr noundef nonnull @.str.5)
  br i1 %11, label %.critedge49, label %.critedge55

.critedge49:                                      ; preds = %.critedge48
  %12 = call zeroext i1 @q_enqueue(ptr noundef %4, ptr noundef nonnull @.str.6)
  br i1 %12, label %.critedge50, label %.critedge55

.critedge50:                                      ; preds = %.critedge49
  %13 = call zeroext i1 @q_enqueue(ptr noundef %4, ptr noundef nonnull @.str.7)
  br i1 %13, label %.critedge51, label %.critedge55

.critedge51:                                      ; preds = %.critedge50
  %14 = call zeroext i1 @q_enqueue(ptr noundef %4, ptr noundef nonnull @.str.8)
  br i1 %14, label %.critedge52, label %.critedge55

.critedge52:                                      ; preds = %.critedge51
  %15 = call zeroext i1 @q_enqueue(ptr noundef %4, ptr noundef nonnull @.str.9)
  br i1 %15, label %.critedge53, label %.critedge55

.critedge53:                                      ; preds = %.critedge52
  %16 = call zeroext i1 @q_enqueue(ptr noundef %4, ptr noundef nonnull @.str.10)
  br i1 %16, label %.critedge54, label %.critedge55

.critedge54:                                      ; preds = %.critedge53
  %17 = call zeroext i1 @q_enqueue(ptr noundef %4, ptr noundef nonnull @.str.11)
  br i1 %17, label %.preheader, label %.critedge55

.critedge55:                                      ; preds = %.critedge53, %.critedge51, %.critedge49, %.critedge47, %.critedge, %0, %6, %.critedge46, %.critedge48, %.critedge50, %.critedge52, %.critedge54
  %18 = load ptr, ptr @stderr, align 8, !tbaa !5
  %19 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str.12) #6
  br label %39

.preheader:                                       ; preds = %.critedge54, %23
  %.04366 = phi i64 [ %27, %23 ], [ 20, %.critedge54 ]
  %20 = call i32 @rand() #5
  %21 = call ptr @q_peek(ptr noundef %4)
  %22 = call zeroext i1 @q_dequeue(ptr noundef %4)
  br i1 %22, label %23, label %.thread

23:                                               ; preds = %.preheader
  %24 = srem i32 %20, 5
  %25 = sext i32 %24 to i64
  %26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, ptr noundef %21, i64 noundef %25)
  %27 = call i64 @llvm.usub.sat.i64(i64 %.04366, i64 %25)
  %.not.not = icmp ugt i64 %.04366, %25
  br i1 %.not.not, label %.preheader, label %.thread59

.thread:                                          ; preds = %.preheader
  %28 = call zeroext i1 @q_empty(ptr noundef %4)
  br i1 %28, label %37, label %30

.thread59:                                        ; preds = %23
  %29 = call zeroext i1 @q_empty(ptr noundef %4)
  br i1 %29, label %.thread62, label %30

30:                                               ; preds = %.thread59, %.thread
  %31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %32 = call zeroext i1 @q_empty(ptr noundef %4)
  br i1 %32, label %.thread62, label %.lr.ph

.lr.ph:                                           ; preds = %30, %.lr.ph
  %33 = call ptr @q_peek(ptr noundef %4)
  %34 = call zeroext i1 @q_dequeue(ptr noundef %4)
  %35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, ptr noundef %33)
  %36 = call zeroext i1 @q_empty(ptr noundef %4)
  br i1 %36, label %.thread62, label %.lr.ph, !llvm.loop !9

37:                                               ; preds = %.thread
  %38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16, i64 noundef %.04366)
  br label %.thread62

.thread62:                                        ; preds = %.lr.ph, %30, %.thread59, %37
  call void @q_free(ptr noundef %4)
  br label %39

39:                                               ; preds = %.thread62, %.critedge55
  %.0 = phi i32 [ 0, %.thread62 ], [ 1, %.critedge55 ]
  ret i32 %.0
}

; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.usub.sat.i64(i64, i64) #4

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { 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 #3 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { cold 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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