; LLVM IR from beagleboard/librobotcontrol :: library/src (pinmux)

; 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.46 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [39 x i8], align 1

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

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

declare i32 @rc_model() #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @rc_pinmux_set_default() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  %4 = call i32 @rc_model()
  %5 = icmp eq i32 %4, 7
  br i1 %5, label %6, label %31

6:                                                ; preds = %0
  %7 = call i32 @rc_pinmux_set(i32 noundef 29, i32 noundef 4)
  %8 = load i32, ptr %2, align 4, !tbaa !5
  %9 = or i32 %8, %7
  store i32 %9, ptr %2, align 4, !tbaa !5
  %10 = call i32 @rc_pinmux_set(i32 noundef 7, i32 noundef 4)
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = or i32 %11, %10
  store i32 %12, ptr %2, align 4, !tbaa !5
  %13 = call i32 @rc_pinmux_set(i32 noundef 57, i32 noundef 1)
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = or i32 %14, %13
  store i32 %15, ptr %2, align 4, !tbaa !5
  %16 = call i32 @rc_pinmux_set(i32 noundef 49, i32 noundef 1)
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = or i32 %17, %16
  store i32 %18, ptr %2, align 4, !tbaa !5
  %19 = call i32 @rc_pinmux_set(i32 noundef 116, i32 noundef 1)
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = or i32 %20, %19
  store i32 %21, ptr %2, align 4, !tbaa !5
  %22 = call i32 @rc_pinmux_set(i32 noundef 113, i32 noundef 1)
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = or i32 %23, %22
  store i32 %24, ptr %2, align 4, !tbaa !5
  %25 = call i32 @rc_pinmux_set(i32 noundef 98, i32 noundef 1)
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = or i32 %26, %25
  store i32 %27, ptr %2, align 4, !tbaa !5
  %28 = call i32 @rc_pinmux_set(i32 noundef 97, i32 noundef 1)
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = or i32 %29, %28
  store i32 %30, ptr %2, align 4, !tbaa !5
  br label %38

31:                                               ; preds = %0
  %32 = call i32 @rc_pinmux_set(i32 noundef 113, i32 noundef 4)
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = or i32 %33, %32
  store i32 %34, ptr %2, align 4, !tbaa !5
  %35 = call i32 @rc_pinmux_set(i32 noundef 49, i32 noundef 0)
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = or i32 %36, %35
  store i32 %37, ptr %2, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %31, %6
  %39 = call i32 @rc_pinmux_set(i32 noundef 30, i32 noundef 5)
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = or i32 %40, %39
  store i32 %41, ptr %2, align 4, !tbaa !5
  %42 = call i32 @rc_pinmux_set(i32 noundef 2, i32 noundef 5)
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = or i32 %43, %42
  store i32 %44, ptr %2, align 4, !tbaa !5
  %45 = call i32 @rc_pinmux_set(i32 noundef 3, i32 noundef 5)
  %46 = load i32, ptr %2, align 4, !tbaa !5
  %47 = or i32 %46, %45
  store i32 %47, ptr %2, align 4, !tbaa !5
  %48 = call i32 @rc_pinmux_set(i32 noundef 14, i32 noundef 5)
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = or i32 %49, %48
  store i32 %50, ptr %2, align 4, !tbaa !5
  %51 = call i32 @rc_pinmux_set(i32 noundef 15, i32 noundef 5)
  %52 = load i32, ptr %2, align 4, !tbaa !5
  %53 = or i32 %52, %51
  store i32 %53, ptr %2, align 4, !tbaa !5
  %54 = call i32 @rc_pinmux_set(i32 noundef 112, i32 noundef 4)
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = or i32 %55, %54
  store i32 %56, ptr %2, align 4, !tbaa !5
  %57 = call i32 @rc_pinmux_set(i32 noundef 111, i32 noundef 4)
  %58 = load i32, ptr %2, align 4, !tbaa !5
  %59 = or i32 %58, %57
  store i32 %59, ptr %2, align 4, !tbaa !5
  %60 = call i32 @rc_pinmux_set(i32 noundef 110, i32 noundef 4)
  %61 = load i32, ptr %2, align 4, !tbaa !5
  %62 = or i32 %61, %60
  store i32 %62, ptr %2, align 4, !tbaa !5
  %63 = load i32, ptr %2, align 4, !tbaa !5
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %69

65:                                               ; preds = %38
  %66 = load ptr, ptr @stderr, align 8, !tbaa !9
  %67 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %66, ptr noundef @.str.46) #4
  %68 = call i32 (ptr, ...) @printf(ptr noundef @.str.47)
  store i32 -1, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %70

69:                                               ; preds = %38
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %70

70:                                               ; preds = %69, %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  %71 = load i32, ptr %1, align 4
  ret i32 %71
}

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

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

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


; 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.46 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [39 x i8], align 1

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

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

declare i32 @rc_model() local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @rc_pinmux_set_default() local_unnamed_addr #0 {
  %1 = tail call i32 @rc_model() #3
  %2 = icmp eq i32 %1, 7
  br i1 %2, label %3, label %19

3:                                                ; preds = %0
  %4 = tail call i32 @rc_pinmux_set(i32 noundef 29, i32 noundef 4)
  %5 = tail call i32 @rc_pinmux_set(i32 noundef 7, i32 noundef 4)
  %6 = or i32 %5, %4
  %7 = tail call i32 @rc_pinmux_set(i32 noundef 57, i32 noundef 1)
  %8 = or i32 %6, %7
  %9 = tail call i32 @rc_pinmux_set(i32 noundef 49, i32 noundef 1)
  %10 = or i32 %8, %9
  %11 = tail call i32 @rc_pinmux_set(i32 noundef 116, i32 noundef 1)
  %12 = or i32 %10, %11
  %13 = tail call i32 @rc_pinmux_set(i32 noundef 113, i32 noundef 1)
  %14 = or i32 %12, %13
  %15 = tail call i32 @rc_pinmux_set(i32 noundef 98, i32 noundef 1)
  %16 = or i32 %14, %15
  %17 = tail call i32 @rc_pinmux_set(i32 noundef 97, i32 noundef 1)
  %18 = or i32 %16, %17
  br label %23

19:                                               ; preds = %0
  %20 = tail call i32 @rc_pinmux_set(i32 noundef 113, i32 noundef 4)
  %21 = tail call i32 @rc_pinmux_set(i32 noundef 49, i32 noundef 0)
  %22 = or i32 %21, %20
  br label %23

23:                                               ; preds = %19, %3
  %.0 = phi i32 [ %18, %3 ], [ %22, %19 ]
  %24 = tail call i32 @rc_pinmux_set(i32 noundef 30, i32 noundef 5)
  %25 = or i32 %24, %.0
  %26 = tail call i32 @rc_pinmux_set(i32 noundef 2, i32 noundef 5)
  %27 = or i32 %25, %26
  %28 = tail call i32 @rc_pinmux_set(i32 noundef 3, i32 noundef 5)
  %29 = or i32 %27, %28
  %30 = tail call i32 @rc_pinmux_set(i32 noundef 14, i32 noundef 5)
  %31 = or i32 %29, %30
  %32 = tail call i32 @rc_pinmux_set(i32 noundef 15, i32 noundef 5)
  %33 = or i32 %31, %32
  %34 = tail call i32 @rc_pinmux_set(i32 noundef 112, i32 noundef 4)
  %35 = or i32 %33, %34
  %36 = tail call i32 @rc_pinmux_set(i32 noundef 111, i32 noundef 4)
  %37 = or i32 %35, %36
  %38 = tail call i32 @rc_pinmux_set(i32 noundef 110, i32 noundef 4)
  %39 = or i32 %37, %38
  %.not = icmp eq i32 %39, 0
  br i1 %.not, label %44, label %40

40:                                               ; preds = %23
  %41 = load ptr, ptr @stderr, align 8, !tbaa !5
  %42 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %41, ptr noundef nonnull @.str.46) #4
  %43 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.47)
  br label %44

44:                                               ; preds = %23, %40
  %.020 = phi i32 [ -1, %40 ], [ 0, %23 ]
  ret i32 %.020
}

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { nounwind }
attributes #4 = { 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"}


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