; LLVM IR from unitreerobotics/kinect_teleoperate :: src/extern/glfw/src/tests (gamma)

; 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.GLFWgammaramp = type { ptr, ptr, ptr, i32 }
%struct.nk_rect = type { float, float, float, float }
%struct.nk_color = type { i8, i8, i8, i8 }

@glad_glClear = external dso_local global ptr, align 8
@.str.140 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.141 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.142 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.143 = external hidden unnamed_addr constant [7 x i8], align 1

; 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 dso_local i32 @gladLoadGL(ptr noundef) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare dso_local { <2 x float>, <2 x float> } @nk_rect(float noundef, float noundef, float noundef, float noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @nk_rgb(i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @nk_begin(ptr noundef, ptr noundef, <2 x float>, <2 x float>, i32 noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @nk_end(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @nk_window_set_bounds(ptr noundef, ptr noundef, <2 x float>, <2 x float>) #3

; Function Attrs: nounwind uwtable
declare dso_local void @nk_layout_row_dynamic(ptr noundef, float noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @nk_labelf(ptr noundef, i32 noundef, ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @nk_button_label(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @nk_slider_float(ptr noundef, float noundef, ptr noundef, float noundef, float noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @nk_glfw3_render(i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @nk_glfw3_init(ptr noundef, i32 noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @nk_glfw3_font_stash_begin(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @nk_glfw3_font_stash_end() #1

; Function Attrs: nounwind uwtable
declare dso_local void @nk_glfw3_new_frame() #3

declare void @glfwGetWindowSize(ptr noundef, ptr noundef, ptr noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local void @nk_glfw3_shutdown() #1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #3 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %struct.GLFWgammaramp, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca float, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %struct.nk_rect, align 4
  %17 = alloca %struct.nk_rect, align 4
  %18 = alloca ptr, align 8
  %19 = alloca %struct.nk_color, align 1
  %20 = alloca %struct.nk_color, align 1
  %21 = alloca %struct.nk_color, align 1
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  store ptr null, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store float 1.000000e+00, ptr %11, align 4, !tbaa !11
  %22 = call ptr @glfwSetErrorCallback(ptr noundef @error_callback)
  %23 = call i32 @glfwInit()
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %26, label %25

25:                                               ; preds = %2
  call void @exit(i32 noundef 1) #9
  unreachable

26:                                               ; preds = %2
  %27 = call ptr @glfwGetPrimaryMonitor()
  store ptr %27, ptr %6, align 8, !tbaa !9
  call void @glfwWindowHint(i32 noundef 139276, i32 noundef 1)
  call void @glfwWindowHint(i32 noundef 151553, i32 noundef 1)
  %28 = call ptr @glfwCreateWindow(i32 noundef 800, i32 noundef 400, ptr noundef @.str.140, ptr noundef null, ptr noundef null)
  store ptr %28, ptr %7, align 8, !tbaa !9
  %29 = load ptr, ptr %7, align 8, !tbaa !9
  %30 = icmp ne ptr %29, null
  br i1 %30, label %32, label %31

31:                                               ; preds = %26
  call void @glfwTerminate()
  call void @exit(i32 noundef 1) #9
  unreachable

32:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %33 = load ptr, ptr %6, align 8, !tbaa !9
  %34 = call ptr @glfwGetGammaRamp(ptr noundef %33)
  store ptr %34, ptr %12, align 8, !tbaa !9
  %35 = load ptr, ptr %12, align 8, !tbaa !9
  %36 = icmp ne ptr %35, null
  br i1 %36, label %38, label %37

37:                                               ; preds = %32
  call void @glfwTerminate()
  call void @exit(i32 noundef 1) #9
  unreachable

38:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %39 = load ptr, ptr %12, align 8, !tbaa !9
  %40 = getelementptr inbounds %struct.GLFWgammaramp, ptr %39, i32 0, i32 3
  %41 = load i32, ptr %40, align 8, !tbaa !13
  %42 = zext i32 %41 to i64
  %43 = mul i64 %42, 2
  store i64 %43, ptr %13, align 8, !tbaa !15
  %44 = load ptr, ptr %12, align 8, !tbaa !9
  %45 = getelementptr inbounds %struct.GLFWgammaramp, ptr %44, i32 0, i32 3
  %46 = load i32, ptr %45, align 8, !tbaa !13
  %47 = getelementptr inbounds %struct.GLFWgammaramp, ptr %8, i32 0, i32 3
  store i32 %46, ptr %47, align 8, !tbaa !13
  %48 = load i64, ptr %13, align 8, !tbaa !15
  %49 = call noalias ptr @malloc(i64 noundef %48) #10
  %50 = getelementptr inbounds %struct.GLFWgammaramp, ptr %8, i32 0, i32 0
  store ptr %49, ptr %50, align 8, !tbaa !17
  %51 = load i64, ptr %13, align 8, !tbaa !15
  %52 = call noalias ptr @malloc(i64 noundef %51) #10
  %53 = getelementptr inbounds %struct.GLFWgammaramp, ptr %8, i32 0, i32 1
  store ptr %52, ptr %53, align 8, !tbaa !18
  %54 = load i64, ptr %13, align 8, !tbaa !15
  %55 = call noalias ptr @malloc(i64 noundef %54) #10
  %56 = getelementptr inbounds %struct.GLFWgammaramp, ptr %8, i32 0, i32 2
  store ptr %55, ptr %56, align 8, !tbaa !19
  %57 = getelementptr inbounds %struct.GLFWgammaramp, ptr %8, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !17
  %59 = load ptr, ptr %12, align 8, !tbaa !9
  %60 = getelementptr inbounds %struct.GLFWgammaramp, ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !17
  %62 = load i64, ptr %13, align 8, !tbaa !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %58, ptr align 2 %61, i64 %62, i1 false)
  %63 = getelementptr inbounds %struct.GLFWgammaramp, ptr %8, i32 0, i32 1
  %64 = load ptr, ptr %63, align 8, !tbaa !18
  %65 = load ptr, ptr %12, align 8, !tbaa !9
  %66 = getelementptr inbounds %struct.GLFWgammaramp, ptr %65, i32 0, i32 1
  %67 = load ptr, ptr %66, align 8, !tbaa !18
  %68 = load i64, ptr %13, align 8, !tbaa !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %64, ptr align 2 %67, i64 %68, i1 false)
  %69 = getelementptr inbounds %struct.GLFWgammaramp, ptr %8, i32 0, i32 2
  %70 = load ptr, ptr %69, align 8, !tbaa !19
  %71 = load ptr, ptr %12, align 8, !tbaa !9
  %72 = getelementptr inbounds %struct.GLFWgammaramp, ptr %71, i32 0, i32 2
  %73 = load ptr, ptr %72, align 8, !tbaa !19
  %74 = load i64, ptr %13, align 8, !tbaa !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %70, ptr align 2 %73, i64 %74, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  %75 = load ptr, ptr %7, align 8, !tbaa !9
  call void @glfwMakeContextCurrent(ptr noundef %75)
  %76 = call i32 @gladLoadGL(ptr noundef @glfwGetProcAddress)
  call void @glfwSwapInterval(i32 noundef 1)
  %77 = load ptr, ptr %7, align 8, !tbaa !9
  %78 = call ptr @nk_glfw3_init(ptr noundef %77, i32 noundef 1)
  store ptr %78, ptr %9, align 8, !tbaa !9
  call void @nk_glfw3_font_stash_begin(ptr noundef %10)
  call void @nk_glfw3_font_stash_end()
  %79 = load ptr, ptr %7, align 8, !tbaa !9
  %80 = call ptr @glfwSetKeyCallback(ptr noundef %79, ptr noundef @key_callback)
  br label %81

81:                                               ; preds = %161, %38
  %82 = load ptr, ptr %7, align 8, !tbaa !9
  %83 = call i32 @glfwWindowShouldClose(ptr noundef %82)
  %84 = icmp ne i32 %83, 0
  %85 = xor i1 %84, true
  br i1 %85, label %86, label %164

86:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #8
  %87 = load ptr, ptr %7, align 8, !tbaa !9
  call void @glfwGetWindowSize(ptr noundef %87, ptr noundef %14, ptr noundef %15)
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #8
  %88 = load i32, ptr %14, align 4, !tbaa !5
  %89 = sitofp i32 %88 to float
  %90 = load i32, ptr %15, align 4, !tbaa !5
  %91 = sitofp i32 %90 to float
  %92 = call { <2 x float>, <2 x float> } @nk_rect(float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef %89, float noundef %91)
  %93 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %17, i32 0, i32 0
  %94 = extractvalue { <2 x float>, <2 x float> } %92, 0
  store <2 x float> %94, ptr %93, align 4
  %95 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %17, i32 0, i32 1
  %96 = extractvalue { <2 x float>, <2 x float> } %92, 1
  store <2 x float> %96, ptr %95, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 4 %17, i64 16, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #8
  %97 = load ptr, ptr %9, align 8, !tbaa !9
  %98 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %16, i32 0, i32 0
  %99 = load <2 x float>, ptr %98, align 4
  %100 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %16, i32 0, i32 1
  %101 = load <2 x float>, ptr %100, align 4
  call void @nk_window_set_bounds(ptr noundef %97, ptr noundef @.str.141, <2 x float> %99, <2 x float> %101)
  %102 = load ptr, ptr @glad_glClear, align 8, !tbaa !9
  call void %102(i32 noundef 16384)
  call void @nk_glfw3_new_frame()
  %103 = load ptr, ptr %9, align 8, !tbaa !9
  %104 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %16, i32 0, i32 0
  %105 = load <2 x float>, ptr %104, align 4
  %106 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %16, i32 0, i32 1
  %107 = load <2 x float>, ptr %106, align 4
  %108 = call i32 @nk_begin(ptr noundef %103, ptr noundef @.str.141, <2 x float> %105, <2 x float> %107, i32 noundef 0)
  %109 = icmp ne i32 %108, 0
  br i1 %109, label %110, label %161

110:                                              ; preds = %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %111 = load ptr, ptr %9, align 8, !tbaa !9
  call void @nk_layout_row_dynamic(ptr noundef %111, float noundef 3.000000e+01, i32 noundef 3)
  %112 = load ptr, ptr %9, align 8, !tbaa !9
  %113 = call i32 @nk_slider_float(ptr noundef %112, float noundef 0x3FB99999A0000000, ptr noundef %11, float noundef 5.000000e+00, float noundef 0x3FB99999A0000000)
  %114 = icmp ne i32 %113, 0
  br i1 %114, label %115, label %118

115:                                              ; preds = %110
  %116 = load ptr, ptr %6, align 8, !tbaa !9
  %117 = load float, ptr %11, align 4, !tbaa !11
  call void @glfwSetGamma(ptr noundef %116, float noundef %117)
  br label %118

118:                                              ; preds = %115, %110
  %119 = load ptr, ptr %9, align 8, !tbaa !9
  %120 = load float, ptr %11, align 4, !tbaa !11
  %121 = fpext float %120 to double
  call void (ptr, i32, ptr, ...) @nk_labelf(ptr noundef %119, i32 noundef 17, ptr noundef @.str.142, double noundef %121)
  %122 = load ptr, ptr %9, align 8, !tbaa !9
  %123 = call i32 @nk_button_label(ptr noundef %122, ptr noundef @.str.143)
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %125, label %127

125:                                              ; preds = %118
  %126 = load ptr, ptr %6, align 8, !tbaa !9
  call void @glfwSetGammaRamp(ptr noundef %126, ptr noundef %8)
  br label %127

127:                                              ; preds = %125, %118
  %128 = load ptr, ptr %6, align 8, !tbaa !9
  %129 = call ptr @glfwGetGammaRamp(ptr noundef %128)
  store ptr %129, ptr %18, align 8, !tbaa !9
  %130 = load ptr, ptr %9, align 8, !tbaa !9
  %131 = load i32, ptr %15, align 4, !tbaa !5
  %132 = sitofp i32 %131 to float
  %133 = fsub float %132, 6.000000e+01
  call void @nk_layout_row_dynamic(ptr noundef %130, float noundef %133, i32 noundef 3)
  %134 = load ptr, ptr %9, align 8, !tbaa !9
  %135 = call i32 @nk_rgb(i32 noundef 255, i32 noundef 0, i32 noundef 0)
  store i32 %135, ptr %19, align 1
  %136 = load ptr, ptr %18, align 8, !tbaa !9
  %137 = getelementptr inbounds %struct.GLFWgammaramp, ptr %136, i32 0, i32 3
  %138 = load i32, ptr %137, align 8, !tbaa !13
  %139 = load ptr, ptr %18, align 8, !tbaa !9
  %140 = getelementptr inbounds %struct.GLFWgammaramp, ptr %139, i32 0, i32 0
  %141 = load ptr, ptr %140, align 8, !tbaa !17
  %142 = load i32, ptr %19, align 1
  call void @chart_ramp_array(ptr noundef %134, i32 %142, i32 noundef %138, ptr noundef %141)
  %143 = load ptr, ptr %9, align 8, !tbaa !9
  %144 = call i32 @nk_rgb(i32 noundef 0, i32 noundef 255, i32 noundef 0)
  store i32 %144, ptr %20, align 1
  %145 = load ptr, ptr %18, align 8, !tbaa !9
  %146 = getelementptr inbounds %struct.GLFWgammaramp, ptr %145, i32 0, i32 3
  %147 = load i32, ptr %146, align 8, !tbaa !13
  %148 = load ptr, ptr %18, align 8, !tbaa !9
  %149 = getelementptr inbounds %struct.GLFWgammaramp, ptr %148, i32 0, i32 1
  %150 = load ptr, ptr %149, align 8, !tbaa !18
  %151 = load i32, ptr %20, align 1
  call void @chart_ramp_array(ptr noundef %143, i32 %151, i32 noundef %147, ptr noundef %150)
  %152 = load ptr, ptr %9, align 8, !tbaa !9
  %153 = call i32 @nk_rgb(i32 noundef 0, i32 noundef 0, i32 noundef 255)
  store i32 %153, ptr %21, align 1
  %154 = load ptr, ptr %18, align 8, !tbaa !9
  %155 = getelementptr inbounds %struct.GLFWgammaramp, ptr %154, i32 0, i32 3
  %156 = load i32, ptr %155, align 8, !tbaa !13
  %157 = load ptr, ptr %18, align 8, !tbaa !9
  %158 = getelementptr inbounds %struct.GLFWgammaramp, ptr %157, i32 0, i32 2
  %159 = load ptr, ptr %158, align 8, !tbaa !19
  %160 = load i32, ptr %21, align 1
  call void @chart_ramp_array(ptr noundef %152, i32 %160, i32 noundef %156, ptr noundef %159)
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  br label %161

161:                                              ; preds = %127, %86
  %162 = load ptr, ptr %9, align 8, !tbaa !9
  call void @nk_end(ptr noundef %162)
  call void @nk_glfw3_render(i32 noundef 1)
  %163 = load ptr, ptr %7, align 8, !tbaa !9
  call void @glfwSwapBuffers(ptr noundef %163)
  call void @glfwWaitEventsTimeout(double noundef 1.000000e+00)
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %81, !llvm.loop !21

164:                                              ; preds = %81
  %165 = getelementptr inbounds %struct.GLFWgammaramp, ptr %8, i32 0, i32 0
  %166 = load ptr, ptr %165, align 8, !tbaa !17
  call void @free(ptr noundef %166) #8
  %167 = getelementptr inbounds %struct.GLFWgammaramp, ptr %8, i32 0, i32 1
  %168 = load ptr, ptr %167, align 8, !tbaa !18
  call void @free(ptr noundef %168) #8
  %169 = getelementptr inbounds %struct.GLFWgammaramp, ptr %8, i32 0, i32 2
  %170 = load ptr, ptr %169, align 8, !tbaa !19
  call void @free(ptr noundef %170) #8
  call void @nk_glfw3_shutdown()
  call void @glfwTerminate()
  call void @exit(i32 noundef 0) #9
  unreachable
}

declare ptr @glfwSetErrorCallback(ptr noundef) #4

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

declare i32 @glfwInit() #4

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #5

declare ptr @glfwGetPrimaryMonitor() #4

declare void @glfwWindowHint(i32 noundef, i32 noundef) #4

declare ptr @glfwCreateWindow(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #4

declare void @glfwTerminate() #4

declare ptr @glfwGetGammaRamp(ptr noundef) #4

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #6

declare void @glfwMakeContextCurrent(ptr noundef) #4

declare ptr @glfwGetProcAddress(ptr noundef) #4

declare void @glfwSwapInterval(i32 noundef) #4

declare ptr @glfwSetKeyCallback(ptr noundef, ptr noundef) #4

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

declare i32 @glfwWindowShouldClose(ptr noundef) #4

declare void @glfwSetGamma(ptr noundef, float noundef) #4

declare void @glfwSetGammaRamp(ptr noundef, ptr noundef) #4

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

declare void @glfwSwapBuffers(ptr noundef) #4

declare void @glfwWaitEventsTimeout(double noundef) #4

; Function Attrs: nounwind
declare void @free(ptr noundef) #7

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="64" "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 = { "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 #5 = { 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 #6 = { nounwind allocsize(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 #7 = { 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 #8 = { nounwind }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind allocsize(0) }

!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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !6, i64 24}
!14 = !{!"GLFWgammaramp", !10, i64 0, !10, i64 8, !10, i64 16, !6, i64 24}
!15 = !{!16, !16, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!14, !10, i64 0}
!18 = !{!14, !10, i64 8}
!19 = !{!14, !10, i64 16}
!20 = !{i64 0, i64 4, !11, i64 4, i64 4, !11, i64 8, i64 4, !11, i64 12, i64 4, !11}
!21 = distinct !{!21, !22}
!22 = !{!"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.GLFWgammaramp = type { ptr, ptr, ptr, i32 }

@glad_glClear = external dso_local local_unnamed_addr global ptr, align 8
@.str.140 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.141 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.142 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.143 = external hidden unnamed_addr constant [7 x i8], align 1

; 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 dso_local i32 @gladLoadGL(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare dso_local { <2 x float>, <2 x float> } @nk_rect(float noundef, float noundef, float noundef, float noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @nk_rgb(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @nk_begin(ptr noundef, ptr noundef, <2 x float>, <2 x float>, i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local void @nk_end(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @nk_window_set_bounds(ptr noundef, ptr noundef, <2 x float>, <2 x float>) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local void @nk_layout_row_dynamic(ptr noundef, float noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @nk_labelf(ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @nk_button_label(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @nk_slider_float(ptr noundef, float noundef, ptr noundef, float noundef, float noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local void @nk_glfw3_render(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @nk_glfw3_init(ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local void @nk_glfw3_font_stash_begin(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @nk_glfw3_font_stash_end() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @nk_glfw3_new_frame() local_unnamed_addr #3

declare void @glfwGetWindowSize(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare dso_local void @nk_glfw3_shutdown() local_unnamed_addr #1

; Function Attrs: noreturn nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #5 {
  %3 = alloca %struct.GLFWgammaramp, align 8
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #9
  store float 1.000000e+00, ptr %5, align 4, !tbaa !5
  %8 = tail call ptr @glfwSetErrorCallback(ptr noundef nonnull @error_callback) #9
  %9 = tail call i32 @glfwInit() #9
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %10, label %11

10:                                               ; preds = %2
  tail call void @exit(i32 noundef 1) #10
  unreachable

11:                                               ; preds = %2
  %12 = tail call ptr @glfwGetPrimaryMonitor() #9
  tail call void @glfwWindowHint(i32 noundef 139276, i32 noundef 1) #9
  tail call void @glfwWindowHint(i32 noundef 151553, i32 noundef 1) #9
  %13 = tail call ptr @glfwCreateWindow(i32 noundef 800, i32 noundef 400, ptr noundef nonnull @.str.140, ptr noundef null, ptr noundef null) #9
  %.not46 = icmp eq ptr %13, null
  br i1 %.not46, label %14, label %15

14:                                               ; preds = %11
  tail call void @glfwTerminate() #9
  tail call void @exit(i32 noundef 1) #10
  unreachable

15:                                               ; preds = %11
  %16 = tail call ptr @glfwGetGammaRamp(ptr noundef %12) #9
  %.not47 = icmp eq ptr %16, null
  br i1 %.not47, label %17, label %18

17:                                               ; preds = %15
  tail call void @glfwTerminate() #9
  tail call void @exit(i32 noundef 1) #10
  unreachable

18:                                               ; preds = %15
  %19 = getelementptr inbounds i8, ptr %16, i64 24
  %20 = load i32, ptr %19, align 8, !tbaa !9
  %21 = zext i32 %20 to i64
  %22 = shl nuw nsw i64 %21, 1
  %23 = getelementptr inbounds i8, ptr %3, i64 24
  store i32 %20, ptr %23, align 8, !tbaa !9
  %24 = tail call noalias ptr @malloc(i64 noundef %22) #11
  store ptr %24, ptr %3, align 8, !tbaa !13
  %25 = tail call noalias ptr @malloc(i64 noundef %22) #11
  %26 = getelementptr inbounds i8, ptr %3, i64 8
  store ptr %25, ptr %26, align 8, !tbaa !14
  %27 = tail call noalias ptr @malloc(i64 noundef %22) #11
  %28 = getelementptr inbounds i8, ptr %3, i64 16
  store ptr %27, ptr %28, align 8, !tbaa !15
  %29 = load ptr, ptr %16, align 8, !tbaa !13
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 2 %24, ptr align 2 %29, i64 %22, i1 false)
  %30 = getelementptr inbounds i8, ptr %16, i64 8
  %31 = load ptr, ptr %30, align 8, !tbaa !14
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 2 %25, ptr align 2 %31, i64 %22, i1 false)
  %32 = getelementptr inbounds i8, ptr %16, i64 16
  %33 = load ptr, ptr %32, align 8, !tbaa !15
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 2 %27, ptr align 2 %33, i64 %22, i1 false)
  tail call void @glfwMakeContextCurrent(ptr noundef nonnull %13) #9
  %34 = tail call i32 @gladLoadGL(ptr noundef nonnull @glfwGetProcAddress)
  tail call void @glfwSwapInterval(i32 noundef 1) #9
  %35 = tail call ptr @nk_glfw3_init(ptr noundef nonnull %13, i32 noundef 1)
  call void @nk_glfw3_font_stash_begin(ptr noundef nonnull %4)
  call void @nk_glfw3_font_stash_end()
  %36 = call ptr @glfwSetKeyCallback(ptr noundef nonnull %13, ptr noundef nonnull @key_callback) #9
  %37 = call i32 @glfwWindowShouldClose(ptr noundef nonnull %13) #9
  %.not4852 = icmp eq i32 %37, 0
  br i1 %.not4852, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %18, %73
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #9
  call void @glfwGetWindowSize(ptr noundef nonnull %13, ptr noundef nonnull %6, ptr noundef nonnull %7) #9
  %38 = load i32, ptr %6, align 4, !tbaa !16
  %39 = sitofp i32 %38 to float
  %40 = load i32, ptr %7, align 4, !tbaa !16
  %41 = sitofp i32 %40 to float
  %42 = call { <2 x float>, <2 x float> } @nk_rect(float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef %39, float noundef %41)
  %43 = extractvalue { <2 x float>, <2 x float> } %42, 0
  %44 = extractvalue { <2 x float>, <2 x float> } %42, 1
  call void @nk_window_set_bounds(ptr noundef %35, ptr noundef nonnull @.str.141, <2 x float> %43, <2 x float> %44)
  %45 = load ptr, ptr @glad_glClear, align 8, !tbaa !17
  call void %45(i32 noundef 16384) #9
  call void @nk_glfw3_new_frame()
  %46 = call i32 @nk_begin(ptr noundef %35, ptr noundef nonnull @.str.141, <2 x float> %43, <2 x float> %44, i32 noundef 0)
  %.not49 = icmp eq i32 %46, 0
  br i1 %.not49, label %73, label %47

47:                                               ; preds = %.lr.ph
  call void @nk_layout_row_dynamic(ptr noundef %35, float noundef 3.000000e+01, i32 noundef 3)
  %48 = call i32 @nk_slider_float(ptr noundef %35, float noundef 0x3FB99999A0000000, ptr noundef nonnull %5, float noundef 5.000000e+00, float noundef 0x3FB99999A0000000)
  %.not50 = icmp eq i32 %48, 0
  br i1 %.not50, label %51, label %49

49:                                               ; preds = %47
  %50 = load float, ptr %5, align 4, !tbaa !5
  call void @glfwSetGamma(ptr noundef %12, float noundef %50) #9
  br label %51

51:                                               ; preds = %49, %47
  %52 = load float, ptr %5, align 4, !tbaa !5
  %53 = fpext float %52 to double
  call void (ptr, i32, ptr, ...) @nk_labelf(ptr noundef %35, i32 noundef 17, ptr noundef nonnull @.str.142, double noundef %53)
  %54 = call i32 @nk_button_label(ptr noundef %35, ptr noundef nonnull @.str.143)
  %.not51 = icmp eq i32 %54, 0
  br i1 %.not51, label %56, label %55

55:                                               ; preds = %51
  call void @glfwSetGammaRamp(ptr noundef %12, ptr noundef nonnull %3) #9
  br label %56

56:                                               ; preds = %55, %51
  %57 = call ptr @glfwGetGammaRamp(ptr noundef %12) #9
  %58 = load i32, ptr %7, align 4, !tbaa !16
  %59 = sitofp i32 %58 to float
  %60 = fadd float %59, -6.000000e+01
  call void @nk_layout_row_dynamic(ptr noundef %35, float noundef %60, i32 noundef 3)
  %61 = call i32 @nk_rgb(i32 noundef 255, i32 noundef 0, i32 noundef 0)
  %62 = getelementptr inbounds i8, ptr %57, i64 24
  %63 = load i32, ptr %62, align 8, !tbaa !9
  %64 = load ptr, ptr %57, align 8, !tbaa !13
  call void @chart_ramp_array(ptr noundef %35, i32 %61, i32 noundef %63, ptr noundef %64)
  %65 = call i32 @nk_rgb(i32 noundef 0, i32 noundef 255, i32 noundef 0)
  %66 = load i32, ptr %62, align 8, !tbaa !9
  %67 = getelementptr inbounds i8, ptr %57, i64 8
  %68 = load ptr, ptr %67, align 8, !tbaa !14
  call void @chart_ramp_array(ptr noundef %35, i32 %65, i32 noundef %66, ptr noundef %68)
  %69 = call i32 @nk_rgb(i32 noundef 0, i32 noundef 0, i32 noundef 255)
  %70 = load i32, ptr %62, align 8, !tbaa !9
  %71 = getelementptr inbounds i8, ptr %57, i64 16
  %72 = load ptr, ptr %71, align 8, !tbaa !15
  call void @chart_ramp_array(ptr noundef %35, i32 %69, i32 noundef %70, ptr noundef %72)
  br label %73

73:                                               ; preds = %56, %.lr.ph
  call void @nk_end(ptr noundef %35)
  call void @nk_glfw3_render(i32 noundef 1)
  call void @glfwSwapBuffers(ptr noundef nonnull %13) #9
  call void @glfwWaitEventsTimeout(double noundef 1.000000e+00) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #9
  %74 = call i32 @glfwWindowShouldClose(ptr noundef nonnull %13) #9
  %.not48 = icmp eq i32 %74, 0
  br i1 %.not48, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !18

._crit_edge.loopexit:                             ; preds = %73
  %.pre = load ptr, ptr %3, align 8, !tbaa !13
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %18
  %75 = phi ptr [ %.pre, %._crit_edge.loopexit ], [ %24, %18 ]
  call void @free(ptr noundef %75) #9
  %76 = load ptr, ptr %26, align 8, !tbaa !14
  call void @free(ptr noundef %76) #9
  %77 = load ptr, ptr %28, align 8, !tbaa !15
  call void @free(ptr noundef %77) #9
  call void @nk_glfw3_shutdown()
  call void @glfwTerminate() #9
  call void @exit(i32 noundef 0) #10
  unreachable
}

declare ptr @glfwSetErrorCallback(ptr noundef) local_unnamed_addr #4

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

declare i32 @glfwInit() local_unnamed_addr #4

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #6

declare ptr @glfwGetPrimaryMonitor() local_unnamed_addr #4

declare void @glfwWindowHint(i32 noundef, i32 noundef) local_unnamed_addr #4

declare ptr @glfwCreateWindow(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @glfwTerminate() local_unnamed_addr #4

declare ptr @glfwGetGammaRamp(ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #7

declare void @glfwMakeContextCurrent(ptr noundef) local_unnamed_addr #4

declare ptr @glfwGetProcAddress(ptr noundef) #4

declare void @glfwSwapInterval(i32 noundef) local_unnamed_addr #4

declare ptr @glfwSetKeyCallback(ptr noundef, ptr noundef) local_unnamed_addr #4

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

declare i32 @glfwWindowShouldClose(ptr noundef) local_unnamed_addr #4

declare void @glfwSetGamma(ptr noundef, float noundef) local_unnamed_addr #4

declare void @glfwSetGammaRamp(ptr noundef, ptr noundef) local_unnamed_addr #4

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

declare void @glfwSwapBuffers(ptr noundef) local_unnamed_addr #4

declare void @glfwWaitEventsTimeout(double noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #8

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="64" "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 = { "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 #5 = { noreturn nounwind uwtable "min-legal-vector-width"="64" "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 #6 = { 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 #7 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #8 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #9 = { nounwind }
attributes #10 = { noreturn nounwind }
attributes #11 = { nounwind allocsize(0) }

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !12, i64 24}
!10 = !{!"GLFWgammaramp", !11, i64 0, !11, i64 8, !11, i64 16, !12, i64 24}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !11, i64 0}
!14 = !{!10, !11, i64 8}
!15 = !{!10, !11, i64 16}
!16 = !{!12, !12, i64 0}
!17 = !{!11, !11, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass