Skip to content

Instantly share code, notes, and snippets.

@FreeMasen
Created October 1, 2023 00:57
Show Gist options
  • Save FreeMasen/16c7856c776f3cdd99c524188e341dbd to your computer and use it in GitHub Desktop.
Save FreeMasen/16c7856c776f3cdd99c524188e341dbd to your computer and use it in GitHub Desktop.
early example
; ModuleID = 'early_example'
source_filename = "early_example"
%"std::tvalue::TValue" = type { i8, [23 x i8] }
%"std::tvalue::TValue::Bool" = type { [23 x i8], i8 }
%"std::tvalue::TValue::Number" = type { [12 x i8], float }
%"std::tvalue::TValue::String" = type { i8, i32, i32, i32, ptr }
@"tvalue::names::nil" = global [5 x i8] c"nil\0A\00"
@"tvalue::names::true" = global [6 x i8] c"true\0A\00"
@"tvalue::names::false" = global [7 x i8] c"false\0A\00"
@"tvalue::names::float_fmt" = global [4 x i8] c"%f\0A\00"
define void @"std::tvalue::new_nil"(ptr %0) {
entry:
%tag_ptr = getelementptr inbounds %"std::tvalue::TValue", ptr %0, i32 0, i32 0
store i8 0, ptr %tag_ptr, align 1
%data_ptr = getelementptr inbounds %"std::tvalue::TValue", ptr %0, i32 0, i32 1
store [15 x i8] zeroinitializer, ptr %data_ptr, align 1
ret void
}
define void @"std::tvalue::new_bool"(ptr %0, i1 %1) {
entry:
%tag_ptr = getelementptr inbounds %"std::tvalue::TValue", ptr %0, i32 0, i32 0
store i8 1, ptr %tag_ptr, align 1
%data_ptr = getelementptr inbounds %"std::tvalue::TValue::Bool", ptr %0, i32 0, i32 1
store i1 %1, ptr %data_ptr, align 1
ret void
}
define void @"std::tvalue::new_num"(ptr %0, float %1) {
entry:
%tag_ptr = getelementptr inbounds %"std::tvalue::TValue", ptr %0, i32 0, i32 0
store i8 2, ptr %tag_ptr, align 1
%data_ptr = getelementptr inbounds %"std::tvalue::TValue::Number", ptr %0, i32 0, i32 1
store float %1, ptr %data_ptr, align 4
ret void
}
define void @"std::tvalue::new_str"(ptr %0, i32 %1) {
entry:
%tag_ptr = getelementptr inbounds %"std::tvalue::TValue", ptr %0, i32 0, i32 0
store i8 3, ptr %tag_ptr, align 1
%len_ptr = getelementptr inbounds %"std::tvalue::TValue::String", ptr %0, i32 0, i32 1
store i32 0, ptr %len_ptr, align 4
%cap_ptr = getelementptr inbounds %"std::tvalue::TValue::String", ptr %0, i32 0, i32 2
store i32 %1, ptr %cap_ptr, align 4
%ref_ct = getelementptr inbounds %"std::tvalue::TValue::String", ptr %0, i32 0, i32 3
store i32 0, ptr %ref_ct, align 4
%bytes_ptr = call ptr @malloc(i32 %1)
%storage = getelementptr inbounds %"std::tvalue::TValue::String", ptr %0, i32 0, i32 4
store ptr %bytes_ptr, ptr %storage, align 8
ret void
}
; Function Attrs: nounwind
declare ptr @malloc(i32) #0
define i8 @"std::tvalue::get_tag"(ptr %tagged_value) {
entry:
%is_null = icmp eq ptr %tagged_value, null
br i1 %is_null, label %null_block, label %not_null
null_block: ; preds = %entry
ret i8 0
not_null: ; preds = %entry
%tag_ptr = getelementptr inbounds %"std::tvalue::TValue", ptr %tagged_value, i32 0, i32 0
%tag_val = load i8, ptr %tag_ptr, align 1
ret i8 %tag_val
}
define i1 @"std::tvalue::is_truthy"(ptr %tagged_value) {
entry:
%tag = call i8 @"std::tvalue::get_tag"(ptr %tagged_value)
%is_nil = icmp eq i8 %tag, 0
br i1 %is_nil, label %is_nil1, label %is_not_nil
is_nil1: ; preds = %entry
ret i1 false
is_not_nil: ; preds = %entry
%is_bool = icmp eq i8 %tag, 1
br i1 %is_bool, label %is_bool2, label %is_not_bool
is_bool2: ; preds = %is_not_nil
%raw_variant_pointer = getelementptr inbounds %"std::tvalue::TValue::Bool", ptr %tagged_value, i32 0, i32 1
%bool_t_int = load i8, ptr %raw_variant_pointer, align 1
%ret = icmp ugt i8 %bool_t_int, 0
ret i1 %ret
is_not_bool: ; preds = %is_not_nil
ret i1 true
}
define i1 @"std::tvalue::is_number"(ptr %0) {
entry:
%tag = call i8 @"std::tvalue::get_tag"(ptr %0)
%cmp = icmp eq i8 %tag, 2
ret i1 %cmp
}
define float @"std::tvalue::get_value_number"(ptr %0) {
entry:
%is_num = call i1 @"std::tvalue::is_number"(ptr %0)
br i1 %is_num, label %ian, label %nan
ian: ; preds = %entry
%value_ptr = getelementptr inbounds %"std::tvalue::TValue::Number", ptr %0, i32 0, i32 1
%value = load float, ptr %value_ptr, align 4
ret float %value
nan: ; preds = %entry
ret float 0x7FF8000000000000
}
define void @"std::tvalue::test::print_tvalue_string"(ptr %0) {
entry:
%len_ptr = getelementptr inbounds %"std::tvalue::TValue::String", ptr %0, i32 0, i32 1
%len = load i32, ptr %len_ptr, align 4
%bytes_ptr_ptr = getelementptr inbounds %"std::tvalue::TValue::String", ptr %0, i32 0, i32 4
%bytes_ptr = load ptr, ptr %bytes_ptr_ptr, align 8
%_ = call i32 @write(i32 1, ptr %bytes_ptr, i32 %len)
ret void
}
declare i32 @write(i32, ptr, i32)
define void @"std::tvalue::test::print_tvalue_raw"(ptr %0) {
entry:
%ob = alloca [2 x i8], align 1
store [2 x i8] c"[\00", ptr %ob, align 1
%_ = call i32 (ptr, ...) @printf(ptr %ob)
br label %looptop
looptop: ; preds = %looptop, %entry
%idx = phi i32 [ %nextidx, %looptop ], [ 0, %entry ]
%nextidx = add i32 %idx, 1
%ch = getelementptr [16 x i8], ptr %0, i32 0, i32 %idx
%ch1 = load i8, ptr %ch, align 1
%ch_fmt = alloca [5 x i8], align 1
store [5 x i8] c"%*i,\00", ptr %ch_fmt, align 1
%_2 = call i32 (ptr, ...) @printf(ptr %ch_fmt, i8 3, i8 %ch1)
%done = icmp uge i32 %nextidx, ptrtoint (ptr getelementptr (%"std::tvalue::TValue", ptr null, i32 1) to i32)
br i1 %done, label %exit, label %looptop
exit: ; preds = %looptop
%cb = alloca [3 x i8], align 1
store [3 x i8] c"]\0A\00", ptr %cb, align 1
%_3 = call i32 (ptr, ...) @printf(ptr %cb)
ret void
}
declare i32 @printf(ptr, ...)
define void @"std::tvalue::test::print_tvalue"(ptr %0) {
entry:
%tag = call i8 @"std::tvalue::get_tag"(ptr %0)
switch i8 %tag, label %unknown [
i8 0, label %nil
i8 1, label %boolean
i8 2, label %number
i8 3, label %string
]
unknown: ; preds = %entry
call void @"std::tvalue::test::print_tvalue_raw"(ptr %0)
ret void
nil: ; preds = %entry
%_ = call i32 (ptr, ...) @printf(ptr @"tvalue::names::nil")
ret void
boolean: ; preds = %entry
%truthy_ptr = getelementptr inbounds %"std::tvalue::TValue::Bool", ptr %0, i32 0, i32 1
%truthy = load i1, ptr %truthy_ptr, align 1
br i1 %truthy, label %bool_true, label %bool_false
number: ; preds = %entry
%num_ptr = getelementptr inbounds %"std::tvalue::TValue::Number", ptr %0, i32 0, i32 1
%num = load float, ptr %num_ptr, align 4
%dbl = fpext float %num to double
%_3 = call i32 (ptr, ...) @printf(ptr @"tvalue::names::float_fmt", double %dbl)
ret void
string: ; preds = %entry
call void @"std::tvalue::test::print_tvalue_string"(ptr %0)
ret void
bool_true: ; preds = %boolean
%_1 = call i32 (ptr, ...) @printf(ptr @"tvalue::names::true")
ret void
bool_false: ; preds = %boolean
%_2 = call i32 (ptr, ...) @printf(ptr @"tvalue::names::false")
ret void
}
define i1 @"std::tvalue::is_two_numbers"(ptr %lhs, ptr %rhs) {
entry:
%lhs_is_num = call i1 @"std::tvalue::is_number"(ptr %lhs)
br i1 %lhs_is_num, label %lhs_ian, label %nan
nan: ; preds = %lhs_ian, %entry
ret i1 false
lhs_ian: ; preds = %entry
%rhs_is_num = call i1 @"std::tvalue::is_number"(ptr %rhs)
br i1 %rhs_is_num, label %rhs_ian, label %nan
rhs_ian: ; preds = %lhs_ian
ret i1 true
}
define i1 @"std::tvalue::add"(ptr %lhs, ptr %rhs, ptr %out) {
entry:
%are_nums = call i1 @"std::tvalue::is_two_numbers"(ptr %lhs, ptr %rhs)
br i1 %are_nums, label %ian, label %nan
ian: ; preds = %entry
%lhs_value = call float @"std::tvalue::get_value_number"(ptr %lhs)
%rhs_value = call float @"std::tvalue::get_value_number"(ptr %rhs)
%out_value = fadd float %lhs_value, %rhs_value
call void @"std::tvalue::new_num"(ptr %out, float %out_value)
ret i1 true
nan: ; preds = %entry
ret i1 false
}
define i1 @"std::tvalue::sub"(ptr %lhs, ptr %rhs, ptr %out) {
entry:
%are_nums = call i1 @"std::tvalue::is_two_numbers"(ptr %lhs, ptr %rhs)
br i1 %are_nums, label %ian, label %nan
ian: ; preds = %entry
%lhs_value = call float @"std::tvalue::get_value_number"(ptr %lhs)
%rhs_value = call float @"std::tvalue::get_value_number"(ptr %rhs)
%out_value = fsub float %lhs_value, %rhs_value
call void @"std::tvalue::new_num"(ptr %out, float %out_value)
ret i1 true
nan: ; preds = %entry
ret i1 false
}
define i1 @"std::tvalue::mul"(ptr %lhs, ptr %rhs, ptr %out) {
entry:
%are_nums = call i1 @"std::tvalue::is_two_numbers"(ptr %lhs, ptr %rhs)
br i1 %are_nums, label %ian, label %nan
ian: ; preds = %entry
%lhs_value = call float @"std::tvalue::get_value_number"(ptr %lhs)
%rhs_value = call float @"std::tvalue::get_value_number"(ptr %rhs)
%out_value = fmul float %lhs_value, %rhs_value
call void @"std::tvalue::new_num"(ptr %out, float %out_value)
ret i1 true
nan: ; preds = %entry
ret i1 false
}
define i1 @"std::tvalue::div"(ptr %lhs, ptr %rhs, ptr %out) {
entry:
%are_nums = call i1 @"std::tvalue::is_two_numbers"(ptr %lhs, ptr %rhs)
br i1 %are_nums, label %ian, label %nan
ian: ; preds = %entry
%lhs_value = call float @"std::tvalue::get_value_number"(ptr %lhs)
%rhs_value = call float @"std::tvalue::get_value_number"(ptr %rhs)
%out_value = fdiv float %lhs_value, %rhs_value
call void @"std::tvalue::new_num"(ptr %out, float %out_value)
ret i1 true
nan: ; preds = %entry
ret i1 false
}
define i1 @"std::tvalue::floor_div"(ptr %lhs, ptr %rhs, ptr %out) {
entry:
%are_nums = call i1 @"std::tvalue::is_two_numbers"(ptr %lhs, ptr %rhs)
br i1 %are_nums, label %ian, label %nan
ian: ; preds = %entry
%lhs_value = call float @"std::tvalue::get_value_number"(ptr %lhs)
%rhs_value = call float @"std::tvalue::get_value_number"(ptr %rhs)
%out_value = fdiv float %lhs_value, %rhs_value
%ret = call float @llvm.floor.f32(float %out_value)
call void @"std::tvalue::new_num"(ptr %out, float %ret)
ret i1 true
nan: ; preds = %entry
ret i1 false
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.floor.f32(float) #1
define i1 @"std::tvalue::pow"(ptr %lhs, ptr %rhs, ptr %out) {
entry:
%are_nums = call i1 @"std::tvalue::is_two_numbers"(ptr %lhs, ptr %rhs)
br i1 %are_nums, label %ian, label %nan
ian: ; preds = %entry
%lhs_value = call float @"std::tvalue::get_value_number"(ptr %lhs)
%rhs_value = call float @"std::tvalue::get_value_number"(ptr %rhs)
%out_value = call float @llvm.pow.f32(float %lhs_value, float %rhs_value)
call void @"std::tvalue::new_num"(ptr %out, float %out_value)
ret i1 true
nan: ; preds = %entry
ret i1 false
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.pow.f32(float, float) #1
define i1 @"std::tvalue::mod"(ptr %lhs, ptr %rhs, ptr %out) {
entry:
%are_nums = call i1 @"std::tvalue::is_two_numbers"(ptr %lhs, ptr %rhs)
br i1 %are_nums, label %ian, label %nan
ian: ; preds = %entry
%lhs_value = call float @"std::tvalue::get_value_number"(ptr %lhs)
%rhs_value = call float @"std::tvalue::get_value_number"(ptr %rhs)
%out_value = frem float %lhs_value, %rhs_value
call void @"std::tvalue::new_num"(ptr %out, float %out_value)
ret i1 true
nan: ; preds = %entry
ret i1 false
}
define i1 @"std::tvalue::NEG"(ptr %0, ptr %1) {
entry:
%arg_ian = call i1 @"std::tvalue::is_number"(ptr %0)
br i1 %arg_ian, label %ian, label %nan
nan: ; preds = %entry
ret i1 false
ian: ; preds = %entry
%lhs_value = call float @"std::tvalue::get_value_number"(ptr %0)
%out_value = fneg float %lhs_value
call void @"std::tvalue::new_num"(ptr %1, float %out_value)
ret i1 true
}
define i1 @"std::tvalue::is_int"(float %0) {
entry:
%floored = call float @llvm.floor.f32(float %0)
%is_int = fcmp oeq float %0, %floored
br i1 %is_int, label %exit, label %nai
exit: ; preds = %entry
ret i1 true
nai: ; preds = %entry
ret i1 false
}
define i1 @"std::tvalue::is_two_ints"(float %lhs, float %rhs) {
entry:
%lhs_is = call i1 @"std::tvalue::is_int"(float %lhs)
br i1 %lhs_is, label %lhs_iai, label %nai
lhs_iai: ; preds = %entry
%rhs_is = call i1 @"std::tvalue::is_int"(float %rhs)
br i1 %rhs_is, label %rhs_iai, label %nai
rhs_iai: ; preds = %lhs_iai
ret i1 true
nai: ; preds = %lhs_iai, %entry
ret i1 false
}
define i1 @"std::tvalue::bin_and"(ptr %lhs, ptr %rhs, ptr %out) {
entry:
%are_nums = call i1 @"std::tvalue::is_two_numbers"(ptr %lhs, ptr %rhs)
br i1 %are_nums, label %ian, label %nan
ian: ; preds = %entry
%lhs_value = call float @"std::tvalue::get_value_number"(ptr %lhs)
%rhs_value = call float @"std::tvalue::get_value_number"(ptr %rhs)
%are_ints = call i1 @"std::tvalue::is_two_ints"(float %lhs_value, float %rhs_value)
br i1 %are_ints, label %two_ints, label %not_ints
nan: ; preds = %entry
ret i1 false
two_ints: ; preds = %ian
%lhs1 = fptosi float %lhs_value to i32
%rhs2 = fptosi float %rhs_value to i32
%anded = and i32 %lhs1, %rhs2
%out3 = sitofp i32 %anded to float
call void @"std::tvalue::new_num"(ptr %out, float %out3)
ret i1 true
not_ints: ; preds = %ian
ret i1 false
}
define i1 @"std::tvalue::bin_or"(ptr %lhs, ptr %rhs, ptr %out) {
entry:
%are_nums = call i1 @"std::tvalue::is_two_numbers"(ptr %lhs, ptr %rhs)
br i1 %are_nums, label %ian, label %nan
ian: ; preds = %entry
%lhs_value = call float @"std::tvalue::get_value_number"(ptr %lhs)
%rhs_value = call float @"std::tvalue::get_value_number"(ptr %rhs)
%are_ints = call i1 @"std::tvalue::is_two_ints"(float %lhs_value, float %rhs_value)
br i1 %are_ints, label %two_ints, label %not_ints
nan: ; preds = %entry
ret i1 false
two_ints: ; preds = %ian
%lhs1 = fptosi float %lhs_value to i32
%rhs2 = fptosi float %rhs_value to i32
%ored = or i32 %lhs1, %rhs2
%out3 = sitofp i32 %ored to float
call void @"std::tvalue::new_num"(ptr %out, float %out3)
ret i1 true
not_ints: ; preds = %ian
ret i1 false
}
define i1 @"std::tvalue::lsh"(ptr %lhs, ptr %rhs, ptr %out) {
entry:
%are_nums = call i1 @"std::tvalue::is_two_numbers"(ptr %lhs, ptr %rhs)
br i1 %are_nums, label %ian, label %nan
ian: ; preds = %entry
%lhs_value = call float @"std::tvalue::get_value_number"(ptr %lhs)
%rhs_value = call float @"std::tvalue::get_value_number"(ptr %rhs)
%are_ints = call i1 @"std::tvalue::is_two_ints"(float %lhs_value, float %rhs_value)
br i1 %are_ints, label %two_ints, label %not_ints
nan: ; preds = %entry
ret i1 false
two_ints: ; preds = %ian
%lhs1 = fptosi float %lhs_value to i32
%rhs2 = fptosi float %rhs_value to i32
%lshed = shl i32 %lhs1, %rhs2
%out3 = sitofp i32 %lshed to float
call void @"std::tvalue::new_num"(ptr %out, float %out3)
ret i1 true
not_ints: ; preds = %ian
ret i1 false
}
define i1 @"std::tvalue::rsh"(ptr %lhs, ptr %rhs, ptr %out) {
entry:
%are_nums = call i1 @"std::tvalue::is_two_numbers"(ptr %lhs, ptr %rhs)
br i1 %are_nums, label %ian, label %nan
ian: ; preds = %entry
%lhs_value = call float @"std::tvalue::get_value_number"(ptr %lhs)
%rhs_value = call float @"std::tvalue::get_value_number"(ptr %rhs)
%are_ints = call i1 @"std::tvalue::is_two_ints"(float %lhs_value, float %rhs_value)
br i1 %are_ints, label %two_ints, label %not_ints
nan: ; preds = %entry
ret i1 false
two_ints: ; preds = %ian
%lhs1 = fptosi float %lhs_value to i32
%rhs2 = fptosi float %rhs_value to i32
%rshed = ashr i32 %lhs1, %rhs2
%out3 = sitofp i32 %rshed to float
call void @"std::tvalue::new_num"(ptr %out, float %out3)
ret i1 true
not_ints: ; preds = %ian
ret i1 false
}
define i1 @"std::tvalue::bin_not"(ptr %value, ptr %out) {
entry:
%is_num = call i1 @"std::tvalue::is_number"(ptr %value)
br i1 %is_num, label %ian, label %no
ian: ; preds = %entry
%value_num = call float @"std::tvalue::get_value_number"(ptr %value)
%is_int = call i1 @"std::tvalue::is_int"(float %value_num)
br i1 %is_int, label %iai, label %no
no: ; preds = %ian, %entry
ret i1 false
iai: ; preds = %ian
%value_int = fptosi float %value_num to i32
%value_int1 = xor i32 %value_int, -1
%ret_float = sitofp i32 %value_int1 to float
call void @"std::tvalue::new_num"(ptr %out, float %ret_float)
ret i1 true
}
define void @main() {
entry:
%a = alloca %"std::tvalue::TValue", align 8
call void @"std::tvalue::new_nil"(ptr %a)
call void @"std::tvalue::new_num"(ptr %a, float 1.000000e+00)
call void @"std::tvalue::test::print_tvalue"(ptr %a)
%b = alloca %"std::tvalue::TValue", align 8
call void @"std::tvalue::new_nil"(ptr %b)
call void @"std::tvalue::new_num"(ptr %b, float 2.500000e+00)
call void @"std::tvalue::test::print_tvalue"(ptr %b)
%result = alloca %"std::tvalue::TValue", align 8
call void @"std::tvalue::new_nil"(ptr %result)
%success = call i1 @"std::tvalue::add"(ptr %a, ptr %b, ptr %result)
call void @"std::tvalue::test::print_tvalue"(ptr %result)
%_ = alloca %"std::tvalue::TValue", align 8
call void @"std::tvalue::new_nil"(ptr %_)
call void @"std::tvalue::new_str"(ptr %_, i32 13)
%ptr_ptr = getelementptr inbounds %"std::tvalue::TValue::String", ptr %_, i32 0, i32 4
%ptr = load ptr, ptr %ptr_ptr, align 8
store [13 x i8] c"\22hello world\22", ptr %ptr, align 1
%len_prt = getelementptr inbounds %"std::tvalue::TValue::String", ptr %_, i32 0, i32 1
store i32 13, ptr %len_prt, align 4
call void @"std::tvalue::test::print_tvalue"(ptr %_)
ret void
}
attributes #0 = { nounwind }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.dbg.cu = !{!0}
!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "luminary", isOptimized: false, runtimeVersion: 1, emissionKind: FullDebug, splitDebugInlining: false)
!1 = !DIFile(filename: "std_tvalue.ll", directory: ".")
.text
.file "early_example"
.globl "std::tvalue::new_nil" # -- Begin function std::tvalue::new_nil
.p2align 4, 0x90
.type "std::tvalue::new_nil",@function
"std::tvalue::new_nil": # @"std::tvalue::new_nil"
.cfi_startproc
# %bb.0: # %entry
movq $0, (%rdi)
movq $0, 8(%rdi)
retq
.Lfunc_end0:
.size "std::tvalue::new_nil", .Lfunc_end0-"std::tvalue::new_nil"
.cfi_endproc
# -- End function
.globl "std::tvalue::new_bool" # -- Begin function std::tvalue::new_bool
.p2align 4, 0x90
.type "std::tvalue::new_bool",@function
"std::tvalue::new_bool": # @"std::tvalue::new_bool"
.cfi_startproc
# %bb.0: # %entry
movb $1, (%rdi)
andl $1, %esi
movb %sil, 23(%rdi)
retq
.Lfunc_end1:
.size "std::tvalue::new_bool", .Lfunc_end1-"std::tvalue::new_bool"
.cfi_endproc
# -- End function
.globl "std::tvalue::new_num" # -- Begin function std::tvalue::new_num
.p2align 4, 0x90
.type "std::tvalue::new_num",@function
"std::tvalue::new_num": # @"std::tvalue::new_num"
.cfi_startproc
# %bb.0: # %entry
movb $2, (%rdi)
movss %xmm0, 12(%rdi)
retq
.Lfunc_end2:
.size "std::tvalue::new_num", .Lfunc_end2-"std::tvalue::new_num"
.cfi_endproc
# -- End function
.globl "std::tvalue::new_str" # -- Begin function std::tvalue::new_str
.p2align 4, 0x90
.type "std::tvalue::new_str",@function
"std::tvalue::new_str": # @"std::tvalue::new_str"
.cfi_startproc
# %bb.0: # %entry
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset %rbx, -16
movq %rdi, %rbx
movb $3, (%rdi)
movl $0, 4(%rdi)
movl %esi, 8(%rdi)
movl $0, 12(%rdi)
movl %esi, %edi
callq malloc@PLT
movq %rax, 16(%rbx)
popq %rbx
.cfi_def_cfa_offset 8
retq
.Lfunc_end3:
.size "std::tvalue::new_str", .Lfunc_end3-"std::tvalue::new_str"
.cfi_endproc
# -- End function
.globl "std::tvalue::get_tag" # -- Begin function std::tvalue::get_tag
.p2align 4, 0x90
.type "std::tvalue::get_tag",@function
"std::tvalue::get_tag": # @"std::tvalue::get_tag"
.cfi_startproc
# %bb.0: # %entry
testq %rdi, %rdi
je .LBB4_1
# %bb.2: # %not_null
movzbl (%rdi), %eax
retq
.LBB4_1: # %null_block
xorl %eax, %eax
retq
.Lfunc_end4:
.size "std::tvalue::get_tag", .Lfunc_end4-"std::tvalue::get_tag"
.cfi_endproc
# -- End function
.globl "std::tvalue::is_truthy" # -- Begin function std::tvalue::is_truthy
.p2align 4, 0x90
.type "std::tvalue::is_truthy",@function
"std::tvalue::is_truthy": # @"std::tvalue::is_truthy"
.cfi_startproc
# %bb.0: # %entry
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset %rbx, -16
movq %rdi, %rbx
callq "std::tvalue::get_tag"@PLT
testb %al, %al
je .LBB5_3
# %bb.1: # %is_not_nil
cmpb $1, %al
jne .LBB5_2
# %bb.4: # %is_bool2
cmpb $0, 23(%rbx)
setne %al
popq %rbx
.cfi_def_cfa_offset 8
retq
.LBB5_3: # %is_nil1
.cfi_def_cfa_offset 16
xorl %eax, %eax
popq %rbx
.cfi_def_cfa_offset 8
retq
.LBB5_2: # %is_not_bool
.cfi_def_cfa_offset 16
movb $1, %al
popq %rbx
.cfi_def_cfa_offset 8
retq
.Lfunc_end5:
.size "std::tvalue::is_truthy", .Lfunc_end5-"std::tvalue::is_truthy"
.cfi_endproc
# -- End function
.globl "std::tvalue::is_number" # -- Begin function std::tvalue::is_number
.p2align 4, 0x90
.type "std::tvalue::is_number",@function
"std::tvalue::is_number": # @"std::tvalue::is_number"
.cfi_startproc
# %bb.0: # %entry
pushq %rax
.cfi_def_cfa_offset 16
callq "std::tvalue::get_tag"@PLT
cmpb $2, %al
sete %al
popq %rcx
.cfi_def_cfa_offset 8
retq
.Lfunc_end6:
.size "std::tvalue::is_number", .Lfunc_end6-"std::tvalue::is_number"
.cfi_endproc
# -- End function
.section .rodata.cst4,"aM",@progbits,4
.p2align 2, 0x0 # -- Begin function std::tvalue::get_value_number
.LCPI7_0:
.long 0x7fc00000 # float NaN
.text
.globl "std::tvalue::get_value_number"
.p2align 4, 0x90
.type "std::tvalue::get_value_number",@function
"std::tvalue::get_value_number": # @"std::tvalue::get_value_number"
.cfi_startproc
# %bb.0: # %entry
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset %rbx, -16
movq %rdi, %rbx
callq "std::tvalue::is_number"@PLT
testb $1, %al
je .LBB7_2
# %bb.1: # %ian
movss 12(%rbx), %xmm0 # xmm0 = mem[0],zero,zero,zero
popq %rbx
.cfi_def_cfa_offset 8
retq
.LBB7_2: # %nan
.cfi_def_cfa_offset 16
movss .LCPI7_0(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
popq %rbx
.cfi_def_cfa_offset 8
retq
.Lfunc_end7:
.size "std::tvalue::get_value_number", .Lfunc_end7-"std::tvalue::get_value_number"
.cfi_endproc
# -- End function
.globl "std::tvalue::test::print_tvalue_string" # -- Begin function std::tvalue::test::print_tvalue_string
.p2align 4, 0x90
.type "std::tvalue::test::print_tvalue_string",@function
"std::tvalue::test::print_tvalue_string": # @"std::tvalue::test::print_tvalue_string"
.cfi_startproc
# %bb.0: # %entry
pushq %rax
.cfi_def_cfa_offset 16
movl 4(%rdi), %edx
movq 16(%rdi), %rsi
movl $1, %edi
callq write@PLT
popq %rax
.cfi_def_cfa_offset 8
retq
.Lfunc_end8:
.size "std::tvalue::test::print_tvalue_string", .Lfunc_end8-"std::tvalue::test::print_tvalue_string"
.cfi_endproc
# -- End function
.globl "std::tvalue::test::print_tvalue_raw" # -- Begin function std::tvalue::test::print_tvalue_raw
.p2align 4, 0x90
.type "std::tvalue::test::print_tvalue_raw",@function
"std::tvalue::test::print_tvalue_raw": # @"std::tvalue::test::print_tvalue_raw"
.cfi_startproc
# %bb.0: # %entry
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset %rbp, -16
movq %rsp, %rbp
.cfi_def_cfa_register %rbp
pushq %r14
pushq %rbx
subq $16, %rsp
.cfi_offset %rbx, -32
.cfi_offset %r14, -24
movq %rdi, %rbx
movw $91, -18(%rbp)
leaq -18(%rbp), %rdi
xorl %eax, %eax
callq printf@PLT
xorl %r14d, %r14d
.p2align 4, 0x90
.LBB9_1: # %looptop
# =>This Inner Loop Header: Depth=1
movzbl (%rbx,%r14), %edx
movq %rsp, %rax
leaq -16(%rax), %rdi
movq %rdi, %rsp
movb $0, -12(%rax)
movl $745089573, -16(%rax) # imm = 0x2C692A25
movl $3, %esi
xorl %eax, %eax
callq printf@PLT
incq %r14
cmpl $24, %r14d
jb .LBB9_1
# %bb.2: # %exit
movq %rsp, %rax
leaq -16(%rax), %rdi
movq %rdi, %rsp
movb $0, -14(%rax)
movw $2653, -16(%rax) # imm = 0xA5D
xorl %eax, %eax
callq printf@PLT
leaq -16(%rbp), %rsp
popq %rbx
popq %r14
popq %rbp
.cfi_def_cfa %rsp, 8
retq
.Lfunc_end9:
.size "std::tvalue::test::print_tvalue_raw", .Lfunc_end9-"std::tvalue::test::print_tvalue_raw"
.cfi_endproc
# -- End function
.globl "std::tvalue::test::print_tvalue" # -- Begin function std::tvalue::test::print_tvalue
.p2align 4, 0x90
.type "std::tvalue::test::print_tvalue",@function
"std::tvalue::test::print_tvalue": # @"std::tvalue::test::print_tvalue"
.cfi_startproc
# %bb.0: # %entry
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset %rbx, -16
movq %rdi, %rbx
callq "std::tvalue::get_tag"@PLT
cmpb $3, %al
ja .LBB10_2
# %bb.1: # %entry
movzbl %al, %eax
jmpq *.LJTI10_0(,%rax,8)
.LBB10_3: # %nil
movq "tvalue::names::nil"@GOTPCREL(%rip), %rdi
jmp .LBB10_4
.LBB10_5: # %number
movss 12(%rbx), %xmm0 # xmm0 = mem[0],zero,zero,zero
cvtss2sd %xmm0, %xmm0
movq "tvalue::names::float_fmt"@GOTPCREL(%rip), %rdi
movb $1, %al
callq printf@PLT
popq %rbx
.cfi_def_cfa_offset 8
retq
.LBB10_6: # %string
.cfi_def_cfa_offset 16
movq %rbx, %rdi
callq "std::tvalue::test::print_tvalue_string"@PLT
popq %rbx
.cfi_def_cfa_offset 8
retq
.LBB10_2: # %unknown
.cfi_def_cfa_offset 16
movq %rbx, %rdi
callq "std::tvalue::test::print_tvalue_raw"@PLT
popq %rbx
.cfi_def_cfa_offset 8
retq
.LBB10_8: # %boolean
.cfi_def_cfa_offset 16
cmpb $0, 23(%rbx)
je .LBB10_9
# %bb.7: # %bool_true
movq "tvalue::names::true"@GOTPCREL(%rip), %rdi
jmp .LBB10_4
.LBB10_9: # %bool_false
movq "tvalue::names::false"@GOTPCREL(%rip), %rdi
.LBB10_4: # %nil
xorl %eax, %eax
callq printf@PLT
popq %rbx
.cfi_def_cfa_offset 8
retq
.Lfunc_end10:
.size "std::tvalue::test::print_tvalue", .Lfunc_end10-"std::tvalue::test::print_tvalue"
.cfi_endproc
.section .rodata,"a",@progbits
.p2align 3, 0x0
.LJTI10_0:
.quad .LBB10_3
.quad .LBB10_8
.quad .LBB10_5
.quad .LBB10_6
# -- End function
.text
.globl "std::tvalue::is_two_numbers" # -- Begin function std::tvalue::is_two_numbers
.p2align 4, 0x90
.type "std::tvalue::is_two_numbers",@function
"std::tvalue::is_two_numbers": # @"std::tvalue::is_two_numbers"
.cfi_startproc
# %bb.0: # %entry
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset %rbx, -16
movq %rsi, %rbx
callq "std::tvalue::is_number"@PLT
testb $1, %al
je .LBB11_3
# %bb.1: # %lhs_ian
movq %rbx, %rdi
callq "std::tvalue::is_number"@PLT
testb $1, %al
je .LBB11_3
# %bb.2: # %rhs_ian
movb $1, %al
popq %rbx
.cfi_def_cfa_offset 8
retq
.LBB11_3: # %nan
.cfi_def_cfa_offset 16
xorl %eax, %eax
popq %rbx
.cfi_def_cfa_offset 8
retq
.Lfunc_end11:
.size "std::tvalue::is_two_numbers", .Lfunc_end11-"std::tvalue::is_two_numbers"
.cfi_endproc
# -- End function
.globl "std::tvalue::add" # -- Begin function std::tvalue::add
.p2align 4, 0x90
.type "std::tvalue::add",@function
"std::tvalue::add": # @"std::tvalue::add"
.cfi_startproc
# %bb.0: # %entry
pushq %r15
.cfi_def_cfa_offset 16
pushq %r14
.cfi_def_cfa_offset 24
pushq %rbx
.cfi_def_cfa_offset 32
subq $16, %rsp
.cfi_def_cfa_offset 48
.cfi_offset %rbx, -32
.cfi_offset %r14, -24
.cfi_offset %r15, -16
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq "std::tvalue::is_two_numbers"@PLT
testb $1, %al
je .LBB12_2
# %bb.1: # %ian
movq %r15, %rdi
callq "std::tvalue::get_value_number"@PLT
movss %xmm0, 12(%rsp) # 4-byte Spill
movq %r14, %rdi
callq "std::tvalue::get_value_number"@PLT
addss 12(%rsp), %xmm0 # 4-byte Folded Reload
movq %rbx, %rdi
callq "std::tvalue::new_num"@PLT
movb $1, %al
jmp .LBB12_3
.LBB12_2: # %nan
xorl %eax, %eax
.LBB12_3: # %nan
addq $16, %rsp
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
retq
.Lfunc_end12:
.size "std::tvalue::add", .Lfunc_end12-"std::tvalue::add"
.cfi_endproc
# -- End function
.globl "std::tvalue::sub" # -- Begin function std::tvalue::sub
.p2align 4, 0x90
.type "std::tvalue::sub",@function
"std::tvalue::sub": # @"std::tvalue::sub"
.cfi_startproc
# %bb.0: # %entry
pushq %r15
.cfi_def_cfa_offset 16
pushq %r14
.cfi_def_cfa_offset 24
pushq %rbx
.cfi_def_cfa_offset 32
subq $16, %rsp
.cfi_def_cfa_offset 48
.cfi_offset %rbx, -32
.cfi_offset %r14, -24
.cfi_offset %r15, -16
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq "std::tvalue::is_two_numbers"@PLT
testb $1, %al
je .LBB13_2
# %bb.1: # %ian
movq %r15, %rdi
callq "std::tvalue::get_value_number"@PLT
movss %xmm0, 12(%rsp) # 4-byte Spill
movq %r14, %rdi
callq "std::tvalue::get_value_number"@PLT
movss 12(%rsp), %xmm1 # 4-byte Reload
# xmm1 = mem[0],zero,zero,zero
subss %xmm0, %xmm1
movq %rbx, %rdi
movaps %xmm1, %xmm0
callq "std::tvalue::new_num"@PLT
movb $1, %al
jmp .LBB13_3
.LBB13_2: # %nan
xorl %eax, %eax
.LBB13_3: # %nan
addq $16, %rsp
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
retq
.Lfunc_end13:
.size "std::tvalue::sub", .Lfunc_end13-"std::tvalue::sub"
.cfi_endproc
# -- End function
.globl "std::tvalue::mul" # -- Begin function std::tvalue::mul
.p2align 4, 0x90
.type "std::tvalue::mul",@function
"std::tvalue::mul": # @"std::tvalue::mul"
.cfi_startproc
# %bb.0: # %entry
pushq %r15
.cfi_def_cfa_offset 16
pushq %r14
.cfi_def_cfa_offset 24
pushq %rbx
.cfi_def_cfa_offset 32
subq $16, %rsp
.cfi_def_cfa_offset 48
.cfi_offset %rbx, -32
.cfi_offset %r14, -24
.cfi_offset %r15, -16
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq "std::tvalue::is_two_numbers"@PLT
testb $1, %al
je .LBB14_2
# %bb.1: # %ian
movq %r15, %rdi
callq "std::tvalue::get_value_number"@PLT
movss %xmm0, 12(%rsp) # 4-byte Spill
movq %r14, %rdi
callq "std::tvalue::get_value_number"@PLT
mulss 12(%rsp), %xmm0 # 4-byte Folded Reload
movq %rbx, %rdi
callq "std::tvalue::new_num"@PLT
movb $1, %al
jmp .LBB14_3
.LBB14_2: # %nan
xorl %eax, %eax
.LBB14_3: # %nan
addq $16, %rsp
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
retq
.Lfunc_end14:
.size "std::tvalue::mul", .Lfunc_end14-"std::tvalue::mul"
.cfi_endproc
# -- End function
.globl "std::tvalue::div" # -- Begin function std::tvalue::div
.p2align 4, 0x90
.type "std::tvalue::div",@function
"std::tvalue::div": # @"std::tvalue::div"
.cfi_startproc
# %bb.0: # %entry
pushq %r15
.cfi_def_cfa_offset 16
pushq %r14
.cfi_def_cfa_offset 24
pushq %rbx
.cfi_def_cfa_offset 32
subq $16, %rsp
.cfi_def_cfa_offset 48
.cfi_offset %rbx, -32
.cfi_offset %r14, -24
.cfi_offset %r15, -16
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq "std::tvalue::is_two_numbers"@PLT
testb $1, %al
je .LBB15_2
# %bb.1: # %ian
movq %r15, %rdi
callq "std::tvalue::get_value_number"@PLT
movss %xmm0, 12(%rsp) # 4-byte Spill
movq %r14, %rdi
callq "std::tvalue::get_value_number"@PLT
movss 12(%rsp), %xmm1 # 4-byte Reload
# xmm1 = mem[0],zero,zero,zero
divss %xmm0, %xmm1
movq %rbx, %rdi
movaps %xmm1, %xmm0
callq "std::tvalue::new_num"@PLT
movb $1, %al
jmp .LBB15_3
.LBB15_2: # %nan
xorl %eax, %eax
.LBB15_3: # %nan
addq $16, %rsp
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
retq
.Lfunc_end15:
.size "std::tvalue::div", .Lfunc_end15-"std::tvalue::div"
.cfi_endproc
# -- End function
.globl "std::tvalue::floor_div" # -- Begin function std::tvalue::floor_div
.p2align 4, 0x90
.type "std::tvalue::floor_div",@function
"std::tvalue::floor_div": # @"std::tvalue::floor_div"
.cfi_startproc
# %bb.0: # %entry
pushq %r15
.cfi_def_cfa_offset 16
pushq %r14
.cfi_def_cfa_offset 24
pushq %rbx
.cfi_def_cfa_offset 32
subq $16, %rsp
.cfi_def_cfa_offset 48
.cfi_offset %rbx, -32
.cfi_offset %r14, -24
.cfi_offset %r15, -16
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq "std::tvalue::is_two_numbers"@PLT
testb $1, %al
je .LBB16_2
# %bb.1: # %ian
movq %r15, %rdi
callq "std::tvalue::get_value_number"@PLT
movss %xmm0, 12(%rsp) # 4-byte Spill
movq %r14, %rdi
callq "std::tvalue::get_value_number"@PLT
movss 12(%rsp), %xmm1 # 4-byte Reload
# xmm1 = mem[0],zero,zero,zero
divss %xmm0, %xmm1
movaps %xmm1, %xmm0
callq floorf@PLT
movq %rbx, %rdi
callq "std::tvalue::new_num"@PLT
movb $1, %al
jmp .LBB16_3
.LBB16_2: # %nan
xorl %eax, %eax
.LBB16_3: # %nan
addq $16, %rsp
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
retq
.Lfunc_end16:
.size "std::tvalue::floor_div", .Lfunc_end16-"std::tvalue::floor_div"
.cfi_endproc
# -- End function
.globl "std::tvalue::pow" # -- Begin function std::tvalue::pow
.p2align 4, 0x90
.type "std::tvalue::pow",@function
"std::tvalue::pow": # @"std::tvalue::pow"
.cfi_startproc
# %bb.0: # %entry
pushq %r15
.cfi_def_cfa_offset 16
pushq %r14
.cfi_def_cfa_offset 24
pushq %rbx
.cfi_def_cfa_offset 32
subq $16, %rsp
.cfi_def_cfa_offset 48
.cfi_offset %rbx, -32
.cfi_offset %r14, -24
.cfi_offset %r15, -16
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq "std::tvalue::is_two_numbers"@PLT
testb $1, %al
je .LBB17_2
# %bb.1: # %ian
movq %r15, %rdi
callq "std::tvalue::get_value_number"@PLT
movss %xmm0, 12(%rsp) # 4-byte Spill
movq %r14, %rdi
callq "std::tvalue::get_value_number"@PLT
movaps %xmm0, %xmm1
movss 12(%rsp), %xmm0 # 4-byte Reload
# xmm0 = mem[0],zero,zero,zero
callq powf@PLT
movq %rbx, %rdi
callq "std::tvalue::new_num"@PLT
movb $1, %al
jmp .LBB17_3
.LBB17_2: # %nan
xorl %eax, %eax
.LBB17_3: # %nan
addq $16, %rsp
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
retq
.Lfunc_end17:
.size "std::tvalue::pow", .Lfunc_end17-"std::tvalue::pow"
.cfi_endproc
# -- End function
.globl "std::tvalue::mod" # -- Begin function std::tvalue::mod
.p2align 4, 0x90
.type "std::tvalue::mod",@function
"std::tvalue::mod": # @"std::tvalue::mod"
.cfi_startproc
# %bb.0: # %entry
pushq %r15
.cfi_def_cfa_offset 16
pushq %r14
.cfi_def_cfa_offset 24
pushq %rbx
.cfi_def_cfa_offset 32
subq $16, %rsp
.cfi_def_cfa_offset 48
.cfi_offset %rbx, -32
.cfi_offset %r14, -24
.cfi_offset %r15, -16
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq "std::tvalue::is_two_numbers"@PLT
testb $1, %al
je .LBB18_2
# %bb.1: # %ian
movq %r15, %rdi
callq "std::tvalue::get_value_number"@PLT
movss %xmm0, 12(%rsp) # 4-byte Spill
movq %r14, %rdi
callq "std::tvalue::get_value_number"@PLT
movaps %xmm0, %xmm1
movss 12(%rsp), %xmm0 # 4-byte Reload
# xmm0 = mem[0],zero,zero,zero
callq fmodf@PLT
movq %rbx, %rdi
callq "std::tvalue::new_num"@PLT
movb $1, %al
jmp .LBB18_3
.LBB18_2: # %nan
xorl %eax, %eax
.LBB18_3: # %nan
addq $16, %rsp
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
retq
.Lfunc_end18:
.size "std::tvalue::mod", .Lfunc_end18-"std::tvalue::mod"
.cfi_endproc
# -- End function
.section .rodata.cst16,"aM",@progbits,16
.p2align 4, 0x0 # -- Begin function std::tvalue::NEG
.LCPI19_0:
.long 0x80000000 # float -0
.long 0x80000000 # float -0
.long 0x80000000 # float -0
.long 0x80000000 # float -0
.text
.globl "std::tvalue::NEG"
.p2align 4, 0x90
.type "std::tvalue::NEG",@function
"std::tvalue::NEG": # @"std::tvalue::NEG"
.cfi_startproc
# %bb.0: # %entry
pushq %r14
.cfi_def_cfa_offset 16
pushq %rbx
.cfi_def_cfa_offset 24
pushq %rax
.cfi_def_cfa_offset 32
.cfi_offset %rbx, -24
.cfi_offset %r14, -16
movq %rsi, %rbx
movq %rdi, %r14
callq "std::tvalue::is_number"@PLT
testb $1, %al
je .LBB19_1
# %bb.3: # %ian
movq %r14, %rdi
callq "std::tvalue::get_value_number"@PLT
xorps .LCPI19_0(%rip), %xmm0
movq %rbx, %rdi
callq "std::tvalue::new_num"@PLT
movb $1, %al
jmp .LBB19_2
.LBB19_1: # %nan
xorl %eax, %eax
.LBB19_2: # %nan
addq $8, %rsp
.cfi_def_cfa_offset 24
popq %rbx
.cfi_def_cfa_offset 16
popq %r14
.cfi_def_cfa_offset 8
retq
.Lfunc_end19:
.size "std::tvalue::NEG", .Lfunc_end19-"std::tvalue::NEG"
.cfi_endproc
# -- End function
.globl "std::tvalue::is_int" # -- Begin function std::tvalue::is_int
.p2align 4, 0x90
.type "std::tvalue::is_int",@function
"std::tvalue::is_int": # @"std::tvalue::is_int"
.cfi_startproc
# %bb.0: # %entry
pushq %rax
.cfi_def_cfa_offset 16
movss %xmm0, 4(%rsp) # 4-byte Spill
callq floorf@PLT
movss 4(%rsp), %xmm1 # 4-byte Reload
# xmm1 = mem[0],zero,zero,zero
ucomiss %xmm0, %xmm1
jne .LBB20_2
jp .LBB20_2
# %bb.1: # %exit
movb $1, %al
popq %rcx
.cfi_def_cfa_offset 8
retq
.LBB20_2: # %nai
.cfi_def_cfa_offset 16
xorl %eax, %eax
popq %rcx
.cfi_def_cfa_offset 8
retq
.Lfunc_end20:
.size "std::tvalue::is_int", .Lfunc_end20-"std::tvalue::is_int"
.cfi_endproc
# -- End function
.globl "std::tvalue::is_two_ints" # -- Begin function std::tvalue::is_two_ints
.p2align 4, 0x90
.type "std::tvalue::is_two_ints",@function
"std::tvalue::is_two_ints": # @"std::tvalue::is_two_ints"
.cfi_startproc
# %bb.0: # %entry
pushq %rax
.cfi_def_cfa_offset 16
movss %xmm1, 4(%rsp) # 4-byte Spill
callq "std::tvalue::is_int"@PLT
testb $1, %al
je .LBB21_3
# %bb.1: # %lhs_iai
movss 4(%rsp), %xmm0 # 4-byte Reload
# xmm0 = mem[0],zero,zero,zero
callq "std::tvalue::is_int"@PLT
testb $1, %al
je .LBB21_3
# %bb.2: # %rhs_iai
movb $1, %al
popq %rcx
.cfi_def_cfa_offset 8
retq
.LBB21_3: # %nai
.cfi_def_cfa_offset 16
xorl %eax, %eax
popq %rcx
.cfi_def_cfa_offset 8
retq
.Lfunc_end21:
.size "std::tvalue::is_two_ints", .Lfunc_end21-"std::tvalue::is_two_ints"
.cfi_endproc
# -- End function
.globl "std::tvalue::bin_and" # -- Begin function std::tvalue::bin_and
.p2align 4, 0x90
.type "std::tvalue::bin_and",@function
"std::tvalue::bin_and": # @"std::tvalue::bin_and"
.cfi_startproc
# %bb.0: # %entry
pushq %r15
.cfi_def_cfa_offset 16
pushq %r14
.cfi_def_cfa_offset 24
pushq %rbx
.cfi_def_cfa_offset 32
subq $16, %rsp
.cfi_def_cfa_offset 48
.cfi_offset %rbx, -32
.cfi_offset %r14, -24
.cfi_offset %r15, -16
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq "std::tvalue::is_two_numbers"@PLT
testb $1, %al
je .LBB22_3
# %bb.1: # %ian
movq %r15, %rdi
callq "std::tvalue::get_value_number"@PLT
movss %xmm0, 8(%rsp) # 4-byte Spill
movq %r14, %rdi
callq "std::tvalue::get_value_number"@PLT
movaps %xmm0, %xmm1
movss 8(%rsp), %xmm0 # 4-byte Reload
# xmm0 = mem[0],zero,zero,zero
movss %xmm1, 12(%rsp) # 4-byte Spill
callq "std::tvalue::is_two_ints"@PLT
testb $1, %al
je .LBB22_3
# %bb.2: # %two_ints
cvttss2si 8(%rsp), %eax # 4-byte Folded Reload
cvttss2si 12(%rsp), %ecx # 4-byte Folded Reload
andl %eax, %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movq %rbx, %rdi
callq "std::tvalue::new_num"@PLT
movb $1, %al
jmp .LBB22_4
.LBB22_3: # %nan
xorl %eax, %eax
.LBB22_4: # %nan
addq $16, %rsp
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
retq
.Lfunc_end22:
.size "std::tvalue::bin_and", .Lfunc_end22-"std::tvalue::bin_and"
.cfi_endproc
# -- End function
.globl "std::tvalue::bin_or" # -- Begin function std::tvalue::bin_or
.p2align 4, 0x90
.type "std::tvalue::bin_or",@function
"std::tvalue::bin_or": # @"std::tvalue::bin_or"
.cfi_startproc
# %bb.0: # %entry
pushq %r15
.cfi_def_cfa_offset 16
pushq %r14
.cfi_def_cfa_offset 24
pushq %rbx
.cfi_def_cfa_offset 32
subq $16, %rsp
.cfi_def_cfa_offset 48
.cfi_offset %rbx, -32
.cfi_offset %r14, -24
.cfi_offset %r15, -16
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq "std::tvalue::is_two_numbers"@PLT
testb $1, %al
je .LBB23_3
# %bb.1: # %ian
movq %r15, %rdi
callq "std::tvalue::get_value_number"@PLT
movss %xmm0, 8(%rsp) # 4-byte Spill
movq %r14, %rdi
callq "std::tvalue::get_value_number"@PLT
movaps %xmm0, %xmm1
movss 8(%rsp), %xmm0 # 4-byte Reload
# xmm0 = mem[0],zero,zero,zero
movss %xmm1, 12(%rsp) # 4-byte Spill
callq "std::tvalue::is_two_ints"@PLT
testb $1, %al
je .LBB23_3
# %bb.2: # %two_ints
cvttss2si 8(%rsp), %eax # 4-byte Folded Reload
cvttss2si 12(%rsp), %ecx # 4-byte Folded Reload
orl %eax, %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movq %rbx, %rdi
callq "std::tvalue::new_num"@PLT
movb $1, %al
jmp .LBB23_4
.LBB23_3: # %nan
xorl %eax, %eax
.LBB23_4: # %nan
addq $16, %rsp
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
retq
.Lfunc_end23:
.size "std::tvalue::bin_or", .Lfunc_end23-"std::tvalue::bin_or"
.cfi_endproc
# -- End function
.globl "std::tvalue::lsh" # -- Begin function std::tvalue::lsh
.p2align 4, 0x90
.type "std::tvalue::lsh",@function
"std::tvalue::lsh": # @"std::tvalue::lsh"
.cfi_startproc
# %bb.0: # %entry
pushq %r15
.cfi_def_cfa_offset 16
pushq %r14
.cfi_def_cfa_offset 24
pushq %rbx
.cfi_def_cfa_offset 32
subq $16, %rsp
.cfi_def_cfa_offset 48
.cfi_offset %rbx, -32
.cfi_offset %r14, -24
.cfi_offset %r15, -16
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq "std::tvalue::is_two_numbers"@PLT
testb $1, %al
je .LBB24_3
# %bb.1: # %ian
movq %r15, %rdi
callq "std::tvalue::get_value_number"@PLT
movss %xmm0, 8(%rsp) # 4-byte Spill
movq %r14, %rdi
callq "std::tvalue::get_value_number"@PLT
movaps %xmm0, %xmm1
movss 8(%rsp), %xmm0 # 4-byte Reload
# xmm0 = mem[0],zero,zero,zero
movss %xmm1, 12(%rsp) # 4-byte Spill
callq "std::tvalue::is_two_ints"@PLT
testb $1, %al
je .LBB24_3
# %bb.2: # %two_ints
cvttss2si 8(%rsp), %eax # 4-byte Folded Reload
cvttss2si 12(%rsp), %ecx # 4-byte Folded Reload
# kill: def $cl killed $cl killed $ecx
shll %cl, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movq %rbx, %rdi
callq "std::tvalue::new_num"@PLT
movb $1, %al
jmp .LBB24_4
.LBB24_3: # %nan
xorl %eax, %eax
.LBB24_4: # %nan
addq $16, %rsp
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
retq
.Lfunc_end24:
.size "std::tvalue::lsh", .Lfunc_end24-"std::tvalue::lsh"
.cfi_endproc
# -- End function
.globl "std::tvalue::rsh" # -- Begin function std::tvalue::rsh
.p2align 4, 0x90
.type "std::tvalue::rsh",@function
"std::tvalue::rsh": # @"std::tvalue::rsh"
.cfi_startproc
# %bb.0: # %entry
pushq %r15
.cfi_def_cfa_offset 16
pushq %r14
.cfi_def_cfa_offset 24
pushq %rbx
.cfi_def_cfa_offset 32
subq $16, %rsp
.cfi_def_cfa_offset 48
.cfi_offset %rbx, -32
.cfi_offset %r14, -24
.cfi_offset %r15, -16
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq "std::tvalue::is_two_numbers"@PLT
testb $1, %al
je .LBB25_3
# %bb.1: # %ian
movq %r15, %rdi
callq "std::tvalue::get_value_number"@PLT
movss %xmm0, 8(%rsp) # 4-byte Spill
movq %r14, %rdi
callq "std::tvalue::get_value_number"@PLT
movaps %xmm0, %xmm1
movss 8(%rsp), %xmm0 # 4-byte Reload
# xmm0 = mem[0],zero,zero,zero
movss %xmm1, 12(%rsp) # 4-byte Spill
callq "std::tvalue::is_two_ints"@PLT
testb $1, %al
je .LBB25_3
# %bb.2: # %two_ints
cvttss2si 8(%rsp), %eax # 4-byte Folded Reload
cvttss2si 12(%rsp), %ecx # 4-byte Folded Reload
# kill: def $cl killed $cl killed $ecx
sarl %cl, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movq %rbx, %rdi
callq "std::tvalue::new_num"@PLT
movb $1, %al
jmp .LBB25_4
.LBB25_3: # %nan
xorl %eax, %eax
.LBB25_4: # %nan
addq $16, %rsp
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
retq
.Lfunc_end25:
.size "std::tvalue::rsh", .Lfunc_end25-"std::tvalue::rsh"
.cfi_endproc
# -- End function
.globl "std::tvalue::bin_not" # -- Begin function std::tvalue::bin_not
.p2align 4, 0x90
.type "std::tvalue::bin_not",@function
"std::tvalue::bin_not": # @"std::tvalue::bin_not"
.cfi_startproc
# %bb.0: # %entry
pushq %r14
.cfi_def_cfa_offset 16
pushq %rbx
.cfi_def_cfa_offset 24
pushq %rax
.cfi_def_cfa_offset 32
.cfi_offset %rbx, -24
.cfi_offset %r14, -16
movq %rsi, %rbx
movq %rdi, %r14
callq "std::tvalue::is_number"@PLT
testb $1, %al
je .LBB26_2
# %bb.1: # %ian
movq %r14, %rdi
callq "std::tvalue::get_value_number"@PLT
movss %xmm0, 4(%rsp) # 4-byte Spill
callq "std::tvalue::is_int"@PLT
testb $1, %al
je .LBB26_2
# %bb.4: # %iai
cvttss2si 4(%rsp), %eax # 4-byte Folded Reload
notl %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movq %rbx, %rdi
callq "std::tvalue::new_num"@PLT
movb $1, %al
jmp .LBB26_3
.LBB26_2: # %no
xorl %eax, %eax
.LBB26_3: # %no
addq $8, %rsp
.cfi_def_cfa_offset 24
popq %rbx
.cfi_def_cfa_offset 16
popq %r14
.cfi_def_cfa_offset 8
retq
.Lfunc_end26:
.size "std::tvalue::bin_not", .Lfunc_end26-"std::tvalue::bin_not"
.cfi_endproc
# -- End function
.section .rodata.cst4,"aM",@progbits,4
.p2align 2, 0x0 # -- Begin function main
.LCPI27_0:
.long 0x3f800000 # float 1
.LCPI27_1:
.long 0x40200000 # float 2.5
.text
.globl main
.p2align 4, 0x90
.type main,@function
main: # @main
.cfi_startproc
# %bb.0: # %entry
pushq %r15
.cfi_def_cfa_offset 16
pushq %r14
.cfi_def_cfa_offset 24
pushq %rbx
.cfi_def_cfa_offset 32
subq $96, %rsp
.cfi_def_cfa_offset 128
.cfi_offset %rbx, -32
.cfi_offset %r14, -24
.cfi_offset %r15, -16
leaq 72(%rsp), %rbx
movq %rbx, %rdi
callq "std::tvalue::new_nil"@PLT
movss .LCPI27_0(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
movq %rbx, %rdi
callq "std::tvalue::new_num"@PLT
movq %rbx, %rdi
callq "std::tvalue::test::print_tvalue"@PLT
leaq 48(%rsp), %r14
movq %r14, %rdi
callq "std::tvalue::new_nil"@PLT
movss .LCPI27_1(%rip), %xmm0 # xmm0 = mem[0],zero,zero,zero
movq %r14, %rdi
callq "std::tvalue::new_num"@PLT
movq %r14, %rdi
callq "std::tvalue::test::print_tvalue"@PLT
leaq 24(%rsp), %r15
movq %r15, %rdi
callq "std::tvalue::new_nil"@PLT
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq "std::tvalue::add"@PLT
movq %r15, %rdi
callq "std::tvalue::test::print_tvalue"@PLT
movq %rsp, %rbx
movq %rbx, %rdi
callq "std::tvalue::new_nil"@PLT
movq %rbx, %rdi
movl $13, %esi
callq "std::tvalue::new_str"@PLT
movq 16(%rsp), %rax
movabsq $8583983401233901602, %rcx # imm = 0x77206F6C6C656822
movq %rcx, (%rax)
movb $34, 12(%rax)
movl $1684828783, 8(%rax) # imm = 0x646C726F
movl $13, 4(%rsp)
movq %rbx, %rdi
callq "std::tvalue::test::print_tvalue"@PLT
addq $96, %rsp
.cfi_def_cfa_offset 32
popq %rbx
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
retq
.Lfunc_end27:
.size main, .Lfunc_end27-main
.cfi_endproc
# -- End function
.type "tvalue::names::nil",@object # @"tvalue::names::nil"
.data
.globl "tvalue::names::nil"
"tvalue::names::nil":
.asciz "nil\n"
.size "tvalue::names::nil", 5
.type "tvalue::names::true",@object # @"tvalue::names::true"
.globl "tvalue::names::true"
"tvalue::names::true":
.asciz "true\n"
.size "tvalue::names::true", 6
.type "tvalue::names::false",@object # @"tvalue::names::false"
.globl "tvalue::names::false"
"tvalue::names::false":
.asciz "false\n"
.size "tvalue::names::false", 7
.type "tvalue::names::float_fmt",@object # @"tvalue::names::float_fmt"
.globl "tvalue::names::float_fmt"
"tvalue::names::float_fmt":
.asciz "%f\n"
.size "tvalue::names::float_fmt", 4
.section ".note.GNU-stack","",@progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment