@@ -8,6 +8,9 @@
import java.util.Map;

import jx86.lang.*;
import jx86.lang.Instruction.AddrOp;
import jx86.lang.Instruction.AddrRegOp;
import jx86.lang.Instruction.AddrRegRegOp;
import jx86.lang.Instruction.RegRegOp;
import whilelang.lang.*;
import whilelang.util.*;
@@ -608,13 +611,13 @@ public void translate(Expr.Constant e, Register target,
List<Instruction> instructions = code.instructions;
String label = freshLabel();
Type type = e.attribute(Attribute.Type.class).type;
addTypeConstant(type, label, data);
Register to = freeRegisters.get(0);
addDataConstant(e, label, data);

// instructions.add(new Instruction.RegReg(RegRegOp.mov ,target ,to ));
// TODO: implement me!
instructions.add(new Instruction.AddrReg(AddrRegOp.lea, label, target));
}



public void translate(Expr.Cast e, Register target,
List<Register> freeRegisters, Map<String, Integer> localVariables,
X86File.Code code, X86File.Data data) {
@@ -1215,6 +1218,26 @@ private void addNaturalWordConstant(long value, String label, X86File.Data data)
data.constants.add(item);
}

private void addDataConstant(whilelang.lang.Expr e, String label, X86File.Data data){
if(e.attribute(Attribute.Type.class).type instanceof Type.Strung){
addStringConstant((Expr.Constant) e, label, data);
}
else if(e.attribute(Attribute.Type.class).type instanceof Type.Bool){
addBooleanConstant((Expr.Constant) e, label, data);
}
System.out.println(e);
}

private void addStringConstant(whilelang.lang.Expr.Constant e, String label, X86File.Data data ) {
Constant item = new Constant.String(label, (String) e.getValue());
data.constants.add(item);
}

private void addBooleanConstant(whilelang.lang.Expr.Constant e, String label, X86File.Data data ) {
Constant item = new Constant.Word(label, (Integer) e.getValue());
data.constants.add(item);
}

/**
* Add a standard main method which will be called by the operating system
* when this process is executed. This sequence is operating system
@@ -56,7 +56,7 @@ public void compileWithGcc(String dir, String target, String... files) {
System.err
.println("============================================================");
fail("Problem running gcc to compile test");
}
}
} catch (Exception ex) {
ex.printStackTrace();
fail("Problem running gcc to compile test");
@@ -85,12 +85,16 @@ public String runNative(String dir, String executable) {
return null;
}
}

@Test
public void BoolAssign_Valid_1() {
runX86Test("BoolAssign_Valid_1");
}

// @Test
// public void BoolAssign_Valid_1() {
// runX86Test("BoolAssign_Valid_1");
// }
// @Test
// public void baseline() {
// runX86Test("baseline");
// }
//
// @Test
// public void BoolAssign_Valid_2() {
// runX86Test("BoolAssign_Valid_2");
@@ -175,12 +179,12 @@ public void BoolAssign_Valid_1() {
// public void Char_Valid_3() {
// runX86Test("Char_Valid_3");
// }
//
// @Test
// public void Const_Valid_1() {
// runX86Test("Const_Valid_1");
// }
//

@Test
public void Const_Valid_1() {
runX86Test("Const_Valid_1");
}

// @Test
// public void Const_Valid_2() {
// runX86Test("Const_Valid_2");
Binary file not shown.
@@ -4,10 +4,12 @@ wl_main:
pushq %rbp
movq %rsp, %rbp
subq $8, %rsp
leaq label1, %rdi
movq %rdi, -8(%rbp)
movq -8(%rbp), %rdi
leaq label2(%rip), %rsi
call print
leaq label3, %rdi
movq %rdi, -8(%rbp)
movq -8(%rbp), %rdi
leaq label4(%rip), %rsi
@@ -1,2 +1,2 @@
true
false
false
@@ -1,5 +1,5 @@
void main() {
bool x = true;
bool x = true;
print x;
x = false;
print x;
@@ -0,0 +1,109 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $8, %rsp
movq 32(%rbp), %rdi
movq 24(%rbp), %rbx
cmpq %rbx, %rdi
jz label1
movq $0, %rdi
jmp label2
label1:
movq $1, %rdi
label2:
movq %rdi, -8(%rbp)
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_g:
pushq %rbp
movq %rsp, %rbp
subq $8, %rsp
movq 32(%rbp), %rdi
movq 24(%rbp), %rbx
cmpq %rbx, %rdi
jge label4
movq $0, %rdi
jmp label5
label4:
movq $1, %rdi
label5:
movq %rdi, -8(%rbp)
label3:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $24, %rsp
leaq label7, %rdi
movq %rdi, 16(%rsp)
leaq label8, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label9(%rip), %rsi
call print
subq $24, %rsp
leaq label10, %rdi
movq %rdi, 16(%rsp)
leaq label11, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label12(%rip), %rsi
call print
subq $24, %rsp
leaq label13, %rdi
movq %rdi, 16(%rsp)
leaq label14, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label15(%rip), %rsi
call print
subq $24, %rsp
leaq label16, %rdi
movq %rdi, 16(%rsp)
leaq label17, %rdi
movq %rdi, 8(%rsp)
call wl_g
movq 0(%rsp), %rdi
leaq label18(%rip), %rsi
call print
subq $24, %rsp
leaq label19, %rdi
movq %rdi, 16(%rsp)
leaq label20, %rdi
movq %rdi, 8(%rsp)
call wl_g
movq 0(%rsp), %rdi
leaq label21(%rip), %rsi
call print
label6:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label9:
.quad 3
label12:
.quad 3
label15:
.quad 3
label18:
.quad 3
label21:
.quad 3
@@ -0,0 +1,37 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
leaq label2, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label3(%rip), %rsi
call print
label1:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label3:
.quad 4
Binary file not shown.
@@ -0,0 +1,40 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq 0(%rdi), %rax
movq %rax, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
movq 0(%rdi), %rax
movq %rax, 8(%rsp)
call wl_f
movq %rsp, %rdi
addq $0, %rdi
leaq label2(%rip), %rsi
call print
label1:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label2:
.quad 7
.quad 4
@@ -0,0 +1,47 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq 0(%rdi), %rax
movq %rax, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
subq $8, %rsp
leaq label2, %rdi
movq %rdi, 0(%rsp)
movq %rsp, %rdi
movq 0(%rdi), %rax
movq %rax, 8(%rsp)
call wl_f
movq %rsp, %rdi
addq $0, %rdi
leaq label3(%rip), %rsi
call print
label1:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label3:
.quad 6
.quad 1
.quad 1
.asciz "x"
.quad 4
@@ -0,0 +1,93 @@

.text
wl_iof:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $24, %rsp
leaq label2, %rdi
movq %rdi, 16(%rsp)
leaq label3, %rdi
movq %rdi, 8(%rsp)
call wl_iof
movq 0(%rsp), %rdi
leaq label4(%rip), %rsi
call print
subq $24, %rsp
leaq label5, %rdi
movq %rdi, 16(%rsp)
leaq label6, %rdi
movq %rdi, 8(%rsp)
call wl_iof
movq 0(%rsp), %rdi
leaq label7(%rip), %rsi
call print
subq $24, %rsp
leaq label8, %rdi
movq %rdi, 16(%rsp)
leaq label9, %rdi
movq %rdi, 8(%rsp)
call wl_iof
movq 0(%rsp), %rdi
leaq label10(%rip), %rsi
call print
subq $24, %rsp
leaq label11, %rdi
movq %rdi, 16(%rsp)
leaq label12, %rdi
movq %rdi, 8(%rsp)
call wl_iof
movq 0(%rsp), %rdi
leaq label13(%rip), %rsi
call print
subq $24, %rsp
leaq label14, %rdi
movq %rdi, 16(%rsp)
leaq label15, %rdi
movq %rdi, 8(%rsp)
call wl_iof
movq 0(%rsp), %rdi
leaq label16(%rip), %rsi
call print
label1:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label2:
.asciz "Hello"
label4:
.quad 2
label5:
.asciz "Hello"
label7:
.quad 2
label8:
.asciz "Hello"
label10:
.quad 2
label11:
.asciz "Hello"
label13:
.quad 2
label14:
.asciz "Hello"
label16:
.quad 2
@@ -0,0 +1,41 @@

.text
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $16, %rsp
subq $16, %rsp
leaq label1, %rdi
movq %rdi, 8(%rsp)
leaq label2, %rdi
movq %rdi, 0(%rsp)
movq %rsp, %rdi
movq 8(%rdi), %rax
movq %rax, -8(%rbp)
movq 0(%rdi), %rax
movq %rax, -16(%rbp)
movq %rbp, %rdi
addq $-16, %rdi
leaq label3(%rip), %rsi
call print
label0:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label3:
.quad 6
.quad 2
.quad 1
.asciz "x"
.quad 4
.quad 1
.asciz "y"
.quad 4
@@ -0,0 +1,62 @@

.text
wl_f1:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
leaq label1, %rdi
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_f2:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
leaq label3, %rdi
movq %rdi, 16(%rbp)
jmp label2
label2:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
leaq label5, %rdi
movq %rdi, 8(%rsp)
call wl_f2
movq 0(%rsp), %rdi
leaq label6(%rip), %rsi
call print
subq $16, %rsp
leaq label7, %rdi
movq %rdi, 8(%rsp)
call wl_f1
movq 0(%rsp), %rdi
leaq label8(%rip), %rsi
call print
label4:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label1:
.asciz "GOT REAL"
label3:
.asciz "GOT INT"
label6:
.quad 5
label8:
.quad 5
@@ -0,0 +1,50 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
leaq label1, %rdi
movq 24(%rbp), %rbx
movq %rdi, %rdi
movq %rbx, %rsi
leaq label2(%rip), %rdx
call _str_left_append
movq %rax, %rdi
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $8, %rsp
leaq label4, %rdi
movq %rdi, -8(%rbp)
subq $16, %rsp
movq -8(%rbp), %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label5(%rip), %rsi
call print
label3:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label1:
.asciz ""
label2:
.quad 3
label5:
.quad 5
@@ -0,0 +1,57 @@

.text
wl_g:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq 24(%rbp), %rdi
leaq label1, %rbx
addq %rbx, %rdi
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq 24(%rbp), %rdi
movq %rdi, 16(%rbp)
jmp label2
label2:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $8, %rsp
leaq label4, %rdi
movq %rdi, -8(%rbp)
subq $16, %rsp
subq $16, %rsp
movq -8(%rbp), %rdi
movq %rdi, 8(%rsp)
call wl_g
movq 0(%rsp), %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label5(%rip), %rsi
call print
label3:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label5:
.quad 3
@@ -0,0 +1,71 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
leaq label2, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label3(%rip), %rsi
call print
subq $16, %rsp
leaq label4, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label5(%rip), %rsi
call print
subq $16, %rsp
leaq label6, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label7(%rip), %rsi
call print
subq $16, %rsp
leaq label8, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label9(%rip), %rsi
call print
subq $16, %rsp
leaq label10, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label11(%rip), %rsi
call print
label1:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label3:
.quad 5
label5:
.quad 5
label7:
.quad 5
label9:
.quad 5
label11:
.quad 5
@@ -0,0 +1,74 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
leaq label1, %rdi
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
leaq label3, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label4(%rip), %rsi
call print
subq $16, %rsp
leaq label5, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label6(%rip), %rsi
call print
subq $16, %rsp
leaq label7, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label8(%rip), %rsi
call print
subq $16, %rsp
leaq label9, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label10(%rip), %rsi
call print
subq $16, %rsp
leaq label11, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label12(%rip), %rsi
call print
label2:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label4:
.quad 3
label6:
.quad 3
label8:
.quad 3
label10:
.quad 3
label12:
.quad 3
@@ -0,0 +1,71 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
leaq label2, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label3(%rip), %rsi
call print
subq $16, %rsp
leaq label4, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label5(%rip), %rsi
call print
subq $16, %rsp
leaq label6, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label7(%rip), %rsi
call print
subq $16, %rsp
leaq label8, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label9(%rip), %rsi
call print
subq $16, %rsp
leaq label10, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label11(%rip), %rsi
call print
label1:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label3:
.quad 3
label5:
.quad 3
label7:
.quad 3
label9:
.quad 3
label11:
.quad 3
@@ -0,0 +1,58 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $8, %rsp
leaq label1, %rdi
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
leaq label3, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label4(%rip), %rsi
call print
subq $16, %rsp
leaq label5, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label6(%rip), %rsi
call print
subq $16, %rsp
leaq label7, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label8(%rip), %rsi
call print
label2:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label1:
.asciz ""
label4:
.quad 5
label6:
.quad 5
label8:
.quad 5
@@ -0,0 +1,47 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq 32(%rbp), %rdi
movq 24(%rbp), %rbx
movq %rdi, %rax
cltd
idivq %rbx
movq %rax, %rdi
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $8, %rsp
subq $24, %rsp
leaq label2, %rdi
movq %rdi, 16(%rsp)
leaq label3, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
movq %rdi, -8(%rbp)
movq -8(%rbp), %rdi
leaq label4(%rip), %rsi
call print
label1:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label4:
.quad 3
@@ -0,0 +1,43 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq 24(%rbp), %rdi
leaq label1, %rbx
movq %rdi, %rax
cltd
idivq %rbx
movq %rax, %rdi
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
leaq label3, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label4(%rip), %rsi
call print
label2:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label4:
.quad 3
@@ -0,0 +1,57 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $24, %rsp
movq %rdi, 16(%rsp)
leaq label2, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label3(%rip), %rsi
call print
subq $24, %rsp
movq %rdi, 16(%rsp)
leaq label4, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label5(%rip), %rsi
call print
subq $24, %rsp
leaq label6, %rdi
movq %rdi, 16(%rsp)
leaq label7, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label8(%rip), %rsi
call print
label1:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label3:
.quad 5
label5:
.quad 5
label8:
.quad 5
@@ -0,0 +1,29 @@

.text
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $8, %rsp
leaq label1, %rdi
leaq label2, %rbx
imulq %rbx, %rdi
leaq label3, %rbx
addq %rbx, %rdi
movq %rdi, -8(%rbp)
movq -8(%rbp), %rdi
leaq label4(%rip), %rsi
call print
label0:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label4:
.quad 3
Binary file not shown.
@@ -0,0 +1,53 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $16, %rsp
movq %rdi, -8(%rbp)
movq %rdi, -16(%rbp)
movq -16(%rbp), %rdi
movq -8(%rbp), %rbx
addq %rbx, %rdi
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $8, %rsp
movq 0(%rdi), %rax
movq %rax, -8(%rbp)
subq $16, %rsp
movq %rbp, %rdi
addq $-8, %rdi
movq 0(%rdi), %rax
movq %rax, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label2(%rip), %rsi
call print
movq %rbp, %rdi
addq $-8, %rdi
leaq label3(%rip), %rsi
call print
label1:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label2:
.quad 3
label3:
.quad 7
.quad 3
@@ -0,0 +1,39 @@

.text
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $16, %rsp
movq 0(%rdi), %rax
movq %rax, -16(%rbp)
movq %rbp, %rdi
addq $-16, %rdi
movq 0(%rdi), %rax
movq %rax, -8(%rbp)
leaq label1, %rdi
movq %rbp, %rdi
addq $-16, %rdi
leaq label2(%rip), %rsi
call print
movq %rbp, %rdi
addq $-8, %rdi
leaq label3(%rip), %rsi
call print
label0:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label2:
.quad 7
.quad 3
label3:
.quad 7
.quad 3
@@ -0,0 +1,39 @@

.text
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $16, %rsp
movq 0(%rdi), %rax
movq %rax, -16(%rbp)
movq %rbp, %rdi
addq $-16, %rdi
movq 0(%rdi), %rax
movq %rax, -8(%rbp)
leaq label1, %rdi
movq %rbp, %rdi
addq $-16, %rdi
leaq label2(%rip), %rsi
call print
movq %rbp, %rdi
addq $-8, %rdi
leaq label3(%rip), %rsi
call print
label0:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label2:
.quad 7
.quad 3
label3:
.quad 7
.quad 3
Binary file not shown.
@@ -0,0 +1,44 @@

.text
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $16, %rsp
movq 0(%rdi), %rax
movq %rax, -8(%rbp)
movq %rbp, %rdi
addq $-8, %rdi
movq 0(%rdi), %rax
movq %rax, -16(%rbp)
leaq label1(%rip), %rsi
call print
leaq label2(%rip), %rsi
call print
leaq label3(%rip), %rsi
call print
leaq label4(%rip), %rsi
call print
label0:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label1:
.quad 7
.quad 3
label2:
.quad 7
.quad 3
label3:
.quad 7
.quad 3
label4:
.quad 7
.quad 3
@@ -0,0 +1,58 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq 0(%rdi), %rax
movq %rax, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $16, %rsp
subq $8, %rsp
call wl_f
movq %rsp, %rdi
addq $0, %rdi
movq 0(%rdi), %rax
movq %rax, -8(%rbp)
subq $8, %rsp
call wl_f
movq %rsp, %rdi
addq $0, %rdi
movq 0(%rdi), %rax
movq %rax, -16(%rbp)
leaq label2, %rdi
leaq label3(%rip), %rsi
call print
leaq label4(%rip), %rsi
call print
leaq label5(%rip), %rsi
call print
leaq label6(%rip), %rsi
call print
label1:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label3:
.quad 3
label4:
.quad 3
label5:
.quad 3
label6:
.quad 3
@@ -0,0 +1,69 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
leaq label1, %rdi
leaq label2, %rdi
movq %rbp, %rbx
addq $24, %rbx
movq %rdi, %rdi
movq %rbx, %rsi
leaq label3(%rip), %rdx
call _str_left_append
movq %rax, %rdi
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $8, %rsp
movq 0(%rdi), %rax
movq %rax, -8(%rbp)
movq %rbp, %rdi
addq $-8, %rdi
leaq label5(%rip), %rsi
call print
subq $16, %rsp
movq %rbp, %rdi
addq $-8, %rdi
movq 0(%rdi), %rax
movq %rax, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label6(%rip), %rsi
call print
movq %rbp, %rdi
addq $-8, %rdi
leaq label7(%rip), %rsi
call print
label4:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label2:
.asciz ""
label3:
.quad 7
.quad 3
label5:
.quad 7
.quad 3
label6:
.quad 5
label7:
.quad 7
.quad 3
@@ -0,0 +1,50 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
leaq label1, %rdi
movq %rbp, %rbx
addq $24, %rbx
movq %rdi, %rdi
movq %rbx, %rsi
leaq label2(%rip), %rdx
call _str_left_append
movq %rax, %rdi
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
movq 0(%rdi), %rax
movq %rax, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label4(%rip), %rsi
call print
label3:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label1:
.asciz ""
label2:
.quad 7
.quad 4
label4:
.quad 5
Binary file not shown.
@@ -0,0 +1,53 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq %rbp, %rdi
addq $24, %rdi
movq 0(%rdi), %rax
movq %rax, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
movq 0(%rdi), %rax
movq %rax, 8(%rsp)
call wl_f
movq %rsp, %rdi
addq $0, %rdi
leaq label2(%rip), %rsi
call print
subq $16, %rsp
movq 0(%rdi), %rax
movq %rax, 8(%rsp)
call wl_f
movq %rsp, %rdi
addq $0, %rdi
leaq label3(%rip), %rsi
call print
label1:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label2:
.quad 7
.quad 3
label3:
.quad 7
.quad 3
Binary file not shown.
@@ -0,0 +1,81 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_g:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq %rbp, %rdi
addq $24, %rdi
leaq label2(%rip), %rsi
call print
movq %rbp, %rdi
addq $16, %rdi
leaq label3(%rip), %rsi
call print
subq $24, %rsp
movq %rbp, %rdi
addq $24, %rdi
movq 0(%rdi), %rax
movq %rax, 16(%rsp)
movq %rbp, %rdi
addq $16, %rdi
movq 0(%rdi), %rax
movq %rax, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label4(%rip), %rsi
call print
label1:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
movq 0(%rdi), %rax
movq %rax, 8(%rsp)
movq 0(%rdi), %rax
movq %rax, 0(%rsp)
call wl_g
subq $16, %rsp
movq 0(%rdi), %rax
movq %rax, 8(%rsp)
movq 0(%rdi), %rax
movq %rax, 0(%rsp)
call wl_g
subq $16, %rsp
movq 0(%rdi), %rax
movq %rax, 8(%rsp)
movq 0(%rdi), %rax
movq %rax, 0(%rsp)
call wl_g
label5:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label2:
.quad 7
.quad 3
label3:
.quad 7
.quad 3
label4:
.quad 5
Binary file not shown.
@@ -0,0 +1,39 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $8, %rsp
movq 0(%rdi), %rax
movq %rax, -8(%rbp)
subq $16, %rsp
movq %rbp, %rdi
addq $-8, %rdi
movq 0(%rdi), %rax
movq %rax, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label2(%rip), %rsi
call print
label1:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label2:
.quad 5
Binary file not shown.
@@ -0,0 +1,24 @@

.text
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $8, %rsp
movq 0(%rdi), %rax
movq %rax, -8(%rbp)
leaq label1(%rip), %rsi
call print
label0:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label1:
.quad 3
Binary file not shown.
@@ -0,0 +1,24 @@

.text
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $8, %rsp
movq 0(%rdi), %rax
movq %rax, -8(%rbp)
leaq label1(%rip), %rsi
call print
label0:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label1:
.quad 3
@@ -0,0 +1,59 @@

.text
wl_g:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
leaq label1, %rbx
movq %rdi, %rax
cltd
idivq %rbx
movq %rax, %rdi
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
movq 32(%rbp), %rdi
movq %rdi, 8(%rsp)
call wl_g
movq 0(%rsp), %rdi
movq %rdi, 16(%rbp)
jmp label2
label2:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $24, %rsp
leaq label4, %rdi
movq %rdi, 16(%rsp)
leaq label5, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label6(%rip), %rsi
call print
label3:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label6:
.quad 4
@@ -0,0 +1,43 @@

.text
wl_g:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq 24(%rbp), %rdi
leaq label1, %rbx
movq %rdi, %rax
cltd
idivq %rbx
movq %rax, %rdi
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
leaq label3, %rdi
movq %rdi, 8(%rsp)
call wl_g
movq 0(%rsp), %rdi
leaq label4(%rip), %rsi
call print
label2:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label4:
.quad 4
@@ -0,0 +1,65 @@

.text
wl_diver:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq 40(%rbp), %rdi
movq 32(%rbp), %rbx
movq 24(%rbp), %rbx
movq %rbx, %rax
cltd
idivq %rbx
movq %rax, %rbx
movq %rdi, %rax
cltd
idivq %rbx
movq %rax, %rdi
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $32, %rsp
leaq label2, %rdi
movq %rdi, 24(%rsp)
leaq label3, %rdi
movq %rdi, 16(%rsp)
leaq label4, %rdi
movq %rdi, 8(%rsp)
call wl_diver
movq 0(%rsp), %rdi
leaq label5(%rip), %rsi
call print
subq $32, %rsp
leaq label6, %rdi
movq %rdi, 24(%rsp)
leaq label7, %rdi
movq %rdi, 16(%rsp)
leaq label8, %rdi
movq %rdi, 8(%rsp)
call wl_diver
movq 0(%rsp), %rdi
leaq label9(%rip), %rsi
call print
label1:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label5:
.quad 4
label9:
.quad 4
@@ -0,0 +1,57 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq 24(%rbp), %rdi
negq %rdi
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
leaq label2, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label3(%rip), %rsi
call print
subq $16, %rsp
leaq label4, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label5(%rip), %rsi
call print
subq $16, %rsp
leaq label6, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label7(%rip), %rsi
call print
label1:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label3:
.quad 4
label5:
.quad 4
label7:
.quad 4
@@ -0,0 +1,40 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
leaq label1, %rdi
movq 24(%rbp), %rbx
subq %rbx, %rdi
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
leaq label3, %rdi
movq %rdi, 8(%rsp)
call wl_f
movq 0(%rsp), %rdi
leaq label4(%rip), %rsi
call print
label2:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label4:
.quad 4
@@ -0,0 +1,59 @@

.text
wl_suber:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq 40(%rbp), %rdi
movq 32(%rbp), %rbx
movq 24(%rbp), %rbx
subq %rbx, %rbx
subq %rbx, %rdi
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $32, %rsp
leaq label2, %rdi
movq %rdi, 24(%rsp)
leaq label3, %rdi
movq %rdi, 16(%rsp)
leaq label4, %rdi
movq %rdi, 8(%rsp)
call wl_suber
movq 0(%rsp), %rdi
leaq label5(%rip), %rsi
call print
subq $32, %rsp
leaq label6, %rdi
movq %rdi, 24(%rsp)
leaq label7, %rdi
movq %rdi, 16(%rsp)
leaq label8, %rdi
movq %rdi, 8(%rsp)
call wl_suber
movq 0(%rsp), %rdi
leaq label9(%rip), %rsi
call print
label1:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label5:
.quad 4
label9:
.quad 4
@@ -0,0 +1,53 @@

.text
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $16, %rsp
leaq label1, %rdi
movq %rdi, -8(%rbp)
leaq label2, %rdi
movq %rdi, -16(%rbp)
movq -8(%rbp), %rdi
movq -16(%rbp), %rbx
addq %rbx, %rdi
leaq label3(%rip), %rsi
call print
movq -16(%rbp), %rdi
movq -8(%rbp), %rbx
subq %rbx, %rdi
leaq label4(%rip), %rsi
call print
movq -8(%rbp), %rdi
movq -16(%rbp), %rbx
movq %rdi, %rax
cltd
idivq %rbx
movq %rax, %rdi
leaq label5(%rip), %rsi
call print
movq -8(%rbp), %rdi
movq -16(%rbp), %rbx
imulq %rbx, %rdi
leaq label6(%rip), %rsi
call print
label0:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label3:
.quad 4
label4:
.quad 4
label5:
.quad 4
label6:
.quad 4
@@ -0,0 +1,98 @@

.text
wl_sum1:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq %rbp, %rdi
addq $24, %rdi
movq 0(%rdi), %rdi
movq %rbp, %rbx
addq $24, %rbx
movq 8(%rbx), %rbx
addq %rbx, %rdi
movq %rdi, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_sum2:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq %rbp, %rdi
addq $24, %rdi
movq 0(%rdi), %rdi
movq %rbp, %rbx
addq $24, %rbx
movq 8(%rbx), %rbx
addq %rbx, %rdi
movq %rdi, 16(%rbp)
jmp label1
label1:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $32, %rsp
subq $16, %rsp
leaq label3, %rdi
movq %rdi, 8(%rsp)
leaq label4, %rdi
movq %rdi, 0(%rsp)
movq %rsp, %rdi
movq 8(%rdi), %rax
movq %rax, -8(%rbp)
movq 0(%rdi), %rax
movq %rax, -16(%rbp)
subq $24, %rsp
movq %rbp, %rdi
addq $-16, %rdi
movq 8(%rdi), %rax
movq %rax, 16(%rsp)
movq 0(%rdi), %rax
movq %rax, 8(%rsp)
call wl_sum1
movq 0(%rsp), %rdi
leaq label5(%rip), %rsi
call print
subq $16, %rsp
leaq label6, %rdi
movq %rdi, 8(%rsp)
leaq label7, %rdi
movq %rdi, 0(%rsp)
movq %rsp, %rdi
movq 8(%rdi), %rax
movq %rax, -24(%rbp)
movq 0(%rdi), %rax
movq %rax, -32(%rbp)
subq $24, %rsp
movq %rbp, %rdi
addq $-32, %rdi
movq 8(%rdi), %rax
movq %rax, 16(%rsp)
movq 0(%rdi), %rax
movq %rax, 8(%rsp)
call wl_sum2
movq 0(%rsp), %rdi
leaq label8(%rip), %rsi
call print
label2:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label5:
.quad 3
label8:
.quad 4
@@ -0,0 +1,66 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
leaq label1, %rdi
movq %rdi, 8(%rsp)
leaq label2, %rdi
movq %rdi, 0(%rsp)
movq %rsp, %rdi
movq 8(%rdi), %rax
movq %rax, 24(%rbp)
movq 0(%rdi), %rax
movq %rax, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $16, %rsp
subq $16, %rsp
call wl_f
movq %rsp, %rdi
addq $0, %rdi
movq 8(%rdi), %rax
movq %rax, -8(%rbp)
movq 0(%rdi), %rax
movq %rax, -16(%rbp)
movq %rbp, %rdi
addq $-16, %rdi
movq 8(%rdi), %rdi
leaq label4, %rbx
subq %rbx, %rdi
movq %rbp, %rsi
addq $-16, %rsi
movq %rdi, 0(%rsi)
movq %rbp, %rdi
addq $-16, %rdi
leaq label5(%rip), %rsi
call print
label3:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label5:
.quad 6
.quad 2
.quad 2
.asciz "f1"
.quad 3
.quad 2
.asciz "f2"
.quad 3
@@ -0,0 +1,97 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
movq %rbp, %rdi
addq $32, %rdi
movq 8(%rdi), %rdi
movq %rdi, 8(%rsp)
movq %rbp, %rdi
addq $32, %rdi
movq 0(%rdi), %rdi
leaq label1, %rbx
subq %rbx, %rdi
movq %rdi, 0(%rsp)
movq %rsp, %rdi
movq 8(%rdi), %rax
movq %rax, 24(%rbp)
movq 0(%rdi), %rax
movq %rax, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $32, %rsp
subq $16, %rsp
leaq label3, %rdi
movq %rdi, 8(%rsp)
leaq label4, %rdi
movq %rdi, 0(%rsp)
movq %rsp, %rdi
movq 8(%rdi), %rax
movq %rax, -8(%rbp)
movq 0(%rdi), %rax
movq %rax, -16(%rbp)
movq %rbp, %rdi
addq $-16, %rdi
leaq label5(%rip), %rsi
call print
leaq label6, %rdi
movq %rbp, %rsi
addq $-16, %rsi
movq %rdi, 0(%rsi)
subq $32, %rsp
movq %rbp, %rdi
addq $-16, %rdi
movq 8(%rdi), %rax
movq %rax, 24(%rsp)
movq 0(%rdi), %rax
movq %rax, 16(%rsp)
call wl_f
movq %rsp, %rdi
addq $0, %rdi
movq 8(%rdi), %rax
movq %rax, -24(%rbp)
movq 0(%rdi), %rax
movq %rax, -32(%rbp)
movq %rbp, %rdi
addq $-32, %rdi
leaq label7(%rip), %rsi
call print
label2:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label5:
.quad 6
.quad 2
.quad 2
.asciz "f1"
.quad 3
.quad 2
.asciz "f2"
.quad 3
label7:
.quad 6
.quad 2
.quad 2
.asciz "f1"
.quad 3
.quad 2
.asciz "f2"
.quad 3
@@ -0,0 +1,94 @@

.text
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $32, %rsp
subq $16, %rsp
leaq label1, %rdi
movq %rdi, 8(%rsp)
leaq label2, %rdi
movq %rdi, 0(%rsp)
movq %rsp, %rdi
movq 8(%rdi), %rax
movq %rax, -8(%rbp)
movq 0(%rdi), %rax
movq %rax, -16(%rbp)
subq $16, %rsp
leaq label3, %rdi
movq %rdi, 8(%rsp)
leaq label4, %rdi
movq %rdi, 0(%rsp)
movq %rsp, %rdi
movq 8(%rdi), %rax
movq %rax, -24(%rbp)
movq 0(%rdi), %rax
movq %rax, -32(%rbp)
movq %rbp, %rdi
addq $-16, %rdi
leaq label5(%rip), %rsi
call print
movq %rbp, %rdi
addq $-32, %rdi
leaq label6(%rip), %rsi
call print
leaq label7, %rdi
movq %rbp, %rsi
addq $-16, %rsi
movq %rdi, 0(%rsi)
movq %rbp, %rdi
addq $-16, %rdi
leaq label8(%rip), %rsi
call print
movq %rbp, %rdi
addq $-32, %rdi
leaq label9(%rip), %rsi
call print
label0:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label5:
.quad 6
.quad 2
.quad 2
.asciz "f1"
.quad 3
.quad 2
.asciz "f2"
.quad 3
label6:
.quad 6
.quad 2
.quad 2
.asciz "f1"
.quad 3
.quad 2
.asciz "f2"
.quad 3
label8:
.quad 6
.quad 2
.quad 2
.asciz "f1"
.quad 3
.quad 2
.asciz "f2"
.quad 3
label9:
.quad 6
.quad 2
.quad 2
.asciz "f1"
.quad 3
.quad 2
.asciz "f2"
.quad 3
@@ -0,0 +1,85 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $16, %rsp
leaq label1, %rdi
movq %rdi, 8(%rsp)
movq 32(%rbp), %rdi
movq %rdi, 0(%rsp)
movq %rsp, %rdi
movq 8(%rdi), %rax
movq %rax, 24(%rbp)
movq 0(%rdi), %rax
movq %rax, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $24, %rsp
leaq label3, %rdi
movq %rdi, -24(%rbp)
subq $24, %rsp
movq -24(%rbp), %rdi
movq %rdi, 16(%rsp)
call wl_f
movq %rsp, %rdi
addq $0, %rdi
movq 8(%rdi), %rax
movq %rax, -8(%rbp)
movq 0(%rdi), %rax
movq %rax, -16(%rbp)
movq %rbp, %rdi
addq $-16, %rdi
leaq label4(%rip), %rsi
call print
subq $16, %rsp
movq -24(%rbp), %rdi
movq %rdi, 8(%rsp)
movq -24(%rbp), %rdi
movq %rdi, 0(%rsp)
movq %rsp, %rdi
movq 8(%rdi), %rax
movq %rax, -8(%rbp)
movq 0(%rdi), %rax
movq %rax, -16(%rbp)
movq %rbp, %rdi
addq $-16, %rdi
leaq label5(%rip), %rsi
call print
label2:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label4:
.quad 6
.quad 2
.quad 2
.asciz "b1"
.quad 3
.quad 2
.asciz "b2"
.quad 3
label5:
.quad 6
.quad 2
.quad 2
.asciz "b1"
.quad 3
.quad 2
.asciz "b2"
.quad 3
@@ -0,0 +1,96 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $16, %rsp
subq $16, %rsp
movq 32(%rbp), %rdi
leaq label1, %rbx
addq %rbx, %rdi
movq %rdi, 8(%rsp)
movq 32(%rbp), %rdi
movq %rdi, 0(%rsp)
movq %rsp, %rdi
movq 8(%rdi), %rax
movq %rax, -8(%rbp)
movq 0(%rdi), %rax
movq %rax, -16(%rbp)
movq %rbp, %rdi
addq $-16, %rdi
movq 8(%rdi), %rax
movq %rax, 24(%rbp)
movq 0(%rdi), %rax
movq %rax, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
subq $24, %rsp
leaq label3, %rdi
movq %rdi, 16(%rsp)
call wl_f
movq %rsp, %rdi
addq $0, %rdi
leaq label4(%rip), %rsi
call print
subq $24, %rsp
leaq label5, %rdi
movq %rdi, 16(%rsp)
call wl_f
movq %rsp, %rdi
addq $0, %rdi
leaq label6(%rip), %rsi
call print
subq $24, %rsp
leaq label7, %rdi
movq %rdi, 16(%rsp)
call wl_f
movq %rsp, %rdi
addq $0, %rdi
leaq label8(%rip), %rsi
call print
label2:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label4:
.quad 6
.quad 2
.quad 2
.asciz "b1"
.quad 3
.quad 2
.asciz "b2"
.quad 3
label6:
.quad 6
.quad 2
.quad 2
.asciz "b1"
.quad 3
.quad 2
.asciz "b2"
.quad 3
label8:
.quad 6
.quad 2
.quad 2
.asciz "b1"
.quad 3
.quad 2
.asciz "b2"
.quad 3
@@ -0,0 +1,100 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
leaq label1, %rdi
movq %rbp, %rsi
addq $24, %rsi
movq 0(%rsi), %rsi
movq %rdi, 0(%rsi)
movq %rbp, %rdi
addq $24, %rdi
movq 0(%rdi), %rax
movq %rax, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $8, %rsp
subq $8, %rsp
subq $8, %rsp
leaq label3, %rdi
movq %rdi, 0(%rsp)
movq %rsp, %rdi
movq 0(%rdi), %rax
movq %rax, 0(%rsp)
movq %rsp, %rdi
movq 0(%rdi), %rax
movq %rax, -8(%rbp)
leaq label4, %rdi
movq %rbp, %rbx
addq $-8, %rbx
movq %rdi, %rdi
movq %rbx, %rsi
leaq label5(%rip), %rdx
call _str_left_append
movq %rax, %rdi
leaq label6(%rip), %rsi
call print
leaq label7, %rdi
subq $16, %rsp
movq %rbp, %rbx
addq $-8, %rbx
movq 0(%rbx), %rax
movq %rax, 8(%rsp)
call wl_f
movq %rsp, %rbx
addq $0, %rbx
movq %rdi, %rdi
movq %rbx, %rsi
leaq label8(%rip), %rdx
call _str_left_append
movq %rax, %rdi
leaq label9(%rip), %rsi
call print
label2:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label4:
.asciz "BEFORE: "
label5:
.quad 6
.quad 1
.quad 7
.asciz "current"
.quad 6
.quad 1
.quad 1
.asciz "x"
.quad 3
label6:
.quad 5
label7:
.asciz "AFTER: "
label8:
.quad 6
.quad 1
.quad 7
.asciz "current"
.quad 6
.quad 1
.quad 1
.asciz "x"
.quad 3
label9:
.quad 5
@@ -0,0 +1,64 @@

.text
wl_f:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq %rbp, %rdi
addq $32, %rdi
movq 8(%rdi), %rax
movq %rax, 24(%rbp)
movq 0(%rdi), %rax
movq %rax, 16(%rbp)
jmp label0
label0:
movq %rbp, %rsp
popq %rbp
ret
wl_main:
pushq %rbp
movq %rsp, %rbp
subq $16, %rsp
subq $32, %rsp
subq $16, %rsp
leaq label2, %rdi
movq %rdi, 8(%rsp)
leaq label3, %rdi
movq %rdi, 0(%rsp)
movq %rsp, %rdi
movq 8(%rdi), %rax
movq %rax, 24(%rsp)
movq 0(%rdi), %rax
movq %rax, 16(%rsp)
call wl_f
movq %rsp, %rdi
addq $0, %rdi
movq 8(%rdi), %rax
movq %rax, -8(%rbp)
movq 0(%rdi), %rax
movq %rax, -16(%rbp)
movq %rbp, %rdi
addq $-16, %rdi
leaq label4(%rip), %rsi
call print
label1:
movq %rbp, %rsp
popq %rbp
ret
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label4:
.quad 6
.quad 2
.quad 1
.asciz "x"
.quad 3
.quad 1
.asciz "y"
.quad 3
Binary file not shown.
@@ -4,22 +4,22 @@ wl_main:
pushq %rbp
movq %rsp, %rbp
subq $0, %rsp
movq %rsp, %rdi
leaq label1, %rdi
leaq label2(%rip), %rsi
call _print
call print
label0:
movq %rbp, %rsp
popq %rbp
ret
.globl _main
_main:
.globl main
main:
pushq %rbp
call wl_main
popq %rbp
ret

.data
label1:
.quad 5
.asciz "hello world"
label2:
.quad 5
File renamed without changes.
@@ -1,3 +1,3 @@
void main() {
void main(){
print "hello world";
}
}