; LLVM IR from devantler/software-engineering-f22-shared :: IOT/BudgetManagementExcercise-03-28/ESP-Project/components/components/nghttp (variables)

; 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.mrb_value = type { %union.anon, i32 }
%union.anon = type { double }
%struct.mrb_state = type { ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.mrb_gc, i32, ptr, [256 x i32], i64, [8 x i8], ptr, ptr, ptr, ptr, ptr, ptr, i16, i16 }
%struct.mrb_gc = type { ptr, ptr, ptr, i64, ptr, i32, i32, i32, i32, ptr, ptr, i64, i64, i32, i32, i8, i64 }

; 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
declare hidden void @iv_foreach(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare { i64, i32 } @mrb_ary_new(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local { i64, i32 } @mrb_f_global_variables(ptr noundef %0, i64 %1, i32 %2) #1 {
  %4 = alloca %struct.mrb_value, align 8
  %5 = alloca %struct.mrb_value, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca [3 x i8], align 1
  %10 = alloca %struct.mrb_value, align 8
  %11 = getelementptr inbounds { i64, i32 }, ptr %5, i32 0, i32 0
  store i64 %1, ptr %11, align 8
  %12 = getelementptr inbounds { i64, i32 }, ptr %5, i32 0, i32 1
  store i32 %2, ptr %12, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.mrb_state, ptr %13, i32 0, i32 6
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %15, ptr %7, align 8, !tbaa !5
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = call { i64, i32 } @mrb_ary_new(ptr noundef %16)
  %18 = getelementptr inbounds { i64, i32 }, ptr %4, i32 0, i32 0
  %19 = extractvalue { i64, i32 } %17, 0
  store i64 %19, ptr %18, align 8
  %20 = getelementptr inbounds { i64, i32 }, ptr %4, i32 0, i32 1
  %21 = extractvalue { i64, i32 } %17, 1
  store i32 %21, ptr %20, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 3, ptr %9) #4
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  call void @iv_foreach(ptr noundef %22, ptr noundef %23, ptr noundef @gv_i, ptr noundef %4)
  %24 = getelementptr inbounds [3 x i8], ptr %9, i64 0, i64 0
  store i8 36, ptr %24, align 1, !tbaa !15
  %25 = getelementptr inbounds [3 x i8], ptr %9, i64 0, i64 2
  store i8 0, ptr %25, align 1, !tbaa !15
  store i64 1, ptr %8, align 8, !tbaa !16
  br label %26

26:                                               ; preds = %51, %3
  %27 = load i64, ptr %8, align 8, !tbaa !16
  %28 = icmp ule i64 %27, 9
  br i1 %28, label %29, label %54

29:                                               ; preds = %26
  %30 = load i64, ptr %8, align 8, !tbaa !16
  %31 = add i64 %30, 48
  %32 = trunc i64 %31 to i8
  %33 = getelementptr inbounds [3 x i8], ptr %9, i64 0, i64 1
  store i8 %32, ptr %33, align 1, !tbaa !15
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds [3 x i8], ptr %9, i64 0, i64 0
  %37 = call i32 @mrb_intern(ptr noundef %35, ptr noundef %36, i64 noundef 2)
  %38 = call { i64, i32 } @mrb_symbol_value(i32 noundef %37)
  %39 = getelementptr inbounds { i64, i32 }, ptr %10, i32 0, i32 0
  %40 = extractvalue { i64, i32 } %38, 0
  store i64 %40, ptr %39, align 8
  %41 = getelementptr inbounds { i64, i32 }, ptr %10, i32 0, i32 1
  %42 = extractvalue { i64, i32 } %38, 1
  store i32 %42, ptr %41, align 8
  %43 = getelementptr inbounds { i64, i32 }, ptr %4, i32 0, i32 0
  %44 = load i64, ptr %43, align 8
  %45 = getelementptr inbounds { i64, i32 }, ptr %4, i32 0, i32 1
  %46 = load i32, ptr %45, align 8
  %47 = getelementptr inbounds { i64, i32 }, ptr %10, i32 0, i32 0
  %48 = load i64, ptr %47, align 8
  %49 = getelementptr inbounds { i64, i32 }, ptr %10, i32 0, i32 1
  %50 = load i32, ptr %49, align 8
  call void @mrb_ary_push(ptr noundef %34, i64 %44, i32 %46, i64 %48, i32 %50)
  br label %51

51:                                               ; preds = %29
  %52 = load i64, ptr %8, align 8, !tbaa !16
  %53 = add i64 %52, 1
  store i64 %53, ptr %8, align 8, !tbaa !16
  br label %26, !llvm.loop !17

54:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 3, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  %55 = load { i64, i32 }, ptr %4, align 8
  ret { i64, i32 } %55
}

; Function Attrs: nounwind uwtable
declare hidden i32 @gv_i(ptr noundef, i32 noundef, i64, i32, ptr noundef) #1

declare void @mrb_ary_push(ptr noundef, i64, i32, i64, i32) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden { i64, i32 } @mrb_symbol_value(i32 noundef) #3

declare i32 @mrb_intern(ptr noundef, ptr noundef, i64 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 = { inlinehint 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 48}
!10 = !{!"mrb_state", !6, i64 0, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !12, i64 200, !11, i64 312, !6, i64 320, !7, i64 328, !13, i64 1352, !7, i64 1360, !6, i64 1368, !6, i64 1376, !6, i64 1384, !6, i64 1392, !6, i64 1400, !6, i64 1408, !14, i64 1416, !14, i64 1418}
!11 = !{!"int", !7, i64 0}
!12 = !{!"mrb_gc", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !6, i64 32, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !6, i64 56, !6, i64 64, !13, i64 72, !13, i64 80, !11, i64 88, !11, i64 92, !7, i64 96, !7, i64 96, !7, i64 96, !7, i64 96, !7, i64 96, !13, i64 104}
!13 = !{!"long", !7, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{!7, !7, i64 0}
!16 = !{!13, !13, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"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.mrb_value = type { %union.anon, i32 }
%union.anon = type { double }

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

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

; Function Attrs: nounwind uwtable
declare hidden void @iv_foreach(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare { i64, i32 } @mrb_ary_new(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local { i64, i32 } @mrb_f_global_variables(ptr noundef %0, i64 %1, i32 %2) local_unnamed_addr #1 {
  %4 = alloca %struct.mrb_value, align 8
  %5 = alloca [3 x i8], align 1
  %6 = getelementptr inbounds i8, ptr %0, i64 48
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = tail call { i64, i32 } @mrb_ary_new(ptr noundef %0) #4
  %9 = extractvalue { i64, i32 } %8, 0
  store i64 %9, ptr %4, align 8
  %10 = getelementptr inbounds i8, ptr %4, i64 8
  %11 = extractvalue { i64, i32 } %8, 1
  store i32 %11, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %5) #4
  call void @iv_foreach(ptr noundef %0, ptr noundef %7, ptr noundef nonnull @gv_i, ptr noundef nonnull %4)
  store i8 36, ptr %5, align 1, !tbaa !14
  %12 = getelementptr inbounds i8, ptr %5, i64 2
  store i8 0, ptr %12, align 1, !tbaa !14
  %13 = getelementptr inbounds i8, ptr %5, i64 1
  store i8 49, ptr %13, align 1, !tbaa !14
  %14 = call i32 @mrb_intern(ptr noundef %0, ptr noundef nonnull %5, i64 noundef 2) #4
  %15 = call { i64, i32 } @mrb_symbol_value(i32 noundef %14)
  %16 = extractvalue { i64, i32 } %15, 0
  %17 = extractvalue { i64, i32 } %15, 1
  %18 = load i64, ptr %4, align 8
  %19 = load i32, ptr %10, align 8
  call void @mrb_ary_push(ptr noundef %0, i64 %18, i32 %19, i64 %16, i32 %17) #4
  store i8 50, ptr %13, align 1, !tbaa !14
  %20 = call i32 @mrb_intern(ptr noundef %0, ptr noundef nonnull %5, i64 noundef 2) #4
  %21 = call { i64, i32 } @mrb_symbol_value(i32 noundef %20)
  %22 = extractvalue { i64, i32 } %21, 0
  %23 = extractvalue { i64, i32 } %21, 1
  %24 = load i64, ptr %4, align 8
  %25 = load i32, ptr %10, align 8
  call void @mrb_ary_push(ptr noundef %0, i64 %24, i32 %25, i64 %22, i32 %23) #4
  store i8 51, ptr %13, align 1, !tbaa !14
  %26 = call i32 @mrb_intern(ptr noundef %0, ptr noundef nonnull %5, i64 noundef 2) #4
  %27 = call { i64, i32 } @mrb_symbol_value(i32 noundef %26)
  %28 = extractvalue { i64, i32 } %27, 0
  %29 = extractvalue { i64, i32 } %27, 1
  %30 = load i64, ptr %4, align 8
  %31 = load i32, ptr %10, align 8
  call void @mrb_ary_push(ptr noundef %0, i64 %30, i32 %31, i64 %28, i32 %29) #4
  store i8 52, ptr %13, align 1, !tbaa !14
  %32 = call i32 @mrb_intern(ptr noundef %0, ptr noundef nonnull %5, i64 noundef 2) #4
  %33 = call { i64, i32 } @mrb_symbol_value(i32 noundef %32)
  %34 = extractvalue { i64, i32 } %33, 0
  %35 = extractvalue { i64, i32 } %33, 1
  %36 = load i64, ptr %4, align 8
  %37 = load i32, ptr %10, align 8
  call void @mrb_ary_push(ptr noundef %0, i64 %36, i32 %37, i64 %34, i32 %35) #4
  store i8 53, ptr %13, align 1, !tbaa !14
  %38 = call i32 @mrb_intern(ptr noundef %0, ptr noundef nonnull %5, i64 noundef 2) #4
  %39 = call { i64, i32 } @mrb_symbol_value(i32 noundef %38)
  %40 = extractvalue { i64, i32 } %39, 0
  %41 = extractvalue { i64, i32 } %39, 1
  %42 = load i64, ptr %4, align 8
  %43 = load i32, ptr %10, align 8
  call void @mrb_ary_push(ptr noundef %0, i64 %42, i32 %43, i64 %40, i32 %41) #4
  store i8 54, ptr %13, align 1, !tbaa !14
  %44 = call i32 @mrb_intern(ptr noundef %0, ptr noundef nonnull %5, i64 noundef 2) #4
  %45 = call { i64, i32 } @mrb_symbol_value(i32 noundef %44)
  %46 = extractvalue { i64, i32 } %45, 0
  %47 = extractvalue { i64, i32 } %45, 1
  %48 = load i64, ptr %4, align 8
  %49 = load i32, ptr %10, align 8
  call void @mrb_ary_push(ptr noundef %0, i64 %48, i32 %49, i64 %46, i32 %47) #4
  store i8 55, ptr %13, align 1, !tbaa !14
  %50 = call i32 @mrb_intern(ptr noundef %0, ptr noundef nonnull %5, i64 noundef 2) #4
  %51 = call { i64, i32 } @mrb_symbol_value(i32 noundef %50)
  %52 = extractvalue { i64, i32 } %51, 0
  %53 = extractvalue { i64, i32 } %51, 1
  %54 = load i64, ptr %4, align 8
  %55 = load i32, ptr %10, align 8
  call void @mrb_ary_push(ptr noundef %0, i64 %54, i32 %55, i64 %52, i32 %53) #4
  store i8 56, ptr %13, align 1, !tbaa !14
  %56 = call i32 @mrb_intern(ptr noundef %0, ptr noundef nonnull %5, i64 noundef 2) #4
  %57 = call { i64, i32 } @mrb_symbol_value(i32 noundef %56)
  %58 = extractvalue { i64, i32 } %57, 0
  %59 = extractvalue { i64, i32 } %57, 1
  %60 = load i64, ptr %4, align 8
  %61 = load i32, ptr %10, align 8
  call void @mrb_ary_push(ptr noundef %0, i64 %60, i32 %61, i64 %58, i32 %59) #4
  store i8 57, ptr %13, align 1, !tbaa !14
  %62 = call i32 @mrb_intern(ptr noundef %0, ptr noundef nonnull %5, i64 noundef 2) #4
  %63 = call { i64, i32 } @mrb_symbol_value(i32 noundef %62)
  %64 = extractvalue { i64, i32 } %63, 0
  %65 = extractvalue { i64, i32 } %63, 1
  %66 = load i64, ptr %4, align 8
  %67 = load i32, ptr %10, align 8
  call void @mrb_ary_push(ptr noundef %0, i64 %66, i32 %67, i64 %64, i32 %65) #4
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %5) #4
  %.fca.0.load = load i64, ptr %4, align 8
  %.fca.0.insert = insertvalue { i64, i32 } poison, i64 %.fca.0.load, 0
  %.fca.1.load = load i32, ptr %10, align 8
  %.fca.1.insert = insertvalue { i64, i32 } %.fca.0.insert, i32 %.fca.1.load, 1
  ret { i64, i32 } %.fca.1.insert
}

; Function Attrs: nounwind uwtable
declare hidden i32 @gv_i(ptr noundef, i32 noundef, i64, i32, ptr noundef) #1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden { i64, i32 } @mrb_symbol_value(i32 noundef) local_unnamed_addr #3

declare i32 @mrb_intern(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress 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 = { inlinehint 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 #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, !7, i64 48}
!6 = !{!"mrb_state", !7, i64 0, !10, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !7, i64 176, !7, i64 184, !7, i64 192, !11, i64 200, !10, i64 312, !7, i64 320, !8, i64 328, !12, i64 1352, !8, i64 1360, !7, i64 1368, !7, i64 1376, !7, i64 1384, !7, i64 1392, !7, i64 1400, !7, i64 1408, !13, i64 1416, !13, i64 1418}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"mrb_gc", !7, i64 0, !7, i64 8, !7, i64 16, !12, i64 24, !7, i64 32, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !7, i64 56, !7, i64 64, !12, i64 72, !12, i64 80, !10, i64 88, !10, i64 92, !8, i64 96, !8, i64 96, !8, i64 96, !8, i64 96, !8, i64 96, !12, i64 104}
!12 = !{!"long", !8, i64 0}
!13 = !{!"short", !8, i64 0}
!14 = !{!8, !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass