安峻邑 2 weeks ago
commit 22d4cc18f2

6
.gitignore vendored

@ -68,3 +68,9 @@ Thumbs.db
# Project outputs
# =========================
test/test_result/
lab1_results/
lab2_results/
lab3_results/
lab4_results/
test_tmp/
test_fail/

@ -196,7 +196,8 @@ enum class Opcode {
Call,
Br,
CondBr,
Ret
Ret,
Phi
};
// User 是所有“会使用其他 Value 作为输入”的 IR 对象的抽象基类。
@ -351,6 +352,16 @@ class StoreInst : public Instruction {
Value* GetPtr() const;
};
class PhiInst : public Instruction {
public:
PhiInst(std::shared_ptr<Type> ty, std::string name);
void AddIncoming(BasicBlock* bb, Value* value);
size_t GetNumIncoming() const;
BasicBlock* GetIncomingBlock(size_t index) const;
Value* GetIncomingValue(size_t index) const;
void SetIncomingValue(size_t index, Value* value);
};
class Argument : public Value {
public:
Argument(std::shared_ptr<Type> ty, std::string name, size_t index);

@ -6,168 +6,358 @@
#include <string>
#include <vector>
namespace ir {
class Module;
namespace ir
{
class Module;
}
namespace mir {
class MIRContext {
public:
MIRContext() = default;
};
MIRContext& DefaultContext();
enum class PhysReg {
W0, W1, W2, W3, W4, W5, W6, W7, W8, W9, W10, W11, W12, W13, W14, W15,
W16, W17, W18, W19, W20, W21, W22, W23, W24, W25, W26, W27, W28, W29, W30,
X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15,
X16, X17, X18, X19, X20, X21, X22, X23, X24, X25, X26, X27, X28, X29, X30,
XZR, SP, WZR
};
const char* PhysRegName(PhysReg reg);
enum class Opcode {
Prologue,
Epilogue,
MovImm,
LoadStack,
StoreStack,
AddRR,
SubRR,
MulRR,
DivRR,
ModRR,
AndRR,
OrRR,
XorRR,
ShlRR,
ShrRR,
CmpRR,
CSet,
Br,
CondBr,
Call,
Ret,
LoadAddr,
LoadArrayBase,
MovReg,
};
enum class CondCode {
EQ, NE, LT, LE, GT, GE
};
class Operand {
public:
enum class Kind { Reg, Imm, FrameIndex, Label };
static Operand Reg(PhysReg reg);
static Operand Imm(int value);
static Operand FrameIndex(int index);
static Operand Label(int label_id);
Kind GetKind() const { return kind_; }
PhysReg GetReg() const { return reg_; }
int GetImm() const { return imm_; }
int GetFrameIndex() const { return imm_; }
int GetLabel() const { return imm_; }
private:
Operand(Kind kind, PhysReg reg, int imm);
Kind kind_;
PhysReg reg_;
int imm_;
};
class MachineInstr {
public:
MachineInstr(Opcode opcode, std::vector<Operand> operands = {});
Opcode GetOpcode() const { return opcode_; }
const std::vector<Operand>& GetOperands() const { return operands_; }
private:
Opcode opcode_;
std::vector<Operand> operands_;
};
struct FrameSlot {
int index = 0;
int size = 4;
int offset = 0;
bool is_array = false;
int array_size = 0;
};
class MachineBasicBlock {
public:
explicit MachineBasicBlock(std::string name);
const std::string& GetName() const { return name_; }
std::vector<MachineInstr>& GetInstructions() { return instructions_; }
const std::vector<MachineInstr>& GetInstructions() const { return instructions_; }
MachineInstr& Append(Opcode opcode,
std::initializer_list<Operand> operands = {});
private:
std::string name_;
std::vector<MachineInstr> instructions_;
};
class MachineFunction {
public:
explicit MachineFunction(std::string name);
const std::string& GetName() const { return name_; }
MachineBasicBlock& GetEntry() { return entry_; }
const MachineBasicBlock& GetEntry() const { return entry_; }
int CreateFrameIndex(int size = 4);
int CreateArrayFrameIndex(int array_size);
FrameSlot& GetFrameSlot(int index);
const FrameSlot& GetFrameSlot(int index) const;
const std::vector<FrameSlot>& GetFrameSlots() const { return frame_slots_; }
int GetFrameSize() const { return frame_size_; }
void SetFrameSize(int size) { frame_size_ = size; }
int GetNumParams() const { return num_params_; }
void SetNumParams(int n) { num_params_ = n; }
private:
std::string name_;
MachineBasicBlock entry_;
std::vector<FrameSlot> frame_slots_;
int frame_size_ = 0;
int num_params_ = 0;
};
class MachineModule {
public:
MachineModule() = default;
MachineFunction* CreateFunction(const std::string& name);
MachineFunction* GetFunction(const std::string& name) const;
const std::vector<std::unique_ptr<MachineFunction>>& GetFunctions() const { return functions_; }
std::vector<std::unique_ptr<MachineFunction>>& GetFunctions() { return functions_; }
void AddGlobal(const std::string& name, int init_value);
void AddGlobal(const std::string& name, size_t array_size, const std::vector<int>& init_values);
const std::vector<std::pair<std::string, std::pair<bool, std::vector<int>>>>& GetGlobals() const { return globals_; }
private:
std::vector<std::unique_ptr<MachineFunction>> functions_;
std::vector<std::pair<std::string, std::pair<bool, std::vector<int>>>> globals_;
};
std::unique_ptr<MachineModule> LowerToMIR(const ir::Module& module);
void RunRegAlloc(MachineModule& module);
void RunFrameLowering(MachineModule& module);
void PrintAsm(const MachineModule& module, std::ostream& os);
} // namespace mir
namespace mir
{
class MIRContext
{
public:
MIRContext() = default;
};
MIRContext &DefaultContext();
enum class PhysReg
{
W0,
W1,
W2,
W3,
W4,
W5,
W6,
W7,
W8,
W9,
W10,
W11,
W12,
W13,
W14,
W15,
W16,
W17,
W18,
W19,
W20,
W21,
W22,
W23,
W24,
W25,
W26,
W27,
W28,
W29,
W30,
X0,
X1,
X2,
X3,
X4,
X5,
X6,
X7,
X8,
X9,
X10,
X11,
X12,
X13,
X14,
X15,
X16,
X17,
X18,
X19,
X20,
X21,
X22,
X23,
X24,
X25,
X26,
X27,
X28,
X29,
X30,
S0,
S1,
S2,
S3,
S4,
S5,
S6,
S7,
S8,
S9,
S10,
S11,
S12,
S13,
S14,
S15,
XZR,
SP,
WZR
};
const char *PhysRegName(PhysReg reg);
enum class Opcode
{
Prologue,
Epilogue,
MovImm,
LoadStack,
StoreStack,
LoadStackAddr,
LoadGlobal,
StoreGlobal,
LoadGlobalAddr,
LoadMem,
StoreMem,
AddRR,
SubRR,
MulRR,
DivRR,
ModRR,
AndRR,
OrRR,
XorRR,
ShlRR,
ShrRR,
Uxtw,
Sxtw,
CmpRR,
FCmpRR,
CSet,
FAddRR,
FSubRR,
FMulRR,
FDivRR,
Scvtf,
FCvtzs,
FMovWS,
Br,
CondBr,
Call,
Ret,
LoadAddr,
MovReg,
};
enum class CondCode
{
EQ,
NE,
LT,
LE,
GT,
GE
};
class Operand
{
public:
enum class Kind
{
Reg,
Imm,
FrameIndex,
Label,
Symbol
};
static Operand Reg(PhysReg reg);
static Operand Imm(int value);
static Operand FrameIndex(int index);
static Operand Label(int label_id);
static Operand Symbol(std::string symbol);
Kind GetKind() const { return kind_; }
PhysReg GetReg() const { return reg_; }
int GetImm() const { return imm_; }
int GetFrameIndex() const { return imm_; }
int GetLabel() const { return imm_; }
const std::string &GetSymbol() const { return symbol_; }
private:
Operand(Kind kind, PhysReg reg, int imm, std::string symbol = "");
Kind kind_;
PhysReg reg_;
int imm_;
std::string symbol_;
};
class MachineInstr
{
public:
MachineInstr(Opcode opcode, std::vector<Operand> operands = {});
Opcode GetOpcode() const { return opcode_; }
const std::vector<Operand> &GetOperands() const { return operands_; }
private:
Opcode opcode_;
std::vector<Operand> operands_;
};
struct FrameSlot
{
int index = 0;
int size = 4;
int offset = 0;
bool is_stack_arg = false;
bool is_callee_stack_arg = false;
};
class MachineBasicBlock
{
public:
explicit MachineBasicBlock(std::string name, int label_id = -1);
const std::string &GetName() const { return name_; }
int GetLabelId() const { return label_id_; }
void SetLabelId(int label_id) { label_id_ = label_id; }
std::vector<MachineInstr> &GetInstructions() { return instructions_; }
const std::vector<MachineInstr> &GetInstructions() const { return instructions_; }
MachineInstr &Append(Opcode opcode,
std::initializer_list<Operand> operands = {});
private:
std::string name_;
int label_id_ = -1;
std::vector<MachineInstr> instructions_;
};
class MachineFunction
{
public:
explicit MachineFunction(std::string name);
const std::string &GetName() const { return name_; }
MachineBasicBlock &GetEntry() { return *entry_; }
const MachineBasicBlock &GetEntry() const { return *entry_; }
MachineBasicBlock *GetEntryPtr() { return entry_; }
const MachineBasicBlock *GetEntryPtr() const { return entry_; }
MachineBasicBlock &CreateBlock(std::string name);
MachineBasicBlock *FindBlock(const std::string &name);
const MachineBasicBlock *FindBlock(const std::string &name) const;
std::vector<std::unique_ptr<MachineBasicBlock>> &GetBlocks()
{
return blocks_;
}
const std::vector<std::unique_ptr<MachineBasicBlock>> &GetBlocks() const
{
return blocks_;
}
int CreateLabel();
int CreateFrameIndex(int size = 4);
int CreateStackArgFrameIndex(int size = 4);
int CreateCalleeStackArgFrameIndex(int size = 4);
FrameSlot &GetFrameSlot(int index);
const FrameSlot &GetFrameSlot(int index) const;
const std::vector<FrameSlot> &GetFrameSlots() const { return frame_slots_; }
int GetFrameSize() const { return frame_size_; }
void SetFrameSize(int size) { frame_size_ = size; }
private:
std::string name_;
std::vector<std::unique_ptr<MachineBasicBlock>> blocks_;
MachineBasicBlock *entry_ = nullptr;
std::vector<FrameSlot> frame_slots_;
int frame_size_ = 0;
int next_label_id_ = 0;
};
struct MachineGlobal
{
enum class Kind
{
I32Scalar,
I32Array
};
std::string name;
Kind kind = Kind::I32Scalar;
int init_value = 0;
size_t array_size = 0;
std::vector<int> init_values;
};
class MachineModule
{
public:
MachineModule() = default;
MachineFunction &CreateFunction(std::string name);
MachineFunction *GetFunction(const std::string &name);
const MachineFunction *GetFunction(const std::string &name) const;
std::vector<std::unique_ptr<MachineFunction>> &GetFunctions()
{
return functions_;
}
const std::vector<std::unique_ptr<MachineFunction>> &GetFunctions() const
{
return functions_;
}
void AddGlobalI32(std::string name, int init_value)
{
MachineGlobal g;
g.name = std::move(name);
g.kind = MachineGlobal::Kind::I32Scalar;
g.init_value = init_value;
globals_.push_back(std::move(g));
}
void AddGlobalArrayI32(std::string name, size_t array_size,
std::vector<int> init_values = {})
{
MachineGlobal g;
g.name = std::move(name);
g.kind = MachineGlobal::Kind::I32Array;
g.array_size = array_size;
g.init_values = std::move(init_values);
globals_.push_back(std::move(g));
}
std::vector<MachineGlobal> &GetGlobals() { return globals_; }
const std::vector<MachineGlobal> &GetGlobals() const { return globals_; }
private:
std::vector<std::unique_ptr<MachineFunction>> functions_;
std::vector<MachineGlobal> globals_;
};
std::unique_ptr<MachineModule> LowerModuleToMIR(const ir::Module &module);
std::unique_ptr<MachineFunction> LowerToMIR(const ir::Module &module);
void RunRegAlloc(MachineFunction &function);
void RunRegAlloc(MachineModule &module);
void RunFrameLowering(MachineFunction &function);
void RunFrameLowering(MachineModule &module);
void PrintAsm(const MachineFunction &function, std::ostream &os);
void PrintAsm(const MachineModule &module, std::ostream &os);
} // namespace mir

@ -9,6 +9,7 @@ struct CLIOptions {
bool emit_ir = true;
bool emit_asm = false;
bool show_help = false;
bool optimize = false;
};
CLIOptions ParseCLI(int argc, char** argv);

File diff suppressed because one or more lines are too long

@ -1,2 +0,0 @@
./test/testdata2022/performance/floyd-2.sy
./test/testdata2022/performance/stencil0.sy

@ -0,0 +1,120 @@
declare i32 @getint()
declare float @getfloat()
declare i32 @getarray(i32* %arg.a)
declare i32 @getfarray(float* %arg.a)
declare i32 @getch()
declare void @putint(i32 %arg.x)
declare void @putfloat(float %arg.x)
declare void @putarray(i32 %arg.n, i32* %arg.a)
declare void @putfarray(i32 %arg.n, float* %arg.a)
declare void @putch(i32 %arg.x)
declare void @starttime()
declare void @stoptime()
define i32 @main() {
entry:
%t10 = alloca i32, i32 8
%t19 = alloca i32, i32 8
%t28 = alloca i32, i32 8
%t39 = alloca i32, i32 8
%t0 = alloca i32, i32 8
%t1 = getelementptr inbounds i32, i32* %t0, i32 0
store i32 1, i32* %t1
%t2 = getelementptr inbounds i32, i32* %t0, i32 1
store i32 2, i32* %t2
%t3 = getelementptr inbounds i32, i32* %t0, i32 2
store i32 3, i32* %t3
%t4 = getelementptr inbounds i32, i32* %t0, i32 3
store i32 4, i32* %t4
%t5 = getelementptr inbounds i32, i32* %t0, i32 4
store i32 0, i32* %t5
%t6 = getelementptr inbounds i32, i32* %t0, i32 5
store i32 0, i32* %t6
%t7 = getelementptr inbounds i32, i32* %t0, i32 6
store i32 7, i32* %t7
%t8 = getelementptr inbounds i32, i32* %t0, i32 7
store i32 0, i32* %t8
%t9 = alloca i32
store i32 3, i32* %t9
%t11 = getelementptr inbounds i32, i32* %t10, i32 0
store i32 0, i32* %t11
%t12 = getelementptr inbounds i32, i32* %t10, i32 1
store i32 0, i32* %t12
%t13 = getelementptr inbounds i32, i32* %t10, i32 2
store i32 0, i32* %t13
%t14 = getelementptr inbounds i32, i32* %t10, i32 3
store i32 0, i32* %t14
%t15 = getelementptr inbounds i32, i32* %t10, i32 4
store i32 0, i32* %t15
%t16 = getelementptr inbounds i32, i32* %t10, i32 5
store i32 0, i32* %t16
%t17 = getelementptr inbounds i32, i32* %t10, i32 6
store i32 0, i32* %t17
%t18 = getelementptr inbounds i32, i32* %t10, i32 7
store i32 0, i32* %t18
%t20 = getelementptr inbounds i32, i32* %t19, i32 0
store i32 1, i32* %t20
%t21 = getelementptr inbounds i32, i32* %t19, i32 1
store i32 2, i32* %t21
%t22 = getelementptr inbounds i32, i32* %t19, i32 2
store i32 3, i32* %t22
%t23 = getelementptr inbounds i32, i32* %t19, i32 3
store i32 4, i32* %t23
%t24 = getelementptr inbounds i32, i32* %t19, i32 4
store i32 5, i32* %t24
%t25 = getelementptr inbounds i32, i32* %t19, i32 5
store i32 6, i32* %t25
%t26 = getelementptr inbounds i32, i32* %t19, i32 6
store i32 7, i32* %t26
%t27 = getelementptr inbounds i32, i32* %t19, i32 7
store i32 8, i32* %t27
%t29 = getelementptr inbounds i32, i32* %t28, i32 0
store i32 1, i32* %t29
%t30 = getelementptr inbounds i32, i32* %t28, i32 1
store i32 2, i32* %t30
%t31 = getelementptr inbounds i32, i32* %t28, i32 2
store i32 3, i32* %t31
%t32 = getelementptr inbounds i32, i32* %t28, i32 3
store i32 0, i32* %t32
%t33 = getelementptr inbounds i32, i32* %t28, i32 4
store i32 5, i32* %t33
%t34 = getelementptr inbounds i32, i32* %t28, i32 5
store i32 0, i32* %t34
%t35 = getelementptr inbounds i32, i32* %t28, i32 6
%t36 = getelementptr inbounds i32, i32* %t0, i32 6
%t37 = load i32, i32* %t36
store i32 %t37, i32* %t35
%t38 = getelementptr inbounds i32, i32* %t28, i32 7
store i32 8, i32* %t38
%t40 = getelementptr inbounds i32, i32* %t39, i32 0
%t41 = getelementptr inbounds i32, i32* %t28, i32 5
%t42 = load i32, i32* %t41
store i32 %t42, i32* %t40
%t43 = getelementptr inbounds i32, i32* %t39, i32 1
%t44 = getelementptr inbounds i32, i32* %t19, i32 5
%t45 = load i32, i32* %t44
store i32 %t45, i32* %t43
%t46 = getelementptr inbounds i32, i32* %t39, i32 2
store i32 3, i32* %t46
%t47 = getelementptr inbounds i32, i32* %t39, i32 3
store i32 4, i32* %t47
%t48 = getelementptr inbounds i32, i32* %t39, i32 4
store i32 5, i32* %t48
%t49 = getelementptr inbounds i32, i32* %t39, i32 5
store i32 6, i32* %t49
%t50 = getelementptr inbounds i32, i32* %t39, i32 6
store i32 7, i32* %t50
%t51 = getelementptr inbounds i32, i32* %t39, i32 7
store i32 8, i32* %t51
%t52 = getelementptr inbounds i32, i32* %t39, i32 7
%t53 = load i32, i32* %t52
%t54 = getelementptr inbounds i32, i32* %t39, i32 0
%t55 = load i32, i32* %t54
%t56 = add i32 %t53, %t55
%t57 = getelementptr inbounds i32, i32* %t39, i32 1
%t58 = load i32, i32* %t57
%t59 = add i32 %t56, %t58
%t60 = getelementptr inbounds i32, i32* %t28, i32 6
%t61 = load i32, i32* %t60
%t62 = add i32 %t59, %t61
ret i32 %t62
}

@ -0,0 +1,4 @@
IR 已生成: ./lab2_results/test_case/functional/05_arr_defn4.ll
运行 ./lab2_results/test_case/functional/05_arr_defn4 ...
退出码: 21
输出匹配: ./test/test_case/functional/05_arr_defn4.out

@ -0,0 +1,35 @@
@a = global i32 0
declare i32 @getint()
declare float @getfloat()
declare i32 @getarray(i32* %arg.a)
declare i32 @getfarray(float* %arg.a)
declare i32 @getch()
declare void @putint(i32 %arg.x)
declare void @putfloat(float %arg.x)
declare void @putarray(i32 %arg.n, i32* %arg.a)
declare void @putfarray(i32 %arg.n, float* %arg.a)
declare void @putch(i32 %arg.x)
declare void @starttime()
declare void @stoptime()
define i32 @func(i32 %arg.p) {
entry:
%t0 = alloca i32
store i32 %arg.p, i32* %t0
%t1 = load i32, i32* %t0
%t2 = sub i32 %t1, 1
store i32 %t2, i32* %t0
%t3 = load i32, i32* %t0
ret i32 %t3
}
define i32 @main() {
entry:
%t4 = alloca i32
store i32 0, i32* %t4
store i32 10, i32* @a
%t5 = load i32, i32* @a
%t6 = call i32 @func(i32 %t5)
store i32 %t6, i32* %t4
%t7 = load i32, i32* %t4
ret i32 %t7
}

@ -0,0 +1,4 @@
IR 已生成: ./lab2_results/test_case/functional/09_func_defn.ll
运行 ./lab2_results/test_case/functional/09_func_defn ...
退出码: 9
输出匹配: ./test/test_case/functional/09_func_defn.out

@ -0,0 +1,25 @@
declare i32 @getint()
declare float @getfloat()
declare i32 @getarray(i32* %arg.a)
declare i32 @getfarray(float* %arg.a)
declare i32 @getch()
declare void @putint(i32 %arg.x)
declare void @putfloat(float %arg.x)
declare void @putarray(i32 %arg.n, i32* %arg.a)
declare void @putfarray(i32 %arg.n, float* %arg.a)
declare void @putch(i32 %arg.x)
declare void @starttime()
declare void @stoptime()
define i32 @main() {
entry:
%t0 = alloca i32
%t1 = alloca i32
store i32 0, i32* %t0
store i32 0, i32* %t1
store i32 10, i32* %t0
store i32 -1, i32* %t1
%t2 = load i32, i32* %t0
%t3 = load i32, i32* %t1
%t4 = add i32 %t2, %t3
ret i32 %t4
}

@ -0,0 +1,4 @@
IR 已生成: ./lab2_results/test_case/functional/11_add2.ll
运行 ./lab2_results/test_case/functional/11_add2 ...
退出码: 9
输出匹配: ./test/test_case/functional/11_add2.out

@ -0,0 +1,23 @@
@a = global i32 10
declare i32 @getint()
declare float @getfloat()
declare i32 @getarray(i32* %arg.a)
declare i32 @getfarray(float* %arg.a)
declare i32 @getch()
declare void @putint(i32 %arg.x)
declare void @putfloat(float %arg.x)
declare void @putarray(i32 %arg.n, i32* %arg.a)
declare void @putfarray(i32 %arg.n, float* %arg.a)
declare void @putch(i32 %arg.x)
declare void @starttime()
declare void @stoptime()
define i32 @main() {
entry:
%t0 = alloca i32
store i32 0, i32* %t0
store i32 2, i32* %t0
%t1 = load i32, i32* %t0
%t2 = sub i32 %t1, 10
ret i32 %t2
}

@ -0,0 +1,4 @@
IR 已生成: ./lab2_results/test_case/functional/13_sub2.ll
运行 ./lab2_results/test_case/functional/13_sub2 ...
退出码: 248
输出匹配: ./test/test_case/functional/13_sub2.out

@ -0,0 +1,235 @@
@V = global i32 4
@space = global i32 32
@LF = global i32 10
declare i32 @getint()
declare float @getfloat()
declare i32 @getarray(i32* %arg.a)
declare i32 @getfarray(float* %arg.a)
declare i32 @getch()
declare void @putint(i32 %arg.x)
declare void @putfloat(float %arg.x)
declare void @putarray(i32 %arg.n, i32* %arg.a)
declare void @putfarray(i32 %arg.n, float* %arg.a)
declare void @putch(i32 %arg.x)
declare void @starttime()
declare void @stoptime()
define void @printSolution(i32* %arg.color) {
entry:
%t0 = alloca i32
store i32 0, i32* %t0
br label %while.cond.1
while.cond.1:
%t1 = load i32, i32* %t0
%t2 = icmp slt i32 %t1, 4
%t3 = zext i1 %t2 to i32
%t4 = icmp ne i32 %t3, 0
br i1 %t4, label %while.body.2, label %while.end.3
while.body.2:
%t5 = load i32, i32* %t0
%t6 = getelementptr inbounds i32, i32* %arg.color, i32 %t5
%t7 = load i32, i32* %t6
call void @putint(i32 %t7)
call void @putch(i32 32)
%t10 = load i32, i32* %t0
%t11 = add i32 %t10, 1
store i32 %t11, i32* %t0
br label %while.cond.1
while.end.3:
call void @putch(i32 10)
ret void
}
define void @printMessage() {
entry:
call void @putch(i32 78)
call void @putch(i32 111)
call void @putch(i32 116)
call void @putch(i32 32)
call void @putch(i32 101)
call void @putch(i32 120)
call void @putch(i32 105)
call void @putch(i32 115)
call void @putch(i32 116)
ret void
}
define i32 @isSafe(i32* %arg.graph, i32* %arg.color) {
entry:
%t22 = alloca i32
%t27 = alloca i32
store i32 0, i32* %t22
br label %while.cond.4
while.cond.4:
%t23 = load i32, i32* %t22
%t24 = icmp slt i32 %t23, 4
%t25 = zext i1 %t24 to i32
%t26 = icmp ne i32 %t25, 0
br i1 %t26, label %while.body.5, label %while.end.6
while.body.5:
%t28 = load i32, i32* %t22
%t29 = add i32 %t28, 1
store i32 %t29, i32* %t27
br label %while.cond.7
while.end.6:
ret i32 1
while.cond.7:
%t30 = load i32, i32* %t27
%t31 = icmp slt i32 %t30, 4
%t32 = zext i1 %t31 to i32
%t33 = icmp ne i32 %t32, 0
br i1 %t33, label %while.body.8, label %while.end.9
while.body.8:
%t34 = load i32, i32* %t22
%t35 = load i32, i32* %t27
%t36 = mul i32 %t34, 4
%t37 = add i32 %t36, %t35
%t38 = getelementptr inbounds i32, i32* %arg.graph, i32 %t37
%t39 = load i32, i32* %t38
%t40 = icmp ne i32 %t39, 0
br i1 %t40, label %land.rhs.12, label %if.end.11
while.end.9:
%t52 = load i32, i32* %t22
%t53 = add i32 %t52, 1
store i32 %t53, i32* %t22
br label %while.cond.4
if.then.10:
ret i32 0
if.end.11:
%t50 = load i32, i32* %t27
%t51 = add i32 %t50, 1
store i32 %t51, i32* %t27
br label %while.cond.7
land.rhs.12:
%t41 = load i32, i32* %t27
%t42 = getelementptr inbounds i32, i32* %arg.color, i32 %t41
%t43 = load i32, i32* %t42
%t44 = load i32, i32* %t22
%t45 = getelementptr inbounds i32, i32* %arg.color, i32 %t44
%t46 = load i32, i32* %t45
%t47 = icmp eq i32 %t43, %t46
%t48 = zext i1 %t47 to i32
%t49 = icmp ne i32 %t48, 0
br i1 %t49, label %if.then.10, label %if.end.11
}
define i32 @graphColoring(i32* %arg.graph, i32 %arg.m, i32 %arg.i, i32* %arg.color) {
entry:
%t63 = alloca i32
%t54 = alloca i32
store i32 %arg.m, i32* %t54
%t55 = alloca i32
store i32 %arg.i, i32* %t55
%t56 = load i32, i32* %t55
%t57 = icmp eq i32 %t56, 4
%t58 = zext i1 %t57 to i32
%t59 = icmp ne i32 %t58, 0
br i1 %t59, label %if.then.13, label %if.end.14
if.then.13:
%t60 = call i32 @isSafe(i32* %arg.graph, i32* %arg.color)
%t61 = icmp ne i32 %t60, 0
br i1 %t61, label %if.then.15, label %if.end.16
if.end.14:
store i32 1, i32* %t63
br label %while.cond.17
if.then.15:
call void @printSolution(i32* %arg.color)
ret i32 1
if.end.16:
ret i32 0
while.cond.17:
%t64 = load i32, i32* %t63
%t65 = load i32, i32* %t54
%t66 = icmp sle i32 %t64, %t65
%t67 = zext i1 %t66 to i32
%t68 = icmp ne i32 %t67, 0
br i1 %t68, label %while.body.18, label %while.end.19
while.body.18:
%t69 = load i32, i32* %t55
%t70 = getelementptr inbounds i32, i32* %arg.color, i32 %t69
%t71 = load i32, i32* %t63
store i32 %t71, i32* %t70
%t72 = load i32, i32* %t54
%t73 = load i32, i32* %t55
%t74 = add i32 %t73, 1
%t75 = call i32 @graphColoring(i32* %arg.graph, i32 %t72, i32 %t74, i32* %arg.color)
%t76 = icmp ne i32 %t75, 0
br i1 %t76, label %if.then.20, label %if.end.21
while.end.19:
ret i32 0
if.then.20:
ret i32 1
if.end.21:
%t77 = load i32, i32* %t55
%t78 = getelementptr inbounds i32, i32* %arg.color, i32 %t77
store i32 0, i32* %t78
%t79 = load i32, i32* %t63
%t80 = add i32 %t79, 1
store i32 %t80, i32* %t63
br label %while.cond.17
}
define i32 @main() {
entry:
%t81 = alloca i32, i32 16
%t98 = alloca i32
%t99 = alloca i32, i32 4
%t100 = alloca i32
%t82 = getelementptr inbounds i32, i32* %t81, i32 0
store i32 0, i32* %t82
%t83 = getelementptr inbounds i32, i32* %t81, i32 1
store i32 1, i32* %t83
%t84 = getelementptr inbounds i32, i32* %t81, i32 2
store i32 1, i32* %t84
%t85 = getelementptr inbounds i32, i32* %t81, i32 3
store i32 1, i32* %t85
%t86 = getelementptr inbounds i32, i32* %t81, i32 4
store i32 1, i32* %t86
%t87 = getelementptr inbounds i32, i32* %t81, i32 5
store i32 0, i32* %t87
%t88 = getelementptr inbounds i32, i32* %t81, i32 6
store i32 1, i32* %t88
%t89 = getelementptr inbounds i32, i32* %t81, i32 7
store i32 0, i32* %t89
%t90 = getelementptr inbounds i32, i32* %t81, i32 8
store i32 1, i32* %t90
%t91 = getelementptr inbounds i32, i32* %t81, i32 9
store i32 1, i32* %t91
%t92 = getelementptr inbounds i32, i32* %t81, i32 10
store i32 0, i32* %t92
%t93 = getelementptr inbounds i32, i32* %t81, i32 11
store i32 1, i32* %t93
%t94 = getelementptr inbounds i32, i32* %t81, i32 12
store i32 1, i32* %t94
%t95 = getelementptr inbounds i32, i32* %t81, i32 13
store i32 0, i32* %t95
%t96 = getelementptr inbounds i32, i32* %t81, i32 14
store i32 1, i32* %t96
%t97 = getelementptr inbounds i32, i32* %t81, i32 15
store i32 0, i32* %t97
store i32 3, i32* %t98
store i32 0, i32* %t100
br label %while.cond.22
while.cond.22:
%t101 = load i32, i32* %t100
%t102 = icmp slt i32 %t101, 4
%t103 = zext i1 %t102 to i32
%t104 = icmp ne i32 %t103, 0
br i1 %t104, label %while.body.23, label %while.end.24
while.body.23:
%t105 = load i32, i32* %t100
%t106 = getelementptr inbounds i32, i32* %t99, i32 %t105
store i32 0, i32* %t106
%t107 = load i32, i32* %t100
%t108 = add i32 %t107, 1
store i32 %t108, i32* %t100
br label %while.cond.22
while.end.24:
%t109 = load i32, i32* %t98
%t110 = call i32 @graphColoring(i32* %t81, i32 %t109, i32 0, i32* %t99)
%t111 = icmp eq i32 %t110, 0
%t112 = zext i1 %t111 to i32
%t113 = icmp ne i32 %t112, 0
br i1 %t113, label %if.then.25, label %if.end.26
if.then.25:
call void @printMessage()
br label %if.end.26
if.end.26:
ret i32 0
}

@ -0,0 +1,5 @@
IR 已生成: ./lab2_results/test_case/functional/15_graph_coloring.ll
运行 ./lab2_results/test_case/functional/15_graph_coloring ...
1 2 3 2
退出码: 0
输出匹配: ./test/test_case/functional/15_graph_coloring.out

@ -0,0 +1,229 @@
@MAX_SIZE = global i32 100
@a = global [10000 x i32] zeroinitializer
@b = global [10000 x i32] zeroinitializer
@res = global [10000 x i32] zeroinitializer
@n1 = global i32 0
@m1 = global i32 0
@n2 = global i32 0
@m2 = global i32 0
declare i32 @getint()
declare float @getfloat()
declare i32 @getarray(i32* %arg.a)
declare i32 @getfarray(float* %arg.a)
declare i32 @getch()
declare void @putint(i32 %arg.x)
declare void @putfloat(float %arg.x)
declare void @putarray(i32 %arg.n, i32* %arg.a)
declare void @putfarray(i32 %arg.n, float* %arg.a)
declare void @putch(i32 %arg.x)
declare void @starttime()
declare void @stoptime()
define void @matrix_multiply() {
entry:
%t0 = alloca i32
%t6 = alloca i32
%t12 = alloca i32
store i32 0, i32* %t0
br label %while.cond.1
while.cond.1:
%t1 = load i32, i32* %t0
%t2 = load i32, i32* @m1
%t3 = icmp slt i32 %t1, %t2
%t4 = zext i1 %t3 to i32
%t5 = icmp ne i32 %t4, 0
br i1 %t5, label %while.body.2, label %while.end.3
while.body.2:
store i32 0, i32* %t6
br label %while.cond.4
while.end.3:
ret void
while.cond.4:
%t7 = load i32, i32* %t6
%t8 = load i32, i32* @n2
%t9 = icmp slt i32 %t7, %t8
%t10 = zext i1 %t9 to i32
%t11 = icmp ne i32 %t10, 0
br i1 %t11, label %while.body.5, label %while.end.6
while.body.5:
store i32 0, i32* %t12
br label %while.cond.7
while.end.6:
%t47 = load i32, i32* %t0
%t48 = add i32 %t47, 1
store i32 %t48, i32* %t0
br label %while.cond.1
while.cond.7:
%t13 = load i32, i32* %t12
%t14 = load i32, i32* @n1
%t15 = icmp slt i32 %t13, %t14
%t16 = zext i1 %t15 to i32
%t17 = icmp ne i32 %t16, 0
br i1 %t17, label %while.body.8, label %while.end.9
while.body.8:
%t18 = load i32, i32* %t0
%t19 = load i32, i32* %t6
%t20 = mul i32 %t18, 100
%t21 = add i32 %t20, %t19
%t22 = getelementptr inbounds [10000 x i32], [10000 x i32]* @res, i32 0, i32 %t21
%t23 = load i32, i32* %t0
%t24 = load i32, i32* %t6
%t25 = mul i32 %t23, 100
%t26 = add i32 %t25, %t24
%t27 = getelementptr inbounds [10000 x i32], [10000 x i32]* @res, i32 0, i32 %t26
%t28 = load i32, i32* %t27
%t29 = load i32, i32* %t0
%t30 = load i32, i32* %t12
%t31 = mul i32 %t29, 100
%t32 = add i32 %t31, %t30
%t33 = getelementptr inbounds [10000 x i32], [10000 x i32]* @a, i32 0, i32 %t32
%t34 = load i32, i32* %t33
%t35 = load i32, i32* %t12
%t36 = load i32, i32* %t6
%t37 = mul i32 %t35, 100
%t38 = add i32 %t37, %t36
%t39 = getelementptr inbounds [10000 x i32], [10000 x i32]* @b, i32 0, i32 %t38
%t40 = load i32, i32* %t39
%t41 = mul i32 %t34, %t40
%t42 = add i32 %t28, %t41
store i32 %t42, i32* %t22
%t43 = load i32, i32* %t12
%t44 = add i32 %t43, 1
store i32 %t44, i32* %t12
br label %while.cond.7
while.end.9:
%t45 = load i32, i32* %t6
%t46 = add i32 %t45, 1
store i32 %t46, i32* %t6
br label %while.cond.4
}
define i32 @main() {
entry:
%t49 = alloca i32
%t50 = alloca i32
store i32 0, i32* %t49
store i32 0, i32* %t50
%t51 = call i32 @getint()
store i32 %t51, i32* @m1
%t52 = call i32 @getint()
store i32 %t52, i32* @n1
store i32 0, i32* %t49
br label %while.cond.10
while.cond.10:
%t53 = load i32, i32* %t49
%t54 = load i32, i32* @m1
%t55 = icmp slt i32 %t53, %t54
%t56 = zext i1 %t55 to i32
%t57 = icmp ne i32 %t56, 0
br i1 %t57, label %while.body.11, label %while.end.12
while.body.11:
store i32 0, i32* %t50
br label %while.cond.13
while.end.12:
%t73 = call i32 @getint()
store i32 %t73, i32* @m2
%t74 = call i32 @getint()
store i32 %t74, i32* @n2
store i32 0, i32* %t49
br label %while.cond.16
while.cond.13:
%t58 = load i32, i32* %t50
%t59 = load i32, i32* @n1
%t60 = icmp slt i32 %t58, %t59
%t61 = zext i1 %t60 to i32
%t62 = icmp ne i32 %t61, 0
br i1 %t62, label %while.body.14, label %while.end.15
while.body.14:
%t63 = load i32, i32* %t49
%t64 = load i32, i32* %t50
%t65 = mul i32 %t63, 100
%t66 = add i32 %t65, %t64
%t67 = getelementptr inbounds [10000 x i32], [10000 x i32]* @a, i32 0, i32 %t66
%t68 = call i32 @getint()
store i32 %t68, i32* %t67
%t69 = load i32, i32* %t50
%t70 = add i32 %t69, 1
store i32 %t70, i32* %t50
br label %while.cond.13
while.end.15:
%t71 = load i32, i32* %t49
%t72 = add i32 %t71, 1
store i32 %t72, i32* %t49
br label %while.cond.10
while.cond.16:
%t75 = load i32, i32* %t49
%t76 = load i32, i32* @m2
%t77 = icmp slt i32 %t75, %t76
%t78 = zext i1 %t77 to i32
%t79 = icmp ne i32 %t78, 0
br i1 %t79, label %while.body.17, label %while.end.18
while.body.17:
store i32 0, i32* %t50
br label %while.cond.19
while.end.18:
call void @matrix_multiply()
store i32 0, i32* %t49
br label %while.cond.22
while.cond.19:
%t80 = load i32, i32* %t50
%t81 = load i32, i32* @n2
%t82 = icmp slt i32 %t80, %t81
%t83 = zext i1 %t82 to i32
%t84 = icmp ne i32 %t83, 0
br i1 %t84, label %while.body.20, label %while.end.21
while.body.20:
%t85 = load i32, i32* %t49
%t86 = load i32, i32* %t50
%t87 = mul i32 %t85, 100
%t88 = add i32 %t87, %t86
%t89 = getelementptr inbounds [10000 x i32], [10000 x i32]* @b, i32 0, i32 %t88
%t90 = call i32 @getint()
store i32 %t90, i32* %t89
%t91 = load i32, i32* %t50
%t92 = add i32 %t91, 1
store i32 %t92, i32* %t50
br label %while.cond.19
while.end.21:
%t93 = load i32, i32* %t49
%t94 = add i32 %t93, 1
store i32 %t94, i32* %t49
br label %while.cond.16
while.cond.22:
%t96 = load i32, i32* %t49
%t97 = load i32, i32* @m1
%t98 = icmp slt i32 %t96, %t97
%t99 = zext i1 %t98 to i32
%t100 = icmp ne i32 %t99, 0
br i1 %t100, label %while.body.23, label %while.end.24
while.body.23:
store i32 0, i32* %t50
br label %while.cond.25
while.end.24:
ret i32 0
while.cond.25:
%t101 = load i32, i32* %t50
%t102 = load i32, i32* @n2
%t103 = icmp slt i32 %t101, %t102
%t104 = zext i1 %t103 to i32
%t105 = icmp ne i32 %t104, 0
br i1 %t105, label %while.body.26, label %while.end.27
while.body.26:
%t106 = load i32, i32* %t49
%t107 = load i32, i32* %t50
%t108 = mul i32 %t106, 100
%t109 = add i32 %t108, %t107
%t110 = getelementptr inbounds [10000 x i32], [10000 x i32]* @res, i32 0, i32 %t109
%t111 = load i32, i32* %t110
call void @putint(i32 %t111)
call void @putch(i32 32)
%t114 = load i32, i32* %t50
%t115 = add i32 %t114, 1
store i32 %t115, i32* %t50
br label %while.cond.25
while.end.27:
call void @putch(i32 10)
%t117 = load i32, i32* %t49
%t118 = add i32 %t117, 1
store i32 %t118, i32* %t49
br label %while.cond.22
}

@ -0,0 +1,4 @@
110 70 30
278 174 70
446 278 110
614 382 150

@ -0,0 +1,8 @@
IR 已生成: ./lab2_results/test_case/functional/22_matrix_multiply.ll
运行 ./lab2_results/test_case/functional/22_matrix_multiply ...
110 70 30
278 174 70
446 278 110
614 382 150
退出码: 0
输出匹配: ./test/test_case/functional/22_matrix_multiply.out

@ -0,0 +1,134 @@
declare i32 @getint()
declare float @getfloat()
declare i32 @getarray(i32* %arg.a)
declare i32 @getfarray(float* %arg.a)
declare i32 @getch()
declare void @putint(i32 %arg.x)
declare void @putfloat(float %arg.x)
declare void @putarray(i32 %arg.n, i32* %arg.a)
declare void @putfarray(i32 %arg.n, float* %arg.a)
declare void @putch(i32 %arg.x)
declare void @starttime()
declare void @stoptime()
define i32 @main() {
entry:
%t2 = alloca i32
%t3 = alloca i32
%t6 = alloca i32
%t18 = alloca i32
%t34 = alloca i32
%t49 = alloca i32
%t67 = alloca i32
call void @putch(i32 97)
call void @putch(i32 10)
store i32 1, i32* %t2
store i32 0, i32* %t3
%t4 = load i32, i32* %t2
%t5 = add i32 %t4, 2
store i32 %t5, i32* %t2
%t7 = load i32, i32* %t2
%t8 = add i32 %t7, 3
store i32 %t8, i32* %t6
%t9 = load i32, i32* %t6
%t10 = add i32 %t9, 4
store i32 %t10, i32* %t6
%t11 = load i32, i32* %t3
%t12 = load i32, i32* %t2
%t13 = add i32 %t11, %t12
%t14 = load i32, i32* %t6
%t15 = add i32 %t13, %t14
store i32 %t15, i32* %t3
%t16 = load i32, i32* %t6
%t17 = add i32 %t16, 5
store i32 %t17, i32* %t6
%t19 = load i32, i32* %t6
%t20 = add i32 %t19, 6
store i32 %t20, i32* %t18
%t21 = load i32, i32* %t2
%t22 = load i32, i32* %t18
%t23 = add i32 %t21, %t22
store i32 %t23, i32* %t2
%t24 = load i32, i32* %t3
%t25 = load i32, i32* %t2
%t26 = add i32 %t24, %t25
%t27 = load i32, i32* %t6
%t28 = add i32 %t26, %t27
%t29 = load i32, i32* %t18
%t30 = add i32 %t28, %t29
store i32 %t30, i32* %t3
%t31 = load i32, i32* %t6
%t32 = load i32, i32* %t2
%t33 = add i32 %t31, %t32
store i32 %t33, i32* %t6
%t35 = load i32, i32* %t18
%t36 = add i32 %t35, 7
store i32 %t36, i32* %t34
%t37 = load i32, i32* %t34
%t38 = add i32 %t37, 8
store i32 %t38, i32* %t34
%t39 = load i32, i32* %t3
%t40 = load i32, i32* %t34
%t41 = add i32 %t39, %t40
%t42 = load i32, i32* %t6
%t43 = add i32 %t41, %t42
%t44 = load i32, i32* %t18
%t45 = add i32 %t43, %t44
store i32 %t45, i32* %t3
%t46 = load i32, i32* %t6
%t47 = load i32, i32* %t34
%t48 = add i32 %t46, %t47
store i32 %t48, i32* %t6
%t50 = load i32, i32* %t18
%t51 = add i32 %t50, 9
store i32 %t51, i32* %t49
%t52 = load i32, i32* %t34
%t53 = add i32 %t52, 10
store i32 %t53, i32* %t34
%t54 = alloca i32
store i32 11, i32* %t54
%t55 = load i32, i32* %t49
%t56 = add i32 %t55, 12
store i32 %t56, i32* %t49
%t57 = load i32, i32* %t3
%t58 = load i32, i32* %t54
%t59 = add i32 %t57, %t58
%t60 = load i32, i32* %t49
%t61 = add i32 %t59, %t60
%t62 = load i32, i32* %t18
%t63 = add i32 %t61, %t62
store i32 %t63, i32* %t3
%t64 = load i32, i32* %t18
%t65 = load i32, i32* %t49
%t66 = add i32 %t64, %t65
store i32 %t66, i32* %t18
%t68 = load i32, i32* %t49
%t69 = add i32 %t68, 13
store i32 %t69, i32* %t67
%t70 = load i32, i32* %t67
%t71 = load i32, i32* %t54
%t72 = add i32 %t70, %t71
store i32 %t72, i32* %t67
%t73 = load i32, i32* %t3
%t74 = load i32, i32* %t54
%t75 = add i32 %t73, %t74
%t76 = load i32, i32* %t49
%t77 = add i32 %t75, %t76
%t78 = load i32, i32* %t67
%t79 = add i32 %t77, %t78
store i32 %t79, i32* %t3
%t80 = load i32, i32* %t3
%t81 = load i32, i32* %t18
%t82 = sub i32 %t80, %t81
store i32 %t82, i32* %t3
%t83 = load i32, i32* %t3
%t84 = load i32, i32* %t6
%t85 = sub i32 %t83, %t84
store i32 %t85, i32* %t3
%t86 = load i32, i32* %t3
%t87 = load i32, i32* %t2
%t88 = sub i32 %t86, %t87
store i32 %t88, i32* %t3
%t89 = load i32, i32* %t3
%t90 = srem i32 %t89, 77
ret i32 %t90
}

@ -0,0 +1,5 @@
IR 已生成: ./lab2_results/test_case/functional/25_scope3.ll
运行 ./lab2_results/test_case/functional/25_scope3 ...
a
退出码: 46
输出匹配: ./test/test_case/functional/25_scope3.out

@ -0,0 +1,48 @@
declare i32 @getint()
declare float @getfloat()
declare i32 @getarray(i32* %arg.a)
declare i32 @getfarray(float* %arg.a)
declare i32 @getch()
declare void @putint(i32 %arg.x)
declare void @putfloat(float %arg.x)
declare void @putarray(i32 %arg.n, i32* %arg.a)
declare void @putfarray(i32 %arg.n, float* %arg.a)
declare void @putch(i32 %arg.x)
declare void @starttime()
declare void @stoptime()
define i32 @main() {
entry:
%t0 = alloca i32
%t1 = alloca i32
store i32 0, i32* %t0
store i32 0, i32* %t0
store i32 0, i32* %t1
store i32 0, i32* %t1
br label %while.cond.1
while.cond.1:
%t2 = load i32, i32* %t0
%t3 = icmp slt i32 %t2, 100
%t4 = zext i1 %t3 to i32
%t5 = icmp ne i32 %t4, 0
br i1 %t5, label %while.body.2, label %while.end.3
while.body.2:
%t6 = load i32, i32* %t0
%t7 = icmp eq i32 %t6, 50
%t8 = zext i1 %t7 to i32
%t9 = icmp ne i32 %t8, 0
br i1 %t9, label %if.then.4, label %if.end.5
while.end.3:
%t15 = load i32, i32* %t1
ret i32 %t15
if.then.4:
br label %while.end.3
if.end.5:
%t10 = load i32, i32* %t1
%t11 = load i32, i32* %t0
%t12 = add i32 %t10, %t11
store i32 %t12, i32* %t1
%t13 = load i32, i32* %t0
%t14 = add i32 %t13, 1
store i32 %t14, i32* %t0
br label %while.cond.1
}

@ -0,0 +1,4 @@
IR 已生成: ./lab2_results/test_case/functional/29_break.ll
运行 ./lab2_results/test_case/functional/29_break ...
退出码: 201
输出匹配: ./test/test_case/functional/29_break.out

@ -0,0 +1,35 @@
declare i32 @getint()
declare float @getfloat()
declare i32 @getarray(i32* %arg.a)
declare i32 @getfarray(float* %arg.a)
declare i32 @getch()
declare void @putint(i32 %arg.x)
declare void @putfloat(float %arg.x)
declare void @putarray(i32 %arg.n, i32* %arg.a)
declare void @putfarray(i32 %arg.n, float* %arg.a)
declare void @putch(i32 %arg.x)
declare void @starttime()
declare void @stoptime()
define i32 @main() {
entry:
%t0 = alloca i32
%t1 = alloca i32
%t2 = alloca i32
%t3 = alloca i32
store i32 0, i32* %t0
store i32 0, i32* %t1
store i32 0, i32* %t2
store i32 0, i32* %t3
store i32 10, i32* %t0
store i32 4, i32* %t1
store i32 2, i32* %t2
store i32 2, i32* %t3
%t4 = load i32, i32* %t2
%t5 = load i32, i32* %t0
%t6 = add i32 %t4, %t5
%t7 = load i32, i32* %t1
%t8 = load i32, i32* %t3
%t9 = sub i32 %t7, %t8
%t10 = mul i32 %t6, %t9
ret i32 %t10
}

@ -0,0 +1,4 @@
IR 已生成: ./lab2_results/test_case/functional/36_op_priority2.ll
运行 ./lab2_results/test_case/functional/36_op_priority2 ...
退出码: 24
输出匹配: ./test/test_case/functional/36_op_priority2.out

@ -0,0 +1,273 @@
@RADIUS = global float 0x4016000000000000
@PI = global float 0x400921FB60000000
@EPS = global float 0x3EB0C6F7A0000000
@PI_HEX = global float 0x400921FB60000000
@HEX2 = global float 0x3FB4000000000000
@FACT = global float 0xC0E01D0000000000
@EVAL1 = global float 0x4057C21FC0000000
@EVAL2 = global float 0x4041475CE0000000
@EVAL3 = global float 0x4041475CE0000000
@CONV1 = global float 0x406D200000000000
@CONV2 = global float 0x40AFFE0000000000
@MAX = global i32 1000000000
@TWO = global i32 2
@THREE = global i32 3
@FIVE = global i32 5
declare i32 @getint()
declare float @getfloat()
declare i32 @getarray(i32* %arg.a)
declare i32 @getfarray(float* %arg.a)
declare i32 @getch()
declare void @putint(i32 %arg.x)
declare void @putfloat(float %arg.x)
declare void @putarray(i32 %arg.n, i32* %arg.a)
declare void @putfarray(i32 %arg.n, float* %arg.a)
declare void @putch(i32 %arg.x)
declare void @starttime()
declare void @stoptime()
define float @float_abs(float %arg.x) {
entry:
%t0 = alloca float
store float %arg.x, float* %t0
%t1 = load float, float* %t0
%t2 = fcmp olt float %t1, 0x0000000000000000
%t3 = zext i1 %t2 to i32
%t4 = icmp ne i32 %t3, 0
br i1 %t4, label %if.then.1, label %if.end.2
if.then.1:
%t5 = load float, float* %t0
%t6 = fsub float 0x0000000000000000, %t5
ret float %t6
if.end.2:
%t7 = load float, float* %t0
ret float %t7
}
define float @circle_area(i32 %arg.radius) {
entry:
%t8 = alloca i32
store i32 %arg.radius, i32* %t8
%t9 = load float, float* @PI
%t10 = load i32, i32* %t8
%t11 = sitofp i32 %t10 to float
%t12 = fmul float %t9, %t11
%t13 = load i32, i32* %t8
%t14 = sitofp i32 %t13 to float
%t15 = fmul float %t12, %t14
%t16 = load i32, i32* %t8
%t17 = load i32, i32* %t8
%t18 = mul i32 %t16, %t17
%t19 = load float, float* @PI
%t20 = sitofp i32 %t18 to float
%t21 = fmul float %t20, %t19
%t22 = fadd float %t15, %t21
%t23 = fdiv float %t22, 0x4000000000000000
ret float %t23
}
define i32 @float_eq(float %arg.a, float %arg.b) {
entry:
%t24 = alloca float
store float %arg.a, float* %t24
%t25 = alloca float
store float %arg.b, float* %t25
%t26 = load float, float* %t24
%t27 = load float, float* %t25
%t28 = fsub float %t26, %t27
%t29 = call float @float_abs(float %t28)
%t30 = load float, float* @EPS
%t31 = fcmp olt float %t29, %t30
%t32 = zext i1 %t31 to i32
%t33 = icmp ne i32 %t32, 0
br i1 %t33, label %if.then.3, label %if.else.4
if.then.3:
ret i32 1
if.else.4:
ret i32 0
if.end.5:
ret i32 0
}
define void @error() {
entry:
call void @putch(i32 101)
call void @putch(i32 114)
call void @putch(i32 114)
call void @putch(i32 111)
call void @putch(i32 114)
call void @putch(i32 10)
ret void
}
define void @ok() {
entry:
call void @putch(i32 111)
call void @putch(i32 107)
call void @putch(i32 10)
ret void
}
define void @assert(i32 %arg.cond) {
entry:
%t43 = alloca i32
store i32 %arg.cond, i32* %t43
%t44 = load i32, i32* %t43
%t45 = icmp eq i32 %t44, 0
%t46 = zext i1 %t45 to i32
%t47 = icmp ne i32 %t46, 0
br i1 %t47, label %if.then.6, label %if.else.7
if.then.6:
call void @error()
br label %if.end.8
if.else.7:
call void @ok()
br label %if.end.8
if.end.8:
ret void
}
define void @assert_not(i32 %arg.cond) {
entry:
%t50 = alloca i32
store i32 %arg.cond, i32* %t50
%t51 = load i32, i32* %t50
%t52 = icmp ne i32 %t51, 0
br i1 %t52, label %if.then.9, label %if.else.10
if.then.9:
call void @error()
br label %if.end.11
if.else.10:
call void @ok()
br label %if.end.11
if.end.11:
ret void
}
define i32 @main() {
entry:
%t87 = alloca i32
%t88 = alloca i32
%t89 = alloca float, i32 10
%t100 = alloca i32
%t106 = alloca float
%t108 = alloca float
%t114 = alloca float
%t55 = load float, float* @HEX2
%t56 = load float, float* @FACT
%t57 = call i32 @float_eq(float %t55, float %t56)
call void @assert_not(i32 %t57)
%t59 = load float, float* @EVAL1
%t60 = load float, float* @EVAL2
%t61 = call i32 @float_eq(float %t59, float %t60)
call void @assert_not(i32 %t61)
%t63 = load float, float* @EVAL2
%t64 = load float, float* @EVAL3
%t65 = call i32 @float_eq(float %t63, float %t64)
call void @assert(i32 %t65)
%t67 = load float, float* @RADIUS
%t68 = fptosi float %t67 to i32
%t69 = call float @circle_area(i32 %t68)
%t70 = call float @circle_area(i32 5)
%t71 = call i32 @float_eq(float %t69, float %t70)
call void @assert(i32 %t71)
%t73 = load float, float* @CONV1
%t74 = load float, float* @CONV2
%t75 = call i32 @float_eq(float %t73, float %t74)
call void @assert_not(i32 %t75)
%t77 = fcmp one float 0x3FF8000000000000, 0x0000000000000000
br i1 %t77, label %if.then.12, label %if.end.13
if.then.12:
call void @ok()
br label %if.end.13
if.end.13:
%t79 = icmp ne i32 1, 0
br i1 %t79, label %if.then.14, label %if.end.15
if.then.14:
call void @ok()
br label %if.end.15
if.end.15:
%t81 = fcmp one float 0x0000000000000000, 0x0000000000000000
br i1 %t81, label %land.rhs.18, label %if.end.17
if.then.16:
call void @error()
br label %if.end.17
if.end.17:
%t84 = icmp ne i32 0, 0
br i1 %t84, label %if.then.19, label %lor.rhs.21
land.rhs.18:
%t82 = icmp ne i32 3, 0
br i1 %t82, label %if.then.16, label %if.end.17
if.then.19:
call void @ok()
br label %if.end.20
if.end.20:
store i32 1, i32* %t87
store i32 0, i32* %t88
%t90 = getelementptr inbounds float, float* %t89, i32 0
store float 0x3FF0000000000000, float* %t90
%t91 = getelementptr inbounds float, float* %t89, i32 1
store float 0x4000000000000000, float* %t91
%t92 = getelementptr inbounds float, float* %t89, i32 2
store float 0x0000000000000000, float* %t92
%t93 = getelementptr inbounds float, float* %t89, i32 3
store float 0x0000000000000000, float* %t93
%t94 = getelementptr inbounds float, float* %t89, i32 4
store float 0x0000000000000000, float* %t94
%t95 = getelementptr inbounds float, float* %t89, i32 5
store float 0x0000000000000000, float* %t95
%t96 = getelementptr inbounds float, float* %t89, i32 6
store float 0x0000000000000000, float* %t96
%t97 = getelementptr inbounds float, float* %t89, i32 7
store float 0x0000000000000000, float* %t97
%t98 = getelementptr inbounds float, float* %t89, i32 8
store float 0x0000000000000000, float* %t98
%t99 = getelementptr inbounds float, float* %t89, i32 9
store float 0x0000000000000000, float* %t99
%t101 = call i32 @getfarray(float* %t89)
store i32 %t101, i32* %t100
br label %while.cond.22
lor.rhs.21:
%t85 = fcmp one float 0x3FD3333340000000, 0x0000000000000000
br i1 %t85, label %if.then.19, label %if.end.20
while.cond.22:
%t102 = load i32, i32* %t87
%t103 = icmp slt i32 %t102, 1000000000
%t104 = zext i1 %t103 to i32
%t105 = icmp ne i32 %t104, 0
br i1 %t105, label %while.body.23, label %while.end.24
while.body.23:
%t107 = call float @getfloat()
store float %t107, float* %t106
%t109 = load float, float* @PI
%t110 = load float, float* %t106
%t111 = fmul float %t109, %t110
%t112 = load float, float* %t106
%t113 = fmul float %t111, %t112
store float %t113, float* %t108
%t115 = load float, float* %t106
%t116 = fptosi float %t115 to i32
%t117 = call float @circle_area(i32 %t116)
store float %t117, float* %t114
%t118 = load i32, i32* %t88
%t119 = getelementptr inbounds float, float* %t89, i32 %t118
%t120 = load i32, i32* %t88
%t121 = getelementptr inbounds float, float* %t89, i32 %t120
%t122 = load float, float* %t121
%t123 = load float, float* %t106
%t124 = fadd float %t122, %t123
store float %t124, float* %t119
%t125 = load float, float* %t108
call void @putfloat(float %t125)
call void @putch(i32 32)
%t128 = load float, float* %t114
%t129 = fptosi float %t128 to i32
call void @putint(i32 %t129)
call void @putch(i32 10)
%t132 = load i32, i32* %t87
%t133 = sitofp i32 %t132 to float
%t134 = fmul float %t133, 0x4024000000000000
%t135 = fptosi float %t134 to i32
store i32 %t135, i32* %t87
%t136 = load i32, i32* %t88
%t137 = add i32 %t136, 1
store i32 %t137, i32* %t88
br label %while.cond.22
while.end.24:
%t138 = load i32, i32* %t100
call void @putfarray(i32 %t138, float* %t89)
ret i32 0
}

@ -0,0 +1,18 @@
ok
ok
ok
ok
ok
ok
ok
ok
0x1.e691e6p+1 3
0x1.e691e6p+3 12
0x1.11b21p+5 28
0x1.e691e6p+5 50
0x1.7c21fcp+6 78
0x1.11b21p+7 113
0x1.7487b2p+7 153
0x1.e691e6p+7 201
0x1.33e85p+8 254
10: 0x1.333334p+0 0x1.333334p+1 0x1.ccccccp+1 0x1.333334p+2 0x1.8p+2 0x1.ccccccp+2 0x1.0cccccp+3 0x1.333334p+3 0x1.599998p+3 0x1p+0

@ -0,0 +1,22 @@
IR 已生成: ./lab2_results/test_case/functional/95_float.ll
运行 ./lab2_results/test_case/functional/95_float ...
ok
ok
ok
ok
ok
ok
ok
ok
0x1.e691e6p+1 3
0x1.e691e6p+3 12
0x1.11b21p+5 28
0x1.e691e6p+5 50
0x1.7c21fcp+6 78
0x1.11b21p+7 113
0x1.7487b2p+7 153
0x1.e691e6p+7 201
0x1.33e85p+8 254
10: 0x1.333334p+0 0x1.333334p+1 0x1.ccccccp+1 0x1.333334p+2 0x1.8p+2 0x1.ccccccp+2 0x1.0cccccp+3 0x1.333334p+3 0x1.599998p+3 0x1p+0
退出码: 0
输出匹配: ./test/test_case/functional/95_float.out

@ -0,0 +1,23 @@
declare i32 @getint()
declare float @getfloat()
declare i32 @getarray(i32* %arg.a)
declare i32 @getfarray(float* %arg.a)
declare i32 @getch()
declare void @putint(i32 %arg.x)
declare void @putfloat(float %arg.x)
declare void @putarray(i32 %arg.n, i32* %arg.a)
declare void @putfarray(i32 %arg.n, float* %arg.a)
declare void @putch(i32 %arg.x)
declare void @starttime()
declare void @stoptime()
define i32 @main() {
entry:
%t0 = alloca i32
%t1 = alloca i32
store i32 1, i32* %t0
store i32 2, i32* %t1
%t2 = load i32, i32* %t0
%t3 = load i32, i32* %t1
%t4 = add i32 %t2, %t3
ret i32 %t4
}

@ -0,0 +1,4 @@
IR 已生成: ./lab2_results/test_case/functional/simple_add.ll
运行 ./lab2_results/test_case/functional/simple_add ...
退出码: 3
输出匹配: ./test/test_case/functional/simple_add.out

@ -0,0 +1,312 @@
@N = global i32 1024
@A = global [1048576 x i32] zeroinitializer
@B = global [1048576 x i32] zeroinitializer
@C = global [1048576 x i32] zeroinitializer
declare i32 @getint()
declare float @getfloat()
declare i32 @getarray(i32* %arg.a)
declare i32 @getfarray(float* %arg.a)
declare i32 @getch()
declare void @putint(i32 %arg.x)
declare void @putfloat(float %arg.x)
declare void @putarray(i32 %arg.n, i32* %arg.a)
declare void @putfarray(i32 %arg.n, float* %arg.a)
declare void @putch(i32 %arg.x)
declare void @starttime()
declare void @stoptime()
define void @mm(i32 %arg.n, i32* %arg.A, i32* %arg.B, i32* %arg.C) {
entry:
%t1 = alloca i32
%t2 = alloca i32
%t3 = alloca i32
%t0 = alloca i32
store i32 %arg.n, i32* %t0
store i32 0, i32* %t1
store i32 0, i32* %t2
store i32 0, i32* %t3
store i32 0, i32* %t1
store i32 0, i32* %t2
br label %while.cond.1
while.cond.1:
%t4 = load i32, i32* %t1
%t5 = load i32, i32* %t0
%t6 = icmp slt i32 %t4, %t5
%t7 = zext i1 %t6 to i32
%t8 = icmp ne i32 %t7, 0
br i1 %t8, label %while.body.2, label %while.end.3
while.body.2:
store i32 0, i32* %t2
br label %while.cond.4
while.end.3:
store i32 0, i32* %t1
store i32 0, i32* %t2
store i32 0, i32* %t3
br label %while.cond.7
while.cond.4:
%t9 = load i32, i32* %t2
%t10 = load i32, i32* %t0
%t11 = icmp slt i32 %t9, %t10
%t12 = zext i1 %t11 to i32
%t13 = icmp ne i32 %t12, 0
br i1 %t13, label %while.body.5, label %while.end.6
while.body.5:
%t14 = load i32, i32* %t1
%t15 = load i32, i32* %t2
%t16 = mul i32 %t14, 1024
%t17 = add i32 %t16, %t15
%t18 = getelementptr inbounds i32, i32* %arg.C, i32 %t17
store i32 0, i32* %t18
%t19 = load i32, i32* %t2
%t20 = add i32 %t19, 1
store i32 %t20, i32* %t2
br label %while.cond.4
while.end.6:
%t21 = load i32, i32* %t1
%t22 = add i32 %t21, 1
store i32 %t22, i32* %t1
br label %while.cond.1
while.cond.7:
%t23 = load i32, i32* %t3
%t24 = load i32, i32* %t0
%t25 = icmp slt i32 %t23, %t24
%t26 = zext i1 %t25 to i32
%t27 = icmp ne i32 %t26, 0
br i1 %t27, label %while.body.8, label %while.end.9
while.body.8:
store i32 0, i32* %t1
br label %while.cond.10
while.end.9:
ret void
while.cond.10:
%t28 = load i32, i32* %t1
%t29 = load i32, i32* %t0
%t30 = icmp slt i32 %t28, %t29
%t31 = zext i1 %t30 to i32
%t32 = icmp ne i32 %t31, 0
br i1 %t32, label %while.body.11, label %while.end.12
while.body.11:
%t33 = load i32, i32* %t1
%t34 = load i32, i32* %t3
%t35 = mul i32 %t33, 1024
%t36 = add i32 %t35, %t34
%t37 = getelementptr inbounds i32, i32* %arg.A, i32 %t36
%t38 = load i32, i32* %t37
%t39 = icmp eq i32 %t38, 0
%t40 = zext i1 %t39 to i32
%t41 = icmp ne i32 %t40, 0
br i1 %t41, label %if.then.13, label %if.end.14
while.end.12:
%t78 = load i32, i32* %t3
%t79 = add i32 %t78, 1
store i32 %t79, i32* %t3
br label %while.cond.7
if.then.13:
%t42 = load i32, i32* %t1
%t43 = add i32 %t42, 1
store i32 %t43, i32* %t1
br label %while.cond.10
if.end.14:
store i32 0, i32* %t2
br label %while.cond.15
while.cond.15:
%t44 = load i32, i32* %t2
%t45 = load i32, i32* %t0
%t46 = icmp slt i32 %t44, %t45
%t47 = zext i1 %t46 to i32
%t48 = icmp ne i32 %t47, 0
br i1 %t48, label %while.body.16, label %while.end.17
while.body.16:
%t49 = load i32, i32* %t1
%t50 = load i32, i32* %t2
%t51 = mul i32 %t49, 1024
%t52 = add i32 %t51, %t50
%t53 = getelementptr inbounds i32, i32* %arg.C, i32 %t52
%t54 = load i32, i32* %t1
%t55 = load i32, i32* %t2
%t56 = mul i32 %t54, 1024
%t57 = add i32 %t56, %t55
%t58 = getelementptr inbounds i32, i32* %arg.C, i32 %t57
%t59 = load i32, i32* %t58
%t60 = load i32, i32* %t1
%t61 = load i32, i32* %t3
%t62 = mul i32 %t60, 1024
%t63 = add i32 %t62, %t61
%t64 = getelementptr inbounds i32, i32* %arg.A, i32 %t63
%t65 = load i32, i32* %t64
%t66 = load i32, i32* %t3
%t67 = load i32, i32* %t2
%t68 = mul i32 %t66, 1024
%t69 = add i32 %t68, %t67
%t70 = getelementptr inbounds i32, i32* %arg.B, i32 %t69
%t71 = load i32, i32* %t70
%t72 = mul i32 %t65, %t71
%t73 = add i32 %t59, %t72
store i32 %t73, i32* %t53
%t74 = load i32, i32* %t2
%t75 = add i32 %t74, 1
store i32 %t75, i32* %t2
br label %while.cond.15
while.end.17:
%t76 = load i32, i32* %t1
%t77 = add i32 %t76, 1
store i32 %t77, i32* %t1
br label %while.cond.10
}
define i32 @main() {
entry:
%t80 = alloca i32
%t82 = alloca i32
%t83 = alloca i32
%t141 = alloca i32
%t81 = call i32 @getint()
store i32 %t81, i32* %t80
store i32 0, i32* %t82
store i32 0, i32* %t83
store i32 0, i32* %t82
store i32 0, i32* %t83
br label %while.cond.18
while.cond.18:
%t84 = load i32, i32* %t82
%t85 = load i32, i32* %t80
%t86 = icmp slt i32 %t84, %t85
%t87 = zext i1 %t86 to i32
%t88 = icmp ne i32 %t87, 0
br i1 %t88, label %while.body.19, label %while.end.20
while.body.19:
store i32 0, i32* %t83
br label %while.cond.21
while.end.20:
store i32 0, i32* %t82
store i32 0, i32* %t83
br label %while.cond.24
while.cond.21:
%t89 = load i32, i32* %t83
%t90 = load i32, i32* %t80
%t91 = icmp slt i32 %t89, %t90
%t92 = zext i1 %t91 to i32
%t93 = icmp ne i32 %t92, 0
br i1 %t93, label %while.body.22, label %while.end.23
while.body.22:
%t94 = load i32, i32* %t82
%t95 = load i32, i32* %t83
%t96 = mul i32 %t94, 1024
%t97 = add i32 %t96, %t95
%t98 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @A, i32 0, i32 %t97
%t99 = call i32 @getint()
store i32 %t99, i32* %t98
%t100 = load i32, i32* %t83
%t101 = add i32 %t100, 1
store i32 %t101, i32* %t83
br label %while.cond.21
while.end.23:
%t102 = load i32, i32* %t82
%t103 = add i32 %t102, 1
store i32 %t103, i32* %t82
br label %while.cond.18
while.cond.24:
%t104 = load i32, i32* %t82
%t105 = load i32, i32* %t80
%t106 = icmp slt i32 %t104, %t105
%t107 = zext i1 %t106 to i32
%t108 = icmp ne i32 %t107, 0
br i1 %t108, label %while.body.25, label %while.end.26
while.body.25:
store i32 0, i32* %t83
br label %while.cond.27
while.end.26:
call void @starttime()
store i32 0, i32* %t82
br label %while.cond.30
while.cond.27:
%t109 = load i32, i32* %t83
%t110 = load i32, i32* %t80
%t111 = icmp slt i32 %t109, %t110
%t112 = zext i1 %t111 to i32
%t113 = icmp ne i32 %t112, 0
br i1 %t113, label %while.body.28, label %while.end.29
while.body.28:
%t114 = load i32, i32* %t82
%t115 = load i32, i32* %t83
%t116 = mul i32 %t114, 1024
%t117 = add i32 %t116, %t115
%t118 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @B, i32 0, i32 %t117
%t119 = call i32 @getint()
store i32 %t119, i32* %t118
%t120 = load i32, i32* %t83
%t121 = add i32 %t120, 1
store i32 %t121, i32* %t83
br label %while.cond.27
while.end.29:
%t122 = load i32, i32* %t82
%t123 = add i32 %t122, 1
store i32 %t123, i32* %t82
br label %while.cond.24
while.cond.30:
%t125 = load i32, i32* %t82
%t126 = icmp slt i32 %t125, 5
%t127 = zext i1 %t126 to i32
%t128 = icmp ne i32 %t127, 0
br i1 %t128, label %while.body.31, label %while.end.32
while.body.31:
%t129 = load i32, i32* %t80
%t130 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @A, i32 0, i32 0
%t131 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @B, i32 0, i32 0
%t132 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @C, i32 0, i32 0
call void @mm(i32 %t129, i32* %t130, i32* %t131, i32* %t132)
%t134 = load i32, i32* %t80
%t135 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @A, i32 0, i32 0
%t136 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @C, i32 0, i32 0
%t137 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @B, i32 0, i32 0
call void @mm(i32 %t134, i32* %t135, i32* %t136, i32* %t137)
%t139 = load i32, i32* %t82
%t140 = add i32 %t139, 1
store i32 %t140, i32* %t82
br label %while.cond.30
while.end.32:
store i32 0, i32* %t141
store i32 0, i32* %t82
br label %while.cond.33
while.cond.33:
%t142 = load i32, i32* %t82
%t143 = load i32, i32* %t80
%t144 = icmp slt i32 %t142, %t143
%t145 = zext i1 %t144 to i32
%t146 = icmp ne i32 %t145, 0
br i1 %t146, label %while.body.34, label %while.end.35
while.body.34:
store i32 0, i32* %t83
br label %while.cond.36
while.end.35:
call void @stoptime()
%t165 = load i32, i32* %t141
call void @putint(i32 %t165)
call void @putch(i32 10)
ret i32 0
while.cond.36:
%t147 = load i32, i32* %t83
%t148 = load i32, i32* %t80
%t149 = icmp slt i32 %t147, %t148
%t150 = zext i1 %t149 to i32
%t151 = icmp ne i32 %t150, 0
br i1 %t151, label %while.body.37, label %while.end.38
while.body.37:
%t152 = load i32, i32* %t141
%t153 = load i32, i32* %t82
%t154 = load i32, i32* %t83
%t155 = mul i32 %t153, 1024
%t156 = add i32 %t155, %t154
%t157 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @B, i32 0, i32 %t156
%t158 = load i32, i32* %t157
%t159 = add i32 %t152, %t158
store i32 %t159, i32* %t141
%t160 = load i32, i32* %t83
%t161 = add i32 %t160, 1
store i32 %t161, i32* %t83
br label %while.cond.36
while.end.38:
%t162 = load i32, i32* %t82
%t163 = add i32 %t162, 1
store i32 %t163, i32* %t82
br label %while.cond.33
}

@ -0,0 +1,6 @@
IR 已生成: ./lab2_results/test_case/performance/01_mm2.ll
运行 ./lab2_results/test_case/performance/01_mm2 ...
Total time: 1.457567 seconds
1691748973
退出码: 0
输出匹配: ./test/test_case/performance/01_mm2.out

@ -0,0 +1,225 @@
@x = global i32 0
@N = global i32 2010
@A = global [4040100 x i32] zeroinitializer
@B = global [2010 x i32] zeroinitializer
@C = global [2010 x i32] zeroinitializer
declare i32 @getint()
declare float @getfloat()
declare i32 @getarray(i32* %arg.a)
declare i32 @getfarray(float* %arg.a)
declare i32 @getch()
declare void @putint(i32 %arg.x)
declare void @putfloat(float %arg.x)
declare void @putarray(i32 %arg.n, i32* %arg.a)
declare void @putfarray(i32 %arg.n, float* %arg.a)
declare void @putch(i32 %arg.x)
declare void @starttime()
declare void @stoptime()
define void @mv(i32 %arg.n, i32* %arg.A, i32* %arg.b, i32* %arg.res) {
entry:
%t1 = alloca i32
%t2 = alloca i32
%t3 = alloca i32
%t4 = alloca i32
%t0 = alloca i32
store i32 %arg.n, i32* %t0
store i32 0, i32* %t1
store i32 0, i32* %t2
store i32 0, i32* %t2
store i32 11, i32* %t1
store i32 0, i32* %t3
store i32 0, i32* %t4
store i32 0, i32* %t3
br label %while.cond.1
while.cond.1:
%t5 = load i32, i32* %t3
%t6 = load i32, i32* %t0
%t7 = icmp slt i32 %t5, %t6
%t8 = zext i1 %t7 to i32
%t9 = icmp ne i32 %t8, 0
br i1 %t9, label %while.body.2, label %while.end.3
while.body.2:
%t10 = load i32, i32* %t3
%t11 = getelementptr inbounds i32, i32* %arg.res, i32 %t10
store i32 0, i32* %t11
%t12 = load i32, i32* %t3
%t13 = add i32 %t12, 1
store i32 %t13, i32* %t3
br label %while.cond.1
while.end.3:
store i32 0, i32* %t3
store i32 0, i32* %t4
br label %while.cond.4
while.cond.4:
%t14 = load i32, i32* %t3
%t15 = load i32, i32* %t0
%t16 = icmp slt i32 %t14, %t15
%t17 = zext i1 %t16 to i32
%t18 = icmp ne i32 %t17, 0
br i1 %t18, label %while.body.5, label %while.end.6
while.body.5:
store i32 0, i32* %t4
br label %while.cond.7
while.end.6:
ret void
while.cond.7:
%t19 = load i32, i32* %t4
%t20 = load i32, i32* %t0
%t21 = icmp slt i32 %t19, %t20
%t22 = zext i1 %t21 to i32
%t23 = icmp ne i32 %t22, 0
br i1 %t23, label %while.body.8, label %while.end.9
while.body.8:
%t24 = load i32, i32* %t3
%t25 = load i32, i32* %t4
%t26 = mul i32 %t24, 2010
%t27 = add i32 %t26, %t25
%t28 = getelementptr inbounds i32, i32* %arg.A, i32 %t27
%t29 = load i32, i32* %t28
%t30 = icmp eq i32 %t29, 0
%t31 = zext i1 %t30 to i32
%t32 = icmp ne i32 %t31, 0
br i1 %t32, label %if.then.10, label %if.else.11
while.end.9:
%t63 = load i32, i32* %t3
%t64 = add i32 %t63, 1
store i32 %t64, i32* %t3
br label %while.cond.4
if.then.10:
%t33 = load i32, i32* %t1
%t34 = load i32, i32* %t3
%t35 = getelementptr inbounds i32, i32* %arg.b, i32 %t34
%t36 = load i32, i32* %t35
%t37 = mul i32 %t33, %t36
%t38 = load i32, i32* %t4
%t39 = getelementptr inbounds i32, i32* %arg.b, i32 %t38
%t40 = load i32, i32* %t39
%t41 = add i32 %t37, %t40
store i32 %t41, i32* %t1
%t42 = load i32, i32* %t2
%t43 = load i32, i32* %t1
%t44 = sub i32 %t42, %t43
store i32 %t44, i32* %t2
br label %if.end.12
if.else.11:
%t45 = load i32, i32* %t3
%t46 = getelementptr inbounds i32, i32* %arg.res, i32 %t45
%t47 = load i32, i32* %t3
%t48 = getelementptr inbounds i32, i32* %arg.res, i32 %t47
%t49 = load i32, i32* %t48
%t50 = load i32, i32* %t3
%t51 = load i32, i32* %t4
%t52 = mul i32 %t50, 2010
%t53 = add i32 %t52, %t51
%t54 = getelementptr inbounds i32, i32* %arg.A, i32 %t53
%t55 = load i32, i32* %t54
%t56 = load i32, i32* %t4
%t57 = getelementptr inbounds i32, i32* %arg.b, i32 %t56
%t58 = load i32, i32* %t57
%t59 = mul i32 %t55, %t58
%t60 = add i32 %t49, %t59
store i32 %t60, i32* %t46
br label %if.end.12
if.end.12:
%t61 = load i32, i32* %t4
%t62 = add i32 %t61, 1
store i32 %t62, i32* %t4
br label %while.cond.7
}
define i32 @main() {
entry:
%t65 = alloca i32
%t67 = alloca i32
%t68 = alloca i32
%t66 = call i32 @getint()
store i32 %t66, i32* %t65
store i32 0, i32* %t67
store i32 0, i32* %t68
store i32 0, i32* %t67
br label %while.cond.13
while.cond.13:
%t69 = load i32, i32* %t67
%t70 = load i32, i32* %t65
%t71 = icmp slt i32 %t69, %t70
%t72 = zext i1 %t71 to i32
%t73 = icmp ne i32 %t72, 0
br i1 %t73, label %while.body.14, label %while.end.15
while.body.14:
store i32 0, i32* %t68
br label %while.cond.16
while.end.15:
store i32 0, i32* %t67
br label %while.cond.19
while.cond.16:
%t74 = load i32, i32* %t68
%t75 = load i32, i32* %t65
%t76 = icmp slt i32 %t74, %t75
%t77 = zext i1 %t76 to i32
%t78 = icmp ne i32 %t77, 0
br i1 %t78, label %while.body.17, label %while.end.18
while.body.17:
%t79 = load i32, i32* %t67
%t80 = load i32, i32* %t68
%t81 = mul i32 %t79, 2010
%t82 = add i32 %t81, %t80
%t83 = getelementptr inbounds [4040100 x i32], [4040100 x i32]* @A, i32 0, i32 %t82
%t84 = call i32 @getint()
store i32 %t84, i32* %t83
%t85 = load i32, i32* %t68
%t86 = add i32 %t85, 1
store i32 %t86, i32* %t68
br label %while.cond.16
while.end.18:
%t87 = load i32, i32* %t67
%t88 = add i32 %t87, 1
store i32 %t88, i32* %t67
br label %while.cond.13
while.cond.19:
%t89 = load i32, i32* %t67
%t90 = load i32, i32* %t65
%t91 = icmp slt i32 %t89, %t90
%t92 = zext i1 %t91 to i32
%t93 = icmp ne i32 %t92, 0
br i1 %t93, label %while.body.20, label %while.end.21
while.body.20:
%t94 = load i32, i32* %t67
%t95 = getelementptr inbounds [2010 x i32], [2010 x i32]* @B, i32 0, i32 %t94
%t96 = call i32 @getint()
store i32 %t96, i32* %t95
%t97 = load i32, i32* %t67
%t98 = add i32 %t97, 1
store i32 %t98, i32* %t67
br label %while.cond.19
while.end.21:
call void @starttime()
store i32 0, i32* %t67
br label %while.cond.22
while.cond.22:
%t100 = load i32, i32* %t67
%t101 = icmp slt i32 %t100, 50
%t102 = zext i1 %t101 to i32
%t103 = icmp ne i32 %t102, 0
br i1 %t103, label %while.body.23, label %while.end.24
while.body.23:
%t104 = load i32, i32* %t65
%t105 = getelementptr inbounds [4040100 x i32], [4040100 x i32]* @A, i32 0, i32 0
%t106 = getelementptr inbounds [2010 x i32], [2010 x i32]* @B, i32 0, i32 0
%t107 = getelementptr inbounds [2010 x i32], [2010 x i32]* @C, i32 0, i32 0
call void @mv(i32 %t104, i32* %t105, i32* %t106, i32* %t107)
%t109 = load i32, i32* %t65
%t110 = getelementptr inbounds [4040100 x i32], [4040100 x i32]* @A, i32 0, i32 0
%t111 = getelementptr inbounds [2010 x i32], [2010 x i32]* @C, i32 0, i32 0
%t112 = getelementptr inbounds [2010 x i32], [2010 x i32]* @B, i32 0, i32 0
call void @mv(i32 %t109, i32* %t110, i32* %t111, i32* %t112)
%t114 = load i32, i32* %t67
%t115 = add i32 %t114, 1
store i32 %t115, i32* %t67
br label %while.cond.22
while.end.24:
call void @stoptime()
%t117 = load i32, i32* %t65
%t118 = getelementptr inbounds [2010 x i32], [2010 x i32]* @C, i32 0, i32 0
call void @putarray(i32 %t117, i32* %t118)
ret i32 0
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,490 @@
@base = global i32 16
@a = global [30000010 x i32] zeroinitializer
@ans = global i32 0
declare i32 @getint()
declare float @getfloat()
declare i32 @getarray(i32* %arg.a)
declare i32 @getfarray(float* %arg.a)
declare i32 @getch()
declare void @putint(i32 %arg.x)
declare void @putfloat(float %arg.x)
declare void @putarray(i32 %arg.n, i32* %arg.a)
declare void @putfarray(i32 %arg.n, float* %arg.a)
declare void @putch(i32 %arg.x)
declare void @starttime()
declare void @stoptime()
define i32 @getMaxNum(i32 %arg.n, i32* %arg.arr) {
entry:
%t1 = alloca i32
%t2 = alloca i32
%t0 = alloca i32
store i32 %arg.n, i32* %t0
store i32 0, i32* %t1
store i32 0, i32* %t2
br label %while.cond.1
while.cond.1:
%t3 = load i32, i32* %t2
%t4 = load i32, i32* %t0
%t5 = icmp slt i32 %t3, %t4
%t6 = zext i1 %t5 to i32
%t7 = icmp ne i32 %t6, 0
br i1 %t7, label %while.body.2, label %while.end.3
while.body.2:
%t8 = load i32, i32* %t2
%t9 = getelementptr inbounds i32, i32* %arg.arr, i32 %t8
%t10 = load i32, i32* %t9
%t11 = load i32, i32* %t1
%t12 = icmp sgt i32 %t10, %t11
%t13 = zext i1 %t12 to i32
%t14 = icmp ne i32 %t13, 0
br i1 %t14, label %if.then.4, label %if.end.5
while.end.3:
%t20 = load i32, i32* %t1
ret i32 %t20
if.then.4:
%t15 = load i32, i32* %t2
%t16 = getelementptr inbounds i32, i32* %arg.arr, i32 %t15
%t17 = load i32, i32* %t16
store i32 %t17, i32* %t1
br label %if.end.5
if.end.5:
%t18 = load i32, i32* %t2
%t19 = add i32 %t18, 1
store i32 %t19, i32* %t2
br label %while.cond.1
}
define i32 @getNumPos(i32 %arg.num, i32 %arg.pos) {
entry:
%t23 = alloca i32
%t24 = alloca i32
%t21 = alloca i32
store i32 %arg.num, i32* %t21
%t22 = alloca i32
store i32 %arg.pos, i32* %t22
store i32 1, i32* %t23
store i32 0, i32* %t24
br label %while.cond.6
while.cond.6:
%t25 = load i32, i32* %t24
%t26 = load i32, i32* %t22
%t27 = icmp slt i32 %t25, %t26
%t28 = zext i1 %t27 to i32
%t29 = icmp ne i32 %t28, 0
br i1 %t29, label %while.body.7, label %while.end.8
while.body.7:
%t30 = load i32, i32* %t21
%t31 = sdiv i32 %t30, 16
store i32 %t31, i32* %t21
%t32 = load i32, i32* %t24
%t33 = add i32 %t32, 1
store i32 %t33, i32* %t24
br label %while.cond.6
while.end.8:
%t34 = load i32, i32* %t21
%t35 = srem i32 %t34, 16
ret i32 %t35
}
define void @radixSort(i32 %arg.bitround, i32* %arg.a, i32 %arg.l, i32 %arg.r) {
entry:
%t39 = alloca i32, i32 16
%t56 = alloca i32, i32 16
%t73 = alloca i32, i32 16
%t100 = alloca i32
%t164 = alloca i32
%t177 = alloca i32
%t216 = alloca i32
%t36 = alloca i32
store i32 %arg.bitround, i32* %t36
%t37 = alloca i32
store i32 %arg.l, i32* %t37
%t38 = alloca i32
store i32 %arg.r, i32* %t38
%t40 = getelementptr inbounds i32, i32* %t39, i32 0
store i32 0, i32* %t40
%t41 = getelementptr inbounds i32, i32* %t39, i32 1
store i32 0, i32* %t41
%t42 = getelementptr inbounds i32, i32* %t39, i32 2
store i32 0, i32* %t42
%t43 = getelementptr inbounds i32, i32* %t39, i32 3
store i32 0, i32* %t43
%t44 = getelementptr inbounds i32, i32* %t39, i32 4
store i32 0, i32* %t44
%t45 = getelementptr inbounds i32, i32* %t39, i32 5
store i32 0, i32* %t45
%t46 = getelementptr inbounds i32, i32* %t39, i32 6
store i32 0, i32* %t46
%t47 = getelementptr inbounds i32, i32* %t39, i32 7
store i32 0, i32* %t47
%t48 = getelementptr inbounds i32, i32* %t39, i32 8
store i32 0, i32* %t48
%t49 = getelementptr inbounds i32, i32* %t39, i32 9
store i32 0, i32* %t49
%t50 = getelementptr inbounds i32, i32* %t39, i32 10
store i32 0, i32* %t50
%t51 = getelementptr inbounds i32, i32* %t39, i32 11
store i32 0, i32* %t51
%t52 = getelementptr inbounds i32, i32* %t39, i32 12
store i32 0, i32* %t52
%t53 = getelementptr inbounds i32, i32* %t39, i32 13
store i32 0, i32* %t53
%t54 = getelementptr inbounds i32, i32* %t39, i32 14
store i32 0, i32* %t54
%t55 = getelementptr inbounds i32, i32* %t39, i32 15
store i32 0, i32* %t55
%t57 = getelementptr inbounds i32, i32* %t56, i32 0
store i32 0, i32* %t57
%t58 = getelementptr inbounds i32, i32* %t56, i32 1
store i32 0, i32* %t58
%t59 = getelementptr inbounds i32, i32* %t56, i32 2
store i32 0, i32* %t59
%t60 = getelementptr inbounds i32, i32* %t56, i32 3
store i32 0, i32* %t60
%t61 = getelementptr inbounds i32, i32* %t56, i32 4
store i32 0, i32* %t61
%t62 = getelementptr inbounds i32, i32* %t56, i32 5
store i32 0, i32* %t62
%t63 = getelementptr inbounds i32, i32* %t56, i32 6
store i32 0, i32* %t63
%t64 = getelementptr inbounds i32, i32* %t56, i32 7
store i32 0, i32* %t64
%t65 = getelementptr inbounds i32, i32* %t56, i32 8
store i32 0, i32* %t65
%t66 = getelementptr inbounds i32, i32* %t56, i32 9
store i32 0, i32* %t66
%t67 = getelementptr inbounds i32, i32* %t56, i32 10
store i32 0, i32* %t67
%t68 = getelementptr inbounds i32, i32* %t56, i32 11
store i32 0, i32* %t68
%t69 = getelementptr inbounds i32, i32* %t56, i32 12
store i32 0, i32* %t69
%t70 = getelementptr inbounds i32, i32* %t56, i32 13
store i32 0, i32* %t70
%t71 = getelementptr inbounds i32, i32* %t56, i32 14
store i32 0, i32* %t71
%t72 = getelementptr inbounds i32, i32* %t56, i32 15
store i32 0, i32* %t72
%t74 = getelementptr inbounds i32, i32* %t73, i32 0
store i32 0, i32* %t74
%t75 = getelementptr inbounds i32, i32* %t73, i32 1
store i32 0, i32* %t75
%t76 = getelementptr inbounds i32, i32* %t73, i32 2
store i32 0, i32* %t76
%t77 = getelementptr inbounds i32, i32* %t73, i32 3
store i32 0, i32* %t77
%t78 = getelementptr inbounds i32, i32* %t73, i32 4
store i32 0, i32* %t78
%t79 = getelementptr inbounds i32, i32* %t73, i32 5
store i32 0, i32* %t79
%t80 = getelementptr inbounds i32, i32* %t73, i32 6
store i32 0, i32* %t80
%t81 = getelementptr inbounds i32, i32* %t73, i32 7
store i32 0, i32* %t81
%t82 = getelementptr inbounds i32, i32* %t73, i32 8
store i32 0, i32* %t82
%t83 = getelementptr inbounds i32, i32* %t73, i32 9
store i32 0, i32* %t83
%t84 = getelementptr inbounds i32, i32* %t73, i32 10
store i32 0, i32* %t84
%t85 = getelementptr inbounds i32, i32* %t73, i32 11
store i32 0, i32* %t85
%t86 = getelementptr inbounds i32, i32* %t73, i32 12
store i32 0, i32* %t86
%t87 = getelementptr inbounds i32, i32* %t73, i32 13
store i32 0, i32* %t87
%t88 = getelementptr inbounds i32, i32* %t73, i32 14
store i32 0, i32* %t88
%t89 = getelementptr inbounds i32, i32* %t73, i32 15
store i32 0, i32* %t89
%t90 = load i32, i32* %t36
%t91 = icmp eq i32 %t90, -1
%t92 = zext i1 %t91 to i32
%t93 = icmp ne i32 %t92, 0
br i1 %t93, label %if.then.9, label %lor.rhs.11
if.then.9:
ret void
if.end.10:
%t101 = load i32, i32* %t37
store i32 %t101, i32* %t100
br label %while.cond.12
lor.rhs.11:
%t94 = load i32, i32* %t37
%t95 = add i32 %t94, 1
%t96 = load i32, i32* %t38
%t97 = icmp sge i32 %t95, %t96
%t98 = zext i1 %t97 to i32
%t99 = icmp ne i32 %t98, 0
br i1 %t99, label %if.then.9, label %if.end.10
while.cond.12:
%t102 = load i32, i32* %t100
%t103 = load i32, i32* %t38
%t104 = icmp slt i32 %t102, %t103
%t105 = zext i1 %t104 to i32
%t106 = icmp ne i32 %t105, 0
br i1 %t106, label %while.body.13, label %while.end.14
while.body.13:
%t107 = load i32, i32* %t100
%t108 = getelementptr inbounds i32, i32* %arg.a, i32 %t107
%t109 = load i32, i32* %t108
%t110 = load i32, i32* %t36
%t111 = call i32 @getNumPos(i32 %t109, i32 %t110)
%t112 = getelementptr inbounds i32, i32* %t73, i32 %t111
%t113 = load i32, i32* %t100
%t114 = getelementptr inbounds i32, i32* %arg.a, i32 %t113
%t115 = load i32, i32* %t114
%t116 = load i32, i32* %t36
%t117 = call i32 @getNumPos(i32 %t115, i32 %t116)
%t118 = getelementptr inbounds i32, i32* %t73, i32 %t117
%t119 = load i32, i32* %t118
%t120 = add i32 %t119, 1
store i32 %t120, i32* %t112
%t121 = load i32, i32* %t100
%t122 = add i32 %t121, 1
store i32 %t122, i32* %t100
br label %while.cond.12
while.end.14:
%t123 = getelementptr inbounds i32, i32* %t39, i32 0
%t124 = load i32, i32* %t37
store i32 %t124, i32* %t123
%t125 = getelementptr inbounds i32, i32* %t56, i32 0
%t126 = load i32, i32* %t37
%t127 = getelementptr inbounds i32, i32* %t73, i32 0
%t128 = load i32, i32* %t127
%t129 = add i32 %t126, %t128
store i32 %t129, i32* %t125
store i32 1, i32* %t100
br label %while.cond.15
while.cond.15:
%t130 = load i32, i32* %t100
%t131 = icmp slt i32 %t130, 16
%t132 = zext i1 %t131 to i32
%t133 = icmp ne i32 %t132, 0
br i1 %t133, label %while.body.16, label %while.end.17
while.body.16:
%t134 = load i32, i32* %t100
%t135 = getelementptr inbounds i32, i32* %t39, i32 %t134
%t136 = load i32, i32* %t100
%t137 = sub i32 %t136, 1
%t138 = getelementptr inbounds i32, i32* %t56, i32 %t137
%t139 = load i32, i32* %t138
store i32 %t139, i32* %t135
%t140 = load i32, i32* %t100
%t141 = getelementptr inbounds i32, i32* %t56, i32 %t140
%t142 = load i32, i32* %t100
%t143 = getelementptr inbounds i32, i32* %t39, i32 %t142
%t144 = load i32, i32* %t143
%t145 = load i32, i32* %t100
%t146 = getelementptr inbounds i32, i32* %t73, i32 %t145
%t147 = load i32, i32* %t146
%t148 = add i32 %t144, %t147
store i32 %t148, i32* %t141
%t149 = load i32, i32* %t100
%t150 = add i32 %t149, 1
store i32 %t150, i32* %t100
br label %while.cond.15
while.end.17:
store i32 0, i32* %t100
br label %while.cond.18
while.cond.18:
%t151 = load i32, i32* %t100
%t152 = icmp slt i32 %t151, 16
%t153 = zext i1 %t152 to i32
%t154 = icmp ne i32 %t153, 0
br i1 %t154, label %while.body.19, label %while.end.20
while.body.19:
br label %while.cond.21
while.end.20:
%t217 = load i32, i32* %t37
store i32 %t217, i32* %t216
%t218 = getelementptr inbounds i32, i32* %t39, i32 0
%t219 = load i32, i32* %t37
store i32 %t219, i32* %t218
%t220 = getelementptr inbounds i32, i32* %t56, i32 0
%t221 = load i32, i32* %t37
%t222 = getelementptr inbounds i32, i32* %t73, i32 0
%t223 = load i32, i32* %t222
%t224 = add i32 %t221, %t223
store i32 %t224, i32* %t220
store i32 0, i32* %t216
br label %while.cond.27
while.cond.21:
%t155 = load i32, i32* %t100
%t156 = getelementptr inbounds i32, i32* %t39, i32 %t155
%t157 = load i32, i32* %t156
%t158 = load i32, i32* %t100
%t159 = getelementptr inbounds i32, i32* %t56, i32 %t158
%t160 = load i32, i32* %t159
%t161 = icmp slt i32 %t157, %t160
%t162 = zext i1 %t161 to i32
%t163 = icmp ne i32 %t162, 0
br i1 %t163, label %while.body.22, label %while.end.23
while.body.22:
%t165 = load i32, i32* %t100
%t166 = getelementptr inbounds i32, i32* %t39, i32 %t165
%t167 = load i32, i32* %t166
%t168 = getelementptr inbounds i32, i32* %arg.a, i32 %t167
%t169 = load i32, i32* %t168
store i32 %t169, i32* %t164
br label %while.cond.24
while.end.23:
%t214 = load i32, i32* %t100
%t215 = add i32 %t214, 1
store i32 %t215, i32* %t100
br label %while.cond.18
while.cond.24:
%t170 = load i32, i32* %t164
%t171 = load i32, i32* %t36
%t172 = call i32 @getNumPos(i32 %t170, i32 %t171)
%t173 = load i32, i32* %t100
%t174 = icmp ne i32 %t172, %t173
%t175 = zext i1 %t174 to i32
%t176 = icmp ne i32 %t175, 0
br i1 %t176, label %while.body.25, label %while.end.26
while.body.25:
%t178 = load i32, i32* %t164
store i32 %t178, i32* %t177
%t179 = load i32, i32* %t177
%t180 = load i32, i32* %t36
%t181 = call i32 @getNumPos(i32 %t179, i32 %t180)
%t182 = getelementptr inbounds i32, i32* %t39, i32 %t181
%t183 = load i32, i32* %t182
%t184 = getelementptr inbounds i32, i32* %arg.a, i32 %t183
%t185 = load i32, i32* %t184
store i32 %t185, i32* %t164
%t186 = load i32, i32* %t177
%t187 = load i32, i32* %t36
%t188 = call i32 @getNumPos(i32 %t186, i32 %t187)
%t189 = getelementptr inbounds i32, i32* %t39, i32 %t188
%t190 = load i32, i32* %t189
%t191 = getelementptr inbounds i32, i32* %arg.a, i32 %t190
%t192 = load i32, i32* %t177
store i32 %t192, i32* %t191
%t193 = load i32, i32* %t177
%t194 = load i32, i32* %t36
%t195 = call i32 @getNumPos(i32 %t193, i32 %t194)
%t196 = getelementptr inbounds i32, i32* %t39, i32 %t195
%t197 = load i32, i32* %t177
%t198 = load i32, i32* %t36
%t199 = call i32 @getNumPos(i32 %t197, i32 %t198)
%t200 = getelementptr inbounds i32, i32* %t39, i32 %t199
%t201 = load i32, i32* %t200
%t202 = add i32 %t201, 1
store i32 %t202, i32* %t196
br label %while.cond.24
while.end.26:
%t203 = load i32, i32* %t100
%t204 = getelementptr inbounds i32, i32* %t39, i32 %t203
%t205 = load i32, i32* %t204
%t206 = getelementptr inbounds i32, i32* %arg.a, i32 %t205
%t207 = load i32, i32* %t164
store i32 %t207, i32* %t206
%t208 = load i32, i32* %t100
%t209 = getelementptr inbounds i32, i32* %t39, i32 %t208
%t210 = load i32, i32* %t100
%t211 = getelementptr inbounds i32, i32* %t39, i32 %t210
%t212 = load i32, i32* %t211
%t213 = add i32 %t212, 1
store i32 %t213, i32* %t209
br label %while.cond.21
while.cond.27:
%t225 = load i32, i32* %t216
%t226 = icmp slt i32 %t225, 16
%t227 = zext i1 %t226 to i32
%t228 = icmp ne i32 %t227, 0
br i1 %t228, label %while.body.28, label %while.end.29
while.body.28:
%t229 = load i32, i32* %t216
%t230 = icmp sgt i32 %t229, 0
%t231 = zext i1 %t230 to i32
%t232 = icmp ne i32 %t231, 0
br i1 %t232, label %if.then.30, label %if.end.31
while.end.29:
ret void
if.then.30:
%t233 = load i32, i32* %t216
%t234 = getelementptr inbounds i32, i32* %t39, i32 %t233
%t235 = load i32, i32* %t216
%t236 = sub i32 %t235, 1
%t237 = getelementptr inbounds i32, i32* %t56, i32 %t236
%t238 = load i32, i32* %t237
store i32 %t238, i32* %t234
%t239 = load i32, i32* %t216
%t240 = getelementptr inbounds i32, i32* %t56, i32 %t239
%t241 = load i32, i32* %t216
%t242 = getelementptr inbounds i32, i32* %t39, i32 %t241
%t243 = load i32, i32* %t242
%t244 = load i32, i32* %t216
%t245 = getelementptr inbounds i32, i32* %t73, i32 %t244
%t246 = load i32, i32* %t245
%t247 = add i32 %t243, %t246
store i32 %t247, i32* %t240
br label %if.end.31
if.end.31:
%t248 = load i32, i32* %t36
%t249 = sub i32 %t248, 1
%t250 = load i32, i32* %t216
%t251 = getelementptr inbounds i32, i32* %t39, i32 %t250
%t252 = load i32, i32* %t251
%t253 = load i32, i32* %t216
%t254 = getelementptr inbounds i32, i32* %t56, i32 %t253
%t255 = load i32, i32* %t254
call void @radixSort(i32 %t249, i32* %arg.a, i32 %t252, i32 %t255)
%t257 = load i32, i32* %t216
%t258 = add i32 %t257, 1
store i32 %t258, i32* %t216
br label %while.cond.27
}
define i32 @main() {
entry:
%t259 = alloca i32
%t266 = alloca i32
%t260 = getelementptr inbounds [30000010 x i32], [30000010 x i32]* @a, i32 0, i32 0
%t261 = call i32 @getarray(i32* %t260)
store i32 %t261, i32* %t259
call void @starttime()
%t263 = load i32, i32* %t259
%t264 = getelementptr inbounds [30000010 x i32], [30000010 x i32]* @a, i32 0, i32 0
call void @radixSort(i32 8, i32* %t264, i32 0, i32 %t263)
store i32 0, i32* %t266
br label %while.cond.32
while.cond.32:
%t267 = load i32, i32* %t266
%t268 = load i32, i32* %t259
%t269 = icmp slt i32 %t267, %t268
%t270 = zext i1 %t269 to i32
%t271 = icmp ne i32 %t270, 0
br i1 %t271, label %while.body.33, label %while.end.34
while.body.33:
%t272 = load i32, i32* @ans
%t273 = load i32, i32* %t266
%t274 = load i32, i32* %t266
%t275 = getelementptr inbounds [30000010 x i32], [30000010 x i32]* @a, i32 0, i32 %t274
%t276 = load i32, i32* %t275
%t277 = load i32, i32* %t266
%t278 = add i32 2, %t277
%t279 = srem i32 %t276, %t278
%t280 = mul i32 %t273, %t279
%t281 = add i32 %t272, %t280
store i32 %t281, i32* @ans
%t282 = load i32, i32* %t266
%t283 = add i32 %t282, 1
store i32 %t283, i32* %t266
br label %while.cond.32
while.end.34:
%t284 = load i32, i32* @ans
%t285 = icmp slt i32 %t284, 0
%t286 = zext i1 %t285 to i32
%t287 = icmp ne i32 %t286, 0
br i1 %t287, label %if.then.35, label %if.end.36
if.then.35:
%t288 = load i32, i32* @ans
%t289 = sub i32 0, %t288
store i32 %t289, i32* @ans
br label %if.end.36
if.end.36:
call void @stoptime()
%t291 = load i32, i32* @ans
call void @putint(i32 %t291)
call void @putch(i32 10)
ret i32 0
}

@ -0,0 +1,6 @@
IR 已生成: ./lab2_results/test_case/performance/03_sort1.ll
运行 ./lab2_results/test_case/performance/03_sort1 ...
Total time: 0.450766 seconds
1576633458
退出码: 0
输出匹配: ./test/test_case/performance/03_sort1.out

@ -0,0 +1,427 @@
@A = global [1048576 x i32] zeroinitializer
@B = global [1048576 x i32] zeroinitializer
@C = global [1048576 x i32] zeroinitializer
declare i32 @getint()
declare float @getfloat()
declare i32 @getarray(i32* %arg.a)
declare i32 @getfarray(float* %arg.a)
declare i32 @getch()
declare void @putint(i32 %arg.x)
declare void @putfloat(float %arg.x)
declare void @putarray(i32 %arg.n, i32* %arg.a)
declare void @putfarray(i32 %arg.n, float* %arg.a)
declare void @putch(i32 %arg.x)
declare void @starttime()
declare void @stoptime()
define i32 @main() {
entry:
%t0 = alloca i32
%t2 = alloca i32
%t4 = alloca i32
%t51 = alloca i32
%t77 = alloca i32
%t97 = alloca i32
%t132 = alloca i32
%t138 = alloca i32
%t166 = alloca i32
%t172 = alloca i32
%t173 = alloca i32
%t206 = alloca i32
%t207 = alloca i32
%t218 = alloca i32
%t1 = call i32 @getint()
store i32 %t1, i32* %t0
%t3 = call i32 @getint()
store i32 %t3, i32* %t2
store i32 0, i32* %t4
br label %while.cond.1
while.cond.1:
%t5 = load i32, i32* %t4
%t6 = load i32, i32* %t0
%t7 = icmp slt i32 %t5, %t6
%t8 = zext i1 %t7 to i32
%t9 = icmp ne i32 %t8, 0
br i1 %t9, label %while.body.2, label %while.end.3
while.body.2:
%t10 = load i32, i32* %t4
%t11 = load i32, i32* %t0
%t12 = sdiv i32 %t11, 2
%t13 = icmp slt i32 %t10, %t12
%t14 = zext i1 %t13 to i32
%t15 = icmp ne i32 %t14, 0
br i1 %t15, label %if.then.4, label %if.end.5
while.end.3:
store i32 0, i32* %t4
br label %while.cond.6
if.then.4:
%t16 = load i32, i32* %t4
%t17 = mul i32 %t16, 1024
%t18 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @A, i32 0, i32 %t17
%t19 = call i32 @getarray(i32* %t18)
br label %if.end.5
if.end.5:
%t20 = load i32, i32* %t4
%t21 = add i32 %t20, 1
store i32 %t21, i32* %t4
br label %while.cond.1
while.cond.6:
%t22 = load i32, i32* %t4
%t23 = load i32, i32* %t0
%t24 = icmp slt i32 %t22, %t23
%t25 = zext i1 %t24 to i32
%t26 = icmp ne i32 %t25, 0
br i1 %t26, label %while.body.7, label %while.end.8
while.body.7:
%t27 = load i32, i32* %t4
%t28 = load i32, i32* %t0
%t29 = sdiv i32 %t28, 2
%t30 = icmp sge i32 %t27, %t29
%t31 = zext i1 %t30 to i32
%t32 = icmp ne i32 %t31, 0
br i1 %t32, label %if.then.9, label %if.end.10
while.end.8:
call void @starttime()
store i32 0, i32* %t4
br label %while.cond.11
if.then.9:
%t33 = load i32, i32* %t4
%t34 = mul i32 %t33, 1024
%t35 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @B, i32 0, i32 %t34
%t36 = call i32 @getarray(i32* %t35)
br label %if.end.10
if.end.10:
%t37 = load i32, i32* %t4
%t38 = add i32 %t37, 1
store i32 %t38, i32* %t4
br label %while.cond.6
while.cond.11:
%t40 = load i32, i32* %t4
%t41 = load i32, i32* %t0
%t42 = icmp slt i32 %t40, %t41
%t43 = zext i1 %t42 to i32
%t44 = icmp ne i32 %t43, 0
br i1 %t44, label %while.body.12, label %while.end.13
while.body.12:
%t45 = load i32, i32* %t4
%t46 = load i32, i32* %t0
%t47 = sdiv i32 %t46, 2
%t48 = icmp sge i32 %t45, %t47
%t49 = zext i1 %t48 to i32
%t50 = icmp ne i32 %t49, 0
br i1 %t50, label %if.then.14, label %if.end.15
while.end.13:
store i32 0, i32* %t4
br label %while.cond.19
if.then.14:
store i32 0, i32* %t51
br label %while.cond.16
if.end.15:
%t64 = load i32, i32* %t4
%t65 = add i32 %t64, 1
store i32 %t65, i32* %t4
br label %while.cond.11
while.cond.16:
%t52 = load i32, i32* %t51
%t53 = load i32, i32* %t0
%t54 = icmp slt i32 %t52, %t53
%t55 = zext i1 %t54 to i32
%t56 = icmp ne i32 %t55, 0
br i1 %t56, label %while.body.17, label %while.end.18
while.body.17:
%t57 = load i32, i32* %t4
%t58 = load i32, i32* %t51
%t59 = mul i32 %t57, 1024
%t60 = add i32 %t59, %t58
%t61 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @A, i32 0, i32 %t60
store i32 -1, i32* %t61
%t62 = load i32, i32* %t51
%t63 = add i32 %t62, 1
store i32 %t63, i32* %t51
br label %while.cond.16
while.end.18:
br label %if.end.15
while.cond.19:
%t66 = load i32, i32* %t4
%t67 = load i32, i32* %t0
%t68 = icmp slt i32 %t66, %t67
%t69 = zext i1 %t68 to i32
%t70 = icmp ne i32 %t69, 0
br i1 %t70, label %while.body.20, label %while.end.21
while.body.20:
%t71 = load i32, i32* %t4
%t72 = load i32, i32* %t0
%t73 = sdiv i32 %t72, 2
%t74 = icmp slt i32 %t71, %t73
%t75 = zext i1 %t74 to i32
%t76 = icmp ne i32 %t75, 0
br i1 %t76, label %if.then.22, label %if.end.23
while.end.21:
store i32 0, i32* %t4
br label %while.cond.27
if.then.22:
store i32 0, i32* %t77
br label %while.cond.24
if.end.23:
%t90 = load i32, i32* %t4
%t91 = add i32 %t90, 1
store i32 %t91, i32* %t4
br label %while.cond.19
while.cond.24:
%t78 = load i32, i32* %t77
%t79 = load i32, i32* %t0
%t80 = icmp slt i32 %t78, %t79
%t81 = zext i1 %t80 to i32
%t82 = icmp ne i32 %t81, 0
br i1 %t82, label %while.body.25, label %while.end.26
while.body.25:
%t83 = load i32, i32* %t4
%t84 = load i32, i32* %t77
%t85 = mul i32 %t83, 1024
%t86 = add i32 %t85, %t84
%t87 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @B, i32 0, i32 %t86
store i32 -1, i32* %t87
%t88 = load i32, i32* %t77
%t89 = add i32 %t88, 1
store i32 %t89, i32* %t77
br label %while.cond.24
while.end.26:
br label %if.end.23
while.cond.27:
%t92 = load i32, i32* %t4
%t93 = load i32, i32* %t0
%t94 = icmp slt i32 %t92, %t93
%t95 = zext i1 %t94 to i32
%t96 = icmp ne i32 %t95, 0
br i1 %t96, label %while.body.28, label %while.end.29
while.body.28:
store i32 0, i32* %t97
br label %while.cond.30
while.end.29:
store i32 0, i32* %t4
br label %while.cond.33
while.cond.30:
%t98 = load i32, i32* %t97
%t99 = load i32, i32* %t0
%t100 = icmp slt i32 %t98, %t99
%t101 = zext i1 %t100 to i32
%t102 = icmp ne i32 %t101, 0
br i1 %t102, label %while.body.31, label %while.end.32
while.body.31:
%t103 = load i32, i32* %t4
%t104 = load i32, i32* %t97
%t105 = mul i32 %t103, 1024
%t106 = add i32 %t105, %t104
%t107 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @C, i32 0, i32 %t106
%t108 = load i32, i32* %t4
%t109 = load i32, i32* %t97
%t110 = mul i32 %t108, 1024
%t111 = add i32 %t110, %t109
%t112 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @A, i32 0, i32 %t111
%t113 = load i32, i32* %t112
%t114 = mul i32 %t113, 2
%t115 = load i32, i32* %t4
%t116 = load i32, i32* %t97
%t117 = mul i32 %t115, 1024
%t118 = add i32 %t117, %t116
%t119 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @B, i32 0, i32 %t118
%t120 = load i32, i32* %t119
%t121 = mul i32 %t120, 3
%t122 = add i32 %t114, %t121
store i32 %t122, i32* %t107
%t123 = load i32, i32* %t97
%t124 = add i32 %t123, 1
store i32 %t124, i32* %t97
br label %while.cond.30
while.end.32:
%t125 = load i32, i32* %t4
%t126 = add i32 %t125, 1
store i32 %t126, i32* %t4
br label %while.cond.27
while.cond.33:
%t127 = load i32, i32* %t4
%t128 = load i32, i32* %t0
%t129 = icmp slt i32 %t127, %t128
%t130 = zext i1 %t129 to i32
%t131 = icmp ne i32 %t130, 0
br i1 %t131, label %while.body.34, label %while.end.35
while.body.34:
store i32 0, i32* %t132
br label %while.cond.36
while.end.35:
store i32 0, i32* %t4
br label %while.cond.39
while.cond.36:
%t133 = load i32, i32* %t132
%t134 = load i32, i32* %t0
%t135 = icmp slt i32 %t133, %t134
%t136 = zext i1 %t135 to i32
%t137 = icmp ne i32 %t136, 0
br i1 %t137, label %while.body.37, label %while.end.38
while.body.37:
%t139 = load i32, i32* %t4
%t140 = load i32, i32* %t132
%t141 = mul i32 %t139, 1024
%t142 = add i32 %t141, %t140
%t143 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @C, i32 0, i32 %t142
%t144 = load i32, i32* %t143
store i32 %t144, i32* %t138
%t145 = load i32, i32* %t138
%t146 = load i32, i32* %t138
%t147 = mul i32 %t145, %t146
%t148 = add i32 %t147, 7
store i32 %t148, i32* %t138
%t149 = load i32, i32* %t138
%t150 = sdiv i32 %t149, 3
store i32 %t150, i32* %t138
%t151 = load i32, i32* %t4
%t152 = load i32, i32* %t132
%t153 = mul i32 %t151, 1024
%t154 = add i32 %t153, %t152
%t155 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @C, i32 0, i32 %t154
%t156 = load i32, i32* %t138
store i32 %t156, i32* %t155
%t157 = load i32, i32* %t132
%t158 = add i32 %t157, 1
store i32 %t158, i32* %t132
br label %while.cond.36
while.end.38:
%t159 = load i32, i32* %t4
%t160 = add i32 %t159, 1
store i32 %t160, i32* %t4
br label %while.cond.33
while.cond.39:
%t161 = load i32, i32* %t4
%t162 = load i32, i32* %t0
%t163 = icmp slt i32 %t161, %t162
%t164 = zext i1 %t163 to i32
%t165 = icmp ne i32 %t164, 0
br i1 %t165, label %while.body.40, label %while.end.41
while.body.40:
store i32 0, i32* %t166
br label %while.cond.42
while.end.41:
store i32 0, i32* %t206
store i32 0, i32* %t207
br label %while.cond.48
while.cond.42:
%t167 = load i32, i32* %t166
%t168 = load i32, i32* %t0
%t169 = icmp slt i32 %t167, %t168
%t170 = zext i1 %t169 to i32
%t171 = icmp ne i32 %t170, 0
br i1 %t171, label %while.body.43, label %while.end.44
while.body.43:
store i32 0, i32* %t172
store i32 0, i32* %t173
br label %while.cond.45
while.end.44:
%t204 = load i32, i32* %t4
%t205 = add i32 %t204, 1
store i32 %t205, i32* %t4
br label %while.cond.39
while.cond.45:
%t174 = load i32, i32* %t172
%t175 = load i32, i32* %t0
%t176 = icmp slt i32 %t174, %t175
%t177 = zext i1 %t176 to i32
%t178 = icmp ne i32 %t177, 0
br i1 %t178, label %while.body.46, label %while.end.47
while.body.46:
%t179 = load i32, i32* %t173
%t180 = load i32, i32* %t4
%t181 = load i32, i32* %t172
%t182 = mul i32 %t180, 1024
%t183 = add i32 %t182, %t181
%t184 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @C, i32 0, i32 %t183
%t185 = load i32, i32* %t184
%t186 = load i32, i32* %t172
%t187 = load i32, i32* %t166
%t188 = mul i32 %t186, 1024
%t189 = add i32 %t188, %t187
%t190 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @A, i32 0, i32 %t189
%t191 = load i32, i32* %t190
%t192 = mul i32 %t185, %t191
%t193 = add i32 %t179, %t192
store i32 %t193, i32* %t173
%t194 = load i32, i32* %t172
%t195 = add i32 %t194, 1
store i32 %t195, i32* %t172
br label %while.cond.45
while.end.47:
%t196 = load i32, i32* %t4
%t197 = load i32, i32* %t166
%t198 = mul i32 %t196, 1024
%t199 = add i32 %t198, %t197
%t200 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @A, i32 0, i32 %t199
%t201 = load i32, i32* %t173
store i32 %t201, i32* %t200
%t202 = load i32, i32* %t166
%t203 = add i32 %t202, 1
store i32 %t203, i32* %t166
br label %while.cond.42
while.cond.48:
%t208 = load i32, i32* %t207
%t209 = load i32, i32* %t2
%t210 = icmp slt i32 %t208, %t209
%t211 = zext i1 %t210 to i32
%t212 = icmp ne i32 %t211, 0
br i1 %t212, label %while.body.49, label %while.end.50
while.body.49:
store i32 0, i32* %t4
br label %while.cond.51
while.end.50:
call void @stoptime()
%t246 = load i32, i32* %t206
call void @putint(i32 %t246)
call void @putch(i32 10)
ret i32 0
while.cond.51:
%t213 = load i32, i32* %t4
%t214 = load i32, i32* %t0
%t215 = icmp slt i32 %t213, %t214
%t216 = zext i1 %t215 to i32
%t217 = icmp ne i32 %t216, 0
br i1 %t217, label %while.body.52, label %while.end.53
while.body.52:
store i32 0, i32* %t218
br label %while.cond.54
while.end.53:
%t243 = load i32, i32* %t207
%t244 = add i32 %t243, 1
store i32 %t244, i32* %t207
br label %while.cond.48
while.cond.54:
%t219 = load i32, i32* %t218
%t220 = load i32, i32* %t0
%t221 = icmp slt i32 %t219, %t220
%t222 = zext i1 %t221 to i32
%t223 = icmp ne i32 %t222, 0
br i1 %t223, label %while.body.55, label %while.end.56
while.body.55:
%t224 = load i32, i32* %t206
%t225 = load i32, i32* %t4
%t226 = load i32, i32* %t218
%t227 = mul i32 %t225, 1024
%t228 = add i32 %t227, %t226
%t229 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @A, i32 0, i32 %t228
%t230 = load i32, i32* %t229
%t231 = load i32, i32* %t4
%t232 = load i32, i32* %t218
%t233 = mul i32 %t231, 1024
%t234 = add i32 %t233, %t232
%t235 = getelementptr inbounds [1048576 x i32], [1048576 x i32]* @A, i32 0, i32 %t234
%t236 = load i32, i32* %t235
%t237 = mul i32 %t230, %t236
%t238 = add i32 %t224, %t237
store i32 %t238, i32* %t206
%t239 = load i32, i32* %t218
%t240 = add i32 %t239, 1
store i32 %t240, i32* %t218
br label %while.cond.54
while.end.56:
%t241 = load i32, i32* %t4
%t242 = add i32 %t241, 1
store i32 %t242, i32* %t4
br label %while.cond.51
}

@ -0,0 +1,2 @@
IR 已生成: ./lab2_results/test_case/performance/2025-MYO-20.ll
运行 ./lab2_results/test_case/performance/2025-MYO-20 ...

Binary file not shown.

@ -0,0 +1,10 @@
.text
.globl main
.p2align 2
main:
.L.main.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
mov w0, #3
ldp x29, x30, [sp], #16
ret

Binary file not shown.

@ -2,26 +2,27 @@
.globl main
.p2align 2
main:
.L.main.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #32
stp x29, x30, [sp, #16]
add x29, sp, #16
mov w8, #0
stur w8, [x29, #-4]
mov w8, #0
stur w8, [x29, #-8]
mov w8, #10
stur w8, [x29, #-4]
mov w8, #-1
mov w8, #8
stur w8, [x29, #-8]
ldur w8, [x29, #-4]
mov w8, #12
stur w8, [x29, #-12]
ldur w8, [x29, #-8]
stur w8, [x29, #-16]
ldur w8, [x29, #-12]
ldur w9, [x29, #-16]
add w8, w8, w9
stur w8, [x29, #-20]
ldur w0, [x29, #-20]
ldp x29, x30, [sp, #16]
ldur w8, [x29, #-16]
ldur w9, [x29, #-20]
add w8, w8, w9
stur w8, [x29, #-4]
ldur w8, [x29, #-4]
stur w8, [x29, #-24]
ldur w0, [x29, #-24]
add sp, sp, #32
ldp x29, x30, [sp], #16
ret

Binary file not shown.

@ -0,0 +1,87 @@
.text
.globl main
.p2align 2
main:
.L.main.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #80
mov w8, #893
stur w8, [x29, #-4]
mov w8, #716
stur w8, [x29, #-8]
mov w8, #837
stur w8, [x29, #-12]
ldur w8, [x29, #-12]
stur w8, [x29, #-24]
ldur w8, [x29, #-24]
mov w9, #128
add w8, w8, w9
stur w8, [x29, #-12]
ldur w8, [x29, #-8]
stur w8, [x29, #-28]
ldur w8, [x29, #-12]
stur w8, [x29, #-32]
ldur w8, [x29, #-28]
ldur w9, [x29, #-32]
add w8, w8, w9
stur w8, [x29, #-8]
mov w8, #241
stur w8, [x29, #-16]
ldur w8, [x29, #-12]
stur w8, [x29, #-36]
ldur w8, [x29, #-16]
stur w8, [x29, #-40]
ldur w8, [x29, #-36]
ldur w10, [x29, #-40]
add w8, w8, w10
mov w9, #412
sub w8, w8, w9
stur w8, [x29, #-12]
mov w8, #771
stur w8, [x29, #-20]
ldur w8, [x29, #-16]
stur w8, [x29, #-44]
ldur w8, [x29, #-20]
stur w8, [x29, #-48]
ldur w8, [x29, #-44]
ldur w10, [x29, #-48]
add w8, w8, w10
mov w9, #18
sub w8, w8, w9
stur w8, [x29, #-16]
ldur w8, [x29, #-16]
stur w8, [x29, #-52]
ldur w8, [x29, #-52]
mov w9, #66
add w8, w8, w9
stur w8, [x29, #-20]
ldur w8, [x29, #-16]
stur w8, [x29, #-56]
ldur w8, [x29, #-12]
stur w8, [x29, #-60]
ldur w8, [x29, #-56]
ldur w10, [x29, #-60]
add w8, w8, w10
mov w9, #33
sub w8, w8, w9
stur w8, [x29, #-16]
ldur w8, [x29, #-16]
stur w8, [x29, #-64]
ldur w8, [x29, #-64]
mov w9, #55
sub w8, w8, w9
stur w8, [x29, #-12]
ldur w8, [x29, #-12]
stur w8, [x29, #-68]
ldur w8, [x29, #-16]
stur w8, [x29, #-72]
ldur w0, [x29, #-68]
ldur w9, [x29, #-72]
add w0, w0, w9
mov w8, #21
sdiv w12, w0, w8
msub w0, w12, w8, w0
add sp, sp, #80
ldp x29, x30, [sp], #16
ret

Binary file not shown.

@ -0,0 +1,265 @@
.text
.globl main
.p2align 2
main:
.L.main.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #128
mov w8, #1
stur w8, [x29, #-4]
mov w8, #2
stur w8, [x29, #-8]
mov w8, #3
stur w8, [x29, #-12]
mov w8, #4
stur w8, [x29, #-16]
mov w8, #5
stur w8, [x29, #-20]
mov w8, #6
stur w8, [x29, #-24]
ldur w8, [x29, #-4]
stur w8, [x29, #-28]
ldur w8, [x29, #-8]
stur w8, [x29, #-32]
ldur w8, [x29, #-12]
stur w8, [x29, #-36]
ldur w8, [x29, #-28]
ldur w11, [x29, #-32]
mul w8, w8, w11
ldur w10, [x29, #-36]
add w8, w8, w10
mov w9, #6
cmp w8, w9
b.lt .L.main.4
b .L.main.2
.L.main.1:
ldur w8, [x29, #-20]
stur w8, [x29, #-40]
ldur w8, [x29, #-40]
mov w9, #0
cmp w8, w9
b.ne .L.main.5
b .L.main.8
.L.main.2:
mov w0, #1
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.L.main.3:
mov w0, #0
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.L.main.4:
ldur w8, [x29, #-16]
stur w8, [x29, #-44]
ldur w8, [x29, #-44]
mov w9, #0
cmp w8, w9
b.ne .L.main.1
b .L.main.2
.L.main.5:
ldur w8, [x29, #-12]
stur w8, [x29, #-48]
ldur w8, [x29, #-48]
mov w9, #2
cmp w8, w9
b.eq .L.main.12
b .L.main.10
.L.main.6:
mov w0, #2
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.L.main.7:
mov w0, #0
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.L.main.8:
ldur w8, [x29, #-4]
stur w8, [x29, #-52]
ldur w8, [x29, #-52]
mov w9, #0
cmp w8, w9
b.eq .L.main.5
b .L.main.6
.L.main.9:
mov w0, #3
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.L.main.10:
ldur w8, [x29, #-24]
stur w8, [x29, #-56]
ldur w8, [x29, #-12]
stur w8, [x29, #-60]
ldur w8, [x29, #-56]
ldur w9, [x29, #-60]
sdiv w12, w8, w9
msub w8, w12, w9, w8
mov w9, #0
cmp w8, w9
b.ne .L.main.16
b .L.main.14
.L.main.11:
mov w0, #0
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.L.main.12:
ldur w8, [x29, #-16]
stur w8, [x29, #-64]
ldur w8, [x29, #-20]
stur w8, [x29, #-68]
ldur w8, [x29, #-64]
ldur w10, [x29, #-68]
add w8, w8, w10
mov w9, #2
cmp w8, w9
b.gt .L.main.9
b .L.main.10
.L.main.13:
mov w0, #4
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.L.main.14:
ldur w8, [x29, #-16]
stur w8, [x29, #-72]
ldur w8, [x29, #-8]
stur w8, [x29, #-76]
ldur w8, [x29, #-4]
stur w8, [x29, #-80]
ldur w8, [x29, #-72]
ldur w11, [x29, #-76]
sdiv w8, w8, w11
ldur w10, [x29, #-80]
add w8, w8, w10
mov w9, #2
cmp w8, w9
b.ge .L.main.17
b .L.main.18
.L.main.15:
mov w0, #0
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.L.main.16:
ldur w8, [x29, #-20]
stur w8, [x29, #-84]
ldur w8, [x29, #-84]
mov w9, #0
cmp w8, w9
b.ne .L.main.13
b .L.main.14
.L.main.17:
ldur w8, [x29, #-20]
stur w8, [x29, #-88]
ldur w8, [x29, #-24]
stur w8, [x29, #-92]
ldur w8, [x29, #-88]
ldur w10, [x29, #-92]
sub w8, w8, w10
mov w9, #0
cmp w8, w9
b.ge .L.main.20
b .L.main.23
.L.main.18:
mov w0, #5
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.L.main.19:
mov w0, #0
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.L.main.20:
mov w0, #6
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.L.main.21:
ldur w8, [x29, #-12]
stur w8, [x29, #-96]
ldur w8, [x29, #-24]
stur w8, [x29, #-100]
ldur w8, [x29, #-96]
ldur w9, [x29, #-100]
cmp w8, w9
b.ne .L.main.24
b .L.main.25
.L.main.22:
mov w0, #0
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.L.main.23:
ldur w8, [x29, #-16]
stur w8, [x29, #-104]
ldur w8, [x29, #-104]
mov w9, #4
cmp w8, w9
b.gt .L.main.20
b .L.main.21
.L.main.24:
ldur w8, [x29, #-8]
stur w8, [x29, #-108]
ldur w8, [x29, #-20]
stur w8, [x29, #-112]
ldur w8, [x29, #-16]
stur w8, [x29, #-116]
ldur w8, [x29, #-108]
ldur w10, [x29, #-112]
ldur w11, [x29, #-116]
mul w10, w10, w11
add w8, w8, w10
mov w9, #10
cmp w8, w9
b.gt .L.main.27
b .L.main.28
.L.main.25:
mov w0, #7
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.L.main.26:
mov w0, #0
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.L.main.27:
ldur w8, [x29, #-24]
stur w8, [x29, #-120]
ldur w8, [x29, #-120]
mov w9, #0
cmp w8, w9
b.eq .L.main.30
b .L.main.31
.L.main.28:
mov w0, #8
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.L.main.29:
mov w0, #0
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.L.main.30:
mov w0, #9
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.L.main.31:
mov w0, #10
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.L.main.32:
mov w0, #0
add sp, sp, #128
ldp x29, x30, [sp], #16
ret

Binary file not shown.

@ -0,0 +1,194 @@
.text
.globl main
.p2align 2
main:
.L.main.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #96
mov w8, #0
stur w8, [x29, #-4]
mov w8, #0
stur w8, [x29, #-8]
b .L.main.1
.L.main.1:
ldur w8, [x29, #-8]
stur w8, [x29, #-28]
ldur w8, [x29, #-28]
mov w9, #20
cmp w8, w9
b.lt .L.main.2
b .L.main.3
.L.main.2:
mov w8, #0
stur w8, [x29, #-12]
b .L.main.4
.L.main.3:
ldur w8, [x29, #-4]
stur w8, [x29, #-32]
ldur w0, [x29, #-32]
add sp, sp, #96
ldp x29, x30, [sp], #16
ret
.L.main.4:
ldur w8, [x29, #-12]
stur w8, [x29, #-36]
ldur w8, [x29, #-36]
mov w9, #10
cmp w8, w9
b.lt .L.main.5
b .L.main.6
.L.main.5:
mov w8, #0
stur w8, [x29, #-16]
b .L.main.7
.L.main.6:
ldur w8, [x29, #-8]
stur w8, [x29, #-40]
ldur w8, [x29, #-40]
mov w9, #1
add w8, w8, w9
stur w8, [x29, #-8]
b .L.main.1
.L.main.7:
ldur w8, [x29, #-16]
stur w8, [x29, #-44]
ldur w8, [x29, #-44]
mov w9, #5
cmp w8, w9
b.lt .L.main.8
b .L.main.9
.L.main.8:
mov w8, #0
stur w8, [x29, #-20]
b .L.main.10
.L.main.9:
ldur w8, [x29, #-12]
stur w8, [x29, #-48]
ldur w8, [x29, #-48]
mov w9, #1
add w8, w8, w9
stur w8, [x29, #-12]
b .L.main.4
.L.main.10:
ldur w8, [x29, #-20]
stur w8, [x29, #-52]
ldur w8, [x29, #-52]
mov w9, #3
cmp w8, w9
b.lt .L.main.11
b .L.main.12
.L.main.11:
ldur w8, [x29, #-20]
stur w8, [x29, #-56]
ldur w8, [x29, #-56]
mov w10, #1
add w8, w8, w10
mov w9, #3
cmp w8, w9
b.ge .L.main.13
b .L.main.14
.L.main.12:
b .L.main.25
.L.main.13:
ldur w8, [x29, #-20]
stur w8, [x29, #-60]
ldur w8, [x29, #-60]
mov w9, #0
cmp w8, w9
b.ne .L.main.15
b .L.main.16
.L.main.14:
mov w8, #0
stur w8, [x29, #-24]
b .L.main.22
.L.main.15:
ldur w8, [x29, #-20]
stur w8, [x29, #-64]
ldur w8, [x29, #-64]
mov w9, #0
cmp w8, w9
b.ne .L.main.17
b .L.main.19
.L.main.16:
b .L.main.14
.L.main.17:
ldur w8, [x29, #-20]
stur w8, [x29, #-68]
ldur w8, [x29, #-68]
mov w10, #-1
sub w8, w8, w10
mov w9, #3
cmp w8, w9
b.ge .L.main.20
b .L.main.21
.L.main.18:
b .L.main.16
.L.main.19:
ldur w8, [x29, #-20]
stur w8, [x29, #-72]
ldur w8, [x29, #-72]
mov w9, #0
cmp w8, w9
b.eq .L.main.17
b .L.main.18
.L.main.20:
b .L.main.12
.L.main.21:
b .L.main.18
.L.main.22:
ldur w8, [x29, #-24]
stur w8, [x29, #-76]
ldur w8, [x29, #-76]
mov w9, #2
cmp w8, w9
b.lt .L.main.23
b .L.main.24
.L.main.23:
ldur w8, [x29, #-24]
stur w8, [x29, #-80]
ldur w8, [x29, #-80]
mov w9, #1
add w8, w8, w9
stur w8, [x29, #-24]
b .L.main.22
.L.main.24:
ldur w8, [x29, #-20]
stur w8, [x29, #-84]
ldur w8, [x29, #-84]
mov w9, #1
add w8, w8, w9
stur w8, [x29, #-20]
ldur w8, [x29, #-4]
stur w8, [x29, #-88]
ldur w8, [x29, #-88]
mov w9, #1
add w8, w8, w9
stur w8, [x29, #-4]
b .L.main.10
.L.main.25:
mov w8, #1
mov w9, #0
cmp w8, w9
b.ne .L.main.26
b .L.main.27
.L.main.26:
b .L.main.28
.L.main.27:
ldur w8, [x29, #-16]
stur w8, [x29, #-92]
ldur w8, [x29, #-92]
mov w9, #1
add w8, w8, w9
stur w8, [x29, #-16]
b .L.main.7
.L.main.28:
mov w8, #1
mov w9, #0
cmp w8, w9
b.ne .L.main.29
b .L.main.30
.L.main.29:
b .L.main.30
.L.main.30:
b .L.main.27

Binary file not shown.

@ -0,0 +1,35 @@
.text
.globl f
.p2align 2
f:
.L.f.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #16
stur w0, [x29, #-4]
ldur w8, [x29, #-4]
stur w8, [x29, #-8]
ldur w8, [x29, #-8]
stur w8, [x29, #-12]
ldur w0, [x29, #-12]
mov w8, #2
lsl w0, w0, #1
add sp, sp, #16
ldp x29, x30, [sp], #16
ret
.text
.globl main
.p2align 2
main:
.L.main.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #16
mov w0, #10
bl f
stur w0, [x29, #-4]
ldur w0, [x29, #-4]
add sp, sp, #16
ldp x29, x30, [sp], #16
ret

Binary file not shown.

@ -0,0 +1,27 @@
.text
.globl f
.p2align 2
f:
.L.f.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
mov w0, #10
ldp x29, x30, [sp], #16
ret
.text
.globl main
.p2align 2
main:
.L.main.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #16
mov w8, #20
stur w8, [x29, #-4]
ldur w8, [x29, #-4]
stur w8, [x29, #-8]
ldur w0, [x29, #-8]
add sp, sp, #16
ldp x29, x30, [sp], #16
ret

Binary file not shown.

@ -0,0 +1,594 @@
.text
.globl main
.p2align 2
main:
.L.main.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #528
mov x15, x29
sub x15, x15, #124
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #124
mov x14, #4
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #124
mov x14, #8
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #124
mov x14, #12
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #124
mov x14, #16
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #124
mov x14, #20
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #124
mov x14, #24
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #124
mov x14, #28
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #124
mov x14, #32
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #124
mov x14, #36
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #124
mov x14, #40
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #124
mov x14, #44
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #124
mov x14, #48
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #124
mov x14, #52
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #124
mov x14, #56
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #188
mov w8, #1
str w8, [x15]
mov x15, x29
sub x15, x15, #188
mov x14, #4
add x15, x15, x14
mov w8, #2
str w8, [x15]
mov x15, x29
sub x15, x15, #188
mov x14, #8
add x15, x15, x14
mov w8, #3
str w8, [x15]
mov x15, x29
sub x15, x15, #188
mov x14, #12
add x15, x15, x14
mov w8, #4
str w8, [x15]
mov x15, x29
sub x15, x15, #188
mov x14, #16
add x15, x15, x14
mov w8, #5
str w8, [x15]
mov x15, x29
sub x15, x15, #188
mov x14, #20
add x15, x15, x14
mov w8, #6
str w8, [x15]
mov x15, x29
sub x15, x15, #188
mov x14, #24
add x15, x15, x14
mov w8, #7
str w8, [x15]
mov x15, x29
sub x15, x15, #188
mov x14, #28
add x15, x15, x14
mov w8, #8
str w8, [x15]
mov x15, x29
sub x15, x15, #188
mov x14, #32
add x15, x15, x14
mov w8, #9
str w8, [x15]
mov x15, x29
sub x15, x15, #188
mov x14, #36
add x15, x15, x14
mov w8, #10
str w8, [x15]
mov x15, x29
sub x15, x15, #188
mov x14, #40
add x15, x15, x14
mov w8, #11
str w8, [x15]
mov x15, x29
sub x15, x15, #188
mov x14, #44
add x15, x15, x14
mov w8, #12
str w8, [x15]
mov x15, x29
sub x15, x15, #188
mov x14, #48
add x15, x15, x14
mov w8, #13
str w8, [x15]
mov x15, x29
sub x15, x15, #188
mov x14, #52
add x15, x15, x14
mov w8, #14
str w8, [x15]
mov x15, x29
sub x15, x15, #188
mov x14, #56
add x15, x15, x14
mov w8, #15
str w8, [x15]
mov x15, x29
sub x15, x15, #252
mov w8, #1
str w8, [x15]
mov x15, x29
sub x15, x15, #252
mov x14, #4
add x15, x15, x14
mov w8, #2
str w8, [x15]
mov x15, x29
sub x15, x15, #252
mov x14, #8
add x15, x15, x14
mov w8, #3
str w8, [x15]
mov x15, x29
sub x15, x15, #252
mov x14, #12
add x15, x15, x14
mov w8, #4
str w8, [x15]
mov x15, x29
sub x15, x15, #252
mov x14, #16
add x15, x15, x14
mov w8, #5
str w8, [x15]
mov x15, x29
sub x15, x15, #252
mov x14, #20
add x15, x15, x14
mov w8, #6
str w8, [x15]
mov x15, x29
sub x15, x15, #252
mov x14, #24
add x15, x15, x14
mov w8, #7
str w8, [x15]
mov x15, x29
sub x15, x15, #252
mov x14, #28
add x15, x15, x14
mov w8, #8
str w8, [x15]
mov x15, x29
sub x15, x15, #252
mov x14, #32
add x15, x15, x14
mov w8, #9
str w8, [x15]
mov x15, x29
sub x15, x15, #252
mov x14, #36
add x15, x15, x14
mov w8, #10
str w8, [x15]
mov x15, x29
sub x15, x15, #252
mov x14, #40
add x15, x15, x14
mov w8, #11
str w8, [x15]
mov x15, x29
sub x15, x15, #252
mov x14, #44
add x15, x15, x14
mov w8, #12
str w8, [x15]
mov x15, x29
sub x15, x15, #252
mov x14, #48
add x15, x15, x14
mov w8, #13
str w8, [x15]
mov x15, x29
sub x15, x15, #252
mov x14, #52
add x15, x15, x14
mov w8, #14
str w8, [x15]
mov x15, x29
sub x15, x15, #252
mov x14, #56
add x15, x15, x14
mov w8, #15
str w8, [x15]
mov x15, x29
sub x15, x15, #316
mov w8, #1
str w8, [x15]
mov x15, x29
sub x15, x15, #316
mov x14, #4
add x15, x15, x14
mov w8, #2
str w8, [x15]
mov x15, x29
sub x15, x15, #316
mov x14, #8
add x15, x15, x14
mov w8, #3
str w8, [x15]
mov x15, x29
sub x15, x15, #316
mov x14, #12
add x15, x15, x14
mov w8, #4
str w8, [x15]
mov x15, x29
sub x15, x15, #316
mov x14, #16
add x15, x15, x14
mov w8, #5
str w8, [x15]
mov x15, x29
sub x15, x15, #316
mov x14, #20
add x15, x15, x14
mov w8, #6
str w8, [x15]
mov x15, x29
sub x15, x15, #316
mov x14, #24
add x15, x15, x14
mov w8, #7
str w8, [x15]
mov x15, x29
sub x15, x15, #316
mov x14, #28
add x15, x15, x14
mov w8, #8
str w8, [x15]
mov x15, x29
sub x15, x15, #316
mov x14, #32
add x15, x15, x14
mov w8, #9
str w8, [x15]
mov x15, x29
sub x15, x15, #316
mov x14, #36
add x15, x15, x14
mov w8, #10
str w8, [x15]
mov x15, x29
sub x15, x15, #316
mov x14, #40
add x15, x15, x14
mov w8, #11
str w8, [x15]
mov x15, x29
sub x15, x15, #316
mov x14, #44
add x15, x15, x14
mov w8, #12
str w8, [x15]
mov x15, x29
sub x15, x15, #316
mov x14, #48
add x15, x15, x14
mov w8, #13
str w8, [x15]
mov x15, x29
sub x15, x15, #316
mov x14, #52
add x15, x15, x14
mov w8, #14
str w8, [x15]
mov x15, x29
sub x15, x15, #316
mov x14, #56
add x15, x15, x14
mov w8, #15
str w8, [x15]
mov x15, x29
sub x15, x15, #404
mov w8, #1
str w8, [x15]
mov x15, x29
sub x15, x15, #404
mov x14, #4
add x15, x15, x14
mov w8, #2
str w8, [x15]
mov x15, x29
sub x15, x15, #404
mov x14, #8
add x15, x15, x14
mov w8, #3
str w8, [x15]
mov x15, x29
sub x15, x15, #404
mov x14, #12
add x15, x15, x14
mov w8, #4
str w8, [x15]
mov x15, x29
sub x15, x15, #404
mov x14, #16
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #404
mov x14, #20
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #404
mov x14, #24
add x15, x15, x14
mov w8, #7
str w8, [x15]
mov x15, x29
sub x15, x15, #404
mov x14, #28
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #404
mov x14, #32
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #404
mov x14, #36
add x15, x15, x14
mov w8, #10
str w8, [x15]
mov x15, x29
sub x15, x15, #404
mov x14, #40
add x15, x15, x14
mov w8, #11
str w8, [x15]
mov x15, x29
sub x15, x15, #404
mov x14, #44
add x15, x15, x14
mov w8, #12
str w8, [x15]
mov x15, x29
sub x15, x15, #404
mov x14, #48
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #404
mov x14, #52
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #404
mov x14, #56
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov w8, #1
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #4
add x15, x15, x14
mov w8, #2
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #8
add x15, x15, x14
mov w8, #3
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #12
add x15, x15, x14
mov w8, #4
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #16
add x15, x15, x14
mov w8, #5
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #20
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #24
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #28
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #32
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #36
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #40
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #44
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #48
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #52
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #56
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #60
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #64
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #68
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #72
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #76
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #80
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #84
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #88
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov x15, x29
sub x15, x15, #520
mov x14, #92
add x15, x15, x14
mov w8, #0
str w8, [x15]
mov w0, #4
add sp, sp, #528
ldp x29, x30, [sp], #16
ret

Binary file not shown.

@ -0,0 +1,189 @@
.data
.globl a0
.p2align 2
a0:
.word 0
.word 0
.word 0
.globl b0
.p2align 2
b0:
.word 0
.word 1
.word 0
.word 0
.globl c0
.p2align 2
c0:
.word 2
.word 8
.word 6
.word 3
.word 9
.word 1
.word 5
.globl d0
.p2align 2
d0:
.zero 44
.globl e0
.p2align 2
e0:
.word 22
.word 33
.globl f0
.p2align 2
f0:
.zero 24
.globl g0
.p2align 2
g0:
.word 85
.word 0
.word 1
.word 29
.word 0
.word 0
.word 0
.word 0
.word 0
.globl a
.p2align 2
a:
.zero 60
.globl b
.p2align 2
b:
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.globl c
.p2align 2
c:
.word 1
.word 2
.word 3
.word 4
.word 5
.word 6
.word 7
.word 8
.word 9
.word 10
.word 11
.word 12
.word 13
.word 14
.word 15
.globl d
.p2align 2
d:
.word 1
.word 2
.word 3
.word 4
.word 5
.word 6
.word 7
.word 8
.word 9
.word 10
.word 11
.word 12
.word 13
.word 14
.word 15
.globl e
.p2align 2
e:
.word 1
.word 2
.word 3
.word 4
.word 5
.word 6
.word 7
.word 8
.word 9
.word 10
.word 11
.word 12
.word 13
.word 14
.word 15
.globl f
.p2align 2
f:
.zero 20
.globl g
.p2align 2
g:
.word 1
.word 2
.word 3
.word 4
.word 0
.word 0
.word 7
.word 0
.word 0
.word 10
.word 11
.word 12
.word 0
.word 0
.word 0
.globl h
.p2align 2
h:
.zero 12
.globl i
.p2align 2
i:
.word 1
.word 2
.word 3
.word 4
.word 5
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.text
.globl main
.p2align 2
main:
.L.main.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
mov w0, #5
ldp x29, x30, [sp], #16
ret

Binary file not shown.

@ -0,0 +1,729 @@
.data
.globl n
.p2align 2
n:
.word 0
.globl m
.p2align 2
m:
.word 0
.globl maxn
.p2align 2
maxn:
.word 1005
.globl maxm
.p2align 2
maxm:
.word 5005
.globl to
.p2align 2
to:
.zero 20020
.globl next
.p2align 2
next:
.zero 20020
.globl head
.p2align 2
head:
.zero 4020
.globl cnt
.p2align 2
cnt:
.word 0
.globl que
.p2align 2
que:
.zero 4020
.globl h
.p2align 2
h:
.word 0
.globl tail
.p2align 2
tail:
.word 0
.globl inq
.p2align 2
inq:
.zero 4020
.text
.globl quick_read
.p2align 2
quick_read:
.L.quick_read.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #64
bl getch
stur w0, [x29, #-16]
ldur w8, [x29, #-16]
stur w8, [x29, #-4]
mov w8, #0
stur w8, [x29, #-8]
mov w8, #0
stur w8, [x29, #-12]
b .L.quick_read.1
.L.quick_read.1:
ldur w8, [x29, #-4]
stur w8, [x29, #-20]
ldur w8, [x29, #-20]
mov w9, #48
cmp w8, w9
b.lt .L.quick_read.2
b .L.quick_read.4
.L.quick_read.2:
ldur w8, [x29, #-4]
stur w8, [x29, #-24]
ldur w8, [x29, #-24]
mov w9, #45
cmp w8, w9
b.eq .L.quick_read.5
b .L.quick_read.6
.L.quick_read.3:
b .L.quick_read.7
.L.quick_read.4:
ldur w8, [x29, #-4]
stur w8, [x29, #-28]
ldur w8, [x29, #-28]
mov w9, #57
cmp w8, w9
b.gt .L.quick_read.2
b .L.quick_read.3
.L.quick_read.5:
mov w8, #1
stur w8, [x29, #-12]
b .L.quick_read.6
.L.quick_read.6:
bl getch
stur w0, [x29, #-32]
ldur w8, [x29, #-32]
stur w8, [x29, #-4]
b .L.quick_read.1
.L.quick_read.7:
ldur w8, [x29, #-4]
stur w8, [x29, #-36]
ldur w8, [x29, #-36]
mov w9, #48
cmp w8, w9
b.ge .L.quick_read.10
b .L.quick_read.9
.L.quick_read.8:
ldur w8, [x29, #-8]
stur w8, [x29, #-40]
ldur w8, [x29, #-4]
stur w8, [x29, #-44]
ldur w8, [x29, #-40]
mov w11, #10
mul w8, w8, w11
ldur w10, [x29, #-44]
add w8, w8, w10
mov w9, #48
sub w8, w8, w9
stur w8, [x29, #-8]
bl getch
stur w0, [x29, #-48]
ldur w8, [x29, #-48]
stur w8, [x29, #-4]
b .L.quick_read.7
.L.quick_read.9:
ldur w8, [x29, #-12]
stur w8, [x29, #-52]
ldur w8, [x29, #-52]
mov w9, #0
cmp w8, w9
b.ne .L.quick_read.11
b .L.quick_read.12
.L.quick_read.10:
ldur w8, [x29, #-4]
stur w8, [x29, #-56]
ldur w8, [x29, #-56]
mov w9, #57
cmp w8, w9
b.le .L.quick_read.8
b .L.quick_read.9
.L.quick_read.11:
ldur w8, [x29, #-8]
stur w8, [x29, #-60]
mov w0, #0
ldur w8, [x29, #-60]
sub w0, w0, w8
add sp, sp, #64
ldp x29, x30, [sp], #16
ret
.L.quick_read.12:
ldur w8, [x29, #-8]
stur w8, [x29, #-64]
ldur w0, [x29, #-64]
add sp, sp, #64
ldp x29, x30, [sp], #16
ret
.L.quick_read.13:
mov w0, #0
add sp, sp, #64
ldp x29, x30, [sp], #16
ret
.text
.globl add_edge
.p2align 2
add_edge:
.L.add_edge.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #80
stur w0, [x29, #-4]
stur w1, [x29, #-8]
ldur w8, [x29, #-4]
stur w8, [x29, #-12]
ldur w8, [x29, #-8]
stur w8, [x29, #-16]
adrp x13, cnt
ldr w8, [x13, #:lo12:cnt]
stur w8, [x29, #-20]
ldur w8, [x29, #-16]
stur w8, [x29, #-24]
adrp x15, to
add x15, x15, :lo12:to
ldur w14, [x29, #-20]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldur w8, [x29, #-24]
str w8, [x15]
adrp x13, cnt
ldr w8, [x13, #:lo12:cnt]
stur w8, [x29, #-28]
ldur w8, [x29, #-12]
stur w8, [x29, #-32]
adrp x15, head
add x15, x15, :lo12:head
ldur w14, [x29, #-32]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldr w8, [x15]
stur w8, [x29, #-36]
adrp x15, next
add x15, x15, :lo12:next
ldur w14, [x29, #-28]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldur w8, [x29, #-36]
str w8, [x15]
ldur w8, [x29, #-12]
stur w8, [x29, #-40]
adrp x13, cnt
ldr w8, [x13, #:lo12:cnt]
stur w8, [x29, #-44]
adrp x15, head
add x15, x15, :lo12:head
ldur w14, [x29, #-40]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldur w8, [x29, #-44]
str w8, [x15]
adrp x13, cnt
ldr w8, [x13, #:lo12:cnt]
stur w8, [x29, #-48]
ldur w8, [x29, #-48]
mov w9, #1
add w8, w8, w9
adrp x13, cnt
str w8, [x13, #:lo12:cnt]
adrp x13, cnt
ldr w8, [x13, #:lo12:cnt]
stur w8, [x29, #-52]
ldur w8, [x29, #-12]
stur w8, [x29, #-56]
adrp x15, to
add x15, x15, :lo12:to
ldur w14, [x29, #-52]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldur w8, [x29, #-56]
str w8, [x15]
adrp x13, cnt
ldr w8, [x13, #:lo12:cnt]
stur w8, [x29, #-60]
ldur w8, [x29, #-16]
stur w8, [x29, #-64]
adrp x15, head
add x15, x15, :lo12:head
ldur w14, [x29, #-64]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldr w8, [x15]
stur w8, [x29, #-68]
adrp x15, next
add x15, x15, :lo12:next
ldur w14, [x29, #-60]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldur w8, [x29, #-68]
str w8, [x15]
ldur w8, [x29, #-16]
stur w8, [x29, #-72]
adrp x13, cnt
ldr w8, [x13, #:lo12:cnt]
stur w8, [x29, #-76]
adrp x15, head
add x15, x15, :lo12:head
ldur w14, [x29, #-72]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldur w8, [x29, #-76]
str w8, [x15]
adrp x13, cnt
ldr w8, [x13, #:lo12:cnt]
stur w8, [x29, #-80]
ldur w8, [x29, #-80]
mov w9, #1
add w8, w8, w9
adrp x13, cnt
str w8, [x13, #:lo12:cnt]
add sp, sp, #80
ldp x29, x30, [sp], #16
ret
.text
.globl init
.p2align 2
init:
.L.init.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #16
mov w8, #0
stur w8, [x29, #-4]
b .L.init.1
.L.init.1:
ldur w8, [x29, #-4]
stur w8, [x29, #-8]
ldur w8, [x29, #-8]
mov w9, #1005
cmp w8, w9
b.lt .L.init.2
b .L.init.3
.L.init.2:
ldur w8, [x29, #-4]
stur w8, [x29, #-12]
adrp x15, head
add x15, x15, :lo12:head
ldur w14, [x29, #-12]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
mov w8, #-1
str w8, [x15]
ldur w8, [x29, #-4]
stur w8, [x29, #-16]
ldur w8, [x29, #-16]
mov w9, #1
add w8, w8, w9
stur w8, [x29, #-4]
b .L.init.1
.L.init.3:
add sp, sp, #16
ldp x29, x30, [sp], #16
ret
.text
.globl inqueue
.p2align 2
inqueue:
.L.inqueue.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #32
stur w0, [x29, #-4]
ldur w8, [x29, #-4]
stur w8, [x29, #-8]
ldur w8, [x29, #-8]
stur w8, [x29, #-12]
adrp x15, inq
add x15, x15, :lo12:inq
ldur w14, [x29, #-12]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
mov w8, #1
str w8, [x15]
adrp x13, tail
ldr w8, [x13, #:lo12:tail]
stur w8, [x29, #-16]
ldur w8, [x29, #-16]
mov w9, #1
add w8, w8, w9
adrp x13, tail
str w8, [x13, #:lo12:tail]
adrp x13, tail
ldr w8, [x13, #:lo12:tail]
stur w8, [x29, #-20]
ldur w8, [x29, #-8]
stur w8, [x29, #-24]
adrp x15, que
add x15, x15, :lo12:que
ldur w14, [x29, #-20]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldur w8, [x29, #-24]
str w8, [x15]
add sp, sp, #32
ldp x29, x30, [sp], #16
ret
.text
.globl pop_queue
.p2align 2
pop_queue:
.L.pop_queue.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #32
adrp x13, h
ldr w8, [x13, #:lo12:h]
stur w8, [x29, #-8]
ldur w8, [x29, #-8]
mov w9, #1
add w8, w8, w9
adrp x13, h
str w8, [x13, #:lo12:h]
adrp x13, h
ldr w8, [x13, #:lo12:h]
stur w8, [x29, #-12]
adrp x15, que
add x15, x15, :lo12:que
ldur w14, [x29, #-12]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldr w8, [x15]
stur w8, [x29, #-16]
ldur w8, [x29, #-16]
stur w8, [x29, #-4]
adrp x13, h
ldr w8, [x13, #:lo12:h]
stur w8, [x29, #-20]
adrp x15, que
add x15, x15, :lo12:que
ldur w14, [x29, #-20]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldr w8, [x15]
stur w8, [x29, #-24]
ldur w0, [x29, #-24]
add sp, sp, #32
ldp x29, x30, [sp], #16
ret
.text
.globl same
.p2align 2
same:
.L.same.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #128
stur w0, [x29, #-4]
stur w1, [x29, #-8]
ldur w8, [x29, #-4]
stur w8, [x29, #-28]
ldur w8, [x29, #-8]
stur w8, [x29, #-32]
mov w8, #0
adrp x13, h
str w8, [x13, #:lo12:h]
mov w8, #0
adrp x13, tail
str w8, [x13, #:lo12:tail]
ldur w8, [x29, #-28]
stur w8, [x29, #-36]
ldur w0, [x29, #-36]
bl inqueue
mov w8, #0
stur w8, [x29, #-12]
b .L.same.1
.L.same.1:
adrp x13, h
ldr w8, [x13, #:lo12:h]
stur w8, [x29, #-40]
adrp x13, tail
ldr w8, [x13, #:lo12:tail]
stur w8, [x29, #-44]
ldur w8, [x29, #-40]
ldur w9, [x29, #-44]
cmp w8, w9
b.lt .L.same.2
b .L.same.3
.L.same.2:
bl pop_queue
stur w0, [x29, #-48]
ldur w8, [x29, #-48]
stur w8, [x29, #-16]
ldur w8, [x29, #-16]
stur w8, [x29, #-52]
ldur w8, [x29, #-32]
stur w8, [x29, #-56]
ldur w8, [x29, #-52]
ldur w9, [x29, #-56]
cmp w8, w9
b.eq .L.same.4
b .L.same.5
.L.same.3:
mov w8, #0
stur w8, [x29, #-24]
b .L.same.11
.L.same.4:
mov w8, #1
stur w8, [x29, #-12]
b .L.same.5
.L.same.5:
ldur w8, [x29, #-16]
stur w8, [x29, #-60]
adrp x15, head
add x15, x15, :lo12:head
ldur w14, [x29, #-60]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldr w8, [x15]
stur w8, [x29, #-64]
ldur w8, [x29, #-64]
stur w8, [x29, #-20]
b .L.same.6
.L.same.6:
ldur w8, [x29, #-20]
stur w8, [x29, #-68]
ldur w8, [x29, #-68]
mov w9, #-1
cmp w8, w9
b.ne .L.same.7
b .L.same.8
.L.same.7:
ldur w8, [x29, #-20]
stur w8, [x29, #-72]
adrp x15, to
add x15, x15, :lo12:to
ldur w14, [x29, #-72]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldr w8, [x15]
stur w8, [x29, #-76]
adrp x15, inq
add x15, x15, :lo12:inq
ldur w14, [x29, #-76]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldr w8, [x15]
stur w8, [x29, #-80]
ldur w8, [x29, #-80]
mov w9, #0
cmp w8, w9
b.eq .L.same.9
b .L.same.10
.L.same.8:
b .L.same.1
.L.same.9:
ldur w8, [x29, #-20]
stur w8, [x29, #-84]
adrp x15, to
add x15, x15, :lo12:to
ldur w14, [x29, #-84]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldr w8, [x15]
stur w8, [x29, #-88]
ldur w0, [x29, #-88]
bl inqueue
b .L.same.10
.L.same.10:
ldur w8, [x29, #-20]
stur w8, [x29, #-92]
adrp x15, next
add x15, x15, :lo12:next
ldur w14, [x29, #-92]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldr w8, [x15]
stur w8, [x29, #-96]
ldur w8, [x29, #-96]
stur w8, [x29, #-20]
b .L.same.6
.L.same.11:
ldur w8, [x29, #-24]
stur w8, [x29, #-100]
adrp x13, tail
ldr w8, [x13, #:lo12:tail]
stur w8, [x29, #-104]
ldur w8, [x29, #-100]
ldur w9, [x29, #-104]
cmp w8, w9
b.le .L.same.12
b .L.same.13
.L.same.12:
ldur w8, [x29, #-24]
stur w8, [x29, #-108]
adrp x15, que
add x15, x15, :lo12:que
ldur w14, [x29, #-108]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldr w8, [x15]
stur w8, [x29, #-112]
adrp x15, inq
add x15, x15, :lo12:inq
ldur w14, [x29, #-112]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
mov w8, #0
str w8, [x15]
ldur w8, [x29, #-24]
stur w8, [x29, #-116]
ldur w8, [x29, #-116]
mov w9, #1
add w8, w8, w9
stur w8, [x29, #-24]
b .L.same.11
.L.same.13:
ldur w8, [x29, #-12]
stur w8, [x29, #-120]
ldur w0, [x29, #-120]
add sp, sp, #128
ldp x29, x30, [sp], #16
ret
.text
.globl main
.p2align 2
main:
.L.main.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #96
bl quick_read
stur w0, [x29, #-24]
ldur w8, [x29, #-24]
adrp x13, n
str w8, [x13, #:lo12:n]
bl quick_read
stur w0, [x29, #-28]
ldur w8, [x29, #-28]
adrp x13, m
str w8, [x13, #:lo12:m]
bl init
b .L.main.1
.L.main.1:
adrp x13, m
ldr w8, [x13, #:lo12:m]
stur w8, [x29, #-32]
ldur w8, [x29, #-32]
mov w9, #0
cmp w8, w9
b.ne .L.main.2
b .L.main.3
.L.main.2:
bl getch
stur w0, [x29, #-36]
ldur w8, [x29, #-36]
stur w8, [x29, #-4]
b .L.main.4
.L.main.3:
mov w0, #0
add sp, sp, #96
ldp x29, x30, [sp], #16
ret
.L.main.4:
ldur w8, [x29, #-4]
stur w8, [x29, #-40]
ldur w8, [x29, #-40]
mov w9, #81
cmp w8, w9
b.ne .L.main.7
b .L.main.6
.L.main.5:
bl getch
stur w0, [x29, #-44]
ldur w8, [x29, #-44]
stur w8, [x29, #-4]
b .L.main.4
.L.main.6:
ldur w8, [x29, #-4]
stur w8, [x29, #-48]
ldur w8, [x29, #-48]
mov w9, #81
cmp w8, w9
b.eq .L.main.8
b .L.main.9
.L.main.7:
ldur w8, [x29, #-4]
stur w8, [x29, #-52]
ldur w8, [x29, #-52]
mov w9, #85
cmp w8, w9
b.ne .L.main.5
b .L.main.6
.L.main.8:
bl quick_read
stur w0, [x29, #-56]
ldur w8, [x29, #-56]
stur w8, [x29, #-8]
bl quick_read
stur w0, [x29, #-60]
ldur w8, [x29, #-60]
stur w8, [x29, #-12]
ldur w8, [x29, #-8]
stur w8, [x29, #-64]
ldur w8, [x29, #-12]
stur w8, [x29, #-68]
ldur w0, [x29, #-64]
ldur w1, [x29, #-68]
bl same
stur w0, [x29, #-72]
ldur w0, [x29, #-72]
bl putint
mov w0, #10
bl putch
b .L.main.10
.L.main.9:
bl quick_read
stur w0, [x29, #-76]
ldur w8, [x29, #-76]
stur w8, [x29, #-16]
bl quick_read
stur w0, [x29, #-80]
ldur w8, [x29, #-80]
stur w8, [x29, #-20]
ldur w8, [x29, #-16]
stur w8, [x29, #-84]
ldur w8, [x29, #-20]
stur w8, [x29, #-88]
ldur w0, [x29, #-84]
ldur w1, [x29, #-88]
bl add_edge
b .L.main.10
.L.main.10:
adrp x13, m
ldr w8, [x13, #:lo12:m]
stur w8, [x29, #-92]
ldur w8, [x29, #-92]
mov w9, #1
sub w8, w8, w9
adrp x13, m
str w8, [x13, #:lo12:m]
b .L.main.1

File diff suppressed because it is too large Load Diff

Binary file not shown.

@ -0,0 +1,617 @@
.data
.globl n
.p2align 2
n:
.word 0
.globl m
.p2align 2
m:
.word 0
.globl maxn
.p2align 2
maxn:
.word 1005
.globl maxm
.p2align 2
maxm:
.word 5005
.globl to
.p2align 2
to:
.zero 20020
.globl next
.p2align 2
next:
.zero 20020
.globl head
.p2align 2
head:
.zero 4020
.globl cnt
.p2align 2
cnt:
.word 0
.globl vis
.p2align 2
vis:
.zero 4020
.text
.globl quick_read
.p2align 2
quick_read:
.L.quick_read.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #64
bl getch
stur w0, [x29, #-16]
ldur w8, [x29, #-16]
stur w8, [x29, #-4]
mov w8, #0
stur w8, [x29, #-8]
mov w8, #0
stur w8, [x29, #-12]
b .L.quick_read.1
.L.quick_read.1:
ldur w8, [x29, #-4]
stur w8, [x29, #-20]
ldur w8, [x29, #-20]
mov w9, #48
cmp w8, w9
b.lt .L.quick_read.2
b .L.quick_read.4
.L.quick_read.2:
ldur w8, [x29, #-4]
stur w8, [x29, #-24]
ldur w8, [x29, #-24]
mov w9, #45
cmp w8, w9
b.eq .L.quick_read.5
b .L.quick_read.6
.L.quick_read.3:
b .L.quick_read.7
.L.quick_read.4:
ldur w8, [x29, #-4]
stur w8, [x29, #-28]
ldur w8, [x29, #-28]
mov w9, #57
cmp w8, w9
b.gt .L.quick_read.2
b .L.quick_read.3
.L.quick_read.5:
mov w8, #1
stur w8, [x29, #-12]
b .L.quick_read.6
.L.quick_read.6:
bl getch
stur w0, [x29, #-32]
ldur w8, [x29, #-32]
stur w8, [x29, #-4]
b .L.quick_read.1
.L.quick_read.7:
ldur w8, [x29, #-4]
stur w8, [x29, #-36]
ldur w8, [x29, #-36]
mov w9, #48
cmp w8, w9
b.ge .L.quick_read.10
b .L.quick_read.9
.L.quick_read.8:
ldur w8, [x29, #-8]
stur w8, [x29, #-40]
ldur w8, [x29, #-4]
stur w8, [x29, #-44]
ldur w8, [x29, #-40]
mov w11, #10
mul w8, w8, w11
ldur w10, [x29, #-44]
add w8, w8, w10
mov w9, #48
sub w8, w8, w9
stur w8, [x29, #-8]
bl getch
stur w0, [x29, #-48]
ldur w8, [x29, #-48]
stur w8, [x29, #-4]
b .L.quick_read.7
.L.quick_read.9:
ldur w8, [x29, #-12]
stur w8, [x29, #-52]
ldur w8, [x29, #-52]
mov w9, #0
cmp w8, w9
b.ne .L.quick_read.11
b .L.quick_read.12
.L.quick_read.10:
ldur w8, [x29, #-4]
stur w8, [x29, #-56]
ldur w8, [x29, #-56]
mov w9, #57
cmp w8, w9
b.le .L.quick_read.8
b .L.quick_read.9
.L.quick_read.11:
ldur w8, [x29, #-8]
stur w8, [x29, #-60]
mov w0, #0
ldur w8, [x29, #-60]
sub w0, w0, w8
add sp, sp, #64
ldp x29, x30, [sp], #16
ret
.L.quick_read.12:
ldur w8, [x29, #-8]
stur w8, [x29, #-64]
ldur w0, [x29, #-64]
add sp, sp, #64
ldp x29, x30, [sp], #16
ret
.L.quick_read.13:
mov w0, #0
add sp, sp, #64
ldp x29, x30, [sp], #16
ret
.text
.globl add_edge
.p2align 2
add_edge:
.L.add_edge.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #80
stur w0, [x29, #-4]
stur w1, [x29, #-8]
ldur w8, [x29, #-4]
stur w8, [x29, #-12]
ldur w8, [x29, #-8]
stur w8, [x29, #-16]
adrp x13, cnt
ldr w8, [x13, #:lo12:cnt]
stur w8, [x29, #-20]
ldur w8, [x29, #-16]
stur w8, [x29, #-24]
adrp x15, to
add x15, x15, :lo12:to
ldur w14, [x29, #-20]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldur w8, [x29, #-24]
str w8, [x15]
adrp x13, cnt
ldr w8, [x13, #:lo12:cnt]
stur w8, [x29, #-28]
ldur w8, [x29, #-12]
stur w8, [x29, #-32]
adrp x15, head
add x15, x15, :lo12:head
ldur w14, [x29, #-32]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldr w8, [x15]
stur w8, [x29, #-36]
adrp x15, next
add x15, x15, :lo12:next
ldur w14, [x29, #-28]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldur w8, [x29, #-36]
str w8, [x15]
ldur w8, [x29, #-12]
stur w8, [x29, #-40]
adrp x13, cnt
ldr w8, [x13, #:lo12:cnt]
stur w8, [x29, #-44]
adrp x15, head
add x15, x15, :lo12:head
ldur w14, [x29, #-40]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldur w8, [x29, #-44]
str w8, [x15]
adrp x13, cnt
ldr w8, [x13, #:lo12:cnt]
stur w8, [x29, #-48]
ldur w8, [x29, #-48]
mov w9, #1
add w8, w8, w9
adrp x13, cnt
str w8, [x13, #:lo12:cnt]
adrp x13, cnt
ldr w8, [x13, #:lo12:cnt]
stur w8, [x29, #-52]
ldur w8, [x29, #-12]
stur w8, [x29, #-56]
adrp x15, to
add x15, x15, :lo12:to
ldur w14, [x29, #-52]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldur w8, [x29, #-56]
str w8, [x15]
adrp x13, cnt
ldr w8, [x13, #:lo12:cnt]
stur w8, [x29, #-60]
ldur w8, [x29, #-16]
stur w8, [x29, #-64]
adrp x15, head
add x15, x15, :lo12:head
ldur w14, [x29, #-64]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldr w8, [x15]
stur w8, [x29, #-68]
adrp x15, next
add x15, x15, :lo12:next
ldur w14, [x29, #-60]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldur w8, [x29, #-68]
str w8, [x15]
ldur w8, [x29, #-16]
stur w8, [x29, #-72]
adrp x13, cnt
ldr w8, [x13, #:lo12:cnt]
stur w8, [x29, #-76]
adrp x15, head
add x15, x15, :lo12:head
ldur w14, [x29, #-72]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldur w8, [x29, #-76]
str w8, [x15]
adrp x13, cnt
ldr w8, [x13, #:lo12:cnt]
stur w8, [x29, #-80]
ldur w8, [x29, #-80]
mov w9, #1
add w8, w8, w9
adrp x13, cnt
str w8, [x13, #:lo12:cnt]
add sp, sp, #80
ldp x29, x30, [sp], #16
ret
.text
.globl init
.p2align 2
init:
.L.init.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #16
mov w8, #0
stur w8, [x29, #-4]
b .L.init.1
.L.init.1:
ldur w8, [x29, #-4]
stur w8, [x29, #-8]
ldur w8, [x29, #-8]
mov w9, #1005
cmp w8, w9
b.lt .L.init.2
b .L.init.3
.L.init.2:
ldur w8, [x29, #-4]
stur w8, [x29, #-12]
adrp x15, head
add x15, x15, :lo12:head
ldur w14, [x29, #-12]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
mov w8, #-1
str w8, [x15]
ldur w8, [x29, #-4]
stur w8, [x29, #-16]
ldur w8, [x29, #-16]
mov w9, #1
add w8, w8, w9
stur w8, [x29, #-4]
b .L.init.1
.L.init.3:
add sp, sp, #16
ldp x29, x30, [sp], #16
ret
.text
.globl clear
.p2align 2
clear:
.L.clear.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #32
mov w8, #1
stur w8, [x29, #-4]
b .L.clear.1
.L.clear.1:
ldur w8, [x29, #-4]
stur w8, [x29, #-8]
adrp x13, n
ldr w8, [x13, #:lo12:n]
stur w8, [x29, #-12]
ldur w8, [x29, #-8]
ldur w9, [x29, #-12]
cmp w8, w9
b.le .L.clear.2
b .L.clear.3
.L.clear.2:
ldur w8, [x29, #-4]
stur w8, [x29, #-16]
adrp x15, vis
add x15, x15, :lo12:vis
ldur w14, [x29, #-16]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
mov w8, #0
str w8, [x15]
ldur w8, [x29, #-4]
stur w8, [x29, #-20]
ldur w8, [x29, #-20]
mov w9, #1
add w8, w8, w9
stur w8, [x29, #-4]
b .L.clear.1
.L.clear.3:
add sp, sp, #32
ldp x29, x30, [sp], #16
ret
.text
.globl same
.p2align 2
same:
.L.same.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #96
stur w0, [x29, #-4]
stur w1, [x29, #-8]
ldur w8, [x29, #-4]
stur w8, [x29, #-20]
ldur w8, [x29, #-8]
stur w8, [x29, #-24]
ldur w8, [x29, #-20]
stur w8, [x29, #-28]
adrp x15, vis
add x15, x15, :lo12:vis
ldur w14, [x29, #-28]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
mov w8, #1
str w8, [x15]
ldur w8, [x29, #-20]
stur w8, [x29, #-32]
ldur w8, [x29, #-24]
stur w8, [x29, #-36]
ldur w8, [x29, #-32]
ldur w9, [x29, #-36]
cmp w8, w9
b.eq .L.same.1
b .L.same.2
.L.same.1:
mov w0, #1
add sp, sp, #96
ldp x29, x30, [sp], #16
ret
.L.same.2:
ldur w8, [x29, #-20]
stur w8, [x29, #-40]
adrp x15, head
add x15, x15, :lo12:head
ldur w14, [x29, #-40]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldr w8, [x15]
stur w8, [x29, #-44]
ldur w8, [x29, #-44]
stur w8, [x29, #-12]
b .L.same.3
.L.same.3:
ldur w8, [x29, #-12]
stur w8, [x29, #-48]
ldur w8, [x29, #-48]
mov w9, #-1
cmp w8, w9
b.ne .L.same.4
b .L.same.5
.L.same.4:
ldur w8, [x29, #-12]
stur w8, [x29, #-52]
adrp x15, to
add x15, x15, :lo12:to
ldur w14, [x29, #-52]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldr w8, [x15]
stur w8, [x29, #-56]
ldur w8, [x29, #-56]
stur w8, [x29, #-16]
ldur w8, [x29, #-16]
stur w8, [x29, #-60]
adrp x15, vis
add x15, x15, :lo12:vis
ldur w14, [x29, #-60]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldr w8, [x15]
stur w8, [x29, #-64]
ldur w8, [x29, #-64]
mov w9, #0
cmp w8, w9
b.eq .L.same.8
b .L.same.7
.L.same.5:
mov w0, #0
add sp, sp, #96
ldp x29, x30, [sp], #16
ret
.L.same.6:
mov w0, #1
add sp, sp, #96
ldp x29, x30, [sp], #16
ret
.L.same.7:
ldur w8, [x29, #-12]
stur w8, [x29, #-68]
adrp x15, next
add x15, x15, :lo12:next
ldur w14, [x29, #-68]
sxtw x14, w14
lsl x14, x14, #2
add x15, x15, x14
ldr w8, [x15]
stur w8, [x29, #-72]
ldur w8, [x29, #-72]
stur w8, [x29, #-12]
b .L.same.3
.L.same.8:
ldur w8, [x29, #-16]
stur w8, [x29, #-76]
ldur w8, [x29, #-24]
stur w8, [x29, #-80]
ldur w0, [x29, #-76]
ldur w1, [x29, #-80]
bl same
stur w0, [x29, #-84]
ldur w8, [x29, #-84]
mov w9, #0
cmp w8, w9
b.ne .L.same.6
b .L.same.7
.text
.globl main
.p2align 2
main:
.L.main.0:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #96
bl quick_read
stur w0, [x29, #-24]
ldur w8, [x29, #-24]
adrp x13, n
str w8, [x13, #:lo12:n]
bl quick_read
stur w0, [x29, #-28]
ldur w8, [x29, #-28]
adrp x13, m
str w8, [x13, #:lo12:m]
bl init
b .L.main.1
.L.main.1:
adrp x13, m
ldr w8, [x13, #:lo12:m]
stur w8, [x29, #-32]
ldur w8, [x29, #-32]
mov w9, #0
cmp w8, w9
b.ne .L.main.2
b .L.main.3
.L.main.2:
bl getch
stur w0, [x29, #-36]
ldur w8, [x29, #-36]
stur w8, [x29, #-4]
b .L.main.4
.L.main.3:
mov w0, #0
add sp, sp, #96
ldp x29, x30, [sp], #16
ret
.L.main.4:
ldur w8, [x29, #-4]
stur w8, [x29, #-40]
ldur w8, [x29, #-40]
mov w9, #81
cmp w8, w9
b.ne .L.main.7
b .L.main.6
.L.main.5:
bl getch
stur w0, [x29, #-44]
ldur w8, [x29, #-44]
stur w8, [x29, #-4]
b .L.main.4
.L.main.6:
ldur w8, [x29, #-4]
stur w8, [x29, #-48]
ldur w8, [x29, #-48]
mov w9, #81
cmp w8, w9
b.eq .L.main.8
b .L.main.9
.L.main.7:
ldur w8, [x29, #-4]
stur w8, [x29, #-52]
ldur w8, [x29, #-52]
mov w9, #85
cmp w8, w9
b.ne .L.main.5
b .L.main.6
.L.main.8:
bl quick_read
stur w0, [x29, #-56]
ldur w8, [x29, #-56]
stur w8, [x29, #-8]
bl quick_read
stur w0, [x29, #-60]
ldur w8, [x29, #-60]
stur w8, [x29, #-12]
bl clear
ldur w8, [x29, #-8]
stur w8, [x29, #-64]
ldur w8, [x29, #-12]
stur w8, [x29, #-68]
ldur w0, [x29, #-64]
ldur w1, [x29, #-68]
bl same
stur w0, [x29, #-72]
ldur w0, [x29, #-72]
bl putint
mov w0, #10
bl putch
b .L.main.10
.L.main.9:
bl quick_read
stur w0, [x29, #-76]
ldur w8, [x29, #-76]
stur w8, [x29, #-16]
bl quick_read
stur w0, [x29, #-80]
ldur w8, [x29, #-80]
stur w8, [x29, #-20]
ldur w8, [x29, #-16]
stur w8, [x29, #-84]
ldur w8, [x29, #-20]
stur w8, [x29, #-88]
ldur w0, [x29, #-84]
ldur w1, [x29, #-88]
bl add_edge
b .L.main.10
.L.main.10:
adrp x13, m
ldr w8, [x13, #:lo12:m]
stur w8, [x29, #-92]
ldur w8, [x29, #-92]
mov w9, #1
sub w8, w8, w9
adrp x13, m
str w8, [x13, #:lo12:m]
b .L.main.1

File diff suppressed because it is too large Load Diff

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save