// File: /workspace/github_c_makefile_star2_O0/oridb[P]mc/6/main.c
// Function: assemble
static void
assemble(char *asmsrc, char *path)
{
	char *asmcmd[] = Asmcmd;
	char objfile[256];
	char *psuffix;
	char **p, **cmd;
	size_t ncmd, i;
	int pid, status;

	if (outfile != NULL)
		strncpy(objfile, outfile, sizeof(objfile));
	else {
		psuffix = strrchr(path, '+');
		i = 0;
		if (objdir)
			i = bprintf(objfile, sizeof objfile, "%s/", objdir);
		if (psuffix != NULL)
			swapsuffix(objfile + i, sizeof objfile - i, path, psuffix, Objsuffix);
		else
			swapsuffix(objfile + i, sizeof objfile - i, path, ".myr", Objsuffix);
	}
	mkpath(objfile);

	cmd = NULL;
	ncmd = 0;
	for (p = asmcmd; *p != NULL; p++)
		lappend(&cmd, &ncmd, *p);
	lappend(&cmd, &ncmd, objfile);
	lappend(&cmd, &ncmd, asmsrc);
	lappend(&cmd, &ncmd, NULL);

	pid = fork();
	if (pid == -1) {
		die("couldn't fork");
	} else if (pid == 0) {
		if (execvp(cmd[0], cmd) == -1)
			die("Couldn't exec assembler\n");
	} else {
		waitpid(pid, &status, 0);
		if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
			die("Couldn't run assembler");
	}
	if (!writeasm)
		unlink(asmsrc);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x4d9c6(%rip), %rax     # 0x5e640
movq %rax, -0x30(%rbp)
movq 0x4d9c3(%rip), %rax     # 0x5e648
movq %rax, -0x28(%rbp)
movq 0x4d9c0(%rip), %rax     # 0x5e650
movq %rax, -0x20(%rbp)
cmpq $0x0, 0x6c044(%rip)     # 0x7cce0
je 0x10cbb
leaq -0x130(%rbp), %rdi
movq 0x6c034(%rip), %rsi     # 0x7cce0
movl $0x100, %edx            # imm = 0x100
callq 0x6080
jmp 0x10d7d
movq -0x10(%rbp), %rdi
movl $0x2b, %esi
callq 0x6140
movq %rax, -0x138(%rbp)
movq $0x0, -0x158(%rbp)
cmpq $0x0, 0x6c00d(%rip)     # 0x7ccf0
je 0x10d0d
leaq -0x130(%rbp), %rdi
movq 0x6bffd(%rip), %rcx     # 0x7ccf0
movl $0x100, %esi            # imm = 0x100
leaq 0x3cde6(%rip), %rdx     # 0x4dae5
movb $0x0, %al
callq 0x4a230
movq %rax, -0x158(%rbp)
cmpq $0x0, -0x138(%rbp)
je 0x10d4a
leaq -0x130(%rbp), %rdi
addq -0x158(%rbp), %rdi
movl $0x100, %esi            # imm = 0x100
subq -0x158(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x138(%rbp), %rcx
leaq 0x3cdf8(%rip), %r8      # 0x4db3b
callq 0x4a450
jmp 0x10d7b
leaq -0x130(%rbp), %rdi
addq -0x158(%rbp), %rdi
movl $0x100, %esi            # imm = 0x100
subq -0x158(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq 0x3cab6(%rip), %rcx     # 0x4d825
leaq 0x3cdc5(%rip), %r8      # 0x4db3b
callq 0x4a450
jmp 0x10d7d
leaq -0x130(%rbp), %rdi
callq 0x10ef0
movq $0x0, -0x148(%rbp)
movq $0x0, -0x150(%rbp)
leaq -0x30(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rax
cmpq $0x0, (%rax)
je 0x10de8
movq -0x140(%rbp), %rax
movq (%rax), %rdx
leaq -0x148(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x48290
movq -0x140(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x140(%rbp)
jmp 0x10daa
leaq -0x130(%rbp), %rdx
leaq -0x148(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x48290
movq -0x8(%rbp), %rdx
leaq -0x148(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x48290
leaq -0x148(%rbp), %rdi
leaq -0x150(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x48290
callq 0x6350
movl %eax, -0x15c(%rbp)
cmpl $-0x1, -0x15c(%rbp)
jne 0x10e52
leaq 0x3ccf3(%rip), %rdi     # 0x4db3e
movb $0x0, %al
callq 0x1df20
cmpl $0x0, -0x15c(%rbp)
jne 0x10e86
movq -0x148(%rbp), %rax
movq (%rax), %rdi
movq -0x148(%rbp), %rsi
callq 0x6300
cmpl $-0x1, %eax
jne 0x10e84
leaq 0x3cccf(%rip), %rdi     # 0x4db4c
movb $0x0, %al
callq 0x1df20
jmp 0x10ecb
movl -0x15c(%rbp), %edi
leaq -0x160(%rbp), %rsi
xorl %edx, %edx
callq 0x62b0
movl -0x160(%rbp), %eax
andl $0x7f, %eax
cmpl $0x0, %eax
jne 0x10ebb
movl -0x160(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
sarl $0x8, %eax
cmpl $0x0, %eax
je 0x10ec9
leaq 0x3cca3(%rip), %rdi     # 0x4db65
movb $0x0, %al
callq 0x1df20
jmp 0x10ecb
jmp 0x10ecd
cmpl $0x0, 0x6be24(%rip)     # 0x7ccf8
jne 0x10edf
movq -0x8(%rbp), %rdi
callq 0x6070
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
nopl (%rax,%rax)