; LLVM IR from sysprog21/shecc :: src (ssa)

; 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.insn = type { ptr, ptr, i32, i32, ptr, ptr, ptr, i32, i8, ptr, ptr, [64 x i8] }

@.str.15 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.67 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.68 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.69 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.70 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.73 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.74 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.75 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.76 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.77 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.78 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.79 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.80 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.81 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.82 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.83 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.84 = external hidden unnamed_addr constant [15 x i8], align 1

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

; Function Attrs: noreturn nounwind
declare void @abort() #1

; Function Attrs: nounwind uwtable
define dso_local ptr @get_insn_op(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds %struct.insn, ptr %4, i32 0, i32 3
  %6 = load i32, ptr %5, align 4, !tbaa !9
  switch i32 %6, label %25 [
    i32 29, label %7
    i32 30, label %8
    i32 31, label %9
    i32 32, label %10
    i32 33, label %11
    i32 35, label %12
    i32 36, label %13
    i32 40, label %14
    i32 41, label %15
    i32 44, label %16
    i32 42, label %17
    i32 45, label %18
    i32 43, label %19
    i32 47, label %20
    i32 46, label %21
    i32 48, label %22
    i32 37, label %23
    i32 38, label %24
  ]

7:                                                ; preds = %1
  store ptr @.str.67, ptr %2, align 8
  br label %27

8:                                                ; preds = %1
  store ptr @.str.68, ptr %2, align 8
  br label %27

9:                                                ; preds = %1
  store ptr @.str.15, ptr %2, align 8
  br label %27

10:                                               ; preds = %1
  store ptr @.str.69, ptr %2, align 8
  br label %27

11:                                               ; preds = %1
  store ptr @.str.70, ptr %2, align 8
  br label %27

12:                                               ; preds = %1
  store ptr @.str.71, ptr %2, align 8
  br label %27

13:                                               ; preds = %1
  store ptr @.str.72, ptr %2, align 8
  br label %27

14:                                               ; preds = %1
  store ptr @.str.73, ptr %2, align 8
  br label %27

15:                                               ; preds = %1
  store ptr @.str.74, ptr %2, align 8
  br label %27

16:                                               ; preds = %1
  store ptr @.str.75, ptr %2, align 8
  br label %27

17:                                               ; preds = %1
  store ptr @.str.76, ptr %2, align 8
  br label %27

18:                                               ; preds = %1
  store ptr @.str.77, ptr %2, align 8
  br label %27

19:                                               ; preds = %1
  store ptr @.str.78, ptr %2, align 8
  br label %27

20:                                               ; preds = %1
  store ptr @.str.79, ptr %2, align 8
  br label %27

21:                                               ; preds = %1
  store ptr @.str.80, ptr %2, align 8
  br label %27

22:                                               ; preds = %1
  store ptr @.str.81, ptr %2, align 8
  br label %27

23:                                               ; preds = %1
  store ptr @.str.82, ptr %2, align 8
  br label %27

24:                                               ; preds = %1
  store ptr @.str.83, ptr %2, align 8
  br label %27

25:                                               ; preds = %1
  %26 = call i32 (ptr, ...) @printf(ptr noundef @.str.84)
  call void @abort() #3
  unreachable

27:                                               ; preds = %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7
  %28 = load ptr, ptr %2, align 8
  ret ptr %28
}

attributes #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 = { noreturn 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 = { 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 = { noreturn 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 = !{!10, !11, i64 20}
!10 = !{!"insn", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !6, i64 24, !6, i64 32, !6, i64 40, !11, i64 48, !12, i64 52, !6, i64 56, !6, i64 64, !7, i64 72}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_Bool", !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"

@.str.15 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.67 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.68 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.69 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.70 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.73 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.74 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.75 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.76 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.77 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.78 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.79 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.80 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.81 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.82 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.83 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.84 = external hidden unnamed_addr constant [15 x i8], align 1
@switch.table.get_insn_op = private unnamed_addr constant [20 x ptr] [ptr @.str.67, ptr @.str.68, ptr @.str.15, ptr @.str.69, ptr @.str.70, ptr @.str.67, ptr @.str.71, ptr @.str.72, ptr @.str.82, ptr @.str.83, ptr @.str.67, ptr @.str.73, ptr @.str.74, ptr @.str.76, ptr @.str.78, ptr @.str.75, ptr @.str.77, ptr @.str.80, ptr @.str.79, ptr @.str.81], align 8

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

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local noundef nonnull ptr @get_insn_op(ptr nocapture noundef readonly %0) local_unnamed_addr #2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 20
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %switch.tableidx = add i32 %3, -29
  %4 = icmp ult i32 %switch.tableidx, 20
  br i1 %4, label %switch.hole_check, label %5

5:                                                ; preds = %switch.hole_check, %1
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.84)
  tail call void @abort() #3
  unreachable

switch.hole_check:                                ; preds = %1
  %switch.shifted = lshr i32 1047519, %switch.tableidx
  %switch.lobit = trunc i32 %switch.shifted to i1
  br i1 %switch.lobit, label %switch.lookup, label %5

switch.lookup:                                    ; preds = %switch.hole_check
  %7 = zext nneg i32 %switch.tableidx to i64
  %switch.gep = getelementptr inbounds [20 x ptr], ptr @switch.table.get_insn_op, i64 0, i64 %7
  %switch.load = load ptr, ptr %switch.gep, align 8
  ret ptr %switch.load
}

attributes #0 = { 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 #1 = { noreturn 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 = { 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 = { noreturn 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, !10, i64 20}
!6 = !{!"insn", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !7, i64 24, !7, i64 32, !7, i64 40, !10, i64 48, !11, i64 52, !7, i64 56, !7, i64 64, !8, i64 72}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_Bool", !8, i64 0}


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