LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/cyb70289[P]tt/src/apn/integer/mod.c
// Function: tt_int_mont_reduce
int _tt_int_mont_reduce(_tt_word *r, int *msbr, const _tt_word *c, int msbc,
		const _tt_word *u, int msbu, const _tt_word *n, int msbn,
		_tt_word *t)
{
	tt_assert_fa(msbc <= msbn*2);

	/* q = u*c % lambda (TODO: drop 1/4 calculation) */
	_tt_word *q = t;
	memset(q, 0, msbn*2*_tt_word_sz);
	int msbq = _tt_int_mul_buf(q, u, msbu, c, _tt_min(msbc, msbn));
	if (msbq > msbn)
		msbq = _tt_int_get_msb(q, msbn);
	/* Q = c + q*n */
	_tt_word *Q = q + msbq;
	memset(Q, 0, msbn*2*_tt_word_sz);
	int msbQ = _tt_int_mul_buf(Q, q, msbq, n, msbn);
	msbQ = _tt_int_add_buf(Q, msbQ, c, msbc);
	/* r = Q / lambda */
	memset(r, 0, (msbn+1)*_tt_word_sz);
	*msbr = 1;
	if (msbQ > msbn) {
		*msbr = msbQ - msbn;
		memcpy(r, Q+msbn, (*msbr)*_tt_word_sz);
	}
	if (_tt_int_cmp_buf(r, *msbr, n, msbn) >= 0)
		*msbr = _tt_int_sub_buf(r, *msbr, n, msbn);

	tt_assert_fa(_tt_int_cmp_buf(r, *msbr, n, msbn) < 0);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl 0x68(%rsp), %r14d
leal (%r14,%r14), %eax
cmpl %ecx, %eax
jl 0x82ba
movl %ecx, %ebp
movq %rdx, %r12
movq %rsi, 0x10(%rsp)
movq %rdi, 0x20(%rsp)
movq 0x70(%rsp), %r13
movl %r14d, %eax
shll $0x4, %eax
movslq %eax, %rdx
movq %r13, %rdi
xorl %esi, %esi
movq %rdx, 0x8(%rsp)
movq %r8, %r15
movl %r9d, %ebx
callq 0x10e0
cmpl %r14d, %ebp
movl %r14d, %r8d
cmovll %ebp, %r8d
movq %r13, %rdi
movq %r15, %rsi
movl %ebx, %edx
movq %r14, %rbx
movq %r12, 0x18(%rsp)
movq %r12, %rcx
callq 0x5a07
cmpl %ebx, %eax
jle 0x81df
movq 0x70(%rsp), %rdi
movl %ebx, %esi
callq 0x59ea
movslq %eax, %r12
movq 0x70(%rsp), %r15
leaq (%r15,%r12,8), %r13
movq %r13, %rdi
xorl %esi, %esi
movq 0x8(%rsp), %rdx
callq 0x10e0
movq %r13, %rdi
movq %r15, %rsi
movl %r12d, %edx
movq 0x60(%rsp), %r12
movq %r12, %rcx
movl %ebx, %r8d
callq 0x5a07
movq %r13, %rdi
movl %eax, %esi
movq 0x18(%rsp), %rdx
movl %ebp, %ecx
callq 0x58d8
movl %eax, %ebp
leal 0x8(,%rbx,8), %eax
movslq %eax, %rdx
movq 0x20(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x10e0
movq 0x10(%rsp), %r15
movl $0x1, (%r15)
subl %ebx, %ebp
jle 0x826e
movl %ebp, (%r15)
movslq %ebx, %rax
leaq (,%rax,8), %rsi
addq %r13, %rsi
shll $0x3, %ebp
movslq %ebp, %rdx
movq %r14, %rdi
callq 0x1120
movl (%r15), %esi
movq %r14, %rdi
movq %r12, %rdx
movl %ebx, %ecx
callq 0x59b9
testl %eax, %eax
js 0x8295
movl (%r15), %esi
movq %r14, %rdi
movq %r12, %rdx
movl %ebx, %ecx
callq 0x593d
movl %eax, (%r15)
movl (%r15), %esi
movq %r14, %rdi
movq %r12, %rdx
movl %ebx, %ecx
callq 0x59b9
testl %eax, %eax
jns 0x82bf
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x19ee
callq 0x19c6
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/debug.c
// Function: ir_debug_fmt
void ir_debug_fmt(const char *fmt, struct ir_stmt *stmt)
{
	struct ir_operand *cop[3] =
	    { stmt->result, stmt->arg1, stmt->arg2 };
	int len = strlen(fmt);
	if (stmt->type != stmt_label) printf("\t");
	for (int i = 0; i < len; i++) {
		if (fmt[i] == '$' && (i + 1) < len) {
			char c = fmt[i + 1];
			if (c >= '0' && c < '3')
				ir_operand_debug(cop[fmt[i + 1] - '0']);
			else if (c == 'l') printf("%d", stmt->label);
			i++;
		} else if (fmt[i] == '@' && (i + 1) < len) {
			char c = fmt[i + 1];
			if (c >= '0' && c < '3')
				ir_operand_size_debug(cop[fmt[i + 1] - '0']);
			i++;
		} else {
			printf("%c", fmt[i]);
		}
 	}
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rsi), %rax
movq %rax, (%rsp)
movq 0x10(%rsi), %rax
movq %rax, 0x8(%rsp)
movq 0x18(%rsi), %rax
movq %rax, 0x10(%rsp)
callq 0x2070
movq %rax, %r15
cmpl $0x1, (%rbx)
je 0x2494
movl $0x9, %edi
callq 0x2040
testl %r15d, %r15d
jle 0x252d
xorl %ebp, %ebp
movslq %ebp, %r13
movzbl (%r14,%r13), %eax
cmpl $0x40, %eax
je 0x24d9
cmpl $0x24, %eax
jne 0x24ff
leaq 0x1(%r13), %r12
cmpl %r15d, %r12d
jge 0x24d5
movzbl (%r14,%r12), %eax
leal -0x30(%rax), %ecx
cmpb $0x2, %cl
ja 0x2509
andl $0x3, %eax
movq (%rsp,%rax,8), %rdi
callq 0x253c
jmp 0x251f
cmpb $0x40, %al
jne 0x24ff
incq %r13
cmpl %r15d, %r13d
jge 0x24ff
movzbl (%r14,%r13), %eax
leal -0x30(%rax), %ecx
cmpb $0x2, %cl
ja 0x24fa
andl $0x3, %eax
movq (%rsp,%rax,8), %rdi
callq 0x259c
movl %r13d, %ebp
jmp 0x2522
movsbl %al, %edi
callq 0x2040
jmp 0x2522
cmpl $0x6c, %eax
jne 0x251f
movl 0x30(%rbx), %esi
leaq 0x6c5a(%rip), %rdi      # 0x9172
xorl %eax, %eax
callq 0x2080
movl %r12d, %ebp
incl %ebp
cmpl %r15d, %ebp
jl 0x249f
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/debug.c
// Function: ir_operand_debug
void ir_operand_debug(struct ir_operand *oper)
{
	if (!oper) return;
	switch (oper->type) {
		case oper_reg: printf("R%d", oper->val.virt_reg); 	break;
		case oper_sym:
			if (!oper->val.sym) break;
			if (oper->val.sym->offset)
				printf("fp-%ld", oper->val.sym->offset);
			else printf("_%s", oper->val.sym->identifier);
			break;
		case oper_cnum: printf("#%ld", oper->val.constant); 	break;
		default: break;
	}
}

// Assembly:
testq %rdi, %rdi
je 0x257c
movl (%rdi), %eax
cmpl $0x2, %eax
je 0x257d
cmpl $0x1, %eax
je 0x2562
testl %eax, %eax
jne 0x257c
movl 0x8(%rdi), %esi
leaq 0x6c16(%rip), %rdi      # 0x9171
xorl %eax, %eax
jmp 0x2080
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x257c
movq (%rax), %rsi
testq %rsi, %rsi
je 0x258f
leaq 0x6bfb(%rip), %rdi      # 0x9175
jmp 0x2588
retq
movq 0x8(%rdi), %rsi
leaq 0x6bf8(%rip), %rdi      # 0x9180
xorl %eax, %eax
jmp 0x2080
movq 0x10(%rax), %rsi
leaq 0x6be2(%rip), %rdi      # 0x917c
jmp 0x2588
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/debug.c
// Function: ir_operand_size_debug
void ir_operand_size_debug(struct ir_operand *oper)
{
	if (!oper) return;
	/*print size*/
	if (oper->size==0)
		printf("n");
	else if (oper->size==1)
		printf("b");
	else if (oper->size==2)
		printf("w");
	else if (oper->size==4)
		printf("dw");
	else if (oper->size==8)
		printf("qw");
}

// Assembly:
testq %rdi, %rdi
je 0x25c4
movl 0x4(%rdi), %eax
cmpq $0x8, %rax
ja 0x25c4
leaq 0x6a53(%rip), %rcx      # 0x9004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x6e, %edi
jmp 0x2040
retq
movl $0x77, %edi
jmp 0x2040
movl $0x62, %edi
jmp 0x2040
leaq 0x6ba5(%rip), %rdi      # 0x9185
jmp 0x25e9
leaq 0x6b9f(%rip), %rdi      # 0x9188
xorl %eax, %eax
jmp 0x2080
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/debug.c
// Function: ir_debug
void ir_debug(struct ir_stmt *head)
{
	struct ir_stmt *stmt = head;
	int ln = 0;
	while (stmt) {
		printf("%2d: ", ++ln);
		ir_stmt_debug(stmt);
		printf("\n");
		stmt = stmt->next;
	}
}

// Assembly:
testq %rdi, %rdi
je 0x264b
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, %ebp
leaq 0x6b45(%rip), %r14      # 0x9150
leaq 0xba9e(%rip), %r15      # 0xe0b0
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x2080
movl (%rbx), %eax
movq (%r15,%rax,8), %rdi
movq %rbx, %rsi
callq 0x244f
movl $0xa, %edi
callq 0x2040
movq 0x28(%rbx), %rbx
incl %ebp
testq %rbx, %rbx
jne 0x2612
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/debug.c
// Function: symbol_table_debug
void symbol_table_debug(struct symbol_table *scope)
{
	if (!scope)
		return;
	for (int i = 0; i < scope->num_syms; i++) {
		printf("%s: ", scope->syms[i]->identifier);
		print_type(scope->syms[i]->type);
		if ((i + 1) < scope->num_syms)
			printf(", ");
		else
			printf("\n");
	}
}

// Assembly:
testq %rdi, %rdi
je 0x26d0
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x8(%rdi)
jle 0x26c5
leaq 0x6b60(%rip), %r14      # 0x91c9
leaq 0x6b1b(%rip), %r15      # 0x918b
xorl %r12d, %r12d
movq 0x10(%rbx), %rax
movq (%rax,%r12,8), %rax
movq 0x10(%rax), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x2080
movq 0x10(%rbx), %rax
movq (%rax,%r12,8), %rax
movq 0x18(%rax), %rdi
callq 0x81ed
incq %r12
movslq 0x8(%rbx), %rax
cmpq %rax, %r12
jge 0x26b2
movq %r15, %rdi
xorl %eax, %eax
callq 0x2080
jmp 0x26bc
movl $0xa, %edi
callq 0x2040
movslq 0x8(%rbx), %rax
cmpq %rax, %r12
jl 0x2673
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/live.c
// Function: bb_init
struct bb *bb_init(struct ir_stmt *s, struct ir_stmt **next)
{
	struct bb *blk = malloc(sizeof(struct bb));

	blk->succ = NULL, blk->pred = NULL;
	blk->nsucc = 0, blk->npred = 0;

	blk->use = NULL, blk->def = NULL;
	blk->nuse = 0, blk->ndef = 0;

	blk->graph = NULL;
	blk->nvert = 0;

	blk->in = NULL, blk->out = NULL;
	blk->nin = 0, blk->nout = 0;
	blk->visited = 0;

	blk->blk = s;
	int len = 1;
	/*Basic blocks can start at labels but must end at a jump or any label not at the start*/
	while (s) {
		if (s->type == stmt_cgoto || s->type == stmt_ugoto) {
			break;
		}
		if (s->type == stmt_label && len != 1) {
			/*Do not include this*/
			s = s->prev;
			len--;
			break;
		}
		len++;
		s = s->next;
	}
	*next = s ? s->next : NULL;
	blk->lst = s;
	blk->len = len;

	bb_set(blk);

	return blk;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0xa0, %edi
callq 0x2100
movq %rax, %rbx
xorl %ecx, %ecx
movq %rcx, 0x50(%rax)
movq %rcx, 0x60(%rax)
movl %ecx, 0x58(%rax)
movl %ecx, 0x68(%rax)
movq %rcx, 0x70(%rax)
movl %ecx, 0x78(%rax)
movq %rcx, 0x80(%rax)
movl %ecx, 0x88(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rax)
movq %rcx, 0x38(%rax)
movups %xmm0, 0x90(%rax)
movq %r15, (%rax)
testq %r15, %r15
je 0x2c0a
xorl %eax, %eax
movl (%r15), %ecx
leal -0x3(%rcx), %edx
cmpl $0x2, %edx
jb 0x2c11
cmpl $0x1, %ecx
sete %cl
testl %eax, %eax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
je 0x2c18
movq 0x28(%r15), %r15
incl %eax
testq %r15, %r15
jne 0x2bdc
incl %eax
xorl %ecx, %ecx
jmp 0x2c1c
movl $0x1, %eax
jmp 0x2c1c
incl %eax
movq %r15, %rcx
jmp 0x2c1c
movq 0x20(%r15), %rcx
testq %rcx, %rcx
je 0x2c27
movq 0x28(%rcx), %rdx
jmp 0x2c29
xorl %edx, %edx
movq %rdx, (%r14)
movq %rcx, 0x8(%rbx)
movl %eax, 0x10(%rbx)
movq %rbx, %rdi
callq 0x2c44
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/live.c
// Function: bb_free
void bb_free(struct bb *blk)
{
	if (!blk) return;
	for (int i = 0; i < blk->nvert; i++)
		vertex_free(blk->graph[i]);
	free(blk->graph);
	free(blk->succ);
	free(blk->pred);
	free(blk->use);
	free(blk->def);
	free(blk);
}

// Assembly:
testq %rdi, %rdi
je 0x2f3e
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x78(%rdi)
jle 0x2f02
xorl %r14d, %r14d
movq 0x70(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x3e6c
incq %r14
movslq 0x78(%rbx), %rax
cmpq %rax, %r14
jl 0x2ee9
movq 0x70(%rbx), %rdi
callq 0x2030
movq 0x28(%rbx), %rdi
callq 0x2030
movq 0x30(%rbx), %rdi
callq 0x2030
movq 0x50(%rbx), %rdi
callq 0x2030
movq 0x60(%rbx), %rdi
callq 0x2030
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2030
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/live.c
// Function: bb_get_treg
int bb_get_treg(struct bb *blk, int reg)
{
	for (int i = 0; i < blk->nvert; i++) {
		if (blk->graph[i]->ocolor == reg) return i;
	}
	blk->nvert++;
	if (!blk->graph) blk->graph = malloc(sizeof(struct vertex*));
	else blk->graph = realloc(blk->graph, sizeof(struct vertex*)*blk->nvert);
	struct vertex *v = vertex_init();
	v->ocolor = reg;
	blk->graph[blk->nvert-1] = v;
	return blk->nvert-1;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movslq 0x78(%rdi), %rsi
testq %rsi, %rsi
setg %dl
jle 0x2f81
movq 0x70(%rbx), %rcx
movq (%rcx), %rdi
xorl %eax, %eax
cmpl %ebp, (%rdi)
je 0x2f7d
leaq -0x1(%rsi), %rdx
xorl %eax, %eax
cmpq %rax, %rdx
je 0x2f81
movq 0x8(%rcx,%rax,8), %rdi
incq %rax
cmpl %ebp, (%rdi)
jne 0x2f66
cmpq %rsi, %rax
setb %dl
testb %dl, %dl
jne 0x2fc2
incq %rsi
movl %esi, 0x78(%rbx)
movq 0x70(%rbx), %rdi
testq %rdi, %rdi
je 0x2f9b
shlq $0x3, %rsi
callq 0x2110
jmp 0x2fa5
movl $0x8, %edi
callq 0x2100
movq %rax, 0x70(%rbx)
xorl %eax, %eax
callq 0x3de0
movl %ebp, (%rax)
movq 0x70(%rbx), %rcx
movslq 0x78(%rbx), %rdx
movq %rax, -0x8(%rcx,%rdx,8)
leal -0x1(%rdx), %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/live.c
// Function: bb_addpred
void bb_addpred(struct bb *blk, struct bb *pred)
{
	blk->npred++;
	if (!blk->pred) blk->pred = malloc(sizeof(struct bb*));
	else blk->pred = realloc(blk->pred, blk->npred * sizeof(struct bb*));
	blk->pred[blk->npred-1] = pred;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movslq 0x3c(%rdi), %rsi
incq %rsi
movl %esi, 0x3c(%rdi)
movq 0x30(%rdi), %rdi
testq %rdi, %rdi
je 0x2ff1
shlq $0x3, %rsi
callq 0x2110
jmp 0x2ffb
movl $0x8, %edi
callq 0x2100
movq %rax, 0x30(%r14)
movslq 0x3c(%r14), %rcx
movq %rbx, -0x8(%rax,%rcx,8)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/live.c
// Function: bb_addsucc
void bb_addsucc(struct bb *blk, struct bb *succ)
{
	blk->nsucc++;
	if (!blk->succ) blk->succ = malloc(sizeof(struct bb*));
	else blk->succ = realloc(blk->succ, blk->nsucc * sizeof(struct bb*));
	blk->succ[blk->nsucc-1] = succ;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movslq 0x38(%rdi), %rsi
incq %rsi
movl %esi, 0x38(%rdi)
movq 0x28(%rdi), %rdi
testq %rdi, %rdi
je 0x3038
shlq $0x3, %rsi
callq 0x2110
jmp 0x3042
movl $0x8, %edi
callq 0x2100
movq %rax, 0x28(%r14)
movslq 0x38(%r14), %rcx
movq %rbx, -0x8(%rax,%rcx,8)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/live.c
// Function: intarr_add
void intarr_add(int **arr, int *num, int val)
{
	int n = *num, *array = *arr;
	n++;
	if (n == 1) {
		array = malloc(sizeof(int));
	} else {
		array = realloc(array, sizeof(int) * n);
	}

	array[n - 1] = val;

	*num = n;
	*arr = array;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movslq (%rsi), %r15
leaq 0x1(%r15), %r12
testq %r15, %r15
je 0x30a9
movq (%rbx), %rdi
movq %r12, %rsi
shlq $0x2, %rsi
callq 0x2110
jmp 0x30b3
movl $0x4, %edi
callq 0x2100
movl %ebp, (%rax,%r15,4)
movl %r12d, (%r14)
movq %rax, (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/live.c
// Function: use
void use(struct bb *blk, struct ir_stmt *s)
{
	if (s->arg1 && s->arg1->type == oper_reg)
		intarr_add(&blk->use, &blk->nuse, s->arg1->val.virt_reg);
	if (s->arg2 && s->arg2->type == oper_reg)
		intarr_add(&blk->use, &blk->nuse, s->arg2->val.virt_reg);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x10(%rsi), %rax
testq %rax, %rax
je 0x30ee
cmpl $0x0, (%rax)
jne 0x30ee
leaq 0x50(%rbx), %rdi
leaq 0x58(%rbx), %rsi
movl 0x8(%rax), %edx
callq 0x307c
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x30fc
cmpl $0x0, (%rax)
je 0x3104
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x50(%rbx), %rdi
addq $0x58, %rbx
movl 0x8(%rax), %edx
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x307c
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/live.c
// Function: bb_creg
void bb_creg(struct bb *bb)
{
	if (!bb) return;
	if (bb->visited) return;
	bb->visited = 1;
	color_graph(bb->graph, bb->nvert, 4);
	struct ir_stmt *stmt = bb->blk;
	int ln = 0;
	while (stmt && ln < bb->len) {
		struct ir_operand *op[3] = { stmt->result, stmt->arg1, stmt->arg2 };
		for (int i = 0; i < 3; i++) {
			if (op[i] && op[i]->type == oper_reg) {
				/*Find it in the graph*/
				int idx = bb_get_treg(bb, op[i]->val.virt_reg);
				op[i]->val.virt_reg = bb->graph[idx]->color;
			}
		}
		/*Remove useless move statements*/
		if (stmt->type == stmt_move && stmt->result && stmt->arg1) {
			int v1 = stmt->result->val.virt_reg;
			int v2 = stmt->arg1->val.virt_reg;
			if (v1 == v2) {
				stmt->prev->next = stmt->next;
				stmt->next->prev = stmt->prev;
				struct ir_stmt *sv = stmt->prev;
				ir_stmt_free(stmt);
				stmt = sv;
			}
		}
		stmt = stmt->next;
		ln++;
	}
	for (int i = 0; i < bb->nsucc; i++) {
		bb_creg(bb->succ[i]);
	}
}

// Assembly:
testq %rdi, %rdi
je 0x324d
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
cmpl $0x0, 0x9c(%rdi)
jne 0x3240
movl $0x1, 0x9c(%rbx)
movq 0x70(%rbx), %rdi
movl 0x78(%rbx), %esi
movl $0x4, %edx
callq 0x3fb7
movq (%rbx), %r14
testq %r14, %r14
je 0x321e
xorl %r15d, %r15d
cmpl 0x10(%rbx), %r15d
jge 0x321e
movq 0x8(%r14), %rax
movq %rax, (%rsp)
movq 0x10(%r14), %rax
movq %rax, 0x8(%rsp)
movq 0x18(%r14), %rax
movq %rax, 0x10(%rsp)
xorl %r12d, %r12d
movq (%rsp,%r12,8), %r13
testq %r13, %r13
je 0x31c2
cmpl $0x0, (%r13)
jne 0x31c2
movl 0x8(%r13), %esi
movq %rbx, %rdi
callq 0x2f3f
movq 0x70(%rbx), %rcx
cltq
movq (%rcx,%rax,8), %rax
movl 0x4(%rax), %eax
movl %eax, 0x8(%r13)
incq %r12
cmpq $0x3, %r12
jne 0x3195
cmpl $0x6, (%r14)
jne 0x320e
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x320e
movq 0x10(%r14), %rcx
testq %rcx, %rcx
je 0x320e
movl 0x8(%rax), %eax
cmpl 0x8(%rcx), %eax
jne 0x320e
movq 0x20(%r14), %rax
movq 0x28(%r14), %rcx
movq %rcx, 0x28(%rax)
movq 0x28(%r14), %rcx
movq %rax, 0x20(%rcx)
movq 0x20(%r14), %r12
movq %r14, %rdi
callq 0x54f7
movq %r12, %r14
movq 0x28(%r14), %r14
incl %r15d
testq %r14, %r14
jne 0x316e
cmpl $0x0, 0x38(%rbx)
jle 0x3240
xorl %r14d, %r14d
movq 0x28(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x311e
incq %r14
movslq 0x38(%rbx), %rax
cmpq %rax, %r14
jl 0x3227
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/main.c
// Function: test_graph
void test_graph()
{
	int num = 10;
	/*Set up basic graph to color*/
	struct vertex **graph = calloc(num, sizeof(struct vertex*));
	for (int i = 0; i < num; i++) {
		graph[i] = vertex_init();
		graph[i]->ocolor = i;
	}
	/*b c d e f g h j k m*/
	/*0 1 2 3 4 5 6 7 8 9*/
	/*m f e j b k g h d c*/
	/*
Vertex b: color 1: good
Vertex c: color 2: good
Vertex d: color 1: good
Vertex e: color 2: good
Vertex f: color 1: good
Vertex g: color 1: good
Vertex h: color 2: good
Vertex j: color 0: good
Vertex k: color 2: good
Vertex m: color 0: good

	 *
	 * */

	add_edge(graph[0], graph[1]);
	add_edge(graph[0], graph[3]);
	add_edge(graph[0], graph[8]);
	add_edge(graph[0], graph[9]);

	add_edge(graph[1], graph[9]);

	add_edge(graph[2], graph[8]);
	add_edge(graph[2], graph[9]);

	add_edge(graph[3], graph[9]);
	add_edge(graph[3], graph[4]);
	add_edge(graph[3], graph[7]);

	add_edge(graph[4], graph[7]);
	add_edge(graph[4], graph[9]);

	add_edge(graph[5], graph[8]);
	add_edge(graph[5], graph[6]);
	add_edge(graph[5], graph[7]);

	add_edge(graph[6], graph[7]);

	add_edge(graph[7], graph[8]);

	color_graph(graph, num, 3);

	for (int i = 0; i < num; i++)
		printf("Node %d: color %d\n", i, graph[i]->color);

	for (int i = 0; i < num; i++) vertex_free(graph[i]);
	free(graph);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl $0xa, %edi
movl $0x8, %esi
callq 0x20b0
movq %rax, %rbx
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x3de0
movq %rax, (%rbx,%r14,8)
movl %r14d, (%rax)
incq %r14
cmpq $0xa, %r14
jne 0x3492
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x3e04
movq (%rbx), %rdi
movq 0x18(%rbx), %rsi
callq 0x3e04
movq (%rbx), %rdi
movq 0x40(%rbx), %rsi
callq 0x3e04
movq (%rbx), %rdi
movq 0x48(%rbx), %rsi
callq 0x3e04
movq 0x8(%rbx), %rdi
movq 0x48(%rbx), %rsi
callq 0x3e04
movq 0x10(%rbx), %rdi
movq 0x40(%rbx), %rsi
callq 0x3e04
movq 0x10(%rbx), %rdi
movq 0x48(%rbx), %rsi
callq 0x3e04
movq 0x18(%rbx), %rdi
movq 0x48(%rbx), %rsi
callq 0x3e04
movq 0x18(%rbx), %rdi
movq 0x20(%rbx), %rsi
callq 0x3e04
movq 0x18(%rbx), %rdi
movq 0x38(%rbx), %rsi
callq 0x3e04
movq 0x20(%rbx), %rdi
movq 0x38(%rbx), %rsi
callq 0x3e04
movq 0x20(%rbx), %rdi
movq 0x48(%rbx), %rsi
callq 0x3e04
movq 0x28(%rbx), %rdi
movq 0x40(%rbx), %rsi
callq 0x3e04
movq 0x28(%rbx), %rdi
movq 0x30(%rbx), %rsi
callq 0x3e04
movq 0x28(%rbx), %rdi
movq 0x38(%rbx), %rsi
callq 0x3e04
movq 0x30(%rbx), %rdi
movq 0x38(%rbx), %rsi
callq 0x3e04
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rsi
callq 0x3e04
movq %rbx, %rdi
movl $0xa, %esi
movl $0x3, %edx
callq 0x3fb7
leaq 0x5ced(%rip), %r14      # 0x9288
xorl %r15d, %r15d
movq (%rbx,%r15,8), %rax
movl 0x4(%rax), %edx
movq %r14, %rdi
movl %r15d, %esi
xorl %eax, %eax
callq 0x2080
incq %r15
cmpq $0xa, %r15
jne 0x359e
xorl %r14d, %r14d
movq (%rbx,%r14,8), %rdi
callq 0x3e6c
incq %r14
cmpq $0xa, %r14
jne 0x35be
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2030
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/match.c
// Function: find_stmt_match
struct ir_stmt *find_stmt_match(struct pattern_state *state)
{
	if (!state->entry) return NULL;
	int offset = 0, ns = 0;
	struct ir_stmt *iter=NULL, *a=state->entry;

	for (int i = 0; i < state->num_patts; i++) {
		ns = state->plist[i].num_stmt;
		iter = a;
		if (offset + ns > state->num_spatts) {
			break;
		}
		int nm;
		/*first check if the statement types are right*/
		for (nm = 0; nm < ns && iter; nm++, iter=iter->next) {
			if (!match_pattern(state->splist+nm+offset, ns-nm, iter)) {
				break;
			}
		}
		if (nm == ns) {
			a = state->callback(a, state->plist[i].value);
		}

		offset += ns;
	}
	return a;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r12
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x38e4
cmpl $0x0, 0x20(%r12)
jle 0x38e6
xorl %r15d, %r15d
xorl %eax, %eax
movq %r12, 0x8(%rsp)
movq 0x10(%r12), %rcx
movq %r15, %r13
shlq $0x4, %r13
movl (%rcx,%r13), %r14d
leal (%r14,%rax), %ebp
cmpl 0x24(%r12), %ebp
jg 0x38e6
xorl %ebx, %ebx
testl %r14d, %r14d
jle 0x38bd
testq %rdi, %rdi
je 0x38bd
movq %rcx, 0x10(%rsp)
movl %ebp, 0x4(%rsp)
movq %r15, 0x18(%rsp)
cltq
leaq (%rax,%rax,4), %r15
shlq $0x2, %r15
addq 0x18(%r12), %r15
movl %r14d, %ebp
xorl %ebx, %ebx
movq %rdi, 0x20(%rsp)
movq %rdi, %r12
movq %r15, %rdi
movl %ebp, %esi
movq %r12, %rdx
callq 0x38f8
testl %eax, %eax
je 0x38a5
incq %rbx
cmpq %r14, %rbx
jae 0x38a5
movq 0x28(%r12), %r12
decl %ebp
addq $0x14, %r15
testq %r12, %r12
jne 0x387c
movq 0x20(%rsp), %rdi
movq 0x8(%rsp), %r12
movq 0x18(%rsp), %r15
movl 0x4(%rsp), %ebp
movq 0x10(%rsp), %rcx
cmpl %r14d, %ebx
jne 0x38cf
movq 0x8(%rcx,%r13), %rsi
callq *0x8(%r12)
movq %rax, %rdi
incq %r15
movslq 0x20(%r12), %rcx
movl %ebp, %eax
cmpq %rcx, %r15
jl 0x3827
jmp 0x38e6
xorl %edi, %edi
movq %rdi, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/match.c
// Function: match_pattern
int match_pattern(struct stmt_pattern *spat, int max, struct ir_stmt *st)
{
	if (st->type != (*spat).st_type) return 0;

	struct ir_stmt *src = NULL, *dst = NULL;
	struct ir_stmt *cur = st;
	int it = 0;
	while (cur && it < max) {
		if (it > 1 && !src) break;
		if ((spat[it].flags&SRC)) src = cur;
		if ((spat[it].flags&DST)) dst = cur;
		it++;
		cur = cur->next;
	}
	if (!src || !dst) src=st, dst=st;
	struct stmt_pattern pat = *spat;

	if ((pat.flags&LBL)) return dst->label == src->label;

	if (!match_operand(dst, src->result, 	pat.result)) return 0;
	if (!match_operand(dst, src->arg1, 	pat.arg1)) return 0;
	if (!match_operand(dst, src->arg2, 	pat.arg2)) return 0;

	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl (%rdx), %eax
xorl %ebp, %ebp
cmpl 0x4(%rdi), %eax
jne 0x39cc
movq %rdx, %rbx
testl %esi, %esi
jle 0x3958
movl %esi, %ecx
xorl %edx, %edx
movq %rdi, %rsi
xorl %eax, %eax
xorl %r14d, %r14d
movq %rbx, %r8
cmpq $0x2, %rdx
jb 0x392e
testq %rax, %rax
je 0x395d
movl (%rsi), %r9d
testb $0x1, %r9b
cmovneq %r8, %rax
testb $0x2, %r9b
cmovneq %r8, %r14
movq 0x28(%r8), %r8
testq %r8, %r8
je 0x395d
incq %rdx
addq $0x14, %rsi
cmpq %rcx, %rdx
jb 0x3923
jmp 0x395d
xorl %r14d, %r14d
xorl %eax, %eax
testq %rax, %rax
setne %cl
testq %r14, %r14
setne %dl
testb %dl, %cl
cmoveq %rbx, %r14
cmovneq %rax, %rbx
testb $0x4, (%rdi)
jne 0x39bf
movl 0xc(%rdi), %r12d
movl 0x10(%rdi), %r15d
movl 0x8(%rdi), %edx
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x39d7
xorl %ebp, %ebp
testl %eax, %eax
je 0x39cc
movq 0x10(%rbx), %rsi
movq %r14, %rdi
movl %r12d, %edx
callq 0x39d7
testl %eax, %eax
je 0x39cc
movq 0x18(%rbx), %rsi
movq %r14, %rdi
movl %r15d, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x39d7
movl 0x30(%r14), %eax
xorl %ebp, %ebp
cmpl 0x30(%rbx), %eax
sete %bpl
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/match.c
// Function: match_operand
int match_operand(struct ir_stmt *st, struct ir_operand *a, enum oper_pattern pat)
{
	if (!a) return 1;
	if (pat == opat_ignore) return 1;
	if (pat == opat_imm && a->type == oper_cnum) return 1;
	if (pat == opat_reg && a->type == oper_reg) return 1;
	if (pat == opat_mem && a->type == oper_sym) return 1;

	if (pat == opat_result) return compare_operands(a, st->result);
	if (pat == opat_arg1) return compare_operands(a, st->arg1);
	if (pat == opat_arg2) return compare_operands(a, st->arg2);

	return 0;
}

// Assembly:
movl $0x1, %eax
testq %rsi, %rsi
je 0x3a67
cmpl $0x6, %edx
ja 0x3a65
movl %edx, %ecx
leaq 0x5905(%rip), %r8       # 0x92f8
movslq (%r8,%rcx,4), %rcx
addq %r8, %rcx
jmpq *%rcx
cmpl $0x2, (%rsi)
je 0x3a67
leal -0x2(%rdx), %ecx
cmpl $0x4, %ecx
ja 0x3a65
leaq 0x5904(%rip), %r8       # 0x9314
movslq (%r8,%rcx,4), %rcx
addq %r8, %rcx
jmpq *%rcx
cmpl $0x0, (%rsi)
je 0x3a67
leal -0x3(%rdx), %ecx
cmpl $0x3, %ecx
ja 0x3a65
leaq 0x58fb(%rip), %r8       # 0x9328
movslq (%r8,%rcx,4), %rcx
addq %r8, %rcx
jmpq *%rcx
cmpl $0x1, (%rsi)
je 0x3a67
cmpl $0x6, %edx
je 0x3a56
cmpl $0x5, %edx
je 0x3a50
cmpl $0x4, %edx
jne 0x3a65
movq 0x8(%rdi), %rax
jmp 0x3a5a
movq 0x10(%rdi), %rax
jmp 0x3a5a
movq 0x18(%rdi), %rax
movq %rsi, %rdi
movq %rax, %rsi
jmp 0x3a68
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/match.c
// Function: compare_operands
int compare_operands(struct ir_operand *a, struct ir_operand *b)
{
	if (!b || !a) return 0;
	if (a->type != b->type) return 0;
	enum oper_type t = a->type;
	if (t==oper_reg&&a->val.virt_reg==b->val.virt_reg) return 1;
	if (t==oper_cnum&&a->val.constant==b->val.constant) return 1;
	if (t==oper_sym&&a->val.sym&&b->val.sym&&!strcmp(a->val.sym->identifier,b->val.sym->identifier)) return 1;
	return 0;
}

// Assembly:
testq %rsi, %rsi
sete %cl
testq %rdi, %rdi
sete %dl
xorl %eax, %eax
orb %cl, %dl
jne 0x3ae4
movl (%rdi), %ecx
cmpl (%rsi), %ecx
jne 0x3ae4
cmpl $0x2, %ecx
je 0x3aa5
cmpl $0x1, %ecx
je 0x3ab9
testl %ecx, %ecx
jne 0x3ae2
movl 0x8(%rdi), %edx
movl $0x1, %eax
cmpl 0x8(%rsi), %edx
je 0x3ae4
cmpl $0x1, %ecx
je 0x3ab9
cmpl $0x2, %ecx
jne 0x3ae2
movq 0x8(%rdi), %rdx
movl $0x1, %eax
cmpq 0x8(%rsi), %rdx
je 0x3ae4
cmpl $0x1, %ecx
jne 0x3ae2
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x3ae2
movq 0x8(%rsi), %rcx
testq %rcx, %rcx
je 0x3ae2
pushq %rax
movq 0x10(%rax), %rdi
movq 0x10(%rcx), %rsi
callq 0x20c0
testl %eax, %eax
leaq 0x8(%rsp), %rsp
je 0x3ae5
xorl %eax, %eax
retq
movl $0x1, %eax
retq
nop
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/peep.c
// Function: reduce_store_load
struct ir_stmt * reduce_store_load(struct ir_stmt *a)
{
	/*Use the value of the previous store instead of load again*/
	struct ir_stmt *ld = a->next;
	if (!ld) return a;
	/*Change the load to a move, with the previous stores operand as the value*/
	ld->type = stmt_move;
	ir_operand_free(ld->arg1);
	ld->arg1 = copy(a->arg2);
	/*Now all occurances of ld->result can be replaced with ld->arg1 */
	struct ir_stmt *cur = ld->next;
	while (cur) {
		if (compare_operands(ld->result, cur->result)) {
			ir_operand_free(cur->result);
			cur->result = copy(ld->arg1);
		}
		if (compare_operands(ld->result, cur->arg1)) {
			ir_operand_free(cur->arg1);
			cur->arg1 = copy(ld->arg1);
		}
		if (compare_operands(ld->result, cur->arg2)) {
			ir_operand_free(cur->arg2);
			cur->arg2 = copy(ld->arg1);
		}

		cur = cur->next;
	}
	unlink(ld);
	struct ir_stmt *n = ld->next;
	ir_stmt_free(ld);
	return n;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x28(%rdi), %rbx
testq %rbx, %rbx
je 0x3cf7
movl $0x6, (%rbx)
movq 0x10(%rbx), %rdi
callq 0x54ed
movq 0x18(%r14), %rdi
callq 0x53ee
movq %rax, 0x10(%rbx)
movq 0x28(%rbx), %r14
testq %r14, %r14
je 0x3cd1
movq 0x8(%rbx), %rdi
movq 0x8(%r14), %rsi
callq 0x3a68
testl %eax, %eax
je 0x3c7d
movq 0x8(%r14), %rdi
callq 0x54ed
movq 0x10(%rbx), %rdi
callq 0x53ee
movq %rax, 0x8(%r14)
movq 0x8(%rbx), %rdi
movq 0x10(%r14), %rsi
callq 0x3a68
testl %eax, %eax
je 0x3ca4
movq 0x10(%r14), %rdi
callq 0x54ed
movq 0x10(%rbx), %rdi
callq 0x53ee
movq %rax, 0x10(%r14)
movq 0x8(%rbx), %rdi
movq 0x18(%r14), %rsi
callq 0x3a68
testl %eax, %eax
je 0x3ccb
movq 0x18(%r14), %rdi
callq 0x54ed
movq 0x10(%rbx), %rdi
callq 0x53ee
movq %rax, 0x18(%r14)
movq 0x28(%r14), %r14
jmp 0x3c51
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x3ce2
movq 0x28(%rbx), %rcx
movq %rcx, 0x28(%rax)
movq 0x28(%rbx), %r14
testq %r14, %r14
je 0x3cef
movq %rax, 0x20(%r14)
movq %rbx, %rdi
callq 0x54f7
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/peep.c
// Function: reduce_label
struct ir_stmt *reduce_label(struct ir_stmt *a)
{
	/*If there is 2 labels, remove the 2nd and replace all occurances with the first*/
	struct ir_stmt *l2 = a->next;
	if (!l2) return a;
	int sl = l2->label;
	unlink(l2);

	ir_stmt_free(l2);
	struct ir_stmt *cur = a;
	/*loop forward and replace*/
	while (cur) {
		if (cur->label == sl) cur->label = a->label;
		cur = cur->next;
	}
	/*loop backwards and replace*/
	cur = a;
	while (cur) {
		if (cur->label == sl) cur->label = a->label;
		cur = cur->prev;
	}
	return a->prev;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x28(%rdi), %rdi
testq %rdi, %rdi
je 0x3d6e
movl 0x30(%rdi), %ebp
movq 0x20(%rdi), %rax
testq %rax, %rax
je 0x3d25
movq 0x28(%rdi), %rcx
movq %rcx, 0x28(%rax)
movq 0x28(%rdi), %rcx
testq %rcx, %rcx
je 0x3d32
movq %rax, 0x20(%rcx)
callq 0x54f7
testq %rbx, %rbx
je 0x3d6a
movq %rbx, %rax
cmpl %ebp, 0x30(%rax)
jne 0x3d4a
movl 0x30(%rbx), %ecx
movl %ecx, 0x30(%rax)
movq 0x28(%rax), %rax
testq %rax, %rax
jne 0x3d3f
movq %rbx, %rax
cmpl %ebp, 0x30(%rax)
jne 0x3d61
movl 0x30(%rbx), %ecx
movl %ecx, 0x30(%rax)
movq 0x20(%rax), %rax
testq %rax, %rax
jne 0x3d56
movq 0x20(%rbx), %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/ralloc.c
// Function: vertex_init
struct vertex *vertex_init()
{
	struct vertex *v = malloc(sizeof(struct vertex));

	v->siblings = NULL, v->num_siblings = 0;
	v->color = -1, v->ocolor = -1;
	v->removed = 0;

	return v;
}

// Assembly:
pushq %rax
movl $0x20, %edi
callq 0x2100
movq $0x0, 0x10(%rax)
xorl %ecx, %ecx
movl %ecx, 0x18(%rax)
movq $-0x1, (%rax)
movl %ecx, 0x8(%rax)
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/ralloc.c
// Function: vertex_add_edge
void vertex_add_edge(struct vertex *v, struct vertex *v2)
{
	v->num_siblings++;
	if (!v->siblings) v->siblings = malloc(sizeof(struct vertex));
	else v->siblings = realloc(v->siblings, sizeof(struct vertex) * v->num_siblings);
	v->siblings[v->num_siblings-1] = v2;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movslq 0x18(%rdi), %rsi
incq %rsi
movl %esi, 0x18(%rdi)
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x3e4d
shlq $0x5, %rsi
callq 0x2110
jmp 0x3e57
movl $0x20, %edi
callq 0x2100
movq %rax, 0x10(%r14)
movslq 0x18(%r14), %rcx
movq %rbx, -0x8(%rax,%rcx,8)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/ralloc.c
// Function: degree
int degree(struct vertex *v)
{
	int deg = 0;
	for (int i = 0; i < v->num_siblings; i++)
		deg += !v->siblings[i]->removed;
	return deg;
}

// Assembly:
movslq 0x18(%rdi), %rcx
testq %rcx, %rcx
jle 0x3ead
movq 0x10(%rdi), %rdx
xorl %esi, %esi
xorl %eax, %eax
movq (%rdx,%rsi,8), %rdi
cmpl $0x1, 0x8(%rdi)
adcl $0x0, %eax
incq %rsi
cmpq %rsi, %rcx
jne 0x3e99
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/ralloc.c
// Function: push
void push(struct vstk *stk, struct vertex *v)
{
	stk->num_vertices++;
	if (!stk->vertices) stk->vertices = malloc(sizeof(struct vertex*));
	else stk->vertices = realloc(stk->vertices, sizeof(struct vertex*)*stk->num_vertices);
	stk->vertices[stk->num_vertices-1] = v;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movslq 0x8(%rdi), %rsi
incq %rsi
movl %esi, 0x8(%rdi)
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x3ed7
shlq $0x3, %rsi
callq 0x2110
jmp 0x3ee1
movl $0x8, %edi
callq 0x2100
movq %rax, (%r14)
movslq 0x8(%r14), %rcx
movq %rbx, -0x8(%rax,%rcx,8)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/ralloc.c
// Function: pop
struct vertex *pop(struct vstk *stk)
{
	if (!stk->num_vertices) return NULL;
	struct vertex *v = stk->vertices[stk->num_vertices-1];
	stk->num_vertices--;
	if (!stk->num_vertices) {
		free(stk->vertices);
		stk->vertices = NULL;
	} else {
		stk->vertices = realloc(stk->vertices, stk->num_vertices*sizeof(struct vertex*));
	}
	return v;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movslq 0x8(%rdi), %rax
testq %rax, %rax
je 0x3f23
movq %rdi, %r14
movq (%rdi), %rdi
movq -0x8(%rdi,%rax,8), %rbx
decl %eax
movl %eax, 0x8(%r14)
je 0x3f27
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x2110
jmp 0x3f2e
xorl %ebx, %ebx
jmp 0x3f31
callq 0x2030
xorl %eax, %eax
movq %rax, (%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/ralloc.c
// Function: fill_stack
void fill_stack(struct vertex **graph, int num, struct vstk *stk, int k)
{
	if (!k) return;
	for (int i = 0; i < num; i++) {
		if (graph[i]->removed) continue;
		if (degree(graph[i]) < k) {
			graph[i]->removed = 1;
			push(stk, graph[i]);
			fill_stack(graph, num, stk, k);
			break;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
movl %esi, %r12d
testl %ebx, %ebx
je 0x3fae
testl %ebp, %ebp
jle 0x3fae
xorl %eax, %eax
movq (%r15,%rax,8), %rsi
cmpl $0x0, 0x8(%rsi)
jne 0x3f93
movslq 0x18(%rsi), %rcx
testq %rcx, %rcx
jle 0x3f8d
movq 0x10(%rsi), %rdi
xorl %r8d, %r8d
xorl %edx, %edx
movq (%rdi,%r8,8), %r9
cmpl $0x1, 0x8(%r9)
adcl $0x0, %edx
incq %r8
cmpq %r8, %rcx
jne 0x3f77
jmp 0x3f8f
xorl %edx, %edx
cmpl %ebx, %edx
jl 0x3f9d
incq %rax
cmpq %r12, %rax
jne 0x3f5b
jmp 0x3fae
movl $0x1, 0x8(%rsi)
movq %r14, %rdi
callq 0x3eb0
jmp 0x3f51
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/ralloc.c
// Function: color_graph
void color_graph(struct vertex **graph, int num, int k)
{
	struct vstk stk;
	stk.vertices = NULL;
	stk.num_vertices = 0;
	/*Fill the vertex stack with vertex's in kempe order*/
	fill_stack(graph, num, &stk, k);
	/*Array that holds which colors the siblings of a node uses*/
	int *used_colors = calloc(sizeof(int), k);

	struct vertex *v;
	while ((v=pop(&stk))) {
		/*skip precolored nodes*/
		if (v->color > 0) continue;
		int clr = k;
		for (int i = 0; i < k; i++) used_colors[i] = 0;
		for (int i = 0; i < v->num_siblings; i++) {
			if (v->siblings[i]->color >= 0 && v->siblings[i]->color < k)
				used_colors[v->siblings[i]->color] = 1;
		}
		for (int i = 0; i < k; i++) {
			if (!used_colors[i]) {
				clr = i;
				break;
			}
		}
		if (clr >= k) {/*spill*/
			//v->color = k;
		} else {
			printf("Assigned R%d -> %d\n", v->ocolor, clr);
			v->color = clr;
		}
	}
	/*If k < the degree of all nodes, some nodes may not even be in the stack*/
	for (int i = 0; i < num; i++) {
		if (graph[i]->color < 0) {
			printf("Spilled %d\n", graph[i]->ocolor);
		}
	}

	free(stk.vertices);
	free(used_colors);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %r15d
movq %rdi, %rbx
leaq 0x18(%rsp), %r12
movq $0x0, (%r12)
movl $0x0, 0x8(%r12)
movl %esi, 0xc(%rsp)
movq %r12, %rdx
movl %r15d, %ecx
callq 0x3f3c
movslq %r15d, %rsi
movl $0x4, %edi
callq 0x20b0
movq %rax, %r14
movq %r12, %rdi
callq 0x3ef5
testq %rax, %rax
je 0x40cd
movq %rax, %r12
movl %r15d, %ebp
leaq (,%rbp,4), %rax
movq %rax, 0x10(%rsp)
cmpl $0x0, 0x4(%r12)
jg 0x40b7
testl %r15d, %r15d
jle 0x4044
movq %r14, %rdi
xorl %esi, %esi
movq 0x10(%rsp), %rdx
callq 0x2090
movslq 0x18(%r12), %rax
testq %rax, %rax
jle 0x407e
movq 0x10(%r12), %rcx
xorl %edx, %edx
movq (%rcx,%rdx,8), %rsi
movl 0x4(%rsi), %esi
testl %esi, %esi
sets %dil
cmpl %r15d, %esi
setge %r8b
orb %dil, %r8b
jne 0x4076
movl $0x1, (%r14,%rsi,4)
incq %rdx
cmpq %rdx, %rax
jne 0x4055
testl %r15d, %r15d
jle 0x4095
xorl %r13d, %r13d
cmpl $0x0, (%r14,%r13,4)
je 0x4098
incq %r13
cmpq %r13, %rbp
jne 0x4086
movl %ebp, %r13d
cmpl %r15d, %r13d
jge 0x40b7
movl (%r12), %esi
leaq 0x52a8(%rip), %rdi      # 0x9350
movl %r13d, %edx
xorl %eax, %eax
callq 0x2080
movl %r13d, 0x4(%r12)
leaq 0x18(%rsp), %rdi
callq 0x3ef5
movq %rax, %r12
testq %rax, %rax
jne 0x4024
movl 0xc(%rsp), %eax
testl %eax, %eax
jle 0x4100
movl %eax, %r12d
leaq 0x5285(%rip), %r15      # 0x9364
xorl %r13d, %r13d
movq (%rbx,%r13,8), %rax
cmpl $0x0, 0x4(%rax)
jns 0x40f8
movl (%rax), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x2080
incq %r13
cmpq %r13, %r12
jne 0x40e2
movq 0x18(%rsp), %rdi
callq 0x2030
movq %r14, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2030
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/tac.c
// Function: block_emit
void block_emit(struct generator *context, struct block *b)
{
	struct node *p = context->parent;
	context->scope = b->scope;
	for (int i = 0; i < b->num_stmt; i++) {
		generate_from_node(b->stmt_list[i], context, IGNORE);
		/*Merge it into the block*/
		TLIST(p)=merge(TLIST(p), TLIST(b->stmt_list[i]));
		FLIST(p)=merge(FLIST(p), FLIST(b->stmt_list[i]));
	}
	context->scope = b->scope->parent;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x20(%rdi), %r15
movq 0x10(%rsi), %rax
movq %rax, 0x8(%rdi)
cmpl $0x0, 0x8(%rsi)
jle 0x450b
xorl %r12d, %r12d
movq (%r14), %rax
movq (%rax,%r12,8), %rdi
movq %rbx, %rsi
movl $0x3, %edx
callq 0x4161
movq 0x10(%r15), %rax
movq 0x8(%rax), %rdi
movq (%r14), %rax
movq (%rax,%r12,8), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x52f7
movq 0x10(%r15), %rcx
movq %rax, 0x8(%rcx)
movq 0x10(%rcx), %rdi
movq (%r14), %rax
movq (%rax,%r12,8), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rsi
callq 0x52f7
movq 0x10(%r15), %rcx
movq %rax, 0x10(%rcx)
incq %r12
movslq 0x8(%r14), %rax
cmpq %rax, %r12
jl 0x44a7
movq 0x10(%r14), %rax
movq 0x18(%rax), %rax
movq %rax, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/tac.c
// Function: cond_emit
void cond_emit(struct generator *context, struct cond *c)
{
	/*Emit comparison, if false jump to block end, at end of block jump after else block*/
	int start = REQ_LABEL(context), otherwise = REQ_LABEL(context), end = REQ_LABEL(context);
	generate_from_node(c->condition, context, IGNORE);
	/*True is patched to the start of the block, false is patched to where the else block would be*/
	backpatch(TLIST_REF(c->condition), start);
	backpatch(FLIST_REF(c->condition), otherwise);

	emit_label(context, start);
	generate_from_node(c->body, context, IGNORE);
	/*If there is a else block, then emit an unconditional jump to the end of that*/
	if (c->otherwise)
		emit_jump(context, end, UNCONDITIONAL);
	emit_label(context, otherwise);
	/*If else statement exists, then traverse that too*/
	generate_from_node(c->otherwise, context, IGNORE);
	emit_label(context, end);
	/*The body's patched to the parents*/
	if (c->body) {
		TLIST(context->parent) = merge(TLIST(context->parent), TLIST(c->body));
		FLIST(context->parent) = merge(FLIST(context->parent), FLIST(c->body));
	}
	if (c->otherwise) {
		TLIST(context->parent) = merge(TLIST(context->parent), TLIST(c->otherwise));
		FLIST(context->parent) = merge(FLIST(context->parent), FLIST(c->otherwise));
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl 0x4(%rdi), %r12d
leal 0x1(%r12), %r15d
leal 0x2(%r12), %ebp
leal 0x3(%r12), %eax
movl %eax, 0x4(%rdi)
movq (%rsi), %rdi
movq %rbx, %rsi
movl $0x3, %edx
callq 0x4161
movq (%r14), %rax
movq 0x10(%rax), %rdi
addq $0x8, %rdi
movl %r12d, %esi
callq 0x51b7
movq (%r14), %rax
movq 0x10(%rax), %rdi
addq $0x10, %rdi
movl %r15d, %esi
callq 0x51b7
movq %rbx, %rdi
movl %r12d, %esi
callq 0x5151
movq 0x8(%r14), %rdi
movq %rbx, %rsi
movl $0x3, %edx
callq 0x4161
cmpq $0x0, 0x10(%r14)
je 0x45af
movq %rbx, %rdi
movl %ebp, %esi
movl $0x2, %edx
callq 0x527c
movq %rbx, %rdi
movl %r15d, %esi
callq 0x5151
movq 0x10(%r14), %rdi
movq %rbx, %rsi
movl $0x3, %edx
callq 0x4161
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5151
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x4624
movq 0x20(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rdi
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x52f7
movq 0x20(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq %rax, 0x8(%rcx)
movq 0x10(%rcx), %rdi
movq 0x8(%r14), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rsi
callq 0x52f7
movq 0x20(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq %rax, 0x10(%rcx)
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x4673
movq 0x20(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rdi
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x52f7
movq 0x20(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq %rax, 0x8(%rcx)
movq 0x10(%rcx), %rdi
movq 0x10(%r14), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rsi
callq 0x52f7
movq 0x20(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq %rax, 0x10(%rcx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/tac.c
// Function: decl_emit
void decl_emit(struct generator *context, struct declaration *decl)
{
	struct ir_stmt *stmt = ir_stmt_init();
	stmt->type = stmt_alloc;
	alloc_type(context->scope, decl->ident);
	struct symbol *s = get_symbol(context->scope, decl->ident);
	stmt->arg1 = from_sym(s);
	if (decl->initializer) {
		emit(context, stmt);
		stmt = ir_stmt_init();
		stmt->type = stmt_store;
		stmt->arg2 = generate_from_node(decl->initializer, context, VALUE);
		stmt->arg1 = from_sym(s);
	}
	emit(context, stmt);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
movl $0x38, %edi
callq 0x2100
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movups %xmm0, 0x18(%rax)
movq $0x0, 0x28(%rax)
movl $0xffffffff, 0x30(%rax) # imm = 0xFFFFFFFF
movl $0x5, (%rax)
movq 0x8(%rbx), %rdi
movq (%r15), %rsi
callq 0x7f50
movq 0x8(%rbx), %rdi
movq (%r15), %rsi
callq 0x7dfe
movq %rax, %r12
movq %rax, %rdi
callq 0x539a
movq %rax, 0x10(%r14)
cmpq $0x0, 0x10(%r15)
je 0x4758
movq %r14, %rdi
callq 0x545c
cmpq $0x0, 0x10(%rbx)
je 0x4702
movq 0x18(%rbx), %rax
movq %r14, 0x28(%rax)
movq %rax, 0x20(%r14)
jmp 0x4706
movq %r14, 0x10(%rbx)
movq %r14, 0x18(%rbx)
movl $0x38, %edi
callq 0x2100
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movups %xmm0, 0x18(%rax)
movq $0x0, 0x28(%rax)
movl $0xffffffff, 0x30(%rax) # imm = 0xFFFFFFFF
movl $0x12, (%rax)
movq 0x10(%r15), %rdi
movq %rbx, %rsi
movl $0x2, %edx
callq 0x4161
movq %rax, 0x18(%r14)
movq %r12, %rdi
callq 0x539a
movq %rax, 0x10(%r14)
movq %r14, %rdi
callq 0x545c
cmpq $0x0, 0x10(%rbx)
je 0x4779
movq 0x18(%rbx), %rax
addq $0x18, %rbx
movq %r14, 0x28(%rax)
movq %rax, 0x20(%r14)
jmp 0x4781
movq %r14, 0x10(%rbx)
addq $0x18, %rbx
movq %r14, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/tac.c
// Function: loop_emit
void loop_emit(struct generator *context, struct loop *l)
{
	int cmp = REQ_LABEL(context), start = REQ_LABEL(context), end = REQ_LABEL(context);
	generate_from_node(l->init, context, IGNORE);
	/*Unconditional jump to compare block*/
	emit_jump(context, cmp, UNCONDITIONAL);
	emit_label(context, start);
	generate_from_node(l->body, context, IGNORE);
	generate_from_node(l->iter, context, IGNORE);
	emit_label(context, cmp);
	generate_from_node(l->condition, context, IGNORE);
	emit_label(context, end);
	/*True is backpatched to the loop start, false is patched to after the loop ends*/
	backpatch(TLIST_REF(l->condition), start);
	backpatch(FLIST_REF(l->condition), end);
	/*The bodys truelist/falselist are continue/break, so patch to start/end respectively*/
	backpatch(TLIST_REF(l->body), start);
	backpatch(FLIST_REF(l->body), end);
	/*The loop body gets patched up to the parent*/
	if (l->body) {
		TLIST(context->parent) = merge(TLIST(context->parent), TLIST(l->body));
		FLIST(context->parent) = merge(FLIST(context->parent), FLIST(l->body));
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl 0x4(%rdi), %r12d
leal 0x1(%r12), %r15d
leal 0x2(%r12), %ebp
leal 0x3(%r12), %eax
movl %eax, 0x4(%rdi)
movq (%rsi), %rdi
movq %rbx, %rsi
movl $0x3, %edx
callq 0x4161
movq %rbx, %rdi
movl %r12d, %esi
movl $0x2, %edx
callq 0x527c
movq %rbx, %rdi
movl %r15d, %esi
callq 0x5151
movq 0x18(%r14), %rdi
movq %rbx, %rsi
movl $0x3, %edx
callq 0x4161
movq 0x10(%r14), %rdi
movq %rbx, %rsi
movl $0x3, %edx
callq 0x4161
movq %rbx, %rdi
movl %r12d, %esi
callq 0x5151
movq 0x8(%r14), %rdi
movq %rbx, %rsi
movl $0x3, %edx
callq 0x4161
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5151
movq 0x8(%r14), %rax
movq 0x10(%rax), %rdi
addq $0x8, %rdi
movl %r15d, %esi
callq 0x51b7
movq 0x8(%r14), %rax
movq 0x10(%rax), %rdi
addq $0x10, %rdi
movl %ebp, %esi
callq 0x51b7
movq 0x18(%r14), %rax
movq 0x10(%rax), %rdi
addq $0x8, %rdi
movl %r15d, %esi
callq 0x51b7
movq 0x18(%r14), %rax
movq 0x10(%rax), %rdi
addq $0x10, %rdi
movl %ebp, %esi
callq 0x51b7
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x48c4
movq 0x20(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rdi
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x52f7
movq 0x20(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq %rax, 0x8(%rcx)
movq 0x10(%rcx), %rdi
movq 0x18(%r14), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rsi
callq 0x52f7
movq 0x20(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq %rax, 0x10(%rcx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq