; LLVM IR from vul337/PrIntFuzz :: config/linux/firmware/carl9170fw/config (expr)

; 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.symbol = type { ptr, ptr, i32, %struct.symbol_value, [4 x %struct.symbol_value], i32, i32, ptr, %struct.expr_value, %struct.expr_value }
%struct.symbol_value = type { ptr, i32 }
%struct.expr_value = type { ptr, i32 }
%struct.expr = type { i32, %union.expr_data, %union.expr_data }
%union.expr_data = type { ptr }

@symbol_no = external global %struct.symbol, align 8
@symbol_yes = external global %struct.symbol, align 8

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @expr_extract_eq(i32 noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #0 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  store i32 %0, ptr %5, align 4, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !9
  %9 = load ptr, ptr %7, align 8, !tbaa !9
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = getelementptr inbounds %struct.expr, ptr %10, i32 0, i32 0
  %12 = load i32, ptr %11, align 8, !tbaa !11
  %13 = load i32, ptr %5, align 4, !tbaa !5
  %14 = icmp eq i32 %12, %13
  br i1 %14, label %15, label %28

15:                                               ; preds = %4
  %16 = load i32, ptr %5, align 4, !tbaa !5
  %17 = load ptr, ptr %6, align 8, !tbaa !9
  %18 = load ptr, ptr %7, align 8, !tbaa !9
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = getelementptr inbounds %struct.expr, ptr %19, i32 0, i32 1
  %21 = load ptr, ptr %8, align 8, !tbaa !9
  call void @expr_extract_eq(i32 noundef %16, ptr noundef %17, ptr noundef %20, ptr noundef %21)
  %22 = load i32, ptr %5, align 4, !tbaa !5
  %23 = load ptr, ptr %6, align 8, !tbaa !9
  %24 = load ptr, ptr %7, align 8, !tbaa !9
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  %26 = getelementptr inbounds %struct.expr, ptr %25, i32 0, i32 2
  %27 = load ptr, ptr %8, align 8, !tbaa !9
  call void @expr_extract_eq(i32 noundef %22, ptr noundef %23, ptr noundef %26, ptr noundef %27)
  br label %91

28:                                               ; preds = %4
  %29 = load ptr, ptr %8, align 8, !tbaa !9
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = getelementptr inbounds %struct.expr, ptr %30, i32 0, i32 0
  %32 = load i32, ptr %31, align 8, !tbaa !11
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = icmp eq i32 %32, %33
  br i1 %34, label %35, label %48

35:                                               ; preds = %28
  %36 = load i32, ptr %5, align 4, !tbaa !5
  %37 = load ptr, ptr %6, align 8, !tbaa !9
  %38 = load ptr, ptr %7, align 8, !tbaa !9
  %39 = load ptr, ptr %8, align 8, !tbaa !9
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  %41 = getelementptr inbounds %struct.expr, ptr %40, i32 0, i32 1
  call void @expr_extract_eq(i32 noundef %36, ptr noundef %37, ptr noundef %38, ptr noundef %41)
  %42 = load i32, ptr %5, align 4, !tbaa !5
  %43 = load ptr, ptr %6, align 8, !tbaa !9
  %44 = load ptr, ptr %7, align 8, !tbaa !9
  %45 = load ptr, ptr %8, align 8, !tbaa !9
  %46 = load ptr, ptr %45, align 8, !tbaa !9
  %47 = getelementptr inbounds %struct.expr, ptr %46, i32 0, i32 2
  call void @expr_extract_eq(i32 noundef %42, ptr noundef %43, ptr noundef %44, ptr noundef %47)
  br label %91

48:                                               ; preds = %28
  %49 = load ptr, ptr %7, align 8, !tbaa !9
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  %51 = load ptr, ptr %8, align 8, !tbaa !9
  %52 = load ptr, ptr %51, align 8, !tbaa !9
  %53 = call i32 @expr_eq(ptr noundef %50, ptr noundef %52)
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %91

55:                                               ; preds = %48
  %56 = load ptr, ptr %6, align 8, !tbaa !9
  %57 = load ptr, ptr %56, align 8, !tbaa !9
  %58 = icmp ne ptr %57, null
  br i1 %58, label %59, label %66

59:                                               ; preds = %55
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = load ptr, ptr %6, align 8, !tbaa !9
  %62 = load ptr, ptr %61, align 8, !tbaa !9
  %63 = load ptr, ptr %7, align 8, !tbaa !9
  %64 = load ptr, ptr %63, align 8, !tbaa !9
  %65 = call ptr @expr_alloc_two(i32 noundef %60, ptr noundef %62, ptr noundef %64)
  br label %69

66:                                               ; preds = %55
  %67 = load ptr, ptr %7, align 8, !tbaa !9
  %68 = load ptr, ptr %67, align 8, !tbaa !9
  br label %69

69:                                               ; preds = %66, %59
  %70 = phi ptr [ %65, %59 ], [ %68, %66 ]
  %71 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %70, ptr %71, align 8, !tbaa !9
  %72 = load ptr, ptr %8, align 8, !tbaa !9
  %73 = load ptr, ptr %72, align 8, !tbaa !9
  call void @expr_free(ptr noundef %73)
  %74 = load i32, ptr %5, align 4, !tbaa !5
  %75 = icmp eq i32 %74, 2
  br i1 %75, label %76, label %81

76:                                               ; preds = %69
  %77 = call ptr @expr_alloc_symbol(ptr noundef @symbol_yes)
  %78 = load ptr, ptr %7, align 8, !tbaa !9
  store ptr %77, ptr %78, align 8, !tbaa !9
  %79 = call ptr @expr_alloc_symbol(ptr noundef @symbol_yes)
  %80 = load ptr, ptr %8, align 8, !tbaa !9
  store ptr %79, ptr %80, align 8, !tbaa !9
  br label %90

81:                                               ; preds = %69
  %82 = load i32, ptr %5, align 4, !tbaa !5
  %83 = icmp eq i32 %82, 1
  br i1 %83, label %84, label %89

84:                                               ; preds = %81
  %85 = call ptr @expr_alloc_symbol(ptr noundef @symbol_no)
  %86 = load ptr, ptr %7, align 8, !tbaa !9
  store ptr %85, ptr %86, align 8, !tbaa !9
  %87 = call ptr @expr_alloc_symbol(ptr noundef @symbol_no)
  %88 = load ptr, ptr %8, align 8, !tbaa !9
  store ptr %87, ptr %88, align 8, !tbaa !9
  br label %89

89:                                               ; preds = %84, %81
  br label %90

90:                                               ; preds = %89, %76
  br label %91

91:                                               ; preds = %90, %48, %35, %15
  ret void
}

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

!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 = !{!"int", !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, !6, i64 0}
!12 = !{!"expr", !6, i64 0, !7, i64 8, !7, 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"

%struct.symbol = type { ptr, ptr, i32, %struct.symbol_value, [4 x %struct.symbol_value], i32, i32, ptr, %struct.expr_value, %struct.expr_value }
%struct.symbol_value = type { ptr, i32 }
%struct.expr_value = type { ptr, i32 }

@symbol_no = external global %struct.symbol, align 8
@symbol_yes = external global %struct.symbol, align 8

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @expr_extract_eq(i32 noundef %0, ptr noundef %1, ptr nocapture noundef %2, ptr nocapture noundef %3) local_unnamed_addr #0 {
  br label %tailrecurse.outer

tailrecurse.outer:                                ; preds = %tailrecurse._crit_edge, %4
  %.tr37.ph = phi ptr [ %13, %tailrecurse._crit_edge ], [ %2, %4 ]
  %.tr38.ph = phi ptr [ %.tr38.lcssa, %tailrecurse._crit_edge ], [ %3, %4 ]
  %5 = load ptr, ptr %.tr37.ph, align 8, !tbaa !5
  %6 = load i32, ptr %5, align 8, !tbaa !9
  %7 = icmp eq i32 %6, %0
  br i1 %7, label %tailrecurse._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %tailrecurse.outer
  %8 = load ptr, ptr %.tr38.ph, align 8, !tbaa !5
  %9 = load i32, ptr %8, align 8, !tbaa !9
  %10 = icmp eq i32 %9, %0
  br i1 %10, label %tailrecurse, label %.lr.ph.preheader._crit_edge

tailrecurse._crit_edge:                           ; preds = %tailrecurse, %tailrecurse.outer
  %.tr38.lcssa = phi ptr [ %.tr38.ph, %tailrecurse.outer ], [ %20, %tailrecurse ]
  %.lcssa = phi ptr [ %5, %tailrecurse.outer ], [ %21, %tailrecurse ]
  %11 = getelementptr inbounds i8, ptr %.lcssa, i64 8
  tail call void @expr_extract_eq(i32 noundef %0, ptr noundef %1, ptr noundef nonnull %11, ptr noundef %.tr38.lcssa)
  %12 = load ptr, ptr %.tr37.ph, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %12, i64 16
  br label %tailrecurse.outer

.lr.ph:                                           ; preds = %tailrecurse
  %14 = load ptr, ptr %20, align 8, !tbaa !5
  %15 = load i32, ptr %14, align 8, !tbaa !9
  %16 = icmp eq i32 %15, %0
  br i1 %16, label %tailrecurse, label %.lr.ph.preheader._crit_edge

tailrecurse:                                      ; preds = %.lr.ph.preheader, %.lr.ph
  %17 = phi ptr [ %14, %.lr.ph ], [ %8, %.lr.ph.preheader ]
  %.tr384266 = phi ptr [ %20, %.lr.ph ], [ %.tr38.ph, %.lr.ph.preheader ]
  %18 = getelementptr inbounds i8, ptr %17, i64 8
  tail call void @expr_extract_eq(i32 noundef %0, ptr noundef %1, ptr noundef nonnull %.tr37.ph, ptr noundef nonnull %18)
  %19 = load ptr, ptr %.tr384266, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %19, i64 16
  %21 = load ptr, ptr %.tr37.ph, align 8, !tbaa !5
  %22 = load i32, ptr %21, align 8, !tbaa !9
  %23 = icmp eq i32 %22, %0
  br i1 %23, label %tailrecurse._crit_edge, label %.lr.ph

.lr.ph.preheader._crit_edge:                      ; preds = %.lr.ph.preheader, %.lr.ph
  %.lcssa62 = phi ptr [ %21, %.lr.ph ], [ %5, %.lr.ph.preheader ]
  %.tr3842.lcssa = phi ptr [ %20, %.lr.ph ], [ %.tr38.ph, %.lr.ph.preheader ]
  %.lcssa59 = phi ptr [ %14, %.lr.ph ], [ %8, %.lr.ph.preheader ]
  %24 = tail call i32 @expr_eq(ptr noundef nonnull %.lcssa62, ptr noundef nonnull %.lcssa59)
  %.not = icmp eq i32 %24, 0
  br i1 %.not, label %36, label %25

25:                                               ; preds = %.lr.ph.preheader._crit_edge
  %26 = load ptr, ptr %1, align 8, !tbaa !5
  %.not35 = icmp eq ptr %26, null
  %27 = load ptr, ptr %.tr37.ph, align 8, !tbaa !5
  br i1 %.not35, label %30, label %28

28:                                               ; preds = %25
  %29 = tail call ptr @expr_alloc_two(i32 noundef %0, ptr noundef nonnull %26, ptr noundef %27)
  br label %30

30:                                               ; preds = %25, %28
  %31 = phi ptr [ %29, %28 ], [ %27, %25 ]
  store ptr %31, ptr %1, align 8, !tbaa !5
  %32 = load ptr, ptr %.tr3842.lcssa, align 8, !tbaa !5
  tail call void @expr_free(ptr noundef %32)
  switch i32 %0, label %36 [
    i32 2, label %.sink.split
    i32 1, label %33
  ]

33:                                               ; preds = %30
  br label %.sink.split

.sink.split:                                      ; preds = %30, %33
  %symbol_yes.sink58 = phi ptr [ @symbol_no, %33 ], [ @symbol_yes, %30 ]
  %34 = tail call ptr @expr_alloc_symbol(ptr noundef nonnull %symbol_yes.sink58)
  store ptr %34, ptr %.tr37.ph, align 8, !tbaa !5
  %35 = tail call ptr @expr_alloc_symbol(ptr noundef nonnull %symbol_yes.sink58)
  store ptr %35, ptr %.tr3842.lcssa, align 8, !tbaa !5
  br label %36

36:                                               ; preds = %.sink.split, %30, %.lr.ph.preheader._crit_edge
  ret void
}

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

!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, !11, i64 0}
!10 = !{!"expr", !11, i64 0, !7, i64 8, !7, i64 16}
!11 = !{!"int", !7, i64 0}


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