// File: /workspace/github_c_makefile_star2_O0/xemul[P]cylang/string.c
// Function: format_one
static int format_one(char *str, char **end, struct cy_token *st)
{
	int len, ret;

	*end = strchr(str, ')');
	if (*end == NULL) {
		show_token_err(st, "Error scanning format");
		return -1;
	}

	len = *end - str - 1;

	{
		char fbuf[len + 1], *fmt;
		struct cy_value cv;
		char i_aux[32];

		strncpy(fbuf, str + 1, len);
		fbuf[len] = '\0';

		fmt = strchr(fbuf, ':');
		if (fmt != NULL) {
			*fmt = '\0';
			fmt++;
		}

		if (try_deref_symbol(fbuf, &cv, false) < 0)
			return -1;

		switch (cv.t) {
		case CY_V_STRING:
			append_buf(cv.v_str, strlen(cv.v_str));
			break;
		case CY_V_NUMBER:
			if (fmt == NULL)
				fmt = "%li";
			ret = sprintf(i_aux, fmt, cv.v_i);
			append_buf(i_aux, ret);
			break;
		default:
			show_token_err(st, "Bad symbol (%s) for format", vtype2s(cv.t));
			return -1;
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movl $0x29, %esi
callq 0x3090
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x7197
movq -0x20(%rbp), %rdi
leaq 0x437c(%rip), %rsi      # 0xb500
movb $0x0, %al
callq 0x3310
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x730d
movq -0x18(%rbp), %rax
movl (%rax), %ecx
movl -0x10(%rbp), %eax
notl %eax
addl %ecx, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
incl %eax
movq %rsp, %rcx
movq %rcx, -0x30(%rbp)
movq %rax, %rcx
addq $0xf, %rcx
andq $-0x10, %rcx
movq %rsp, %rdi
subq %rcx, %rdi
movq %rdi, -0x80(%rbp)
movq %rdi, %rsp
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movslq -0x24(%rbp), %rdx
callq 0x3040
movq -0x80(%rbp), %rdi
movslq -0x24(%rbp), %rax
movb $0x0, (%rdi,%rax)
movl $0x3a, %esi
callq 0x3090
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x7214
movq -0x40(%rbp), %rax
movb $0x0, (%rax)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x80(%rbp), %rdi
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x4d60
cmpl $0x0, %eax
jge 0x723b
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x74(%rbp)
jmp 0x72f4
movl -0x50(%rbp), %eax
movl %eax, -0x84(%rbp)
subl $0x1, %eax
je 0x727c
jmp 0x724b
movl -0x84(%rbp), %eax
subl $0x2, %eax
jne 0x72b2
jmp 0x7258
movq -0x48(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x48(%rbp), %rdi
callq 0x3080
movq -0x90(%rbp), %rdi
movl %eax, %esi
callq 0x70d0
jmp 0x72ed
cmpq $0x0, -0x40(%rbp)
jne 0x728e
leaq 0x428c(%rip), %rax      # 0xb516
movq %rax, -0x40(%rbp)
leaq -0x70(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rdx
movb $0x0, %al
callq 0x31e0
movl %eax, -0x28(%rbp)
leaq -0x70(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x70d0
jmp 0x72ed
movq -0x20(%rbp), %rax
movq %rax, -0x98(%rbp)
movl -0x50(%rbp), %edi
callq 0x3400
movq -0x98(%rbp), %rdi
movq %rax, %rdx
leaq 0x4244(%rip), %rsi      # 0xb51a
movb $0x0, %al
callq 0x3310
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x74(%rbp)
jmp 0x72f4
movl $0x0, -0x74(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rsp
movl -0x74(%rbp), %eax
testl %eax, %eax
je 0x7306
jmp 0x7304
jmp 0x730d
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
movq %rbp, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)