; ModuleID = 'github.com/goplus/llgo/compiler/cl/_testrt/cast'
source_filename = "github.com/goplus/llgo/compiler/cl/_testrt/cast"

%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
%"github.com/goplus/llgo/runtime/internal/runtime.eface" = type { ptr, ptr }

@"github.com/goplus/llgo/compiler/cl/_testrt/cast.init$guard" = global i1 false, align 1
@0 = private unnamed_addr constant [5 x i8] c"error", align 1
@_llgo_string = linkonce global ptr null, align 8

define void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto32"(float %0, i32 %1) {
_llgo_0:
  %2 = fptosi float %0 to i32
  %3 = icmp ne i32 %2, %1
  br i1 %3, label %_llgo_1, label %_llgo_2

_llgo_1:                                          ; preds = %_llgo_0
  %4 = load ptr, ptr @_llgo_string, align 8
  %5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
  store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 }, ptr %5, align 8
  %6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %4, 0
  %7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %6, ptr %5, 1
  call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %7)
  unreachable

_llgo_2:                                          ; preds = %_llgo_0
  ret void
}

define void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto32U"(float %0, i32 %1) {
_llgo_0:
  %2 = fptoui float %0 to i32
  %3 = icmp ne i32 %2, %1
  br i1 %3, label %_llgo_1, label %_llgo_2

_llgo_1:                                          ; preds = %_llgo_0
  %4 = load ptr, ptr @_llgo_string, align 8
  %5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
  store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 }, ptr %5, align 8
  %6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %4, 0
  %7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %6, ptr %5, 1
  call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %7)
  unreachable

_llgo_2:                                          ; preds = %_llgo_0
  ret void
}

define void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto64F"(float %0, double %1) {
_llgo_0:
  %2 = fpext float %0 to double
  %3 = fcmp une double %2, %1
  br i1 %3, label %_llgo_1, label %_llgo_2

_llgo_1:                                          ; preds = %_llgo_0
  %4 = load ptr, ptr @_llgo_string, align 8
  %5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
  store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 }, ptr %5, align 8
  %6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %4, 0
  %7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %6, ptr %5, 1
  call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %7)
  unreachable

_llgo_2:                                          ; preds = %_llgo_0
  ret void
}

define void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto8"(float %0, i8 %1) {
_llgo_0:
  %2 = fptosi float %0 to i8
  %3 = icmp ne i8 %2, %1
  br i1 %3, label %_llgo_1, label %_llgo_2

_llgo_1:                                          ; preds = %_llgo_0
  %4 = load ptr, ptr @_llgo_string, align 8
  %5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
  store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 }, ptr %5, align 8
  %6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %4, 0
  %7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %6, ptr %5, 1
  call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %7)
  unreachable

_llgo_2:                                          ; preds = %_llgo_0
  ret void
}

define void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto8U"(float %0, i8 %1) {
_llgo_0:
  %2 = fptoui float %0 to i8
  %3 = icmp ne i8 %2, %1
  br i1 %3, label %_llgo_1, label %_llgo_2

_llgo_1:                                          ; preds = %_llgo_0
  %4 = load ptr, ptr @_llgo_string, align 8
  %5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
  store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 }, ptr %5, align 8
  %6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %4, 0
  %7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %6, ptr %5, 1
  call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %7)
  unreachable

_llgo_2:                                          ; preds = %_llgo_0
  ret void
}

define void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32to64"(i32 %0, i64 %1) {
_llgo_0:
  %2 = sext i32 %0 to i64
  %3 = icmp ne i64 %2, %1
  br i1 %3, label %_llgo_1, label %_llgo_2

_llgo_1:                                          ; preds = %_llgo_0
  %4 = load ptr, ptr @_llgo_string, align 8
  %5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
  store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 }, ptr %5, align 8
  %6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %4, 0
  %7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %6, ptr %5, 1
  call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %7)
  unreachable

_llgo_2:                                          ; preds = %_llgo_0
  ret void
}

define void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64Fto32F"(double %0, float %1) {
_llgo_0:
  %2 = fptrunc double %0 to float
  %3 = fcmp une float %2, %1
  br i1 %3, label %_llgo_1, label %_llgo_2

_llgo_1:                                          ; preds = %_llgo_0
  %4 = load ptr, ptr @_llgo_string, align 8
  %5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
  store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 }, ptr %5, align 8
  %6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %4, 0
  %7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %6, ptr %5, 1
  call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %7)
  unreachable

_llgo_2:                                          ; preds = %_llgo_0
  ret void
}

define void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64Uto64F"(i64 %0, double %1) {
_llgo_0:
  %2 = uitofp i64 %0 to double
  %3 = fcmp une double %2, %1
  br i1 %3, label %_llgo_1, label %_llgo_2

_llgo_1:                                          ; preds = %_llgo_0
  %4 = load ptr, ptr @_llgo_string, align 8
  %5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
  store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 }, ptr %5, align 8
  %6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %4, 0
  %7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %6, ptr %5, 1
  call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %7)
  unreachable

_llgo_2:                                          ; preds = %_llgo_0
  ret void
}

define void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64to64F"(i64 %0, double %1) {
_llgo_0:
  %2 = sitofp i64 %0 to double
  %3 = fcmp une double %2, %1
  br i1 %3, label %_llgo_1, label %_llgo_2

_llgo_1:                                          ; preds = %_llgo_0
  %4 = load ptr, ptr @_llgo_string, align 8
  %5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
  store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 }, ptr %5, align 8
  %6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %4, 0
  %7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %6, ptr %5, 1
  call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %7)
  unreachable

_llgo_2:                                          ; preds = %_llgo_0
  ret void
}

define void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64to8"(i64 %0, i8 %1) {
_llgo_0:
  %2 = trunc i64 %0 to i8
  %3 = icmp ne i8 %2, %1
  br i1 %3, label %_llgo_1, label %_llgo_2

_llgo_1:                                          ; preds = %_llgo_0
  %4 = load ptr, ptr @_llgo_string, align 8
  %5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
  store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 }, ptr %5, align 8
  %6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %4, 0
  %7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %6, ptr %5, 1
  call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %7)
  unreachable

_llgo_2:                                          ; preds = %_llgo_0
  ret void
}

define void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64to8U"(i64 %0, i8 %1) {
_llgo_0:
  %2 = trunc i64 %0 to i8
  %3 = icmp ne i8 %2, %1
  br i1 %3, label %_llgo_1, label %_llgo_2

_llgo_1:                                          ; preds = %_llgo_0
  %4 = load ptr, ptr @_llgo_string, align 8
  %5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
  store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 }, ptr %5, align 8
  %6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %4, 0
  %7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %6, ptr %5, 1
  call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %7)
  unreachable

_llgo_2:                                          ; preds = %_llgo_0
  ret void
}

define void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvtUinptr"(i32 %0, i64 %1) {
_llgo_0:
  %2 = zext i32 %0 to i64
  %3 = icmp ne i64 %2, %1
  br i1 %3, label %_llgo_1, label %_llgo_2

_llgo_1:                                          ; preds = %_llgo_0
  %4 = load ptr, ptr @_llgo_string, align 8
  %5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
  store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 }, ptr %5, align 8
  %6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %4, 0
  %7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %6, ptr %5, 1
  call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %7)
  unreachable

_llgo_2:                                          ; preds = %_llgo_0
  %8 = trunc i64 %1 to i32
  %9 = icmp ne i32 %8, %0
  br i1 %9, label %_llgo_3, label %_llgo_4

_llgo_3:                                          ; preds = %_llgo_2
  %10 = load ptr, ptr @_llgo_string, align 8
  %11 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
  store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 }, ptr %11, align 8
  %12 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %10, 0
  %13 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %12, ptr %11, 1
  call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %13)
  unreachable

_llgo_4:                                          ; preds = %_llgo_2
  ret void
}

define void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.init"() {
_llgo_0:
  %0 = load i1, ptr @"github.com/goplus/llgo/compiler/cl/_testrt/cast.init$guard", align 1
  br i1 %0, label %_llgo_2, label %_llgo_1

_llgo_1:                                          ; preds = %_llgo_0
  store i1 true, ptr @"github.com/goplus/llgo/compiler/cl/_testrt/cast.init$guard", align 1
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.init$after"()
  br label %_llgo_2

_llgo_2:                                          ; preds = %_llgo_1, %_llgo_0
  ret void
}

define void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.main"() {
_llgo_0:
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64to8"(i64 0, i8 0)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64to8"(i64 127, i8 127)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64to8"(i64 128, i8 -128)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64to8"(i64 -128, i8 -128)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64to8"(i64 -129, i8 127)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64to8"(i64 256, i8 0)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64to8U"(i64 0, i8 0)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64to8U"(i64 255, i8 -1)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64to8U"(i64 256, i8 0)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64to8U"(i64 257, i8 1)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64to8U"(i64 -1, i8 -1)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto8"(float 0x3FB99999A0000000, i8 0)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto8"(float 0x405FC66660000000, i8 127)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto8"(float 0x4060033340000000, i8 -128)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto8"(float 0xC060033340000000, i8 -128)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto8"(float 0xC060233340000000, i8 127)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto8"(float 0x40700199A0000000, i8 0)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto8U"(float 0.000000e+00, i8 0)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto8U"(float 2.550000e+02, i8 -1)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto8U"(float 2.560000e+02, i8 0)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto8U"(float 2.570000e+02, i8 1)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto8U"(float -1.000000e+00, i8 -1)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto32"(float 0.000000e+00, i32 0)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto32"(float 1.500000e+00, i32 1)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto32"(float 0x41D1194D80000000, i32 1147483648)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto32"(float 0xC1E0000000000000, i32 -2147483648)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto32U"(float 0.000000e+00, i32 0)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto32U"(float 1.500000e+00, i32 1)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto32U"(float 0x41F0000000000000, i32 0)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto32U"(float 0x41F3B9ACA0000000, i32 1000000000)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto32U"(float 0xC1F0000000000000, i32 0)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto32U"(float 0xC1D34BE880000000, i32 -1294967296)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto32U"(float 0xBFF19999A0000000, i32 -1)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto64F"(float 0.000000e+00, double 0.000000e+00)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto64F"(float 1.500000e+00, double 1.500000e+00)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto64F"(float 1.000000e+10, double 1.000000e+10)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32Fto64F"(float -1.000000e+10, double -1.000000e+10)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64Fto32F"(double 0.000000e+00, float 0.000000e+00)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64Fto32F"(double 1.500000e+00, float 1.500000e+00)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64Fto32F"(double 1.000000e+10, float 1.000000e+10)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64Fto32F"(double -1.000000e+10, float -1.000000e+10)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64to64F"(i64 0, double 0.000000e+00)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64to64F"(i64 10000000000, double 1.000000e+10)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64to64F"(i64 9223372036854775807, double 0x43E0000000000000)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64to64F"(i64 -9223372036854775807, double 0xC3E0000000000000)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64Uto64F"(i64 0, double 0.000000e+00)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64Uto64F"(i64 10000000000, double 1.000000e+10)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64Uto64F"(i64 9223372036854775807, double 0x43E0000000000000)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt64Uto64F"(i64 -1, double 0x43F0000000000000)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32to64"(i32 0, i64 0)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvt32to64"(i32 2147483647, i64 2147483647)
  call void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.cvtUinptr"(i32 1024, i64 1024)
  ret void
}

define void @"github.com/goplus/llgo/compiler/cl/_testrt/cast.init$after"() {
_llgo_0:
  %0 = load ptr, ptr @_llgo_string, align 8
  %1 = icmp eq ptr %0, null
  br i1 %1, label %_llgo_1, label %_llgo_2

_llgo_1:                                          ; preds = %_llgo_0
  %2 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 24)
  store ptr %2, ptr @_llgo_string, align 8
  br label %_llgo_2

_llgo_2:                                          ; preds = %_llgo_1, %_llgo_0
  ret void
}

declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64)

declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64)

declare void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface")
