Skip to content

Instantly share code, notes, and snippets.

@nickdesaulniers
Created September 11, 2013 00:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickdesaulniers/6517782 to your computer and use it in GitHub Desktop.
Save nickdesaulniers/6517782 to your computer and use it in GitHub Desktop.
CLANG_ADD_VERSION=3.3 LLVM_ADD_VERSION=3.3 emcc hello_world.ll
; ModuleID = 'Crystal'
%String.0 = type { i32, i8 }
%MatchData = type { %String.0*, %String.0*, i32, i32*, i32 }
%StringBuilder.1 = type { i32, %"Array(String).2"* }
%"Array(String).2" = type { i32, i32, %String.0** }
%"struct.ABI::UnwindException" = type { i64, i64, i64, i64, i64, i32 }
%"Nil | UInt64" = type <{ i32, [2 x i32] }>
@symbol_table = internal global [0 x %String.0*] zeroinitializer
@"MatchData::EMPTY" = internal global %MatchData* null
@str = private constant [5 x i8] zeroinitializer
@"$~" = internal global %MatchData* null
@"ABI::UA_SEARCH_PHASE" = internal constant i32 1
@"ABI::URC_HANDLER_FOUND" = internal constant i32 6
@"ABI::UA_HANDLER_FRAME" = internal constant i32 4
@"ABI::URC_INSTALL_CONTEXT" = internal constant i32 7
@"ABI::URC_CONTINUE_UNWIND" = internal constant i32 8
@str1 = private constant [20 x i8] c"\0F\00\00\00Could not raise\00"
@str2 = private constant [10 x i8] c"\05\00\00\00hello\00"
@str3 = private constant [12 x i8] c"\07\00\00\00 world!\00"
define i1 @__crystal_main(i32 %argc, i8** %argv) {
alloca:
%a = alloca %String.0*
%b = alloca %String.0*
br label %const
const: ; preds = %alloca
br label %"const_MatchData::EMPTY"
entry: ; preds = %"const_MatchData::EMPTY"
%0 = load %MatchData** @"MatchData::EMPTY"
store %MatchData* %0, %MatchData** @"$~"
store %String.0* bitcast ([10 x i8]* @str2 to %String.0*), %String.0** %a
%1 = call %StringBuilder.1* @"*StringBuilder::new<StringBuilder:Class>:StringBuilder"(i32 69)
%a1 = load %String.0** %a
%2 = call %StringBuilder.1* @"*StringBuilder#<<<StringBuilder, String>:StringBuilder"(%StringBuilder.1* %1, %String.0* %a1)
%3 = call %StringBuilder.1* @"*StringBuilder#<<<StringBuilder, String>:StringBuilder"(%StringBuilder.1* %2, %String.0* bitcast ([12 x i8]* @str3 to %String.0*))
%4 = call %String.0* @"*StringBuilder#to_s<StringBuilder>:String"(%StringBuilder.1* %3)
store %String.0* %4, %String.0** %b
%b2 = load %String.0** %b
%5 = call i1 @"*puts<String>:Nil"(%String.0* %b2)
ret i1 %5
"const_MatchData::EMPTY": ; preds = %const
%6 = call i32* @"*Pointer(Int32)::malloc<Pointer(Int32):Class, Int32>:Pointer(Int32)"(i32 1, i32 0)
%7 = call %MatchData* @"*MatchData::new<MatchData:Class, String, String, Int32, Pointer(Int32), Int32>:MatchData"(i32 52, %String.0* bitcast ([5 x i8]* @str to %String.0*), %String.0* bitcast ([5 x i8]* @str to %String.0*), i32 0, i32* %6, i32 0)
store %MatchData* %7, %MatchData** @"MatchData::EMPTY"
br label %entry
}
define internal i32* @"*Pointer(Int32)::malloc<Pointer(Int32):Class, Int32>:Pointer(Int32)"(i32 %self, i32 %size) {
alloca:
%size1 = alloca i32
br label %entry
entry: ; preds = %alloca
store i32 %size, i32* %size1
%size2 = load i32* %size1
%0 = call i64 @"*Int32#to_u64<Int32>:UInt64"(i32 %size2)
%1 = call i32* @"*Pointer(Int32)::malloc<Pointer(Int32):Class, UInt64>:Pointer(Int32)"(i32 %self, i64 %0)
ret i32* %1
}
define internal i64 @"*Int32#to_u64<Int32>:UInt64"(i32 %self) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = sext i32 %self to i64
ret i64 %0
}
define internal i32* @"*Pointer(Int32)::malloc<Pointer(Int32):Class, UInt64>:Pointer(Int32)"(i32 %self, i64 %size) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = trunc i64 %size to i32
%mallocsize = mul i32 %0, ptrtoint (i32* getelementptr (i32* null, i32 1) to i32)
%malloccall = tail call i8* @malloc(i32 %mallocsize)
%1 = bitcast i8* %malloccall to i32*
ret i32* %1
}
declare noalias i8* @malloc(i32)
define internal %MatchData* @"*MatchData::new<MatchData:Class, String, String, Int32, Pointer(Int32), Int32>:MatchData"(i32 %self, %String.0* %arg0, %String.0* %arg1, i32 %arg2, i32* %arg3, i32 %arg4) {
alloca:
%arg01 = alloca %String.0*
%arg12 = alloca %String.0*
%arg23 = alloca i32
%arg34 = alloca i32*
%arg45 = alloca i32
%x = alloca %MatchData*
br label %entry
entry: ; preds = %alloca
store %String.0* %arg0, %String.0** %arg01
store %String.0* %arg1, %String.0** %arg12
store i32 %arg2, i32* %arg23
store i32* %arg3, i32** %arg34
store i32 %arg4, i32* %arg45
%0 = call %MatchData* @"*MatchData::allocate<MatchData:Class>:MatchData"(i32 %self)
store %MatchData* %0, %MatchData** %x
%x6 = load %MatchData** %x
%arg07 = load %String.0** %arg01
%arg18 = load %String.0** %arg12
%arg29 = load i32* %arg23
%arg310 = load i32** %arg34
%arg411 = load i32* %arg45
%1 = call i32 @"*MatchData#initialize<MatchData, String, String, Int32, Pointer(Int32), Int32>:Int32"(%MatchData* %x6, %String.0* %arg07, %String.0* %arg18, i32 %arg29, i32* %arg310, i32 %arg411)
%x12 = load %MatchData** %x
ret %MatchData* %x12
}
define internal %MatchData* @"*MatchData::allocate<MatchData:Class>:MatchData"(i32 %self) {
alloca:
br label %entry
entry: ; preds = %alloca
%malloccall = tail call i8* @malloc(i32 ptrtoint (%MatchData* getelementptr (%MatchData* null, i32 1) to i32))
%0 = bitcast i8* %malloccall to %MatchData*
%1 = bitcast %MatchData* %0 to i8*
call void @llvm.memset.p0i8.i32(i8* %1, i8 0, i32 ptrtoint (%MatchData* getelementptr (%MatchData* null, i32 1) to i32), i32 4, i1 false)
ret %MatchData* %0
}
; Function Attrs: nounwind
declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) #0
define internal i32 @"*MatchData#initialize<MatchData, String, String, Int32, Pointer(Int32), Int32>:Int32"(%MatchData* %self, %String.0* %regex, %String.0* %string, i32 %pos, i32* %ovector, i32 %length) {
alloca:
%regex1 = alloca %String.0*
%string2 = alloca %String.0*
%pos3 = alloca i32
%ovector4 = alloca i32*
%length5 = alloca i32
br label %entry
entry: ; preds = %alloca
store %String.0* %regex, %String.0** %regex1
store %String.0* %string, %String.0** %string2
store i32 %pos, i32* %pos3
store i32* %ovector, i32** %ovector4
store i32 %length, i32* %length5
%regex6 = load %String.0** %regex1
%0 = getelementptr %MatchData* %self, i32 0, i32 0
store %String.0* %regex6, %String.0** %0
%string7 = load %String.0** %string2
%1 = getelementptr %MatchData* %self, i32 0, i32 1
store %String.0* %string7, %String.0** %1
%pos8 = load i32* %pos3
%2 = getelementptr %MatchData* %self, i32 0, i32 2
store i32 %pos8, i32* %2
%ovector9 = load i32** %ovector4
%3 = getelementptr %MatchData* %self, i32 0, i32 3
store i32* %ovector9, i32** %3
%length10 = load i32* %length5
%4 = getelementptr %MatchData* %self, i32 0, i32 4
store i32 %length10, i32* %4
ret i32 %length10
}
define i32 @__crystal_personality(i32 %version, i32 %actions, i64 %exception_class, %"struct.ABI::UnwindException"* %exception_object, i8* %context) {
alloca:
%version1 = alloca i32
%actions2 = alloca i32
%exception_class3 = alloca i64
%exception_object4 = alloca %"struct.ABI::UnwindException"*
%context5 = alloca i8*
%start = alloca i64
%ip = alloca i64
%throw_offset = alloca i64
%lsd = alloca i8*
%0 = alloca %"Nil | UInt64"
%cs_table_length = alloca i64
%cs_table_end = alloca i8*
%cs_offset = alloca i32
%cs_length = alloca i32
%cs_addr = alloca i32
%action = alloca i64
%"#temp_192" = alloca i1
%"#temp_193" = alloca i1
%"lsd:1" = alloca i8*
%"#temp_194" = alloca i1
%"#temp_195" = alloca i1
%"lsd:2" = alloca i8*
%"#temp_196" = alloca i1
br label %entry
entry: ; preds = %alloca
store i32 %version, i32* %version1
store i32 %actions, i32* %actions2
store i64 %exception_class, i64* %exception_class3
store %"struct.ABI::UnwindException"* %exception_object, %"struct.ABI::UnwindException"** %exception_object4
store i8* %context, i8** %context5
%context6 = load i8** %context5
%1 = call i64 @_Unwind_GetRegionStart(i8* %context6)
store i64 %1, i64* %start
%context7 = load i8** %context5
%2 = call i64 @_Unwind_GetIP(i8* %context7)
store i64 %2, i64* %ip
%ip8 = load i64* %ip
%3 = call i64 @"*UInt64#-<UInt64, Int32>:UInt64"(i64 %ip8, i32 1)
%start9 = load i64* %start
%4 = call i64 @"*UInt64#-<UInt64, UInt64>:UInt64"(i64 %3, i64 %start9)
store i64 %4, i64* %throw_offset
%context10 = load i8** %context5
%5 = call i8* @_Unwind_GetLanguageSpecificData(i8* %context10)
store i8* %5, i8** %lsd
%6 = call i8 @"*LEBReader::read_uint8<LEBReader:Class, Pointer(Pointer(UInt8))>:UInt8"(i32 83, i8** %lsd)
%7 = call i8 @"*LEBReader::read_uint8<LEBReader:Class, Pointer(Pointer(UInt8))>:UInt8"(i32 83, i8** %lsd)
%8 = call i1 @"*UInt8#!=<UInt8, UInt8>:Bool"(i8 %7, i8 -1)
%9 = icmp ne i1 %8, false
br i1 %9, label %then, label %else
then: ; preds = %entry
%10 = call i64 @"*LEBReader::read_uleb128<LEBReader:Class, Pointer(Pointer(UInt8))>:UInt64"(i32 83, i8** %lsd)
%11 = getelementptr %"Nil | UInt64"* %0, i32 0, i32 0
%12 = getelementptr %"Nil | UInt64"* %0, i32 0, i32 1
store i32 11, i32* %11
%13 = bitcast [2 x i32]* %12 to i64*
store i64 %10, i64* %13
br label %exit
else: ; preds = %entry
%14 = getelementptr %"Nil | UInt64"* %0, i32 0, i32 0
%15 = getelementptr %"Nil | UInt64"* %0, i32 0, i32 1
store i32 0, i32* %14
%16 = bitcast [2 x i32]* %15 to i1*
store i1 false, i1* %16
br label %exit
exit: ; preds = %else, %then
%17 = call i8 @"*LEBReader::read_uint8<LEBReader:Class, Pointer(Pointer(UInt8))>:UInt8"(i32 83, i8** %lsd)
%18 = call i64 @"*LEBReader::read_uleb128<LEBReader:Class, Pointer(Pointer(UInt8))>:UInt64"(i32 83, i8** %lsd)
store i64 %18, i64* %cs_table_length
%lsd11 = load i8** %lsd
%cs_table_length12 = load i64* %cs_table_length
%19 = call i8* @"*Pointer(UInt8)#+<Pointer(UInt8), UInt64>:Pointer(UInt8)"(i8* %lsd11, i64 %cs_table_length12)
store i8* %19, i8** %cs_table_end
br label %while
while: ; preds = %exit19, %exit
%lsd14 = load i8** %lsd
%cs_table_end15 = load i8** %cs_table_end
%20 = call i1 @"*Pointer(UInt8)#<<Pointer(UInt8), Pointer(UInt8)>:Bool"(i8* %lsd14, i8* %cs_table_end15)
%21 = icmp ne i1 %20, false
br i1 %21, label %body, label %exit13
body: ; preds = %while
%22 = call i32 @"*LEBReader::read_uint32<LEBReader:Class, Pointer(Pointer(UInt8))>:UInt32"(i32 83, i8** %lsd)
store i32 %22, i32* %cs_offset
%23 = call i32 @"*LEBReader::read_uint32<LEBReader:Class, Pointer(Pointer(UInt8))>:UInt32"(i32 83, i8** %lsd)
store i32 %23, i32* %cs_length
%24 = call i32 @"*LEBReader::read_uint32<LEBReader:Class, Pointer(Pointer(UInt8))>:UInt32"(i32 83, i8** %lsd)
store i32 %24, i32* %cs_addr
%25 = call i64 @"*LEBReader::read_uleb128<LEBReader:Class, Pointer(Pointer(UInt8))>:UInt64"(i32 83, i8** %lsd)
store i64 %25, i64* %action
%cs_addr16 = load i32* %cs_addr
%26 = call i1 @"*UInt32#!=<UInt32, Int32>:Bool"(i32 %cs_addr16, i32 0)
%27 = icmp ne i1 %26, false
br i1 %27, label %then17, label %else18
exit13: ; preds = %while
%28 = load i32* @"ABI::URC_CONTINUE_UNWIND"
ret i32 %28
then17: ; preds = %body
%cs_offset20 = load i32* %cs_offset
%throw_offset21 = load i64* %throw_offset
%29 = call i1 @"*UInt32#<=<UInt32, UInt64>:Bool"(i32 %cs_offset20, i64 %throw_offset21)
store i1 %29, i1* %"#temp_192"
%30 = icmp ne i1 %29, false
br i1 %30, label %then22, label %else23
else18: ; preds = %body
%lsd53 = load i8** %lsd
store i8* %lsd53, i8** %"lsd:2"
br label %exit19
exit19: ; preds = %else18, %exit35
%31 = phi i1 [ %"#temp_19552", %exit35 ], [ false, %else18 ]
store i1 %31, i1* %"#temp_196"
%"lsd:254" = load i8** %"lsd:2"
store i8* %"lsd:254", i8** %lsd
%"#temp_19655" = load i1* %"#temp_196"
br label %while
then22: ; preds = %then17
%throw_offset25 = load i64* %throw_offset
%cs_offset26 = load i32* %cs_offset
%cs_length27 = load i32* %cs_length
%32 = call i32 @"*UInt32#+<UInt32, UInt32>:UInt32"(i32 %cs_offset26, i32 %cs_length27)
%33 = call i1 @"*UInt64#<=<UInt64, UInt32>:Bool"(i64 %throw_offset25, i32 %32)
store i1 %33, i1* %"#temp_193"
%lsd28 = load i8** %lsd
store i8* %lsd28, i8** %"lsd:1"
%"#temp_19329" = load i1* %"#temp_193"
br label %exit24
else23: ; preds = %then17
%"#temp_19230" = load i1* %"#temp_192"
store i1 %"#temp_19230", i1* %"#temp_194"
%lsd31 = load i8** %lsd
store i8* %lsd31, i8** %"lsd:1"
%"#temp_19432" = load i1* %"#temp_194"
br label %exit24
exit24: ; preds = %else23, %then22
%34 = phi i1 [ %"#temp_19329", %then22 ], [ %"#temp_19432", %else23 ]
%35 = icmp ne i1 %34, false
br i1 %35, label %then33, label %else34
then33: ; preds = %exit24
%actions36 = load i32* %actions2
%36 = load i32* @"ABI::UA_SEARCH_PHASE"
%37 = call i32 @"*Int32#&<Int32, Int32>:Int32"(i32 %actions36, i32 %36)
%38 = call i1 @"*Int32#><Int32, Int32>:Bool"(i32 %37, i32 0)
%39 = icmp ne i1 %38, false
br i1 %39, label %then37, label %else38
else34: ; preds = %exit24
br label %exit35
exit35: ; preds = %else34, %exit43
%40 = phi i1 [ %57, %exit43 ], [ false, %else34 ]
store i1 %40, i1* %"#temp_195"
%"lsd:151" = load i8** %"lsd:1"
store i8* %"lsd:151", i8** %"lsd:2"
%"#temp_19552" = load i1* %"#temp_195"
br label %exit19
then37: ; preds = %then33
%41 = load i32* @"ABI::URC_HANDLER_FOUND"
ret i32 %41
else38: ; preds = %then33
br label %exit39
exit39: ; preds = %else38
%42 = phi i1 [ false, %else38 ]
%actions40 = load i32* %actions2
%43 = load i32* @"ABI::UA_HANDLER_FRAME"
%44 = call i32 @"*Int32#&<Int32, Int32>:Int32"(i32 %actions40, i32 %43)
%45 = call i1 @"*Int32#><Int32, Int32>:Bool"(i32 %44, i32 0)
%46 = icmp ne i1 %45, false
br i1 %46, label %then41, label %else42
then41: ; preds = %exit39
%context44 = load i8** %context5
%exception_object45 = load %"struct.ABI::UnwindException"** %exception_object4
%47 = call i64 @"*Pointer(ABI::UnwindException)#address<Pointer(ABI::UnwindException)>:UInt64"(%"struct.ABI::UnwindException"* %exception_object45)
%48 = call i64 @"*UInt64#+<UInt64, UInt64>:UInt64"(i64 0, i64 %47)
%49 = call i1 @_Unwind_SetGR(i8* %context44, i32 0, i64 %48)
%context46 = load i8** %context5
%exception_object47 = load %"struct.ABI::UnwindException"** %exception_object4
%50 = call %"struct.ABI::UnwindException"* @"*Pointer(ABI::UnwindException)#value<Pointer(ABI::UnwindException)>:struct.ABI::UnwindException"(%"struct.ABI::UnwindException"* %exception_object47)
%51 = call i32 @"*struct.ABI::UnwindException#exception_type_id<struct.ABI::UnwindException>:Int32"(%"struct.ABI::UnwindException"* %50)
%52 = call i64 @"*UInt64#+<UInt64, Int32>:UInt64"(i64 0, i32 %51)
%53 = call i1 @_Unwind_SetGR(i8* %context46, i32 1, i64 %52)
%context48 = load i8** %context5
%start49 = load i64* %start
%cs_addr50 = load i32* %cs_addr
%54 = call i64 @"*UInt64#+<UInt64, UInt32>:UInt64"(i64 %start49, i32 %cs_addr50)
%55 = call i64 @_Unwind_SetIP(i8* %context48, i64 %54)
%56 = load i32* @"ABI::URC_INSTALL_CONTEXT"
ret i32 %56
else42: ; preds = %exit39
br label %exit43
exit43: ; preds = %else42
%57 = phi i1 [ false, %else42 ]
br label %exit35
}
declare i64 @_Unwind_GetRegionStart(i8*)
declare i64 @_Unwind_GetIP(i8*)
define internal i64 @"*UInt64#-<UInt64, Int32>:UInt64"(i64 %self, i32 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = sext i32 %other to i64
%1 = sub i64 %self, %0
ret i64 %1
}
define internal i64 @"*UInt64#-<UInt64, UInt64>:UInt64"(i64 %self, i64 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = sub i64 %self, %other
ret i64 %0
}
declare i8* @_Unwind_GetLanguageSpecificData(i8*)
define internal i8 @"*LEBReader::read_uint8<LEBReader:Class, Pointer(Pointer(UInt8))>:UInt8"(i32 %self, i8** %data) {
alloca:
%data1 = alloca i8**
%value = alloca i8
br label %entry
entry: ; preds = %alloca
store i8** %data, i8*** %data1
%data2 = load i8*** %data1
%0 = call i8* @"*Pointer(Pointer(UInt8))#value<Pointer(Pointer(UInt8))>:Pointer(UInt8)"(i8** %data2)
%1 = call i8* @"*Pointer(UInt8)#as<Pointer(UInt8), UInt8:Class>:Pointer(UInt8)"(i8* %0, i32 8)
%2 = call i8 @"*Pointer(UInt8)#value<Pointer(UInt8)>:UInt8"(i8* %1)
store i8 %2, i8* %value
%data3 = load i8*** %data1
%data4 = load i8*** %data1
%3 = call i8* @"*Pointer(Pointer(UInt8))#value<Pointer(Pointer(UInt8))>:Pointer(UInt8)"(i8** %data4)
%4 = call i8* @"*Pointer(UInt8)#+<Pointer(UInt8), Int32>:Pointer(UInt8)"(i8* %3, i32 1)
%5 = call i8* @"*Pointer(Pointer(UInt8))#value=<Pointer(Pointer(UInt8)), Pointer(UInt8)>:Pointer(UInt8)"(i8** %data3, i8* %4)
%value5 = load i8* %value
ret i8 %value5
}
define internal i8* @"*Pointer(Pointer(UInt8))#value<Pointer(Pointer(UInt8))>:Pointer(UInt8)"(i8** %self) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = load i8** %self
ret i8* %0
}
define internal i8* @"*Pointer(UInt8)#as<Pointer(UInt8), UInt8:Class>:Pointer(UInt8)"(i8* %self, i32 %type) {
alloca:
br label %entry
entry: ; preds = %alloca
ret i8* %self
}
define internal i8 @"*Pointer(UInt8)#value<Pointer(UInt8)>:UInt8"(i8* %self) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = load i8* %self
ret i8 %0
}
define internal i8* @"*Pointer(UInt8)#+<Pointer(UInt8), Int32>:Pointer(UInt8)"(i8* %self, i32 %other) {
alloca:
%other1 = alloca i32
br label %entry
entry: ; preds = %alloca
store i32 %other, i32* %other1
%other2 = load i32* %other1
%0 = call i64 @"*Int32#to_i64<Int32>:Int64"(i32 %other2)
%1 = call i8* @"*Pointer(UInt8)#+<Pointer(UInt8), Int64>:Pointer(UInt8)"(i8* %self, i64 %0)
ret i8* %1
}
define internal i64 @"*Int32#to_i64<Int32>:Int64"(i32 %self) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = sext i32 %self to i64
ret i64 %0
}
define internal i8* @"*Pointer(UInt8)#+<Pointer(UInt8), Int64>:Pointer(UInt8)"(i8* %self, i64 %offset) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = getelementptr i8* %self, i64 %offset
ret i8* %0
}
define internal i8* @"*Pointer(Pointer(UInt8))#value=<Pointer(Pointer(UInt8)), Pointer(UInt8)>:Pointer(UInt8)"(i8** %self, i8* %value) {
alloca:
br label %entry
entry: ; preds = %alloca
store i8* %value, i8** %self
ret i8* %value
}
define internal i1 @"*UInt8#!=<UInt8, UInt8>:Bool"(i8 %self, i8 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = icmp ne i8 %self, %other
ret i1 %0
}
define internal i64 @"*LEBReader::read_uleb128<LEBReader:Class, Pointer(Pointer(UInt8))>:UInt64"(i32 %self, i8** %data) {
alloca:
%data1 = alloca i8**
%result = alloca i64
%shift = alloca i32
%byte = alloca i8
%"result:1" = alloca i64
%"shift:1" = alloca i32
%"#temp_191" = alloca i32
br label %entry
entry: ; preds = %alloca
store i8** %data, i8*** %data1
store i64 0, i64* %result
store i32 0, i32* %shift
br label %while
while: ; preds = %exit7, %entry
br i1 true, label %body, label %exit
body: ; preds = %while
%data2 = load i8*** %data1
%0 = call i8 @"*LEBReader::read_uint8<LEBReader:Class, Pointer(Pointer(UInt8))>:UInt8"(i32 %self, i8** %data2)
store i8 %0, i8* %byte
%result3 = load i64* %result
%byte4 = load i8* %byte
%1 = call i64 @"*UInt64#&<UInt64, UInt8>:UInt64"(i64 127, i8 %byte4)
%shift5 = load i32* %shift
%2 = call i64 @"*UInt64#<<<UInt64, Int32>:UInt64"(i64 %1, i32 %shift5)
%3 = call i64 @"*UInt64#|<UInt64, UInt64>:UInt64"(i64 %result3, i64 %2)
store i64 %3, i64* %"result:1"
%byte6 = load i8* %byte
%4 = call i8 @"*UInt8#&<UInt8, UInt8>:UInt8"(i8 %byte6, i8 -128)
%5 = call i1 @"*UInt8#==<UInt8, Int32>:Bool"(i8 %4, i32 0)
%6 = icmp ne i1 %5, false
br i1 %6, label %then, label %else
exit: ; preds = %then, %while
%result13 = load i64* %result
ret i64 %result13
then: ; preds = %body
%"result:18" = load i64* %"result:1"
store i64 %"result:18", i64* %result
br label %exit
else: ; preds = %body
br label %exit7
exit7: ; preds = %else
%7 = phi i1 [ false, %else ]
%shift9 = load i32* %shift
%8 = call i32 @"*Int32#+<Int32, Int32>:Int32"(i32 %shift9, i32 7)
store i32 %8, i32* %"shift:1"
store i32 %8, i32* %"#temp_191"
%"result:110" = load i64* %"result:1"
store i64 %"result:110", i64* %result
%"shift:111" = load i32* %"shift:1"
store i32 %"shift:111", i32* %shift
%"#temp_19112" = load i32* %"#temp_191"
br label %while
}
define internal i64 @"*UInt64#&<UInt64, UInt8>:UInt64"(i64 %self, i8 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = zext i8 %other to i64
%1 = and i64 %self, %0
ret i64 %1
}
define internal i64 @"*UInt64#<<<UInt64, Int32>:UInt64"(i64 %self, i32 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = sext i32 %other to i64
%1 = shl i64 %self, %0
ret i64 %1
}
define internal i64 @"*UInt64#|<UInt64, UInt64>:UInt64"(i64 %self, i64 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = or i64 %self, %other
ret i64 %0
}
define internal i8 @"*UInt8#&<UInt8, UInt8>:UInt8"(i8 %self, i8 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = and i8 %self, %other
ret i8 %0
}
define internal i1 @"*UInt8#==<UInt8, Int32>:Bool"(i8 %self, i32 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = zext i8 %self to i32
%1 = icmp eq i32 %0, %other
ret i1 %1
}
define internal i32 @"*Int32#+<Int32, Int32>:Int32"(i32 %self, i32 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = add i32 %self, %other
ret i32 %0
}
define internal i8* @"*Pointer(UInt8)#+<Pointer(UInt8), UInt64>:Pointer(UInt8)"(i8* %self, i64 %other) {
alloca:
%other1 = alloca i64
br label %entry
entry: ; preds = %alloca
store i64 %other, i64* %other1
%other2 = load i64* %other1
%0 = call i64 @"*UInt64#to_i64<UInt64>:Int64"(i64 %other2)
%1 = call i8* @"*Pointer(UInt8)#+<Pointer(UInt8), Int64>:Pointer(UInt8)"(i8* %self, i64 %0)
ret i8* %1
}
define internal i64 @"*UInt64#to_i64<UInt64>:Int64"(i64 %self) {
alloca:
br label %entry
entry: ; preds = %alloca
ret i64 %self
}
define internal i1 @"*Pointer(UInt8)#<<Pointer(UInt8), Pointer(UInt8)>:Bool"(i8* %self, i8* %other) {
alloca:
%other1 = alloca i8*
br label %entry
entry: ; preds = %alloca
store i8* %other, i8** %other1
%other2 = load i8** %other1
%0 = call i32 @"*Pointer(UInt8)#<=><Pointer(UInt8), Pointer(UInt8)>:Int32"(i8* %self, i8* %other2)
%1 = call i1 @"*Int32#<<Int32, Int32>:Bool"(i32 %0, i32 0)
ret i1 %1
}
define internal i32 @"*Pointer(UInt8)#<=><Pointer(UInt8), Pointer(UInt8)>:Int32"(i8* %self, i8* %other) {
alloca:
%other1 = alloca i8*
br label %entry
entry: ; preds = %alloca
store i8* %other, i8** %other1
%0 = call i64 @"*Pointer(UInt8)#address<Pointer(UInt8)>:UInt64"(i8* %self)
%other2 = load i8** %other1
%1 = call i64 @"*Pointer(UInt8)#address<Pointer(UInt8)>:UInt64"(i8* %other2)
%2 = call i32 @"*UInt64#<=><UInt64, UInt64>:Int32"(i64 %0, i64 %1)
ret i32 %2
}
define internal i64 @"*Pointer(UInt8)#address<Pointer(UInt8)>:UInt64"(i8* %self) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = ptrtoint i8* %self to i64
ret i64 %0
}
define internal i32 @"*UInt64#<=><UInt64, UInt64>:Int32"(i64 %self, i64 %other) {
alloca:
%other1 = alloca i64
br label %entry
entry: ; preds = %alloca
store i64 %other, i64* %other1
%other2 = load i64* %other1
%0 = call i1 @"*UInt64#><UInt64, UInt64>:Bool"(i64 %self, i64 %other2)
%1 = icmp ne i1 %0, false
br i1 %1, label %then, label %else
then: ; preds = %entry
br label %exit
else: ; preds = %entry
%other3 = load i64* %other1
%2 = call i1 @"*UInt64#<<UInt64, UInt64>:Bool"(i64 %self, i64 %other3)
%3 = icmp ne i1 %2, false
br i1 %3, label %then4, label %else5
exit: ; preds = %exit6, %then
%4 = phi i32 [ 1, %then ], [ %5, %exit6 ]
ret i32 %4
then4: ; preds = %else
br label %exit6
else5: ; preds = %else
br label %exit6
exit6: ; preds = %else5, %then4
%5 = phi i32 [ -1, %then4 ], [ 0, %else5 ]
br label %exit
}
define internal i1 @"*UInt64#><UInt64, UInt64>:Bool"(i64 %self, i64 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = icmp ugt i64 %self, %other
ret i1 %0
}
define internal i1 @"*UInt64#<<UInt64, UInt64>:Bool"(i64 %self, i64 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = icmp ult i64 %self, %other
ret i1 %0
}
define internal i1 @"*Int32#<<Int32, Int32>:Bool"(i32 %self, i32 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = icmp slt i32 %self, %other
ret i1 %0
}
define internal i32 @"*LEBReader::read_uint32<LEBReader:Class, Pointer(Pointer(UInt8))>:UInt32"(i32 %self, i8** %data) {
alloca:
%data1 = alloca i8**
%value = alloca i32
br label %entry
entry: ; preds = %alloca
store i8** %data, i8*** %data1
%data2 = load i8*** %data1
%0 = call i8* @"*Pointer(Pointer(UInt8))#value<Pointer(Pointer(UInt8))>:Pointer(UInt8)"(i8** %data2)
%1 = call i32* @"*Pointer(UInt8)#as<Pointer(UInt8), UInt32:Class>:Pointer(UInt32)"(i8* %0, i32 10)
%2 = call i32 @"*Pointer(UInt32)#value<Pointer(UInt32)>:UInt32"(i32* %1)
store i32 %2, i32* %value
%data3 = load i8*** %data1
%data4 = load i8*** %data1
%3 = call i8* @"*Pointer(Pointer(UInt8))#value<Pointer(Pointer(UInt8))>:Pointer(UInt8)"(i8** %data4)
%4 = call i8* @"*Pointer(UInt8)#+<Pointer(UInt8), Int32>:Pointer(UInt8)"(i8* %3, i32 4)
%5 = call i8* @"*Pointer(Pointer(UInt8))#value=<Pointer(Pointer(UInt8)), Pointer(UInt8)>:Pointer(UInt8)"(i8** %data3, i8* %4)
%value5 = load i32* %value
ret i32 %value5
}
define internal i32* @"*Pointer(UInt8)#as<Pointer(UInt8), UInt32:Class>:Pointer(UInt32)"(i8* %self, i32 %type) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = bitcast i8* %self to i32*
ret i32* %0
}
define internal i32 @"*Pointer(UInt32)#value<Pointer(UInt32)>:UInt32"(i32* %self) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = load i32* %self
ret i32 %0
}
define internal i1 @"*UInt32#!=<UInt32, Int32>:Bool"(i32 %self, i32 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = icmp ne i32 %self, %other
ret i1 %0
}
define internal i1 @"*UInt32#<=<UInt32, UInt64>:Bool"(i32 %self, i64 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = zext i32 %self to i64
%1 = icmp ule i64 %0, %other
ret i1 %1
}
define internal i32 @"*UInt32#+<UInt32, UInt32>:UInt32"(i32 %self, i32 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = add i32 %self, %other
ret i32 %0
}
define internal i1 @"*UInt64#<=<UInt64, UInt32>:Bool"(i64 %self, i32 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = zext i32 %other to i64
%1 = icmp ule i64 %self, %0
ret i1 %1
}
define internal i32 @"*Int32#&<Int32, Int32>:Int32"(i32 %self, i32 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = and i32 %self, %other
ret i32 %0
}
define internal i1 @"*Int32#><Int32, Int32>:Bool"(i32 %self, i32 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = icmp sgt i32 %self, %other
ret i1 %0
}
define internal i64 @"*Pointer(ABI::UnwindException)#address<Pointer(ABI::UnwindException)>:UInt64"(%"struct.ABI::UnwindException"* %self) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = ptrtoint %"struct.ABI::UnwindException"* %self to i64
ret i64 %0
}
define internal i64 @"*UInt64#+<UInt64, UInt64>:UInt64"(i64 %self, i64 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = add i64 %self, %other
ret i64 %0
}
declare i1 @_Unwind_SetGR(i8*, i32, i64)
define internal %"struct.ABI::UnwindException"* @"*Pointer(ABI::UnwindException)#value<Pointer(ABI::UnwindException)>:struct.ABI::UnwindException"(%"struct.ABI::UnwindException"* %self) {
alloca:
br label %entry
entry: ; preds = %alloca
ret %"struct.ABI::UnwindException"* %self
}
define internal i32 @"*struct.ABI::UnwindException#exception_type_id<struct.ABI::UnwindException>:Int32"(%"struct.ABI::UnwindException"* %self) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = load %"struct.ABI::UnwindException"* %self
%exception_type_id = extractvalue %"struct.ABI::UnwindException" %0, 5
ret i32 %exception_type_id
}
define internal i64 @"*UInt64#+<UInt64, Int32>:UInt64"(i64 %self, i32 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = sext i32 %other to i64
%1 = add i64 %self, %0
ret i64 %1
}
define internal i64 @"*UInt64#+<UInt64, UInt32>:UInt64"(i64 %self, i32 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = zext i32 %other to i64
%1 = add i64 %self, %0
ret i64 %1
}
declare i64 @_Unwind_SetIP(i8*, i64)
; Function Attrs: noreturn
define void @__crystal_raise(%"struct.ABI::UnwindException"* %unwind_ex) #1 {
alloca:
%unwind_ex1 = alloca %"struct.ABI::UnwindException"*
%ret = alloca i32
br label %entry
entry: ; preds = %alloca
store %"struct.ABI::UnwindException"* %unwind_ex, %"struct.ABI::UnwindException"** %unwind_ex1
%0 = load %"struct.ABI::UnwindException"** %unwind_ex1
%1 = call i32 @_Unwind_RaiseException(%"struct.ABI::UnwindException"* %0)
store i32 %1, i32* %ret
%2 = call i1 @"*puts<String>:Nil"(%String.0* bitcast ([20 x i8]* @str1 to %String.0*))
%ret2 = load i32* %ret
call void @exit(i32 %ret2)
unreachable
}
declare i32 @_Unwind_RaiseException(%"struct.ABI::UnwindException"*)
define internal i1 @"*puts<String>:Nil"(%String.0* %obj) {
alloca:
%obj1 = alloca %String.0*
br label %entry
entry: ; preds = %alloca
store %String.0* %obj, %String.0** %obj1
%obj2 = load %String.0** %obj1
%0 = call %String.0* @"*String#to_s<String>:String"(%String.0* %obj2)
%1 = call i8* @"*String#cstr<String>:Pointer(Char)"(%String.0* %0)
%2 = call i32 @puts(i8* %1)
ret i1 false
}
define internal %String.0* @"*String#to_s<String>:String"(%String.0* %self) {
alloca:
br label %entry
entry: ; preds = %alloca
ret %String.0* %self
}
define internal i8* @"*String#cstr<String>:Pointer(Char)"(%String.0* %self) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = getelementptr %String.0* %self, i32 0, i32 1
ret i8* %0
}
declare i32 @puts(i8*)
; Function Attrs: noreturn
declare void @exit(i32) #1
define i64 @__crystal_get_exception(%"struct.ABI::UnwindException"* %unwind_ex) {
alloca:
%unwind_ex1 = alloca %"struct.ABI::UnwindException"*
br label %entry
entry: ; preds = %alloca
store %"struct.ABI::UnwindException"* %unwind_ex, %"struct.ABI::UnwindException"** %unwind_ex1
%unwind_ex2 = load %"struct.ABI::UnwindException"** %unwind_ex1
%0 = call i64 @"*struct.ABI::UnwindException#exception_object<struct.ABI::UnwindException>:UInt64"(%"struct.ABI::UnwindException"* %unwind_ex2)
ret i64 %0
}
define internal i64 @"*struct.ABI::UnwindException#exception_object<struct.ABI::UnwindException>:UInt64"(%"struct.ABI::UnwindException"* %self) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = load %"struct.ABI::UnwindException"* %self
%exception_object = extractvalue %"struct.ABI::UnwindException" %0, 4
ret i64 %exception_object
}
define i32 @main(i32 %argc, i8** %argv) {
alloca:
%argc1 = alloca i32
%argv2 = alloca i8**
br label %entry
entry: ; preds = %alloca
store i32 %argc, i32* %argc1
store i8** %argv, i8*** %argv2
%argc3 = load i32* %argc1
%argv4 = load i8*** %argv2
%0 = call i1 @__crystal_main(i32 %argc3, i8** %argv4)
ret i32 0
}
define internal %StringBuilder.1* @"*StringBuilder::new<StringBuilder:Class>:StringBuilder"(i32 %self) {
alloca:
%x = alloca %StringBuilder.1*
br label %entry
entry: ; preds = %alloca
%0 = call %StringBuilder.1* @"*StringBuilder::allocate<StringBuilder:Class>:StringBuilder"(i32 %self)
store %StringBuilder.1* %0, %StringBuilder.1** %x
%x1 = load %StringBuilder.1** %x
%1 = call %"Array(String).2"* @"*StringBuilder#initialize<StringBuilder>:Array(String)"(%StringBuilder.1* %x1)
%x2 = load %StringBuilder.1** %x
ret %StringBuilder.1* %x2
}
define internal %StringBuilder.1* @"*StringBuilder::allocate<StringBuilder:Class>:StringBuilder"(i32 %self) {
alloca:
br label %entry
entry: ; preds = %alloca
%malloccall = tail call i8* @malloc(i32 ptrtoint (%StringBuilder.1* getelementptr (%StringBuilder.1* null, i32 1) to i32))
%0 = bitcast i8* %malloccall to %StringBuilder.1*
%1 = bitcast %StringBuilder.1* %0 to i8*
call void @llvm.memset.p0i8.i32(i8* %1, i8 0, i32 ptrtoint (%StringBuilder.1* getelementptr (%StringBuilder.1* null, i32 1) to i32), i32 4, i1 false)
ret %StringBuilder.1* %0
}
define internal %"Array(String).2"* @"*StringBuilder#initialize<StringBuilder>:Array(String)"(%StringBuilder.1* %self) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = getelementptr %StringBuilder.1* %self, i32 0, i32 0
store i32 0, i32* %0
%1 = call %"Array(String).2"* @"*Array(String)::new<Array(String):Class>:Array(String)"(i32 37)
%2 = getelementptr %StringBuilder.1* %self, i32 0, i32 1
store %"Array(String).2"* %1, %"Array(String).2"** %2
ret %"Array(String).2"* %1
}
define internal %"Array(String).2"* @"*Array(String)::new<Array(String):Class>:Array(String)"(i32 %self) {
alloca:
%x = alloca %"Array(String).2"*
br label %entry
entry: ; preds = %alloca
%0 = call %"Array(String).2"* @"*Array(String)::allocate<Array(String):Class>:Array(String)"(i32 %self)
store %"Array(String).2"* %0, %"Array(String).2"** %x
%x1 = load %"Array(String).2"** %x
%1 = call %String.0** @"*Array(String)#initialize<Array(String)>:Pointer(String)"(%"Array(String).2"* %x1)
%x2 = load %"Array(String).2"** %x
ret %"Array(String).2"* %x2
}
define internal %"Array(String).2"* @"*Array(String)::allocate<Array(String):Class>:Array(String)"(i32 %self) {
alloca:
br label %entry
entry: ; preds = %alloca
%malloccall = tail call i8* @malloc(i32 ptrtoint (%"Array(String).2"* getelementptr (%"Array(String).2"* null, i32 1) to i32))
%0 = bitcast i8* %malloccall to %"Array(String).2"*
%1 = bitcast %"Array(String).2"* %0 to i8*
call void @llvm.memset.p0i8.i32(i8* %1, i8 0, i32 ptrtoint (%"Array(String).2"* getelementptr (%"Array(String).2"* null, i32 1) to i32), i32 4, i1 false)
ret %"Array(String).2"* %0
}
define internal %String.0** @"*Array(String)#initialize<Array(String)>:Pointer(String)"(%"Array(String).2"* %self) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = call %String.0** @"*Array(String)#initialize<Array(String), Int32>:Pointer(String)"(%"Array(String).2"* %self, i32 16)
ret %String.0** %0
}
define internal %String.0** @"*Array(String)#initialize<Array(String), Int32>:Pointer(String)"(%"Array(String).2"* %self, i32 %initial_capacity) {
alloca:
%initial_capacity1 = alloca i32
br label %entry
entry: ; preds = %alloca
store i32 %initial_capacity, i32* %initial_capacity1
%0 = getelementptr %"Array(String).2"* %self, i32 0, i32 0
store i32 0, i32* %0
%initial_capacity2 = load i32* %initial_capacity1
%1 = getelementptr %"Array(String).2"* %self, i32 0, i32 1
store i32 %initial_capacity2, i32* %1
%initial_capacity3 = load i32* %initial_capacity1
%2 = call %String.0** @"*Pointer(String)::malloc<Pointer(String):Class, Int32>:Pointer(String)"(i32 37, i32 %initial_capacity3)
%3 = getelementptr %"Array(String).2"* %self, i32 0, i32 2
store %String.0** %2, %String.0*** %3
ret %String.0** %2
}
define internal %String.0** @"*Pointer(String)::malloc<Pointer(String):Class, Int32>:Pointer(String)"(i32 %self, i32 %size) {
alloca:
%size1 = alloca i32
br label %entry
entry: ; preds = %alloca
store i32 %size, i32* %size1
%size2 = load i32* %size1
%0 = call i64 @"*Int32#to_u64<Int32>:UInt64"(i32 %size2)
%1 = call %String.0** @"*Pointer(String)::malloc<Pointer(String):Class, UInt64>:Pointer(String)"(i32 %self, i64 %0)
ret %String.0** %1
}
define internal %String.0** @"*Pointer(String)::malloc<Pointer(String):Class, UInt64>:Pointer(String)"(i32 %self, i64 %size) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = trunc i64 %size to i32
%mallocsize = mul i32 %0, ptrtoint (i1** getelementptr (i1** null, i32 1) to i32)
%malloccall = tail call i8* @malloc(i32 %mallocsize)
%1 = bitcast i8* %malloccall to %String.0**
ret %String.0** %1
}
define internal %StringBuilder.1* @"*StringBuilder#<<<StringBuilder, String>:StringBuilder"(%StringBuilder.1* %self, %String.0* %part) {
alloca:
%part1 = alloca %String.0*
%str = alloca %String.0*
%"@parts:1" = alloca %"Array(String).2"*
%"@length:1" = alloca i32
%"@length:2" = alloca i32
br label %entry
entry: ; preds = %alloca
store %String.0* %part, %String.0** %part1
%part2 = load %String.0** %part1
%0 = call %String.0* @"*String#to_s<String>:String"(%String.0* %part2)
store %String.0* %0, %String.0** %str
%1 = load %StringBuilder.1* %self
%"@parts" = extractvalue %StringBuilder.1 %1, 1
store %"Array(String).2"* %"@parts", %"Array(String).2"** %"@parts:1"
%str3 = load %String.0** %str
%2 = call %"Array(String).2"* @"*Array(String)#<<<Array(String), String>:Array(String)"(%"Array(String).2"* %"@parts", %String.0* %str3)
%3 = load %StringBuilder.1* %self
%"@length" = extractvalue %StringBuilder.1 %3, 0
store i32 %"@length", i32* %"@length:1"
%str4 = load %String.0** %str
%4 = call i32 @"*String#length<String>:Int32"(%String.0* %str4)
%5 = call i32 @"*Int32#+<Int32, Int32>:Int32"(i32 %"@length", i32 %4)
store i32 %5, i32* %"@length:2"
%6 = getelementptr %StringBuilder.1* %self, i32 0, i32 0
store i32 %5, i32* %6
ret %StringBuilder.1* %self
}
define internal %"Array(String).2"* @"*Array(String)#<<<Array(String), String>:Array(String)"(%"Array(String).2"* %self, %String.0* %value) {
alloca:
%value1 = alloca %String.0*
br label %entry
entry: ; preds = %alloca
store %String.0* %value, %String.0** %value1
%value2 = load %String.0** %value1
%0 = call %"Array(String).2"* @"*Array(String)#push<Array(String), String>:Array(String)"(%"Array(String).2"* %self, %String.0* %value2)
ret %"Array(String).2"* %0
}
define internal %"Array(String).2"* @"*Array(String)#push<Array(String), String>:Array(String)"(%"Array(String).2"* %self, %String.0* %value) {
alloca:
%value1 = alloca %String.0*
%"@buffer:1" = alloca %String.0**
%"@length:1" = alloca i32
%"@length:2" = alloca i32
%"@length:3" = alloca i32
br label %entry
entry: ; preds = %alloca
store %String.0* %value, %String.0** %value1
%0 = call %String.0** @"*Array(String)#check_needs_resize<Array(String)>:Pointer(String)?"(%"Array(String).2"* %self)
%1 = load %"Array(String).2"* %self
%"@buffer" = extractvalue %"Array(String).2" %1, 2
store %String.0** %"@buffer", %String.0*** %"@buffer:1"
%2 = load %"Array(String).2"* %self
%"@length" = extractvalue %"Array(String).2" %2, 0
store i32 %"@length", i32* %"@length:1"
%value2 = load %String.0** %value1
%3 = call %String.0* @"*Pointer(String)#[]=<Pointer(String), Int32, String>:String"(%String.0** %"@buffer", i32 %"@length", %String.0* %value2)
%4 = load %"Array(String).2"* %self
%"@length3" = extractvalue %"Array(String).2" %4, 0
store i32 %"@length3", i32* %"@length:2"
%5 = call i32 @"*Int32#+<Int32, Int32>:Int32"(i32 %"@length3", i32 1)
store i32 %5, i32* %"@length:3"
%6 = getelementptr %"Array(String).2"* %self, i32 0, i32 0
store i32 %5, i32* %6
ret %"Array(String).2"* %self
}
define internal %String.0** @"*Array(String)#check_needs_resize<Array(String)>:Pointer(String)?"(%"Array(String).2"* %self) {
alloca:
%"@length:1" = alloca i32
%"@capacity:1" = alloca i32
%"@capacity:2" = alloca i32
br label %entry
entry: ; preds = %alloca
%0 = load %"Array(String).2"* %self
%"@length" = extractvalue %"Array(String).2" %0, 0
store i32 %"@length", i32* %"@length:1"
%1 = load %"Array(String).2"* %self
%"@capacity" = extractvalue %"Array(String).2" %1, 1
store i32 %"@capacity", i32* %"@capacity:1"
%2 = call i1 @"*Int32#==<Int32, Int32>:Bool"(i32 %"@length", i32 %"@capacity")
%3 = icmp ne i1 %2, false
br i1 %3, label %then, label %else
then: ; preds = %entry
%4 = load %"Array(String).2"* %self
%"@capacity1" = extractvalue %"Array(String).2" %4, 1
store i32 %"@capacity1", i32* %"@capacity:2"
%5 = call i32 @"*Int32#*<Int32, Int32>:Int32"(i32 %"@capacity1", i32 2)
%6 = call %String.0** @"*Array(String)#resize_to_capacity<Array(String), Int32>:Pointer(String)"(%"Array(String).2"* %self, i32 %5)
br label %exit
else: ; preds = %entry
br label %exit
exit: ; preds = %else, %then
%7 = phi %String.0** [ %6, %then ], [ null, %else ]
ret %String.0** %7
}
define internal i1 @"*Int32#==<Int32, Int32>:Bool"(i32 %self, i32 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = icmp eq i32 %self, %other
ret i1 %0
}
define internal i32 @"*Int32#*<Int32, Int32>:Int32"(i32 %self, i32 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = mul i32 %self, %other
ret i32 %0
}
define internal %String.0** @"*Array(String)#resize_to_capacity<Array(String), Int32>:Pointer(String)"(%"Array(String).2"* %self, i32 %capacity) {
alloca:
%capacity1 = alloca i32
%"@capacity:1" = alloca i32
%"@buffer:1" = alloca %String.0**
%"@buffer:2" = alloca %String.0**
br label %entry
entry: ; preds = %alloca
store i32 %capacity, i32* %capacity1
%capacity2 = load i32* %capacity1
store i32 %capacity2, i32* %"@capacity:1"
%0 = getelementptr %"Array(String).2"* %self, i32 0, i32 1
store i32 %capacity2, i32* %0
%1 = load %"Array(String).2"* %self
%"@buffer" = extractvalue %"Array(String).2" %1, 2
store %String.0** %"@buffer", %String.0*** %"@buffer:1"
%"@capacity:13" = load i32* %"@capacity:1"
%2 = call %String.0** @"*Pointer(String)#realloc<Pointer(String), Int32>:Pointer(String)"(%String.0** %"@buffer", i32 %"@capacity:13")
store %String.0** %2, %String.0*** %"@buffer:2"
%3 = getelementptr %"Array(String).2"* %self, i32 0, i32 2
store %String.0** %2, %String.0*** %3
ret %String.0** %2
}
define internal %String.0** @"*Pointer(String)#realloc<Pointer(String), Int32>:Pointer(String)"(%String.0** %self, i32 %size) {
alloca:
%size1 = alloca i32
br label %entry
entry: ; preds = %alloca
store i32 %size, i32* %size1
%size2 = load i32* %size1
%0 = call i64 @"*Int32#to_u64<Int32>:UInt64"(i32 %size2)
%1 = call %String.0** @"*Pointer(String)#realloc<Pointer(String), UInt64>:Pointer(String)"(%String.0** %self, i64 %0)
ret %String.0** %1
}
define internal %String.0** @"*Pointer(String)#realloc<Pointer(String), UInt64>:Pointer(String)"(%String.0** %self, i64 %size) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = bitcast %String.0** %self to i8*
%1 = mul i64 %size, 8
%2 = call i8* @realloc(i8* %0, i64 %1)
%3 = bitcast i8* %2 to %String.0**
ret %String.0** %3
}
declare i8* @realloc(i8*, i64)
define internal %String.0* @"*Pointer(String)#[]=<Pointer(String), Int32, String>:String"(%String.0** %self, i32 %offset, %String.0* %value) {
alloca:
%offset1 = alloca i32
%value2 = alloca %String.0*
br label %entry
entry: ; preds = %alloca
store i32 %offset, i32* %offset1
store %String.0* %value, %String.0** %value2
%offset3 = load i32* %offset1
%0 = call %String.0** @"*Pointer(String)#+<Pointer(String), Int32>:Pointer(String)"(%String.0** %self, i32 %offset3)
%value4 = load %String.0** %value2
%1 = call %String.0* @"*Pointer(String)#value=<Pointer(String), String>:String"(%String.0** %0, %String.0* %value4)
ret %String.0* %1
}
define internal %String.0** @"*Pointer(String)#+<Pointer(String), Int32>:Pointer(String)"(%String.0** %self, i32 %other) {
alloca:
%other1 = alloca i32
br label %entry
entry: ; preds = %alloca
store i32 %other, i32* %other1
%other2 = load i32* %other1
%0 = call i64 @"*Int32#to_i64<Int32>:Int64"(i32 %other2)
%1 = call %String.0** @"*Pointer(String)#+<Pointer(String), Int64>:Pointer(String)"(%String.0** %self, i64 %0)
ret %String.0** %1
}
define internal %String.0** @"*Pointer(String)#+<Pointer(String), Int64>:Pointer(String)"(%String.0** %self, i64 %offset) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = getelementptr %String.0** %self, i64 %offset
ret %String.0** %0
}
define internal %String.0* @"*Pointer(String)#value=<Pointer(String), String>:String"(%String.0** %self, %String.0* %value) {
alloca:
br label %entry
entry: ; preds = %alloca
store %String.0* %value, %String.0** %self
ret %String.0* %value
}
define internal i32 @"*String#length<String>:Int32"(%String.0* %self) {
alloca:
%"@length:1" = alloca i32
br label %entry
entry: ; preds = %alloca
%0 = load %String.0* %self
%"@length" = extractvalue %String.0 %0, 0
store i32 %"@length", i32* %"@length:1"
ret i32 %"@length"
}
define internal %String.0* @"*StringBuilder#to_s<StringBuilder>:String"(%StringBuilder.1* %self) {
alloca:
%"@length:1" = alloca i32
%length = alloca i32
%str = alloca i8*
%buffer = alloca i8*
%block_cstr = alloca i8*
%buffer5 = alloca i8*
%"@parts:1" = alloca %"Array(String).2"*
%i = alloca i32
%block_i = alloca i32
%"@buffer:1" = alloca %String.0**
%block_part = alloca %String.0*
%"buffer:1" = alloca i8*
%"#temp_190" = alloca i8*
%"i:1" = alloca i32
%"#temp_1" = alloca i32
br label %entry
entry: ; preds = %alloca
%0 = load %StringBuilder.1* %self
%"@length" = extractvalue %StringBuilder.1 %0, 0
store i32 %"@length", i32* %"@length:1"
store i32 %"@length", i32* %length
%length1 = load i32* %length
%1 = call i32 @"*Int32#+<Int32, Int32>:Int32"(i32 %length1, i32 5)
%2 = call i8* @"*Pointer(Char)::malloc<Pointer(Char):Class, Int32>:Pointer(Char)"(i32 2, i32 %1)
store i8* %2, i8** %str
%str2 = load i8** %str
%3 = call %String.0* @"*Pointer(Char)#as<Pointer(Char), String:Class>:String"(i8* %str2, i32 37)
%4 = call i8* @"*String#cstr<String>:Pointer(Char)"(%String.0* %3)
store i8* %4, i8** %buffer
%buffer3 = load i8** %buffer
store i8* %buffer3, i8** %block_cstr
%cstr = load i8** %block_cstr
%cstr4 = load i8** %block_cstr
store i8* %cstr4, i8** %buffer5
%5 = load %StringBuilder.1* %self
%"@parts" = extractvalue %StringBuilder.1 %5, 1
store %"Array(String).2"* %"@parts", %"Array(String).2"** %"@parts:1"
%6 = call i32 @"*Array(String)#length<Array(String)>:Int32"(%"Array(String).2"* %"@parts")
%7 = call i32 @"*Int32#^<Int32, Int32>:Int32"(i32 %6, i32 %6)
store i32 %7, i32* %i
br label %while
return: ; preds = %return6
%8 = phi %String.0* [ %13, %return6 ]
ret %String.0* %8
return6: ; preds = %return7
%9 = phi %"Array(String).2"* [ %"@parts", %return7 ]
%buffer21 = load i8** %buffer
%length22 = load i32* %length
%10 = call i8 @"*Pointer(Char)#[]=<Pointer(Char), Int32, Char>:Char"(i8* %buffer21, i32 %length22, i8 0)
%str23 = load i8** %str
%11 = call i32* @"*Pointer(Char)#as<Pointer(Char), Int32:Class>:Pointer(Int32)"(i8* %str23, i32 1)
%length24 = load i32* %length
%12 = call i32 @"*Pointer(Int32)#value=<Pointer(Int32), Int32>:Int32"(i32* %11, i32 %length24)
%str25 = load i8** %str
%13 = call %String.0* @"*Pointer(Char)#as<Pointer(Char), String:Class>:String"(i8* %str25, i32 37)
br label %return
return7: ; preds = %exit
%14 = phi i32 [ %6, %exit ]
br label %return6
while: ; preds = %body, %entry
%i8 = load i32* %i
%15 = call i1 @"*Int32#<<Int32, Int32>:Bool"(i32 %i8, i32 %6)
%16 = icmp ne i1 %15, false
br i1 %16, label %body, label %exit
body: ; preds = %while
%i9 = load i32* %i
store i32 %i9, i32* %block_i
%i10 = load i32* %block_i
%17 = load %"Array(String).2"* %"@parts"
%"@buffer" = extractvalue %"Array(String).2" %17, 2
store %String.0** %"@buffer", %String.0*** %"@buffer:1"
%i11 = load i32* %block_i
%18 = call %String.0* @"*Pointer(String)#[]<Pointer(String), Int32>:String"(%String.0** %"@buffer", i32 %i11)
store %String.0* %18, %String.0** %block_part
%part = load %String.0** %block_part
%buffer12 = load i8** %buffer5
%part13 = load %String.0** %block_part
%19 = call i8* @"*String#cstr<String>:Pointer(Char)"(%String.0* %part13)
%20 = call i8* @strcpy(i8* %buffer12, i8* %19)
%buffer14 = load i8** %buffer5
%part15 = load %String.0** %block_part
%21 = call i32 @"*String#length<String>:Int32"(%String.0* %part15)
%22 = call i8* @"*Pointer(Char)#+<Pointer(Char), Int32>:Pointer(Char)"(i8* %buffer14, i32 %21)
store i8* %22, i8** %"buffer:1"
store i8* %22, i8** %"#temp_190"
%"buffer:116" = load i8** %"buffer:1"
store i8* %"buffer:116", i8** %buffer5
%"#temp_19017" = load i8** %"#temp_190"
%i18 = load i32* %i
%23 = call i32 @"*Int32#+<Int32, Int32>:Int32"(i32 %i18, i32 1)
store i32 %23, i32* %"i:1"
store i32 %23, i32* %"#temp_1"
%"i:119" = load i32* %"i:1"
store i32 %"i:119", i32* %i
%"#temp_120" = load i32* %"#temp_1"
br label %while
exit: ; preds = %while
br label %return7
}
define internal i8* @"*Pointer(Char)::malloc<Pointer(Char):Class, Int32>:Pointer(Char)"(i32 %self, i32 %size) {
alloca:
%size1 = alloca i32
br label %entry
entry: ; preds = %alloca
store i32 %size, i32* %size1
%size2 = load i32* %size1
%0 = call i64 @"*Int32#to_u64<Int32>:UInt64"(i32 %size2)
%1 = call i8* @"*Pointer(Char)::malloc<Pointer(Char):Class, UInt64>:Pointer(Char)"(i32 %self, i64 %0)
ret i8* %1
}
define internal i8* @"*Pointer(Char)::malloc<Pointer(Char):Class, UInt64>:Pointer(Char)"(i32 %self, i64 %size) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = trunc i64 %size to i32
%mallocsize = mul i32 %0, ptrtoint (i8* getelementptr (i8* null, i32 1) to i32)
%1 = tail call i8* @malloc(i32 %mallocsize)
ret i8* %1
}
define internal %String.0* @"*Pointer(Char)#as<Pointer(Char), String:Class>:String"(i8* %self, i32 %type) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = bitcast i8* %self to %String.0*
ret %String.0* %0
}
define internal i32 @"*Array(String)#length<Array(String)>:Int32"(%"Array(String).2"* %self) {
alloca:
%"@length:1" = alloca i32
br label %entry
entry: ; preds = %alloca
%0 = load %"Array(String).2"* %self
%"@length" = extractvalue %"Array(String).2" %0, 0
store i32 %"@length", i32* %"@length:1"
ret i32 %"@length"
}
define internal i32 @"*Int32#^<Int32, Int32>:Int32"(i32 %self, i32 %other) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = xor i32 %self, %other
ret i32 %0
}
define internal %String.0* @"*Pointer(String)#[]<Pointer(String), Int32>:String"(%String.0** %self, i32 %offset) {
alloca:
%offset1 = alloca i32
br label %entry
entry: ; preds = %alloca
store i32 %offset, i32* %offset1
%offset2 = load i32* %offset1
%0 = call %String.0** @"*Pointer(String)#+<Pointer(String), Int32>:Pointer(String)"(%String.0** %self, i32 %offset2)
%1 = call %String.0* @"*Pointer(String)#value<Pointer(String)>:String"(%String.0** %0)
ret %String.0* %1
}
define internal %String.0* @"*Pointer(String)#value<Pointer(String)>:String"(%String.0** %self) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = load %String.0** %self
ret %String.0* %0
}
declare i8* @strcpy(i8*, i8*)
define internal i8* @"*Pointer(Char)#+<Pointer(Char), Int32>:Pointer(Char)"(i8* %self, i32 %other) {
alloca:
%other1 = alloca i32
br label %entry
entry: ; preds = %alloca
store i32 %other, i32* %other1
%other2 = load i32* %other1
%0 = call i64 @"*Int32#to_i64<Int32>:Int64"(i32 %other2)
%1 = call i8* @"*Pointer(Char)#+<Pointer(Char), Int64>:Pointer(Char)"(i8* %self, i64 %0)
ret i8* %1
}
define internal i8* @"*Pointer(Char)#+<Pointer(Char), Int64>:Pointer(Char)"(i8* %self, i64 %offset) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = getelementptr i8* %self, i64 %offset
ret i8* %0
}
define internal i8 @"*Pointer(Char)#[]=<Pointer(Char), Int32, Char>:Char"(i8* %self, i32 %offset, i8 %value) {
alloca:
%offset1 = alloca i32
%value2 = alloca i8
br label %entry
entry: ; preds = %alloca
store i32 %offset, i32* %offset1
store i8 %value, i8* %value2
%offset3 = load i32* %offset1
%0 = call i8* @"*Pointer(Char)#+<Pointer(Char), Int32>:Pointer(Char)"(i8* %self, i32 %offset3)
%value4 = load i8* %value2
%1 = call i8 @"*Pointer(Char)#value=<Pointer(Char), Char>:Char"(i8* %0, i8 %value4)
ret i8 %1
}
define internal i8 @"*Pointer(Char)#value=<Pointer(Char), Char>:Char"(i8* %self, i8 %value) {
alloca:
br label %entry
entry: ; preds = %alloca
store i8 %value, i8* %self
ret i8 %value
}
define internal i32* @"*Pointer(Char)#as<Pointer(Char), Int32:Class>:Pointer(Int32)"(i8* %self, i32 %type) {
alloca:
br label %entry
entry: ; preds = %alloca
%0 = bitcast i8* %self to i32*
ret i32* %0
}
define internal i32 @"*Pointer(Int32)#value=<Pointer(Int32), Int32>:Int32"(i32* %self, i32 %value) {
alloca:
br label %entry
entry: ; preds = %alloca
store i32 %value, i32* %self
ret i32 %value
}
attributes #0 = { nounwind }
attributes #1 = { noreturn }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment