; LLVM IR from ponylang/ponyc :: src/libponyc/type (viewpoint)

; 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 [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [78 x i8], align 1
@__func__.viewpoint_type = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @viewpoint_type(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca [3 x ptr], align 16
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !9
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = call i32 @ast_id(ptr noundef %25)
  switch i32 %26, label %57 [
    i32 149, label %27
    i32 56, label %27
    i32 150, label %27
    i32 187, label %47
    i32 151, label %48
    i32 17, label %58
  ]

27:                                               ; preds = %2, %2, %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = call i32 @ast_id(ptr noundef %29)
  %31 = call ptr @ast_from(ptr noundef %28, i32 noundef %30)
  store ptr %31, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = call ptr @ast_child(ptr noundef %32)
  store ptr %33, ptr %8, align 8, !tbaa !5
  br label %34

34:                                               ; preds = %37, %27
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %45

37:                                               ; preds = %34
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = call ptr @viewpoint_type(ptr noundef %39, ptr noundef %40)
  %42 = call ptr @ast_append(ptr noundef %38, ptr noundef %41)
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = call ptr @ast_sibling(ptr noundef %43)
  store ptr %44, ptr %8, align 8, !tbaa !5
  br label %34, !llvm.loop !11

45:                                               ; preds = %34
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %46, ptr %3, align 8
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %186

47:                                               ; preds = %2
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %58

48:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = call ptr @cap_fetch(ptr noundef %49)
  store ptr %50, ptr %10, align 8, !tbaa !5
  %51 = load ptr, ptr %10, align 8, !tbaa !5
  %52 = call i32 @ast_id(ptr noundef %51)
  switch i32 %52, label %55 [
    i32 91, label %53
    i32 92, label %53
    i32 93, label %53
    i32 95, label %53
    i32 94, label %54
    i32 96, label %54
    i32 99, label %54
  ]

53:                                               ; preds = %48, %48, %48, %48
  store i32 1, ptr %6, align 4, !tbaa !9
  br label %56

54:                                               ; preds = %48, %48, %48
  store i32 2, ptr %6, align 4, !tbaa !9
  br label %56

55:                                               ; preds = %48
  br label %56

56:                                               ; preds = %55, %54, %53
  store i32 2, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %58

57:                                               ; preds = %2
  call void @ponyint_assert_fail(ptr noundef @.str, ptr noundef @.str.1, i64 noundef 72, ptr noundef @__func__.viewpoint_type)
  store ptr null, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %186

58:                                               ; preds = %56, %47, %2
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = call i32 @ast_id(ptr noundef %59)
  switch i32 %60, label %95 [
    i32 151, label %61
    i32 187, label %61
    i32 152, label %78
    i32 91, label %83
    i32 92, label %83
    i32 93, label %83
    i32 94, label %83
    i32 95, label %83
    i32 96, label %83
    i32 17, label %84
  ]

61:                                               ; preds = %58, %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = call ptr @cap_fetch(ptr noundef %62)
  store ptr %63, ptr %11, align 8, !tbaa !5
  %64 = load ptr, ptr %11, align 8, !tbaa !5
  %65 = call i32 @ast_id(ptr noundef %64)
  switch i32 %65, label %74 [
    i32 93, label %66
    i32 98, label %69
    i32 99, label %69
    i32 97, label %69
    i32 100, label %69
    i32 101, label %69
  ]

66:                                               ; preds = %61
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = call ptr @ast_dup(ptr noundef %67)
  store ptr %68, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %76

69:                                               ; preds = %61, %61, %61, %61, %61
  %70 = load i32, ptr %6, align 4, !tbaa !9
  %71 = icmp eq i32 %70, 1
  br i1 %71, label %72, label %73

72:                                               ; preds = %69
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %73

73:                                               ; preds = %72, %69
  br label %75

74:                                               ; preds = %61
  br label %75

75:                                               ; preds = %74, %73
  store i32 6, ptr %9, align 4
  br label %76

76:                                               ; preds = %75, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  %77 = load i32, ptr %9, align 4
  switch i32 %77, label %186 [
    i32 6, label %96
  ]

78:                                               ; preds = %58
  %79 = load i32, ptr %6, align 4, !tbaa !9
  %80 = icmp eq i32 %79, 1
  br i1 %80, label %81, label %82

81:                                               ; preds = %78
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %81, %78
  br label %96

83:                                               ; preds = %58, %58, %58, %58, %58, %58
  br label %96

84:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #3
  store ptr %12, ptr %14, align 8, !tbaa !5
  %85 = getelementptr inbounds ptr, ptr %14, i64 1
  store ptr %13, ptr %85, align 8, !tbaa !5
  %86 = getelementptr inbounds ptr, ptr %14, i64 2
  store ptr null, ptr %86, align 8, !tbaa !5
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds [3 x ptr], ptr %14, i64 0, i64 0
  call void @ast_get_children(ptr noundef %87, i64 noundef 2, ptr noundef %88)
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %89 = load ptr, ptr %13, align 8, !tbaa !5
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = call ptr @viewpoint_type(ptr noundef %89, ptr noundef %90)
  store ptr %91, ptr %15, align 8, !tbaa !5
  %92 = load ptr, ptr %12, align 8, !tbaa !5
  %93 = load ptr, ptr %15, align 8, !tbaa !5
  %94 = call ptr @viewpoint_type(ptr noundef %92, ptr noundef %93)
  store ptr %94, ptr %3, align 8
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  br label %186

95:                                               ; preds = %58
  call void @ponyint_assert_fail(ptr noundef @.str, ptr noundef @.str.1, i64 noundef 126, ptr noundef @__func__.viewpoint_type)
  store ptr null, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %186

96:                                               ; preds = %83, %82, %76
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %97, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  store ptr null, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  store ptr null, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  store ptr null, ptr %20, align 8, !tbaa !5
  %98 = load ptr, ptr %17, align 8, !tbaa !5
  %99 = call ptr @ast_from(ptr noundef %98, i32 noundef 17)
  store ptr %99, ptr %20, align 8, !tbaa !5
  %100 = load ptr, ptr %18, align 8, !tbaa !5
  %101 = icmp eq ptr %100, null
  br i1 %101, label %102, label %104

102:                                              ; preds = %96
  %103 = load ptr, ptr %20, align 8, !tbaa !5
  store ptr %103, ptr %18, align 8, !tbaa !5
  br label %116

104:                                              ; preds = %96
  %105 = load ptr, ptr %19, align 8, !tbaa !5
  %106 = icmp eq ptr %105, null
  br i1 %106, label %107, label %111

107:                                              ; preds = %104
  %108 = load ptr, ptr %18, align 8, !tbaa !5
  %109 = load ptr, ptr %20, align 8, !tbaa !5
  %110 = call ptr @ast_add(ptr noundef %108, ptr noundef %109)
  store ptr %110, ptr %19, align 8, !tbaa !5
  br label %115

111:                                              ; preds = %104
  %112 = load ptr, ptr %19, align 8, !tbaa !5
  %113 = load ptr, ptr %20, align 8, !tbaa !5
  %114 = call ptr @ast_add_sibling(ptr noundef %112, ptr noundef %113)
  store ptr %114, ptr %19, align 8, !tbaa !5
  br label %115

115:                                              ; preds = %111, %107
  br label %116

116:                                              ; preds = %115, %102
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  %117 = load ptr, ptr %20, align 8, !tbaa !5
  store ptr %117, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  store ptr null, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #3
  store ptr null, ptr %23, align 8, !tbaa !5
  %118 = load ptr, ptr %21, align 8, !tbaa !5
  %119 = icmp eq ptr %118, null
  br i1 %119, label %120, label %123

120:                                              ; preds = %116
  %121 = load ptr, ptr %4, align 8, !tbaa !5
  %122 = call ptr @ast_dup(ptr noundef %121)
  store ptr %122, ptr %21, align 8, !tbaa !5
  br label %137

123:                                              ; preds = %116
  %124 = load ptr, ptr %22, align 8, !tbaa !5
  %125 = icmp eq ptr %124, null
  br i1 %125, label %126, label %131

126:                                              ; preds = %123
  %127 = load ptr, ptr %21, align 8, !tbaa !5
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  %129 = call ptr @ast_dup(ptr noundef %128)
  %130 = call ptr @ast_add(ptr noundef %127, ptr noundef %129)
  store ptr %130, ptr %22, align 8, !tbaa !5
  br label %136

131:                                              ; preds = %123
  %132 = load ptr, ptr %22, align 8, !tbaa !5
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = call ptr @ast_dup(ptr noundef %133)
  %135 = call ptr @ast_add_sibling(ptr noundef %132, ptr noundef %134)
  store ptr %135, ptr %22, align 8, !tbaa !5
  br label %136

136:                                              ; preds = %131, %126
  br label %137

137:                                              ; preds = %136, %120
  %138 = load ptr, ptr %21, align 8, !tbaa !5
  %139 = icmp eq ptr %138, null
  br i1 %139, label %140, label %143

140:                                              ; preds = %137
  %141 = load ptr, ptr %5, align 8, !tbaa !5
  %142 = call ptr @ast_dup(ptr noundef %141)
  store ptr %142, ptr %21, align 8, !tbaa !5
  br label %157

143:                                              ; preds = %137
  %144 = load ptr, ptr %22, align 8, !tbaa !5
  %145 = icmp eq ptr %144, null
  br i1 %145, label %146, label %151

146:                                              ; preds = %143
  %147 = load ptr, ptr %21, align 8, !tbaa !5
  %148 = load ptr, ptr %5, align 8, !tbaa !5
  %149 = call ptr @ast_dup(ptr noundef %148)
  %150 = call ptr @ast_add(ptr noundef %147, ptr noundef %149)
  store ptr %150, ptr %22, align 8, !tbaa !5
  br label %156

151:                                              ; preds = %143
  %152 = load ptr, ptr %22, align 8, !tbaa !5
  %153 = load ptr, ptr %5, align 8, !tbaa !5
  %154 = call ptr @ast_dup(ptr noundef %153)
  %155 = call ptr @ast_add_sibling(ptr noundef %152, ptr noundef %154)
  store ptr %155, ptr %22, align 8, !tbaa !5
  br label %156

156:                                              ; preds = %151, %146
  br label %157

157:                                              ; preds = %156, %140
  %158 = load ptr, ptr %21, align 8, !tbaa !5
  call void @ast_inheritflags(ptr noundef %158)
  %159 = load ptr, ptr %21, align 8, !tbaa !5
  %160 = load ptr, ptr %22, align 8, !tbaa !5
  %161 = load ptr, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  %162 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %162, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  %163 = load i32, ptr %6, align 4, !tbaa !9
  %164 = icmp ne i32 %163, 0
  br i1 %164, label %165, label %183

165:                                              ; preds = %157
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #3
  %166 = load ptr, ptr %16, align 8, !tbaa !5
  %167 = call ptr @viewpoint_upper(ptr noundef %166)
  store ptr %167, ptr %24, align 8, !tbaa !5
  %168 = load ptr, ptr %24, align 8, !tbaa !5
  %169 = icmp eq ptr %168, null
  br i1 %169, label %170, label %172

170:                                              ; preds = %165
  %171 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %171, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %180

172:                                              ; preds = %165
  %173 = load ptr, ptr %16, align 8, !tbaa !5
  %174 = load ptr, ptr %24, align 8, !tbaa !5
  %175 = icmp ne ptr %173, %174
  br i1 %175, label %176, label %179

176:                                              ; preds = %172
  %177 = load ptr, ptr %16, align 8, !tbaa !5
  call void @ast_free_unattached(ptr noundef %177)
  %178 = load ptr, ptr %24, align 8, !tbaa !5
  store ptr %178, ptr %16, align 8, !tbaa !5
  br label %179

179:                                              ; preds = %176, %172
  store i32 0, ptr %9, align 4
  br label %180

180:                                              ; preds = %179, %170
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #3
  %181 = load i32, ptr %9, align 4
  switch i32 %181, label %185 [
    i32 0, label %182
  ]

182:                                              ; preds = %180
  br label %183

183:                                              ; preds = %182, %157
  %184 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %184, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %185

185:                                              ; preds = %183, %180
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  br label %186

186:                                              ; preds = %185, %95, %84, %76, %57, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  %187 = load ptr, ptr %3, align 8
  ret ptr %187
}

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

declare i32 @ast_id(ptr noundef) #2

declare ptr @ast_from(ptr noundef, i32 noundef) #2

declare ptr @ast_child(ptr noundef) #2

declare ptr @ast_append(ptr noundef, ptr noundef) #2

declare ptr @ast_sibling(ptr noundef) #2

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

declare ptr @cap_fetch(ptr noundef) #2

declare void @ponyint_assert_fail(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #2

declare ptr @ast_dup(ptr noundef) #2

declare void @ast_get_children(ptr noundef, i64 noundef, ptr noundef) #2

declare ptr @ast_add(ptr noundef, ptr noundef) #2

declare ptr @ast_add_sibling(ptr noundef, ptr noundef) #2

declare void @ast_inheritflags(ptr noundef) #2

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

declare void @ast_free_unattached(ptr noundef) #2

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 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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"

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [78 x i8], align 1
@__func__.viewpoint_type = external hidden unnamed_addr constant [15 x i8], align 1
@switch.table.viewpoint_type = private unnamed_addr constant [9 x i32] [i32 0, i32 0, i32 0, i32 2, i32 0, i32 2, i32 0, i32 0, i32 2], align 4
@switch.table.viewpoint_type.1 = private unnamed_addr constant [9 x i32] [i32 1, i32 1, i32 1, i32 2, i32 1, i32 2, i32 0, i32 0, i32 2], align 4

; Function Attrs: nounwind uwtable
define dso_local ptr @viewpoint_type(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [3 x ptr], align 16
  %6 = tail call i32 @ast_id(ptr noundef %1) #3
  switch i32 %6, label %18 [
    i32 149, label %7
    i32 56, label %7
    i32 150, label %7
    i32 187, label %21
    i32 151, label %14
    i32 17, label %21
  ]

7:                                                ; preds = %2, %2, %2
  %8 = tail call i32 @ast_id(ptr noundef %1) #3
  %9 = tail call ptr @ast_from(ptr noundef %1, i32 noundef %8) #3
  %10 = tail call ptr @ast_child(ptr noundef %1) #3
  %.not8396 = icmp eq ptr %10, null
  br i1 %.not8396, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %7, %.lr.ph
  %.07397 = phi ptr [ %13, %.lr.ph ], [ %10, %7 ]
  %11 = tail call ptr @viewpoint_type(ptr noundef %0, ptr noundef nonnull %.07397)
  %12 = tail call ptr @ast_append(ptr noundef %9, ptr noundef %11) #3
  %13 = tail call ptr @ast_sibling(ptr noundef nonnull %.07397) #3
  %.not83 = icmp eq ptr %13, null
  br i1 %.not83, label %.loopexit, label %.lr.ph, !llvm.loop !5

14:                                               ; preds = %2
  %15 = tail call ptr @cap_fetch(ptr noundef %1) #3
  %16 = tail call i32 @ast_id(ptr noundef %15) #3
  %switch.tableidx = add i32 %16, -91
  %17 = icmp ult i32 %switch.tableidx, 9
  br i1 %17, label %switch.lookup, label %21

18:                                               ; preds = %2
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i64 noundef 72, ptr noundef nonnull @__func__.viewpoint_type) #3
  br label %.loopexit

switch.lookup:                                    ; preds = %14
  %19 = zext nneg i32 %switch.tableidx to i64
  %switch.gep = getelementptr inbounds [9 x i32], ptr @switch.table.viewpoint_type, i64 0, i64 %19
  %switch.load = load i32, ptr %switch.gep, align 4
  %20 = zext nneg i32 %switch.tableidx to i64
  %switch.gep98 = getelementptr inbounds [9 x i32], ptr @switch.table.viewpoint_type.1, i64 0, i64 %20
  %switch.load99 = load i32, ptr %switch.gep98, align 4
  br label %21

21:                                               ; preds = %switch.lookup, %14, %2, %2
  %spec.store.select2 = phi i32 [ 0, %2 ], [ 0, %2 ], [ 0, %14 ], [ %switch.load, %switch.lookup ]
  %.164 = phi i32 [ 0, %2 ], [ 0, %2 ], [ 0, %14 ], [ %switch.load99, %switch.lookup ]
  %22 = tail call i32 @ast_id(ptr noundef %0) #3
  switch i32 %22, label %37 [
    i32 151, label %23
    i32 187, label %23
    i32 152, label %29
    i32 91, label %.thread
    i32 92, label %.thread
    i32 93, label %.thread
    i32 94, label %.thread
    i32 95, label %.thread
    i32 96, label %.thread
    i32 17, label %30
  ]

23:                                               ; preds = %21, %21
  %24 = tail call ptr @cap_fetch(ptr noundef %0) #3
  %25 = tail call i32 @ast_id(ptr noundef %24) #3
  switch i32 %25, label %.thread [
    i32 93, label %27
    i32 98, label %26
    i32 99, label %26
    i32 97, label %26
    i32 100, label %26
    i32 101, label %26
  ]

26:                                               ; preds = %23, %23, %23, %23, %23
  br label %.thread

27:                                               ; preds = %23
  %28 = tail call ptr @ast_dup(ptr noundef %1) #3
  br label %.loopexit

29:                                               ; preds = %21
  br label %.thread

30:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #3
  store ptr %3, ptr %5, align 16, !tbaa !7
  %31 = getelementptr inbounds i8, ptr %5, i64 8
  store ptr %4, ptr %31, align 8, !tbaa !7
  %32 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr null, ptr %32, align 16, !tbaa !7
  call void @ast_get_children(ptr noundef %0, i64 noundef 2, ptr noundef nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #3
  %33 = load ptr, ptr %4, align 8, !tbaa !7
  %34 = call ptr @viewpoint_type(ptr noundef %33, ptr noundef %1)
  %35 = load ptr, ptr %3, align 8, !tbaa !7
  %36 = call ptr @viewpoint_type(ptr noundef %35, ptr noundef %34)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  br label %.loopexit

37:                                               ; preds = %21
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i64 noundef 126, ptr noundef nonnull @__func__.viewpoint_type) #3
  br label %.loopexit

.thread:                                          ; preds = %26, %23, %21, %21, %21, %21, %21, %21, %29
  %.467 = phi i32 [ %.164, %21 ], [ %.164, %21 ], [ %.164, %21 ], [ %.164, %21 ], [ %.164, %21 ], [ %.164, %21 ], [ %spec.store.select2, %29 ], [ %spec.store.select2, %26 ], [ %.164, %23 ]
  %38 = tail call ptr @ast_from(ptr noundef %0, i32 noundef 17) #3
  %39 = icmp eq ptr %38, null
  %40 = tail call ptr @ast_dup(ptr noundef %0) #3
  br i1 %39, label %41, label %45

41:                                               ; preds = %.thread
  %42 = icmp eq ptr %40, null
  br i1 %42, label %43, label %.thread92

43:                                               ; preds = %41
  %44 = tail call ptr @ast_dup(ptr noundef %1) #3
  br label %53

45:                                               ; preds = %.thread
  %46 = tail call ptr @ast_add(ptr noundef nonnull %38, ptr noundef %40) #3
  %47 = icmp eq ptr %46, null
  br i1 %47, label %.thread92, label %50

.thread92:                                        ; preds = %41, %45
  %.0709095 = phi ptr [ %38, %45 ], [ %40, %41 ]
  %48 = tail call ptr @ast_dup(ptr noundef %1) #3
  %49 = tail call ptr @ast_add(ptr noundef nonnull %.0709095, ptr noundef %48) #3
  br label %53

50:                                               ; preds = %45
  %51 = tail call ptr @ast_dup(ptr noundef %1) #3
  %52 = tail call ptr @ast_add_sibling(ptr noundef nonnull %46, ptr noundef %51) #3
  br label %53

53:                                               ; preds = %.thread92, %50, %43
  %.171 = phi ptr [ %44, %43 ], [ %.0709095, %.thread92 ], [ %38, %50 ]
  tail call void @ast_inheritflags(ptr noundef %.171) #3
  %.not = icmp eq i32 %.467, 0
  br i1 %.not, label %.loopexit, label %54

54:                                               ; preds = %53
  %55 = tail call ptr @viewpoint_upper(ptr noundef %38)
  %.not82 = icmp eq ptr %55, null
  %.not81 = icmp eq ptr %38, %55
  %or.cond = or i1 %.not82, %.not81
  br i1 %or.cond, label %57, label %56

56:                                               ; preds = %54
  tail call void @ast_free_unattached(ptr noundef %38) #3
  br label %57

57:                                               ; preds = %56, %54
  %.175 = phi ptr [ %38, %54 ], [ %55, %56 ]
  %spec.select = select i1 %.not82, ptr %38, ptr %.175
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %7, %27, %57, %53, %37, %30, %18
  %.4 = phi ptr [ null, %18 ], [ null, %37 ], [ %36, %30 ], [ %28, %27 ], [ %38, %53 ], [ %spec.select, %57 ], [ %9, %7 ], [ %9, %.lr.ph ]
  ret ptr %.4
}

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

declare i32 @ast_id(ptr noundef) local_unnamed_addr #2

declare ptr @ast_from(ptr noundef, i32 noundef) local_unnamed_addr #2

declare ptr @ast_child(ptr noundef) local_unnamed_addr #2

declare ptr @ast_append(ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @ast_sibling(ptr noundef) local_unnamed_addr #2

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

declare ptr @cap_fetch(ptr noundef) local_unnamed_addr #2

declare void @ponyint_assert_fail(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

declare ptr @ast_dup(ptr noundef) local_unnamed_addr #2

declare void @ast_get_children(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

declare ptr @ast_add(ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @ast_add_sibling(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @ast_inheritflags(ptr noundef) local_unnamed_addr #2

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

declare void @ast_free_unattached(ptr noundef) local_unnamed_addr #2

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass