Files
c3c/test/test_suite/functions/test_regression_mingw.c3t
2022-10-15 02:45:19 +02:00

763 lines
26 KiB
C

// #target: mingw-x64
module test;
import test2;
import std::array::list;
import std::array::linkedlist;
import hello_world;
extern fn int printf(char *, ...);
fn void helloWorld()
{
printf("helloWorld!\n");
}
fn int test_static()
{
static int x = 1;
x++;
printf("Test static %d\n", x);
return x;
}
struct Bobo { short b; float c; short d; short e; float f; short g; }
struct Blob { int z; int f; }
union Foor
{
long a;
char[12] b;
}
fn int helo(double d, Bobo b)
{
int[3] de = { 1, 2, 3 };
Bobo c = b;
helo(1.0, c);
return 1;
}
fn int test1(int a, int b)
{
a = a >> b;
if (b > 128) return -1;
return a;
}
struct Foo2
{
int x;
}
fn void Foo2.printme(Foo2 *foo)
{
printf("Foo is: %d\n", foo.x);
}
fn int Foo2.mutate(Foo2 *foo)
{
printf("Mutating");
return ++foo.x;
}
define oopsInt = test2::argh<int>;
define oopsDouble = test2::argh<int>;
define Argh = fn int(double, Bobo);
define Argh2 = fn int(double, Bobo);
fn int sum_us(int... x)
{
int sum = 0;
if (x.len == 0) return 0;
sum += x[0] + sum_us(...x[1..^1]);
return sum;
}
define Frob = long;
fn int sumd(int[] x)
{
int sum = 0;
for (int i = 0; i < x.len; i++) sum += x[i];
return sum;
}
struct Foo
{
int a;
int b;
}
define getValueInt = test2::getValue<int>;
define getValueDouble = test2::getValue<double>;
define IntBlob = test2::Blob<int>;
define DoubleBlob = Blob<double>;
define getMultInt = test2::getMult<int>;
define getMultDouble = test2::getMult<double>;
define IntArray = List<int>;
define IntList = LinkedList<int>;
enum MyEnum : int
{
HELO,
WORLD,
BYE
}
fn void main()
{
test_static();
test_static();
test_static();
hello_world::hello();
IntList list;
list.push(10);
list.push(15);
list.push(30);
for (int i = 0; i < (int)(list.len()); i++)
{
printf("Element[%d]: %d\n", i, list.get(i));
}
list.free();
printf("Elements: %d\n", (int)(MyEnum.elements));
int elements = MyEnum.elements;
printf("Hello\n");
IntArray array;
array.append(100);
array.append(200);
array.append(400);
array.push(600);
array.insert_at(2, 300);
for (int i = 0; i < (int)(array.len()); i++)
{
printf("Element[%d]: %d\n", i, array.get(i));
}
array.free();
IntBlob a = { 42 };
DoubleBlob b = { 33.3 };
printf("a was %d\n", getValueInt(a));
printf("b was %f\n", getValueDouble(b));
printf("Mult int was %d\n", getMultInt(25));
printf("Mult double was %f\n", getMultDouble(3.3));
helloWorld();
Foo ddx;
int fro = 3;
int[4] x = { 1, 2, 3, 3 };
fro += printf("1Vararg4splatA: %d\n", sum_us(...x));
printf("%d\n", fro);
int[] z = &x;
int[3] de = { 1, 2, 3 };
printf("Vararg4splatB: %d\n", sum_us(...&x));
printf("Vararg4splatC: %d\n", sum_us(...z));
printf("Vararg4: %d\n", sum_us(1, 2, 4, 5));
printf("Vararg1: %d\n", sum_us(1));
printf("Vararg0: %d\n", sum_us());
Argh a1;
Argh2 b2;
}
module hello_world;
import foo;
extern fn int printf(char *, ...);
define doubleMult = foo::check<double>;
fn void hello()
{
printf("Hello baby\n");
printf("Mult %f\n", doubleMult(11.1));
}
module foo <Type>;
fn Type check(Type i)
{
return i * i;
}
module test2 <Type>;
struct Blob
{
Type a;
}
fn Type getMult(Type a)
{
return a * a;
}
Type argh = 234;
fault MyErr
{
X,
Y
}
enum Hello : int
{
FOO,
BAR,
}
macro Hello wut()
{
return Hello.FOO;
}
define Bye = Hello;
define wat = wut;
define byebye = hello;
fn int hello()
{
return 1;
}
fn Type getValue(Blob blob)
{
return blob.a;
}
/* #expect: test.ll
%Blob = type { i32 }
%Blob.0 = type { double }
%Foo2 = type { i32 }
%Bobo = type { i16, float, i16, i16, float, i16 }
%"int[]" = type { i32*, i64 }
%LinkedList = type { i64, %Node*, %Node* }
%Node = type { %Node*, %Node*, i32 }
%List = type { i64, i64, %Allocator*, i32* }
%Foo = type { i32, i32 }
$"ct$test_Bobo" = comdat any
$"ct$test_Blob" = comdat any
$"ct$test_Foor" = comdat any
$"ct$test_Foo2" = comdat any
$"ct$test_Foo" = comdat any
$"ct$int" = comdat any
$"ct$test_MyEnum" = comdat any
@"ct$test_Bobo" = linkonce constant %.introspect { i8 10, i64 20, i64 0, i64 6, [0 x i64] zeroinitializer }, comdat, align 8
@"ct$test_Blob" = linkonce constant %.introspect { i8 10, i64 8, i64 0, i64 2, [0 x i64] zeroinitializer }, comdat, align 8
@"ct$test_Foor" = linkonce constant %.introspect { i8 11, i64 16, i64 0, i64 2, [0 x i64] zeroinitializer }, comdat, align 8
@"ct$test_Foo2" = linkonce constant %.introspect { i8 10, i64 4, i64 0, i64 1, [0 x i64] zeroinitializer }, comdat, align 8
@"ct$test_Foo" = linkonce constant %.introspect { i8 10, i64 8, i64 0, i64 2, [0 x i64] zeroinitializer }, comdat, align 8
@"ct$int" = linkonce constant %.introspect { i8 2, i64 4, i64 0, i64 0, [0 x i64] zeroinitializer }, comdat, align 8
@"ct$test_MyEnum" = linkonce constant { i8, i64, i64, i64, [3 x %"char[]"] } { i8 8, i64 4, i64 ptrtoint (%.introspect* @"ct$int" to i64), i64 3, [3 x %"char[]"] [%"char[]" { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.enum.0, i64 0, i64 0), i64 4 }, %"char[]" { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.enum.1, i64 0, i64 0), i64 5 }, %"char[]" { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.enum.2, i64 0, i64 0), i64 3 }] }, comdat, align 8
@.str = private unnamed_addr constant [13 x i8] c"helloWorld!\0A\00", align 1
@"test_static$x" = internal unnamed_addr global i32 1, align 4
@.str.1 = private unnamed_addr constant [16 x i8] c"Test static %d\0A\00", align 1
@.__const = private unnamed_addr constant [3 x i32] [i32 1, i32 2, i32 3], align 4
@.str.2 = private unnamed_addr constant [17 x i8] c"Element[%d]: %d\0A\00", align 1
@.str.3 = private unnamed_addr constant [14 x i8] c"Elements: %d\0A\00", align 1
@.str.4 = private unnamed_addr constant [7 x i8] c"Hello\0A\00", align 1
@.str.5 = private unnamed_addr constant [17 x i8] c"Element[%d]: %d\0A\00", align 1
@.__const.6 = private unnamed_addr constant %Blob { i32 42 }, align 4
@.__const.7 = private unnamed_addr constant %Blob.0 { double 3.330000e+01 }, align 8
@.str.8 = private unnamed_addr constant [10 x i8] c"a was %d\0A\00", align 1
@.str.9 = private unnamed_addr constant [10 x i8] c"b was %f\0A\00", align 1
@.str.10 = private unnamed_addr constant [17 x i8] c"Mult int was %d\0A\00", align 1
@.str.11 = private unnamed_addr constant [20 x i8] c"Mult double was %f\0A\00", align 1
@.__const.12 = private unnamed_addr constant [4 x i32] [i32 1, i32 2, i32 3, i32 3], align 16
@.str.13 = private unnamed_addr constant [20 x i8] c"1Vararg4splatA: %d\0A\00", align 1
@.str.14 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.__const.15 = private unnamed_addr constant [3 x i32] [i32 1, i32 2, i32 3], align 4
@.str.16 = private unnamed_addr constant [19 x i8] c"Vararg4splatB: %d\0A\00", align 1
@.str.17 = private unnamed_addr constant [19 x i8] c"Vararg4splatC: %d\0A\00", align 1
@.str.18 = private unnamed_addr constant [13 x i8] c"Vararg4: %d\0A\00", align 1
@.str.19 = private unnamed_addr constant [13 x i8] c"Vararg1: %d\0A\00", align 1
@.str.20 = private unnamed_addr constant [13 x i8] c"Vararg0: %d\0A\00", align 1
@.str.21 = private unnamed_addr constant [12 x i8] c"Foo is: %d\0A\00", align 1
@.str.22 = private unnamed_addr constant [9 x i8] c"Mutating\00", align 1
; Function Attrs: nounwind
define void @test_Foo2_printme(%Foo2* %0) #0 {
entry:
%1 = getelementptr inbounds %Foo2, %Foo2* %0, i32 0, i32 0
%2 = load i32, i32* %1, align 8
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.21, i32 0, i32 0), i32 %2)
ret void
}
; Function Attrs: nounwind
define i32 @test_Foo2_mutate(%Foo2* %0) #0 {
entry:
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.22, i32 0, i32 0))
%2 = getelementptr inbounds %Foo2, %Foo2* %0, i32 0, i32 0
%3 = load i32, i32* %2, align 8
%add = add i32 %3, 1
store i32 %add, i32* %2, align 8
ret i32 %add
}
; Function Attrs: nounwind
declare i32 @printf(i8*, ...) #0
; Function Attrs: nounwind
define void @test_helloWorld() #0 {
entry:
%0 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i32 0, i32 0))
ret void
}
; Function Attrs: nounwind
define i32 @test_test_static() #0 {
entry:
%0 = load i32, i32* @"test_static$x", align 4
%add = add i32 %0, 1
store i32 %add, i32* @"test_static$x", align 4
%1 = load i32, i32* @"test_static$x", align 4
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i32 0, i32 0), i32 %1)
%3 = load i32, i32* @"test_static$x", align 4
ret i32 %3
}
; Function Attrs: nounwind
define i32 @test_helo(double %0, %Bobo* align 4 %1) #0 {
entry:
%de = alloca [3 x i32], align 4
%c = alloca %Bobo, align 4
%indirectarg = alloca %Bobo, align 4
%2 = bitcast [3 x i32]* %de to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %2, i8* align 4 bitcast ([3 x i32]* @.__const to i8*), i32 12, i1 false)
%3 = bitcast %Bobo* %c to i8*
%4 = bitcast %Bobo* %1 to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %3, i8* align 4 %4, i32 20, i1 false)
%5 = bitcast %Bobo* %indirectarg to i8*
%6 = bitcast %Bobo* %c to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %5, i8* align 4 %6, i32 20, i1 false)
%7 = call i32 @test_helo(double 1.000000e+00, %Bobo* align 4 %indirectarg)
ret i32 1
}
; Function Attrs: nounwind
define i32 @test_test1(i32 %0, i32 %1) #0 {
entry:
%a = alloca i32, align 4
store i32 %0, i32* %a, align 4
%2 = load i32, i32* %a, align 4
%ashr = ashr i32 %2, %1
%3 = freeze i32 %ashr
store i32 %3, i32* %a, align 4
%gt = icmp sgt i32 %1, 128
br i1 %gt, label %if.then, label %if.exit
if.then: ; preds = %entry
ret i32 -1
if.exit: ; preds = %entry
%4 = load i32, i32* %a, align 4
ret i32 %4
}
; Function Attrs: nounwind
define i32 @test_sum_us(%"int[]"* align 8 %0) #0 {
entry:
%sum = alloca i32, align 4
%vararg = alloca %"int[]", align 8
%indirectarg = alloca %"int[]", align 8
store i32 0, i32* %sum, align 4
%1 = getelementptr inbounds %"int[]", %"int[]"* %0, i32 0, i32 1
%2 = load i64, i64* %1, align 8
%eq = icmp eq i64 0, %2
br i1 %eq, label %if.then, label %if.exit
if.then: ; preds = %entry
ret i32 0
if.exit: ; preds = %entry
%3 = load i32, i32* %sum, align 4
%4 = getelementptr inbounds %"int[]", %"int[]"* %0, i32 0, i32 0
%5 = load i32*, i32** %4, align 8
%ptroffset = getelementptr inbounds i32, i32* %5, i64 0
%6 = load i32, i32* %ptroffset, align 4
%7 = load %"int[]", %"int[]"* %0, align 8
%8 = extractvalue %"int[]" %7, 0
%9 = extractvalue %"int[]" %7, 1
%sub = sub i64 %9, 1
%10 = add i64 %sub, 1
%size = sub i64 %10, 1
%ptroffset1 = getelementptr inbounds i32, i32* %8, i64 1
%11 = insertvalue %"int[]" undef, i32* %ptroffset1, 0
%12 = insertvalue %"int[]" %11, i64 %size, 1
%13 = getelementptr inbounds %"int[]", %"int[]"* %vararg, i32 0, i32 1
%14 = getelementptr inbounds %"int[]", %"int[]"* %vararg, i32 0, i32 0
store %"int[]" %12, %"int[]"* %indirectarg, align 8
%15 = call i32 @test_sum_us(%"int[]"* align 8 %indirectarg)
%add = add i32 %6, %15
%add2 = add i32 %3, %add
store i32 %add2, i32* %sum, align 4
%16 = load i32, i32* %sum, align 4
ret i32 %16
}
; Function Attrs: nounwind
define i32 @test_sumd(%"int[]"* align 8 %0) #0 {
entry:
%sum = alloca i32, align 4
%i = alloca i32, align 4
store i32 0, i32* %sum, align 4
store i32 0, i32* %i, align 4
br label %loop.cond
loop.cond: ; preds = %loop.body, %entry
%1 = load i32, i32* %i, align 4
%sisiext = sext i32 %1 to i64
%2 = getelementptr inbounds %"int[]", %"int[]"* %0, i32 0, i32 1
%3 = load i64, i64* %2, align 8
%lt = icmp slt i64 %sisiext, %3
%check = icmp slt i64 %3, 0
%siui-lt = or i1 %check, %lt
br i1 %siui-lt, label %loop.body, label %loop.exit
loop.body: ; preds = %loop.cond
%4 = load i32, i32* %sum, align 4
%5 = getelementptr inbounds %"int[]", %"int[]"* %0, i32 0, i32 0
%6 = load i32*, i32** %5, align 8
%7 = load i32, i32* %i, align 4
%sisiext1 = sext i32 %7 to i64
%ptroffset = getelementptr inbounds i32, i32* %6, i64 %sisiext1
%8 = load i32, i32* %ptroffset, align 4
%add = add i32 %4, %8
store i32 %add, i32* %sum, align 4
%9 = load i32, i32* %i, align 4
%add2 = add i32 %9, 1
store i32 %add2, i32* %i, align 4
br label %loop.cond
loop.exit: ; preds = %loop.cond
%10 = load i32, i32* %sum, align 4
ret i32 %10
}
; Function Attrs: nounwind
define void @test_main() #0 {
entry:
%list = alloca %LinkedList, align 8
%i = alloca i32, align 4
%elements = alloca i32, align 4
%array = alloca %List, align 8
%i1 = alloca i32, align 4
%a = alloca %Blob, align 4
%b = alloca %Blob.0, align 8
%tempcoerce = alloca i64, align 8
%ddx = alloca %Foo, align 4
%fro = alloca i32, align 4
%x = alloca [4 x i32], align 16
%vararg = alloca %"int[]", align 8
%indirectarg = alloca %"int[]", align 8
%z = alloca %"int[]", align 8
%de = alloca [3 x i32], align 4
%vararg10 = alloca %"int[]", align 8
%indirectarg11 = alloca %"int[]", align 8
%vararg12 = alloca %"int[]", align 8
%indirectarg13 = alloca %"int[]", align 8
%vararg14 = alloca %"int[]", align 8
%varargslots = alloca [4 x i32], align 16
%indirectarg15 = alloca %"int[]", align 8
%vararg16 = alloca %"int[]", align 8
%varargslots17 = alloca [1 x i32], align 4
%indirectarg18 = alloca %"int[]", align 8
%vararg19 = alloca %"int[]", align 8
%indirectarg20 = alloca %"int[]", align 8
%a1 = alloca i32 (double, %Bobo*)*, align 8
%b2 = alloca i32 (double, %Bobo*)*, align 8
%0 = call i32 @test_test_static()
%1 = call i32 @test_test_static()
%2 = call i32 @test_test_static()
call void @hello_world_hello()
%3 = bitcast %LinkedList* %list to i8*
call void @llvm.memset.p0i8.i64(i8* align 8 %3, i8 0, i64 24, i1 false)
call void @"std_array_linkedlist$$int_LinkedList_push"(%LinkedList* %list, i32 10)
call void @"std_array_linkedlist$$int_LinkedList_push"(%LinkedList* %list, i32 15)
call void @"std_array_linkedlist$$int_LinkedList_push"(%LinkedList* %list, i32 30)
store i32 0, i32* %i, align 4
br label %loop.cond
loop.cond: ; preds = %loop.body, %entry
%4 = load i32, i32* %i, align 4
%5 = call i64 @"std_array_linkedlist$$int_LinkedList_len"(%LinkedList* %list) #3
%uisitrunc = trunc i64 %5 to i32
%lt = icmp slt i32 %4, %uisitrunc
br i1 %lt, label %loop.body, label %loop.exit
loop.body: ; preds = %loop.cond
%6 = load i32, i32* %i, align 4
%7 = load i32, i32* %i, align 4
%siuiext = sext i32 %7 to i64
%8 = call i32 @"std_array_linkedlist$$int_LinkedList_get"(%LinkedList* %list, i64 %siuiext)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i32 0, i32 0), i32 %6, i32 %8)
%10 = load i32, i32* %i, align 4
%add = add i32 %10, 1
store i32 %add, i32* %i, align 4
br label %loop.cond
loop.exit: ; preds = %loop.cond
call void @"std_array_linkedlist$$int_LinkedList_free"(%LinkedList* %list)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i32 0, i32 0), i32 3)
store i32 3, i32* %elements, align 4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i32 0, i32 0))
%13 = bitcast %List* %array to i8*
call void @llvm.memset.p0i8.i64(i8* align 8 %13, i8 0, i64 32, i1 false)
call void @"std_array_list$$int_List_append"(%List* %array, i32 100)
call void @"std_array_list$$int_List_append"(%List* %array, i32 200)
call void @"std_array_list$$int_List_append"(%List* %array, i32 400)
call void @"std_array_list$$int_List_push"(%List* %array, i32 600) #3
call void @"std_array_list$$int_List_insert_at"(%List* %array, i64 2, i32 300)
store i32 0, i32* %i1, align 4
br label %loop.cond2
loop.cond2: ; preds = %loop.body5, %loop.exit
%14 = load i32, i32* %i1, align 4
%15 = call i64 @"std_array_list$$int_List_len"(%List* %array)
%uisitrunc3 = trunc i64 %15 to i32
%lt4 = icmp slt i32 %14, %uisitrunc3
br i1 %lt4, label %loop.body5, label %loop.exit8
loop.body5: ; preds = %loop.cond2
%16 = load i32, i32* %i1, align 4
%17 = load i32, i32* %i1, align 4
%siuiext6 = sext i32 %17 to i64
%18 = call i32 @"std_array_list$$int_List_get"(%List* %array, i64 %siuiext6)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i32 0, i32 0), i32 %16, i32 %18)
%20 = load i32, i32* %i1, align 4
%add7 = add i32 %20, 1
store i32 %add7, i32* %i1, align 4
br label %loop.cond2
loop.exit8: ; preds = %loop.cond2
call void @"std_array_list$$int_List_free"(%List* %array)
%21 = bitcast %Blob* %a to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %21, i8* align 4 bitcast (%Blob* @.__const.6 to i8*), i32 4, i1 false)
%22 = bitcast %Blob.0* %b to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %22, i8* align 8 bitcast (%Blob.0* @.__const.7 to i8*), i32 8, i1 false)
%23 = getelementptr inbounds %Blob, %Blob* %a, i32 0, i32 0
%24 = load i32, i32* %23, align 4
%25 = call i32 @"test2$$int_getValue"(i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i32 0, i32 0), i32 %25)
%27 = getelementptr inbounds %Blob.0, %Blob.0* %b, i32 0, i32 0
%28 = bitcast i64* %tempcoerce to i8*
%29 = bitcast double* %27 to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %28, i8* align 8 %29, i32 8, i1 false)
%30 = load i64, i64* %tempcoerce, align 8
%31 = call double @"test2$$double_getValue"(i64 %30)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i32 0, i32 0), double %31)
%33 = call i32 @"test2$$int_getMult"(i32 25)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i32 0, i32 0), i32 %33)
%35 = call double @"test2$$double_getMult"(double 3.300000e+00)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i32 0, i32 0), double %35)
call void @test_helloWorld()
%37 = getelementptr inbounds %Foo, %Foo* %ddx, i32 0, i32 0
store i32 0, i32* %37, align 4
%38 = getelementptr inbounds %Foo, %Foo* %ddx, i32 0, i32 1
store i32 0, i32* %38, align 4
store i32 3, i32* %fro, align 4
%39 = bitcast [4 x i32]* %x to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 16 %39, i8* align 16 bitcast ([4 x i32]* @.__const.12 to i8*), i32 16, i1 false)
%40 = load i32, i32* %fro, align 4
%41 = getelementptr inbounds %"int[]", %"int[]"* %vararg, i32 0, i32 1
%42 = getelementptr inbounds %"int[]", %"int[]"* %vararg, i32 0, i32 0
store i64 4, i64* %41, align 8
%43 = bitcast [4 x i32]* %x to i32*
store i32* %43, i32** %42, align 8
%44 = bitcast %"int[]"* %indirectarg to i8*
%45 = bitcast %"int[]"* %vararg to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %44, i8* align 8 %45, i32 16, i1 false)
%46 = call i32 @test_sum_us(%"int[]"* align 8 %indirectarg)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i32 0, i32 0), i32 %46)
%add9 = add i32 %40, %47
store i32 %add9, i32* %fro, align 4
%48 = load i32, i32* %fro, align 4
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i32 0, i32 0), i32 %48)
%50 = bitcast [4 x i32]* %x to i32*
%51 = insertvalue %"int[]" undef, i32* %50, 0
%52 = insertvalue %"int[]" %51, i64 4, 1
store %"int[]" %52, %"int[]"* %z, align 8
%53 = bitcast [3 x i32]* %de to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %53, i8* align 4 bitcast ([3 x i32]* @.__const.15 to i8*), i32 12, i1 false)
%54 = getelementptr inbounds %"int[]", %"int[]"* %vararg10, i32 0, i32 1
%55 = getelementptr inbounds %"int[]", %"int[]"* %vararg10, i32 0, i32 0
store i64 4, i64* %54, align 8
%56 = bitcast [4 x i32]* %x to i32*
store i32* %56, i32** %55, align 8
%57 = bitcast %"int[]"* %indirectarg11 to i8*
%58 = bitcast %"int[]"* %vararg10 to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %57, i8* align 8 %58, i32 16, i1 false)
%59 = call i32 @test_sum_us(%"int[]"* align 8 %indirectarg11)
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.16, i32 0, i32 0), i32 %59)
%61 = getelementptr inbounds %"int[]", %"int[]"* %vararg12, i32 0, i32 1
%62 = getelementptr inbounds %"int[]", %"int[]"* %vararg12, i32 0, i32 0
%63 = bitcast %"int[]"* %indirectarg13 to i8*
%64 = bitcast %"int[]"* %z to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %63, i8* align 8 %64, i32 16, i1 false)
%65 = call i32 @test_sum_us(%"int[]"* align 8 %indirectarg13)
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i32 0, i32 0), i32 %65)
%67 = getelementptr inbounds [4 x i32], [4 x i32]* %varargslots, i64 0, i64 0
store i32 1, i32* %67, align 4
%68 = getelementptr inbounds [4 x i32], [4 x i32]* %varargslots, i64 0, i64 1
store i32 2, i32* %68, align 4
%69 = getelementptr inbounds [4 x i32], [4 x i32]* %varargslots, i64 0, i64 2
store i32 4, i32* %69, align 4
%70 = getelementptr inbounds [4 x i32], [4 x i32]* %varargslots, i64 0, i64 3
store i32 5, i32* %70, align 4
%71 = getelementptr inbounds %"int[]", %"int[]"* %vararg14, i32 0, i32 1
store i64 4, i64* %71, align 8
%72 = getelementptr inbounds %"int[]", %"int[]"* %vararg14, i32 0, i32 0
%73 = bitcast [4 x i32]* %varargslots to i32*
store i32* %73, i32** %72, align 8
%74 = bitcast %"int[]"* %indirectarg15 to i8*
%75 = bitcast %"int[]"* %vararg14 to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %74, i8* align 8 %75, i32 16, i1 false)
%76 = call i32 @test_sum_us(%"int[]"* align 8 %indirectarg15)
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.18, i32 0, i32 0), i32 %76)
%78 = getelementptr inbounds [1 x i32], [1 x i32]* %varargslots17, i64 0, i64 0
store i32 1, i32* %78, align 4
%79 = getelementptr inbounds %"int[]", %"int[]"* %vararg16, i32 0, i32 1
store i64 1, i64* %79, align 8
%80 = getelementptr inbounds %"int[]", %"int[]"* %vararg16, i32 0, i32 0
%81 = bitcast [1 x i32]* %varargslots17 to i32*
store i32* %81, i32** %80, align 8
%82 = bitcast %"int[]"* %indirectarg18 to i8*
%83 = bitcast %"int[]"* %vararg16 to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %82, i8* align 8 %83, i32 16, i1 false)
%84 = call i32 @test_sum_us(%"int[]"* align 8 %indirectarg18)
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.19, i32 0, i32 0), i32 %84)
%86 = getelementptr inbounds %"int[]", %"int[]"* %vararg19, i32 0, i32 1
store i64 0, i64* %86, align 8
%87 = bitcast %"int[]"* %indirectarg20 to i8*
%88 = bitcast %"int[]"* %vararg19 to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %87, i8* align 8 %88, i32 16, i1 false)
%89 = call i32 @test_sum_us(%"int[]"* align 8 %indirectarg20)
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.20, i32 0, i32 0), i32 %89)
store i32 (double, %Bobo*)* null, i32 (double, %Bobo*)** %a1, align 8
store i32 (double, %Bobo*)* null, i32 (double, %Bobo*)** %b2, align 8
ret void
}
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i32, i1 immarg) #1
declare void @hello_world_hello()
declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #2
declare void @"std_array_linkedlist$$int_LinkedList_push"(%LinkedList*, i32)
declare i64 @"std_array_linkedlist$$int_LinkedList_len"(%LinkedList*)
declare i32 @"std_array_linkedlist$$int_LinkedList_get"(%LinkedList*, i64)
declare void @"std_array_linkedlist$$int_LinkedList_free"(%LinkedList*)
declare void @"std_array_list$$int_List_append"(%List*, i32)
declare void @"std_array_list$$int_List_push"(%List*, i32)
declare void @"std_array_list$$int_List_insert_at"(%List*, i64, i32)
declare i64 @"std_array_list$$int_List_len"(%List*)
declare i32 @"std_array_list$$int_List_get"(%List*, i64)
declare void @"std_array_list$$int_List_free"(%List*)
declare i32 @"test2$$int_getValue"(i32)
declare double @"test2$$double_getValue"(i64)
declare i32 @"test2$$int_getMult"(i32)
declare double @"test2$$double_getMult"(double)
// #expect: hello_world.ll
define void @hello_world_hello() #0 {
entry:
%0 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0))
%1 = call double @"foo$$double_check"(double 1.110000e+01)
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), double %1)
ret void
}
// #expect: foo.double.ll
define double @"foo$$double_check"(double %0)
entry:
%fmul = fmul double %0, %0
ret double %fmul
// #expect: test2.int.ll
%Blob = type { i32 }
@"test2$$int_argh" = local_unnamed_addr global i32 234, align 4
define i32 @"test2$$int_getMult"(i32 %0)
entry:
%mul = mul i32 %0, %0
ret i32 %mul
define i32 @"test2$$int_hello"()
entry:
ret i32 1
}
define i32 @"test2$$int_getValue"(i32 %0)
entry:
%blob = alloca %Blob, align 4
%1 = getelementptr inbounds %Blob, %Blob* %blob, i32 0, i32 0
store i32 %0, i32* %1, align 4
%2 = getelementptr inbounds %Blob, %Blob* %blob, i32 0, i32 0
%3 = load i32, i32* %2, align 4
ret i32 %3
// #expect: test2.double.ll
%Blob = type { double }
@"test2$$double_argh" = local_unnamed_addr global double 2.340000e+02, align 8
define double @"test2$$double_getMult"(double %0)
entry:
%fmul = fmul double %0, %0
ret double %fmul
define i32 @"test2$$double_hello"()
entry:
ret i32 1
define double @"test2$$double_getValue"(i64 %0)
entry:
%blob = alloca %Blob, align 8
%1 = getelementptr inbounds %Blob, %Blob* %blob, i32 0, i32 0
%2 = bitcast double* %1 to i64*
store i64 %0, i64* %2, align 8
%3 = getelementptr inbounds %Blob, %Blob* %blob, i32 0, i32 0
%4 = load double, double* %3, align 8
ret double %4