; LLVM IR from openluopworld/aes_128 :: lut (gen_dec_key_table)

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

@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@IK0 = external hidden global [256 x i32], align 16
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1
@IK1 = external hidden global [256 x i32], align 16
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@IK2 = external hidden global [256 x i32], align 16
@.str.6 = external hidden unnamed_addr constant [6 x i8], align 1
@IK3 = external hidden global [256 x i32], align 16

; 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: nounwind uwtable
define dso_local void @print_tables() #1 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #3
  %2 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %3

3:                                                ; preds = %18, %0
  %4 = load i32, ptr %1, align 4, !tbaa !5
  %5 = icmp slt i32 %4, 256
  br i1 %5, label %6, label %21

6:                                                ; preds = %3
  %7 = load i32, ptr %1, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds [256 x i32], ptr @IK0, i64 0, i64 %8
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %11 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %10)
  %12 = load i32, ptr %1, align 4, !tbaa !5
  %13 = srem i32 %12, 4
  %14 = icmp eq i32 %13, 3
  br i1 %14, label %15, label %17

15:                                               ; preds = %6
  %16 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %17

17:                                               ; preds = %15, %6
  br label %18

18:                                               ; preds = %17
  %19 = load i32, ptr %1, align 4, !tbaa !5
  %20 = add nsw i32 %19, 1
  store i32 %20, ptr %1, align 4, !tbaa !5
  br label %3, !llvm.loop !9

21:                                               ; preds = %3
  %22 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %39, %21
  %25 = load i32, ptr %1, align 4, !tbaa !5
  %26 = icmp slt i32 %25, 256
  br i1 %26, label %27, label %42

27:                                               ; preds = %24
  %28 = load i32, ptr %1, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [256 x i32], ptr @IK1, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %31)
  %33 = load i32, ptr %1, align 4, !tbaa !5
  %34 = srem i32 %33, 4
  %35 = icmp eq i32 %34, 3
  br i1 %35, label %36, label %38

36:                                               ; preds = %27
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %38

38:                                               ; preds = %36, %27
  br label %39

39:                                               ; preds = %38
  %40 = load i32, ptr %1, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %1, align 4, !tbaa !5
  br label %24, !llvm.loop !11

42:                                               ; preds = %24
  %43 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  %44 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %60, %42
  %46 = load i32, ptr %1, align 4, !tbaa !5
  %47 = icmp slt i32 %46, 256
  br i1 %47, label %48, label %63

48:                                               ; preds = %45
  %49 = load i32, ptr %1, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [256 x i32], ptr @IK2, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %52)
  %54 = load i32, ptr %1, align 4, !tbaa !5
  %55 = srem i32 %54, 4
  %56 = icmp eq i32 %55, 3
  br i1 %56, label %57, label %59

57:                                               ; preds = %48
  %58 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %59

59:                                               ; preds = %57, %48
  br label %60

60:                                               ; preds = %59
  %61 = load i32, ptr %1, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %1, align 4, !tbaa !5
  br label %45, !llvm.loop !12

63:                                               ; preds = %45
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  %65 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %66

66:                                               ; preds = %81, %63
  %67 = load i32, ptr %1, align 4, !tbaa !5
  %68 = icmp slt i32 %67, 256
  br i1 %68, label %69, label %84

69:                                               ; preds = %66
  %70 = load i32, ptr %1, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [256 x i32], ptr @IK3, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %73)
  %75 = load i32, ptr %1, align 4, !tbaa !5
  %76 = srem i32 %75, 4
  %77 = icmp eq i32 %76, 3
  br i1 %77, label %78, label %80

78:                                               ; preds = %69
  %79 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %80

80:                                               ; preds = %78, %69
  br label %81

81:                                               ; preds = %80
  %82 = load i32, ptr %1, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %1, align 4, !tbaa !5
  br label %66, !llvm.loop !13

84:                                               ; preds = %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #3
  ret void
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


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

@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@IK0 = external hidden local_unnamed_addr global [256 x i32], align 16
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1
@IK1 = external hidden local_unnamed_addr global [256 x i32], align 16
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@IK2 = external hidden local_unnamed_addr global [256 x i32], align 16
@.str.6 = external hidden unnamed_addr constant [6 x i8], align 1
@IK3 = external hidden local_unnamed_addr global [256 x i32], align 16

; Function Attrs: nofree nounwind uwtable
define dso_local void @print_tables() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  br label %2

2:                                                ; preds = %0, %10
  %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %10 ]
  %3 = getelementptr inbounds [256 x i32], ptr @IK0, i64 0, i64 %indvars.iv
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %4)
  %6 = and i64 %indvars.iv, 3
  %7 = icmp eq i64 %6, 3
  br i1 %7, label %8, label %10

8:                                                ; preds = %2
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %10

10:                                               ; preds = %2, %8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 256
  br i1 %exitcond.not, label %11, label %2, !llvm.loop !9

11:                                               ; preds = %10
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %14

14:                                               ; preds = %11, %22
  %indvars.iv21 = phi i64 [ 0, %11 ], [ %indvars.iv.next22, %22 ]
  %15 = getelementptr inbounds [256 x i32], ptr @IK1, i64 0, i64 %indvars.iv21
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %16)
  %18 = and i64 %indvars.iv21, 3
  %19 = icmp eq i64 %18, 3
  br i1 %19, label %20, label %22

20:                                               ; preds = %14
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %22

22:                                               ; preds = %14, %20
  %indvars.iv.next22 = add nuw nsw i64 %indvars.iv21, 1
  %exitcond24.not = icmp eq i64 %indvars.iv.next22, 256
  br i1 %exitcond24.not, label %23, label %14, !llvm.loop !11

23:                                               ; preds = %22
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  br label %26

26:                                               ; preds = %23, %34
  %indvars.iv25 = phi i64 [ 0, %23 ], [ %indvars.iv.next26, %34 ]
  %27 = getelementptr inbounds [256 x i32], ptr @IK2, i64 0, i64 %indvars.iv25
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %28)
  %30 = and i64 %indvars.iv25, 3
  %31 = icmp eq i64 %30, 3
  br i1 %31, label %32, label %34

32:                                               ; preds = %26
  %33 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %34

34:                                               ; preds = %26, %32
  %indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, 1
  %exitcond28.not = icmp eq i64 %indvars.iv.next26, 256
  br i1 %exitcond28.not, label %35, label %26, !llvm.loop !12

35:                                               ; preds = %34
  %36 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %37 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %38

38:                                               ; preds = %35, %46
  %indvars.iv29 = phi i64 [ 0, %35 ], [ %indvars.iv.next30, %46 ]
  %39 = getelementptr inbounds [256 x i32], ptr @IK3, i64 0, i64 %indvars.iv29
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %40)
  %42 = and i64 %indvars.iv29, 3
  %43 = icmp eq i64 %42, 3
  br i1 %43, label %44, label %46

44:                                               ; preds = %38
  %45 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %46

46:                                               ; preds = %38, %44
  %indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
  %exitcond32.not = icmp eq i64 %indvars.iv.next30, 256
  br i1 %exitcond32.not, label %47, label %38, !llvm.loop !13

47:                                               ; preds = %46
  ret void
}

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

attributes #0 = { nofree 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" }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


; Effective O3 passes: GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass