; LLVM IR from QMUL-EECS-Networks-Systems/ebpf-sketches :: tests/micro-benchmarks/prandom_u32/main_sip.ll (Z12prandom_seedj)

; 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.siprand_state = type { i64, i64, i64, i64 }

@net_rand_state = external dso_local global %struct.siprand_state, align 8

; 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: mustprogress uwtable
define dso_local void @_Z12prandom_seedj(i32 noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  store ptr @net_rand_state, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %9 = load ptr, ptr %4, align 8, !tbaa !9
  %10 = getelementptr inbounds %struct.siprand_state, ptr %9, i32 0, i32 0
  %11 = load i64, ptr %10, align 8, !tbaa !11
  store i64 %11, ptr %5, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %12 = load ptr, ptr %4, align 8, !tbaa !9
  %13 = getelementptr inbounds %struct.siprand_state, ptr %12, i32 0, i32 1
  %14 = load i64, ptr %13, align 8, !tbaa !15
  store i64 %14, ptr %6, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %15 = load ptr, ptr %4, align 8, !tbaa !9
  %16 = getelementptr inbounds %struct.siprand_state, ptr %15, i32 0, i32 2
  %17 = load i64, ptr %16, align 8, !tbaa !16
  store i64 %17, ptr %7, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %18 = load ptr, ptr %4, align 8, !tbaa !9
  %19 = getelementptr inbounds %struct.siprand_state, ptr %18, i32 0, i32 3
  %20 = load i64, ptr %19, align 8, !tbaa !17
  store i64 %20, ptr %8, align 8, !tbaa !14
  br label %21

21:                                               ; preds = %115, %1
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = zext i32 %22 to i64
  %24 = load i64, ptr %8, align 8, !tbaa !14
  %25 = xor i64 %24, %23
  store i64 %25, ptr %8, align 8, !tbaa !14
  %26 = load i64, ptr %6, align 8, !tbaa !14
  %27 = load i64, ptr %5, align 8, !tbaa !14
  %28 = add i64 %27, %26
  store i64 %28, ptr %5, align 8, !tbaa !14
  %29 = load i64, ptr %6, align 8, !tbaa !14
  %30 = call noundef i64 @_ZL5rol64yj(i64 noundef %29, i32 noundef 13)
  store i64 %30, ptr %6, align 8, !tbaa !14
  %31 = load i64, ptr %8, align 8, !tbaa !14
  %32 = load i64, ptr %7, align 8, !tbaa !14
  %33 = add i64 %32, %31
  store i64 %33, ptr %7, align 8, !tbaa !14
  %34 = load i64, ptr %8, align 8, !tbaa !14
  %35 = call noundef i64 @_ZL5rol64yj(i64 noundef %34, i32 noundef 16)
  store i64 %35, ptr %8, align 8, !tbaa !14
  %36 = load i64, ptr %5, align 8, !tbaa !14
  %37 = load i64, ptr %6, align 8, !tbaa !14
  %38 = xor i64 %37, %36
  store i64 %38, ptr %6, align 8, !tbaa !14
  %39 = load i64, ptr %5, align 8, !tbaa !14
  %40 = call noundef i64 @_ZL5rol64yj(i64 noundef %39, i32 noundef 32)
  store i64 %40, ptr %5, align 8, !tbaa !14
  %41 = load i64, ptr %7, align 8, !tbaa !14
  %42 = load i64, ptr %8, align 8, !tbaa !14
  %43 = xor i64 %42, %41
  store i64 %43, ptr %8, align 8, !tbaa !14
  %44 = load i64, ptr %8, align 8, !tbaa !14
  %45 = load i64, ptr %5, align 8, !tbaa !14
  %46 = add i64 %45, %44
  store i64 %46, ptr %5, align 8, !tbaa !14
  %47 = load i64, ptr %8, align 8, !tbaa !14
  %48 = call noundef i64 @_ZL5rol64yj(i64 noundef %47, i32 noundef 21)
  store i64 %48, ptr %8, align 8, !tbaa !14
  %49 = load i64, ptr %6, align 8, !tbaa !14
  %50 = load i64, ptr %7, align 8, !tbaa !14
  %51 = add i64 %50, %49
  store i64 %51, ptr %7, align 8, !tbaa !14
  %52 = load i64, ptr %6, align 8, !tbaa !14
  %53 = call noundef i64 @_ZL5rol64yj(i64 noundef %52, i32 noundef 17)
  store i64 %53, ptr %6, align 8, !tbaa !14
  %54 = load i64, ptr %5, align 8, !tbaa !14
  %55 = load i64, ptr %8, align 8, !tbaa !14
  %56 = xor i64 %55, %54
  store i64 %56, ptr %8, align 8, !tbaa !14
  %57 = load i64, ptr %7, align 8, !tbaa !14
  %58 = load i64, ptr %6, align 8, !tbaa !14
  %59 = xor i64 %58, %57
  store i64 %59, ptr %6, align 8, !tbaa !14
  %60 = load i64, ptr %7, align 8, !tbaa !14
  %61 = call noundef i64 @_ZL5rol64yj(i64 noundef %60, i32 noundef 32)
  store i64 %61, ptr %7, align 8, !tbaa !14
  %62 = load i64, ptr %6, align 8, !tbaa !14
  %63 = load i64, ptr %5, align 8, !tbaa !14
  %64 = add i64 %63, %62
  store i64 %64, ptr %5, align 8, !tbaa !14
  %65 = load i64, ptr %6, align 8, !tbaa !14
  %66 = call noundef i64 @_ZL5rol64yj(i64 noundef %65, i32 noundef 13)
  store i64 %66, ptr %6, align 8, !tbaa !14
  %67 = load i64, ptr %8, align 8, !tbaa !14
  %68 = load i64, ptr %7, align 8, !tbaa !14
  %69 = add i64 %68, %67
  store i64 %69, ptr %7, align 8, !tbaa !14
  %70 = load i64, ptr %8, align 8, !tbaa !14
  %71 = call noundef i64 @_ZL5rol64yj(i64 noundef %70, i32 noundef 16)
  store i64 %71, ptr %8, align 8, !tbaa !14
  %72 = load i64, ptr %5, align 8, !tbaa !14
  %73 = load i64, ptr %6, align 8, !tbaa !14
  %74 = xor i64 %73, %72
  store i64 %74, ptr %6, align 8, !tbaa !14
  %75 = load i64, ptr %5, align 8, !tbaa !14
  %76 = call noundef i64 @_ZL5rol64yj(i64 noundef %75, i32 noundef 32)
  store i64 %76, ptr %5, align 8, !tbaa !14
  %77 = load i64, ptr %7, align 8, !tbaa !14
  %78 = load i64, ptr %8, align 8, !tbaa !14
  %79 = xor i64 %78, %77
  store i64 %79, ptr %8, align 8, !tbaa !14
  %80 = load i64, ptr %8, align 8, !tbaa !14
  %81 = load i64, ptr %5, align 8, !tbaa !14
  %82 = add i64 %81, %80
  store i64 %82, ptr %5, align 8, !tbaa !14
  %83 = load i64, ptr %8, align 8, !tbaa !14
  %84 = call noundef i64 @_ZL5rol64yj(i64 noundef %83, i32 noundef 21)
  store i64 %84, ptr %8, align 8, !tbaa !14
  %85 = load i64, ptr %6, align 8, !tbaa !14
  %86 = load i64, ptr %7, align 8, !tbaa !14
  %87 = add i64 %86, %85
  store i64 %87, ptr %7, align 8, !tbaa !14
  %88 = load i64, ptr %6, align 8, !tbaa !14
  %89 = call noundef i64 @_ZL5rol64yj(i64 noundef %88, i32 noundef 17)
  store i64 %89, ptr %6, align 8, !tbaa !14
  %90 = load i64, ptr %5, align 8, !tbaa !14
  %91 = load i64, ptr %8, align 8, !tbaa !14
  %92 = xor i64 %91, %90
  store i64 %92, ptr %8, align 8, !tbaa !14
  %93 = load i64, ptr %7, align 8, !tbaa !14
  %94 = load i64, ptr %6, align 8, !tbaa !14
  %95 = xor i64 %94, %93
  store i64 %95, ptr %6, align 8, !tbaa !14
  %96 = load i64, ptr %7, align 8, !tbaa !14
  %97 = call noundef i64 @_ZL5rol64yj(i64 noundef %96, i32 noundef 32)
  store i64 %97, ptr %7, align 8, !tbaa !14
  %98 = load i32, ptr %2, align 4, !tbaa !5
  %99 = zext i32 %98 to i64
  %100 = load i64, ptr %5, align 8, !tbaa !14
  %101 = xor i64 %100, %99
  store i64 %101, ptr %5, align 8, !tbaa !14
  br label %102

102:                                              ; preds = %21
  %103 = load i64, ptr %5, align 8, !tbaa !14
  %104 = icmp ne i64 %103, 0
  br i1 %104, label %105, label %115

105:                                              ; preds = %102
  %106 = load i64, ptr %6, align 8, !tbaa !14
  %107 = icmp ne i64 %106, 0
  br i1 %107, label %108, label %115

108:                                              ; preds = %105
  %109 = load i64, ptr %7, align 8, !tbaa !14
  %110 = icmp ne i64 %109, 0
  br i1 %110, label %111, label %115

111:                                              ; preds = %108
  %112 = load i64, ptr %8, align 8, !tbaa !14
  %113 = icmp ne i64 %112, 0
  %114 = xor i1 %113, true
  br label %115

115:                                              ; preds = %111, %108, %105, %102
  %116 = phi i1 [ true, %108 ], [ true, %105 ], [ true, %102 ], [ %114, %111 ]
  br i1 %116, label %21, label %117, !llvm.loop !18

117:                                              ; preds = %115
  %118 = load i64, ptr %5, align 8, !tbaa !14
  %119 = load ptr, ptr %4, align 8, !tbaa !9
  %120 = getelementptr inbounds %struct.siprand_state, ptr %119, i32 0, i32 0
  store i64 %118, ptr %120, align 8, !tbaa !11
  %121 = load i64, ptr %6, align 8, !tbaa !14
  %122 = load ptr, ptr %4, align 8, !tbaa !9
  %123 = getelementptr inbounds %struct.siprand_state, ptr %122, i32 0, i32 1
  store i64 %121, ptr %123, align 8, !tbaa !15
  %124 = load i64, ptr %7, align 8, !tbaa !14
  %125 = load ptr, ptr %4, align 8, !tbaa !9
  %126 = getelementptr inbounds %struct.siprand_state, ptr %125, i32 0, i32 2
  store i64 %124, ptr %126, align 8, !tbaa !16
  %127 = load i64, ptr %8, align 8, !tbaa !14
  %128 = load ptr, ptr %4, align 8, !tbaa !9
  %129 = getelementptr inbounds %struct.siprand_state, ptr %128, i32 0, i32 3
  store i64 %127, ptr %129, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZL5rol64yj(i64 noundef, i32 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 #2 = { inlinehint mustprogress 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 #3 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTS13siprand_state", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!13 = !{!"long", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{!12, !13, i64 8}
!16 = !{!12, !13, i64 16}
!17 = !{!12, !13, i64 24}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


; 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.siprand_state = type { i64, i64, i64, i64 }

@net_rand_state = external dso_local local_unnamed_addr global %struct.siprand_state, align 8

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z12prandom_seedj(i32 noundef %0) local_unnamed_addr #0 {
  %2 = load i64, ptr @net_rand_state, align 8, !tbaa !5
  %3 = load i64, ptr getelementptr inbounds (i8, ptr @net_rand_state, i64 8), align 8, !tbaa !10
  %4 = load i64, ptr getelementptr inbounds (i8, ptr @net_rand_state, i64 16), align 8, !tbaa !11
  %5 = load i64, ptr getelementptr inbounds (i8, ptr @net_rand_state, i64 24), align 8, !tbaa !12
  %6 = zext i32 %0 to i64
  br label %7

7:                                                ; preds = %7, %1
  %.068 = phi i64 [ %2, %1 ], [ %37, %7 ]
  %.067 = phi i64 [ %3, %1 ], [ %35, %7 ]
  %.066 = phi i64 [ %4, %1 ], [ %36, %7 ]
  %.0 = phi i64 [ %5, %1 ], [ %34, %7 ]
  %8 = xor i64 %.0, %6
  %9 = add i64 %.067, %.068
  %10 = tail call noundef i64 @_ZL5rol64yj(i64 noundef %.067, i32 noundef 13)
  %11 = add i64 %8, %.066
  %12 = tail call noundef i64 @_ZL5rol64yj(i64 noundef %8, i32 noundef 16)
  %13 = xor i64 %10, %9
  %14 = tail call noundef i64 @_ZL5rol64yj(i64 noundef %9, i32 noundef 32)
  %15 = xor i64 %12, %11
  %16 = add i64 %14, %15
  %17 = tail call noundef i64 @_ZL5rol64yj(i64 noundef %15, i32 noundef 21)
  %18 = add i64 %11, %13
  %19 = tail call noundef i64 @_ZL5rol64yj(i64 noundef %13, i32 noundef 17)
  %20 = xor i64 %17, %16
  %21 = xor i64 %19, %18
  %22 = tail call noundef i64 @_ZL5rol64yj(i64 noundef %18, i32 noundef 32)
  %23 = add i64 %21, %16
  %24 = tail call noundef i64 @_ZL5rol64yj(i64 noundef %21, i32 noundef 13)
  %25 = add i64 %22, %20
  %26 = tail call noundef i64 @_ZL5rol64yj(i64 noundef %20, i32 noundef 16)
  %27 = xor i64 %24, %23
  %28 = tail call noundef i64 @_ZL5rol64yj(i64 noundef %23, i32 noundef 32)
  %29 = xor i64 %26, %25
  %30 = add i64 %28, %29
  %31 = tail call noundef i64 @_ZL5rol64yj(i64 noundef %29, i32 noundef 21)
  %32 = add i64 %27, %25
  %33 = tail call noundef i64 @_ZL5rol64yj(i64 noundef %27, i32 noundef 17)
  %34 = xor i64 %31, %30
  %35 = xor i64 %33, %32
  %36 = tail call noundef i64 @_ZL5rol64yj(i64 noundef %32, i32 noundef 32)
  %37 = xor i64 %30, %6
  %38 = icmp eq i64 %30, %6
  %39 = icmp eq i64 %33, %32
  %or.cond.not72 = select i1 %38, i1 true, i1 %39
  %40 = icmp eq i64 %36, 0
  %or.cond3.not = or i1 %or.cond.not72, %40
  %.not = icmp eq i64 %31, %30
  %41 = or i1 %.not, %or.cond3.not
  br i1 %41, label %7, label %42, !llvm.loop !13

42:                                               ; preds = %7
  store i64 %37, ptr @net_rand_state, align 8, !tbaa !5
  store i64 %35, ptr getelementptr inbounds (i8, ptr @net_rand_state, i64 8), align 8, !tbaa !10
  store i64 %36, ptr getelementptr inbounds (i8, ptr @net_rand_state, i64 16), align 8, !tbaa !11
  store i64 %34, ptr getelementptr inbounds (i8, ptr @net_rand_state, i64 24), align 8, !tbaa !12
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZL5rol64yj(i64 noundef, i32 noundef) local_unnamed_addr #1

attributes #0 = { mustprogress 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 = { inlinehint mustprogress 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, !7, i64 0}
!6 = !{!"_ZTS13siprand_state", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 16}
!12 = !{!6, !7, i64 24}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass